usb gadget: update pxa2xx_udc.c and arch dependent files for ixp4xx
PATCH 2/5 usb gadget: update pxa2xx_udc.c and arch dependent files for ixp4xx
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.16.13.
Signed-off-by Milan Svoboda <[email protected]>
---
arch/arm/mach-ixp4xx/common.c +36 -1
@@ -39,6 +39,8 @@#include <asm/mach/irq.h> #include <asm/mach/time.h> +#include <asm/arch/udc.h> +/************************************************************************* * IXP4xx chipset I/O mapping *************************************************************************/
@@ -334,8 +336,41 @@ static struct platform_device ixp46x_i2c .resource = ixp46x_i2c_resources }; +static struct resource ixp4xx_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 ixp4xx_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 ixp4xx_gadget = { + .name ="pxa2xx-udc" , + .id =-1 , + .num_resources =2 , + .resource = ixp4xx_gadget_resources, + .dev = { + .platform_data = &ixp4xx_udc_info, + }, +}; +static struct platform_device *ixp46x_devices[]__initdata = { - &ixp46x_i2c_controller + &ixp46x_i2c_controller, + &ixp4xx_gadget, };unsigned long ixp4xx_exp_bus_size;
drivers/usb/gadget/pxa2xx_udc.c +6 -2
@@ -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>
@@ -2432,7 +2434,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 ;
@@ -2564,7 +2566,7 @@ static void pxa2xx_udc_shutdown(struct ppullup_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);
@@ -2576,10 +2578,12 @@ static int __exit pxa2xx_udc_remove(strufree_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 ;
include/asm-arm/arch-ixp4xx/irqs.h +6 -0
@@ -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
include/asm-arm/arch-ixp4xx/udc.h +18 -0
@@ -0,0 +1,18 @@ +/* +* 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 */ +}; + +extern void pxa_set_udc_info (struct pxa2xx_udc_mach_info *info); +