From: Florian Fainelli <f.fainelli@gmail.com>
To: Arun Parameswaran <arun.parameswaran@broadcom.com>,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>, Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH v3 7/8] net: phy: Add support to configure clock in Broadcom iProc mdio mux
Date: Wed, 1 Aug 2018 11:40:33 -0700 [thread overview]
Message-ID: <0cc6db4f-7008-0ad3-58d7-9e93060f152f@gmail.com> (raw)
In-Reply-To: <1533146186-8374-8-git-send-email-arun.parameswaran@broadcom.com>
On 08/01/2018 10:56 AM, Arun Parameswaran wrote:
> Add support to configure the internal rate adjust register based on the
> core clock supplied through device tree in the Broadcom iProc mdio mux.
>
> The operating frequency of the mdio mux block is 11MHz. This is derrived
> by dividing the clock to the mdio mux with the rate adjust register.
>
> In some SoC's the default values of the rate adjust register do not yield
> 11MHz. These SoC's are required to specify the clock via the device tree
> for proper operation.
>
> Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
> ---
[snip]
> static int iproc_mdio_wait_for_idle(void __iomem *base, bool result)
> @@ -204,6 +225,20 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> + md->core_clk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(md->core_clk)) {
> + if (PTR_ERR(md->core_clk) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> +
> + md->core_clk = NULL;
I would simplify this a bit:
if (IS_ERR(md->core_clk) && PTR_ERR(md->core_clk) == -EPROBE_DEFER)
return PTR_ERR(md->core_clk);
else
md->core_clk = NULL;
rc = clk_prepare_enable(md->core_clk);
and continue that way.
> + } else {
> + rc = clk_prepare_enable(md->core_clk);
> + if (rc) {
> + dev_err(&pdev->dev, "failed to enable core clk\n");
> + return rc;
> + }
> + }
> +
> bus = md->mii_bus;
> bus->priv = md;
> bus->name = "iProc MDIO mux bus";
> @@ -217,7 +252,7 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
> rc = mdiobus_register(bus);
> if (rc) {
> dev_err(&pdev->dev, "mdiomux registration failed\n");
> - return rc;
> + goto out_clk;
> }
>
> platform_set_drvdata(pdev, md);
> @@ -237,6 +272,8 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
>
> out_register:
> mdiobus_unregister(bus);
> +out_clk:
> + clk_disable_unprepare(md->core_clk);
> return rc;
> }
>
> @@ -246,6 +283,7 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev)
>
> mdio_mux_uninit(md->mux_handle);
> mdiobus_unregister(md->mii_bus);
> + clk_disable_unprepare(md->core_clk);
> platform_set_drvdata(pdev, NULL);
>
> return 0;
>
--
Florian
next prev parent reply other threads:[~2018-08-01 18:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 17:56 [PATCH v3 0/8] Add clock config and pm support to bcm iProc mdio mux Arun Parameswaran
2018-08-01 17:56 ` [PATCH v3 1/8] dt-bindings: net: Fix Broadcom iProc mdio mux driver base address Arun Parameswaran
2018-08-01 17:56 ` [PATCH v3 2/8] net: phy: Fix the register offsets in Broadcom iProc mdio mux driver Arun Parameswaran
2018-08-01 17:56 ` [PATCH v3 3/8] arm64: dts: Fix the base address of the Broadcom iProc mdio mux Arun Parameswaran
2018-08-01 17:56 ` [PATCH v3 4/8] net: phy: Disable external master access in bcm mdio mux driver Arun Parameswaran
2018-08-01 17:56 ` [PATCH v3 5/8] net: phy: Use devm api for mdio bus allocation in bcm iproc mdio mux Arun Parameswaran
2018-08-01 18:37 ` Florian Fainelli
2018-08-01 17:56 ` [PATCH v3 6/8] dt-bindings: net: Add clock handle to Broadcom iProc " Arun Parameswaran
2018-08-01 17:56 ` [PATCH v3 7/8] net: phy: Add support to configure clock in " Arun Parameswaran
2018-08-01 18:40 ` Florian Fainelli [this message]
2018-08-01 18:46 ` Russell King - ARM Linux
2018-08-01 19:55 ` Arun Parameswaran
2018-08-01 20:07 ` Andrew Lunn
2018-08-01 20:23 ` Russell King - ARM Linux
2018-08-01 20:38 ` Andrew Lunn
2018-08-01 21:45 ` Arun Parameswaran
2018-08-01 21:55 ` Andrew Lunn
2018-08-01 22:10 ` Arun Parameswaran
2018-08-01 22:18 ` Andrew Lunn
2018-08-01 17:56 ` [PATCH v3 8/8] net: phy: Add pm support to Broadcom iProc mdio mux driver Arun Parameswaran
2018-08-01 18:39 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0cc6db4f-7008-0ad3-58d7-9e93060f152f@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=arun.parameswaran@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=rjui@broadcom.com \
--cc=robh+dt@kernel.org \
--cc=sbranden@broadcom.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).