Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5645225ybl; Tue, 10 Dec 2019 09:13:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzvcJLIv7sJ143AOfBPqloplfAxaC9JJoYvfAzAu3nsjHBKwucosmx/bT7e07JqJtSnlB5q X-Received: by 2002:a9d:6e88:: with SMTP id a8mr27621972otr.79.1575997996006; Tue, 10 Dec 2019 09:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575997995; cv=none; d=google.com; s=arc-20160816; b=kOwYMUE1ijF3ox/JfnMdCJ84dOZZyRC+k/+de5Kh1ZS1WilPa+6oSjVJ6TTzWluVZv qiYZHvt+YzBYKkJkzhwbrt4auIiR0X+X58uzCs1EG8qyvd5Zdn4fAojCkNFk4vrPImCc EgEQAzgsrHt2MR3wtrecx+8ig21/RF/sqJdgbFPrmW/h0ENkj7Sd4xeXTYTmxdrQUu0h MPiW11fR2YgY4N+RD0+z8rsqLx8fpAlHcOFwNJ1ykLeHN5+/k/Y0ZB/21jD+F6Kdidl5 lWcfE2pdUzFSzNCqjrCcUiBIxe8DTKuQJnO2+5qHo20SJgO3/sl+j4Zw0Vx15Ruf63pZ 02EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2aUsQE1DKgvq3JL2eyia+DJerAH/OPdkjkm9YCiprVI=; b=rMBG/3TBVv40UX7Ru5Hda0DQlz+mBhIvSs5p5QpALspmnVabD6zWxUZ1XeiRGmhxym jX/MyyvlMvG2WrfQ7XcjBPWr40IdzZK2uyZtsN1AkR9W13FJooGQq88iy3h7XVJkHShW /Ehx7r6PtUix4m4JZPZmSz2zNoghpLzYdH/aCSrK6Rq/5x/oE5Z4ZpsY7v/ULHErsls4 fHNfswK1HUuUgPvD5LlEWcp2VvvElN29b3+Yxmb1HnH+y1S4CoqZZR8frtF92Y2d0N7R czKVMm6ptPblvTOibior1bdQAInXoGerBR8gkmUYgNTdx/MP0+soqy6t5lryoDPJ8qsS aSDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b="ckoe/WcJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r126si2310521oig.36.2019.12.10.09.13.03; Tue, 10 Dec 2019 09:13:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b="ckoe/WcJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727919AbfLJRL7 (ORCPT + 99 others); Tue, 10 Dec 2019 12:11:59 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:44680 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbfLJRL6 (ORCPT ); Tue, 10 Dec 2019 12:11:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1575997880; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2aUsQE1DKgvq3JL2eyia+DJerAH/OPdkjkm9YCiprVI=; b=ckoe/WcJW9nAej0d598EGa+W+KhVYQIfib3owkcpmcgkVEmMUw4QmFQbiwsRMB9kcAXoqS ETDTiS5Ssy3e0+KhVH6LAeooSTa+mYmgYFWLktO0MTo5K1y/zEwXUqvQ2rYOWcODvpmZvI 8DXNMhc7Q/vGd+TndWsgjgFOLOxUcWQ= From: Paul Cercueil To: Bin Liu , Greg Kroah-Hartman Cc: od@zcrc.me, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 7/7] usb: musb: jz4740: Disable pullup at init Date: Tue, 10 Dec 2019 18:11:10 +0100 Message-Id: <20191210171110.62141-7-paul@crapouillou.net> In-Reply-To: <20191210171110.62141-1-paul@crapouillou.net> References: <20191210171110.62141-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pullup may be already enabled before the driver is initialized. It has to be disabled at init time, as we cannot guarantee that a gadget driver will be bound to the UDC. Signed-off-by: Paul Cercueil --- Notes: v3: New patch drivers/usb/musb/jz4740.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index f948eca654f3..1af9e4053312 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -75,6 +75,7 @@ static const struct musb_hdrc_config jz4740_musb_config = { static int jz4740_musb_init(struct musb *musb) { struct device *dev = musb->controller->parent; + u8 power; int err; if (dev->of_node) @@ -97,6 +98,14 @@ static int jz4740_musb_init(struct musb *musb) musb->isr = jz4740_musb_interrupt; musb->dma_share_usb_irq = true; + /* + * If the SoC booted from USB the pullup might still be set. + * Disable it until a gadget is bound. + */ + power = musb_readb(musb->mregs, MUSB_POWER); + power &= ~MUSB_POWER_SOFTCONN; + musb_writeb(musb->mregs, MUSB_POWER, power); + return 0; } -- 2.24.0