* [PATCH 1/7] balloon3: drop udc_is_connected @ 2011-04-01 13:56 Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 2/7] mioa701: " Dmitry Eremin-Solenikov ` (5 more replies) 0 siblings, 6 replies; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel Balloon3 is a pxa270 machins and pxa27x_udc driver doesn't pay any attention to udc_is_connected, so drop it. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- arch/arm/mach-pxa/balloon3.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c index bfbecec..79cabe8 100644 --- a/arch/arm/mach-pxa/balloon3.c +++ b/arch/arm/mach-pxa/balloon3.c @@ -317,14 +317,8 @@ static void balloon3_udc_command(int cmd) UP2OCR &= ~UP2OCR_DPPUE; } -static int balloon3_udc_is_connected(void) -{ - return 1; -} - static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = { .udc_command = balloon3_udc_command, - .udc_is_connected = balloon3_udc_is_connected, .gpio_pullup = -1, }; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/7] mioa701: drop udc_is_connected 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov @ 2011-04-01 13:56 ` Dmitry Eremin-Solenikov 2011-04-01 14:10 ` Sergei Shtylyov 2011-04-01 13:56 ` [PATCH 3/7] stargate2: udc_is_connected is ignored for pxa27x, drop it Dmitry Eremin-Solenikov ` (4 subsequent siblings) 5 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel Mioa701 is a pxa270 machine and pxa27x_udc driver doesn't pay any attention to udc_is_connected, so drop it. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- arch/arm/mach-pxa/mioa701.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index dd13bb6..f69a3c7 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c @@ -402,13 +402,7 @@ static void gsm_exit(void) /* * USB UDC */ -static int is_usb_connected(void) -{ - return !gpio_get_value(GPIO13_nUSB_DETECT); -} - static struct pxa2xx_udc_mach_info mioa701_udc_info = { - .udc_is_connected = is_usb_connected, .gpio_pullup = GPIO22_USB_ENABLE, }; @@ -596,6 +590,11 @@ static int is_ac_connected(void) return gpio_get_value(GPIO96_AC_DETECT); } +static int is_usb_connected(void) +{ + return !gpio_get_value(GPIO13_nUSB_DETECT); +} + static void mioa701_set_charge(int flags) { gpio_set_value(GPIO9_CHARGE_EN, (flags == PDA_POWER_CHARGE_USB)); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/7] mioa701: drop udc_is_connected 2011-04-01 13:56 ` [PATCH 2/7] mioa701: " Dmitry Eremin-Solenikov @ 2011-04-01 14:10 ` Sergei Shtylyov 2011-04-01 14:50 ` Dmitry Eremin-Solenikov 0 siblings, 1 reply; 23+ messages in thread From: Sergei Shtylyov @ 2011-04-01 14:10 UTC (permalink / raw) To: linux-arm-kernel Dmitry Eremin-Solenikov wrote: > Mioa701 is a pxa270 machine and pxa27x_udc driver doesn't pay any attention > to udc_is_connected, so drop it. You seem to be moving is_usb_connected(), not dropping it... > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> > --- > arch/arm/mach-pxa/mioa701.c | 11 +++++------ > 1 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c > index dd13bb6..f69a3c7 100644 > --- a/arch/arm/mach-pxa/mioa701.c > +++ b/arch/arm/mach-pxa/mioa701.c > @@ -402,13 +402,7 @@ static void gsm_exit(void) > /* > * USB UDC > */ > -static int is_usb_connected(void) > -{ > - return !gpio_get_value(GPIO13_nUSB_DETECT); > -} > - > static struct pxa2xx_udc_mach_info mioa701_udc_info = { > - .udc_is_connected = is_usb_connected, > .gpio_pullup = GPIO22_USB_ENABLE, > }; > > @@ -596,6 +590,11 @@ static int is_ac_connected(void) > return gpio_get_value(GPIO96_AC_DETECT); > } > > +static int is_usb_connected(void) > +{ > + return !gpio_get_value(GPIO13_nUSB_DETECT); > +} > + > static void mioa701_set_charge(int flags) > { > gpio_set_value(GPIO9_CHARGE_EN, (flags == PDA_POWER_CHARGE_USB)); WBR, Sergei ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/7] mioa701: drop udc_is_connected 2011-04-01 14:10 ` Sergei Shtylyov @ 2011-04-01 14:50 ` Dmitry Eremin-Solenikov 2011-04-04 6:58 ` Eric Miao 0 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 14:50 UTC (permalink / raw) To: linux-arm-kernel On 01.04.2011 18:10, Sergei Shtylyov wrote: > Dmitry Eremin-Solenikov wrote: > >> Mioa701 is a pxa270 machine and pxa27x_udc driver doesn't pay any >> attention >> to udc_is_connected, so drop it. > > You seem to be moving is_usb_connected(), not dropping it... It may seem to be a bad wording. I'm dropping pxa2xx_udc_mach_info.udc_is_connected() callback assignment. The is_usb_connected() function is still used by pda-power driver. > >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> >> --- >> arch/arm/mach-pxa/mioa701.c | 11 +++++------ >> 1 files changed, 5 insertions(+), 6 deletions(-) >> >> diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c >> index dd13bb6..f69a3c7 100644 >> --- a/arch/arm/mach-pxa/mioa701.c >> +++ b/arch/arm/mach-pxa/mioa701.c >> @@ -402,13 +402,7 @@ static void gsm_exit(void) >> /* >> * USB UDC >> */ >> -static int is_usb_connected(void) >> -{ >> - return !gpio_get_value(GPIO13_nUSB_DETECT); >> -} >> - >> static struct pxa2xx_udc_mach_info mioa701_udc_info = { >> - .udc_is_connected = is_usb_connected, >> .gpio_pullup = GPIO22_USB_ENABLE, >> }; >> >> @@ -596,6 +590,11 @@ static int is_ac_connected(void) >> return gpio_get_value(GPIO96_AC_DETECT); >> } >> >> +static int is_usb_connected(void) >> +{ >> + return !gpio_get_value(GPIO13_nUSB_DETECT); >> +} >> + >> static void mioa701_set_charge(int flags) >> { >> gpio_set_value(GPIO9_CHARGE_EN, (flags == PDA_POWER_CHARGE_USB)); > > WBR, Sergei -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/7] mioa701: drop udc_is_connected 2011-04-01 14:50 ` Dmitry Eremin-Solenikov @ 2011-04-04 6:58 ` Eric Miao 0 siblings, 0 replies; 23+ messages in thread From: Eric Miao @ 2011-04-04 6:58 UTC (permalink / raw) To: linux-arm-kernel On Fri, Apr 1, 2011 at 10:50 PM, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote: > On 01.04.2011 18:10, Sergei Shtylyov wrote: >> >> Dmitry Eremin-Solenikov wrote: >> >>> Mioa701 is a pxa270 machine and pxa27x_udc driver doesn't pay any >>> attention >>> to udc_is_connected, so drop it. >> >> You seem to be moving is_usb_connected(), not dropping it... > > It may seem to be a bad wording. I'm dropping > pxa2xx_udc_mach_info.udc_is_connected() callback assignment. The > is_usb_connected() function is still used by pda-power driver. I'll apply this patch as is. However, this does reveal another problem at least, that pda-power should have a way to know usb connected status, maybe through gpio_vbus. > >> >>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> >>> --- >>> arch/arm/mach-pxa/mioa701.c | 11 +++++------ >>> 1 files changed, 5 insertions(+), 6 deletions(-) >>> >>> diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c >>> index dd13bb6..f69a3c7 100644 >>> --- a/arch/arm/mach-pxa/mioa701.c >>> +++ b/arch/arm/mach-pxa/mioa701.c >>> @@ -402,13 +402,7 @@ static void gsm_exit(void) >>> /* >>> * USB UDC >>> */ >>> -static int is_usb_connected(void) >>> -{ >>> - return !gpio_get_value(GPIO13_nUSB_DETECT); >>> -} >>> - >>> static struct pxa2xx_udc_mach_info mioa701_udc_info = { >>> - .udc_is_connected = is_usb_connected, >>> .gpio_pullup = GPIO22_USB_ENABLE, >>> }; >>> >>> @@ -596,6 +590,11 @@ static int is_ac_connected(void) >>> return gpio_get_value(GPIO96_AC_DETECT); >>> } >>> >>> +static int is_usb_connected(void) >>> +{ >>> + return !gpio_get_value(GPIO13_nUSB_DETECT); >>> +} >>> + >>> static void mioa701_set_charge(int flags) >>> { >>> gpio_set_value(GPIO9_CHARGE_EN, (flags == PDA_POWER_CHARGE_USB)); >> >> WBR, Sergei > > > -- > With best wishes > Dmitry > > ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 3/7] stargate2: udc_is_connected is ignored for pxa27x, drop it 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 2/7] mioa701: " Dmitry Eremin-Solenikov @ 2011-04-01 13:56 ` Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver Dmitry Eremin-Solenikov ` (3 subsequent siblings) 5 siblings, 0 replies; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- arch/arm/mach-pxa/stargate2.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index cb5611d..3e3621d 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c @@ -956,13 +956,7 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = { /* Board doesn't support cable detection - so always lie and say * something is there. */ -static int sg2_udc_detect(void) -{ - return 1; -} - static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = { - .udc_is_connected = sg2_udc_detect, .udc_command = sg2_udc_command, }; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 2/7] mioa701: " Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 3/7] stargate2: udc_is_connected is ignored for pxa27x, drop it Dmitry Eremin-Solenikov @ 2011-04-01 13:56 ` Dmitry Eremin-Solenikov 2011-04-04 7:01 ` Eric Miao 2011-04-01 13:56 ` [PATCH 5/7] lubbock: switch to using lubbock_usb_xceiv transceiver Dmitry Eremin-Solenikov ` (2 subsequent siblings) 5 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel Move all handling of lubbock board to separate lubbock-usb transceiver, removing cruft from pxa25x_udc. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- drivers/usb/gadget/pxa25x_udc.c | 74 ---------------- drivers/usb/otg/Kconfig | 8 ++ drivers/usb/otg/Makefile | 1 + drivers/usb/otg/lubbock-usb.c | 178 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 187 insertions(+), 74 deletions(-) create mode 100644 drivers/usb/otg/lubbock-usb.c diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 444b60a..6cb32b8 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c @@ -65,10 +65,6 @@ #include <mach/pxa25x-udc.h> #endif -#ifdef CONFIG_ARCH_LUBBOCK -#include <mach/lubbock.h> -#endif - #include <asm/mach/udc_pxa2xx.h> @@ -1383,42 +1379,6 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); /*-------------------------------------------------------------------------*/ -#ifdef CONFIG_ARCH_LUBBOCK - -/* Lubbock has separate connect and disconnect irqs. More typical designs - * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. - */ - -static irqreturn_t -lubbock_vbus_irq(int irq, void *_dev) -{ - struct pxa25x_udc *dev = _dev; - int vbus; - - dev->stats.irqs++; - switch (irq) { - case LUBBOCK_USB_IRQ: - vbus = 1; - disable_irq(LUBBOCK_USB_IRQ); - enable_irq(LUBBOCK_USB_DISC_IRQ); - break; - case LUBBOCK_USB_DISC_IRQ: - vbus = 0; - disable_irq(LUBBOCK_USB_DISC_IRQ); - enable_irq(LUBBOCK_USB_IRQ); - break; - default: - return IRQ_NONE; - } - - pxa25x_udc_vbus_session(&dev->gadget, vbus); - return IRQ_HANDLED; -} - -#endif - - -/*-------------------------------------------------------------------------*/ static inline void clear_ep_state (struct pxa25x_udc *dev) { @@ -2206,38 +2166,10 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) } dev->got_irq = 1; -#ifdef CONFIG_ARCH_LUBBOCK - if (machine_is_lubbock()) { - retval = request_irq(LUBBOCK_USB_DISC_IRQ, - lubbock_vbus_irq, - IRQF_DISABLED | IRQF_SAMPLE_RANDOM, - driver_name, dev); - if (retval != 0) { - pr_err("%s: can't get irq %i, err %d\n", - driver_name, LUBBOCK_USB_DISC_IRQ, retval); -lubbock_fail0: - goto err_irq_lub; - } - retval = request_irq(LUBBOCK_USB_IRQ, - lubbock_vbus_irq, - IRQF_DISABLED | IRQF_SAMPLE_RANDOM, - driver_name, dev); - if (retval != 0) { - pr_err("%s: can't get irq %i, err %d\n", - driver_name, LUBBOCK_USB_IRQ, retval); - free_irq(LUBBOCK_USB_DISC_IRQ, dev); - goto lubbock_fail0; - } - } else -#endif create_debug_files(dev); return 0; -#ifdef CONFIG_ARCH_LUBBOCK - free_irq(LUBBOCK_USB_DISC_IRQ, dev); - err_irq_lub: -#endif free_irq(irq, dev); err_irq1: if (gpio_is_valid(dev->mach->gpio_pullup)) @@ -2273,12 +2205,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) free_irq(platform_get_irq(pdev, 0), 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 if (gpio_is_valid(dev->mach->gpio_pullup)) gpio_free(dev->mach->gpio_pullup); diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index daf3e5f..7ddfc54 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig @@ -122,4 +122,12 @@ config AB8500_USB This transceiver supports high and full speed devices plus, in host mode, low speed. +config LUBBOCK_USB + tristate "Intel DBPXA250 (Lubbock) Tranceiver Driver" + depends on ARCH_LUBBOCK + select USB_OTG_UTILS + help + Enable this to support the USB UDC connectivity on Intel DBPXA250 + development platform (so-called Lubbock). + endif # USB || OTG diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile index e22d917..5ed42cd 100644 --- a/drivers/usb/otg/Makefile +++ b/drivers/usb/otg/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_USB_ULPI) += ulpi.o obj-$(CONFIG_USB_ULPI_VIEWPORT) += ulpi_viewport.o obj-$(CONFIG_USB_MSM_OTG) += msm_otg.o obj-$(CONFIG_AB8500_USB) += ab8500-usb.o +obj-$(CONFIG_LUBBOCK_USB) += lubbock-usb.o diff --git a/drivers/usb/otg/lubbock-usb.c b/drivers/usb/otg/lubbock-usb.c new file mode 100644 index 0000000..d18c101 --- /dev/null +++ b/drivers/usb/otg/lubbock-usb.c @@ -0,0 +1,178 @@ +/* + * Intel DBPXA250 Development Platform USB UDC support + * + * Copyright (C) 2011 Dmitry Eremin-Solenikov + * + * Based on pxa25x_udc driver: + * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker) + * Copyright (C) 2003 Robert Schwebel, Pengutronix + * Copyright (C) 2003 Benedikt Spranger, Pengutronix + * Copyright (C) 2003 David Brownell + * Copyright (C) 2003 Joshua Wise + * + * Largely based on lubbock-usb-xceiv: + * Copyright (C) 2009 Texas Instruments Inc + */ +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/dma-mapping.h> +#include <linux/usb.h> +#include <linux/usb/gadget.h> +#include <linux/usb/otg.h> +#include <linux/slab.h> +#include <linux/interrupt.h> + +#include <mach/lubbock.h> + +static int lubbock_udc_is_connected(void) +{ + return (LUB_MISC_RD & (1 << 9)) == 0; +} + +static int lubbock_set_peripheral(struct otg_transceiver *lubbock, + struct usb_gadget *gadget) +{ + if (!lubbock) + return -ENODEV; + + if (!gadget) { + lubbock->gadget = NULL; + return 0; + } + + lubbock->gadget = gadget; + lubbock->state = OTG_STATE_B_IDLE; + if (lubbock_udc_is_connected()) { + lubbock->state = OTG_STATE_B_PERIPHERAL; + usb_gadget_vbus_connect(lubbock->gadget); + } + + return 0; +} + +/* Lubbock has separate connect and disconnect irqs. More typical designs + * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. + */ + +static irqreturn_t +lubbock_vbus_irq(int irq, void *_dev) +{ + struct otg_transceiver *lubbock = _dev; + switch (irq) { + case LUBBOCK_USB_IRQ: + lubbock->state = OTG_STATE_B_PERIPHERAL; + usb_gadget_vbus_connect(lubbock->gadget); + + disable_irq(LUBBOCK_USB_IRQ); + enable_irq(LUBBOCK_USB_DISC_IRQ); + break; + case LUBBOCK_USB_DISC_IRQ: + usb_gadget_vbus_disconnect(lubbock->gadget); + lubbock->state = OTG_STATE_B_IDLE; + + disable_irq(LUBBOCK_USB_DISC_IRQ); + enable_irq(LUBBOCK_USB_IRQ); + break; + default: + return IRQ_NONE; + } + + return IRQ_HANDLED; +} + + +static int __devinit lubbock_usb_xceiv_probe(struct platform_device *pdev) +{ + struct otg_transceiver *lubbock; + int err; + + lubbock = kzalloc(sizeof *lubbock, GFP_KERNEL); + if (!lubbock) + return -ENOMEM; + + lubbock->dev = &pdev->dev; + lubbock->label = "lubbock-xceiv"; + lubbock->state = OTG_STATE_UNDEFINED; + lubbock->set_peripheral = lubbock_set_peripheral; + + err = request_irq(LUBBOCK_USB_DISC_IRQ, + lubbock_vbus_irq, + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, + lubbock->label, lubbock); + if (err != 0) { + pr_err("%s: can't get irq %i, err %d\n", + lubbock->label, LUBBOCK_USB_DISC_IRQ, err); + goto err_irq_lub; + } + err = request_irq(LUBBOCK_USB_IRQ, + lubbock_vbus_irq, + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, + lubbock->label, lubbock); + if (err != 0) { + pr_err("%s: can't get irq %i, err %d\n", + lubbock->label, LUBBOCK_USB_IRQ, err); + goto err_irq_lub2; + } + + err = otg_set_transceiver(lubbock); + if (err) { + dev_err(&pdev->dev, "can't register transceiver, err: %d\n", + err); + goto exit; + } + + platform_set_drvdata(pdev, lubbock); + + BLOCKING_INIT_NOTIFIER_HEAD(&lubbock->notifier); + + return 0; +exit: + free_irq(LUBBOCK_USB_IRQ, lubbock); +err_irq_lub2: + free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); +err_irq_lub: + kfree(lubbock); + return err; +} + +static int __devexit lubbock_usb_xceiv_remove(struct platform_device *pdev) +{ + struct otg_transceiver *lubbock = platform_get_drvdata(pdev); + + otg_set_transceiver(NULL); + + platform_set_drvdata(pdev, NULL); + + free_irq(LUBBOCK_USB_IRQ, lubbock); + free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); + + kfree(lubbock); + + return 0; +} + +static struct platform_driver lubbock_usb_xceiv_driver = { + .probe = lubbock_usb_xceiv_probe, + .remove = __devexit_p(lubbock_usb_xceiv_remove), + .driver = { + .name = "lubbock_usb_xceiv", + .owner = THIS_MODULE, + }, +}; + +static int __init lubbock_usb_xceiv_init(void) +{ + return platform_driver_register(&lubbock_usb_xceiv_driver); +} +subsys_initcall(lubbock_usb_xceiv_init); + +static void __exit lubbock_usb_xceiv_exit(void) +{ + platform_driver_unregister(&lubbock_usb_xceiv_driver); +} +module_exit(lubbock_usb_xceiv_exit); + +MODULE_ALIAS("platform:lubbock_usb_xceiv"); +MODULE_DESCRIPTION("lubbock USB Transceiver driver"); +MODULE_LICENSE("GPL"); + -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-04-01 13:56 ` [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver Dmitry Eremin-Solenikov @ 2011-04-04 7:01 ` Eric Miao 2011-04-04 7:04 ` Eric Miao 0 siblings, 1 reply; 23+ messages in thread From: Eric Miao @ 2011-04-04 7:01 UTC (permalink / raw) To: linux-arm-kernel On Fri, Apr 1, 2011 at 9:56 PM, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote: > Move all handling of lubbock board to separate lubbock-usb transceiver, > removing cruft from pxa25x_udc. > > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> I like this change very much. It would be perfect if someone can actually test this, but provided Lubbock is no way popular these days, it would just be fine. Acked-by: Eric Miao <eric.y.miao@gmail.com> > --- > ?drivers/usb/gadget/pxa25x_udc.c | ? 74 ---------------- > ?drivers/usb/otg/Kconfig ? ? ? ? | ? ?8 ++ > ?drivers/usb/otg/Makefile ? ? ? ?| ? ?1 + > ?drivers/usb/otg/lubbock-usb.c ? | ?178 +++++++++++++++++++++++++++++++++++++++ > ?4 files changed, 187 insertions(+), 74 deletions(-) > ?create mode 100644 drivers/usb/otg/lubbock-usb.c > > diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c > index 444b60a..6cb32b8 100644 > --- a/drivers/usb/gadget/pxa25x_udc.c > +++ b/drivers/usb/gadget/pxa25x_udc.c > @@ -65,10 +65,6 @@ > ?#include <mach/pxa25x-udc.h> > ?#endif > > -#ifdef CONFIG_ARCH_LUBBOCK > -#include <mach/lubbock.h> > -#endif > - > ?#include <asm/mach/udc_pxa2xx.h> > > > @@ -1383,42 +1379,6 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); > > ?/*-------------------------------------------------------------------------*/ > > -#ifdef CONFIG_ARCH_LUBBOCK > - > -/* Lubbock has separate connect and disconnect irqs. ?More typical designs > - * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. > - */ > - > -static irqreturn_t > -lubbock_vbus_irq(int irq, void *_dev) > -{ > - ? ? ? struct pxa25x_udc ? ? ? *dev = _dev; > - ? ? ? int ? ? ? ? ? ? ? ? ? ? vbus; > - > - ? ? ? dev->stats.irqs++; > - ? ? ? switch (irq) { > - ? ? ? case LUBBOCK_USB_IRQ: > - ? ? ? ? ? ? ? vbus = 1; > - ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_IRQ); > - ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_DISC_IRQ); > - ? ? ? ? ? ? ? break; > - ? ? ? case LUBBOCK_USB_DISC_IRQ: > - ? ? ? ? ? ? ? vbus = 0; > - ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_DISC_IRQ); > - ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_IRQ); > - ? ? ? ? ? ? ? break; > - ? ? ? default: > - ? ? ? ? ? ? ? return IRQ_NONE; > - ? ? ? } > - > - ? ? ? pxa25x_udc_vbus_session(&dev->gadget, vbus); > - ? ? ? return IRQ_HANDLED; > -} > - > -#endif > - > - > -/*-------------------------------------------------------------------------*/ > > ?static inline void clear_ep_state (struct pxa25x_udc *dev) > ?{ > @@ -2206,38 +2166,10 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) > ? ? ? ?} > ? ? ? ?dev->got_irq = 1; > > -#ifdef CONFIG_ARCH_LUBBOCK > - ? ? ? if (machine_is_lubbock()) { > - ? ? ? ? ? ? ? retval = request_irq(LUBBOCK_USB_DISC_IRQ, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, dev); > - ? ? ? ? ? ? ? if (retval != 0) { > - ? ? ? ? ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, LUBBOCK_USB_DISC_IRQ, retval); > -lubbock_fail0: > - ? ? ? ? ? ? ? ? ? ? ? goto err_irq_lub; > - ? ? ? ? ? ? ? } > - ? ? ? ? ? ? ? retval = request_irq(LUBBOCK_USB_IRQ, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, dev); > - ? ? ? ? ? ? ? if (retval != 0) { > - ? ? ? ? ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, LUBBOCK_USB_IRQ, retval); > - ? ? ? ? ? ? ? ? ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, dev); > - ? ? ? ? ? ? ? ? ? ? ? goto lubbock_fail0; > - ? ? ? ? ? ? ? } > - ? ? ? } else > -#endif > ? ? ? ?create_debug_files(dev); > > ? ? ? ?return 0; > > -#ifdef CONFIG_ARCH_LUBBOCK > - ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, dev); > - err_irq_lub: > -#endif > ? ? ? ?free_irq(irq, dev); > ?err_irq1: > ? ? ? ?if (gpio_is_valid(dev->mach->gpio_pullup)) > @@ -2273,12 +2205,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) > ? ? ? ? ? ? ? ?free_irq(platform_get_irq(pdev, 0), 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 > ? ? ? ?if (gpio_is_valid(dev->mach->gpio_pullup)) > ? ? ? ? ? ? ? ?gpio_free(dev->mach->gpio_pullup); > > diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig > index daf3e5f..7ddfc54 100644 > --- a/drivers/usb/otg/Kconfig > +++ b/drivers/usb/otg/Kconfig > @@ -122,4 +122,12 @@ config AB8500_USB > ? ? ? ? ? This transceiver supports high and full speed devices plus, > ? ? ? ? ? in host mode, low speed. > > +config LUBBOCK_USB > + ? ? ? tristate "Intel DBPXA250 (Lubbock) Tranceiver Driver" > + ? ? ? depends on ARCH_LUBBOCK > + ? ? ? ?select USB_OTG_UTILS > + ? ? ? help > + ? ? ? ? Enable this to support the USB UDC connectivity on Intel DBPXA250 > + ? ? ? ? development platform (so-called Lubbock). > + > ?endif # USB || OTG > diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile > index e22d917..5ed42cd 100644 > --- a/drivers/usb/otg/Makefile > +++ b/drivers/usb/otg/Makefile > @@ -19,3 +19,4 @@ obj-$(CONFIG_USB_ULPI) ? ? ? ? ? ? ? ?+= ulpi.o > ?obj-$(CONFIG_USB_ULPI_VIEWPORT) ? ? ? ?+= ulpi_viewport.o > ?obj-$(CONFIG_USB_MSM_OTG) ? ? ?+= msm_otg.o > ?obj-$(CONFIG_AB8500_USB) ? ? ? += ab8500-usb.o > +obj-$(CONFIG_LUBBOCK_USB) ? ? ?+= lubbock-usb.o > diff --git a/drivers/usb/otg/lubbock-usb.c b/drivers/usb/otg/lubbock-usb.c > new file mode 100644 > index 0000000..d18c101 > --- /dev/null > +++ b/drivers/usb/otg/lubbock-usb.c > @@ -0,0 +1,178 @@ > +/* > + * Intel DBPXA250 Development Platform USB UDC support > + * > + * Copyright (C) 2011 Dmitry Eremin-Solenikov > + * > + * Based on pxa25x_udc driver: > + * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker) > + * Copyright (C) 2003 Robert Schwebel, Pengutronix > + * Copyright (C) 2003 Benedikt Spranger, Pengutronix > + * Copyright (C) 2003 David Brownell > + * Copyright (C) 2003 Joshua Wise > + * > + * Largely based on lubbock-usb-xceiv: > + * Copyright (C) 2009 Texas Instruments Inc > + */ > +#include <linux/module.h> > +#include <linux/platform_device.h> > +#include <linux/dma-mapping.h> > +#include <linux/usb.h> > +#include <linux/usb/gadget.h> > +#include <linux/usb/otg.h> > +#include <linux/slab.h> > +#include <linux/interrupt.h> > + > +#include <mach/lubbock.h> > + > +static int lubbock_udc_is_connected(void) > +{ > + ? ? ? return (LUB_MISC_RD & (1 << 9)) == 0; > +} > + > +static int lubbock_set_peripheral(struct otg_transceiver *lubbock, > + ? ? ? ? ? ? ? struct usb_gadget *gadget) > +{ > + ? ? ? if (!lubbock) > + ? ? ? ? ? ? ? return -ENODEV; > + > + ? ? ? if (!gadget) { > + ? ? ? ? ? ? ? lubbock->gadget = NULL; > + ? ? ? ? ? ? ? return 0; > + ? ? ? } > + > + ? ? ? lubbock->gadget = gadget; > + ? ? ? lubbock->state = OTG_STATE_B_IDLE; > + ? ? ? if (lubbock_udc_is_connected()) { > + ? ? ? ? ? ? ? lubbock->state = OTG_STATE_B_PERIPHERAL; > + ? ? ? ? ? ? ? usb_gadget_vbus_connect(lubbock->gadget); > + ? ? ? } > + > + ? ? ? return 0; > +} > + > +/* Lubbock has separate connect and disconnect irqs. ?More typical designs > + * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. > + */ > + > +static irqreturn_t > +lubbock_vbus_irq(int irq, void *_dev) > +{ > + ? ? ? struct otg_transceiver *lubbock = _dev; > + ? ? ? switch (irq) { > + ? ? ? case LUBBOCK_USB_IRQ: > + ? ? ? ? ? ? ? lubbock->state = OTG_STATE_B_PERIPHERAL; > + ? ? ? ? ? ? ? usb_gadget_vbus_connect(lubbock->gadget); > + > + ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_IRQ); > + ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_DISC_IRQ); > + ? ? ? ? ? ? ? break; > + ? ? ? case LUBBOCK_USB_DISC_IRQ: > + ? ? ? ? ? ? ? usb_gadget_vbus_disconnect(lubbock->gadget); > + ? ? ? ? ? ? ? lubbock->state = OTG_STATE_B_IDLE; > + > + ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_DISC_IRQ); > + ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_IRQ); > + ? ? ? ? ? ? ? break; > + ? ? ? default: > + ? ? ? ? ? ? ? return IRQ_NONE; > + ? ? ? } > + > + ? ? ? return IRQ_HANDLED; > +} > + > + > +static int __devinit lubbock_usb_xceiv_probe(struct platform_device *pdev) > +{ > + ? ? ? struct otg_transceiver ?*lubbock; > + ? ? ? int err; > + > + ? ? ? lubbock = kzalloc(sizeof *lubbock, GFP_KERNEL); > + ? ? ? if (!lubbock) > + ? ? ? ? ? ? ? return -ENOMEM; > + > + ? ? ? lubbock->dev ? ? ? ? ? ?= &pdev->dev; > + ? ? ? lubbock->label ? ? ? ? ?= "lubbock-xceiv"; > + ? ? ? lubbock->state ? ? ? ? ?= OTG_STATE_UNDEFINED; > + ? ? ? lubbock->set_peripheral = lubbock_set_peripheral; > + > + ? ? ? err = request_irq(LUBBOCK_USB_DISC_IRQ, > + ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, > + ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, > + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, lubbock); > + ? ? ? if (err != 0) { > + ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", > + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, LUBBOCK_USB_DISC_IRQ, err); > + ? ? ? ? ? ? ? goto err_irq_lub; > + ? ? ? } > + ? ? ? err = request_irq(LUBBOCK_USB_IRQ, > + ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, > + ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, > + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, lubbock); > + ? ? ? if (err != 0) { > + ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", > + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, LUBBOCK_USB_IRQ, err); > + ? ? ? ? ? ? ? goto err_irq_lub2; > + ? ? ? } > + > + ? ? ? err = otg_set_transceiver(lubbock); > + ? ? ? if (err) { > + ? ? ? ? ? ? ? dev_err(&pdev->dev, "can't register transceiver, err: %d\n", > + ? ? ? ? ? ? ? ? ? ? ? err); > + ? ? ? ? ? ? ? goto exit; > + ? ? ? } > + > + ? ? ? platform_set_drvdata(pdev, lubbock); > + > + ? ? ? BLOCKING_INIT_NOTIFIER_HEAD(&lubbock->notifier); > + > + ? ? ? return 0; > +exit: > + ? ? ? free_irq(LUBBOCK_USB_IRQ, lubbock); > +err_irq_lub2: > + ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); > +err_irq_lub: > + ? ? ? kfree(lubbock); > + ? ? ? return err; > +} > + > +static int __devexit lubbock_usb_xceiv_remove(struct platform_device *pdev) > +{ > + ? ? ? struct otg_transceiver *lubbock = platform_get_drvdata(pdev); > + > + ? ? ? otg_set_transceiver(NULL); > + > + ? ? ? platform_set_drvdata(pdev, NULL); > + > + ? ? ? free_irq(LUBBOCK_USB_IRQ, lubbock); > + ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); > + > + ? ? ? kfree(lubbock); > + > + ? ? ? return 0; > +} > + > +static struct platform_driver lubbock_usb_xceiv_driver = { > + ? ? ? .probe ? ? ? ? ?= lubbock_usb_xceiv_probe, > + ? ? ? .remove ? ? ? ? = __devexit_p(lubbock_usb_xceiv_remove), > + ? ? ? .driver ? ? ? ? = { > + ? ? ? ? ? ? ? .name ? = "lubbock_usb_xceiv", > + ? ? ? ? ? ? ? .owner ?= THIS_MODULE, > + ? ? ? }, > +}; > + > +static int __init lubbock_usb_xceiv_init(void) > +{ > + ? ? ? return platform_driver_register(&lubbock_usb_xceiv_driver); > +} > +subsys_initcall(lubbock_usb_xceiv_init); > + > +static void __exit lubbock_usb_xceiv_exit(void) > +{ > + ? ? ? platform_driver_unregister(&lubbock_usb_xceiv_driver); > +} > +module_exit(lubbock_usb_xceiv_exit); > + > +MODULE_ALIAS("platform:lubbock_usb_xceiv"); > +MODULE_DESCRIPTION("lubbock USB Transceiver driver"); > +MODULE_LICENSE("GPL"); > + > -- > 1.7.4.1 > > ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-04-04 7:01 ` Eric Miao @ 2011-04-04 7:04 ` Eric Miao 2011-04-06 21:21 ` Dmitry Eremin-Solenikov 0 siblings, 1 reply; 23+ messages in thread From: Eric Miao @ 2011-04-04 7:04 UTC (permalink / raw) To: linux-arm-kernel David, Let me know if you're OK I take this patch, as several others following have dependency on this one. On Mon, Apr 4, 2011 at 3:01 PM, Eric Miao <eric.y.miao@gmail.com> wrote: > On Fri, Apr 1, 2011 at 9:56 PM, Dmitry Eremin-Solenikov > <dbaryshkov@gmail.com> wrote: >> Move all handling of lubbock board to separate lubbock-usb transceiver, >> removing cruft from pxa25x_udc. >> >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> > > I like this change very much. It would be perfect if someone can actually > test this, but provided Lubbock is no way popular these days, it would > just be fine. > > Acked-by: Eric Miao <eric.y.miao@gmail.com> > >> --- >> ?drivers/usb/gadget/pxa25x_udc.c | ? 74 ---------------- >> ?drivers/usb/otg/Kconfig ? ? ? ? | ? ?8 ++ >> ?drivers/usb/otg/Makefile ? ? ? ?| ? ?1 + >> ?drivers/usb/otg/lubbock-usb.c ? | ?178 +++++++++++++++++++++++++++++++++++++++ >> ?4 files changed, 187 insertions(+), 74 deletions(-) >> ?create mode 100644 drivers/usb/otg/lubbock-usb.c >> >> diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c >> index 444b60a..6cb32b8 100644 >> --- a/drivers/usb/gadget/pxa25x_udc.c >> +++ b/drivers/usb/gadget/pxa25x_udc.c >> @@ -65,10 +65,6 @@ >> ?#include <mach/pxa25x-udc.h> >> ?#endif >> >> -#ifdef CONFIG_ARCH_LUBBOCK >> -#include <mach/lubbock.h> >> -#endif >> - >> ?#include <asm/mach/udc_pxa2xx.h> >> >> >> @@ -1383,42 +1379,6 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); >> >> ?/*-------------------------------------------------------------------------*/ >> >> -#ifdef CONFIG_ARCH_LUBBOCK >> - >> -/* Lubbock has separate connect and disconnect irqs. ?More typical designs >> - * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. >> - */ >> - >> -static irqreturn_t >> -lubbock_vbus_irq(int irq, void *_dev) >> -{ >> - ? ? ? struct pxa25x_udc ? ? ? *dev = _dev; >> - ? ? ? int ? ? ? ? ? ? ? ? ? ? vbus; >> - >> - ? ? ? dev->stats.irqs++; >> - ? ? ? switch (irq) { >> - ? ? ? case LUBBOCK_USB_IRQ: >> - ? ? ? ? ? ? ? vbus = 1; >> - ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_IRQ); >> - ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_DISC_IRQ); >> - ? ? ? ? ? ? ? break; >> - ? ? ? case LUBBOCK_USB_DISC_IRQ: >> - ? ? ? ? ? ? ? vbus = 0; >> - ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_DISC_IRQ); >> - ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_IRQ); >> - ? ? ? ? ? ? ? break; >> - ? ? ? default: >> - ? ? ? ? ? ? ? return IRQ_NONE; >> - ? ? ? } >> - >> - ? ? ? pxa25x_udc_vbus_session(&dev->gadget, vbus); >> - ? ? ? return IRQ_HANDLED; >> -} >> - >> -#endif >> - >> - >> -/*-------------------------------------------------------------------------*/ >> >> ?static inline void clear_ep_state (struct pxa25x_udc *dev) >> ?{ >> @@ -2206,38 +2166,10 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) >> ? ? ? ?} >> ? ? ? ?dev->got_irq = 1; >> >> -#ifdef CONFIG_ARCH_LUBBOCK >> - ? ? ? if (machine_is_lubbock()) { >> - ? ? ? ? ? ? ? retval = request_irq(LUBBOCK_USB_DISC_IRQ, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, dev); >> - ? ? ? ? ? ? ? if (retval != 0) { >> - ? ? ? ? ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, LUBBOCK_USB_DISC_IRQ, retval); >> -lubbock_fail0: >> - ? ? ? ? ? ? ? ? ? ? ? goto err_irq_lub; >> - ? ? ? ? ? ? ? } >> - ? ? ? ? ? ? ? retval = request_irq(LUBBOCK_USB_IRQ, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, dev); >> - ? ? ? ? ? ? ? if (retval != 0) { >> - ? ? ? ? ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? driver_name, LUBBOCK_USB_IRQ, retval); >> - ? ? ? ? ? ? ? ? ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, dev); >> - ? ? ? ? ? ? ? ? ? ? ? goto lubbock_fail0; >> - ? ? ? ? ? ? ? } >> - ? ? ? } else >> -#endif >> ? ? ? ?create_debug_files(dev); >> >> ? ? ? ?return 0; >> >> -#ifdef CONFIG_ARCH_LUBBOCK >> - ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, dev); >> - err_irq_lub: >> -#endif >> ? ? ? ?free_irq(irq, dev); >> ?err_irq1: >> ? ? ? ?if (gpio_is_valid(dev->mach->gpio_pullup)) >> @@ -2273,12 +2205,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) >> ? ? ? ? ? ? ? ?free_irq(platform_get_irq(pdev, 0), 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 >> ? ? ? ?if (gpio_is_valid(dev->mach->gpio_pullup)) >> ? ? ? ? ? ? ? ?gpio_free(dev->mach->gpio_pullup); >> >> diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig >> index daf3e5f..7ddfc54 100644 >> --- a/drivers/usb/otg/Kconfig >> +++ b/drivers/usb/otg/Kconfig >> @@ -122,4 +122,12 @@ config AB8500_USB >> ? ? ? ? ? This transceiver supports high and full speed devices plus, >> ? ? ? ? ? in host mode, low speed. >> >> +config LUBBOCK_USB >> + ? ? ? tristate "Intel DBPXA250 (Lubbock) Tranceiver Driver" >> + ? ? ? depends on ARCH_LUBBOCK >> + ? ? ? ?select USB_OTG_UTILS >> + ? ? ? help >> + ? ? ? ? Enable this to support the USB UDC connectivity on Intel DBPXA250 >> + ? ? ? ? development platform (so-called Lubbock). >> + >> ?endif # USB || OTG >> diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile >> index e22d917..5ed42cd 100644 >> --- a/drivers/usb/otg/Makefile >> +++ b/drivers/usb/otg/Makefile >> @@ -19,3 +19,4 @@ obj-$(CONFIG_USB_ULPI) ? ? ? ? ? ? ? ?+= ulpi.o >> ?obj-$(CONFIG_USB_ULPI_VIEWPORT) ? ? ? ?+= ulpi_viewport.o >> ?obj-$(CONFIG_USB_MSM_OTG) ? ? ?+= msm_otg.o >> ?obj-$(CONFIG_AB8500_USB) ? ? ? += ab8500-usb.o >> +obj-$(CONFIG_LUBBOCK_USB) ? ? ?+= lubbock-usb.o >> diff --git a/drivers/usb/otg/lubbock-usb.c b/drivers/usb/otg/lubbock-usb.c >> new file mode 100644 >> index 0000000..d18c101 >> --- /dev/null >> +++ b/drivers/usb/otg/lubbock-usb.c >> @@ -0,0 +1,178 @@ >> +/* >> + * Intel DBPXA250 Development Platform USB UDC support >> + * >> + * Copyright (C) 2011 Dmitry Eremin-Solenikov >> + * >> + * Based on pxa25x_udc driver: >> + * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker) >> + * Copyright (C) 2003 Robert Schwebel, Pengutronix >> + * Copyright (C) 2003 Benedikt Spranger, Pengutronix >> + * Copyright (C) 2003 David Brownell >> + * Copyright (C) 2003 Joshua Wise >> + * >> + * Largely based on lubbock-usb-xceiv: >> + * Copyright (C) 2009 Texas Instruments Inc >> + */ >> +#include <linux/module.h> >> +#include <linux/platform_device.h> >> +#include <linux/dma-mapping.h> >> +#include <linux/usb.h> >> +#include <linux/usb/gadget.h> >> +#include <linux/usb/otg.h> >> +#include <linux/slab.h> >> +#include <linux/interrupt.h> >> + >> +#include <mach/lubbock.h> >> + >> +static int lubbock_udc_is_connected(void) >> +{ >> + ? ? ? return (LUB_MISC_RD & (1 << 9)) == 0; >> +} >> + >> +static int lubbock_set_peripheral(struct otg_transceiver *lubbock, >> + ? ? ? ? ? ? ? struct usb_gadget *gadget) >> +{ >> + ? ? ? if (!lubbock) >> + ? ? ? ? ? ? ? return -ENODEV; >> + >> + ? ? ? if (!gadget) { >> + ? ? ? ? ? ? ? lubbock->gadget = NULL; >> + ? ? ? ? ? ? ? return 0; >> + ? ? ? } >> + >> + ? ? ? lubbock->gadget = gadget; >> + ? ? ? lubbock->state = OTG_STATE_B_IDLE; >> + ? ? ? if (lubbock_udc_is_connected()) { >> + ? ? ? ? ? ? ? lubbock->state = OTG_STATE_B_PERIPHERAL; >> + ? ? ? ? ? ? ? usb_gadget_vbus_connect(lubbock->gadget); >> + ? ? ? } >> + >> + ? ? ? return 0; >> +} >> + >> +/* Lubbock has separate connect and disconnect irqs. ?More typical designs >> + * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. >> + */ >> + >> +static irqreturn_t >> +lubbock_vbus_irq(int irq, void *_dev) >> +{ >> + ? ? ? struct otg_transceiver *lubbock = _dev; >> + ? ? ? switch (irq) { >> + ? ? ? case LUBBOCK_USB_IRQ: >> + ? ? ? ? ? ? ? lubbock->state = OTG_STATE_B_PERIPHERAL; >> + ? ? ? ? ? ? ? usb_gadget_vbus_connect(lubbock->gadget); >> + >> + ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_IRQ); >> + ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_DISC_IRQ); >> + ? ? ? ? ? ? ? break; >> + ? ? ? case LUBBOCK_USB_DISC_IRQ: >> + ? ? ? ? ? ? ? usb_gadget_vbus_disconnect(lubbock->gadget); >> + ? ? ? ? ? ? ? lubbock->state = OTG_STATE_B_IDLE; >> + >> + ? ? ? ? ? ? ? disable_irq(LUBBOCK_USB_DISC_IRQ); >> + ? ? ? ? ? ? ? enable_irq(LUBBOCK_USB_IRQ); >> + ? ? ? ? ? ? ? break; >> + ? ? ? default: >> + ? ? ? ? ? ? ? return IRQ_NONE; >> + ? ? ? } >> + >> + ? ? ? return IRQ_HANDLED; >> +} >> + >> + >> +static int __devinit lubbock_usb_xceiv_probe(struct platform_device *pdev) >> +{ >> + ? ? ? struct otg_transceiver ?*lubbock; >> + ? ? ? int err; >> + >> + ? ? ? lubbock = kzalloc(sizeof *lubbock, GFP_KERNEL); >> + ? ? ? if (!lubbock) >> + ? ? ? ? ? ? ? return -ENOMEM; >> + >> + ? ? ? lubbock->dev ? ? ? ? ? ?= &pdev->dev; >> + ? ? ? lubbock->label ? ? ? ? ?= "lubbock-xceiv"; >> + ? ? ? lubbock->state ? ? ? ? ?= OTG_STATE_UNDEFINED; >> + ? ? ? lubbock->set_peripheral = lubbock_set_peripheral; >> + >> + ? ? ? err = request_irq(LUBBOCK_USB_DISC_IRQ, >> + ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, >> + ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >> + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, lubbock); >> + ? ? ? if (err != 0) { >> + ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", >> + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, LUBBOCK_USB_DISC_IRQ, err); >> + ? ? ? ? ? ? ? goto err_irq_lub; >> + ? ? ? } >> + ? ? ? err = request_irq(LUBBOCK_USB_IRQ, >> + ? ? ? ? ? ? ? ? ? ? ? lubbock_vbus_irq, >> + ? ? ? ? ? ? ? ? ? ? ? IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >> + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, lubbock); >> + ? ? ? if (err != 0) { >> + ? ? ? ? ? ? ? pr_err("%s: can't get irq %i, err %d\n", >> + ? ? ? ? ? ? ? ? ? ? ? lubbock->label, LUBBOCK_USB_IRQ, err); >> + ? ? ? ? ? ? ? goto err_irq_lub2; >> + ? ? ? } >> + >> + ? ? ? err = otg_set_transceiver(lubbock); >> + ? ? ? if (err) { >> + ? ? ? ? ? ? ? dev_err(&pdev->dev, "can't register transceiver, err: %d\n", >> + ? ? ? ? ? ? ? ? ? ? ? err); >> + ? ? ? ? ? ? ? goto exit; >> + ? ? ? } >> + >> + ? ? ? platform_set_drvdata(pdev, lubbock); >> + >> + ? ? ? BLOCKING_INIT_NOTIFIER_HEAD(&lubbock->notifier); >> + >> + ? ? ? return 0; >> +exit: >> + ? ? ? free_irq(LUBBOCK_USB_IRQ, lubbock); >> +err_irq_lub2: >> + ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); >> +err_irq_lub: >> + ? ? ? kfree(lubbock); >> + ? ? ? return err; >> +} >> + >> +static int __devexit lubbock_usb_xceiv_remove(struct platform_device *pdev) >> +{ >> + ? ? ? struct otg_transceiver *lubbock = platform_get_drvdata(pdev); >> + >> + ? ? ? otg_set_transceiver(NULL); >> + >> + ? ? ? platform_set_drvdata(pdev, NULL); >> + >> + ? ? ? free_irq(LUBBOCK_USB_IRQ, lubbock); >> + ? ? ? free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); >> + >> + ? ? ? kfree(lubbock); >> + >> + ? ? ? return 0; >> +} >> + >> +static struct platform_driver lubbock_usb_xceiv_driver = { >> + ? ? ? .probe ? ? ? ? ?= lubbock_usb_xceiv_probe, >> + ? ? ? .remove ? ? ? ? = __devexit_p(lubbock_usb_xceiv_remove), >> + ? ? ? .driver ? ? ? ? = { >> + ? ? ? ? ? ? ? .name ? = "lubbock_usb_xceiv", >> + ? ? ? ? ? ? ? .owner ?= THIS_MODULE, >> + ? ? ? }, >> +}; >> + >> +static int __init lubbock_usb_xceiv_init(void) >> +{ >> + ? ? ? return platform_driver_register(&lubbock_usb_xceiv_driver); >> +} >> +subsys_initcall(lubbock_usb_xceiv_init); >> + >> +static void __exit lubbock_usb_xceiv_exit(void) >> +{ >> + ? ? ? platform_driver_unregister(&lubbock_usb_xceiv_driver); >> +} >> +module_exit(lubbock_usb_xceiv_exit); >> + >> +MODULE_ALIAS("platform:lubbock_usb_xceiv"); >> +MODULE_DESCRIPTION("lubbock USB Transceiver driver"); >> +MODULE_LICENSE("GPL"); >> + >> -- >> 1.7.4.1 >> >> > ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-04-04 7:04 ` Eric Miao @ 2011-04-06 21:21 ` Dmitry Eremin-Solenikov 2011-04-07 1:48 ` Eric Miao 0 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-06 21:21 UTC (permalink / raw) To: linux-arm-kernel On 4/4/11, Eric Miao <eric.y.miao@gmail.com> wrote: > David, > > Let me know if you're OK I take this patch, as several others following > have dependency on this one. So, what is the current status of this patch? > > On Mon, Apr 4, 2011 at 3:01 PM, Eric Miao <eric.y.miao@gmail.com> wrote: >> On Fri, Apr 1, 2011 at 9:56 PM, Dmitry Eremin-Solenikov >> <dbaryshkov@gmail.com> wrote: >>> Move all handling of lubbock board to separate lubbock-usb transceiver, >>> removing cruft from pxa25x_udc. >>> >>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> >> >> I like this change very much. It would be perfect if someone can actually >> test this, but provided Lubbock is no way popular these days, it would >> just be fine. >> >> Acked-by: Eric Miao <eric.y.miao@gmail.com> >> >>> --- >>> drivers/usb/gadget/pxa25x_udc.c | 74 ---------------- >>> drivers/usb/otg/Kconfig | 8 ++ >>> drivers/usb/otg/Makefile | 1 + >>> drivers/usb/otg/lubbock-usb.c | 178 >>> +++++++++++++++++++++++++++++++++++++++ >>> 4 files changed, 187 insertions(+), 74 deletions(-) >>> create mode 100644 drivers/usb/otg/lubbock-usb.c >>> >>> diff --git a/drivers/usb/gadget/pxa25x_udc.c >>> b/drivers/usb/gadget/pxa25x_udc.c >>> index 444b60a..6cb32b8 100644 >>> --- a/drivers/usb/gadget/pxa25x_udc.c >>> +++ b/drivers/usb/gadget/pxa25x_udc.c >>> @@ -65,10 +65,6 @@ >>> #include <mach/pxa25x-udc.h> >>> #endif >>> >>> -#ifdef CONFIG_ARCH_LUBBOCK >>> -#include <mach/lubbock.h> >>> -#endif >>> - >>> #include <asm/mach/udc_pxa2xx.h> >>> >>> >>> @@ -1383,42 +1379,6 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); >>> >>> /*-------------------------------------------------------------------------*/ >>> >>> -#ifdef CONFIG_ARCH_LUBBOCK >>> - >>> -/* Lubbock has separate connect and disconnect irqs. More typical >>> designs >>> - * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. >>> - */ >>> - >>> -static irqreturn_t >>> -lubbock_vbus_irq(int irq, void *_dev) >>> -{ >>> - struct pxa25x_udc *dev = _dev; >>> - int vbus; >>> - >>> - dev->stats.irqs++; >>> - switch (irq) { >>> - case LUBBOCK_USB_IRQ: >>> - vbus = 1; >>> - disable_irq(LUBBOCK_USB_IRQ); >>> - enable_irq(LUBBOCK_USB_DISC_IRQ); >>> - break; >>> - case LUBBOCK_USB_DISC_IRQ: >>> - vbus = 0; >>> - disable_irq(LUBBOCK_USB_DISC_IRQ); >>> - enable_irq(LUBBOCK_USB_IRQ); >>> - break; >>> - default: >>> - return IRQ_NONE; >>> - } >>> - >>> - pxa25x_udc_vbus_session(&dev->gadget, vbus); >>> - return IRQ_HANDLED; >>> -} >>> - >>> -#endif >>> - >>> - >>> -/*-------------------------------------------------------------------------*/ >>> >>> static inline void clear_ep_state (struct pxa25x_udc *dev) >>> { >>> @@ -2206,38 +2166,10 @@ static int __init pxa25x_udc_probe(struct >>> platform_device *pdev) >>> } >>> dev->got_irq = 1; >>> >>> -#ifdef CONFIG_ARCH_LUBBOCK >>> - if (machine_is_lubbock()) { >>> - retval = request_irq(LUBBOCK_USB_DISC_IRQ, >>> - lubbock_vbus_irq, >>> - IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >>> - driver_name, dev); >>> - if (retval != 0) { >>> - pr_err("%s: can't get irq %i, err %d\n", >>> - driver_name, LUBBOCK_USB_DISC_IRQ, >>> retval); >>> -lubbock_fail0: >>> - goto err_irq_lub; >>> - } >>> - retval = request_irq(LUBBOCK_USB_IRQ, >>> - lubbock_vbus_irq, >>> - IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >>> - driver_name, dev); >>> - if (retval != 0) { >>> - pr_err("%s: can't get irq %i, err %d\n", >>> - driver_name, LUBBOCK_USB_IRQ, retval); >>> - free_irq(LUBBOCK_USB_DISC_IRQ, dev); >>> - goto lubbock_fail0; >>> - } >>> - } else >>> -#endif >>> create_debug_files(dev); >>> >>> return 0; >>> >>> -#ifdef CONFIG_ARCH_LUBBOCK >>> - free_irq(LUBBOCK_USB_DISC_IRQ, dev); >>> - err_irq_lub: >>> -#endif >>> free_irq(irq, dev); >>> err_irq1: >>> if (gpio_is_valid(dev->mach->gpio_pullup)) >>> @@ -2273,12 +2205,6 @@ static int __exit pxa25x_udc_remove(struct >>> platform_device *pdev) >>> free_irq(platform_get_irq(pdev, 0), 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 >>> if (gpio_is_valid(dev->mach->gpio_pullup)) >>> gpio_free(dev->mach->gpio_pullup); >>> >>> diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig >>> index daf3e5f..7ddfc54 100644 >>> --- a/drivers/usb/otg/Kconfig >>> +++ b/drivers/usb/otg/Kconfig >>> @@ -122,4 +122,12 @@ config AB8500_USB >>> This transceiver supports high and full speed devices plus, >>> in host mode, low speed. >>> >>> +config LUBBOCK_USB >>> + tristate "Intel DBPXA250 (Lubbock) Tranceiver Driver" >>> + depends on ARCH_LUBBOCK >>> + select USB_OTG_UTILS >>> + help >>> + Enable this to support the USB UDC connectivity on Intel >>> DBPXA250 >>> + development platform (so-called Lubbock). >>> + >>> endif # USB || OTG >>> diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile >>> index e22d917..5ed42cd 100644 >>> --- a/drivers/usb/otg/Makefile >>> +++ b/drivers/usb/otg/Makefile >>> @@ -19,3 +19,4 @@ obj-$(CONFIG_USB_ULPI) += ulpi.o >>> obj-$(CONFIG_USB_ULPI_VIEWPORT) += ulpi_viewport.o >>> obj-$(CONFIG_USB_MSM_OTG) += msm_otg.o >>> obj-$(CONFIG_AB8500_USB) += ab8500-usb.o >>> +obj-$(CONFIG_LUBBOCK_USB) += lubbock-usb.o >>> diff --git a/drivers/usb/otg/lubbock-usb.c >>> b/drivers/usb/otg/lubbock-usb.c >>> new file mode 100644 >>> index 0000000..d18c101 >>> --- /dev/null >>> +++ b/drivers/usb/otg/lubbock-usb.c >>> @@ -0,0 +1,178 @@ >>> +/* >>> + * Intel DBPXA250 Development Platform USB UDC support >>> + * >>> + * Copyright (C) 2011 Dmitry Eremin-Solenikov >>> + * >>> + * Based on pxa25x_udc driver: >>> + * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker) >>> + * Copyright (C) 2003 Robert Schwebel, Pengutronix >>> + * Copyright (C) 2003 Benedikt Spranger, Pengutronix >>> + * Copyright (C) 2003 David Brownell >>> + * Copyright (C) 2003 Joshua Wise >>> + * >>> + * Largely based on lubbock-usb-xceiv: >>> + * Copyright (C) 2009 Texas Instruments Inc >>> + */ >>> +#include <linux/module.h> >>> +#include <linux/platform_device.h> >>> +#include <linux/dma-mapping.h> >>> +#include <linux/usb.h> >>> +#include <linux/usb/gadget.h> >>> +#include <linux/usb/otg.h> >>> +#include <linux/slab.h> >>> +#include <linux/interrupt.h> >>> + >>> +#include <mach/lubbock.h> >>> + >>> +static int lubbock_udc_is_connected(void) >>> +{ >>> + return (LUB_MISC_RD & (1 << 9)) == 0; >>> +} >>> + >>> +static int lubbock_set_peripheral(struct otg_transceiver *lubbock, >>> + struct usb_gadget *gadget) >>> +{ >>> + if (!lubbock) >>> + return -ENODEV; >>> + >>> + if (!gadget) { >>> + lubbock->gadget = NULL; >>> + return 0; >>> + } >>> + >>> + lubbock->gadget = gadget; >>> + lubbock->state = OTG_STATE_B_IDLE; >>> + if (lubbock_udc_is_connected()) { >>> + lubbock->state = OTG_STATE_B_PERIPHERAL; >>> + usb_gadget_vbus_connect(lubbock->gadget); >>> + } >>> + >>> + return 0; >>> +} >>> + >>> +/* Lubbock has separate connect and disconnect irqs. More typical >>> designs >>> + * use one GPIO as the VBUS IRQ, and another to control the D+ pullup. >>> + */ >>> + >>> +static irqreturn_t >>> +lubbock_vbus_irq(int irq, void *_dev) >>> +{ >>> + struct otg_transceiver *lubbock = _dev; >>> + switch (irq) { >>> + case LUBBOCK_USB_IRQ: >>> + lubbock->state = OTG_STATE_B_PERIPHERAL; >>> + usb_gadget_vbus_connect(lubbock->gadget); >>> + >>> + disable_irq(LUBBOCK_USB_IRQ); >>> + enable_irq(LUBBOCK_USB_DISC_IRQ); >>> + break; >>> + case LUBBOCK_USB_DISC_IRQ: >>> + usb_gadget_vbus_disconnect(lubbock->gadget); >>> + lubbock->state = OTG_STATE_B_IDLE; >>> + >>> + disable_irq(LUBBOCK_USB_DISC_IRQ); >>> + enable_irq(LUBBOCK_USB_IRQ); >>> + break; >>> + default: >>> + return IRQ_NONE; >>> + } >>> + >>> + return IRQ_HANDLED; >>> +} >>> + >>> + >>> +static int __devinit lubbock_usb_xceiv_probe(struct platform_device >>> *pdev) >>> +{ >>> + struct otg_transceiver *lubbock; >>> + int err; >>> + >>> + lubbock = kzalloc(sizeof *lubbock, GFP_KERNEL); >>> + if (!lubbock) >>> + return -ENOMEM; >>> + >>> + lubbock->dev = &pdev->dev; >>> + lubbock->label = "lubbock-xceiv"; >>> + lubbock->state = OTG_STATE_UNDEFINED; >>> + lubbock->set_peripheral = lubbock_set_peripheral; >>> + >>> + err = request_irq(LUBBOCK_USB_DISC_IRQ, >>> + lubbock_vbus_irq, >>> + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >>> + lubbock->label, lubbock); >>> + if (err != 0) { >>> + pr_err("%s: can't get irq %i, err %d\n", >>> + lubbock->label, LUBBOCK_USB_DISC_IRQ, err); >>> + goto err_irq_lub; >>> + } >>> + err = request_irq(LUBBOCK_USB_IRQ, >>> + lubbock_vbus_irq, >>> + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, >>> + lubbock->label, lubbock); >>> + if (err != 0) { >>> + pr_err("%s: can't get irq %i, err %d\n", >>> + lubbock->label, LUBBOCK_USB_IRQ, err); >>> + goto err_irq_lub2; >>> + } >>> + >>> + err = otg_set_transceiver(lubbock); >>> + if (err) { >>> + dev_err(&pdev->dev, "can't register transceiver, err: >>> %d\n", >>> + err); >>> + goto exit; >>> + } >>> + >>> + platform_set_drvdata(pdev, lubbock); >>> + >>> + BLOCKING_INIT_NOTIFIER_HEAD(&lubbock->notifier); >>> + >>> + return 0; >>> +exit: >>> + free_irq(LUBBOCK_USB_IRQ, lubbock); >>> +err_irq_lub2: >>> + free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); >>> +err_irq_lub: >>> + kfree(lubbock); >>> + return err; >>> +} >>> + >>> +static int __devexit lubbock_usb_xceiv_remove(struct platform_device >>> *pdev) >>> +{ >>> + struct otg_transceiver *lubbock = platform_get_drvdata(pdev); >>> + >>> + otg_set_transceiver(NULL); >>> + >>> + platform_set_drvdata(pdev, NULL); >>> + >>> + free_irq(LUBBOCK_USB_IRQ, lubbock); >>> + free_irq(LUBBOCK_USB_DISC_IRQ, lubbock); >>> + >>> + kfree(lubbock); >>> + >>> + return 0; >>> +} >>> + >>> +static struct platform_driver lubbock_usb_xceiv_driver = { >>> + .probe = lubbock_usb_xceiv_probe, >>> + .remove = __devexit_p(lubbock_usb_xceiv_remove), >>> + .driver = { >>> + .name = "lubbock_usb_xceiv", >>> + .owner = THIS_MODULE, >>> + }, >>> +}; >>> + >>> +static int __init lubbock_usb_xceiv_init(void) >>> +{ >>> + return platform_driver_register(&lubbock_usb_xceiv_driver); >>> +} >>> +subsys_initcall(lubbock_usb_xceiv_init); >>> + >>> +static void __exit lubbock_usb_xceiv_exit(void) >>> +{ >>> + platform_driver_unregister(&lubbock_usb_xceiv_driver); >>> +} >>> +module_exit(lubbock_usb_xceiv_exit); >>> + >>> +MODULE_ALIAS("platform:lubbock_usb_xceiv"); >>> +MODULE_DESCRIPTION("lubbock USB Transceiver driver"); >>> +MODULE_LICENSE("GPL"); >>> + >>> -- >>> 1.7.4.1 >>> >>> >> > -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-04-06 21:21 ` Dmitry Eremin-Solenikov @ 2011-04-07 1:48 ` Eric Miao 2011-07-01 11:48 ` Dmitry Eremin-Solenikov 0 siblings, 1 reply; 23+ messages in thread From: Eric Miao @ 2011-04-07 1:48 UTC (permalink / raw) To: linux-arm-kernel On Thu, Apr 7, 2011 at 5:21 AM, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote: > On 4/4/11, Eric Miao <eric.y.miao@gmail.com> wrote: >> David, >> >> Let me know if you're OK I take this patch, as several others following >> have dependency on this one. > > So, what is the current status of this patch? Unfortunately, David passed away as Greg KH announced days ago. I'll take these patches. ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-04-07 1:48 ` Eric Miao @ 2011-07-01 11:48 ` Dmitry Eremin-Solenikov 2011-07-05 7:26 ` Eric Miao 0 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-07-01 11:48 UTC (permalink / raw) To: linux-arm-kernel Hello, On 07.04.2011 05:48, Eric Miao wrote: > On Thu, Apr 7, 2011 at 5:21 AM, Dmitry Eremin-Solenikov > <dbaryshkov@gmail.com> wrote: >> On 4/4/11, Eric Miao<eric.y.miao@gmail.com> wrote: >>> David, >>> >>> Let me know if you're OK I take this patch, as several others following >>> have dependency on this one. >> >> So, what is the current status of this patch? > > Unfortunately, David passed away as Greg KH announced days ago. > I'll take these patches. I'v seen these patches rest a bit in your tree. It wasn't merged for 3.0. Does it stand a chance to be merged into 3.1, or it's better to resubmit these patches to usb/gadget subtree to Felipe/Greg? -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-07-01 11:48 ` Dmitry Eremin-Solenikov @ 2011-07-05 7:26 ` Eric Miao 2011-07-05 13:26 ` Greg KH 0 siblings, 1 reply; 23+ messages in thread From: Eric Miao @ 2011-07-05 7:26 UTC (permalink / raw) To: linux-arm-kernel Felipe, ping? Cc'ed Greg KH. Any possibility for this to go quicker, this series has been delayed for 2 cycles. And the patches look good to me. Dmitry, If this is going to be merged through the usb tree, what are the other patches that have no dependency? - eric On Fri, Jul 1, 2011 at 7:48 PM, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote: > Hello, > > On 07.04.2011 05:48, Eric Miao wrote: >> >> On Thu, Apr 7, 2011 at 5:21 AM, Dmitry Eremin-Solenikov >> <dbaryshkov@gmail.com> ?wrote: >>> >>> On 4/4/11, Eric Miao<eric.y.miao@gmail.com> ?wrote: >>>> >>>> David, >>>> >>>> Let me know if you're OK I take this patch, as several others following >>>> have dependency on this one. >>> >>> So, what is the current status of this patch? >> >> Unfortunately, David passed away as Greg KH announced days ago. >> I'll take these patches. > > I'v seen these patches rest a bit in your tree. It wasn't merged for 3.0. > Does it stand a chance to be merged into 3.1, or it's better to resubmit > these patches to usb/gadget subtree to Felipe/Greg? > > > -- > With best wishes > Dmitry > > ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-07-05 7:26 ` Eric Miao @ 2011-07-05 13:26 ` Greg KH 2011-07-05 14:35 ` Dmitry Eremin-Solenikov 0 siblings, 1 reply; 23+ messages in thread From: Greg KH @ 2011-07-05 13:26 UTC (permalink / raw) To: linux-arm-kernel On Tue, Jul 05, 2011 at 03:26:37PM +0800, Eric Miao wrote: > Felipe, ping? > > Cc'ed Greg KH. Any possibility for this to go quicker, this series has been > delayed for 2 cycles. And the patches look good to me. Someone should have said something sooner then :) I can take them, if someone resends them, with the proper acked-by lines, and queue them up for 3.1. thanks, greg k-h ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver 2011-07-05 13:26 ` Greg KH @ 2011-07-05 14:35 ` Dmitry Eremin-Solenikov 0 siblings, 0 replies; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-07-05 14:35 UTC (permalink / raw) To: linux-arm-kernel On 7/5/11, Greg KH <gregkh@suse.de> wrote: > On Tue, Jul 05, 2011 at 03:26:37PM +0800, Eric Miao wrote: >> Felipe, ping? >> >> Cc'ed Greg KH. Any possibility for this to go quicker, this series has >> been >> delayed for 2 cycles. And the patches look good to me. > > Someone should have said something sooner then :) > > I can take them, if someone resends them, with the proper acked-by > lines, and queue them up for 3.1. I've resent them + several more patches which waited for them to be applied. -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 5/7] lubbock: switch to using lubbock_usb_xceiv transceiver 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov ` (2 preceding siblings ...) 2011-04-01 13:56 ` [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver Dmitry Eremin-Solenikov @ 2011-04-01 13:56 ` Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 6/7] pxa25x: drop handling of udc_is_connected Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv Dmitry Eremin-Solenikov 5 siblings, 0 replies; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- arch/arm/mach-pxa/lubbock.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 3ede978..8b6e654 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c @@ -207,16 +207,6 @@ device_initcall(lubbock_irq_device_init); #endif -static int lubbock_udc_is_connected(void) -{ - return (LUB_MISC_RD & (1 << 9)) == 0; -} - -static struct pxa2xx_udc_mach_info udc_info __initdata = { - .udc_is_connected = lubbock_udc_is_connected, - // no D+ pullup; lubbock can't connect/disconnect in software -}; - static struct resource sa1111_resources[] = { [0] = { .start = 0x10000000, @@ -388,11 +378,17 @@ static struct platform_device lubbock_flash_device[2] = { }, }; +static struct platform_device lubbock_usb_xceiv = { + .name = "lubbock_usb_xceiv", + .id = -1, +}; + static struct platform_device *devices[] __initdata = { &sa1111_device, &smc91x_device, &lubbock_flash_device[0], &lubbock_flash_device[1], + &lubbock_usb_xceiv, }; static struct pxafb_mode_info sharp_lm8v31_mode = { @@ -520,7 +516,6 @@ static void __init lubbock_init(void) pxa_set_stuart_info(NULL); clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); - pxa_set_udc_info(&udc_info); pxa_set_fb_info(NULL, &sharp_lm8v31); pxa_set_mci_info(&lubbock_mci_platform_data); pxa_set_ficp_info(&lubbock_ficp_platform_data); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 6/7] pxa25x: drop handling of udc_is_connected 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov ` (3 preceding siblings ...) 2011-04-01 13:56 ` [PATCH 5/7] lubbock: switch to using lubbock_usb_xceiv transceiver Dmitry Eremin-Solenikov @ 2011-04-01 13:56 ` Dmitry Eremin-Solenikov 2011-04-01 19:02 ` Sergei Shtylyov 2011-04-01 13:56 ` [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv Dmitry Eremin-Solenikov 5 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel There are no more users of udc_is_connected. Drop this field from mach_info and stop using it in pxa25x_udc. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- arch/arm/include/asm/mach/udc_pxa2xx.h | 1 - drivers/usb/gadget/pxa25x_udc.c | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/mach/udc_pxa2xx.h b/arch/arm/include/asm/mach/udc_pxa2xx.h index ea297ac..f0719d3 100644 --- a/arch/arm/include/asm/mach/udc_pxa2xx.h +++ b/arch/arm/include/asm/mach/udc_pxa2xx.h @@ -10,7 +10,6 @@ */ 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 */ diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 6cb32b8..40ceb73 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c @@ -1072,7 +1072,7 @@ udc_seq_show(struct seq_file *m, void *_d) (tmp & UDCCFR_ACM) ? " acm" : ""); } - if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver) + if (dev->gadget.speed == USB_SPEED_UNKNOWN || !dev->driver) goto done; seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", @@ -1700,9 +1700,13 @@ 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\n"); + DBG(DBG_VERBOSE, "USB suspend%s\n", + dev->gadget.speed != USB_SPEED_UNKNOWN + ? "" : "+disconnect"); - if (dev->gadget.speed != USB_SPEED_UNKNOWN + if (dev->gadget.speed == USB_SPEED_UNKNOWN) + stop_activity(dev, dev->driver); + else if (dev->gadget.speed != USB_SPEED_UNKNOWN && dev->driver && dev->driver->suspend) dev->driver->suspend(&dev->gadget); @@ -1717,7 +1721,8 @@ pxa25x_udc_irq(int irq, void *_dev) if (dev->gadget.speed != USB_SPEED_UNKNOWN && dev->driver - && dev->driver->resume) + && dev->driver->resume + && dev->gadget.speed != USB_SPEED_UNKNOWN) dev->driver->resume(&dev->gadget); } -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 6/7] pxa25x: drop handling of udc_is_connected 2011-04-01 13:56 ` [PATCH 6/7] pxa25x: drop handling of udc_is_connected Dmitry Eremin-Solenikov @ 2011-04-01 19:02 ` Sergei Shtylyov 2011-04-02 14:46 ` Dmitry Eremin-Solenikov 0 siblings, 1 reply; 23+ messages in thread From: Sergei Shtylyov @ 2011-04-01 19:02 UTC (permalink / raw) To: linux-arm-kernel Hello. Dmitry Eremin-Solenikov wrote: > There are no more users of udc_is_connected. Drop this field from mach_info If I don't mistake, this patch does more than just that. > and stop using it in pxa25x_udc. Hm, I don't see where you're doing that. Instead you're changing some checks for gadget speed and adding some code. And you've said that the driver never used that thing before. Hm? > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> [...] > diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c > index 6cb32b8..40ceb73 100644 > --- a/drivers/usb/gadget/pxa25x_udc.c > +++ b/drivers/usb/gadget/pxa25x_udc.c > @@ -1072,7 +1072,7 @@ udc_seq_show(struct seq_file *m, void *_d) > (tmp & UDCCFR_ACM) ? " acm" : ""); > } > > - if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver) > + if (dev->gadget.speed == USB_SPEED_UNKNOWN || !dev->driver) > goto done; > > seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", > @@ -1700,9 +1700,13 @@ 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\n"); > + DBG(DBG_VERBOSE, "USB suspend%s\n", > + dev->gadget.speed != USB_SPEED_UNKNOWN > + ? "" : "+disconnect"); > > - if (dev->gadget.speed != USB_SPEED_UNKNOWN > + if (dev->gadget.speed == USB_SPEED_UNKNOWN) > + stop_activity(dev, dev->driver); > + else if (dev->gadget.speed != USB_SPEED_UNKNOWN This is redundant, as it will always be true after your first *if*. WBR, Sergei ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/7] pxa25x: drop handling of udc_is_connected 2011-04-01 19:02 ` Sergei Shtylyov @ 2011-04-02 14:46 ` Dmitry Eremin-Solenikov 0 siblings, 0 replies; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-02 14:46 UTC (permalink / raw) To: linux-arm-kernel On 4/1/11, Sergei Shtylyov <sshtylyov@mvista.com> wrote: > Hello. > > Dmitry Eremin-Solenikov wrote: > >> There are no more users of udc_is_connected. Drop this field from >> mach_info > > If I don't mistake, this patch does more than just that. > >> and stop using it in pxa25x_udc. > > Hm, I don't see where you're doing that. Instead you're changing some > checks > for gadget speed and adding some code. And you've said that the driver never > used that thing before. Hm? Strange. I thought I cleaned up this patch. There are some leftovers from previous rebases. Correct patch as it is now includes only the part regarding udc_is_connected field. I'll wait for more review comments and then resend the whole serie. -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov ` (4 preceding siblings ...) 2011-04-01 13:56 ` [PATCH 6/7] pxa25x: drop handling of udc_is_connected Dmitry Eremin-Solenikov @ 2011-04-01 13:56 ` Dmitry Eremin-Solenikov 2011-04-18 8:42 ` Eric Miao 5 siblings, 1 reply; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-04-01 13:56 UTC (permalink / raw) To: linux-arm-kernel Ask for vbus_draw regulator before registering tranceiver to disallow possible race between registration and set_power/etc. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- drivers/usb/otg/gpio_vbus.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 221c444..52733d9 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c @@ -279,6 +279,13 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) } INIT_WORK(&gpio_vbus->work, gpio_vbus_work); + gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); + if (IS_ERR(gpio_vbus->vbus_draw)) { + dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", + PTR_ERR(gpio_vbus->vbus_draw)); + gpio_vbus->vbus_draw = NULL; + } + /* only active when a gadget is registered */ err = otg_set_transceiver(&gpio_vbus->otg); if (err) { @@ -287,13 +294,6 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) goto err_otg; } - gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); - if (IS_ERR(gpio_vbus->vbus_draw)) { - dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", - PTR_ERR(gpio_vbus->vbus_draw)); - gpio_vbus->vbus_draw = NULL; - } - return 0; err_otg: free_irq(irq, &pdev->dev); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv 2011-04-01 13:56 ` [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv Dmitry Eremin-Solenikov @ 2011-04-18 8:42 ` Eric Miao 2011-05-02 23:38 ` Greg KH 0 siblings, 1 reply; 23+ messages in thread From: Eric Miao @ 2011-04-18 8:42 UTC (permalink / raw) To: linux-arm-kernel On Fri, Apr 1, 2011 at 9:56 PM, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote: > Ask for vbus_draw regulator before registering tranceiver to disallow possible > race between registration and set_power/etc. > > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Acked-by: Eric Miao <eric.y.miao@gmail.com> Greg, can you help take this patch. This looks like a good fix. > --- > ?drivers/usb/otg/gpio_vbus.c | ? 14 +++++++------- > ?1 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c > index 221c444..52733d9 100644 > --- a/drivers/usb/otg/gpio_vbus.c > +++ b/drivers/usb/otg/gpio_vbus.c > @@ -279,6 +279,13 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) > ? ? ? ?} > ? ? ? ?INIT_WORK(&gpio_vbus->work, gpio_vbus_work); > > + ? ? ? gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); > + ? ? ? if (IS_ERR(gpio_vbus->vbus_draw)) { > + ? ? ? ? ? ? ? dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", > + ? ? ? ? ? ? ? ? ? ? ? PTR_ERR(gpio_vbus->vbus_draw)); > + ? ? ? ? ? ? ? gpio_vbus->vbus_draw = NULL; > + ? ? ? } > + > ? ? ? ?/* only active when a gadget is registered */ > ? ? ? ?err = otg_set_transceiver(&gpio_vbus->otg); > ? ? ? ?if (err) { > @@ -287,13 +294,6 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) > ? ? ? ? ? ? ? ?goto err_otg; > ? ? ? ?} > > - ? ? ? gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); > - ? ? ? if (IS_ERR(gpio_vbus->vbus_draw)) { > - ? ? ? ? ? ? ? dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", > - ? ? ? ? ? ? ? ? ? ? ? PTR_ERR(gpio_vbus->vbus_draw)); > - ? ? ? ? ? ? ? gpio_vbus->vbus_draw = NULL; > - ? ? ? } > - > ? ? ? ?return 0; > ?err_otg: > ? ? ? ?free_irq(irq, &pdev->dev); > -- > 1.7.4.1 > > ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv 2011-04-18 8:42 ` Eric Miao @ 2011-05-02 23:38 ` Greg KH 2011-05-03 8:46 ` [PATCH] " Dmitry Eremin-Solenikov 0 siblings, 1 reply; 23+ messages in thread From: Greg KH @ 2011-05-02 23:38 UTC (permalink / raw) To: linux-arm-kernel On Mon, Apr 18, 2011 at 04:42:28PM +0800, Eric Miao wrote: > On Fri, Apr 1, 2011 at 9:56 PM, Dmitry Eremin-Solenikov > <dbaryshkov@gmail.com> wrote: > > Ask for vbus_draw regulator before registering tranceiver to disallow possible > > race between registration and set_power/etc. > > > > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> > > Acked-by: Eric Miao <eric.y.miao@gmail.com> > > Greg, can you help take this patch. This looks like a good fix. I could if I could get it in a format I could apply it in :( Can someone resend it? thanks, greg k-h ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] gpio-vbus: ask for vbus_draw regulator before registering xceiv 2011-05-02 23:38 ` Greg KH @ 2011-05-03 8:46 ` Dmitry Eremin-Solenikov 0 siblings, 0 replies; 23+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-05-03 8:46 UTC (permalink / raw) To: linux-arm-kernel Ask for vbus_draw regulator before registering tranceiver to disallow possible race between registration and set_power/etc. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> --- drivers/usb/otg/gpio_vbus.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 221c444..52733d9 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c @@ -279,6 +279,13 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) } INIT_WORK(&gpio_vbus->work, gpio_vbus_work); + gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); + if (IS_ERR(gpio_vbus->vbus_draw)) { + dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", + PTR_ERR(gpio_vbus->vbus_draw)); + gpio_vbus->vbus_draw = NULL; + } + /* only active when a gadget is registered */ err = otg_set_transceiver(&gpio_vbus->otg); if (err) { @@ -287,13 +294,6 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) goto err_otg; } - gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); - if (IS_ERR(gpio_vbus->vbus_draw)) { - dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", - PTR_ERR(gpio_vbus->vbus_draw)); - gpio_vbus->vbus_draw = NULL; - } - return 0; err_otg: free_irq(irq, &pdev->dev); -- 1.7.4.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
end of thread, other threads:[~2011-07-05 14:35 UTC | newest] Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-04-01 13:56 [PATCH 1/7] balloon3: drop udc_is_connected Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 2/7] mioa701: " Dmitry Eremin-Solenikov 2011-04-01 14:10 ` Sergei Shtylyov 2011-04-01 14:50 ` Dmitry Eremin-Solenikov 2011-04-04 6:58 ` Eric Miao 2011-04-01 13:56 ` [PATCH 3/7] stargate2: udc_is_connected is ignored for pxa27x, drop it Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 4/7] pxa25x: separate lubbock handling to lubbock-usb transceiver Dmitry Eremin-Solenikov 2011-04-04 7:01 ` Eric Miao 2011-04-04 7:04 ` Eric Miao 2011-04-06 21:21 ` Dmitry Eremin-Solenikov 2011-04-07 1:48 ` Eric Miao 2011-07-01 11:48 ` Dmitry Eremin-Solenikov 2011-07-05 7:26 ` Eric Miao 2011-07-05 13:26 ` Greg KH 2011-07-05 14:35 ` Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 5/7] lubbock: switch to using lubbock_usb_xceiv transceiver Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 6/7] pxa25x: drop handling of udc_is_connected Dmitry Eremin-Solenikov 2011-04-01 19:02 ` Sergei Shtylyov 2011-04-02 14:46 ` Dmitry Eremin-Solenikov 2011-04-01 13:56 ` [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv Dmitry Eremin-Solenikov 2011-04-18 8:42 ` Eric Miao 2011-05-02 23:38 ` Greg KH 2011-05-03 8:46 ` [PATCH] " 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.