Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp63620ybk; Tue, 12 May 2020 15:27:40 -0700 (PDT) X-Google-Smtp-Source: APiQypJpKRPlc7KZsCUGyQhP8lmF7guxilE2roPcW7/YDNkfRH7uSfWB+KCTDwW/CwRzQTSfpGkU X-Received: by 2002:a17:906:89a:: with SMTP id n26mr20064965eje.201.1589322459948; Tue, 12 May 2020 15:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589322459; cv=none; d=google.com; s=arc-20160816; b=hahBmJjkIkI5iFgjF24KGY5g2YE8+Xn6T+Js8bHuppx7C9NCZ17gldY3dtL8ebrOwF a6SaAxAVfgUBDJay+CXboW+3tcfcJ1CrSAP7zqe1otdiymSYxZACOVuEoKUC2NbxDY20 xYsEzGhCDv6SPd76YzS2hl9uKFNfF/oM3gIW6Sk2mT0V9m5CIdUGtk2aGmIKCW2b64pA 7PMWGNetZdixM9a8mr5LVV+xi5bU/BuFR0mf+ZuYpQATUrww4MPbQ0yRwFy4BO1TlzP2 dRMmfBVB5PPS0QP1swIlD+8+X3fiL9K5jmr6M4xoxD7a/eoqbDYSdb0UbjiVPk/q23p4 uDlg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uHVRsCOT9MyMisZFgSTwlSLvLYQeGqXXf2R8XWiMUgQ=; b=Hxfe+PUeiE8P9V07xFUqLDXeh+ek92WoyvANOehJkFljSXIm3FpnH2nZyxqLLTgHUD Cr7qRzSLJA36mH/rYbsRu5YivQYEU6ap+ipBz2Jg45o84T751xB0BPBGeKjI3CAv+Aaj D3ZZPG1NwuwWeVjrhQxBHq3t+YZxjQZnqI0bPhwb8bRyeTv3u12Yz18M2KGDbb+lkFsF HF+W2vO3MFErI1whgxX93AjQF3W5GQEF7ODJMagyFuG+sVIPWS5fIT3rqiyZnA0ngZ7H X+jGTfTs4IEFUA1ioe5w0+Py6LHqS70DnMNOOiFzOGmw5oHCkAlfZcJu2FXryeylHWri WIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=l0Q6aaZM; 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=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si8535669edq.470.2020.05.12.15.27.17; Tue, 12 May 2020 15:27: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=@googlemail.com header.s=20161025 header.b=l0Q6aaZM; 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=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732025AbgELWY5 (ORCPT + 99 others); Tue, 12 May 2020 18:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731982AbgELWYk (ORCPT ); Tue, 12 May 2020 18:24:40 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9647C061A0C; Tue, 12 May 2020 15:24:39 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id l18so18023249wrn.6; Tue, 12 May 2020 15:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uHVRsCOT9MyMisZFgSTwlSLvLYQeGqXXf2R8XWiMUgQ=; b=l0Q6aaZMyvU10IB4ybnWRKE3f63txu5zwml68AOPUfCKi3ap27AmbKA2je7xoYYPYX HXgjZdpYg+hbCSgdJKfruqF6k5Lm1VCHZIgR5EJ3KIXSCpY/8ioJwWuAb3OTli6eXFac Y8Aw79TNWRjuNNhDbhMjA7Qmuo3f4RHVaiwY777BVjJfetkNXmOKjCXrBKpaWdaIHYvH l4JyKVPQ9E1veTLB9ocMA30dlNfmUCk2JxRPs6L5E+e7vU6S09OoSz4SN/1133K+exaO 2x3KAiOPgffuEmcEo9Q1yrFlXM+YdaDIc5E1qZQqL65z5oE8Dtmc9sZKCiHpkdi89AZe Y9nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uHVRsCOT9MyMisZFgSTwlSLvLYQeGqXXf2R8XWiMUgQ=; b=Xk6T0jxZwsI/IC1k8NHVfU6i9WI7BlufEnYMVEO3jpvuPvbRc75F3QiQvkq2wgtGL0 mmq+SMufjE7H3ei9NH7K++ddx8Tm/d2g1AvfgULrlsAr1f9A2VwuiRHYeCIohi360tmZ 46ynxiDJ1sTJeakY0Y4rgqEp9Z3ITIoonR/C1lWTWH6w34yl7VP38D63qkszOVztcx+b MfyISFXWMQJPSE9sgayVMWwQ7iZrZI/jJOzbR3lvJBg1QM6/E6IUOD9wHzwgeq5CbJRO +PLTi0ABhbjifaM85Y/0IGSM5yCrjWVQpAFLKpdN+AiI3JnZ0ZdkDYmFlo0f0y2s8y6G fiVA== X-Gm-Message-State: AGi0PubBk2FVdZ+37eAE4gHS2TRivp1u21LADhkwqRArMOxgQanJbtFm VJPwci9wp2mK4kKbfu86vww= X-Received: by 2002:adf:c38c:: with SMTP id p12mr28947458wrf.357.1589322278537; Tue, 12 May 2020 15:24:38 -0700 (PDT) Received: from localhost.localdomain (p200300F137132E00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3713:2e00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id b2sm21758758wrm.30.2020.05.12.15.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 15:24:37 -0700 (PDT) From: Martin Blumenstingl To: kishon@ti.com, robh+dt@kernel.org, vkoul@kernel.org, devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org Cc: narmstrong@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, hexdump0815@googlemail.com, Martin Blumenstingl , Thomas Graichen Subject: [PATCH v2 4/6] phy: amlogic: meson8b-usb2: Don't set REG_ADP_BC_ACA_ENABLE on Meson8 Date: Wed, 13 May 2020 00:24:22 +0200 Message-Id: <20200512222424.549351-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512222424.549351-1-martin.blumenstingl@googlemail.com> References: <20200512222424.549351-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Skip setting REG_ADP_BC_ACA_ENABLE on Meson8 SoCs and polling for the REG_ADP_BC_ACA_PIN_FLOAT bit. The vendor also skips this part on Meson8 SoCs. This fixes initialization of the host-only USB PHY on Meson8 which would otherwise fail with "USB ID detect failed!". Fixes: 4a3449d1a0a10c ("phy: meson8b-usb2: add support for the USB PHY on Meson8 SoCs") Reported-by: Thomas Graichen Tested-by: Thomas Graichen Signed-off-by: Martin Blumenstingl --- drivers/phy/amlogic/phy-meson8b-usb2.c | 48 ++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 86824cc21f11..7236b8885f07 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -105,12 +106,17 @@ #define RESET_COMPLETE_TIME 500 #define ACA_ENABLE_COMPLETE_TIME 50 +struct phy_meson8b_usb2_match_data { + bool host_enable_aca; +}; + struct phy_meson8b_usb2_priv { - struct regmap *regmap; - enum usb_dr_mode dr_mode; - struct clk *clk_usb_general; - struct clk *clk_usb; - struct reset_control *reset; + struct regmap *regmap; + enum usb_dr_mode dr_mode; + struct clk *clk_usb_general; + struct clk *clk_usb; + struct reset_control *reset; + const struct phy_meson8b_usb2_match_data *match; }; static const struct regmap_config phy_meson8b_usb2_regmap_conf = { @@ -166,7 +172,8 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, REG_CTRL_SOF_TOGGLE_OUT); - if (priv->dr_mode == USB_DR_MODE_HOST) { + if (priv->dr_mode == USB_DR_MODE_HOST && + priv->match->host_enable_aca) { regmap_update_bits(priv->regmap, REG_ADP_BC, REG_ADP_BC_ACA_ENABLE, REG_ADP_BC_ACA_ENABLE); @@ -216,6 +223,10 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); + priv->match = device_get_match_data(&pdev->dev); + if (!priv->match) + return -ENODEV; + priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, &phy_meson8b_usb2_regmap_conf); if (IS_ERR(priv->regmap)) @@ -254,11 +265,28 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) return PTR_ERR_OR_ZERO(phy_provider); } +static const struct phy_meson8b_usb2_match_data phy_meson8_usb2_match_data = { + .host_enable_aca = false, +}; + +static const struct phy_meson8b_usb2_match_data phy_meson8b_usb2_match_data = { + .host_enable_aca = true, +}; + static const struct of_device_id phy_meson8b_usb2_of_match[] = { - { .compatible = "amlogic,meson8-usb2-phy", }, - { .compatible = "amlogic,meson8b-usb2-phy", }, - { .compatible = "amlogic,meson-gxbb-usb2-phy", }, - { }, + { + .compatible = "amlogic,meson8-usb2-phy", + .data = &phy_meson8_usb2_match_data + }, + { + .compatible = "amlogic,meson8b-usb2-phy", + .data = &phy_meson8b_usb2_match_data + }, + { + .compatible = "amlogic,meson-gxbb-usb2-phy", + .data = &phy_meson8b_usb2_match_data + }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, phy_meson8b_usb2_of_match); -- 2.26.2