From 5d8965557318fabb1680d1817c2afc2714b6d3ce Mon Sep 17 00:00:00 2001 From: Simon Kagstrom Date: Fri, 9 Oct 2009 08:26:45 +0200 Subject: [ARM] OpenRD base: Initialize PCI express and i2c Signed-off-by: Simon Kagstrom Acked-by: Dieter Kiermaier Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/openrd_base-setup.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/openrd_base-setup.c b/arch/arm/mach-kirkwood/openrd_base-setup.c index 947dfb8cd5b..77617c72229 100644 --- a/arch/arm/mach-kirkwood/openrd_base-setup.c +++ b/arch/arm/mach-kirkwood/openrd_base-setup.c @@ -70,8 +70,20 @@ static void __init openrd_base_init(void) kirkwood_ge00_init(&openrd_base_ge00_data); kirkwood_sata_init(&openrd_base_sata_data); kirkwood_sdio_init(&openrd_base_mvsdio_data); + + kirkwood_i2c_init(); } +static int __init openrd_base_pci_init(void) +{ + if (machine_is_openrd_base()) + kirkwood_pcie_init(); + + return 0; + } +subsys_initcall(openrd_base_pci_init); + + MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board") /* Maintainer: Dhaval Vasa */ .phys_io = KIRKWOOD_REGS_PHYS_BASE, -- cgit v1.2.3 From 6de95c198729d34a85c88f8844f1c3d57fb6da00 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Thu, 5 Nov 2009 07:29:54 -0800 Subject: [ARM] kirkwood: fix section mismatch kirkwood_timer_init() and kirkwood_pcie_setup() lack of __init which causes following warnings: WARNING: vmlinux.o(.text+0x9568): Section mismatch in reference from the function kirkwood_timer_init() to the function .init.text:kirkwood_find_tclk() The function kirkwood_timer_init() references the function __init kirkwood_find_tclk(). This is often because kirkwood_timer_init lacks a __init annotation or the annotation of kirkwood_find_tclk is wrong. WARNING: vmlinux.o(.text+0x979c): Section mismatch in reference from the function kirkwood_pcie_setup() to the function .init.text:orion_pcie_setup() The function kirkwood_pcie_setup() references the function __init orion_pcie_setup(). This is often because kirkwood_pcie_setup lacks a __init annotation or the annotation of orion_pcie_setup is wrong. Signed-off-by: lijie Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/common.c | 2 +- arch/arm/mach-kirkwood/pcie.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 0acb61f3c10..7177c4aa634 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -845,7 +845,7 @@ int __init kirkwood_find_tclk(void) return 166666667; } -static void kirkwood_timer_init(void) +static void __init kirkwood_timer_init(void) { kirkwood_tclk = kirkwood_find_tclk(); orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index d90b9aae308..55388203300 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c @@ -93,7 +93,7 @@ static struct pci_ops pcie_ops = { }; -static int kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) +static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) { struct resource *res; extern unsigned int kirkwood_clk_ctrl; -- cgit v1.2.3 From 35f029e2514be209eb0e88c7d927f3bcc42a5cc2 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sat, 7 Nov 2009 14:49:18 +0100 Subject: [ARM] kirkwood: fix PCI I/O port assignment Instead of allocating PCI devices I/O port bus addresses from the 000xxxxx I/O port range as intended, due to a bus versus physical address mixup, the Kirkwood PCIe handling code inadvertently allocated I/O port bus addresses from the f20xxxxx address range (which is the physical address range of the PCIe I/O mapping window), but then direct all I/O port accesses to bus addresses 000xxxxx, which would then not be decoded at all. Fix this by setting the base address of the PCIe I/O space struct resource to KIRKWOOD_PCIE_IO_BUS_BASE instead of the incorrect KIRKWOOD_PCIE_IO_PHYS_BASE, and fix up __io() to expect addresses offsetted by the former instead of the latter. (The suggested fix of directing I/O port accesses from the host to bus addresses f20xxxxx instead has the problem that assigning full 32bit I/O port bus addresses (f20xxxxx) doesn't work on all PCI devices, as not all PCI devices implement full 32 bit BAR registers for I/O ports. We should really try to allocate I/O port bus addresses that fit in 16 bits.) Signed-off-by: Lennert Buytenhek Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/include/mach/io.h | 2 +- arch/arm/mach-kirkwood/pcie.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h index a643a846d5f..44e8be04f25 100644 --- a/arch/arm/mach-kirkwood/include/mach/io.h +++ b/arch/arm/mach-kirkwood/include/mach/io.h @@ -15,7 +15,7 @@ static inline void __iomem *__io(unsigned long addr) { - return (void __iomem *)((addr - KIRKWOOD_PCIE_IO_PHYS_BASE) + return (void __iomem *)((addr - KIRKWOOD_PCIE_IO_BUS_BASE) + KIRKWOOD_PCIE_IO_VIRT_BASE); } diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index 55388203300..0660e78641e 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c @@ -115,7 +115,7 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) */ res[0].name = "PCIe I/O Space"; res[0].flags = IORESOURCE_IO; - res[0].start = KIRKWOOD_PCIE_IO_PHYS_BASE; + res[0].start = KIRKWOOD_PCIE_IO_BUS_BASE; res[0].end = res[0].start + KIRKWOOD_PCIE_IO_SIZE - 1; if (request_resource(&ioport_resource, &res[0])) panic("Request PCIe IO resource failed\n"); -- cgit v1.2.3 From a1897fa67cb964cc6b5a9048a31eb6ef3dcc2dda Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sat, 7 Nov 2009 14:50:00 +0100 Subject: [ARM] Kirkwood: clarify PCIe MEM bus/physical address distinction Signed-off-by: Lennert Buytenhek Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/addr-map.c | 2 +- arch/arm/mach-kirkwood/include/mach/kirkwood.h | 1 + arch/arm/mach-kirkwood/pcie.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c index 1da5d1c18ec..2e69168fc69 100644 --- a/arch/arm/mach-kirkwood/addr-map.c +++ b/arch/arm/mach-kirkwood/addr-map.c @@ -105,7 +105,7 @@ void __init kirkwood_setup_cpu_mbus(void) setup_cpu_win(0, KIRKWOOD_PCIE_IO_PHYS_BASE, KIRKWOOD_PCIE_IO_SIZE, TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE); setup_cpu_win(1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE, - TARGET_PCIE, ATTR_PCIE_MEM, -1); + TARGET_PCIE, ATTR_PCIE_MEM, KIRKWOOD_PCIE_MEM_BUS_BASE); /* * Setup window for NAND controller. diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index 54c132731d2..a15cf0ee22b 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h @@ -43,6 +43,7 @@ #define KIRKWOOD_REGS_SIZE SZ_1M #define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000 +#define KIRKWOOD_PCIE_MEM_BUS_BASE 0xe0000000 #define KIRKWOOD_PCIE_MEM_SIZE SZ_128M /* diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index 0660e78641e..a604b2a701a 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c @@ -126,7 +126,7 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) */ res[1].name = "PCIe Memory Space"; res[1].flags = IORESOURCE_MEM; - res[1].start = KIRKWOOD_PCIE_MEM_PHYS_BASE; + res[1].start = KIRKWOOD_PCIE_MEM_BUS_BASE; res[1].end = res[1].start + KIRKWOOD_PCIE_MEM_SIZE - 1; if (request_resource(&iomem_resource, &res[1])) panic("Request PCIe Memory resource failed\n"); -- cgit v1.2.3 From 2bf30108435339c4cf149f9d279d0dc961345393 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Thu, 12 Nov 2009 20:31:14 +0100 Subject: [ARM] Kirkwood: disable propagation of mbus error to the CPU local bus Disable propagation of mbus errors to the CPU local bus, as this causes mbus errors (which can occur for example for PCI aborts) to throw CPU aborts, which we're not set up to deal with. Reported-by: Dieter Kiermaier Signed-off-by: Lennert Buytenhek Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/common.c | 8 ++++++++ arch/arm/mach-kirkwood/include/mach/bridge-regs.h | 3 +++ 2 files changed, 11 insertions(+) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 7177c4aa634..242dd077534 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -915,6 +915,14 @@ void __init kirkwood_init(void) kirkwood_uart0_data[0].uartclk = kirkwood_tclk; kirkwood_uart1_data[0].uartclk = kirkwood_tclk; + /* + * Disable propagation of mbus errors to the CPU local bus, + * as this causes mbus errors (which can occur for example + * for PCI aborts) to throw CPU aborts, which we're not set + * up to deal with. + */ + writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); + kirkwood_setup_cpu_mbus(); #ifdef CONFIG_CACHE_FEROCEON_L2 diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h index 9e80d9232c8..418f5017c50 100644 --- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h +++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h @@ -13,6 +13,9 @@ #include +#define CPU_CONFIG (BRIDGE_VIRT_BASE | 0x0100) +#define CPU_CONFIG_ERROR_PROP 0x00000004 + #define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104) #define CPU_RESET 0x00000002 -- cgit v1.2.3