Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2098486ybl; Thu, 30 Jan 2020 11:19:36 -0800 (PST) X-Google-Smtp-Source: APXvYqybZAUojh+ZKU//I3lXW5VyPcoJZOXyl5D5j0fn3EA7ugBC5W4BJcqt9ookWqVcPfcLpAIc X-Received: by 2002:a9d:7696:: with SMTP id j22mr4959320otl.188.1580411976509; Thu, 30 Jan 2020 11:19:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411976; cv=none; d=google.com; s=arc-20160816; b=hIogWEeSONgVcqQe7Q7tYNb5rW9QJVZU5FbuRJSN6ZpFmW+Ai8yrNAu7TEJ9lh428R f+Hl2tLyC0RV96hefijyt5vTtv4myr5/T3TUnBZD2XmPQeBKEFMOl1At2vW1Q1XQbgGK kjPMvD+z5YFeamGsu2ovjE96AeXoVQjcgj1eAjf9dc4mt5Odh7RekM3ZFEHnBirnLj2S 2TFNfmHxMnLfJ04jG++JHX7WczqP2b5iWFB15pB/P/Q7UJ5VC5qicetiBXKRorUXYOb2 xZZ1lL7MrdyqgYRAwBwq68UcleduO0N0F6mebgc/2VBgM3K6BamwmuQEXPi7AS8/OKVM vIsw== 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=vJ8vVWW9PdvDLVYnOUmBTVYh7qhruOKBpDxEqpBgnfI=; b=M+/M7HCIbbG6MuboXGyjmNn9DBSsPROmejagOdgMNLoIMy1k+/tbpSUPKQBafB/Bhr pfourpyW2im8kZj/mUXAwrdHQKQy87SIRU79Dry3JUGhFktso5mtEZWHV2TS9kSABL2C 3vksl7dYtYbdLqHcxv7RJkFJjik1bG6dXZqKaRalFIQ4S/VpPSQd+kpLwcPrNYXV5F96 6jpUSCYiWw+a0uV2pTn+5MI6nXAF9urhyfBvatih9NCnESvDutNQtdwSpi+Ces/kiTS2 jS3nZk47eHummGvc7Xq5UXKueXZxriqslCb4Zp+n28JBZuHTDQPW1Xe17e9MMcQ/2YT3 GmNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YcOj1Zs8; 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 k14si3130895oig.69.2020.01.30.11.19.25; Thu, 30 Jan 2020 11:19:36 -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=pass header.i=@kernel.org header.s=default header.b=YcOj1Zs8; 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 S1731130AbgA3SqG (ORCPT + 99 others); Thu, 30 Jan 2020 13:46:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:55678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731103AbgA3Spy (ORCPT ); Thu, 30 Jan 2020 13:45:54 -0500 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 2B83F2083E; Thu, 30 Jan 2020 18:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409953; bh=43kTr0NPBcUNY5/WCSeWOm0xRl5ynf2UYA22QRGlEVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YcOj1Zs8eP8T8s8aWz/7vDlVPwCDB0zom3QUo0JqKi9Q5DEvdr78oVxwJzqoXU42U egALbaYJj5pjEpGJ4QvTcMDFYZtdOI2Ak8qpOA6NvT3/OUCJuZnV0HcJkgVsKnfHAH Dx7Bfn66UU6cG2qtR3+zVQ8X+qrlE6Ion86UiWpE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Merlijn Wajer , Pavel Machek , Sebastian Reichel , Tony Lindgren , Kishon Vijay Abraham I , Sasha Levin Subject: [PATCH 5.4 058/110] phy: cpcap-usb: Prevent USB line glitches from waking up modem Date: Thu, 30 Jan 2020 19:38:34 +0100 Message-Id: <20200130183621.938204099@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@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: Tony Lindgren [ Upstream commit 63078b6ba09e842f09df052c5728857389fddcd2 ] The micro-USB connector on Motorola Mapphone devices can be muxed between the SoC and the mdm6600 modem. But even when used for the SoC, configuring the PHY with ID pin grounded will wake up the modem from idle state. Looks like the issue is probably caused by line glitches. We can prevent the glitches by using a previously unknown mode of the GPIO mux to prevent the USB lines from being connected to the moden while configuring the USB PHY, and enable the USB lines after configuring the PHY. Note that this only prevents waking up mdm6600 as regular USB A-host mode, and does not help when connected to a lapdock. The lapdock specific issue still needs to be debugged separately. Cc: Merlijn Wajer Cc: Pavel Machek Cc: Sebastian Reichel Acked-by: Pavel Machek Signed-off-by: Tony Lindgren Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sasha Levin --- drivers/phy/motorola/phy-cpcap-usb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c index 9a38741d3546d..5baf64dfb24de 100644 --- a/drivers/phy/motorola/phy-cpcap-usb.c +++ b/drivers/phy/motorola/phy-cpcap-usb.c @@ -115,7 +115,7 @@ struct cpcap_usb_ints_state { enum cpcap_gpio_mode { CPCAP_DM_DP, CPCAP_MDM_RX_TX, - CPCAP_UNKNOWN, + CPCAP_UNKNOWN_DISABLED, /* Seems to disable USB lines */ CPCAP_OTG_DM_DP, }; @@ -381,7 +381,8 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) { int error; - error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); + /* Disable lines to prevent glitches from waking up mdm6600 */ + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); if (error) goto out_err; @@ -408,6 +409,11 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) if (error) goto out_err; + /* Enable UART mode */ + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); + if (error) + goto out_err; + return 0; out_err: @@ -420,7 +426,8 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) { int error; - error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); + /* Disable lines to prevent glitches from waking up mdm6600 */ + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); if (error) return error; @@ -460,6 +467,11 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) if (error) goto out_err; + /* Enable USB mode */ + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); + if (error) + goto out_err; + return 0; out_err: -- 2.20.1