mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-04 05:50:17 +00:00 
			
		
		
		
	Apple SoCs have an integrated NVMe controller that isn't connected over a PCIe bus. In preparation for adding support for this NVMe controller, split out the PCI support into its own file. This file is selected through a new CONFIG_NVME_PCI Kconfig option, so do a wholesale replacement of CONFIG_NVME with CONFIG_NVME_PCI. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested on: Macbook Air M1 Tested-by: Simon Glass <sjg@chromium.org>
		
			
				
	
	
		
			50 lines
		
	
	
		
			1023 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1023 B
		
	
	
	
		
			C
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0+
 | 
						|
/*
 | 
						|
 * Copyright (C) 2017 NXP Semiconductors
 | 
						|
 * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
 | 
						|
 */
 | 
						|
 | 
						|
#include <common.h>
 | 
						|
#include <dm.h>
 | 
						|
#include <pci.h>
 | 
						|
#include "nvme.h"
 | 
						|
 | 
						|
static int nvme_bind(struct udevice *udev)
 | 
						|
{
 | 
						|
	static int ndev_num;
 | 
						|
	char name[20];
 | 
						|
 | 
						|
	sprintf(name, "nvme#%d", ndev_num++);
 | 
						|
 | 
						|
	return device_set_name(udev, name);
 | 
						|
}
 | 
						|
 | 
						|
static int nvme_probe(struct udevice *udev)
 | 
						|
{
 | 
						|
	struct nvme_dev *ndev = dev_get_priv(udev);
 | 
						|
	struct pci_child_plat *pplat;
 | 
						|
 | 
						|
	pplat = dev_get_parent_plat(udev);
 | 
						|
	sprintf(ndev->vendor, "0x%.4x", pplat->vendor);
 | 
						|
 | 
						|
	ndev->instance = trailing_strtol(udev->name);
 | 
						|
	ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0,
 | 
						|
			PCI_REGION_MEM);
 | 
						|
	return nvme_init(udev);
 | 
						|
}
 | 
						|
 | 
						|
U_BOOT_DRIVER(nvme) = {
 | 
						|
	.name	= "nvme",
 | 
						|
	.id	= UCLASS_NVME,
 | 
						|
	.bind	= nvme_bind,
 | 
						|
	.probe	= nvme_probe,
 | 
						|
	.priv_auto	= sizeof(struct nvme_dev),
 | 
						|
};
 | 
						|
 | 
						|
struct pci_device_id nvme_supported[] = {
 | 
						|
	{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, ~0) },
 | 
						|
	{}
 | 
						|
};
 | 
						|
 | 
						|
U_BOOT_PCI_DEVICE(nvme, nvme_supported);
 |