From patchwork Sat Jan 23 12:57:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 8096911 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 43D749F6FA for ; Sat, 23 Jan 2016 12:58:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68CF3203ED for ; Sat, 23 Jan 2016 12:57:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A7F5203E9 for ; Sat, 23 Jan 2016 12:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753143AbcAWM5o (ORCPT ); Sat, 23 Jan 2016 07:57:44 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:34733 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753098AbcAWM5h (ORCPT ); Sat, 23 Jan 2016 07:57:37 -0500 Received: by mail-wm0-f54.google.com with SMTP id u188so15137369wmu.1; Sat, 23 Jan 2016 04:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=/QnPa4v5CL+yFqNz9K7OdjQ3wV6ncjmZJPX89MVo9kY=; b=vUPwD27dBVuWR6cQd4KZUoWc7lIbCirvX97UI8SuMLaL7ZtIJKBAbIQf8/LIc34WX0 6SIB9JAqMJq16y8oM8CsxzlTsv+EUvaFLDIFQD+81BqLtZDRP60wCKt2wqIfFMUy9ipI hjYY8gdWEwIKmKpjxrLKV6mT48ACaagEXCv/DEM8WlVuCFwCoKSau6+Fwj3JbjdgQKNa fke94RAH8o2Awe7UxUit05SozsXDyoHHLIvtPRzbKz36PE3FkLkFqTkosP6H7gqprGz+ 1VcASkgBpbDJBwL3HQ6SrQBRyBRWWQm+8zHefA6O1Uo3sn114rkuE0SQCV3gCH8m012Q LDog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id; bh=/QnPa4v5CL+yFqNz9K7OdjQ3wV6ncjmZJPX89MVo9kY=; b=AA4b6LrMFHTNQiDJlMBIN25xfIrGFz7Bws7C6MoGA5MbLOzCihz8YtqODKLPZqpkJG 0a/dZtxsAg1f8si/dKJJICXAORLTtruFjD1+5jcNvjw4ExNpgl8la6OlbY3ygPJRscqF +DvWAnWOFFtuuu+H+zfxJm4EFDbYHeYzBR4MRMLtMTOX2kvnCIN4K6YzfXjl5V3l69TE +OeqEIZev7F2K6ueUntCxE4xvGFQ8nheLvTg+QsDzHxh0/HNk2WVotvzHHAo8s9DYWgB /+Z4TL+guD05b2/3Tlf6hAxl98aAyrxoNmDTTfpXMc4foFL+PWNfPgVsRbomDOAj3Bsw VdpA== X-Gm-Message-State: AG10YOSwGOR7kqqsxrY+qYvB0o7Ectr+hqdyvoiXL+sIEHLu7Yab2ZqOtg48FJd722VUuQ== X-Received: by 10.194.173.65 with SMTP id bi1mr8069936wjc.110.1453553854879; Sat, 23 Jan 2016 04:57:34 -0800 (PST) Received: from pali-latitude.localnet ([2001:718:1e03:a01::1ca]) by smtp.gmail.com with ESMTPSA id c15sm7224687wmd.19.2016.01.23.04.57.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 23 Jan 2016 04:57:33 -0800 (PST) From: Pali =?utf-8?q?Roh=C3=A1r?= To: Tony Lindgren Subject: Re: Nokia N900: musb is in wrong state after boot Date: Sat, 23 Jan 2016 13:57:32 +0100 User-Agent: KMail/1.13.7 (Linux/3.13.0-76-generic; KDE/4.14.2; x86_64; ; ) Cc: joerg Reisenweber , Felipe Balbi , "Greg Kroah-Hartman" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Ivaylo Dimitrov , Sebastian Reichel , Aaro Koskinen , Pavel Machek , Nishanth Menon References: <201601091616.04193@pali> <3690314.8jDXSUDcRZ@saturn> <20160121192113.GM19432@atomide.com> In-Reply-To: <20160121192113.GM19432@atomide.com> MIME-Version: 1.0 Message-Id: <201601231357.32629@pali> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thursday 21 January 2016 20:21:13 Tony Lindgren wrote: > * joerg Reisenweber [160121 10:45]: > > On Thu 21 January 2016 09:41:46 Tony Lindgren wrote: > > > Then for supporting the USB host mode.. We should add regulator > > > support to the USB PHY driver so if the ID pin is grounded, the > > > PHY driver enables the VBUS regulator. That too seems to need > > > some coordination between the drivers/phy/phy-twl4030-usb.c and > > > 1707 driver if the ID pin interrupt is only detected in > > > drivers/phy/phy-twl4030-usb.c. > > > > Note that, while this is probably a good thing to do, it needs to > > be sufficiently loose coupling to allow user to 'intercept' this > > VBOOS regulator enabling and instead allow device charging while > > in externally powered hostmode. There's even a spec for this in > > USB-docs-foo iirc, something along a certain resistor value on ID > > to GND - alas I guess the twl4030 is not capable to detect such > > sophisticated signaling, and anyway it's always desirable to allow > > user to manually override the VBOOST and enable VBUS-charging > > while in hostmode. > > OK, I think this is what's happening with the Motorola LapDock BTW. > It always feeds the VBUS, well most of the time. Do you have some > pointer to the "certain resistor value on ID to GND" spec? Is it > maybe part of the carkit related parts of the USB spec? > > > On N900 the situation is even more complex since the 1707 doesn't > > support genuine ID detection, neither does it support emulated ID > > grounding. And there's no other method than a ID=GND message from > > PHY to musb core to make the musb core state engine transfer into > > proper hostmode. Thus my H-E-N hostmode botch abuses debug flags > > to force the musb core into a "emulated" hostmode and this mode > > doesn't support USB speed detection. Thus speed settings are > > forced onto musb core and PHY by software, and the musb core speed > > bits are only effective before session enabled. > > Bottom line: you need VBUS to try and negotiate speed with the > > attached device in hostmode, but to actually set this speed you > > detected by software means, you need to disable and discharge VBUS > > again, or musb core won't care about the speed you set. To be > > utterly clear: unconditional enabling of VBUS in ID=GND won't > > work. > > > > This is quite complex and it's questionable if it could get handled > > reasonably in kernel space. *Very* N900 specific niche solution, > > I'd not think it's suited for upstreaming. > > Yeah OK. I think we should be able to support the aux VBUS regulator > part with mainline kernel though. > > Regards, > > Tony Hello, attached patch for musb debugfs adds option to force both hostmode with speed. It is just example, I tested only compilation. Something like that will be needed for usb host mode on Nokia N900. From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sat, 9 Jan 2016 16:57:59 +0100 Subject: [PATCH] musb: debugfs: Add support in testmode for forcing host mode together with speed --- drivers/usb/musb/musb_debugfs.c | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 9b22d94..62c13a2 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -147,28 +147,34 @@ static int musb_test_mode_show(struct seq_file *s, void *unused) test = musb_readb(musb->mregs, MUSB_TESTMODE); - if (test & MUSB_TEST_FORCE_HOST) + if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)) + seq_printf(s, "force host full-speed\n"); + + else if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS)) + seq_printf(s, "force host high-speed\n"); + + else if (test & MUSB_TEST_FORCE_HOST) seq_printf(s, "force host\n"); - if (test & MUSB_TEST_FIFO_ACCESS) + else if (test & MUSB_TEST_FIFO_ACCESS) seq_printf(s, "fifo access\n"); - if (test & MUSB_TEST_FORCE_FS) + else if (test & MUSB_TEST_FORCE_FS) seq_printf(s, "force full-speed\n"); - if (test & MUSB_TEST_FORCE_HS) + else if (test & MUSB_TEST_FORCE_HS) seq_printf(s, "force high-speed\n"); - if (test & MUSB_TEST_PACKET) + else if (test & MUSB_TEST_PACKET) seq_printf(s, "test packet\n"); - if (test & MUSB_TEST_K) + else if (test & MUSB_TEST_K) seq_printf(s, "test K\n"); - if (test & MUSB_TEST_J) + else if (test & MUSB_TEST_J) seq_printf(s, "test J\n"); - if (test & MUSB_TEST_SE0_NAK) + else if (test & MUSB_TEST_SE0_NAK) seq_printf(s, "test SE0 NAK\n"); return 0; @@ -206,30 +212,36 @@ static ssize_t musb_test_mode_write(struct file *file, if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; - if (strstarts(buf, "force host")) + if (strstarts(buf, "force host full-speed")) + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; + + else if (strstarts(buf, "force host high-speed")) + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS; + + else if (strstarts(buf, "force host")) test = MUSB_TEST_FORCE_HOST; - if (strstarts(buf, "fifo access")) + else if (strstarts(buf, "fifo access")) test = MUSB_TEST_FIFO_ACCESS; - if (strstarts(buf, "force full-speed")) + else if (strstarts(buf, "force full-speed")) test = MUSB_TEST_FORCE_FS; - if (strstarts(buf, "force high-speed")) + else if (strstarts(buf, "force high-speed")) test = MUSB_TEST_FORCE_HS; - if (strstarts(buf, "test packet")) { + else if (strstarts(buf, "test packet")) { test = MUSB_TEST_PACKET; musb_load_testpacket(musb); } - if (strstarts(buf, "test K")) + else if (strstarts(buf, "test K")) test = MUSB_TEST_K; - if (strstarts(buf, "test J")) + else if (strstarts(buf, "test J")) test = MUSB_TEST_J; - if (strstarts(buf, "test SE0 NAK")) + else if (strstarts(buf, "test SE0 NAK")) test = MUSB_TEST_SE0_NAK; musb_writeb(musb->mregs, MUSB_TESTMODE, test); -- 1.7.9.5