Skip to contentSkip to conversation

Get rid of gpio-vbus related code from pxa25x_udc

PATCH New Dmitry Eremin-Solenikov 2 participants 7 messages Feb 14, 2011 – Feb 18, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Get rid of gpio-vbus related code from pxa25x_udc

Currently pxa25x_udc contains some code duplicating gpio-vbus functionality. Please merge this serie of patches (based on v2.6.38-rc4), which makes all relevant platforms use gpio-vbus tranceiver instead of relying on pxa25x_udc and then drop support for gpio-vbus handling in pxa25x_udc.

Please tell me if I should rebase these patches on top of some other commit.

The following changes since commit 100b33c8bd8a3235fd0b7948338d6cbb3db3c63d:

Linux 2.6.38-rc4 (2011-02-07 16:03:55 -0800)

Dmitry Eremin-Solenikov (5):
eseries: switch to using gpio-vbus transceiver
gumstix: switch to using gpio-vbus transceiver
tosa: switch to using gpio-vbus transceiver
pxa25x_udc: stop handling gpio-vbus internally
pxa2xx: drop gpio_vbus field from info struct

 arch/arm/include/asm/mach/udc_pxa2xx.h |    2 -
 arch/arm/mach-pxa/corgi.c              |    1 -
 arch/arm/mach-pxa/devices.c            |    1 -
 arch/arm/mach-pxa/eseries.c            |   34 +++++++++++---
 arch/arm/mach-pxa/gumstix.c            |   13 +++++-
 arch/arm/mach-pxa/tosa.c               |   13 +++++-
 drivers/usb/gadget/pxa25x_udc.c        |   76 +++-----------------------------
 7 files changed, 55 insertions(+), 85 deletions(-)
#1 lore raw

PATCH 1/5 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
index edca0a0..6b09645 100644
@@ -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
#2 lore raw

PATCH 2/5 gumstix: switch to using gpio-vbus transceiver

In reply to Dmitry Eremin-Solenikov

Switch 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
index 6fd319e..d65e4bd 100644
@@ -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
#3 lore raw

PATCH 3/5 tosa: switch to using gpio-vbus transceiver

In reply to Dmitry Eremin-Solenikov

Switch 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
index af152e7..88b2329 100644
@@ -34,6 +34,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/input/matrix_keypad.h>
+#include <linux/usb/gpio_vbus.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -240,12 +241,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
  */
@@ -885,6 +894,7 @@ static struct platform_device *devices[] __initdata = {
 	&tosaled_device,
 	&tosa_bt_device,
 	&sharpsl_rom_device,
+	&tosa_gpio_vbus,
 };
 
 static void tosa_poweroff(void)
@@ -931,7 +941,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
#4 lore raw

PATCH 4/5 pxa25x_udc: stop handling gpio-vbus internally

In reply to Dmitry Eremin-Solenikov

Stop 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
index b37f92c..444b60a 100644
@@ -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
#5 lore raw

PATCH 4/5 pxa25x_udc: stop handling gpio-vbus internally

Quoted 5 lines · Dmitry Eremin-Solenikov

Stop 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.

I'm good with the change below. The original intention of is_vbus_present() is actually to detect if it's connected. A name of is_connected() would be better, and I'm fine using gadget.speed for this.

David or any other USB people please have a review and give an Ack-by? I'd like this being merged through the ARM tree as the other four patches better go there as well.

Thanks

Quoted 177 lines

---
?drivers/usb/gadget/pxa25x_udc.c | ? 76 ++++----------------------------------- ?1 files changed, 7 insertions(+), 69 deletions(-)

drivers/usb/gadget/pxa25x_udc.c +0 -18
index b37f92c..444b60a 100644
@@ -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)
?{

drivers/usb/gadget/pxa25x_udc.c +1 -1
@@ -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,

drivers/usb/gadget/pxa25x_udc.c +1 -1
@@ -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

drivers/usb/gadget/pxa25x_udc.c +0 -8
-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;
-}
-

?/*-------------------------------------------------------------------------*/

drivers/usb/gadget/pxa25x_udc.c +2 -5
@@ -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);

drivers/usb/gadget/pxa25x_udc.c +0 -0
@@ -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); ? ? ? ? ? ? ? ?}

drivers/usb/gadget/pxa25x_udc.c +1 -1
@@ -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 */

drivers/usb/gadget/pxa25x_udc.c +1 -14
@@ -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,

drivers/usb/gadget/pxa25x_udc.c +0 -0
@@ -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:

drivers/usb/gadget/pxa25x_udc.c +0 -0
@@ -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;

drivers/usb/gadget/pxa25x_udc.c +0 -0
@@ -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);

--
1.7.2.3

#6 lore raw

PATCH 5/5 pxa2xx: drop gpio_vbus field from info struct

In reply to Dmitry Eremin-Solenikov

Neither 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
index 833306e..ea297ac 100644
@@ -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
index a5452a3..002be00 100644
@@ -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
index 4c766e3..9e10841 100644
@@ -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