From patchwork Thu Jun 17 19:41:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13F47C2B9F4 for ; Thu, 17 Jun 2021 19:45:17 +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 C82746113E for ; Thu, 17 Jun 2021 19:45:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C82746113E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qkEq+HgfM3XDJ8GF06q/iKM1ZqRZccEorKDg6qo1bew=; b=G1rBWx3tvUxK94 fRgw1jZd/6rShUGnJhUsnKcNWko6vkALvkIRgIvr2Y5aVxPTHMmhTDS72Vf3CIZqbGrGz3FnGTBj1 KBPG63WjzwcjvRfgHx051KQrd8vHhyfqKktbVb4tHqUePBLVsBkerEo/L61ZpmbmFL0nkwgUnC0rY VKzzLIEBi3B2u1twjA3d83nUeRBqnxHhIL19BjHmJA+gf2SvBl4T8WfmC42k1YTOOQrSO3+ZFfdnj ycm0uOYrHBHH6a1JT162JGnCuGZFe2Ms5vN/7zWbZPal78ZTJRuloIAl9sZ9+WRZPkCquYCYuyrjX e0nLGnWpZwEHMyYQTQfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxuk-00BaAh-5d; Thu, 17 Jun 2021 19:42:58 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxug-00Ba9V-Bl; Thu, 17 Jun 2021 19:42:55 +0000 Received: by mail-pf1-x430.google.com with SMTP id k6so5822516pfk.12; Thu, 17 Jun 2021 12:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9HgQ9eAiW96/ovGrHzecsI1VfEM+0/YBZu4OcH2CPvU=; b=IDSWM3vrjvw7MeiWIr15DCD+wCW8pjSkdRreLc5MeLbze+tu8Nh8QKvgpZssU2jVh+ EMQCfONigNWK4SDSJ/Hw4tHIUeJBc9nrRMdXQo22qr2+R+URmi6vb6T/1TOssz/c/3IK eS5oGDLvCKwpthgHfrcJj4g0SKG5ZZRClREimHO1848jnbGediRxvFf61qDukJXFpd1h SzBCWnmdPDWqQo+KA1dJBHSG6GUv7To0iQ8M2XI0kWZhmbHCuLU2u8Qt+kMsKhGPdyWn Dg7Dn+CNiwz/MxDpXDkKaL2AGon9BTny6fi0WRb+pWbR6spNHihtCmD4S79nIpyFoZA+ 0ceg== 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=9HgQ9eAiW96/ovGrHzecsI1VfEM+0/YBZu4OcH2CPvU=; b=ZCBnR8AbB1hoFEM+vp2hRYWgZZsAIhDoSfXw8pP2CctdCQmCiZaZBJt3ZAtCtlsET9 keTY10OANIgtB6/T5dwKkZim2CaZAD8KpJQa0YWpmmU4LAs6q9SVbzS4Z43iPqjoku1U ui9Z9Kla15qYpezwvDAfwihoW9HDOHSXgF7ISwVsVUzSkSSp0p/yinXnZi2y8WrvSHqZ pU3/JLxMl+DK/QkM6oyxmFYs1hF215J9HUhOv+Gc1efguOza790rWDPHhBfwlwCq4S7/ 7sOGzyMC/eFK4ldReQjkl/bNNLVU58Klk2iCs65ic9Ebn+E4OPtnA0FuW06XU3UkvltN hT3w== X-Gm-Message-State: AOAM531nuq85986cHz0hlWOoDF7wHCenWHrRV1VwXW6d4wUoFyxBe7rU P+J++jyFc/vqf8pCb6eSiUVyJh2Qwz4= X-Google-Smtp-Source: ABdhPJx5ZIxR9ySXUG7SX502EB68UiuFkiJPUuTxkOHSdD37m0SDC1zBokNef3WrEmJMyPMDImpLdw== X-Received: by 2002:a63:5360:: with SMTP id t32mr6385187pgl.192.1623958973053; Thu, 17 Jun 2021 12:42:53 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:42:52 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 1/8] phy: amlogic: meson8b-usb2: Use clock bulk to get clocks for phy Date: Thu, 17 Jun 2021 19:41:36 +0000 Message-Id: <20210617194154.2397-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124254_448064_8A55C8F0 X-CRM114-Status: GOOD ( 15.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use clock bulk helpers to get/enable/disable clocks, it will be easier to handle clocks. No functional change intended. Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 03c061dd5f0d..771b73f3b44e 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -121,11 +121,16 @@ struct phy_meson8b_usb2_match_data { bool host_enable_aca; }; +static const char * const meson_phy_clks[] = { + "usb_general", + "usb", +}; + struct phy_meson8b_usb2_priv { struct regmap *regmap; enum usb_dr_mode dr_mode; - struct clk *clk_usb_general; - struct clk *clk_usb; + int num_clks; + struct clk_bulk_data *clks; struct reset_control *reset; const struct phy_meson8b_usb2_match_data *match; }; @@ -151,16 +156,9 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) } } - ret = clk_prepare_enable(priv->clk_usb_general); + ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks); if (ret) { - dev_err(&phy->dev, "Failed to enable USB general clock\n"); - return ret; - } - - ret = clk_prepare_enable(priv->clk_usb); - if (ret) { - dev_err(&phy->dev, "Failed to enable USB DDR clock\n"); - clk_disable_unprepare(priv->clk_usb_general); + dev_err(&phy->dev, "Failed to enable USB clock\n"); return ret; } @@ -197,8 +195,7 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) regmap_read(priv->regmap, REG_ADP_BC, ®); if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { dev_warn(&phy->dev, "USB ID detect failed!\n"); - clk_disable_unprepare(priv->clk_usb); - clk_disable_unprepare(priv->clk_usb_general); + clk_bulk_disable_unprepare(priv->num_clks, priv->clks); return -EINVAL; } } @@ -216,8 +213,7 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) REG_DBG_UART_SET_IDDQ, REG_DBG_UART_SET_IDDQ); - clk_disable_unprepare(priv->clk_usb); - clk_disable_unprepare(priv->clk_usb_general); + clk_bulk_disable_unprepare(priv->num_clks, priv->clks); return 0; } @@ -234,6 +230,7 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) struct phy *phy; struct phy_provider *phy_provider; void __iomem *base; + int i, ret; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -252,13 +249,18 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); - priv->clk_usb_general = devm_clk_get(&pdev->dev, "usb_general"); - if (IS_ERR(priv->clk_usb_general)) - return PTR_ERR(priv->clk_usb_general); + priv->num_clks = ARRAY_SIZE(meson_phy_clks); + priv->clks = devm_kcalloc(&pdev->dev, priv->num_clks, + sizeof(*priv->clks), GFP_KERNEL); + if (!priv->clks) + return -ENOMEM; + + for (i = 0; i < priv->num_clks; i++) + priv->clks[i].id = meson_phy_clks[i]; - priv->clk_usb = devm_clk_get(&pdev->dev, "usb"); - if (IS_ERR(priv->clk_usb)) - return PTR_ERR(priv->clk_usb); + ret = devm_clk_bulk_get(&pdev->dev, priv->num_clks, priv->clks); + if (ret) + return ret; priv->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL); if (PTR_ERR(priv->reset) == -EPROBE_DEFER) From patchwork Thu Jun 17 19:41:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23D63C48BE5 for ; Thu, 17 Jun 2021 19:45:29 +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 CBBC26113E for ; Thu, 17 Jun 2021 19:45:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBBC26113E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2qh3tO3VadqvBgsuHW6wpb6vudJeFyljOVVckjoaXx0=; b=t9uWLd4KymFSuz m4k5GOkTxzZ55amh8hjF3jvQN/WLK6ci2kqDEsH0G/By7iUYK8ykwd8gbYgqS0bbCNf88zGhm0K4n 6Rll9HzZoIAzzkZvUia6+5TFmQgxV11RzPOV132m4goQtdeXEG+CYy2lL8kub03Embh5xUTC5i8eA 6+26pgUMSvd384nd4JOCB7rY6e5yqTQhPZE2npMI8aZyEox6OXU8dJtl3SdtiNf1VQX10QQYoj+R5 o7VNpH4/2EO/KdxzA7Bb0aPWSFtGngEtQCOhknlraeXVfu0xxZvteYyMgQ/Ur7h3yBuGQFHYWq5d/ wpISBWzf8qu2SDvSfunA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxv2-00BaGn-NL; Thu, 17 Jun 2021 19:43:16 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxux-00BaED-4w; Thu, 17 Jun 2021 19:43:12 +0000 Received: by mail-pf1-x436.google.com with SMTP id h12so5872716pfe.2; Thu, 17 Jun 2021 12:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tzl7V45UMyttxYvjiG/RGthazfovWqPJvvGzwmVDhlo=; b=nX6c2e296ygCF1xZbasjThl+i6Ji+L2S4BwRH6Yqu5GAayLfXb/+7noHwKrOBgUhT9 eg2K8QQKUCQtGI30BQjNCvkson1PiNZIydbEt4cn3X0jb3cSPVKu8RtW23Ga/do6cx8l s/i584YLWZFfY2swVuF0bgfLDDTAJDioZtSyV46rFruBtv95EFO/v26qprrx+naHMg6M lFwo2KSs4Ir8cAEpHhXJCuHOCzDuFlXqVr9mSZov9TiqBb9CS8s88/2qQbksE+oNykis D1BoDJgcAA4aFeSifOrKf3dxz8Zh9NnbDwFhbyRFV++z4+dmK99df1yl1LRUFxVEsCG/ UX4g== 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=Tzl7V45UMyttxYvjiG/RGthazfovWqPJvvGzwmVDhlo=; b=IzchLielSxoYineBwHkkNDTp5HzfbYZ3lDACYTO49MwtnYWZ9EdOtkVdfqGhZetCk5 rxrOAE+GIAfPtBjYKPN78ph1GP+bLhBEwj30TCCtSveekW2l/TlkH/JyV+HB5tJXOjyN OlR9ElvJ3nE+yKIJs8vnJ+KzrdnUWlnzRCj5Fc08F0N2Kbysw7z+WJNWecSKIbVBCOho uG/Horw2GsvCILVOIf+Xra7tu8KBoaxivo+QF11f+iTaFU+ZBdkdcTfSqDt5PAvNmstB dOU1pk1zZhOV4l3ObcuAsdslnO2GIA04zods8Ku/c5F5ZTKPuH8i4/FBYSnrg64KfmWA P8hw== X-Gm-Message-State: AOAM530xXFc4UDO/ajDxIP59JQKncIw7uJlU2VxVq5VHHGxBHgib4V3F FSPmknOk7mzokMmdlFbbbB0+voknQxk= X-Google-Smtp-Source: ABdhPJzSDzSC/y7Al0PHl13B+aX97fg7FS5mmLZ0StkNpzHKaEaV2uuutbLzj6Fs44BbtxcdaNvEGQ== X-Received: by 2002:aa7:8587:0:b029:2f8:8439:c265 with SMTP id w7-20020aa785870000b02902f88439c265mr1528450pfn.38.1623958989932; Thu, 17 Jun 2021 12:43:09 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:43:09 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 2/8] phy: amlogic: meson8b-usb2: Use phy init callback function Date: Thu, 17 Jun 2021 19:41:37 +0000 Message-Id: <20210617194154.2397-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124311_239573_207CA72A X-CRM114-Status: GOOD ( 11.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reorder the code for bulk clk_enable into .init callback function. Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 771b73f3b44e..d48171b0b32e 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -142,10 +142,9 @@ static const struct regmap_config phy_meson8b_usb2_regmap_conf = { .max_register = REG_TUNE, }; -static int phy_meson8b_usb2_power_on(struct phy *phy) +static int phy_meson8b_usb2_init(struct phy *phy) { struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); - u32 reg; int ret; if (!IS_ERR_OR_NULL(priv->reset)) { @@ -162,6 +161,14 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) return ret; } + return 0; +} + +static int phy_meson8b_usb2_power_on(struct phy *phy) +{ + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + u32 reg; + regmap_update_bits(priv->regmap, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, REG_CONFIG_CLK_32k_ALTSEL); @@ -219,6 +226,7 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) } static const struct phy_ops phy_meson8b_usb2_ops = { + .init = phy_meson8b_usb2_init, .power_on = phy_meson8b_usb2_power_on, .power_off = phy_meson8b_usb2_power_off, .owner = THIS_MODULE, From patchwork Thu Jun 17 19:41:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F39C2B9F4 for ; Thu, 17 Jun 2021 19:45:28 +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 7A220613D5 for ; Thu, 17 Jun 2021 19:45:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A220613D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s5GdF+KxhEIfZCKK+04AlrIxmLTV7HVSKtYn0383gX0=; b=WeUCYprMW4gN2O 1Vh7JpcjgTGJwMnCrMBq5HjVc+mjtUfUTJVwRLiYXdweIvgJXV87sFElBgNbiBbIrBkUwP1rOOItw wkM02Vt6ysOyJnIsDCzOQikKba2uJTxOFk1pzN3vwrKiQ8sAhOBhqC1hmeaULEIHZPqLx3WM9ltRN kN5IZVEZeDNtsypUySZhhnDNEueTOfu7jWqRRNfwYZldpcfLN48ee/nodbTXCniPYKoX57tyM4UXZ 4KI0MzZaqg2kqOWL41aIGHLcfEKcdWDmYJJzoNUXpejucZoHTThF94lYFDCED8C/rg1Z7CyUpxZ+R iw2UNrp1mXuqzMog0XXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvK-00BaPD-Sn; Thu, 17 Jun 2021 19:43:35 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvE-00BaMZ-0p; Thu, 17 Jun 2021 19:43:29 +0000 Received: by mail-pl1-x62b.google.com with SMTP id o21so3483858pll.6; Thu, 17 Jun 2021 12:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IphS2NfYy5YZOfBpgQZDF/SMsovEiyi9nwsRO6kEmeA=; b=W/pVQVs4NBXtAYB44k2FtP7IHprt6d6EQ3dpcGJzbORkjzsTXC497kYd5Ph5SvW7On AQOK39Cn16MWTOGPzVp1O2FYev8QYj+EfmqZlnkpPvMw068YdCfdq58EssXhzPIrWn3l YTmqO05Yn3QKdXQAj5ntx2kInNGvcqNCv1vLDE3VhahwWsHblJqjx90cDlqI6EqjTtrG 3/KMyZvPalXzJF0rmMjIdJX326IspxknvB45A0NbzN0VdXGDk3UK1+gSo54j5jTmKKjK VgMBkuh0vBvr4g48oU8cQfNbbPovAzJ5E9Qe4New5O8l17FRfuCHWAfDXp1TXNvfo5ma aUeg== 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=IphS2NfYy5YZOfBpgQZDF/SMsovEiyi9nwsRO6kEmeA=; b=slsh7RExkTFLCluAT6DUdvsz+gxnpd1zfA7Z/MZlm4foi4BYyDoQ+gJYv372r4YC+8 dsgFvF6yyf6Qd8QJIG5z0ToWCrjA0XW2jhFR8KAHaPo081O+QXFG2pAl/MDQKLiFqXvx ZknU5oLZW2//Gako6V+kOBFXcKPw0ymRAOZKTzNX7YaKG+XX/5aAdRmke6m/FirbbYmu /LbM2NypmriuzFiusf1/v4zrEaIi748J0FaXWJvpZOgjxdPz6D1WCK1B6hlvf/0DeeFM 3DBFjSv2WM7TDBeFYbTd+603LF3kJqCZkwubpcDq3s5zniubHtLBSIGwqmiDVG6L6HoX BU6A== X-Gm-Message-State: AOAM531SSNd+Akd2PNuDwt985Z5JV0SQEp0/bXnokwQSJe5iO0bp00xl GGumKnxLkuzpOLZycz3sjQ3y3IjynZQ= X-Google-Smtp-Source: ABdhPJwx8ZB3IeQr09msM778ELNHTToq+Qc73hhIl+bWtjosPtRLzG8166FGLfKwgITZ18ya2OFIXQ== X-Received: by 2002:a17:90a:5795:: with SMTP id g21mr6988218pji.235.1623959006613; Thu, 17 Jun 2021 12:43:26 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:43:26 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 3/8] phy: amlogic: meson8b-usb2: Use phy exit callback function Date: Thu, 17 Jun 2021 19:41:38 +0000 Message-Id: <20210617194154.2397-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124328_086870_03A8E8C3 X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reorder the code for phy bulkclk disable in .exit callback function. Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index d48171b0b32e..2b32a3eabccf 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -164,6 +164,15 @@ static int phy_meson8b_usb2_init(struct phy *phy) return 0; } +static int phy_meson8b_usb2_exit(struct phy *phy) +{ + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + + clk_bulk_disable_unprepare(priv->num_clks, priv->clks); + + return 0; +} + static int phy_meson8b_usb2_power_on(struct phy *phy) { struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); @@ -220,13 +229,13 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) REG_DBG_UART_SET_IDDQ, REG_DBG_UART_SET_IDDQ); - clk_bulk_disable_unprepare(priv->num_clks, priv->clks); return 0; } static const struct phy_ops phy_meson8b_usb2_ops = { .init = phy_meson8b_usb2_init, + .exit = phy_meson8b_usb2_exit, .power_on = phy_meson8b_usb2_power_on, .power_off = phy_meson8b_usb2_power_off, .owner = THIS_MODULE, From patchwork Thu Jun 17 19:41:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F620C2B9F4 for ; Thu, 17 Jun 2021 19:45:45 +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 D1C426113E for ; Thu, 17 Jun 2021 19:45:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1C426113E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P9/UKLM1BfkpmNUd3Vp3nGqtq8QtjaLmfO1ufmpEI9s=; b=u2z5BXctyHFwtF zKS1P8Fo+kRazHr5RHmQpf04WaWG9RVv1J116ZjHcSrfMEuUbCWJpEPBq/NfQrjMaFrMMAOW8bAwy 1k7ZjAVCjxnu4v4iLOF+FFw/S+UbLiInRWI/XbEUQzWqoamxDV0wHsL4kqMLegn8N9fQZqvdjufcS a3ghfYR3/tyD0qLa8Y1U8AiMMOJipqtBUhyiH/rShypc/MPGyqsuHzFbibsLoUUpwDo4C7DDULx6J 057/SGSKGM3v5UTujM/0UqgBHz09DfBG9Smo+V0trphWGXM3Vuz1jL3wLHidGhrtjUWnj5PNzb2wS 7uOnxxuoK70tg19RB5yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvg-00Baa8-BJ; Thu, 17 Jun 2021 19:43:56 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvX-00BaVS-Qt; Thu, 17 Jun 2021 19:43:49 +0000 Received: by mail-pj1-x1036.google.com with SMTP id k22-20020a17090aef16b0290163512accedso5986788pjz.0; Thu, 17 Jun 2021 12:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ru7VYZQFM1VVEN15+QmGHBxSNzsOgYyzaqlXuO2dVxw=; b=Lw7iEBZ4GD3k2g+fSKiJqkf85PV7RM3V4AcTlkHE5CxPdrnHgXsvsxuqGq0RDe33cc uXNcINgRIEnA+CdK0wQphN7H3fTlGDe6qrFFTaROCmFtZh4Qxi8KQnf86KtaRN4Xc6cr 0XUhUmpCpx2hWZmv9Cml21ppM2R6msZ+TrI+m5GWaQpy3o0cLh11y3+2F0aiC3Sik1ss xQnYIGhqlo38r6HMGmpCkGg72/bHRGYACDbGpqds5QboQHg95wXexwhhtTXK4aTVkqb3 F5dbsdVhnlHIM73fLHOFmwWUDC/ktoK1e5xKgkLkcK2A/3F3BJrBa0e1J3MpMai/Y4Di p9mw== 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=ru7VYZQFM1VVEN15+QmGHBxSNzsOgYyzaqlXuO2dVxw=; b=bvraSQqtPzPAXPUJD5mbBU/CFw4N5O5mAtgEvRoWmTaAAQoB2omgPhFqe6WIyq3d6R scqRpuDOiBd4D5QLEtUYiVRPG2iHbSI4zBbJ/X+Q3zS5DPA4kLortIX3e6sjZWKkfqR4 JlCZvxAr+pZvv/g8Ffbf8wjxCim8LeCu33Y9sHZOw496hD6TRrueQT7WAAVOB5lXlvq0 BBAcWlgN7Q/yBghxlqxjazcl1Bgv57bw7SOaM6RE6ZBzvuDaBFje0zjGNNGfh+DmjcVU o1iAe2RyXqyCzadwqtMgam838qMMtDRVBKOP60snNXjl+euLmsDAPzMtnsXomtWrqBY3 vQWA== X-Gm-Message-State: AOAM533kkocTMyA7ParVIuWpuWqIdzI6ZLqciHLI9U6ggApVaEQzKE3y CYVvA1KWKOndr3LZFLlVeJNdNu/bB8g= X-Google-Smtp-Source: ABdhPJy8kifTsQYkHADB3X/VjwWX4edCBRIlpmtaNoexFdNOuNYczcrBwE+yOodX+UnG3Bcu8rQXdQ== X-Received: by 2002:a17:90b:197:: with SMTP id t23mr6968654pjs.61.1623959023215; Thu, 17 Jun 2021 12:43:43 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:43:42 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function Date: Thu, 17 Jun 2021 19:41:39 +0000 Message-Id: <20210617194154.2397-5-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124347_930767_A0A794AC X-CRM114-Status: GOOD ( 14.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reorder the code for phy set_mode in .set_mode callback function. For now configure the phy in host mode. Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 62 ++++++++++++++++++-------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 2b32a3eabccf..18e0986f6ed2 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -173,11 +173,43 @@ static int phy_meson8b_usb2_exit(struct phy *phy) return 0; } -static int phy_meson8b_usb2_power_on(struct phy *phy) +static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, + int submode) { struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); u32 reg; + switch (mode) { + case PHY_MODE_USB_HOST: + if (priv->match->host_enable_aca) { + regmap_update_bits(priv->regmap, REG_ADP_BC, + REG_ADP_BC_ACA_ENABLE, + REG_ADP_BC_ACA_ENABLE); + + udelay(ACA_ENABLE_COMPLETE_TIME); + + regmap_read(priv->regmap, REG_ADP_BC, ®); + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { + dev_warn(&phy->dev, "USB ID detect failed!\n"); + return -EINVAL; + } + } + break; + default: + dev_warn(&phy->dev, "USB ID detect failed to setnode! %d\n", mode); + return -EINVAL; + } + + priv->dr_mode = mode; + + return 0; +} + +static int phy_meson8b_usb2_power_on(struct phy *phy) +{ + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + int ret; + regmap_update_bits(priv->regmap, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, REG_CONFIG_CLK_32k_ALTSEL); @@ -197,24 +229,12 @@ 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) { - regmap_update_bits(priv->regmap, REG_DBG_UART, - REG_DBG_UART_SET_IDDQ, 0); - - if (priv->match->host_enable_aca) { - regmap_update_bits(priv->regmap, REG_ADP_BC, - REG_ADP_BC_ACA_ENABLE, - REG_ADP_BC_ACA_ENABLE); - - udelay(ACA_ENABLE_COMPLETE_TIME); - - regmap_read(priv->regmap, REG_ADP_BC, ®); - if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { - dev_warn(&phy->dev, "USB ID detect failed!\n"); - clk_bulk_disable_unprepare(priv->num_clks, priv->clks); - return -EINVAL; - } - } + ret = phy_meson8b_usb2_setmode(phy, priv->dr_mode, 0); + if (ret) { + phy_meson8b_usb2_power_off(phy); + dev_err(&phy->dev, "Failed to initialize PHY with mode %d\n", + priv->dr_mode); + return ret; } return 0; @@ -238,6 +258,7 @@ static const struct phy_ops phy_meson8b_usb2_ops = { .exit = phy_meson8b_usb2_exit, .power_on = phy_meson8b_usb2_power_on, .power_off = phy_meson8b_usb2_power_off, + .set_mode = phy_meson8b_usb2_setmode, .owner = THIS_MODULE, }; @@ -261,6 +282,9 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) if (!priv->match) return -ENODEV; + /* start in host mode */ + priv->dr_mode = PHY_MODE_USB_HOST; + priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, &phy_meson8b_usb2_regmap_conf); if (IS_ERR(priv->regmap)) From patchwork Thu Jun 17 19:41:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4353C2B9F4 for ; Thu, 17 Jun 2021 19:46:27 +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 612ED613D5 for ; Thu, 17 Jun 2021 19:46:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 612ED613D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7wA7QmVzPylw/lgH6MsHu/lNYFFk+bpsMGMg4uFhHXw=; b=2qaElJgG/3rORw 1LCJUbWA0/AP42Z2Mqg+f5WatiYO58rAGO6KnoE4qTxZkNkRXzFrP/gfC/4z2+4BGTTMxg1O98vCQ 1uKLZTijTqblW9hbmGnysHldQobzSil94lWKSBxIGRxrrqQCop+8OwRGH861l05IhmiMyXPCfaOjc BvMigmxiDHaJji73iYP4qHvv7IYNH0MeM5AdwBTKhm/YlSJrxdxES6YOlhcT6Cfwg71zxG0poUh/Z D7VGKeHFEQttOtEUyV5WqQCSTvo+xfsrUK4sk4WC/ohz8ft0LsuMSjeLXb9QTOYBgCumFobLeYCSM X2UiV65TQsq0Nd/320UA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxw7-00BaoX-4E; Thu, 17 Jun 2021 19:44:23 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvl-00Baee-Ed; Thu, 17 Jun 2021 19:44:02 +0000 Received: by mail-pl1-x635.google.com with SMTP id c15so3406909pls.13; Thu, 17 Jun 2021 12:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hdzvs1xs4XG3cpyN4NkJEKqbHLmgGkruX+DR+rsCUB8=; b=KzJwSd6ASPVS70vFaIeoMnaFl69YBeca53kGHvijVtBhgsWbanwrpO8qZcVlpjhzGy oqCWhUzPocyp1GqUVxqQDpd+pdcZV1buOgaveUqgEA/lu9wT5s1/sOtP99BFFCoIUB9h GrFF+nn++sPbetBCyrdoZDL3Mj7Kr6RTEYETq17limuCSOIk0ZIfVM59aw31RIiXxuJ6 AjKTH1Y0cpascG4sdEbQxbdRZZBIIWd85cV/dvG0FOUXPWqeNcMnfw1EOOLCS9Kdyb3P 3CjoywJ+C4DOZz3YxtWeZZJJ1MGuYNJBJeWQ7jgqaT8avdVT4bWQbRypsrfPvmWe+vB3 cbIA== 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=Hdzvs1xs4XG3cpyN4NkJEKqbHLmgGkruX+DR+rsCUB8=; b=bUuVhSmXfBynl7pFDyMUetpMvIlT3dFXIPHI7qnHYw4fuBYMirdspcSKJ67IRGJV4i wZ55a7N3m/ZnznqscZbkZ6eqttj0+FQJbdg1gN/sUjnLsUs7ZnGYy8TtdP5IPlHEyf6h 3cmjtE0rJrALnhde+u+L48vmnpf3vUV1eaQP/2iehSORkTVPmSfrZNe33QZXeWfgGEWD bgieQGkvR8hMrqIzP4CJW6rOHrflSNaqif+eApgaJRCW3uY4ZJWIoRvBmAzQ72Vv0Uts dDjmqbwb/mfH3WO9kTw8XwmBMcPhSqK26Xn9ldanN6DRfa5WKVobu21Z3/HA2NF8tL0+ Vm3w== X-Gm-Message-State: AOAM5302pdgUkQm4vAQF6xkyJ+X8s8PPzhal4AdsccBGu7j1LavKzb/R 7zBTD3MnKKvGuTGtlKs2rtp8X7sWrw4= X-Google-Smtp-Source: ABdhPJyONX1RytaqS/1Abh60D0SZ6YpWdjvwgyXHIGp/cDL0NRrUFyKJEfDLIqaBQz0JNR6EF1p1Lw== X-Received: by 2002:a17:90b:3147:: with SMTP id ip7mr7180115pjb.8.1623959039950; Thu, 17 Jun 2021 12:43:59 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:43:59 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 5/8] phy: amlogic: meson8b-usb2: Reorder phy poweroff callback function Date: Thu, 17 Jun 2021 19:41:40 +0000 Message-Id: <20210617194154.2397-6-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124401_535343_7EFF1112 X-CRM114-Status: GOOD ( 11.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the phy_meson8b_usb2_power_off fundtion to avoid compilation error. drivers/phy/amlogic/phy-meson8b-usb2.c:247:3: error: implicit declaration of function 'phy_meson8b_usb2_power_off'; Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 18e0986f6ed2..ab23a584d7b7 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -205,6 +205,17 @@ static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, return 0; } +static int phy_meson8b_usb2_power_off(struct phy *phy) +{ + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + + if (priv->dr_mode == USB_DR_MODE_HOST) + regmap_update_bits(priv->regmap, REG_DBG_UART, + REG_DBG_UART_SET_IDDQ, + REG_DBG_UART_SET_IDDQ); + return 0; +} + static int phy_meson8b_usb2_power_on(struct phy *phy) { struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); @@ -240,19 +251,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) return 0; } -static int phy_meson8b_usb2_power_off(struct phy *phy) -{ - struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); - - if (priv->dr_mode == USB_DR_MODE_HOST) - regmap_update_bits(priv->regmap, REG_DBG_UART, - REG_DBG_UART_SET_IDDQ, - REG_DBG_UART_SET_IDDQ); - - - return 0; -} - static const struct phy_ops phy_meson8b_usb2_ops = { .init = phy_meson8b_usb2_init, .exit = phy_meson8b_usb2_exit, From patchwork Thu Jun 17 19:41:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329385 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7B46C2B9F4 for ; Thu, 17 Jun 2021 19:46:51 +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 9D09A60FDB for ; Thu, 17 Jun 2021 19:46:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D09A60FDB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9S1u2I5MeDrq4Cld9zLlNN9eztxlPJyg2wpFOXsOdgg=; b=jTTOZCBrBsaoL2 J3y/JerqbYYmRWXJ2hTjbsgXujiDU58a3rX/2bHids2TT4fppFZKNiHIrpiLinMrydKfILNtRseEy cUX0Lxh93NfbJ1Cw3XCtpqDDyQULmLFRqhRq+752Sr1fiZMSrvW/HZ57QDP1ZqSYsFyJ8so3yuGed SQX1eZKKI2E8Kjl3kHC0NLY0m/dfXxTz44ZzQFb0Hf9iAk+IOVfcLZfhaJUw8InVKxDq2JYv/A/Yw qNuKwv+9thJ/PiIJlldVItMulFDVJUyAszZ0eV6HJlRy4OnFijJO6u+4xbRgXDtDueBLQ/mjmoYDD a0MfzzpBM39klkmhOfYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxwe-00Bb5u-Ku; Thu, 17 Jun 2021 19:44:57 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxw2-00Ban2-6V; Thu, 17 Jun 2021 19:44:19 +0000 Received: by mail-pf1-x42f.google.com with SMTP id a127so5833203pfa.10; Thu, 17 Jun 2021 12:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=083k0zv8Ytg086lmX8X+TtAKRzXKvvth7IVx9plMtXg=; b=iuajfJilA0fwo4o/4oh4VDEAW6K9CA+mAVG1N73pVcpReCbdShNd7WB85LybfZQHjB Xby86N2VkOHbLyYxQhP0vKv//8KimP7qM2RAnzNuEewy84WGVtavZPyAfT0PMEevO3kh YaCKWXcZGDrqVekkPU+9J9+1Ei4tLb74yW5VYooD8DsMYNcE8WIgtr31HhazXJFoAoJ/ hQs+rCZgYmqhhuNKGE8q7CaRprAt6+6XzW/O5CC6BAL4huoAdKKyxewif5XV+9HJ0lxb 0lQhHy7HhGKhmK/hs8qUlRhJcBWJYce1ZjdCFMBc6WrmHw3Y9np3Oja+5GynM0VhzNmB bwOw== 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=083k0zv8Ytg086lmX8X+TtAKRzXKvvth7IVx9plMtXg=; b=rJj+VNW3Mgm8vxqBYJfB9Kue4TvEe23gitl4inXXhsmZ+nDINvzFovMNHYISS8irCr 7DIwKBN7qtwZwxM0TXNFhi8+xEOv6Td5GFYFy5r3rgPYuM5HlvGFV4ibOLU4y+16zOod sve6KrEwRpX53J8rwEi41Y01JGo1KQUNbqLOqSmcgWFTVmqWQtIaHTycxtnhuaY2u59Z wz6SeYEZ3knu+4mHKngU3qc1KwAfSNoPes2awyVIIdNFNyZhT51tk9/asfBSYMhMfpc5 ACNC5dKABDt0v+DZQJLWd0xWne4DazMhqc/cmpUgyhp1ThgBD9j1/2Cfuk9FHVJUZsYl lN5w== X-Gm-Message-State: AOAM530pemsywRaKRBSZTeg2iVBt6uMx02Bf/fnXyddnqD7Y+T9OC6cv 4Nsv3Nsm9d20daslHKCgc7w49VBKxls= X-Google-Smtp-Source: ABdhPJxt9c7UvvRETV6duPF5gupqd/aXsSexrgfUjLHqotY9ZIoS1gjWqBegyutCZwZkYOgqDB/Dmw== X-Received: by 2002:a65:4242:: with SMTP id d2mr6293256pgq.243.1623959056538; Thu, 17 Jun 2021 12:44:16 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:44:16 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 6/8] phy: amlogic: meson8b-usb2: Use phy reset callback function Date: Thu, 17 Jun 2021 19:41:41 +0000 Message-Id: <20210617194154.2397-7-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124418_354295_692F8B70 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reoder the code for phy reset mode in .reset callback function. Reset control is shared between two phy so use the phy name as shared id. Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 35 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index ab23a584d7b7..c1ed2e5c80d8 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -133,6 +133,7 @@ struct phy_meson8b_usb2_priv { struct clk_bulk_data *clks; struct reset_control *reset; const struct phy_meson8b_usb2_match_data *match; + int is_enabled; }; static const struct regmap_config phy_meson8b_usb2_regmap_conf = { @@ -147,14 +148,6 @@ static int phy_meson8b_usb2_init(struct phy *phy) struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); int ret; - if (!IS_ERR_OR_NULL(priv->reset)) { - ret = reset_control_reset(priv->reset); - if (ret) { - dev_err(&phy->dev, "Failed to trigger USB reset\n"); - return ret; - } - } - ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks); if (ret) { dev_err(&phy->dev, "Failed to enable USB clock\n"); @@ -173,6 +166,22 @@ static int phy_meson8b_usb2_exit(struct phy *phy) return 0; } +static int phy_meson8b_usb2_reset(struct phy *phy) +{ + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + int ret; + + if (priv->is_enabled) { + ret = reset_control_reset(priv->reset); + if (ret) { + dev_err(&phy->dev, "Failed to trigger USB reset\n"); + return ret; + } + } + + return 0; +} + static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, int submode) { @@ -200,6 +209,8 @@ static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, return -EINVAL; } + phy_meson8b_usb2_reset(phy); + priv->dr_mode = mode; return 0; @@ -209,6 +220,8 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) { struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + priv->is_enabled = 0; + if (priv->dr_mode == USB_DR_MODE_HOST) regmap_update_bits(priv->regmap, REG_DBG_UART, REG_DBG_UART_SET_IDDQ, @@ -221,6 +234,8 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); int ret; + priv->is_enabled = 1; + regmap_update_bits(priv->regmap, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, REG_CONFIG_CLK_32k_ALTSEL); @@ -229,7 +244,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_FSEL_MASK, 0x5 << REG_CTRL_FSEL_SHIFT); - /* reset the PHY */ regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, REG_CTRL_POWER_ON_RESET); @@ -257,6 +271,7 @@ static const struct phy_ops phy_meson8b_usb2_ops = { .power_on = phy_meson8b_usb2_power_on, .power_off = phy_meson8b_usb2_power_off, .set_mode = phy_meson8b_usb2_setmode, + .reset = phy_meson8b_usb2_reset, .owner = THIS_MODULE, }; @@ -301,7 +316,7 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) if (ret) return ret; - priv->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL); + priv->reset = devm_reset_control_get_optional_shared(&pdev->dev, "phy"); if (PTR_ERR(priv->reset) == -EPROBE_DEFER) return PTR_ERR(priv->reset); From patchwork Thu Jun 17 19:41:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84D37C2B9F4 for ; Thu, 17 Jun 2021 19:47:44 +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 4968A610A1 for ; Thu, 17 Jun 2021 19:47:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4968A610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UWvWsloJ/gErg0P2vTX3hmeezu2JUOF6PweOW/g8V3E=; b=LCs/JvKkDmyJiJ iXP6k1YUXsxjCAdMBf3j9XU47EjfyDb9z27La5cUtZS3fjdXDTXgQBn0hh/D8IA3rCA47y0UMwG27 dvPtRZ4idWoUy1js5BR+gTZaNQMDnjXF5sz9NdW+WoAbPdCc5/vXID5JenzLnRcCXQqDmZQ9UuAEM XZAGsE/4oCeoykEn9/YiDMYtoYSGJwPK2032MZnUm383EhI9a5gbV3f2lO2wlIxtw+XYfMbJnrGiW ks8bOH4JG2gW3c6dlTswCe8WR1rY7uvpPEA4QA8ufhoDKXQePCHeJbVsRhiIGXfLeEAhaQ9TAob6K MQ7Eo0oW7GIcce5at8uA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxxN-00BbVk-P4; Thu, 17 Jun 2021 19:45:41 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxwJ-00Bax4-0p; Thu, 17 Jun 2021 19:44:36 +0000 Received: by mail-pj1-x1030.google.com with SMTP id o10-20020a17090aac0ab029016e92770073so4477202pjq.5; Thu, 17 Jun 2021 12:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SQPEi5A9nnMFKoiOKyymsLKzhX94jE2VAyrLXIfg84k=; b=oF7qwt4MVyLOPRPRZwU7w3KvEGQIUotgOr/2Rooi6tbscOBcNqcc1XD3ENr3WptRU8 UdhBxiQR1tOYZjcJVD1fa4KleHtJqN7KxHtvJS754EFzMoK4T9Gh2Jx2st8Iz/a2/nhp 22a8md8h3WN1OnjpWFJrD9iYAxM0o2F6ADNX5fQMR/pQ/e0CWYI4RO+/aMakKaTPHohm 7RDU6QSEhU2D2TGadIdObyZPW+phnQWWMo1OkSF4NVgn2lFG/8slNhESNif5h22IWKa0 yAY/349fJ48TmmziwVVoRA40NUaR3gcQ33rXNNwdSCQLCPJQyq7+SGHFi7JBBTMHceDV fJJg== 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=SQPEi5A9nnMFKoiOKyymsLKzhX94jE2VAyrLXIfg84k=; b=X+e5QMUDSp5aariSadXgXm35MfcYxfhw3Slo4+S00OmhZKcVfGsi/pp3TlKrbYFY8P G4Mg3DURD90wR9Ms9Tzq1rd0MiOHbnMLFKcva/QaWgkeJXZi0CDl0thRW4Wqcza02yR0 WpMBNwOqpUhHxLFYGVfHC2am3SNRae2ADAGq4Dnch77tM00Q3LQEdLJ8JXzF29IWLDYR RHLeXhFajQPG/h0lFAvLJ6fFcjcAwRpuu1wXZBZ53rcWcEYN2jKz6ByTYFiDiVQr+I5h eLQ1t+JXo/ARjSoYTHnFkMPz4d7wDAUPdE1z3hBqjaowVdABpAc4fp3IpHj2tQOR6WgA xplQ== X-Gm-Message-State: AOAM533WOmigIWF14xogR5b0xDJ7rGbexQ6mTxrIVZuIbVUhv886q4KO 0VL/FK7/cCLJqZELNLPAUXoFoTG/HfM= X-Google-Smtp-Source: ABdhPJzZxNqxDhu1JuR1k4gJl697ElF7Ci5dtFWC4BPWfy/748J3KooaJwzRJ6CEUCMpmbkiVKZ2KA== X-Received: by 2002:a17:90a:5795:: with SMTP id g21mr6992169pji.235.1623959073592; Thu, 17 Jun 2021 12:44:33 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:44:33 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 7/8] phy: amlogic: meson8b-usb2: Power off the PHY by putting it into reset mode. Date: Thu, 17 Jun 2021 19:41:42 +0000 Message-Id: <20210617194154.2397-8-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124435_128005_CDAB79E3 X-CRM114-Status: GOOD ( 11.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Power off the PHY by putting it into reset mode. Drop the phy power reset since we are doing reset of phy after we configure the phy. No functional change. Cc: Martin Blumenstingl Signed-off-by: Anand Moon --- drivers/phy/amlogic/phy-meson8b-usb2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index c1ed2e5c80d8..d5edd31686bb 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -226,6 +226,11 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) regmap_update_bits(priv->regmap, REG_DBG_UART, REG_DBG_UART_SET_IDDQ, REG_DBG_UART_SET_IDDQ); + + /* power off the PHY by putting it into reset mode */ + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, + REG_CTRL_POWER_ON_RESET); + return 0; } @@ -245,8 +250,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_FSEL_MASK, 0x5 << REG_CTRL_FSEL_SHIFT); /* reset the PHY */ - regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, - REG_CTRL_POWER_ON_RESET); udelay(RESET_COMPLETE_TIME); regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, 0); udelay(RESET_COMPLETE_TIME); From patchwork Thu Jun 17 19:41:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12329435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94387C2B9F4 for ; Thu, 17 Jun 2021 19:47:56 +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 55EFA610A1 for ; Thu, 17 Jun 2021 19:47:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55EFA610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dVGLgaT/uPtE75enKkgWOPrWmOoMHas7r91r7yvPL0M=; b=z56d2Nss8XEMQw UrwX3wPqKeZ2ssAN0if7rcNcvEko+tNznHuuCqEpjW70YYDlRH5vHr0iisqDSHhENzAkkGaSSuxSl aE2NSM5RStsZhjog7ltK+WB7lZfV/H5nyqgDWHY2DmzqlAJcOIe5NR/EtgYyX+aQp99Q+6WG4su5r Scb/UBMbXFT+9oOk43WH2H9rH6IJ7/FTqDyIrIYffugE36dM426MuCRBOpbhcSyGQ77lQy6c/ZDyZ wq1MSQaazO02ADHGHZFQN30sH/cwujhBb0/UYgnsacd2XYd/ToV+Pfy7fjnOAqbsG4s+ICVRE5FvA 00olRB7kbR/cLUCs/SMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxy6-00Bbvq-P4; Thu, 17 Jun 2021 19:46:27 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxwa-00Bb67-3j; Thu, 17 Jun 2021 19:44:53 +0000 Received: by mail-pg1-x536.google.com with SMTP id q15so5772239pgg.12; Thu, 17 Jun 2021 12:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+55Ue4W/St8WzVyqe/i5ldF+F9lfhpaazjUIhpwFCbU=; b=EZjAcRaCFNPFLV/Dwc3dBcc+5bgU85W2R/dX96oapPujxwKglk9SnSCNmryv1xNeP1 RFx/XZ2b0Og6wCxyOpVNhSQuV6TNrmgG7BmhFaFap0FX6QvkZlJEVValx6vLby/pgYA4 85+xlVnVYjiqilbp65xRAT4JSKby3RgC98Na+BqImwSyxLq9NU8Wj9EG2TkySkqNlfPV 8HCjZB5xH7B57jtI+Tl+58xGhvVo1ihY6beJ1zUeoLj4dw4ezfeQUhyXYkEqyIkiQIpM 6YeDJAm1Tr1efY5g+wFylrdwaHGWFzbG0r/w/9Nc6T6KX6IeNq16LjpjwT+VtXjGDtqt H4hA== 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=+55Ue4W/St8WzVyqe/i5ldF+F9lfhpaazjUIhpwFCbU=; b=H9B32vsAJXFflybrFiXJXnVwJ8rZCBJKlrwOgXX3ap/MrlzRhvPyiDA0CYNQQTpdMp Y8A366dXKx82Oz4uD9j6ZFuACiJ3Nvt2+j0HY+HwNm43fnFMyYoK6XccKL3VUMqIzCir wPQDWaSLG9XZb3XJVBQbPzrpdTwyQfDNLuX0NoJunRoNPYZsHmLB0kSULDN/wB3t4s5/ XCOrv8QVwM7b4k0NkohAzX6gxiJR9v39LUj8ioiSIMgRBmva3YfzXHxsKveS7/714xs8 ++KqchFHxYhmEGCuCqR71RayRp1pZOxWyOVi5TfNSRySdgq8jLAsZ9dss4sXBYY3Q1Dv 1o+w== X-Gm-Message-State: AOAM5330CbOGdWCWKaeaarwCYGL3F8JGmfrWrxarNg206PFmxj7jLzLK tvvgaq+Fux3XxeOdhgEqdDAVQmCNwLo= X-Google-Smtp-Source: ABdhPJz1NtVS+KHlgLx1xT9I5TBnQfvCgNalkW+pJw42jrPFghbseNcxDTgiOxfCDLd6UXJeprIi5g== X-Received: by 2002:a62:7e05:0:b029:2ea:57f:ec86 with SMTP id z5-20020a627e050000b02902ea057fec86mr1515090pfc.37.1623959090404; Thu, 17 Jun 2021 12:44:50 -0700 (PDT) Received: from archl-c2lm.. ([103.51.75.27]) by smtp.gmail.com with ESMTPSA id z9sm5987187pfa.2.2021.06.17.12.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 12:44:49 -0700 (PDT) From: Anand Moon To: --to=linux-phy@lists.infradead.org, --to=linux-arm-kernel@lists.infradead.org, --to=linux-amlogic@lists.infradead.org, --to=linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 8/8] phy: amlogic: meson8b-usb2: don't log an error on -EPROBE_DEFER Date: Thu, 17 Jun 2021 19:41:43 +0000 Message-Id: <20210617194154.2397-9-linux.amoon@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617194154.2397-1-linux.amoon@gmail.com> References: <20210617194154.2397-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_124452_232253_509E83CC X-CRM114-Status: GOOD ( 12.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org devm_phy_create can return -EPROBE_DEFER if the phy-supply is not ready yet. Silence this warning as the driver framework will re-attempt registering the PHY. Use dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up. Cc: Martin Blumenstingl Signed-off-by: Anand Moon Reviewed-by: Martin Blumenstingl --- drivers/phy/amlogic/phy-meson8b-usb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index d5edd31686bb..bd624781d914 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -332,8 +332,8 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) phy = devm_phy_create(&pdev->dev, NULL, &phy_meson8b_usb2_ops); if (IS_ERR(phy)) { - dev_err(&pdev->dev, "failed to create PHY\n"); - return PTR_ERR(phy); + ret = PTR_ERR(phy); + return dev_err_probe(&pdev->dev, ret, "failed to create PHY\n"); } phy_set_drvdata(phy, priv);