pci: Don't use pci_indirect when DM is active
PATCH v2 1/3 pci: Don't use pci_indirect when DM is active
Declaration of indirect PCI bridges is not compatible with DM: Both define PCI operations, but in different ways. Hence, don't use indirect bridges if DM is active.
---
v1 -> v2:
No changes
--- drivers/pci/pci_indirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_indirect.c +1 -1
@@ -8,7 +8,7 @@#include <common.h> -#if !defined(__I386__) +#if !defined(__I386__) && !defined(CONFIG_DM_PCI )#include <asm/processor.h> #include <asm/io.h>
Signature · 1 line
2.16.1
PATCH v2 2/3 mpc83xx/pci: Register IMMR region
Register the IMMR region as a PCI region when PCI is used on MPC83xx.
---
v1 -> v2:
No changes
--- drivers/pci/pci-uclass.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/pci-uclass.c +5 -0
@@ -902,6 +902,11 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node, base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);#endif +#if defined(MPC83xx) && defined(CONFIG_SYS_IMMR ) +pci_set_region (hose->regions + hose->region_count++, +CONFIG_SYS_IMMR ,CONFIG_SYS_IMMR ,0x100000 , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); +#endif return 0 ; }
Signature · 1 line
2.16.1
PATCH v2 2/3 mpc83xx/pci: Register IMMR region
Hi Mario,
Quoted 17 lines · Mario Six
Register the IMMR region as a PCI region when PCI is used on MPC83xx.
Signed-off-by Mario Six <[email protected]>---
v1 -> v2:
No changes--- drivers/pci/pci-uclass.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/pci/pci-uclass.c +0
-0
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, ofnode parent_node, · line 909
Quoted 8 lines
drivers/pci/pci-uclass.c +5
-0@@ -902,6 +902,11 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node, base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);#endif +#if defined(MPC83xx) && defined(CONFIG_SYS_IMMR ) +pci_set_region (hose->regions + hose->region_count++, +CONFIG_SYS_IMMR ,CONFIG_SYS_IMMR ,0x100000 , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); +#endif
Please don't add device-specific code in this file. This could go in the device tree, perhaps. If not, we perhaps need to do it in your PCI driver?
Quoted 6 lines
drivers/pci/pci-uclass.c +0
-1return 0 ; } --2.16.1
Regards,
Simon
PATCH v2 2/3 mpc83xx/pci: Register IMMR region
Hi Simon,
Quoted 23 lines · Simon Glass
Hi Mario,
Quoted 20 lines · Mario Six
Register the IMMR region as a PCI region when PCI is used on MPC83xx.
Signed-off-by Mario Six <[email protected]>---
v1 -> v2:
No changes--- drivers/pci/pci-uclass.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/pci/pci-uclass.c +0
-0@@ -902,6 +902,11 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node, base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);#endif
Quoted 10 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, ofnode parent_node, · line 909
Quoted 5 lines
drivers/pci/pci-uclass.c +5
-0+#if defined(MPC83xx) && defined(CONFIG_SYS_IMMR ) +pci_set_region (hose->regions + hose->region_count++, +CONFIG_SYS_IMMR ,CONFIG_SYS_IMMR ,0x100000 , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); +#endif Please don't add device-specific code in this file. This could go in the device tree, perhaps. If not, we perhaps need to do it in your PCI driver?
OK, I'll try to put it into the DT (I have absolutely no expertise with PCI, so I'm still learning with this one).
Quoted 10 lines
Quoted 6 lines
drivers/pci/pci-uclass.c +0
-1return 0 ; } --2.16.1
Regards,
Simon
Best regards,
Mario
PATCH v2 2/3 mpc83xx/pci: Register IMMR region
Hi Mario,
Quoted 18 lines · Mario Six
Hi Simon,
Quoted 15 lines · Simon Glass
Hi Mario,
Quoted 12 lines · Mario Six
Register the IMMR region as a PCI region when PCI is used on MPC83xx.
Signed-off-by Mario Six <[email protected]>---
v1 -> v2:
No changes--- drivers/pci/pci-uclass.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 5 lines
Quoted 5 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller
Quoted 5 lines
drivers/pci/pci-uclass.c +0
-0@@ -902,6 +902,11 @@ static int decode_regions(struct pci_controller
*hose, ofnode parent_node,
Quoted 1 line
Quoted 1 line
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller · line 902
Quoted 1 line
drivers/pci/pci-uclass.c +0
-0base, size, PCI_REGION_MEM |
PCI_REGION_SYS_MEMORY);
Quoted 13 lines
Quoted 12 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, ofnode parent_node, · line 909
Quoted 7 lines
drivers/pci/pci-uclass.c +5
-0#endif +#if defined(MPC83xx) && defined(CONFIG_SYS_IMMR ) +pci_set_region (hose->regions + hose->region_count++, +CONFIG_SYS_IMMR ,CONFIG_SYS_IMMR ,0x100000 , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); +#endif Please don't add device-specific code in this file. This could go in the device tree, perhaps. If not, we perhaps need to do it in your PCI driver?
Quoted 1 line
OK, I'll try to put it into the DT (I have absolutely no expertise with
PCI, so
Quoted 1 line
I'm still learning with this one).
Here's a possible idea:
decode_regions() is called from the PCI uclass' pre_probe() method. This means that by the time your PCI controller enters the probe() method, all the regions should be set up. So you should be able to add the above code into the probe() method of your PCI controller driver. Perhaps can check a compatible string etc. to decide whether to add this region, if it is no described in the DT itself.
Regards,
Simon
PATCH v2 2/3 mpc83xx/pci: Register IMMR region
Hi Simon,
Quoted 46 lines · Simon Glass
Hi Mario,
Quoted 18 lines · Mario Six
Hi Simon,
Quoted 15 lines · Simon Glass
Hi Mario,
Quoted 12 lines · Mario Six
Register the IMMR region as a PCI region when PCI is used on MPC83xx.
Signed-off-by Mario Six <[email protected]>---
v1 -> v2:
No changes--- drivers/pci/pci-uclass.c | 5 +++++ 1 file changed, 5 insertions(+)Quoted 5 lines
Quoted 5 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller
Quoted 5 lines
drivers/pci/pci-uclass.c +0
-0@@ -902,6 +902,11 @@ static int decode_regions(struct pci_controller*hose, ofnode
parent_node,Quoted 1 line
Quoted 1 line
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller · line 902
Quoted 1 line
drivers/pci/pci-uclass.c +0
-0base, size, PCI_REGION_MEM |
PCI_REGION_SYS_MEMORY);Quoted 13 lines
Quoted 12 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, ofnode parent_node, · line 909
Quoted 7 lines
drivers/pci/pci-uclass.c +5
-0#endif +#if defined(MPC83xx) && defined(CONFIG_SYS_IMMR ) +pci_set_region (hose->regions + hose->region_count++, +CONFIG_SYS_IMMR ,CONFIG_SYS_IMMR ,0x100000 , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); +#endif Please don't add device-specific code in this file. This could go in the device tree, perhaps. If not, we perhaps need to do it in your PCI driver?
Quoted 1 line
OK, I'll try to put it into the DT (I have absolutely no expertise with
PCI, so
Quoted 1 line
I'm still learning with this one).
Quoted 9 lines
Here's a possible idea:
decode_regions()is called from the PCI uclass'pre_probe()method. This means that by the time your PCI controller enters theprobe()method, all the regions should be set up. So you should be able to add the above code into theprobe()method of your PCI controller driver. Perhaps can check a compatible string etc. to decide whether to add this region, if it is no described in the DT itself.
OK, I'll do that for v3, thanks for the explanation.
Quoted 3 lines
Regards,
Simon
Best regards,
Mario
PATCH v2 3/3 pci: Add MPC83xx PCIe driver
In reply to Mario SixAdd a PCIe driver for the MPC83xx architecture.
---
v1 -> v2:
No changes
--- arch/powerpc/cpu/mpc83xx/pcie.c | 4 + drivers/pci/Kconfig | 16 ++ drivers/pci/Makefile | 1 + drivers/pci/pcie_mpc83xx.c | 442 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 463 insertions(+) create mode 100644 drivers/pci/pcie_mpc83xx.c
arch/powerpc/cpu/mpc83xx/pcie.c +4 -0
@@ -8,6 +8,8 @@* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef CONFIG_PCIE_MPC83XX +#include <common.h> #include <pci.h> #include <mpc83xx.h>
@@ -333,3 +335,5 @@ void mpc83xx_pcie_init(int num_buses, struct pci_region **reg)for (i =0 ; i < num_buses; i++) mpc83xx_pcie_init_bus(i, reg[i]); } + +#endif /* !CONFIG_PCIE_MPC83XX */
drivers/pci/Kconfig +16 -0
@@ -69,6 +69,22 @@ config PCI_RCAR_GEN2 Renesas RCar Gen2 SoCs. The PCIe controller on RCar Gen2 is also used to access EHCI USB controller on the SoC. +config PCIE_MPC83XX + bool "MPC83xx PCIe driver support" + depends on DM_PCI + help + Say Y here if you want to enable support for the PCIe controller on + MPC83xx SoCs. + +if PCIE_MPC83XX + +config 83XX_GENERIC_PCIE_REGISTER_HOSES + bool "Register generic hoses" + help + Register generic PCIe hoses when probing the PCIe device. + +endif + config PCI_SANDBOX bool "Sandbox PCI support" depends on SANDBOX && DM_PCI
drivers/pci/Makefile +1 -0
@@ -34,4 +34,5 @@ obj-$(CONFIG_PCI_AARDVARK) += pci-aardvark.o obj-$(CONFIG_PCIE_DW_MVEBU) += pcie_dw_mvebu.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o +obj-$(CONFIG_PCIE_MPC83XX) += pcie_mpc83xx.o obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o
drivers/pci/pcie_mpc83xx.c new file +442 -0
442 lines not on this page · raw message
Signature · 1 line
2.16.1
PATCH v2 1/3 pci: Don't use pci_indirect when DM is active
In reply to Mario SixQuoted 6 lines · Mario Six
Declaration of indirect PCI bridges is not compatible with DM: Both define PCI operations, but in different ways. Hence, don't use indirect bridges if DM is active.
Signed-off-by Mario Six <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180508/2ce9c926/attachment.sig>