All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ohci-at91: add vbus_pin_inverted platform attribute
@ 2011-07-05  9:05 Thomas Petazzoni
  2011-07-05  9:05 ` [PATCH 2/3] at91-ohci: support overcurrent notification Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2011-07-05  9:05 UTC (permalink / raw)
  To: linux-arm-kernel

The existing OHCI AT91 driver made the assumption that the enable
input of the USB power switch was active low. However, some USB power
switches such as the Micrel MIC2026-1 [1] have an active high input to
enable the power. A new vbus_pin_inverted attribute is added to the
at91_usbh_data structure so that board files can tell the OHCI driver
if the vbus pin logic is active low or active high.

[1] http://www.micrel.com/page.do?page=product-info/products/mic2026.shtml

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Andrew Victor <linux@maxim.org.za>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/include/mach/board.h |    1 +
 drivers/usb/host/ohci-at91.c            |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index ed544a0..61d52dc 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -98,6 +98,7 @@ extern void __init at91_add_device_eth(struct at91_eth_data *data);
 struct at91_usbh_data {
 	u8		ports;		/* number of ports on root hub */
 	u8		vbus_pin[2];	/* port power-control pin */
+	u8              vbus_pin_inverted;
 };
 extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
 extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 944291e..52e50ba 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -284,7 +284,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
 			if (pdata->vbus_pin[i] <= 0)
 				continue;
 			gpio_request(pdata->vbus_pin[i], "ohci_vbus");
-			gpio_direction_output(pdata->vbus_pin[i], 0);
+			gpio_direction_output(pdata->vbus_pin[i], 0 ^ pdata->vbus_pin_inverted);
 		}
 	}
 
@@ -301,7 +301,7 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
 		for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
 			if (pdata->vbus_pin[i] <= 0)
 				continue;
-			gpio_direction_output(pdata->vbus_pin[i], 1);
+			gpio_direction_output(pdata->vbus_pin[i], 1 ^ pdata->vbus_pin_inverted);
 			gpio_free(pdata->vbus_pin[i]);
 		}
 	}
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH v2] AT91 OHCI active-high vbus and overcurrent handling
@ 2011-07-13  9:29 Thomas Petazzoni
  2011-07-13  9:29 ` [PATCH 1/3] ohci-at91: add vbus_pin_inverted platform attribute Thomas Petazzoni
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2011-07-13  9:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This series of patches adds two features to the AT91 OHCI driver :
 * Support for active-high vbus pin USB power switches (patch 1)
 * Support for over-current notification (patches 2 and 3)

Changes since v1 (posted July, 5th 2011) :

 * Simplify expressions in gpio_direction_output() when controlling
   the VBUS pin, as suggested by Sergei Shtylyov
   <sshtylyov@mvista.com>

 * Extend the overcurrent notification support by notifying the USB
   stack and exposing the fact that per-port power switching and
   overcurrent notification, based on ohci-da8xx.c and ohci-s3c2410.c,
   as suggested by Matthieu CASTET <matthieu.castet@parrot.com>

I haven't yet taken into account Jean-Christophe Plagniol-Villard
comment on using the named ressources, because I don't see how a board
file can define ressources with the current AT91 code structure (the
ressources are only defined at the SoC level). Input from
Jean-Christophe on this would be greatly appreciated.

Regards,

Thomas

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

end of thread, other threads:[~2011-09-07 10:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-05  9:05 [PATCH 1/3] ohci-at91: add vbus_pin_inverted platform attribute Thomas Petazzoni
2011-07-05  9:05 ` [PATCH 2/3] at91-ohci: support overcurrent notification Thomas Petazzoni
2011-07-05 10:12   ` Matthieu CASTET
2011-07-05 10:18     ` Thomas Petazzoni
2011-07-05 12:18       ` Matthieu CASTET
2011-07-05 14:23   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-05  9:05 ` [PATCH 3/3] at91-ohci: configure overcurrent pins as GPIOs Thomas Petazzoni
2011-07-05 11:39 ` [PATCH 1/3] ohci-at91: add vbus_pin_inverted platform attribute Sergei Shtylyov
2011-07-05 11:54   ` Thomas Petazzoni
2011-07-13  9:29 [PATCH v2] AT91 OHCI active-high vbus and overcurrent handling Thomas Petazzoni
2011-07-13  9:29 ` [PATCH 1/3] ohci-at91: add vbus_pin_inverted platform attribute Thomas Petazzoni
2011-09-07 10:47   ` Nicolas Ferre

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.