Skip to content

Commit

Permalink
ARM: orion: Consolidate USB platform setup code.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
  • Loading branch information
Andrew Lunn authored and Nicolas Pitre committed May 16, 2011
1 parent ee96272 commit 4fcd3f3
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 247 deletions.
65 changes: 4 additions & 61 deletions arch/arm/mach-dove/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <mach/bridge-regs.h>
#include <asm/mach/arch.h>
#include <linux/irq.h>
#include <plat/ehci-orion.h>
#include <plat/time.h>
#include <plat/common.h>
#include "common.h"
Expand Down Expand Up @@ -69,78 +68,22 @@ void __init dove_map_io(void)
iotable_init(dove_io_desc, ARRAY_SIZE(dove_io_desc));
}

/*****************************************************************************
* EHCI
****************************************************************************/
static struct orion_ehci_data dove_ehci_data = {
.dram = &dove_mbus_dram_info,
.phy_version = EHCI_PHY_NA,
};

static u64 ehci_dmamask = DMA_BIT_MASK(32);

/*****************************************************************************
* EHCI0
****************************************************************************/
static struct resource dove_ehci0_resources[] = {
{
.start = DOVE_USB0_PHYS_BASE,
.end = DOVE_USB0_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_DOVE_USB0,
.end = IRQ_DOVE_USB0,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device dove_ehci0 = {
.name = "orion-ehci",
.id = 0,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &dove_ehci_data,
},
.resource = dove_ehci0_resources,
.num_resources = ARRAY_SIZE(dove_ehci0_resources),
};

void __init dove_ehci0_init(void)
{
platform_device_register(&dove_ehci0);
orion_ehci_init(&dove_mbus_dram_info,
DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0);
}

/*****************************************************************************
* EHCI1
****************************************************************************/
static struct resource dove_ehci1_resources[] = {
{
.start = DOVE_USB1_PHYS_BASE,
.end = DOVE_USB1_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_DOVE_USB1,
.end = IRQ_DOVE_USB1,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device dove_ehci1 = {
.name = "orion-ehci",
.id = 1,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &dove_ehci_data,
},
.resource = dove_ehci1_resources,
.num_resources = ARRAY_SIZE(dove_ehci1_resources),
};

void __init dove_ehci1_init(void)
{
platform_device_register(&dove_ehci1);
orion_ehci_1_init(&dove_mbus_dram_info,
DOVE_USB1_PHYS_BASE, IRQ_DOVE_USB1);
}

/*****************************************************************************
Expand Down
39 changes: 2 additions & 37 deletions arch/arm/mach-kirkwood/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <mach/bridge-regs.h>
#include <plat/audio.h>
#include <plat/cache-feroceon-l2.h>
#include <plat/ehci-orion.h>
#include <plat/mvsdio.h>
#include <plat/orion_nand.h>
#include <plat/common.h>
Expand Down Expand Up @@ -68,48 +67,14 @@ void __init kirkwood_map_io(void)
unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED;


/*****************************************************************************
* EHCI
****************************************************************************/
static struct orion_ehci_data kirkwood_ehci_data = {
.dram = &kirkwood_mbus_dram_info,
.phy_version = EHCI_PHY_NA,
};

static u64 ehci_dmamask = DMA_BIT_MASK(32);


/*****************************************************************************
* EHCI0
****************************************************************************/
static struct resource kirkwood_ehci_resources[] = {
{
.start = USB_PHYS_BASE,
.end = USB_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_KIRKWOOD_USB,
.end = IRQ_KIRKWOOD_USB,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device kirkwood_ehci = {
.name = "orion-ehci",
.id = 0,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &kirkwood_ehci_data,
},
.resource = kirkwood_ehci_resources,
.num_resources = ARRAY_SIZE(kirkwood_ehci_resources),
};

void __init kirkwood_ehci_init(void)
{
kirkwood_clk_ctrl |= CGC_USB0;
platform_device_register(&kirkwood_ehci);
orion_ehci_init(&kirkwood_mbus_dram_info,
USB_PHYS_BASE, IRQ_KIRKWOOD_USB);
}


Expand Down
93 changes: 6 additions & 87 deletions arch/arm/mach-mv78xx0/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <mach/mv78xx0.h>
#include <mach/bridge-regs.h>
#include <plat/cache-feroceon-l2.h>
#include <plat/ehci-orion.h>
#include <plat/orion_nand.h>
#include <plat/time.h>
#include <plat/common.h>
Expand Down Expand Up @@ -168,110 +167,30 @@ void __init mv78xx0_map_io(void)
/*****************************************************************************
* EHCI
****************************************************************************/
static struct orion_ehci_data mv78xx0_ehci_data = {
.dram = &mv78xx0_mbus_dram_info,
.phy_version = EHCI_PHY_NA,
};

static u64 ehci_dmamask = DMA_BIT_MASK(32);


/*****************************************************************************
* EHCI0
****************************************************************************/
static struct resource mv78xx0_ehci0_resources[] = {
{
.start = USB0_PHYS_BASE,
.end = USB0_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_MV78XX0_USB_0,
.end = IRQ_MV78XX0_USB_0,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device mv78xx0_ehci0 = {
.name = "orion-ehci",
.id = 0,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &mv78xx0_ehci_data,
},
.resource = mv78xx0_ehci0_resources,
.num_resources = ARRAY_SIZE(mv78xx0_ehci0_resources),
};

void __init mv78xx0_ehci0_init(void)
{
platform_device_register(&mv78xx0_ehci0);
orion_ehci_init(&mv78xx0_mbus_dram_info,
USB0_PHYS_BASE, IRQ_MV78XX0_USB_0);
}


/*****************************************************************************
* EHCI1
****************************************************************************/
static struct resource mv78xx0_ehci1_resources[] = {
{
.start = USB1_PHYS_BASE,
.end = USB1_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_MV78XX0_USB_1,
.end = IRQ_MV78XX0_USB_1,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device mv78xx0_ehci1 = {
.name = "orion-ehci",
.id = 1,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &mv78xx0_ehci_data,
},
.resource = mv78xx0_ehci1_resources,
.num_resources = ARRAY_SIZE(mv78xx0_ehci1_resources),
};

void __init mv78xx0_ehci1_init(void)
{
platform_device_register(&mv78xx0_ehci1);
orion_ehci_1_init(&mv78xx0_mbus_dram_info,
USB1_PHYS_BASE, IRQ_MV78XX0_USB_1);
}


/*****************************************************************************
* EHCI2
****************************************************************************/
static struct resource mv78xx0_ehci2_resources[] = {
{
.start = USB2_PHYS_BASE,
.end = USB2_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_MV78XX0_USB_2,
.end = IRQ_MV78XX0_USB_2,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device mv78xx0_ehci2 = {
.name = "orion-ehci",
.id = 2,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &mv78xx0_ehci_data,
},
.resource = mv78xx0_ehci2_resources,
.num_resources = ARRAY_SIZE(mv78xx0_ehci2_resources),
};

void __init mv78xx0_ehci2_init(void)
{
platform_device_register(&mv78xx0_ehci2);
orion_ehci_2_init(&mv78xx0_mbus_dram_info,
USB2_PHYS_BASE, IRQ_MV78XX0_USB_2);
}


Expand Down
66 changes: 4 additions & 62 deletions arch/arm/mach-orion5x/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <mach/bridge-regs.h>
#include <mach/hardware.h>
#include <mach/orion5x.h>
#include <plat/ehci-orion.h>
#include <plat/orion_nand.h>
#include <plat/time.h>
#include <plat/common.h>
Expand Down Expand Up @@ -67,80 +66,23 @@ void __init orion5x_map_io(void)
}


/*****************************************************************************
* EHCI
****************************************************************************/
static struct orion_ehci_data orion5x_ehci_data = {
.dram = &orion5x_mbus_dram_info,
.phy_version = EHCI_PHY_ORION,
};

static u64 ehci_dmamask = DMA_BIT_MASK(32);


/*****************************************************************************
* EHCI0
****************************************************************************/
static struct resource orion5x_ehci0_resources[] = {
{
.start = ORION5X_USB0_PHYS_BASE,
.end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_ORION5X_USB0_CTRL,
.end = IRQ_ORION5X_USB0_CTRL,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device orion5x_ehci0 = {
.name = "orion-ehci",
.id = 0,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &orion5x_ehci_data,
},
.resource = orion5x_ehci0_resources,
.num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
};

void __init orion5x_ehci0_init(void)
{
platform_device_register(&orion5x_ehci0);
orion_ehci_init(&orion5x_mbus_dram_info,
ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL);
}


/*****************************************************************************
* EHCI1
****************************************************************************/
static struct resource orion5x_ehci1_resources[] = {
{
.start = ORION5X_USB1_PHYS_BASE,
.end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_ORION5X_USB1_CTRL,
.end = IRQ_ORION5X_USB1_CTRL,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device orion5x_ehci1 = {
.name = "orion-ehci",
.id = 1,
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &orion5x_ehci_data,
},
.resource = orion5x_ehci1_resources,
.num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
};

void __init orion5x_ehci1_init(void)
{
platform_device_register(&orion5x_ehci1);
orion_ehci_1_init(&orion5x_mbus_dram_info,
ORION5X_USB1_PHYS_BASE, IRQ_ORION5X_USB1_CTRL);
}


Expand Down
Loading

0 comments on commit 4fcd3f3

Please sign in to comment.