Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp507702pxa; Wed, 19 Aug 2020 07:30:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJcDeWudujJwy/rLissCBaFDyKw8uhogqO1NB9MoCn+I0kLy0St1YgEfctZg9mU9N5eJnK X-Received: by 2002:a17:906:819:: with SMTP id e25mr26430751ejd.95.1597847439153; Wed, 19 Aug 2020 07:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597847439; cv=none; d=google.com; s=arc-20160816; b=szRcdI0cyKg3wSkMHScd9vTmV/Dw7vxoCa1/EJ5UdvTYNlCvsnCBmI4JOCZo1QaNV1 VNM0TWn9eLWPZHpaJkqulfceFva3LLHsJBmRp35RZY6p4drtzw3H3n9casWKoRHH4R4L vWGUYfOioOufPW2x/mmbbqGi6eFsJsn9Z8B2o1QEqIPna0bl3XGBY4vLcRoaWxJTl+GQ Hn3GIm0J1G7qCwMU6qa/bw2udlOtJ8gvEIIMzD1H8GxdZauhG1DZkVpxZg8DhlpTwKyp EIEYEIkB+eZWi6T5YY2kdRDQkMwVTGw9ve68pNZoMxnzQyNqKtx9CP1IJdXAWxWJ0OWY EMmA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=otgbGWwb3UhDFUjBDSNCt0tc9BFNVg6jezhPK5rBtvs=; b=UbgRhOoXH29SzHbEQpqIDq0NE7EaaFaWAh54GCZAcZh8hwICpiVFRJ+fV+51QryidT cYYVe+A1+HwnPs6EkWUBlbezg3OFdIXv34m1Jb9z7gOgYK+naCM6vF/YdWZpjurTjjFM VZ49N8HFzQjTBn1/MLXExJ9VZ71Cqf/arhjW+IEJN3s9qhcLHAjb2f0Mxw0k8O5WoX40 Fbg+5054HVKbssB/YsTV+nhGF+nlHV2Z3o8JC+D0TvEA4yfDr3j2tKekrBYGSB+dm3Bq cbyLsj6DK6CsMXgm/6Y1TWnwpS546ox/qEMZxk2WCrSO4Phu6d2EZ2HP03J0SezKmSHo LxSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rj+vboY7; 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 a7si15662288ejd.422.2020.08.19.07.30.13; Wed, 19 Aug 2020 07:30:39 -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=rj+vboY7; 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 S1728549AbgHSO3L (ORCPT + 99 others); Wed, 19 Aug 2020 10:29:11 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:58488 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbgHSO3F (ORCPT ); Wed, 19 Aug 2020 10:29:05 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 07JESq9h061954; Wed, 19 Aug 2020 09:28:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1597847332; bh=otgbGWwb3UhDFUjBDSNCt0tc9BFNVg6jezhPK5rBtvs=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=rj+vboY7Qk7a04Sc54mBzQhcy5l/J3ufrpLb99EZBcmpseX5MONXa8RgO/nWlCwAc BmYw92X0OYMOihS9jV3XBqnSvWWMTQFEhctL6o5s015eh08HG7f+MLcLxvQlcoWKIr UD9m4Ng1Ndx5+JZYcQIgS2o5/ayL1Q3E1A80qnfc= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07JESqBp068440; Wed, 19 Aug 2020 09:28:52 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 19 Aug 2020 09:28:52 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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 via Frontend Transport; Wed, 19 Aug 2020 09:28:52 -0500 Received: from [192.168.2.14] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07JESoYv050647; Wed, 19 Aug 2020 09:28:50 -0500 Subject: Re: [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect To: Jan Kiszka , CC: , , , , , Bin Liu References: <20200716082252.21266-1-rogerq@ti.com> <20200716082252.21266-4-rogerq@ti.com> From: Roger Quadros Message-ID: <5961c75e-f0a5-6493-7d4a-7113ebea14dc@ti.com> Date: Wed, 19 Aug 2020 17:28:49 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 19/08/2020 12:02, Jan Kiszka wrote: > On 16.07.20 10:22, Roger Quadros wrote: >> 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)) { >> > > Why a property, rather than SoC detection like in [1] and your previous > downstream version? I agree, that SoC detection is better way. Will spin a v5. > > Jan > > [1] https://patchwork.kernel.org/patch/11710643/ > cheers, -roger -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki