Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1330426ybj; Fri, 20 Sep 2019 08:45:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvC6BIaULVXMKIgTF9vx97oaDc62Z9bKvO4rykSRh9rbPq/ke1F83spoZXdu0CPKIX0aFS X-Received: by 2002:a17:907:4242:: with SMTP id np2mr20037447ejb.102.1568994309333; Fri, 20 Sep 2019 08:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568994309; cv=none; d=google.com; s=arc-20160816; b=HDCtGynWuOipTFf16d+zMj19eqo9tZtrkv5cVIdZPkNCMUrdOCX1ef8Tz5BM0UTkI5 tEQCv06TXS9fEkRZ3qiEZ4JsclfOXFkAP3AC6TQ1DKEJbuwVWxPHXpC5VGR+2RGFyQJa Q0PG8PEV3KtlTstpsfEqZOOeuFkafvJG95uyKvWtjKT0DH5xrYb5bKEZc69SrPy5clD7 4O/VVFxAHbxsK4aIhm/anH4Llmp8fsdyLef4dbR+G9iBJnfJD3SmDuj2OmJmBvrriGpK nFpj3drTKlojkrzcXUJ4gUSlG18vKNyLKNWV/Bddvn6GnE2I6iQ+Zl250MF8cYarDIIP O7ZA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gZwbkPbgeb/kNOZhZQ79HvF6AByM5TvEiZJFPK2pnxc=; b=K526LanYh+HBy31xvK2aFS51PgNN8fJBN1sfVs9RAl4NEUNceoyo3o54QXUZKAQ7V6 l/D9lFu6oQMZqnPaoSjnNYJRzsKtn0dOzuj7mHJS8qtpqsRXYU9SsKoO87At4kSo39ri NnOllupNZTub6M17OVteBPJn2tbhE02O3WHbMQKptMdcg1fp7olxJ86cgsM0TaF3Zdey vbQ20ulGAF7OrhP3B2iL2DJrfMqzDWmxYM44toX0B1tUYSOreTxviavEtHqvj9qSLhue Bls5gglN1GXXB3uxWFETVlh+93ACZb4dl5vd2tHB9PTpKgfV5+0TjxCeZ0ZF1Dy8XgYL 6JfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tSjnkzZA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gh16si940617ejb.150.2019.09.20.08.44.46; Fri, 20 Sep 2019 08:45:09 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=tSjnkzZA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406088AbfISWaG (ORCPT + 99 others); Thu, 19 Sep 2019 18:30:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:57612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406360AbfISWQr (ORCPT ); Thu, 19 Sep 2019 18:16:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B4B121927; Thu, 19 Sep 2019 22:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931406; bh=o3tP0NE4bLjkO/y323hJ12h+vGP22dZK+e8WsLUikco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tSjnkzZAJHo0y4tOtoK0v484upam4wOIR9vAV5EkYGFEaGBSvyU/FZdE71/1j6oi7 5euhXGvBiyzBEx5wlErDTn1FWPwul2hEL5SomaRmfyhQ5TPPEttGg7qkC2n6gv1fbx M1NHiYRZXcP+L4u+znEh+GSIRp3ThQyB9AoOxrq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Kishon Vijay Abraham I Subject: [PATCH 4.14 05/59] phy: renesas: rcar-gen3-usb2: Disable clearing VBUS in over-current Date: Fri, 20 Sep 2019 00:03:20 +0200 Message-Id: <20190919214757.399176052@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214755.852282682@linuxfoundation.org> References: <20190919214755.852282682@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yoshihiro Shimoda commit e6839c31a608e79f2057fab987dd814f5d3477e6 upstream. The hardware manual should be revised, but the initial value of VBCTRL.OCCLREN is set to 1 actually. If the bit is set, the hardware clears VBCTRL.VBOUT and ADPCTRL.DRVVBUS registers automatically when the hardware detects over-current signal from a USB power switch. However, since the hardware doesn't have any registers which indicates over-current, the driver cannot handle it at all. So, if "is_otg_channel" hardware detects over-current, since ADPCTRL.DRVVBUS register is cleared automatically, the channel cannot be used after that. To resolve this behavior, this patch sets the VBCTRL.OCCLREN to 0 to keep ADPCTRL.DRVVBUS even if the "is_otg_channel" hardware detects over-current. (We assume a USB power switch itself protects over-current and turns the VBUS off.) This patch is inspired by a BSP patch from Kazuya Mizuguchi. Fixes: 1114e2d31731 ("phy: rcar-gen3-usb2: change the mode to OTG on the combined channel") Cc: # v4.5+ Signed-off-by: Yoshihiro Shimoda Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Greg Kroah-Hartman --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -64,6 +64,7 @@ USB2_OBINT_IDDIGCHG) /* VBCTRL */ +#define USB2_VBCTRL_OCCLREN BIT(16) #define USB2_VBCTRL_DRVVBUSSEL BIT(8) /* LINECTRL1 */ @@ -278,6 +279,7 @@ static void rcar_gen3_init_otg(struct rc u32 val; val = readl(usb2_base + USB2_VBCTRL); + val &= ~USB2_VBCTRL_OCCLREN; writel(val | USB2_VBCTRL_DRVVBUSSEL, usb2_base + USB2_VBCTRL); writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA); val = readl(usb2_base + USB2_OBINTEN);