Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1046490ybh; Thu, 16 Jul 2020 01:24:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB/JLfZ4YDSxH31Yt0VTkSo1orrMwV5u2QEa6y7e3AHhU1dqZSVZoZnkOUAGxLtpLd2Slw X-Received: by 2002:aa7:cf82:: with SMTP id z2mr3207429edx.15.1594887853501; Thu, 16 Jul 2020 01:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594887853; cv=none; d=google.com; s=arc-20160816; b=rxLIQNG00bTdZCjYV+onT54BkE8AebwN0Xz8stWjepqjt3+6/MftrAHSL1OwDlyni0 3S9Wpsq1+ZSMma6+ugL8r3/rQJGkr8QJywaYjg00SoPlqHymSxmeb9Hud1iHN00O0NN6 TpLe9HrQ1R1oTpSkJ3S9/rw/Iai4jrIQMGfPgE6CDIWMCra1e1R/kH+aPp3uUhVk6XZa l9my/DIzhiXXh5Vsi0N/xmVx1o2cdES1OE3hgOtOa2h0zTQxlpaZEb8YBpAxN5FHSZ+P PgP0B0hg37lXmGBzYXPQMclsUokXzd70/e9syG6r2WSvTBTZv/RwkNElaK75sCydCneA JuLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=gtnBfikQgeKFXoCbSTClfcF4fEw+NTU1+ewwsYoy6H0=; b=lrgQj583tkuVLuaXWbFtRi8vJwM/G6qAiIOCejAuWRGmW9aeAJVs87OpgXHsoe1+rc xE4C8Flay0j0QWieuO8B6XIYMcrTe9qv9SK6eFb7QRifpmxKpOPFEcLEDPWO7kh1IKwX DqyDlzG0oVFxNl99VT68lriEyW/Sj8u6XokIiZrbqS4EYmLcf5ZqjXyPQY9IdsgDVJ4h qsGsotIm78oq3ihQNPeqZAsVUl8PxWyA5Jl+Dj0Gtc1MAwWTsQr9du29LQgT9zLZVqL1 BGP8WDT9olAn/mW56OfJGH7tOT8wOH9i/KdoYeHjAFXukFRqx48k6IiZT7w7rmwO0kzz IjyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MfRAQMC7; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz15si2716537ejb.406.2020.07.16.01.23.49; Thu, 16 Jul 2020 01:24:13 -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=@ti.com header.s=ti-com-17Q1 header.b=MfRAQMC7; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727019AbgGPIXJ (ORCPT + 99 others); Thu, 16 Jul 2020 04:23:09 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:47892 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbgGPIXE (ORCPT ); Thu, 16 Jul 2020 04:23:04 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06G8N2PO029530; Thu, 16 Jul 2020 03:23:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594887782; bh=gtnBfikQgeKFXoCbSTClfcF4fEw+NTU1+ewwsYoy6H0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MfRAQMC7cLo6QMzIfOTUq2atXAB3dkir5Y9Kyd07eL1pnM+WyP9ILAvvjyA9rxAcn 2ZE68FT1f52UC9KzgDvjWPjFfKIcQQr8Tp+ErxV6/Ghn5t/jUyoPBVf47KKzwZB1so CUW3ynRcEohBTtGeKm+/ET8baZG9YgLrbuA0PpEA= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06G8N2eu009479 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Jul 2020 03:23:02 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 16 Jul 2020 03:23:02 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 16 Jul 2020 03:23:02 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06G8MrSI049495; Thu, 16 Jul 2020 03:23:00 -0500 From: Roger Quadros To: CC: , , , , , Roger Quadros , Bin Liu Subject: [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect Date: Thu, 16 Jul 2020 11:22:52 +0300 Message-ID: <20200716082252.21266-4-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200716082252.21266-1-rogerq@ti.com> References: <20200716082252.21266-1-rogerq@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Using property "ti,disable-charger-det" in the DT usb2-phy node to enable this workaround for AM654x PG1.0. This addresses Silicon Errata: i2075 - "USB2PHY: USB2PHY Charger Detect is Enabled by Default Without VBUS Presence" Signed-off-by: Bin Liu Signed-off-by: Sekhar Nori Signed-off-by: Roger Quadros --- drivers/phy/ti/phy-omap-usb2.c | 35 +++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c index cb2dd3230fa7..21c3904d4efc 100644 --- a/drivers/phy/ti/phy-omap-usb2.c +++ b/drivers/phy/ti/phy-omap-usb2.c @@ -26,6 +26,10 @@ #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 +47,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 +241,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; } @@ -366,14 +378,12 @@ 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; - } + 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"); @@ -405,6 +415,17 @@ static int omap_usb2_probe(struct platform_device *pdev) } } + /* + * 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 (of_property_read_bool(node, "ti,disable-charger-det")) + phy->flags |= OMAP_USB2_DISABLE_CHRG_DET; phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); if (IS_ERR(phy->wkupclk)) { -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki