All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc
@ 2011-02-14 12:33 Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 1/5] eseries: switch to using gpio-vbus transceiver Dmitry Eremin-Solenikov
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-02-14 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] eseries: switch to using gpio-vbus transceiver
  2011-02-14 12:33 [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc Dmitry Eremin-Solenikov
@ 2011-02-14 12:33 ` Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 2/5] gumstix: " Dmitry Eremin-Solenikov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-02-14 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

Switch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus
tranceiver.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Ian Molton <spyro@f2s.com>
---
 arch/arm/mach-pxa/eseries.c |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index edca0a0..6b09645 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -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);
 }
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] gumstix: switch to using gpio-vbus transceiver
  2011-02-14 12:33 [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 1/5] eseries: switch to using gpio-vbus transceiver Dmitry Eremin-Solenikov
@ 2011-02-14 12:33 ` Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 3/5] tosa: " Dmitry Eremin-Solenikov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-02-14 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

Switch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus
tranceiver.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Steve Sakoman <sakoman@gmail.com>
---
 arch/arm/mach-pxa/gumstix.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index 6fd319e..d65e4bd 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -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)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] tosa: switch to using gpio-vbus transceiver
  2011-02-14 12:33 [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 1/5] eseries: switch to using gpio-vbus transceiver Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 2/5] gumstix: " Dmitry Eremin-Solenikov
@ 2011-02-14 12:33 ` Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 4/5] pxa25x_udc: stop handling gpio-vbus internally Dmitry Eremin-Solenikov
  2011-02-14 12:33 ` [PATCH 5/5] pxa2xx: drop gpio_vbus field from info struct Dmitry Eremin-Solenikov
  4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-02-14 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

Switch from handling gpio-vbus in pxa25x_udc to using standard gpio-vbus
tranceiver.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 arch/arm/mach-pxa/tosa.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index af152e7..88b2329 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -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);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] pxa25x_udc: stop handling gpio-vbus internally
  2011-02-14 12:33 [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc Dmitry Eremin-Solenikov
                   ` (2 preceding siblings ...)
  2011-02-14 12:33 ` [PATCH 3/5] tosa: " Dmitry Eremin-Solenikov
@ 2011-02-14 12:33 ` Dmitry Eremin-Solenikov
  2011-02-18  7:33   ` Eric Miao
  2011-02-14 12:33 ` [PATCH 5/5] pxa2xx: drop gpio_vbus field from info struct Dmitry Eremin-Solenikov
  4 siblings, 1 reply; 7+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-02-14 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/usb/gadget/pxa25x_udc.c |   76 ++++-----------------------------------
 1 files changed, 7 insertions(+), 69 deletions(-)

diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index b37f92c..444b60a 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -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);
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] pxa2xx: drop gpio_vbus field from info struct
  2011-02-14 12:33 [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc Dmitry Eremin-Solenikov
                   ` (3 preceding siblings ...)
  2011-02-14 12:33 ` [PATCH 4/5] pxa25x_udc: stop handling gpio-vbus internally Dmitry Eremin-Solenikov
@ 2011-02-14 12:33 ` Dmitry Eremin-Solenikov
  4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-02-14 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

Neither pxa25x_udc, nor pxa27x_udc use gpio_vbus/gpio_vbus_inverted
anymore. Drop those two fields from udc info completely.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 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(-)

diff --git a/arch/arm/include/asm/mach/udc_pxa2xx.h b/arch/arm/include/asm/mach/udc_pxa2xx.h
index 833306e..ea297ac 100644
--- a/arch/arm/include/asm/mach/udc_pxa2xx.h
+++ b/arch/arm/include/asm/mach/udc_pxa2xx.h
@@ -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 */
 };
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index a5452a3..002be00 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -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,
 };
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 4c766e3..9e10841 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -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)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] pxa25x_udc: stop handling gpio-vbus internally
  2011-02-14 12:33 ` [PATCH 4/5] pxa25x_udc: stop handling gpio-vbus internally Dmitry Eremin-Solenikov
@ 2011-02-18  7:33   ` Eric Miao
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Miao @ 2011-02-18  7:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 14, 2011 at 8:33 PM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:
> 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.
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

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

> ---
> ?drivers/usb/gadget/pxa25x_udc.c | ? 76 ++++-----------------------------------
> ?1 files changed, 7 insertions(+), 69 deletions(-)
>
> diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
> index b37f92c..444b60a 100644
> --- a/drivers/usb/gadget/pxa25x_udc.c
> +++ b/drivers/usb/gadget/pxa25x_udc.c
> @@ -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);
>
> --
> 1.7.2.3
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-18  7:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 12:33 [PATCH 0/5][RESENT] Get rid of gpio-vbus related code from pxa25x_udc Dmitry Eremin-Solenikov
2011-02-14 12:33 ` [PATCH 1/5] eseries: switch to using gpio-vbus transceiver Dmitry Eremin-Solenikov
2011-02-14 12:33 ` [PATCH 2/5] gumstix: " Dmitry Eremin-Solenikov
2011-02-14 12:33 ` [PATCH 3/5] tosa: " Dmitry Eremin-Solenikov
2011-02-14 12:33 ` [PATCH 4/5] pxa25x_udc: stop handling gpio-vbus internally Dmitry Eremin-Solenikov
2011-02-18  7:33   ` Eric Miao
2011-02-14 12:33 ` [PATCH 5/5] pxa2xx: drop gpio_vbus field from info struct Dmitry Eremin-Solenikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.