From patchwork Sat Dec 22 18:27:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Dunn X-Patchwork-Id: 1906181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 1E9DEDFB79 for ; Sat, 22 Dec 2012 18:31:10 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TmTnK-0008GT-IZ; Sat, 22 Dec 2012 18:27:34 +0000 Received: from smtp.newsguy.com ([74.209.136.69]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TmTnC-0008Fh-Mf for linux-arm-kernel@lists.infradead.org; Sat, 22 Dec 2012 18:27:27 +0000 Received: from localhost.localdomain (84.sub-70-199-227.myvzw.com [70.199.227.84]) by smtp.newsguy.com (8.14.3/8.14.3) with ESMTP id qBMIREEY072260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 22 Dec 2012 10:27:24 -0800 (PST) (envelope-from mikedunn@newsguy.com) From: Mike Dunn To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] ARM: pxa: palm27x: fix udc device initialization Date: Sat, 22 Dec 2012 10:27:39 -0800 Message-Id: <1356200860-3241-2-git-send-email-mikedunn@newsguy.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1356200860-3241-1-git-send-email-mikedunn@newsguy.com> References: <1356200860-3241-1-git-send-email-mikedunn@newsguy.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121222_132726_932465_482A10D1 X-CRM114-Status: GOOD ( 14.10 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: marex@denx.de, Mike Dunn X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 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 This patch fixes some bad behaviour from the usb gadget during machine initialization by changing the management of the D+ pull-up gpio from the gpio-vbus driver to the pxa27x-udc driver. Also, code that drives the pull-up high is removed. (The gpio-vbus driver can optionally manage the D+ line pull-up, but the pxa27x-udc driver does this itself.) Without this patch, the host senses the presence of the usb gadget during machine initialization (when palm27x_udc_init() runs), at which point it tries to enumerate the newly detected usb gadget. But because the pxa27x-udc driver has not been initialized yet, there's no gadget driver to respond to the host, and enumeration fails. Tested on my Palm Treo680. Signed-off-by: Mike Dunn Acked-by: Robert Jarzmik --- arch/arm/mach-pxa/palm27x.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c index 17d4c53..298a8a9 100644 --- a/arch/arm/mach-pxa/palm27x.c +++ b/arch/arm/mach-pxa/palm27x.c @@ -167,7 +167,7 @@ void __init palm27x_lcd_init(int power, struct pxafb_mode_info *mode) #if defined(CONFIG_USB_PXA27X) || \ defined(CONFIG_USB_PXA27X_MODULE) static struct gpio_vbus_mach_info palm27x_udc_info = { - .gpio_vbus_inverted = 1, + .gpio_pullup = -1, /* pxa27x-udc driver handles D+ pull-up, not vbus */ }; static struct platform_device palm27x_gpio_vbus = { @@ -180,17 +180,22 @@ static struct platform_device palm27x_gpio_vbus = { void __init palm27x_udc_init(int vbus, int pullup, int vbus_inverted) { - palm27x_udc_info.gpio_vbus = vbus; - palm27x_udc_info.gpio_pullup = pullup; + struct pxa2xx_udc_mach_info udc_mach_info = { + .udc_is_connected = NULL, + .udc_command = NULL, + .gpio_pullup_inverted = false, + }; + udc_mach_info.gpio_pullup = pullup; + palm27x_udc_info.gpio_vbus = vbus; palm27x_udc_info.gpio_vbus_inverted = vbus_inverted; - if (!gpio_request(pullup, "USB Pullup")) { - gpio_direction_output(pullup, - palm27x_udc_info.gpio_vbus_inverted); - gpio_free(pullup); - } else + /* driver will quietly ignore an invalid gpio */ + if (!gpio_is_valid(pullup)) { + pr_err("Palm27x: USB D+ pull-up gpio is invalid!\n"); return; + } + pxa_set_udc_info(&udc_mach_info); platform_device_register(&palm27x_gpio_vbus); }