From b5ee9002583fc14e6d45a04c18f208987a8fbced Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Fri, 5 Sep 2008 21:53:30 -0400 Subject: [ARM] remove a common set of __virt_to_bus definitions Let's provide an overridable default instead of having every machine class define __virt_to_bus and __bus_to_virt to the same thing. What most platforms are using is bus_addr == phys_addr so such is the default. One exception is ebsa110 which has no DMA what so ever, so the actual definition is not important except only for proper compilation. Also added a comment about the special footbridge bus translation. Let's also remove comments alluding to set_dma_addr which is not (and should not) be commonly used. Signed-off-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/mach-kirkwood/include/mach/memory.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/include/mach/memory.h b/arch/arm/mach-kirkwood/include/mach/memory.h index b5fb34b..45431e1 100644 --- a/arch/arm/mach-kirkwood/include/mach/memory.h +++ b/arch/arm/mach-kirkwood/include/mach/memory.h @@ -7,8 +7,4 @@ #define PHYS_OFFSET UL(0x00000000) -#define __virt_to_bus(x) __virt_to_phys(x) -#define __bus_to_virt(x) __phys_to_virt(x) - - #endif -- cgit v1.1 From dcea83adc666061864b82c96e059dffe7268b512 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 29 Nov 2008 11:40:28 +0000 Subject: [ARM] Hide ISA DMA API when ISA_DMA_API is unset When ISA_DMA_API is unset, we're not implementing the ISA DMA API, so there's no point in publishing the prototypes via asm/dma.h, nor including the machine dependent parts of that API. This allows us to remove a lot of mach/dma.h files which don't contain any useful code. Unfortunately though, some platforms put their own private non-ISA definitions into mach/dma.h, so we leave these behind and fix the appropriate #include statments. Signed-off-by: Russell King --- arch/arm/mach-kirkwood/include/mach/dma.h | 1 - 1 file changed, 1 deletion(-) delete mode 100644 arch/arm/mach-kirkwood/include/mach/dma.h (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/include/mach/dma.h b/arch/arm/mach-kirkwood/include/mach/dma.h deleted file mode 100644 index 40a8c17..0000000 --- a/arch/arm/mach-kirkwood/include/mach/dma.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ -- cgit v1.1 From fb6f552930e52699c8ac452c5a79ec3e97e6fc73 Mon Sep 17 00:00:00 2001 From: Ronen Shitrit Date: Wed, 17 Sep 2008 10:08:05 +0300 Subject: [ARM] Orion: add the option to support different ehci phy initialization The Orion ehci driver serves the Orion, kirkwood and DD Soc families. Since each of those integrate a different USB phy we should have the ability to use few initialization sequences or to leave the boot loader phy settings as is. Signed-off-by: Ronen Shitrit --- arch/arm/mach-kirkwood/common.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 0bb1fbd..b5c684d 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -57,6 +57,7 @@ void __init kirkwood_map_io(void) ****************************************************************************/ static struct orion_ehci_data kirkwood_ehci_data = { .dram = &kirkwood_mbus_dram_info, + .phy_version = EHCI_PHY_NA, }; static u64 ehci_dmamask = 0xffffffffUL; -- cgit v1.1 From d15fb9efe91b7198f2234783ab1d496ab1ee7b58 Mon Sep 17 00:00:00 2001 From: Ronen Shitrit Date: Sun, 19 Oct 2008 23:10:14 +0200 Subject: [ARM] Kirkwood: allow instantiating the second ethernet port The 88f6192 and 88f6281 Kirkwood SoCs support two ethernet ports. Add the platform glue that will allow board support files to instantiate the second ethernet port. Signed-off-by: Ronen Shitrit Signed-off-by: Lennert Buytenhek Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/common.c | 58 ++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/common.h | 1 + arch/arm/mach-kirkwood/include/mach/irqs.h | 1 + 3 files changed, 60 insertions(+) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index b5c684d..7b8ef97 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -154,6 +154,64 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) /***************************************************************************** + * GE01 + ****************************************************************************/ +struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = { + .dram = &kirkwood_mbus_dram_info, + .shared_smi = &kirkwood_ge00_shared, +}; + +static struct resource kirkwood_ge01_shared_resources[] = { + { + .name = "ge01 base", + .start = GE01_PHYS_BASE + 0x2000, + .end = GE01_PHYS_BASE + 0x3fff, + .flags = IORESOURCE_MEM, + }, { + .name = "ge01 err irq", + .start = IRQ_KIRKWOOD_GE01_ERR, + .end = IRQ_KIRKWOOD_GE01_ERR, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device kirkwood_ge01_shared = { + .name = MV643XX_ETH_SHARED_NAME, + .id = 1, + .dev = { + .platform_data = &kirkwood_ge01_shared_data, + }, + .num_resources = ARRAY_SIZE(kirkwood_ge01_shared_resources), + .resource = kirkwood_ge01_shared_resources, +}; + +static struct resource kirkwood_ge01_resources[] = { + { + .name = "ge01 irq", + .start = IRQ_KIRKWOOD_GE01_SUM, + .end = IRQ_KIRKWOOD_GE01_SUM, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device kirkwood_ge01 = { + .name = MV643XX_ETH_NAME, + .id = 1, + .num_resources = 1, + .resource = kirkwood_ge01_resources, +}; + +void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) +{ + eth_data->shared = &kirkwood_ge01_shared; + kirkwood_ge01.dev.platform_data = eth_data; + + platform_device_register(&kirkwood_ge01_shared); + platform_device_register(&kirkwood_ge01); +} + + +/***************************************************************************** * Ethernet switch ****************************************************************************/ static struct resource kirkwood_switch_resources[] = { diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 5774632..fe367c1 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h @@ -30,6 +30,7 @@ void kirkwood_pcie_id(u32 *dev, u32 *rev); void kirkwood_ehci_init(void); void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data); +void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data); void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq); void kirkwood_pcie_init(void); void kirkwood_rtc_init(void); diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h index ffab89f..3a964bb 100644 --- a/arch/arm/mach-kirkwood/include/mach/irqs.h +++ b/arch/arm/mach-kirkwood/include/mach/irqs.h @@ -51,6 +51,7 @@ #define IRQ_KIRKWOOD_GPIO_HIGH_8_15 40 #define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41 #define IRQ_KIRKWOOD_GE00_ERR 46 +#define IRQ_KIRKWOOD_GE01_ERR 47 /* * KIRKWOOD General Purpose Pins -- cgit v1.1 From 37787e449b39202afae13b6c47505ae9e977cae3 Mon Sep 17 00:00:00 2001 From: Ronen Shitrit Date: Sun, 19 Oct 2008 23:19:07 +0200 Subject: [ARM] Kirkwood: properly handle the WAN port on newer RD88F6281 boards On newer versions of the RD88F6281 board, the WAN port is connected to its own ethernet port on the CPU, via a separate PHY, whereas on older versions of the board, it is connected to one of the PHYs in the ethernet switch. In the RD8F6281 setup code, detect which version of the board we are running on, and instantiate the ethernet ports and switch driver accordingly. Signed-off-by: Ronen Shitrit Signed-off-by: Lennert Buytenhek Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/rd88f6281-setup.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c index 175054a..9a0e905 100644 --- a/arch/arm/mach-kirkwood/rd88f6281-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c @@ -80,24 +80,38 @@ static struct dsa_platform_data rd88f6281_switch_data = { .port_names[1] = "lan2", .port_names[2] = "lan3", .port_names[3] = "lan4", - .port_names[4] = "wan", .port_names[5] = "cpu", }; +static struct mv643xx_eth_platform_data rd88f6281_ge01_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(11), +}; + static struct mv_sata_platform_data rd88f6281_sata_data = { .n_ports = 2, }; static void __init rd88f6281_init(void) { + u32 dev, rev; + /* * Basic setup. Needs to be called early. */ kirkwood_init(); kirkwood_ehci_init(); + kirkwood_ge00_init(&rd88f6281_ge00_data); + kirkwood_pcie_id(&dev, &rev); + if (rev == MV88F6281_REV_A0) { + rd88f6281_switch_data.sw_addr = 10; + kirkwood_ge01_init(&rd88f6281_ge01_data); + } else { + rd88f6281_switch_data.port_names[4] = "wan"; + } kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ); + kirkwood_rtc_init(); kirkwood_sata_init(&rd88f6281_sata_data); kirkwood_uart0_init(); -- cgit v1.1 From 4c21343005b6b0d6ef24ab6e6a8f3883ff0cb569 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Mon, 20 Oct 2008 01:51:04 +0200 Subject: [ARM] Kirkwood: implement GPIO and GPIO interrupt support Signed-off-by: Lennert Buytenhek Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/include/mach/gpio.h | 38 ++++++++++++++++++++++++++ arch/arm/mach-kirkwood/include/mach/irqs.h | 4 +-- arch/arm/mach-kirkwood/include/mach/kirkwood.h | 3 -- arch/arm/mach-kirkwood/irq.c | 35 ++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 arch/arm/mach-kirkwood/include/mach/gpio.h (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/include/mach/gpio.h b/arch/arm/mach-kirkwood/include/mach/gpio.h new file mode 100644 index 0000000..81b335e --- /dev/null +++ b/arch/arm/mach-kirkwood/include/mach/gpio.h @@ -0,0 +1,38 @@ +/* + * arch/asm-arm/mach-kirkwood/include/mach/gpio.h + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#ifndef __ASM_ARCH_GPIO_H +#define __ASM_ARCH_GPIO_H + +#include +#include +#include /* cansleep wrappers */ + +#define GPIO_MAX 50 +#define GPIO_OFF(pin) (((pin) >> 5) ? 0x0140 : 0x0100) +#define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x00) +#define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x04) +#define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x08) +#define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x0c) +#define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x10) +#define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x14) +#define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x18) +#define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x1c) + +static inline int gpio_to_irq(int pin) +{ + return pin + IRQ_KIRKWOOD_GPIO_START; +} + +static inline int irq_to_gpio(int irq) +{ + return irq - IRQ_KIRKWOOD_GPIO_START; +} + + +#endif diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h index 3a964bb..f00a0a4 100644 --- a/arch/arm/mach-kirkwood/include/mach/irqs.h +++ b/arch/arm/mach-kirkwood/include/mach/irqs.h @@ -11,8 +11,6 @@ #ifndef __ASM_ARCH_IRQS_H #define __ASM_ARCH_IRQS_H -#include "kirkwood.h" /* need GPIO_MAX */ - /* * Low Interrupt Controller */ @@ -57,7 +55,7 @@ * KIRKWOOD General Purpose Pins */ #define IRQ_KIRKWOOD_GPIO_START 64 -#define NR_GPIO_IRQS GPIO_MAX +#define NR_GPIO_IRQS 50 #define NR_IRQS (IRQ_KIRKWOOD_GPIO_START + NR_GPIO_IRQS) diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index eae4240..ada480c 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h @@ -117,7 +117,4 @@ #define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) -#define GPIO_MAX 50 - - #endif diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c index 5790643..efb86b7 100644 --- a/arch/arm/mach-kirkwood/irq.c +++ b/arch/arm/mach-kirkwood/irq.c @@ -13,10 +13,45 @@ #include #include #include +#include #include "common.h" +static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) +{ + BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7); + BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23); + + orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3); +} + void __init kirkwood_init_irq(void) { + int i; + orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); + + /* + * Mask and clear GPIO IRQ interrupts. + */ + writel(0, GPIO_LEVEL_MASK(0)); + writel(0, GPIO_EDGE_MASK(0)); + writel(0, GPIO_EDGE_CAUSE(0)); + writel(0, GPIO_LEVEL_MASK(32)); + writel(0, GPIO_EDGE_MASK(32)); + writel(0, GPIO_EDGE_CAUSE(32)); + + for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) { + set_irq_chip(i, &orion_gpio_irq_level_chip); + set_irq_handler(i, handle_level_irq); + irq_desc[i].status |= IRQ_LEVEL; + set_irq_flags(i, IRQF_VALID); + } + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler); + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler); + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler); + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler); + set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler); } -- cgit v1.1