Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1254468pxa; Thu, 20 Aug 2020 06:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB5RXf4lvcEK3CGlwHlk7nbKDtjxkXJWuoplXczKRhT/2BFMHwNhB4r1vlr0wSw35CYRn4 X-Received: by 2002:aa7:cd76:: with SMTP id ca22mr2962532edb.42.1597931552029; Thu, 20 Aug 2020 06:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931552; cv=none; d=google.com; s=arc-20160816; b=bd6zGFx9xz2G8TRnJm08QxsR/3xKMXB0qG1Tl30jbjyoz6ECyyz/svlhmZSUDx5Zz7 t2Bi8VUYsUGLv4nktWSOqZoai6P8vb8/EzU5z62jluQxoEMduJqJV77NQ7aTWbevUuNi C0JcsmlTphFbbB+5LZdrU+cVmKr/js0RUM1FBtwupmFwwD8G2txNos1Q1fznQo8rR1xc ffZmpOggDO8jApBU8WwlkG8aEV42ubkOFuVJyMt4vpyw4Zr+MtNicOIno+9btOopEoeE yE6G6OK0rJhCBSsTmDFVeRmjQWdyuIVAHIffFNzzapAkjLKXXSpjE9C0+ZlG2Bozu4ls xDhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=CreWDlx2qw1gxWkE6+yRLtN1h0tYFQe3WNDbGnsvsrA=; b=YWobner1Cbcckpzm+fAi97jY0aDO9FxBOAITNq2OcSHacTw4Ysqzeiu0WtkgkPLi67 612DmkY+yDOW15iFMo9qTxgLPl+eRjLNDGvhvnl0upWT9Zy/trwWeIISJajBxU7Pv7y7 n2+6CuvD69AQsObb1i3eF6ncQiuEiZwJ2GioNjxe4JUYBpf0L3kgvKshWcYUyGgeje01 i+hPvIkrmU70/NJFoGGpOWIgpfy39uD8CEP/4xX5OnM8JWNpGPpORgScT++Mzxo4G8oP k7Z0zFZ9+v8M046tFA9vUAcwNTOyRguDlBvKoxIYori9CHuHMcGEC2cSHCwuJUX9ecSZ Dimg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EzF0matl; 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 e7si1468606ejm.580.2020.08.20.06.52.06; Thu, 20 Aug 2020 06:52:32 -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=EzF0matl; 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 S1728879AbgHTNsc (ORCPT + 99 others); Thu, 20 Aug 2020 09:48:32 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:49530 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729889AbgHTNjq (ORCPT ); Thu, 20 Aug 2020 09:39:46 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 07KDdfPe064937; Thu, 20 Aug 2020 08:39:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1597930781; bh=CreWDlx2qw1gxWkE6+yRLtN1h0tYFQe3WNDbGnsvsrA=; h=From:To:CC:Subject:Date; b=EzF0matl3w/Tupsws9Qb4Wiy9di0m/4OgyYS1J/sXucf1N8CZOkDK7uH0P7TDehTS vCVE9+Z35nDC6n10erou66E+AsH0LU4DSxUg5UbjtXmMuhNR5UuY8Y1lUzOGSuPXlb YFwTNPFHeeN3S5W20TaVIwfk6buP0i2Vk+IG45Oo= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 07KDdfQk067556 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Aug 2020 08:39:41 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 20 Aug 2020 08:39:41 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE106.ent.ti.com (157.170.170.36) 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, 20 Aug 2020 08:39:40 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07KDddxj087926; Thu, 20 Aug 2020 08:39:39 -0500 From: Roger Quadros To: CC: , , , , Roger Quadros Subject: [PATCH v5] phy: omap-usb2-phy: disable PHY charger detect Date: Thu, 20 Aug 2020 16:39:37 +0300 Message-ID: <20200820133937.32504-1-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 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. This addresses Silicon Errata: i2075 - "USB2PHY: USB2PHY Charger Detect is Enabled by Default Without VBUS Presence" Signed-off-by: Roger Quadros --- Changelog: v5 - don't use dt property to enable workaround. Use soc_device_match() instead. v4 - fix example to fix dt_binding_check warnings - '#phy-cells' -> "#phy-cells" - Add 'oneOf' to compatible logic to allow just "ti,omap-usb2" as valid v3 - Removed quotes from compatibles - changed property to "ti,disable-charger-det" v2 - Address Rob's comments on YAML schema. drivers/phy/ti/phy-omap-usb2.c | 70 +++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c index cb2dd3230fa7..65d73142d4ec 100644 --- a/drivers/phy/ti/phy-omap-usb2.c +++ b/drivers/phy/ti/phy-omap-usb2.c @@ -6,26 +6,31 @@ * Author: Kishon Vijay Abraham I */ -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include +#include +#include +#include +#include +#include +#include #include +#include #include -#include +#include +#include #include -#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"); @@ -405,7 +438,6 @@ static int omap_usb2_probe(struct platform_device *pdev) } } - phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); if (IS_ERR(phy->wkupclk)) { if (PTR_ERR(phy->wkupclk) == -EPROBE_DEFER) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki