ppc32: Add usb support to IBM stb04xxx platforms
PATCH 1/1 ppc32: Add usb support to IBM stb04xxx platforms
Signed-off-by Dale Farnsworth <[email protected]>
arch/ppc/platforms/4xx/ibmstb4.c +37 -6
@@ -72,12 +72,43 @@ .irq = IDE0_IRQ, .pm = OCP_CPM_NA, }, - { .vendor = OCP_VENDOR_IBM, - .function = OCP_FUNC_USB, - .paddr = USB0_BASE, - .irq = USB0_IRQ, - .pm = OCP_CPM_NA, - }, { .vendor = OCP_VENDOR_INVALID, } }; + +static struct resource ohci_usb_resources[] = { + [0 ] = { + .start =USB0_BASE , + .end =USB0_BASE +USB0_SIZE -1 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =USB0_IRQ , + .end =USB0_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static u64 dma_mask =0xffffffffULL ; + +static struct platform_device ohci_usb_device = { + .name ="ppc-soc-ohci" , + .id =0 , + .num_resources =ARRAY_SIZE (ohci_usb_resources), + .resource = ohci_usb_resources, + .dev = { + .dma_mask = &dma_mask, + .coherent_dma_mask =0xffffffffULL , + } +}; + +static struct platform_device *ibmstb4_devs[]__initdata = { + &ohci_usb_device, +}; + +static int __init +ibmstb4_platform_add_devices (void ) +{ +return platform_add_devices (ibmstb4_devs,ARRAY_SIZE (ibmstb4_devs)); +} +arch_initcall (ibmstb4_platform_add_devices);
arch/ppc/platforms/4xx/ibmstb4.h +2 -2
@@ -73,9 +73,9 @@#define OPB0_BASE 0x40000000#define GPIO0_BASE 0x40060000 +#define USB0_BASE 0x40010000 +#define USB0_SIZE 0xA0#define USB0_IRQ 18 -#define USB0_BASE STB04xxx_MAP_IO_ADDR(0x40010000) -#define USB0_EXTENT 4096#define IIC_NUMS 2#define UART_NUMS 3
arch/ppc/platforms/4xx/redwood5.c +10 -0
@@ -52,8 +52,18 @@void __init redwood5_setup_arch (void ) { +u32 mask; +ppc4xx_setup_arch (); +/* +* Set up USB interrupt as positive polarity and level-sensitive. +* Firmware should do this, but apparently does not. +*/ + mask =1 << (31 -USB0_IRQ ); +mtdcr (DCRN_UIC_PR (UIC0 ),mfdcr (DCRN_UIC_PR (UIC0 )) | mask); +mtdcr (DCRN_UIC_TR (UIC0 ),mfdcr (DCRN_UIC_TR (UIC0 )) & ~mask); +#ifdef CONFIG_DEBUG_BRINGUP printk ("\n" );printk ("machine\t: %s\n" , PPC4xx_MACHINE_NAME);
On Thu, Mar 31, 2005 at 01:47:30PM -0700, Dale Farnsworth wrote:
[snip]
Quoted 12 lines
===================================================================
arch/ppc/platforms/4xx/redwood5.c +3
-0@@ -52,8 +52,18 @@void __init redwood5_setup_arch (void ) { +u32 mask; +ppc4xx_setup_arch (); +/*
arch/ppc/platforms/4xx/redwood5.c line 69
Quoted 10 lines
arch/ppc/platforms/4xx/redwood5.c +7
-0+* Set up USB interrupt as positive polarity and level-sensitive. +* Firmware should do this, but apparently does not. +*/ + mask =1 << (31 -USB0_IRQ ); +mtdcr (DCRN_UIC_PR (UIC0 ),mfdcr (DCRN_UIC_PR (UIC0 )) | mask); +mtdcr (DCRN_UIC_TR (UIC0 ),mfdcr (DCRN_UIC_TR (UIC0 )) & ~mask); +#ifdef CONFIG_DEBUG_BRINGUP printk ("\n" );printk ("machine\t: %s\n" , PPC4xx_MACHINE_NAME);
Dale, please, don't mess with UIC registers directly, there is a cleaner way to set this up.
Take a look at how this is done in other 4xx ports (ppc4xx_core_uic_cfg & ppc4xx_uic_ext_irq_cfg).
--
Eugene
Quoted 5 lines · Eugene Surovegin
Dale, please, don't mess with UIC registers directly, there is a cleaner way to set this up.
Take a look at how this is done in other 4xx ports (
ppc4xx_core_uic_cfg&ppc4xx_uic_ext_irq_cfg).
Thanks for the heads up Eugene. I'll submit an updated patch shortly.
-Dale