Switch pxa25x_udc devices to use gpio-vbus tranceiver
Subsystems (4)
cover Switch pxa25x_udc devices to use gpio-vbus tranceiver
pxa25x_udc driver contains functionality duplicating gpio-vbus tranceiver functions. Switch all devices, that depend on it, to use gpio-vbus and (in the last patches) drop related code from pxa25x_udc.
PATCH 1/6 eseries: switch to using gpio-vbus transceiver
Switch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus tranceiver.
--- arch/arm/mach-pxa/eseries.c | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-)
arch/arm/mach-pxa/eseries.c +26 -8
@@ -20,6 +20,7 @@#include <linux/mfd/t7l66xb.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> +#include <linux/usb/gpio_vbus.h> #include <video/w100fb.h>
@@ -51,12 +52,20 @@ void __init eseries_fixup(struct machine_desc *desc, mi->bank[0 ].size = (64 *1024 *1024 ); } -struct pxa2xx_udc_mach_info e7xx_udc_mach_info = { +struct gpio_vbus_mach_info e7xx_udc_info = { .gpio_vbus =GPIO_E7XX_USB_DISC , .gpio_pullup =GPIO_E7XX_USB_PULLUP , .gpio_pullup_inverted =1 }; +static struct platform_device e7xx_gpio_vbus = { + .name ="gpio-vbus" , + .id =-1 , + .dev = { + .platform_data = &e7xx_udc_info, + }, +}; +struct pxaficp_platform_data e7xx_ficp_platform_data = { .gpio_pwdown =GPIO_E7XX_IR_OFF , .transceiver_cap =IR_SIRMODE |IR_OFF ,
@@ -165,6 +174,7 @@ static struct platform_device e330_tc6387xb_device = {static struct platform_device *e330_devices[]__initdata = { &e330_tc6387xb_device, + &e7xx_gpio_vbus, };static void __init e330_init (void )
@@ -175,7 +185,6 @@ static void __init e330_init(void)eseries_register_clks ();eseries_get_tmio_gpios ();platform_add_devices (ARRAY_AND_SIZE (e330_devices)); -pxa_set_udc_info (&e7xx_udc_mach_info); }MACHINE_START (E330 ,"Toshiba e330" )
@@ -214,6 +223,7 @@ static struct platform_device e350_t7l66xb_device = {static struct platform_device *e350_devices[]__initdata = { &e350_t7l66xb_device, + &e7xx_gpio_vbus, };static void __init e350_init (void )
@@ -224,7 +234,6 @@ static void __init e350_init(void)eseries_register_clks ();eseries_get_tmio_gpios ();platform_add_devices (ARRAY_AND_SIZE (e350_devices)); -pxa_set_udc_info (&e7xx_udc_mach_info); }MACHINE_START (E350 ,"Toshiba e350" )
@@ -333,6 +342,7 @@ static struct platform_device e400_t7l66xb_device = {static struct platform_device *e400_devices[]__initdata = { &e400_t7l66xb_device, + &e7xx_gpio_vbus, };static void __init e400_init (void )
@@ -346,7 +356,6 @@ static void __init e400_init(void)eseries_get_tmio_gpios ();set_pxa_fb_info (&e400_pxafb_mach_info);platform_add_devices (ARRAY_AND_SIZE (e400_devices)); -pxa_set_udc_info (&e7xx_udc_mach_info); }MACHINE_START (E400 ,"Toshiba e400" )
@@ -519,6 +528,7 @@ static struct platform_device e740_t7l66xb_device = {static struct platform_device *e740_devices[]__initdata = { &e740_fb_device, &e740_t7l66xb_device, + &e7xx_gpio_vbus, };static void __init e740_init (void )
@@ -532,7 +542,6 @@ static void __init e740_init(void) "UDCCLK", &pxa25x_device_udc.dev),eseries_get_tmio_gpios ();platform_add_devices (ARRAY_AND_SIZE (e740_devices)); -pxa_set_udc_info (&e7xx_udc_mach_info);pxa_set_ac97_info (NULL );pxa_set_ficp_info (&e7xx_ficp_platform_data); }
@@ -711,6 +720,7 @@ static struct platform_device e750_tc6393xb_device = {static struct platform_device *e750_devices[]__initdata = { &e750_fb_device, &e750_tc6393xb_device, + &e7xx_gpio_vbus, };static void __init e750_init (void )
@@ -723,7 +733,6 @@ static void __init e750_init(void) "GPIO11_CLK", NULL),eseries_get_tmio_gpios ();platform_add_devices (ARRAY_AND_SIZE (e750_devices)); -pxa_set_udc_info (&e7xx_udc_mach_info);pxa_set_ac97_info (NULL );pxa_set_ficp_info (&e7xx_ficp_platform_data); }
@@ -873,12 +882,21 @@ static struct platform_device e800_fb_device = {/* --------------------------- UDC definitions --------------------------- */ -static struct pxa2xx_udc_mach_info e800_udc_mach_info = { +static struct gpio_vbus_mach_info e800_udc_info = { .gpio_vbus =GPIO_E800_USB_DISC , .gpio_pullup =GPIO_E800_USB_PULLUP , .gpio_pullup_inverted =1 }; +static struct platform_device e800_gpio_vbus = { + .name ="gpio-vbus" , + .id =-1 , + .dev = { + .platform_data = &e800_udc_info, + }, +}; + +/* ----------------- e800 tc6393xb parameters ------------------ */ static struct tc6393xb_platform_data e800_tc6393xb_info = {
@@ -907,6 +925,7 @@ static struct platform_device e800_tc6393xb_device = {static struct platform_device *e800_devices[]__initdata = { &e800_fb_device, &e800_tc6393xb_device, + &e800_gpio_vbus, };static void __init e800_init (void )
@@ -919,7 +938,6 @@ static void __init e800_init(void) "GPIO11_CLK", NULL),eseries_get_tmio_gpios ();platform_add_devices (ARRAY_AND_SIZE (e800_devices)); -pxa_set_udc_info (&e800_udc_mach_info);pxa_set_ac97_info (NULL ); }
Signature · 1 line
1.7.2.3
PATCH 2/6 gumstix: switch to using gpio-vbus transceiver
In reply to Dmitry Eremin-SolenikovSwitch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus tranceiver.
--- arch/arm/mach-pxa/gumstix.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/gumstix.c +11 -2
@@ -26,6 +26,7 @@#include <linux/gpio.h> #include <linux/err.h> #include <linux/clk.h> +#include <linux/usb/gpio_vbus.h> #include <asm/setup.h> #include <asm/memory.h>
@@ -106,14 +107,22 @@ static void __init gumstix_mmc_init(void)#endif #ifdef CONFIG_USB_GADGET_PXA25X -static struct pxa2xx_udc_mach_info gumstix_udc_info__initdata = { +static struct gpio_vbus_mach_info gumstix_udc_info = { .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, }; +static struct platform_device gumstix_gpio_vbus = { + .name ="gpio-vbus" , + .id =-1 , + .dev = { + .platform_data = &gumstix_udc_info, + }, +}; +static void __init gumstix_udc_init (void ) { -pxa_set_udc_info (&gumstix_udc_info); +platform_device_register (&gumstix_gpio_vbus); }#else static void gumstix_udc_init (void )
Signature · 1 line
1.7.2.3
PATCH 3/6 PalmTC: switch to using gpio-vbus transceiver
In reply to Dmitry Eremin-SolenikovSwitch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus tranceiver.
--- arch/arm/mach-pxa/palmtc.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/palmtc.c +12 -2
@@ -25,6 +25,7 @@#include <linux/power_supply.h> #include <linux/gpio_keys.h> #include <linux/mtd/physmap.h> +#include <linux/usb/gpio_vbus.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -294,12 +295,21 @@ static struct platform_device palmtc_keyboard = {/****************************************************************************** * UDC ******************************************************************************/ -static struct pxa2xx_udc_mach_info palmtc_udc_info__initdata = { +static struct gpio_vbus_mach_info palmtc_udc_info = { .gpio_vbus =GPIO_NR_PALMTC_USB_DETECT_N , .gpio_vbus_inverted =1 , .gpio_pullup =GPIO_NR_PALMTC_USB_POWER , }; +static struct platform_device palmtc_gpio_vbus = { + .name ="gpio-vbus" , + .id =-1 , + .dev = { + .platform_data = &palmtc_udc_info, + }, +}; + +/****************************************************************************** * Touchscreen / Battery / GPIO-extender ******************************************************************************/
@@ -391,6 +401,7 @@ static struct platform_device *devices[] __initdata = { &palmtc_keyboard, &palmtc_pxa_keys, &palmtc_flash, + &palmtc_gpio_vbus, };static void __init palmtc_init (void )
@@ -404,7 +415,6 @@ static void __init palmtc_init(void)set_pxa_fb_info (&palmtc_lcd_screen);pxa_set_mci_info (&palmtc_mci_platform_data); -pxa_set_udc_info (&palmtc_udc_info);pxa_set_ac97_info (NULL );pxa_set_ficp_info (&palmtc_ficp_platform_data);
Signature · 1 line
1.7.2.3
PATCH 3/6 PalmTC: switch to using gpio-vbus transceiver
Quoted 5 lines · On Wednesday 02 February 2011 18:00:00 Dmitry Eremin-Solenikov wrote:
Switch from handling gpio-vbus in
pxa25x_udcto using standard gpio-vbus tranceiver.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>Cc Marek Vasut <[email protected]>
Looks good
Quoted 56 lines
--- arch/arm/mach-pxa/palmtc.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)arch/arm/mach-pxa/palmtc.c +11
-0@@ -25,6 +25,7 @@#include <linux/power_supply.h> #include <linux/gpio_keys.h> #include <linux/mtd/physmap.h> +#include <linux/usb/gpio_vbus.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -294,12 +295,21 @@ static struct platform_device palmtc_keyboard = {/************************************************************************* ***** * UDC ************************************************************************** ****/ -static struct pxa2xx_udc_mach_info palmtc_udc_info __initdata = { +static struct gpio_vbus_mach_info palmtc_udc_info = { .gpio_vbus =GPIO_NR_PALMTC_USB_DETECT_N , .gpio_vbus_inverted =1 , .gpio_pullup =GPIO_NR_PALMTC_USB_POWER , }; +static struct platform_device palmtc_gpio_vbus = { + .name ="gpio-vbus" , + .id =-1 , + .dev = { + .platform_data = &palmtc_udc_info, + }, +}; + +/************************************************************************* ***** * Touchscreen / Battery / GPIO-extender
**************************************************************************
****/ @@ -391,6 +401,7 @@ static structplatform_device*devices[]__initdata= {&palmtc_keyboard,arch/arm/mach-pxa/palmtc.c +1
-1&palmtc_pxa_keys, &palmtc_flash, + &palmtc_gpio_vbus, };static void __init palmtc_init (void )@@ -404,7 +415,6 @@ static void __init palmtc_init(void)set_pxa_fb_info (&palmtc_lcd_screen);pxa_set_mci_info (&palmtc_mci_platform_data); -pxa_set_udc_info (&palmtc_udc_info);pxa_set_ac97_info (NULL );pxa_set_ficp_info (&palmtc_ficp_platform_data);
PATCH 4/6 tosa: switch to using gpio-vbus transceiver
In reply to Dmitry Eremin-SolenikovSwitch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus tranceiver.
--- arch/arm/mach-pxa/tosa.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/tosa.c +11 -2
@@ -33,6 +33,7 @@#include <linux/pda_power.h> #include <linux/spi/spi.h> #include <linux/input/matrix_keypad.h> +#include <linux/usb/gpio_vbus.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -239,12 +240,20 @@ static struct scoop_pcmcia_config tosa_pcmcia_config = {/* * USB Device Controller */ -static struct pxa2xx_udc_mach_info udc_info__initdata = { +static struct gpio_vbus_mach_info tosa_udc_info = { .gpio_pullup =TOSA_GPIO_USB_PULLUP , .gpio_vbus =TOSA_GPIO_USB_IN , .gpio_vbus_inverted =1 , }; +static struct platform_device tosa_gpio_vbus = { + .name ="gpio-vbus" , + .id =-1 , + .dev = { + .platform_data = &tosa_udc_info, + }, +}; +/* * MMC/SD Device */
@@ -884,6 +893,7 @@ static struct platform_device *devices[] __initdata = { &tosaled_device, &tosa_bt_device, &sharpsl_rom_device, + &tosa_gpio_vbus, };static void tosa_poweroff (void )
@@ -928,7 +938,6 @@ static void __init tosa_init(void) dummy =gpiochip_reserve (TOSA_TC6393XB_GPIO_BASE ,16 );pxa_set_mci_info (&tosa_mci_platform_data); -pxa_set_udc_info (&udc_info);pxa_set_ficp_info (&tosa_ficp_platform_data);pxa_set_i2c_info (NULL );pxa_set_ac97_info (NULL );
Signature · 1 line
1.7.2.3
PATCH 5/6 pxa25x_udc: stop handling gpio-vbus internally
In reply to Dmitry Eremin-SolenikovStop handling gpio-vbus internally. All boards that depended on this functionality have been converted to use gpio-vbus tranceiver. All new boards can use it right from the start. Drop unused code.
--- drivers/usb/gadget/pxa25x_udc.c | 76 ++++----------------------------------- 1 files changed, 7 insertions(+), 69 deletions(-)
drivers/usb/gadget/pxa25x_udc.c +7 -69
@@ -139,24 +139,6 @@ static const char ep0name [] = "ep0";static void pxa25x_ep_fifo_flush (struct usb_ep *ep);static void nuke (struct pxa25x_ep *,int status); -/* one GPIO should be used to detect VBUS from the host */ -static int is_vbus_present (void ) -{ -struct pxa2xx_udc_mach_info *mach = the_controller->mach; - -if (gpio_is_valid (mach->gpio_vbus)) { -int value =gpio_get_value (mach->gpio_vbus); - -if (mach->gpio_vbus_inverted) -return !value; -else -return !!value; - } -if (mach->udc_is_connected) -return mach->udc_is_connected (); -return 1 ; -} -/* one GPIO should control a D+ pullup, so host sees this device (or not) */ static void pullup_off (void ) {
@@ -1055,7 +1037,7 @@ udc_seq_show(struct seq_file *m, void *_d)"%s version: %s\nGadget driver: %s\nHost %s\n\n" , driver_name, DRIVER_VERSION SIZE_STR "(pio)", dev->driver ? dev->driver->driver.name :"(none)" , - is_vbus_present() ? "full speed" : "disconnected"); + dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected");/* registers for device and ep0 */ seq_printf(m,
@@ -1094,7 +1076,7 @@ udc_seq_show(struct seq_file *m, void *_d) (tmp & UDCCFR_ACM) ? " acm" : ""); } -if (!is_vbus_present () || !dev->driver) +if (dev->gadget.speed !=USB_SPEED_FULL || !dev->driver) goto done; seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n",
@@ -1435,14 +1417,6 @@ lubbock_vbus_irq(int irq, void *_dev)#endif -static irqreturn_t udc_vbus_irq (int irq,void *_dev) -{ -struct pxa25x_udc *dev = _dev; - -pxa25x_udc_vbus_session (&dev->gadget,is_vbus_present ()); -return IRQ_HANDLED ; -} -/*-------------------------------------------------------------------------*/
@@ -1766,12 +1740,9 @@ pxa25x_udc_irq(int irq, void *_dev)if (unlikely (udccr &UDCCR_SUSIR )) {udc_ack_int_UDCCR (UDCCR_SUSIR ); handled =1 ; -DBG (DBG_VERBOSE ,"USB suspend%s\n" ,is_vbus_present () - ?"" :"+disconnect" ); +DBG (DBG_VERBOSE ,"USB suspend\n" ); -if (!is_vbus_present ()) -stop_activity (dev, dev->driver); -else if (dev->gadget.speed !=USB_SPEED_UNKNOWN +if (dev->gadget.speed !=USB_SPEED_UNKNOWN && dev->driver && dev->driver->suspend) dev->driver->suspend (&dev->gadget);
@@ -1786,8 +1757,7 @@ pxa25x_udc_irq(int irq, void *_dev)if (dev->gadget.speed !=USB_SPEED_UNKNOWN && dev->driver - && dev->driver->resume - &&is_vbus_present ()) + && dev->driver->resume) dev->driver->resume (&dev->gadget); }
@@ -2137,7 +2107,7 @@ static struct pxa25x_udc memory = {static int __init pxa25x_udc_probe (struct platform_device *pdev) {struct pxa25x_udc *dev = &memory; -int retval, vbus_irq, irq; +int retval, irq;u32 chiprev;/* insist on Intel/ARM/XScale */
@@ -2199,19 +2169,6 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) dev->transceiver =otg_get_transceiver (); -if (gpio_is_valid (dev->mach->gpio_vbus)) { -if ((retval =gpio_request (dev->mach->gpio_vbus, -"pxa25x_udc GPIO VBUS" ))) { -dev_dbg (&pdev->dev, -"can't get vbus gpio %d, err: %d\n" , - dev->mach->gpio_vbus, retval); - goto err_gpio_vbus; - } -gpio_direction_input (dev->mach->gpio_vbus); - vbus_irq =gpio_to_irq (dev->mach->gpio_vbus); - }else - vbus_irq =0 ; -if (gpio_is_valid (dev->mach->gpio_pullup)) {if ((retval =gpio_request (dev->mach->gpio_pullup,"pca25x_udc GPIO PULLUP" ))) {
@@ -2237,7 +2194,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)udc_disable (dev);udc_reinit (dev); - dev->vbus = !!is_vbus_present (); + dev->vbus =0 ;/* irq setup after old hardware state is cleaned up */ retval = request_irq(irq, pxa25x_udc_irq,
@@ -2273,22 +2230,10 @@ lubbock_fail0: } } else#endif -if (vbus_irq) { - retval =request_irq (vbus_irq, udc_vbus_irq, -IRQF_DISABLED |IRQF_SAMPLE_RANDOM | -IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , - driver_name, dev); -if (retval !=0 ) { -pr_err ("%s: can't get irq %i, err %d\n" , - driver_name, vbus_irq, retval); - goto err_vbus_irq; - } - }create_debug_files (dev);return 0 ; - err_vbus_irq:#ifdef CONFIG_ARCH_LUBBOCK free_irq (LUBBOCK_USB_DISC_IRQ , dev); err_irq_lub:
@@ -2298,9 +2243,6 @@ lubbock_fail0:if (gpio_is_valid (dev->mach->gpio_pullup))gpio_free (dev->mach->gpio_pullup); err_gpio_pullup: -if (gpio_is_valid (dev->mach->gpio_vbus)) -gpio_free (dev->mach->gpio_vbus); - err_gpio_vbus:if (dev->transceiver) {otg_put_transceiver (dev->transceiver); dev->transceiver =NULL ;
@@ -2337,10 +2279,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) free_irq(LUBBOCK_USB_IRQ, dev); }#endif -if (gpio_is_valid (dev->mach->gpio_vbus)) { -free_irq (gpio_to_irq (dev->mach->gpio_vbus), dev); -gpio_free (dev->mach->gpio_vbus); - }if (gpio_is_valid (dev->mach->gpio_pullup))gpio_free (dev->mach->gpio_pullup);
Signature · 1 line
1.7.2.3
PATCH 6/6 pxa2xx: drop gpio_vbus field from info struct
In reply to Dmitry Eremin-SolenikovNeither pxa25x_udc, nor pxa27x_udc use gpio_vbus/gpio_vbus_inverted anymore. Drop those two fields from udc info completely.
--- arch/arm/include/asm/mach/udc_pxa2xx.h | 2 -- arch/arm/mach-pxa/corgi.c | 1 - arch/arm/mach-pxa/devices.c | 1 - 3 files changed, 0 insertions(+), 4 deletions(-)
arch/arm/include/asm/mach/udc_pxa2xx.h +0 -2
@@ -20,8 +20,6 @@ struct pxa2xx_udc_mach_info {* VBUS IRQ and omit the methods above. Store the GPIO number * here. Note that sometimes the signals go through inverters... */ -bool gpio_vbus_inverted; -int gpio_vbus;/* high == vbus present */ bool gpio_pullup_inverted;int gpio_pullup;/* high == pullup activated */ };
arch/arm/mach-pxa/corgi.c +0 -1
@@ -462,7 +462,6 @@ static struct pxaficp_platform_data corgi_ficp_platform_data = {* USB Device Controller */ static struct pxa2xx_udc_mach_info udc_info__initdata = { - .gpio_vbus =-1 ,/* no connect GPIO; corgi can't tell connection status */ .gpio_pullup =CORGI_GPIO_USB_PULLUP , };
arch/arm/mach-pxa/devices.c +0 -1
@@ -90,7 +90,6 @@ void __init pxa_set_mci_info(struct pxamci_platform_data *info)static struct pxa2xx_udc_mach_info pxa_udc_info = { .gpio_pullup =-1 , - .gpio_vbus =-1 , };void __init pxa_set_udc_info (struct pxa2xx_udc_mach_info *info)
Signature · 1 line
1.7.2.3
cover Switch pxa25x_udc devices to use gpio-vbus tranceiver
In reply to Dmitry Eremin-SolenikovHello,
Quoted 3 lines · Dmitry Eremin-Solenikov
pxa25x_udcdriver contains functionality duplicating gpio-vbus tranceiver functions. Switch all devices, that depend on it, to use gpio-vbus and (in the last patches) drop related code frompxa25x_udc.
Any comments on this patchset?
Signature · 2 lines
With best wishes Dmitry