Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp859019ybj; Fri, 20 Sep 2019 00:57:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzq7/ZTICwWqi25CyAlA6lh2XZK3fkzl5aOuPdNRmeJOrnNWXkpVV91+YoSFyeAJXFp4MRI X-Received: by 2002:a50:d096:: with SMTP id v22mr20685133edd.81.1568966257579; Fri, 20 Sep 2019 00:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568966257; cv=none; d=google.com; s=arc-20160816; b=IWmSRFWuEHWWM03r5f7zouTiQiQaRbfUn04qdeIhBV5kU4BRWN/asOb3iGa2NEaARR 1lpeKOYImHSSogKQeAiovzsAzfctLczmD3AhmXQ8uTQkZzx1USrLmAHGodDdEn9ypEZc StxTBF/3xE1Mhtg+ctjVeYic7U0AgtuobEMBG/z2iJzmQRYPz3PmHIDH3nvmDv7DqNIN v1gV4PFPi6/xDlxU9OJyXVdH77mYyTpCa/3qE9DfUjPBdpC9ZTagidW4xEKw0zVbGJ3d b6ToQPaDUtbyHXrkxKGavfitA20d7KHcjsAev2FspOfjMB8NVGMF00SYPsnTS/uJP0zc E25A== 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=VH83A7J0hRpwvyIwBELgsKuZctqmI9MwjjbOE2z9H4M=; b=N18gc4pwt1/+P5W+UcGQstt/e3CKhHRqV8cAfJPyjqeSiawlnQvoOXm56rXENCCUrc W96Gf9JGnlLQ9aIODg+FRPdxsJdTcO0b/8XDjd+2KIPsRDpezOtELFfI+m8HE7Hdp6aE gOGN0VGxymJ1mwHgJ+CFkpFj1SHJYH5VmrP35C5WTLF+sML1upHmq4iCV+iPDWpqofnj wurnmT4FgRLVabamW/RNUSnKCpsJezCZT/Y+iqhNenIC9LSBPpUrvDeMoOpvl1A4EsRe omZYfNWikkG2EEV3I4DpeL5XipaViOK4Nw1apA3hSl4dOUTDmxLal6pFBoJL+sbOwWGL /IEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPkPF3nx; 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 x30si866013edi.351.2019.09.20.00.57.14; Fri, 20 Sep 2019 00:57:37 -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=wPkPF3nx; 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 S2405200AbfISWGZ (ORCPT + 99 others); Thu, 19 Sep 2019 18:06:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:43718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405174AbfISWGT (ORCPT ); Thu, 19 Sep 2019 18:06:19 -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 61BA421A4C; Thu, 19 Sep 2019 22:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568930778; bh=r0m26UKHtA2rH1mqxbDjBWhP355JLVzzf6ub9mODwyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wPkPF3nxZI/m2TCs1Y8tBVyhQiTpOVAThD1+NZ/pPsTCGU0+kp85olMyNL8PZt227 FaIHyyTGiV0xBzxYrQ22C/X7K6EwYzk4knIvDxgxiIrjdPAKQq7VXEmzsUmolm3l1z 0ACWz2+ls0TuXBLfQ55e+3UdWT1LLKsYT8jRQMpg= 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 5.2 003/124] phy: renesas: rcar-gen3-usb2: Disable clearing VBUS in over-current Date: Fri, 20 Sep 2019 00:01:31 +0200 Message-Id: <20190919214819.317756759@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214819.198419517@linuxfoundation.org> References: <20190919214819.198419517@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 @@ -61,6 +61,7 @@ USB2_OBINT_IDDIGCHG) /* VBCTRL */ +#define USB2_VBCTRL_OCCLREN BIT(16) #define USB2_VBCTRL_DRVVBUSSEL BIT(8) /* LINECTRL1 */ @@ -374,6 +375,7 @@ static void rcar_gen3_init_otg(struct rc writel(val, usb2_base + USB2_LINECTRL1); val = readl(usb2_base + USB2_VBCTRL); + val &= ~USB2_VBCTRL_OCCLREN; writel(val | USB2_VBCTRL_DRVVBUSSEL, usb2_base + USB2_VBCTRL); val = readl(usb2_base + USB2_ADPCTRL); writel(val | USB2_ADPCTRL_IDPULLUP, usb2_base + USB2_ADPCTRL);