From patchwork Sat May 2 11:47:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11523827 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FA2F1575 for ; Sat, 2 May 2020 11:49:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C5682137B for ; Sat, 2 May 2020 11:49:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ifaPKoWa"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="d5CPJSeE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C5682137B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7nz5m1k+TWtJrPRpADUzYTepiGWzELZAoVSL5bu0Ky8=; b=ifaPKoWapXfuis f5O9OGqj29MXq4aBNdHT6rfOsHfHnJUxOHqFidfXYGZ3CLQbRjdq22Mp+GzcGUkMhHvaj2aLNLGsW WEamR2qadBPjdAF3Vs1Sv/2lPyeUQSADPxX9/ZKXwmCLyjPNvOjV6/MDisxKPhfNwuWbPwQ0397VU T/mloDWUJgqqUcUX6J1uKKWjBgv7u/QEy86Rhr0xUl7iCpHFmHnid5IPgwJpX8g/ZaNsC/2yD06B0 d5Ju9uh6GvISdIwsLbJy+30fm+dR7YRo27GD7LXd6wkHxAtNOjKuVROwR83VGaOxYj4Vnh7O9HrRo v3tShck/1gcINeY3P0qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUqeI-0000db-RJ; Sat, 02 May 2020 11:49:38 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUqdF-0007eX-OD; Sat, 02 May 2020 11:48:35 +0000 Received: by mail-wr1-x444.google.com with SMTP id s8so4662237wrt.9; Sat, 02 May 2020 04:48:32 -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=QpUpEujYS3y0hvmmOxoZ9pqLQStnivHijsveQ/+4bak=; b=d5CPJSeE3aFq5WtPqTb6wdqcCX9i7DU8YSqB5iEs959ykns7HVLaeyVkCO4mSqi6sE OZ04VLxDQuI9fe5s+73mLcQcR868KB+YDPc1ShQ718L5udF+JjVW6cbW367ebyNMWUYS Z4igW0VfMt28CEGrL25xRyA4DOYzgy4+pzRex1PkQ/s1IeAPgFF28VGNE3iZHiY5oSqM n3L9A2+Sjy87ran5QaMgfcj01DX9AvROhEro0r48FyaZBwR0hvjtdktjIHtdZQjr6Qsg nxz9DM4ot2CMpLSjy936cdLI9D2vWpfkPp/811I2uM7zLce764dCbHkgRGD+I2hw+9qD 7XGQ== 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=QpUpEujYS3y0hvmmOxoZ9pqLQStnivHijsveQ/+4bak=; b=nKRCchNwnepgy/LkaJyrqEDQ0ml5xkw0AB58sSykhLBozW5HLrHAX9CTIWben/OijE QiaI1zZjAN4XURT0j68sgQzUA5nBcnrvhfA9/Cg7l52hvHGjreMiu/YDGmmbMOx6NzF4 6EHpP7MxSN0/qToCVMmIgURnZyweG5Ju0ibnW5dHbUOxzEckIaH/BAmxOOpHeZ2O0zvv 20IPHviMatz+Wu2TKCmU6tmFYWa6Bgpc0+yx9Cv7YZTklUZFL3I7XrukBNdualWZnT38 00bRTRqn9V9lJSJSI/et+dx59vAdZbq8iu2fNO5nY7aUdUNeX8TIpzhZjBVWOu+VB5TS gQlg== X-Gm-Message-State: AGi0PuY+zdoTx4d+hVdPNcIr5uJFKaLwqc6bsEacLwDXP07oQNKjBVD7 D2gJQLmsBSbpTvXwrvyn6Fs= X-Google-Smtp-Source: APiQypLFmVcYXXF7loumlfnuG3OukAXkPJPXAtWSaBqPWtktFqwqCJZzKf9WGy/aDZCb8D/T/7kbeA== X-Received: by 2002:adf:9564:: with SMTP id 91mr9301488wrs.246.1588420111297; Sat, 02 May 2020 04:48:31 -0700 (PDT) Received: from localhost.localdomain (p200300F137142E00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3714:2e00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id s17sm3801599wmc.48.2020.05.02.04.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 May 2020 04:48:30 -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 Subject: [PATCH 4/6] phy: amlogic: meson8b-usb2: Don't set REG_ADP_BC_ACA_ENABLE on Meson8 Date: Sat, 2 May 2020 13:47:50 +0200 Message-Id: <20200502114752.1048500-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200502114752.1048500-1-martin.blumenstingl@googlemail.com> References: <20200502114752.1048500-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200502_044833_788925_CA56E69A X-CRM114-Status: GOOD ( 14.48 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [martin.blumenstingl[at]googlemail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , hexdump0815@googlemail.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, narmstrong@baylibre.com Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.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: hexdump Signed-off-by: Martin Blumenstingl Tested-by: hexdump --- 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);