From: Milan Svoboda <[EMAIL PROTECTED]> This patch adds platform device ixp4xx_gadget that uses pxa2xx-udc device driver. Also pxa2xx_udc.c is updated so it can be compiled without errors on IXP4XX architecture.
The patch is against 2.6.17-rc5. Signed-off-by: Milan Svoboda <[EMAIL PROTECTED]> ---
diff -uprN -X orig/Documentation/dontdiff orig/arch/arm/mach-ixp4xx/ixdp425-setup.c new_gadget/arch/arm/mach-ixp4xx/ixdp425-setup.c --- orig/arch/arm/mach-ixp4xx/ixdp425-setup.c 2006-05-15 10:21:27.000000000 +0000 +++ new_gadget/arch/arm/mach-ixp4xx/ixdp425-setup.c 2006-05-17 09:57:26.000000000 +0000 @@ -22,6 +22,7 @@ #include <asm/hardware.h> #include <asm/mach-types.h> #include <asm/irq.h> +#include <asm/udc.h> #include <asm/mach/arch.h> #include <asm/mach/flash.h> @@ -58,6 +59,38 @@ static struct platform_device ixdp425_i2 .num_resources = 0 }; +static struct resource ixdp425_gadget_resources[] = { + [0] = { + .start = 0xc800b000, + .end = 0xc800bfff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB, + .end = IRQ_USB, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct pxa2xx_udc_mach_info ixdp425_udc_info = { + .udc_is_connected = NULL, + .udc_command = NULL, +}; + +/* + * USB device controller. The IXP46x uses the same controller as PXA2XX, + * so we just use the same device name. + */ +static struct platform_device ixdp425_gadget = { + .name = "pxa2xx-udc", + .id = -1, + .num_resources = 2, + .resource = ixdp425_gadget_resources, + .dev = { + .platform_data = &ixdp425_udc_info, + }, +}; + static struct resource ixdp425_uart_resources[] = { { .start = IXP4XX_UART1_BASE_PHYS, @@ -103,6 +136,7 @@ static struct platform_device ixdp425_ua static struct platform_device *ixdp425_devices[] __initdata = { &ixdp425_i2c_controller, + &ixdp425_gadget, &ixdp425_flash, &ixdp425_uart }; diff -uprN -X orig/Documentation/dontdiff orig/drivers/usb/gadget/pxa2xx_udc.c new_gadget/drivers/usb/gadget/pxa2xx_udc.c --- orig/drivers/usb/gadget/pxa2xx_udc.c 2006-05-17 12:08:15.000000000 +0000 +++ new_gadget/drivers/usb/gadget/pxa2xx_udc.c 2006-05-18 15:04:53.000000000 +0000 @@ -53,7 +53,9 @@ #include <asm/mach-types.h> #include <asm/unaligned.h> #include <asm/hardware.h> +#ifdef CONFIG_ARCH_PXA #include <asm/arch/pxa-regs.h> +#endif #include <linux/usb_ch9.h> #include <linux/usb_gadget.h> @@ -2431,7 +2433,7 @@ static struct pxa2xx_udc memory = { /* * probe - binds to the platform device */ -static int __init pxa2xx_udc_probe(struct platform_device *pdev) +static int pxa2xx_udc_probe(struct platform_device *pdev) { struct pxa2xx_udc *dev = &memory; int retval, out_dma = 1; @@ -2563,7 +2565,7 @@ static void pxa2xx_udc_shutdown(struct p pullup_off(); } -static int __exit pxa2xx_udc_remove(struct platform_device *pdev) +static int pxa2xx_udc_remove(struct platform_device *pdev) { struct pxa2xx_udc *dev = platform_get_drvdata(pdev); @@ -2575,10 +2577,12 @@ static int __exit pxa2xx_udc_remove(stru free_irq(IRQ_USB, dev); dev->got_irq = 0; } +#ifdef CONFIG_ARCH_LUBBOCK if (machine_is_lubbock()) { free_irq(LUBBOCK_USB_DISC_IRQ, dev); free_irq(LUBBOCK_USB_IRQ, dev); } +#endif platform_set_drvdata(pdev, NULL); the_controller = NULL; return 0; diff -uprN -X orig/Documentation/dontdiff orig/include/asm-arm/arch-ixp4xx/irqs.h new_gadget/include/asm-arm/arch-ixp4xx/irqs.h --- orig/include/asm-arm/arch-ixp4xx/irqs.h 2006-05-17 12:08:15.000000000 +0000 +++ new_gadget/include/asm-arm/arch-ixp4xx/irqs.h 2006-05-15 14:20:09.000000000 +0000 @@ -109,4 +109,10 @@ #define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8 #define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7 +/* + * This is used in pxa2xx usb device controller driver, so it + * doesn't follow ixp4xx naming convetions. + */ +#define IRQ_USB IRQ_IXP4XX_USB + #endif diff -uprN -X orig/Documentation/dontdiff orig/include/asm-arm/arch-pxa/udc.h new_gadget/include/asm-arm/arch-pxa/udc.h --- orig/include/asm-arm/arch-pxa/udc.h 2005-03-02 07:38:17.000000000 +0000 +++ new_gadget/include/asm-arm/arch-pxa/udc.h 2006-05-15 15:13:26.000000000 +0000 @@ -1,18 +1,4 @@ -/* - * linux/include/asm-arm/arch-pxa/udc.h - * - * This supports machine-specific differences in how the PXA2xx - * USB Device Controller (UDC) is wired. - * - * It is set in linux/arch/arm/mach-pxa/<machine>.c and used in - * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c - */ -struct pxa2xx_udc_mach_info { - int (*udc_is_connected)(void); /* do we see host? */ - void (*udc_command)(int cmd); -#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */ -#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ -}; +#include <asm/udc.h> extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); diff -uprN -X orig/Documentation/dontdiff orig/include/asm-arm/udc.h new_gadget/include/asm-arm/udc.h --- orig/include/asm-arm/udc.h 1970-01-01 00:00:00.000000000 +0000 +++ new_gadget/include/asm-arm/udc.h 2006-05-15 15:12:43.000000000 +0000 @@ -0,0 +1,13 @@ +/* + * linux/include/asm-arm/udc.h + * + * This supports machine-specific differences in how the PXA2xx + * USB Device Controller (UDC) is wired. + * + */ +struct pxa2xx_udc_mach_info { + int (*udc_is_connected)(void); /* do we see host? */ + void (*udc_command)(int cmd); +#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */ +#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ +};