From patchwork Tue Jul 5 09:05:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 944002 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6596aHQ006692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 5 Jul 2011 09:06:56 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qe1a0-0002YN-BM; Tue, 05 Jul 2011 09:06:04 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qe1Zz-00036O-UX; Tue, 05 Jul 2011 09:06:03 +0000 Received: from mail.free-electrons.com ([88.190.12.23]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qe1Zf-00032p-HN for linux-arm-kernel@lists.infradead.org; Tue, 05 Jul 2011 09:05:45 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 2C905276; Tue, 5 Jul 2011 11:05:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id 031C9136; Tue, 5 Jul 2011 11:05:32 +0200 (CEST) From: Thomas Petazzoni To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] ohci-at91: add vbus_pin_inverted platform attribute Date: Tue, 5 Jul 2011 11:05:26 +0200 Message-Id: <1309856728-8265-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.4.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110705_050543_734417_B73A6FFE X-CRM114-Status: GOOD ( 14.37 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Jean-Christophe Plagniol-Villard , Nicolas Ferre , Andrew Victor X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 05 Jul 2011 09:06:56 +0000 (UTC) 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 Cc: Andrew Victor Cc: Nicolas Ferre Cc: Jean-Christophe Plagniol-Villard --- 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]); } }