From: Alexandre Torgue <alexandre.torgue@st•com>
To: Christophe Roullier <christophe.roullier@st•com>,
<robh@kernel•org>, <davem@davemloft•net>, <joabreu@synopsys•com>,
<mark.rutland@arm•com>, <mcoquelin.stm32@gmail•com>,
<peppe.cavallaro@st•com>
Cc: devicetree@vger•kernel.org, andrew@lunn•ch,
netdev@vger•kernel.org, linux-kernel@vger•kernel.org,
linux-stm32@st-md-mailman•stormreply.com,
linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH 1/5] net: ethernet: stmmac: Add support for syscfg clock
Date: Thu, 3 Oct 2019 12:13:44 +0200 [thread overview]
Message-ID: <7032bc93-cfb3-4538-1de5-bd901a3fc8c5@st.com> (raw)
In-Reply-To: <20190920053817.13754-2-christophe.roullier@st.com>
Hi,
On 9/20/19 7:38 AM, Christophe Roullier wrote:
> Add optional support for syscfg clock in dwmac-stm32.c
> Now Syscfg clock is activated automatically when syscfg
> registers are used
>
> Signed-off-by: Christophe Roullier <christophe.roullier@st•com>
> ---
> .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 36 +++++++++++++------
> 1 file changed, 25 insertions(+), 11 deletions(-)
Acked-by: Alexandre TORGUE <alexandre.torgue@st•com>
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> index 4ef041bdf6a1..7e6619868cc1 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> @@ -152,23 +152,32 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare)
> int ret = 0;
>
> if (prepare) {
> - ret = clk_prepare_enable(dwmac->syscfg_clk);
> - if (ret)
> - return ret;
> -
> + if (dwmac->syscfg_clk) {
> + ret = clk_prepare_enable(dwmac->syscfg_clk);
> + if (ret)
> + return ret;
> + }
> if (dwmac->clk_eth_ck) {
> ret = clk_prepare_enable(dwmac->clk_eth_ck);
> if (ret) {
> - clk_disable_unprepare(dwmac->syscfg_clk);
> + if (dwmac->syscfg_clk)
> + goto unprepare_syscfg;
> return ret;
> }
> }
> } else {
> - clk_disable_unprepare(dwmac->syscfg_clk);
> + if (dwmac->syscfg_clk)
> + clk_disable_unprepare(dwmac->syscfg_clk);
> +
> if (dwmac->clk_eth_ck)
> clk_disable_unprepare(dwmac->clk_eth_ck);
> }
> return ret;
> +
> +unprepare_syscfg:
> + clk_disable_unprepare(dwmac->syscfg_clk);
> +
> + return ret;
> }
>
> static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat)
> @@ -296,7 +305,7 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac,
> {
> struct platform_device *pdev = to_platform_device(dev);
> struct device_node *np = dev->of_node;
> - int err = 0;
> + int err;
>
> /* Gigabit Ethernet 125MHz clock selection. */
> dwmac->eth_clk_sel_reg = of_property_read_bool(np, "st,eth-clk-sel");
> @@ -320,13 +329,17 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac,
> return PTR_ERR(dwmac->clk_ethstp);
> }
>
> - /* Clock for sysconfig */
> + /* Optional Clock for sysconfig */
> dwmac->syscfg_clk = devm_clk_get(dev, "syscfg-clk");
> if (IS_ERR(dwmac->syscfg_clk)) {
> - dev_err(dev, "No syscfg clock provided...\n");
> - return PTR_ERR(dwmac->syscfg_clk);
> + err = PTR_ERR(dwmac->syscfg_clk);
> + if (err != -ENOENT)
> + return err;
> + dwmac->syscfg_clk = NULL;
> }
>
> + err = 0;
> +
> /* Get IRQ information early to have an ability to ask for deferred
> * probe if needed before we went too far with resource allocation.
> */
> @@ -436,7 +449,8 @@ static int stm32mp1_suspend(struct stm32_dwmac *dwmac)
> return ret;
>
> clk_disable_unprepare(dwmac->clk_tx);
> - clk_disable_unprepare(dwmac->syscfg_clk);
> + if (dwmac->syscfg_clk)
> + clk_disable_unprepare(dwmac->syscfg_clk);
> if (dwmac->clk_eth_ck)
> clk_disable_unprepare(dwmac->clk_eth_ck);
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-10-03 10:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 5:38 [PATCH 0/5] net: ethernet: stmmac: some fixes and optimization Christophe Roullier
2019-09-20 5:38 ` [PATCH 1/5] net: ethernet: stmmac: Add support for syscfg clock Christophe Roullier
2019-10-03 10:13 ` Alexandre Torgue [this message]
2019-09-20 5:38 ` [PATCH 2/5] net: ethernet: stmmac: fix warning when w=1 option is used during build Christophe Roullier
2019-10-03 10:14 ` Alexandre Torgue
2019-09-20 5:38 ` [PATCH 3/5] ARM: dts: stm32: remove syscfg clock on stm32mp157c ethernet Christophe Roullier
2019-09-20 5:38 ` [PATCH 4/5] ARM: dts: stm32: adjust slew rate for Ethernet Christophe Roullier
2019-09-20 5:38 ` [PATCH 5/5] ARM: dts: stm32: Enable gating of the MAC TX clock during TX low-power mode on stm32mp157c Christophe Roullier
2019-09-22 22:12 ` [PATCH 0/5] net: ethernet: stmmac: some fixes and optimization Jakub Kicinski
2019-09-23 7:46 ` Christophe ROULLIER
2019-10-25 9:17 ` Christophe ROULLIER
2019-10-03 10:16 ` Alexandre Torgue
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=7032bc93-cfb3-4538-1de5-bd901a3fc8c5@st.com \
--to=alexandre.torgue@st$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=christophe.roullier@st$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=devicetree@vger$(echo .)kernel.org \
--cc=joabreu@synopsys$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-stm32@st-md-mailman$(echo .)stormreply.com \
--cc=mark.rutland@arm$(echo .)com \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=peppe.cavallaro@st$(echo .)com \
--cc=robh@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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