Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3296843pxk; Mon, 21 Sep 2020 09:58:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLp2tG1ruBovLkZl43NVXWc6CVF0LoOYbhgFZaxNZwevN1ZB65UshQNdjNfPNBI2K48gnP X-Received: by 2002:a17:906:bc47:: with SMTP id s7mr421569ejv.354.1600707536856; Mon, 21 Sep 2020 09:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707536; cv=none; d=google.com; s=arc-20160816; b=aBdNo4w3/dSAdqmtSOZ7OzX41IBsFi58HeXmO2O+1amrn3SEWx3D4CW3lKyiG0/kPe jqSvl06X6vKVOvf1QgEUXOdjOEhKUkAeOY+BvTMydEJBaD3JpfD1WlXGt7H3FiSDCYzs PTuRJ3LrInRAgkBd1qA8k+AhRSMqGNXo7MT24oGswvjrDk3P3aFq3ZbIKQKMhZb0W0Zm 3S1cu5EE2Kt+hBuJVxuyON5sZn1P5rgaMueSVjcwyUBYho03QjZf5s7N/THlo1lBp18I GudJQdFdY0vfewWxOL+1kpkUYBalQHulfY7yErCBDy+g2xFgnXbLcI4nUK/BbvHVyqf3 sS5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OV2GFo/I0H8j4/lWRkHio/Py8IfL/H3jMhYJggzffaw=; b=z47ljQjE/MfCQjxJwNIhNf2PUTduPuznEvIzxV2Y0I7yoN0nDND6q+G1Wp8o63ghF3 tyOTZjW8+rJDwZlrntqEHN6KCCbPeULlgJ4FEGjnLqaTsnu9nBE1F0iNpHGmZkeH+4Op z7ssxhJx50VQ8m+akcI7iDoyqDUxaqKCyOdii9pl76tLGBx9fx9I51JshOaU2+JFjKZB nIcuHT1AEVC7Qq1jCHAqSI2HRGZ+TvhGQGUiWGdB3n1cDCHsMLzL47IYWY/h75ZdhF7v MJAjAMPN0XtLCHhvmchHuDZ8MOHIEMZ9AaEIAYfDNqjaz+i6puXIrpwnLSV5CoWV1ZqH dgPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ko6zHNIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si8541436eji.301.2020.09.21.09.58.33; Mon, 21 Sep 2020 09:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ko6zHNIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729577AbgIUQnS (ORCPT + 99 others); Mon, 21 Sep 2020 12:43:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:47428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729547AbgIUQnD (ORCPT ); Mon, 21 Sep 2020 12:43:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8F94C235F9; Mon, 21 Sep 2020 16:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706582; bh=Llbw0CYSQemtqBZuEhbhie3lulMzKLoDz/N99EKFMTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ko6zHNIateeDHdbgsypMn/MwwsUZjHOZIiOV5+G+Kes4Jm72PbLSX+aWJEJK7FK/D QOo3F6CFgk1u/ZtrrNYDnUb5oAuStVAYld3MUeWTh/lytKj1B30KqTw/oczTm5O3K1 KvbffyM1x/qWeM857RJoxkLP7K5PoExv32+7Ifxc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roger Quadros , Jan Kiszka , Vinod Koul , Sasha Levin Subject: [PATCH 5.8 011/118] phy: omap-usb2-phy: disable PHY charger detect Date: Mon, 21 Sep 2020 18:27:03 +0200 Message-Id: <20200921162036.849548936@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roger Quadros [ Upstream commit ad7a7acaedcf45071c822b6c983f9c1e084041c9 ] AM654x PG1.0 has a silicon bug that D+ is pulled high after POR, which could cause enumeration failure with some USB hubs. Disabling the USB2_PHY Charger Detect function will put D+ into the normal state. This addresses Silicon Errata: i2075 - "USB2PHY: USB2PHY Charger Detect is Enabled by Default Without VBUS Presence" Signed-off-by: Roger Quadros Tested-by: Jan Kiszka Link: https://lore.kernel.org/r/20200824075127.14902-2-rogerq@ti.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/ti/phy-omap-usb2.c | 47 +++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c index cb2dd3230fa76..507f79d14adb8 100644 --- a/drivers/phy/ti/phy-omap-usb2.c +++ b/drivers/phy/ti/phy-omap-usb2.c @@ -22,10 +22,15 @@ #include #include #include +#include #define USB2PHY_ANA_CONFIG1 0x4c #define USB2PHY_DISCON_BYP_LATCH BIT(31) +#define USB2PHY_CHRG_DET 0x14 +#define USB2PHY_CHRG_DET_USE_CHG_DET_REG BIT(29) +#define USB2PHY_CHRG_DET_DIS_CHG_DET BIT(28) + /* SoC Specific USB2_OTG register definitions */ #define AM654_USB2_OTG_PD BIT(8) #define AM654_USB2_VBUS_DET_EN BIT(5) @@ -43,6 +48,7 @@ #define OMAP_USB2_HAS_START_SRP BIT(0) #define OMAP_USB2_HAS_SET_VBUS BIT(1) #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2) +#define OMAP_USB2_DISABLE_CHRG_DET BIT(3) struct omap_usb { struct usb_phy phy; @@ -236,6 +242,13 @@ static int omap_usb_init(struct phy *x) omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val); } + if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) { + val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET); + val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG | + USB2PHY_CHRG_DET_DIS_CHG_DET; + omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val); + } + return 0; } @@ -329,6 +342,26 @@ static const struct of_device_id omap_usb2_id_table[] = { }; MODULE_DEVICE_TABLE(of, omap_usb2_id_table); +static void omap_usb2_init_errata(struct omap_usb *phy) +{ + static const struct soc_device_attribute am65x_sr10_soc_devices[] = { + { .family = "AM65X", .revision = "SR1.0" }, + { /* sentinel */ } + }; + + /* + * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by + * Default Without VBUS Presence. + * + * AM654x SR1.0 has a silicon bug due to which D+ is pulled high after + * POR, which could cause enumeration failure with some USB hubs. + * Disabling the USB2_PHY Charger Detect function will put D+ + * into the normal state. + */ + if (soc_device_match(am65x_sr10_soc_devices)) + phy->flags |= OMAP_USB2_DISABLE_CHRG_DET; +} + static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; @@ -366,14 +399,14 @@ static int omap_usb2_probe(struct platform_device *pdev) phy->mask = phy_data->mask; phy->power_on = phy_data->power_on; phy->power_off = phy_data->power_off; + phy->flags = phy_data->flags; - if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - phy->phy_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(phy->phy_base)) - return PTR_ERR(phy->phy_base); - phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; - } + omap_usb2_init_errata(phy); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy->phy_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(phy->phy_base)) + return PTR_ERR(phy->phy_base); phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node, "syscon-phy-power"); -- 2.25.1