u-boot-brain/drivers/pci
Simon Glass 9b69ba4a78 pci: sandbox: Move the emulators into their own node
Sandbox pci works using emulation drivers which are currently children of
the pci device:

	pci-controller {
		pci@1f,0 {
			compatible = "pci-generic";
			reg = <0xf800 0 0 0 0>;
			emul@1f,0 {
				compatible = "sandbox,swap-case";
			};
		};
	};

In this case the emulation device is attached to pci device on address
f800 (device 1f, function 0) and provides the swap-case functionality.

However this is not ideal, since every device on a PCI bus has a child
device. This is only really the case for sandbox, but we want to avoid
special-case code for sandbox.

Worse, child devices cannot be probed before their parents. This forces
us to use 'find' rather than 'get' to obtain the emulator device. In fact
the emulator devices are never probed. There is code in
sandbox_pci_emul_post_probe() which tries to track when emulators are
active, but at present this does not work.

A better approach seems to be to add a separate node elsewhere in the
device tree, an 'emulation parent'. This could be given a bogus address
(such as -1) to hide the emulators away from the 'pci' command, but it
seems better to keep it at the root node to avoid such hacks.

Then we can use a phandle to point from the device to the correct
emulator, and only on sandbox. The code to find an emulator does not
interfere with normal pci operation.

Add a new UCLASS_PCI_EMUL_PARENT uclass which allows finding an emulator
given a bus, and finding a bus given an emulator. Update the existing
device trees and the code for finding an emulator.

This brings PCI emulators more into line with I2C.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fix 3 typos in the commit message;
        encode bus number in the labels of swap_case_emul nodes;
        mention commit 4345998ae9 in sandbox_pci_get_emul()]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08 13:57:41 +08:00
..
fsl_pci_init.c env: Move env_get() to env.h 2019-08-11 16:43:41 -04:00
Kconfig pcie: ti: add driver for AM65x PCIe RC 2019-08-12 13:33:39 -04:00
Makefile pcie: ti: add driver for AM65x PCIe RC 2019-08-12 13:33:39 -04:00
pci_auto_common.c pci: Avoid assigning PCI resources that are below 0x1000 2019-06-21 10:07:11 -04:00
pci_auto_old.c mpc83xx: Make distinct caddy2 config 2019-05-20 13:50:34 +02:00
pci_auto.c mpc83xx: Make distinct caddy2 config 2019-05-20 13:50:34 +02:00
pci_common.c env: Move env_get() to env.h 2019-08-11 16:43:41 -04:00
pci_compat.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_ftpci100.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_gt64120.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_indirect.c pci: Don't use pci_indirect when DM is active 2018-05-08 18:50:23 -04:00
pci_internal.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_msc01.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_mvebu.c pci: pci_mvebu: set BAR0 after memory space is set 2019-08-12 13:59:31 +02:00
pci_rom.c x86: Support PCI VGA ROM when TPL is used 2019-05-08 13:02:16 +08:00
pci_sandbox.c Remove <inttypes.h> includes and PRI* usages in printf() entirely 2018-09-10 20:48:17 -04:00
pci_sh4.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_sh7751.c pci: sh7751: Convert to DM and DT probing 2019-09-02 17:38:43 +02:00
pci_sh7780.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci_tegra.c pci: tegra: introduce weak tegra_pcie_board_port_reset() function 2018-05-10 16:34:21 -07:00
pci_x86.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pci-aardvark.c Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR 2018-04-27 14:54:48 -04:00
pci-emul-uclass.c pci: sandbox: Move the emulators into their own node 2019-10-08 13:57:41 +08:00
pci-rcar-gen2.c pci: rmobile: Filter out device 1 and 2 2018-08-28 11:01:52 +02:00
pci-rcar-gen3.c pci: renesas: Add RCar Gen3 PCIe controller driver 2019-05-21 22:15:31 +02:00
pci-uclass.c x86: fsp: Create a common fsp_support.h header 2019-10-08 13:53:41 +08:00
pci.c env: Move env_get() to env.h 2019-08-11 16:43:41 -04:00
pcie_dw_mvebu.c pcie: designware: mvebu: fix reset release polarity 2019-02-11 09:39:12 +01:00
pcie_dw_ti.c pcie: ti: add driver for AM65x PCIe RC 2019-08-12 13:33:39 -04:00
pcie_ecam_generic.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pcie_fsl_fixup.c dm: pci: add Freescale PowerPC PCIe driver 2019-06-20 10:44:45 +05:30
pcie_fsl.c dm: pcie_fsl: Add MPC8548 PCIe support 2019-08-28 13:47:47 +05:30
pcie_fsl.h dm: pcie_fsl: Fix the calculation of controller index 2019-08-28 13:47:44 +05:30
pcie_imx.c pci: imx: Add DM and DT support 2019-06-11 10:42:48 +02:00
pcie_intel_fpga.c pci: intel: Fix configuration type based on secondary number 2019-08-11 16:43:41 -04:00
pcie_layerscape_fixup.c pci: layerscape: Add the dts fixup for EP and RC 2019-01-17 13:17:40 -08:00
pcie_layerscape_gen4_fixup.c pci: ls_pcie_g4: add device tree fixups for PCI Stream IDs 2019-05-22 12:24:24 +05:30
pcie_layerscape_gen4.c pci: ls_pcie_g4: add device tree fixups for PCI Stream IDs 2019-05-22 12:24:24 +05:30
pcie_layerscape_gen4.h pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs 2019-05-22 12:24:24 +05:30
pcie_layerscape.c pci: layerscape: Do not scan when PEX work in EP mode 2019-01-17 13:17:33 -08:00
pcie_layerscape.h pci: layerscape: Modify the EP and RC mode judge method 2019-01-17 13:17:28 -08:00
pcie_xilinx.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00