ppc32: Add usb support to IBM stb04xxx platforms including Redwood5
PATCH 1/1 ppc32: Add usb support to IBM stb04xxx platforms including Redwood5
Signed-off-by Dale Farnsworth <[email protected]>
arch/ppc/platforms/4xx/ibmstb4.c +65 -6
@@ -11,6 +11,7 @@#include <linux/init.h> #include <asm/ocp.h> +#include <asm/usb.h> #include <platforms/4xx/ibmstb4.h> static struct ocp_func_iic_data ibmstb4_iic0_def = {
@@ -72,12 +73,70 @@ .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, } }; + +/* Power up the USB subsection */ +static int enable_usb (struct platform_device *pdev) +{ +u32 mask; + + 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); +return 0 ; +} + +/* Power down the USB subsection */ +static void disable_usb (struct platform_device *pdev) +{ +u32 mask; + + 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); +} + +static struct usb_hcd_platform_data pd = { + .start = enable_usb, + .stop = disable_usb, +}; + +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 , + .platform_data = &pd, + } +}; + +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
include/asm-ppc/usb.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* ppc/usb.h: +* +*/ +#ifndef _PPC_USB_H +#define _PPC_USB_H + +struct usb_hcd_platform_data { +char *name; +int (*start) (struct platform_device *pdev); +void (*stop) (struct platform_device *pdev); +}; + +#endif /* !(_PPC_USB_H) */
On Wed, Mar 30, 2005 at 05:05:21PM -0700, Dale Farnsworth wrote:
[snip]
Quoted 10 lines
arch/ppc/platforms/4xx/ibmstb4.c +10
-0+/* Power up the USB subsection */ +static int enable_usb (struct platform_device *pdev) +{ +u32 mask; + + 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); +return 0 ; +}
arch/ppc/platforms/4xx/ibmstb4.c line 99
Quoted 10 lines
arch/ppc/platforms/4xx/ibmstb4.c +10
-0+ +/* Power down the USB subsection */ +static void disable_usb (struct platform_device *pdev) +{ +u32 mask; + + 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); +}
Dale, I'm curious, what's going on here :) ?.
How changing polarity and triggering setting could power-down USB unit? Some STB funkiness?
--
Eugene
Quoted 27 lines · Eugene Surovegin
On Wed, Mar 30, 2005 at 05:05:21PM -0700, Dale Farnsworth wrote:
[snip]
Quoted 10 lines
arch/ppc/platforms/4xx/ibmstb4.c +10
-0+/* Power up the USB subsection */ +static int enable_usb (struct platform_device *pdev) +{ +u32 mask; + + 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); +return 0 ; +}arch/ppc/platforms/4xx/ibmstb4.c line 99
Quoted 10 lines
arch/ppc/platforms/4xx/ibmstb4.c +10
-0+ +/* Power down the USB subsection */ +static void disable_usb (struct platform_device *pdev) +{ +u32 mask; + + 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); +}Dale, I'm curious, what's going on here :) ?.
Quoted 2 lines
How changing polarity and triggering setting could power-down USB unit? Some STB funkiness?
No. It's brown paper bag time. Looks bogus to me now, too.
Please ignore the patch. I'll redo it and resubmit.
Thanks Eugene,
-Dale