* [PATCH] Fix AT91 UDC driver on boards without vbus.
@ 2014-04-17 0:51 Owen Kirby
2014-04-23 7:24 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Owen Kirby @ 2014-04-17 0:51 UTC (permalink / raw)
To: barebox
From 4ea2bd2e1ca18136d7cfd61643bc8d8187b1495f Mon Sep 17 00:00:00 2001
From: Owen Kirby <osk@exegin.com>
Date: Wed, 16 Apr 2014 17:45:18 -0700
Subject: [PATCH] Fix AT91 UDC driver on boards without vbus.
While porting Barebox to one of our boards, we found that the AT91 UDC driver
will fail to connect to USB hosts, and will spam the console with errors if
the VBUS pin isn't connected.
Signed-off-by: Owen Kirby <osk@exegin.com>
---
drivers/usb/gadget/at91_udc.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 8ef1ad0..b66e949 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1328,14 +1328,16 @@ int usb_gadget_poll(void)
if (!udc->udp_baseaddr)
return -ENODEV;
+
+ if (gpio_is_valid(udc->board.vbus_pin)) {
+ value = gpio_get_value(udc->board.vbus_pin);
+ value ^= udc->board.vbus_active_low;
- value = gpio_get_value(udc->board.vbus_pin);
- value ^= udc->board.vbus_active_low;
-
- udc->gpio_vbus_val = value;
+ udc->gpio_vbus_val = value;
- if (!value)
- return 0;
+ if (!value)
+ return 0;
+ }
value = at91_udp_read(udc, AT91_UDP_ISR) & (~(AT91_UDP_SOFINT));
if (value)
@@ -1501,14 +1503,14 @@ static int __init at91udc_probe(struct device_d *dev)
udc->vbus = gpio_get_value(udc->board.vbus_pin);
DBG(udc, "VBUS detection: host:%s \n",
udc->vbus ? "present":"absent");
+
+ dev_add_param_bool(dev, "vbus",
+ at91_udc_vbus_set, NULL, &udc->gpio_vbus_val, udc);
} else {
DBG(udc, "no VBUS detection, assuming always-on\n");
udc->vbus = 1;
}
- dev_add_param_bool(dev, "vbus",
- at91_udc_vbus_set, NULL, &udc->gpio_vbus_val, udc);
-
poller_register(&poller);
INFO(udc, "%s version %s\n", driver_name, DRIVER_VERSION);
--
1.7.9.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix AT91 UDC driver on boards without vbus.
2014-04-17 0:51 [PATCH] Fix AT91 UDC driver on boards without vbus Owen Kirby
@ 2014-04-23 7:24 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-04-23 7:24 UTC (permalink / raw)
To: Owen Kirby; +Cc: barebox
On Wed, Apr 16, 2014 at 05:51:11PM -0700, Owen Kirby wrote:
> From 4ea2bd2e1ca18136d7cfd61643bc8d8187b1495f Mon Sep 17 00:00:00 2001
> From: Owen Kirby <osk@exegin.com>
> Date: Wed, 16 Apr 2014 17:45:18 -0700
> Subject: [PATCH] Fix AT91 UDC driver on boards without vbus.
>
> While porting Barebox to one of our boards, we found that the AT91 UDC driver
> will fail to connect to USB hosts, and will spam the console with errors if
> the VBUS pin isn't connected.
>
> Signed-off-by: Owen Kirby <osk@exegin.com>
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-23 7:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 0:51 [PATCH] Fix AT91 UDC driver on boards without vbus Owen Kirby
2014-04-23 7:24 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox