Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5955754ybi; Wed, 29 May 2019 00:03:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQm5GsbtBx//Q6zPPSTNmjGLN636k9ZJfzghkS8iKyB4rDxpAPlQT3XVCFgDxVx3P7VByH X-Received: by 2002:a63:c14:: with SMTP id b20mr137289473pgl.163.1559113410972; Wed, 29 May 2019 00:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559113410; cv=none; d=google.com; s=arc-20160816; b=0k65uTJ/LAG1BI7M3FC5R6r19vdImdiGEn1Qo1iH2MWs531v7q7FdHSdB9lAy1z8Yh jxohATp0iHCX7lnIIC9G0hbQyM6OUc2N+gjXv47blCX0o8eOFS2lPEaao8dTAabxXkSO af2rweTWi9XkImoPk1KRSmmmu2jV/6jtiDt5PuZQ8ydBnRsCr96Y/Mppw2x+i8XnPS7q LhbtqlaWVVo2OzYEoKJyKHqxLdQ57Haee1WU7Fi2HJva2GdS+kqqNGSD7bKDf6DUZyXx kPcdNbr4jPYHNrfjTHn1MtTTaInWedhsdPkHjOyE/X/90R5dT1GikvJyjSODEet1S7Hl +thg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=E0bgQPgSMP42ZfwbXSuWmab92jZuGUt5fjUbtxPvUiM=; b=jZWdSlq5o5z9wEqIxqbbURPWX2XtMG5ELRUA8JSCUKV/EUfPWqAOsNjIcZNycdwyhX z+RojZx3gkyQQfrCyz3EjyTFeNUbslMncfZsx1ilfUHqtr/qR37a3iHt5qFvYDLBjdx5 lAsUcG6qI2n7USAWf+DfSngE8Yc7AWDn6OdXqpxxKrq6zOkW+spIOXJd7Ow/xz5sxiCA u7VRoy82XNNxwOgYDbWpwFEOFVGPQRq1zNyLtNvA7xRz1cbz/O/qT1M5sM4mMSU5DK1a rCB8mSh67cbjKhwj6PsiaoqMtyoWMBcMQB4eu2RTqxdezZnbCAq3PRM09PoArIuBMQH+ HI4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rU4iITG5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w184si29265317pfw.271.2019.05.29.00.03.14; Wed, 29 May 2019 00:03:30 -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=@gmail.com header.s=20161025 header.b=rU4iITG5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726515AbfE2G76 (ORCPT + 99 others); Wed, 29 May 2019 02:59:58 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46688 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbfE2G75 (ORCPT ); Wed, 29 May 2019 02:59:57 -0400 Received: by mail-pl1-f193.google.com with SMTP id bb3so628528plb.13; Tue, 28 May 2019 23:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E0bgQPgSMP42ZfwbXSuWmab92jZuGUt5fjUbtxPvUiM=; b=rU4iITG5VmFx4XAjZ9SqdhuxUFPZ5ojPBvVmPgPP/iEB6Zl/SxjPjIhLou+meUEEfo aE4bNXDzRYOC52gv/f5psxBu4D6JI7J6aOPwmyzHEcDMbGLTHhck2r15OHzLmzlbdGJL ZxzX9vyrueX+suCwX9Z7LOdPfuG1sHClnSaZTFHe16dyt5wMErqzI0FE+56QgZgrDG8u xmLcJgBSPX7ytWo6jVTC8OqdPumPG6Yp0P5f6jBe8QSAi1BZT4qzCR0OCuNHMmSVCzfK zt2xQpFO3cRe92LHNxjXUGN40xSP3L+QKjWQXcus4oiZaeS93tMwmAl/ycm41hJHFZck 4FtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E0bgQPgSMP42ZfwbXSuWmab92jZuGUt5fjUbtxPvUiM=; b=Bte+Gjt0r8eZmrNx/cHxEPb4qYfecWA5sBNeuifWz1fV+cQykw8rDx5XgCIC5hvrAI TxO4v383v8dA/3ZtuNNiulgAM+G/q0wTIWtHszjPtsUXft8v0Vxiz+MZOdFpcRcawaup cjIkWGqWs3mWQ+63wvXIwyJqMTnDNZqhWUJPf3w9TbGU9Ssl3GWjOcnDLbNwraoqo67f +sfbrALLrWYLEDy/c7pt0rsrRo3f1JkUQiUDD52TLWjV0nxqphn5fqAWKIIHkxzn5xRd 0TZ/WAaYYXhYmVY8BIbPXFtieLTNkeWm2Q2v4i5dKqwK9VlychoLB5ol0oOu3yH6SCad 2alg== X-Gm-Message-State: APjAAAU/RK3eq0vUxIXzXr9+saZrmpjaX4ZF9LsdTf/H4W4IuSB3bUnM qsG/76Bnw2vKDsIV+iz5WUuQoplJ0t8= X-Received: by 2002:a17:902:9305:: with SMTP id bc5mr39755419plb.193.1559113196710; Tue, 28 May 2019 23:59:56 -0700 (PDT) Received: from localhost.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id g19sm13460036pgj.75.2019.05.28.23.59.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 23:59:56 -0700 (PDT) From: Andrey Smirnov To: linux-usb@vger.kernel.org Cc: Andrey Smirnov , Chris Healy , Felipe Balbi , Shawn Guo , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init() Date: Tue, 28 May 2019 23:59:48 -0700 Message-Id: <20190529065948.5492-1-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 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 Since this driver already handles changer detction state, copy the workaround code currently residing in arch/arm/mach-imx/anatop.c into this drier to consolidate the places modifying it. Signed-off-by: Andrey Smirnov Cc: Chris Healy Cc: Felipe Balbi Cc: Shawn Guo Cc: Fabio Estevam Cc: NXP Linux Team Cc: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- The intent of this patch is to consolidate all of the code maipulating charge detection state to a signle place and if this patch is agreed upon I plan to follow it up with this change: https://github.com/ndreys/linux/commit/7248f2b85b4706760fd33d2ff970e2ea12d3bea7 Thanks, Andrey Smirnov drivers/usb/phy/phy-mxs-usb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 1b1bb0ad40c3..6fa16ab31e2e 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -63,6 +63,7 @@ #define ANADIG_USB1_CHRG_DETECT_SET 0x1b4 #define ANADIG_USB1_CHRG_DETECT_CLR 0x1b8 +#define ANADIG_USB2_CHRG_DETECT_SET 0x214 #define ANADIG_USB1_CHRG_DETECT_EN_B BIT(20) #define ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B BIT(19) #define ANADIG_USB1_CHRG_DETECT_CHK_CONTACT BIT(18) @@ -250,6 +251,19 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) if (mxs_phy->data->flags & MXS_PHY_NEED_IP_FIX) writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); + if (mxs_phy->regmap_anatop) { + unsigned int reg = mxs_phy->port_id ? + ANADIG_USB1_CHRG_DETECT_SET : + ANADIG_USB2_CHRG_DETECT_SET; + /* + * The external charger detector needs to be disabled, + * or the signal at DP will be poor + */ + regmap_write(mxs_phy->regmap_anatop, reg, + ANADIG_USB1_CHRG_DETECT_EN_B | + ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B); + } + mxs_phy_tx_init(mxs_phy); return 0; -- 2.21.0