All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 5/8] net: dwc_eth_qos: Make clk_rx and clk_tx optional
Date: Thu, 30 Apr 2020 14:00:15 +0000	[thread overview]
Message-ID: <b1855803-e1a4-a580-60f4-e935843c72ef@st.com> (raw)
In-Reply-To: <20200430104343.30843-1-david.wu@rock-chips.com>

Hi David

On 4/30/20 12:43 PM, David Wu wrote:
> For others using, clk_rx and clk_tx may not be necessary,
> and their clock names are different.
>
> Signed-off-by: David Wu <david.wu@rock-chips.com>
> ---
>
>  drivers/net/dwc_eth_qos.c | 65 +++++++++++++++++++--------------------
>  1 file changed, 31 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
> index fbd6caf85b..b5d5156292 100644
> --- a/drivers/net/dwc_eth_qos.c
> +++ b/drivers/net/dwc_eth_qos.c
> @@ -592,16 +592,20 @@ static int eqos_start_clks_stm32(struct udevice *dev)
>  		goto err;
>  	}
>  
> -	ret = clk_enable(&eqos->clk_rx);
> -	if (ret < 0) {
> -		pr_err("clk_enable(clk_rx) failed: %d", ret);
> -		goto err_disable_clk_master_bus;
> +	if (clk_valid(&eqos->clk_rx)) {
> +		ret = clk_enable(&eqos->clk_rx);
> +		if (ret < 0) {
> +			pr_err("clk_enable(clk_rx) failed: %d", ret);
> +			goto err_disable_clk_master_bus;
> +		}
>  	}
>  
> -	ret = clk_enable(&eqos->clk_tx);
> -	if (ret < 0) {
> -		pr_err("clk_enable(clk_tx) failed: %d", ret);
> -		goto err_disable_clk_rx;
> +	if (clk_valid(&eqos->clk_tx)) {
> +		ret = clk_enable(&eqos->clk_tx);
> +		if (ret < 0) {
> +			pr_err("clk_enable(clk_tx) failed: %d", ret);
> +			goto err_disable_clk_rx;
> +		}
>  	}
>  
>  	if (clk_valid(&eqos->clk_ck)) {
> @@ -616,9 +620,11 @@ static int eqos_start_clks_stm32(struct udevice *dev)
>  	return 0;
>  
>  err_disable_clk_tx:
> -	clk_disable(&eqos->clk_tx);
> +	if (clk_valid(&eqos->clk_tx))
> +		clk_disable(&eqos->clk_tx);
>  err_disable_clk_rx:
> -	clk_disable(&eqos->clk_rx);
> +	if (clk_valid(&eqos->clk_rx))
> +		clk_disable(&eqos->clk_rx);
>  err_disable_clk_master_bus:
>  	clk_disable(&eqos->clk_master_bus);
>  err:
> @@ -647,8 +653,10 @@ static void eqos_stop_clks_stm32(struct udevice *dev)
>  
>  	debug("%s(dev=%p):\n", __func__, dev);
>  
> -	clk_disable(&eqos->clk_tx);
> -	clk_disable(&eqos->clk_rx);
> +	if (clk_valid(&eqos->clk_tx))
> +		clk_disable(&eqos->clk_tx);
> +	if (clk_valid(&eqos->clk_rx))
> +		clk_disable(&eqos->clk_rx);
>  	clk_disable(&eqos->clk_master_bus);
>  	if (clk_valid(&eqos->clk_ck))
>  		clk_disable(&eqos->clk_ck);
> @@ -1691,20 +1699,16 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
>  	ret = clk_get_by_name(dev, "stmmaceth", &eqos->clk_master_bus);
>  	if (ret) {
>  		pr_err("clk_get_by_name(master_bus) failed: %d", ret);
> -		goto err_probe;
> +		return ret;
>  	}
why are you changing the error path here ?
>  
> -	ret = clk_get_by_name(dev, "mac-clk-rx", &eqos->clk_rx);
> -	if (ret) {
> -		pr_err("clk_get_by_name(rx) failed: %d", ret);
> -		goto err_free_clk_master_bus;
> -	}
> +	ret = clk_get_by_name(dev, "mac_clk_rx", &eqos->clk_rx);
> +	if (ret)
> +		pr_warn("clk_get_by_name(rx) failed: %d", ret);
>  
> -	ret = clk_get_by_name(dev, "mac-clk-tx", &eqos->clk_tx);
> -	if (ret) {
> -		pr_err("clk_get_by_name(tx) failed: %d", ret);
> -		goto err_free_clk_rx;
> -	}
> +	ret = clk_get_by_name(dev, "mac_clk_tx", &eqos->clk_tx);
> +	if (ret)
> +		pr_warn("clk_get_by_name(tx) failed: %d", ret);

Nak

Why are you changing the Rx and Tx clock names ?

for information, check with the kernel dt bindings regarding this driver:

Documentation/devicetree/bindings/net/stm32-dwmac.txt

This patch is breaking ethernet on STM32MP1 boards

>  
>  	/*  Get ETH_CLK clocks (optional) */
>  	ret = clk_get_by_name(dev, "eth-ck", &eqos->clk_ck);
> @@ -1749,15 +1753,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
>  
>  	debug("%s: OK\n", __func__);
>  	return 0;
> -
> -err_free_clk_rx:
> -	clk_free(&eqos->clk_rx);
> -err_free_clk_master_bus:
> -	clk_free(&eqos->clk_master_bus);
> -err_probe:
> -
> -	debug("%s: returns %d\n", __func__, ret);
> -	return ret;
>  }
>  
>  static phy_interface_t eqos_get_interface_stm32(struct udevice *dev)
> @@ -1803,8 +1798,10 @@ static int eqos_remove_resources_stm32(struct udevice *dev)
>  
>  	debug("%s(dev=%p):\n", __func__, dev);
>  
> -	clk_free(&eqos->clk_tx);
> -	clk_free(&eqos->clk_rx);
> +	if (clk_valid(&eqos->clk_tx))
> +		clk_free(&eqos->clk_tx);
> +	if (clk_valid(&eqos->clk_rx))
> +		clk_free(&eqos->clk_rx);
>  	clk_free(&eqos->clk_master_bus);
>  	if (clk_valid(&eqos->clk_ck))
>  		clk_free(&eqos->clk_ck);

  reply	other threads:[~2020-04-30 14:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 10:36 [PATCH 0/8] Add dwc_eth_qos support for rockchip David Wu
2020-04-30 10:36 ` [PATCH 1/8] net: dwc_eth_qos: Use dev_ functions calls to get FDT data David Wu
2020-04-30 10:36 ` [PATCH 2/8] net: dwc_eth_qos: Fix the software reset David Wu
2020-04-30 15:28   ` Patrice CHOTARD
2020-04-30 22:25   ` Stephen Warren
2020-04-30 10:36 ` [PATCH 3/8] net: dwc_eth_qos: Add option "snps, reset-gpio" phy-rst gpio for stm32 David Wu
2020-04-30 15:47   ` [PATCH 3/8] net: dwc_eth_qos: Add option "snps,reset-gpio" " Patrice CHOTARD
2020-05-09  2:59     ` David Wu
2020-04-30 22:36   ` [PATCH 3/8] net: dwc_eth_qos: Add option "snps, reset-gpio" " Stephen Warren
2020-04-30 22:42     ` Stephen Warren
2020-05-09  2:41     ` David Wu
2020-05-09  3:32       ` David Wu
2020-04-30 10:36 ` [PATCH 4/8] net: dwc_eth_qos: Move interface() to eqos_ops struct David Wu
2020-04-30 22:39   ` Stephen Warren
2020-05-09  3:22     ` David Wu
2020-04-30 10:43 ` [PATCH 5/8] net: dwc_eth_qos: Make clk_rx and clk_tx optional David Wu
2020-04-30 14:00   ` Patrice CHOTARD [this message]
2020-05-09  6:31     ` David Wu
2020-04-30 22:45   ` Stephen Warren
2020-05-09  6:33     ` David Wu
2020-04-30 10:44 ` [PATCH 6/8] net: dwc_eth_qos: Split eqos_start() to get link speed David Wu
2020-04-30 15:33   ` Patrice CHOTARD
2020-05-09  6:42     ` David Wu
2020-05-11 12:48       ` Patrice CHOTARD
2020-05-12  1:56         ` David Wu
2020-04-30 10:45 ` [PATCH 7/8] net: dwc_eth_qos: Export common struct and interface at head file David Wu
2020-04-30 12:06   ` Patrice CHOTARD
2020-04-30 22:47   ` Stephen Warren
2020-04-30 10:45 ` [PATCH 8/8] net: gmac_rockchip: Add dwc_eth_qos support David Wu
2020-04-30 22:52   ` Stephen Warren
2020-05-09  6:56     ` David Wu

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=b1855803-e1a4-a580-60f4-e935843c72ef@st.com \
    --to=patrice.chotard@st.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.