From 378b02d7edea56a53cfd51700e0c63c3ee126bbc Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Fri, 8 May 2015 15:17:10 -0700 Subject: pci: imx: display message if no pcie link If CONFIG_PCI_SCAN_SHOW enabled then lets print a message of no link was detected. Signed-off-by: Tim Harvey --- drivers/pci/pcie_imx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/pci') diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c index fd7e4d4..ca485ba 100644 --- a/drivers/pci/pcie_imx.c +++ b/drivers/pci/pcie_imx.c @@ -588,7 +588,9 @@ static int imx_pcie_link_up(void) udelay(10); count++; if (count >= 2000) { - debug("phy link never came up\n"); +#ifdef CONFIG_PCI_SCAN_SHOW + puts("PCI: pcie phy link never came up\n"); +#endif debug("DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n", readl(MX6_DBI_ADDR + PCIE_PHY_DEBUG_R0), readl(MX6_DBI_ADDR + PCIE_PHY_DEBUG_R1)); -- cgit v1.1 From 238fe16c40f640e5b78828b21990a0565f408813 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Thu, 7 May 2015 21:34:07 +0800 Subject: pci: Move pci_hose_phys_to_bus() to pci_common.c pci_hose_phys_to_bus() is needed by several drivers. Move it to pci_common.c to avoid a broken build when CONFIG_DM_PCI is on. Signed-off-by: Bin Meng Acked-by: Simon Glass --- drivers/pci/pci.c | 66 --------------------------------------------- drivers/pci/pci_common.c | 70 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 70 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5b6c6bc..157491c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -186,72 +186,6 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index) return -1; } -/* - * - */ - -int __pci_hose_phys_to_bus(struct pci_controller *hose, - phys_addr_t phys_addr, - unsigned long flags, - unsigned long skip_mask, - pci_addr_t *ba) -{ - struct pci_region *res; - pci_addr_t bus_addr; - int i; - - for (i = 0; i < hose->region_count; i++) { - res = &hose->regions[i]; - - if (((res->flags ^ flags) & PCI_REGION_TYPE) != 0) - continue; - - if (res->flags & skip_mask) - continue; - - bus_addr = phys_addr - res->phys_start + res->bus_start; - - if (bus_addr >= res->bus_start && - bus_addr < res->bus_start + res->size) { - *ba = bus_addr; - return 0; - } - } - - return 1; -} - -pci_addr_t pci_hose_phys_to_bus (struct pci_controller *hose, - phys_addr_t phys_addr, - unsigned long flags) -{ - pci_addr_t bus_addr = 0; - int ret; - - if (!hose) { - puts("pci_hose_phys_to_bus: invalid hose\n"); - return bus_addr; - } - - /* - * if PCI_REGION_MEM is set we do a two pass search with preference - * on matches that don't have PCI_REGION_SYS_MEMORY set - */ - if ((flags & PCI_REGION_MEM) == PCI_REGION_MEM) { - ret = __pci_hose_phys_to_bus(hose, phys_addr, - flags, PCI_REGION_SYS_MEMORY, &bus_addr); - if (!ret) - return bus_addr; - } - - ret = __pci_hose_phys_to_bus(hose, phys_addr, flags, 0, &bus_addr); - - if (ret) - puts("pci_hose_phys_to_bus: invalid physical address\n"); - - return bus_addr; -} - int pci_hose_config_device(struct pci_controller *hose, pci_dev_t dev, unsigned long io, diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c index 24c66bb..b9ff23f 100644 --- a/drivers/pci/pci_common.c +++ b/drivers/pci/pci_common.c @@ -182,10 +182,10 @@ u32 pci_read_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum) } int __pci_hose_bus_to_phys(struct pci_controller *hose, - pci_addr_t bus_addr, - unsigned long flags, - unsigned long skip_mask, - phys_addr_t *pa) + pci_addr_t bus_addr, + unsigned long flags, + unsigned long skip_mask, + phys_addr_t *pa) { struct pci_region *res; int i; @@ -240,6 +240,68 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose, return phys_addr; } +int __pci_hose_phys_to_bus(struct pci_controller *hose, + phys_addr_t phys_addr, + unsigned long flags, + unsigned long skip_mask, + pci_addr_t *ba) +{ + struct pci_region *res; + pci_addr_t bus_addr; + int i; + + for (i = 0; i < hose->region_count; i++) { + res = &hose->regions[i]; + + if (((res->flags ^ flags) & PCI_REGION_TYPE) != 0) + continue; + + if (res->flags & skip_mask) + continue; + + bus_addr = phys_addr - res->phys_start + res->bus_start; + + if (bus_addr >= res->bus_start && + bus_addr < res->bus_start + res->size) { + *ba = bus_addr; + return 0; + } + } + + return 1; +} + +pci_addr_t pci_hose_phys_to_bus(struct pci_controller *hose, + phys_addr_t phys_addr, + unsigned long flags) +{ + pci_addr_t bus_addr = 0; + int ret; + + if (!hose) { + puts("pci_hose_phys_to_bus: invalid hose\n"); + return bus_addr; + } + + /* + * if PCI_REGION_MEM is set we do a two pass search with preference + * on matches that don't have PCI_REGION_SYS_MEMORY set + */ + if ((flags & PCI_REGION_MEM) == PCI_REGION_MEM) { + ret = __pci_hose_phys_to_bus(hose, phys_addr, + flags, PCI_REGION_SYS_MEMORY, &bus_addr); + if (!ret) + return bus_addr; + } + + ret = __pci_hose_phys_to_bus(hose, phys_addr, flags, 0, &bus_addr); + + if (ret) + puts("pci_hose_phys_to_bus: invalid physical address\n"); + + return bus_addr; +} + pci_dev_t pci_find_device(unsigned int vendor, unsigned int device, int index) { struct pci_device_id ids[2] = { {}, {0, 0} }; -- cgit v1.1 From 1b73b1c7fbb6c35c509e5b1d43785f029146cf61 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sat, 16 May 2015 09:33:14 +0800 Subject: pci: Allow debug message output in pci_auto.c Remove the '#undef DEBUG' in pci_auto.c so that we can enable debug message output via '-DDEBUG'. Signed-off-by: Bin Meng Acked-by: Simon Glass --- drivers/pci/pci_auto.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/pci') diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index e8da977..43965d8 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -14,7 +14,6 @@ #include #include -#undef DEBUG #ifdef DEBUG #define DEBUGF(x...) printf(x) #else -- cgit v1.1 From 04e3c4eb930a761b561cb87f964aa8a5d694c501 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sat, 16 May 2015 09:33:15 +0800 Subject: pci: Do not skip legacy IDE device configuration The legacy IDE device has a BAR4 (Bus Master Interface BAR) which needs to be configured. Signed-off-by: Bin Meng Reviewed-by: Simon Glass Acked-by: Simon Glass --- drivers/pci/pci_auto.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 43965d8..7c10983 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -20,8 +20,6 @@ #define DEBUGF(x...) #endif /* DEBUG */ -#define PCIAUTO_IDE_MODE_MASK 0x05 - /* the user can define CONFIG_SYS_PCI_CACHE_LINE_SIZE to avoid problems */ #ifndef CONFIG_SYS_PCI_CACHE_LINE_SIZE #define CONFIG_SYS_PCI_CACHE_LINE_SIZE 8 @@ -424,7 +422,6 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev) { unsigned int sub_bus = PCI_BUS(dev); unsigned short class; - unsigned char prg_iface; int n; pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class); @@ -460,17 +457,6 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev) #endif break; - case PCI_CLASS_STORAGE_IDE: - pci_hose_read_config_byte(hose, dev, PCI_CLASS_PROG, &prg_iface); - if (!(prg_iface & PCIAUTO_IDE_MODE_MASK)) { - DEBUGF("PCI Autoconfig: Skipping legacy mode IDE controller\n"); - return sub_bus; - } - - pciauto_setup_device(hose, dev, 6, hose->pci_mem, - hose->pci_prefetch, hose->pci_io); - break; - case PCI_CLASS_BRIDGE_CARDBUS: /* * just do a minimal setup of the bridge, -- cgit v1.1 From 2bb02e4fe22da5d982867c26e369730ea901f999 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2015 21:08:06 -0600 Subject: dm: pci: Allow PCI bus numbering aliases Commit 9cc36a2 'dm: core: Add a flag to control sequence numbering' changed the default uclass behaviour to not support bus numbering. This is incorrect for PCI and that commit should have enabled the flag for PCI. Enable it so that PCI buses can be found and the 'pci' command works again. Also add a test for this. Signed-off-by: Simon Glass --- drivers/pci/pci-uclass.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/pci') diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index d48d865..de87505 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -596,6 +596,7 @@ int pci_bridge_write_config(struct udevice *bus, pci_dev_t devfn, uint offset, UCLASS_DRIVER(pci) = { .id = UCLASS_PCI, .name = "pci", + .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = pci_uclass_post_bind, .pre_probe = pci_uclass_pre_probe, .post_probe = pci_uclass_post_probe, -- cgit v1.1