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: 12329391 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 D1C22C48BE5 for ; Thu, 17 Jun 2021 19:43:12 +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 9AB3C6113E for ; Thu, 17 Jun 2021 19:43:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AB3C6113E 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-amlogic-bounces+linux-amlogic=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=ntJOpdDGswI645AT8qA3IJN+t3BBTnRFOjQA9jc+FH8=; b=hcftSW5m+22m1+ qFfE8F67D1FMACj/HiJBoALrXpXA2heL0ugZwJn7LYnTJE+SAUjcmBERVB0h0SN5biCRrQfitcifv 3o4Mgl5mzQOPlFrN2OVE1yVkHru2YseM2/Q8GeTatjBbrgy9l0i1yYIAGbNAp9tjkLza63y/kzkt6 QJisNjRXDVUin+dqp9WRaxBveIUk9eiBGOSlGEM/srC8n+xg2i0b7SkNZGnZWoi7dMcxsLMs4iLFM /5M4oMd4VD8W7QaNsm2MATDJkoo1SzSlk1nHTFHsXDRMtnx7rhmz/ZEkicUULeD8IX+u1a4bZueCm qvUgR8A0HQ+gqaVAuLmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxut-00BaDF-L3; Thu, 17 Jun 2021 19:43:07 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329393 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 35339C2B9F4 for ; Thu, 17 Jun 2021 19:43:35 +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 0AB886113E for ; Thu, 17 Jun 2021 19:43:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AB886113E 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-amlogic-bounces+linux-amlogic=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=ujCXQalI8WrJP9R67YpUn2SG83Lhmwt4dkZlXcHqHLY=; b=c67pN+5jdML3Mx utPEfP4AUGP3PFQnDv1AKfUEiAEpVbbNObdSZV56wnnNkapMTJJRZ7DKgF+PAarc8IqAdWhKHT8jS GZhSPU5WppFomm2R5rUgFmVXzZ73jUmANXkt+5SksSNMwzf960COkcxsCVwln7dgkDRcglb1u1Not 2B9j+0yiiERzjjeU4yQ2AAOcWOIOiCl6kIRvi5okTgBuQbilK+TBRRBapB2xHDYCWlSfoQ2kcLxJ6 /pNLaOR1ChirxtGhQrki9lcTJQ9I52uyWK+x10D2WiXdS9bNIELX9uH0xFZVBYaPzuBUtTtpMnqIA /09EuypAHUgeZyf1NeZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvE-00BaNJ-SQ; Thu, 17 Jun 2021 19:43:28 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329395 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 AF990C2B9F4 for ; Thu, 17 Jun 2021 19:43:54 +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 7D7E5613CB for ; Thu, 17 Jun 2021 19:43:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D7E5613CB 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-amlogic-bounces+linux-amlogic=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=rBnZ8Sf1rtVlFqOSX0ST6jUZyJtROVYmdYh2QcpGlfk=; b=GIYnHrwlb/pXQO pbCmL+dDfTuUQrIzwTbIWVmKwpLMKPeAXnx+QtwD9/cORFoHfoNN86TKDwDsx2ANV6kv1wYK2P0m0 7/m23EbBHlQChxIZw0WGok//Qq+yfX95znxNnEXrZErMRtbtVlbQwoSkUoenNrYUV+oXAj8mVgqHd xUZXir9UF2BrU14Msxoon90N44HG8cpZsxp8d3ZWDbiEgQo1aHSTJTS/sezHzDCvNs9y5XGufK7c9 Igd1pgf2Fi14OWq6Qw0+CfNXnRht28ULoWtR6hmqbxTEHfdpzRgLDDJ9l5r7C8s6cy67iehkev4x/ mzYwBj0rnLWUSz6BJg7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvY-00BaXZ-8R; Thu, 17 Jun 2021 19:43:48 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329397 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 CC6E4C48BE5 for ; Thu, 17 Jun 2021 19:44:23 +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 92B10613E7 for ; Thu, 17 Jun 2021 19:44:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92B10613E7 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-amlogic-bounces+linux-amlogic=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=KUBC7kKYjHEQ89w/6yVWQvuDEqtbQbN4Pkq+KwJD4Jk=; b=wzSkVifR2kOFA1 OtUS8Kb+XeklTdxjW2Na1odP+bMwX3EcapvtgltFBZ4fvxSM3DxOeQCcXSTfD/c45qQiawf6DDmzh 5diojzKXEtBbFpxX6JVmuWIf3ommYLQVkq/UI5hnYRNjhmZS/yaOKawJfa1wW0iCdde6O3uBiDJoC 1ekY7ey8YSwqjuJXt2fiHHgZv+buIdSj4JLub4ULzksU7P7hsGMkCYeKrrIoZO6/jNOnaO7IT48d0 pD2RnHbxUqM3+hoeesd8TZAj42gH1L8QI8v3j9DnA/H5egHeihLQeAre6vhUv57EKzogz6xd8OPSv bTYN01uuWgtOEEtEWHaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxvz-00Balu-KX; Thu, 17 Jun 2021 19:44:15 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329399 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 32EB1C48BE5 for ; Thu, 17 Jun 2021 19:44:55 +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 F33656113E for ; Thu, 17 Jun 2021 19:44:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F33656113E 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-amlogic-bounces+linux-amlogic=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=zORQgo5XJbL6y/SzY600Rkr2AljXOJjJWI7vdAVgvR0=; b=dQAKV++aAJM6hg 7mi42WPsBOk++8iVGjeQMCF6aMVG/7A7DsXs+2oRNRXwZAnnXm0R3fMpzM6MX2E95dfRZbtsEarWq CaNpY0TSxdDmEiMgYLdmZljfMm3NJ9BWZprl9QNf18Mh3jiwTVla1m5rpApchndBQn69mxoKMttBZ fKKs3N8kSs38QSkJ3eqEqJh68v/vdYQP+aiyEiqsck6KtyN3PVMZCwRUYf5cAWWe3NmZcB4YBYSwJ ORq7JJw9jgC4lrzwpaxX/bnBPXI/05absB9CpSwbF5MbfGzm/PlEaQ4Bcgy+kafVqqZg53wTVYvZT sbANmw6u1q6YBbqYS3dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxwW-00Bb4Q-Oq; Thu, 17 Jun 2021 19:44:48 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329401 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 C84A8C2B9F4 for ; Thu, 17 Jun 2021 19:45:30 +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 8E120613D5 for ; Thu, 17 Jun 2021 19:45:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E120613D5 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-amlogic-bounces+linux-amlogic=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=ODdKPZZnYa+Tr0OzXfLsbmN+5/FwBc+MTrxbNEEHMD8=; b=TnYS8CiOU6qkXR 6bmJvIZbNezFlW4o4gNRQPUIZoDHOqnH6Ck+7eOkBOQ8PciUjNQkz+e4YQ9URgkoyQybiFBZyH5/w fHoHdsywvLxGJFMdkrJ8FKnXYU+C0J2XrMyNusdsbeG2SDRj68x9TJs7UkXi2R9TMW3JlExfsM03c A4EX+JxiwHvSaFNyPW7NTKDsx2L3DChQ5pyQ/IjTjYM3SuPwD2Ok2iXvE6AgNNpqGTpAmllTeKERN EoFVBBQwEKJR8ifQJillToEBQthWcryDfrrjXzfGu1lD6pElIbwVIAaukjcysN5b1zmlAf17Ze6mb c+ukJXR7sTxwfn037SOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxx6-00BbOH-Ll; Thu, 17 Jun 2021 19:45:24 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329403 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 9B337C2B9F4 for ; Thu, 17 Jun 2021 19:46:25 +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 649C3613D5 for ; Thu, 17 Jun 2021 19:46:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 649C3613D5 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-amlogic-bounces+linux-amlogic=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=a3HutMD6+ggCb47OIukg77UlYwRSIpIAWtOaiQ4ObIk=; b=JFU5Sa6s82KJoj jhTxpa40u+F74j/5cH7/fekV+oRidVhh5mVZaSCq+hfuyyBY7Be0OsQVEaS9VBUg143iuOf/4utcr RjLV//C3dkhrO1ApNYVXbXPXOHWWhuVLzLFIQKFXbsOWCubxiWLSVszEMM5gQZwrr92MvSouv6SGg wjW5w02aZvsUgJ1CrUTbwZCY2cJFbtwQC7fhOu2vOuAHUSN1L6u+wDTiql5w9CHF7pxaUyBiljG3O vsv6ZfGQzoHJisv9QNeXXtQljj4AZuWZVC2mhknkfD+7phTOFntYX9Pl6CIubvpDY+E/Qs2Spw6jK HAPDdwZt1RIDzMXfPhqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxxz-00BbtY-EK; Thu, 17 Jun 2021 19:46:19 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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: 12329405 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 4AAA2C2B9F4 for ; Thu, 17 Jun 2021 19:47:03 +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 1464260FDB for ; Thu, 17 Jun 2021 19:47:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1464260FDB 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-amlogic-bounces+linux-amlogic=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=Wjp51JrcJTkBSLhK6PTedgQgfwI3KuxAVQYmSHZY7bQ=; b=Ct8fM16QeS+3hV DT50qEyYLhxRF+NdY/qkRT38oE6PRRjE2E9vUZWMeSf7YXr6pYbncTis61z9TRSan46YHg50N8/h+ Lq5NCkWn509uCS88Qv6FGHAJolER55V7ZTyipxAJMfavyToQmaVClG5ZIRYZiFiB9nY3rP8LKtjX7 vV6D6iTDb1PxOks8LFzWMw99/qDRpuA8dbgIcOLs9tyYSxIEmllnp8EhRP7x6uz3HAQJf26HJGCKh oTGJerhgRtyv85fmogcRzFcLc26LIDMbP+yLC9td4C7l9A3Jq3e63UdecvosaKkTg5cdM5tyuRiP6 D555gdg6ByRi1ToozAPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltxyZ-00BcCk-JV; Thu, 17 Jun 2021 19:46:55 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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);