public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: Chen-Yu Tsai <wens@csie.org>
Cc: <netdev@vger.kernel.org>, Rob Herring <rob.herring@calxeda.com>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-sunxi@googlegroups.com>,
	Srinivas Kandagatla <srinivas.kandagatla@st.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: Re: [PATCH 01/10] net: stmmac: Enable stmmac main clock when probing hardware
Date: Mon, 9 Dec 2013 08:14:45 +0100	[thread overview]
Message-ID: <52A56DE5.5010206@st.com> (raw)
In-Reply-To: <1386350983-13281-2-git-send-email-wens@csie.org>

Hello Chen-Yu

On 12/6/2013 6:29 PM, Chen-Yu Tsai wrote:
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>
> Guiseppe previously stated that the "stmmaceth" clock is the
> main clock that drives the IP. The stmmac driver does not
> enable this clock during the probe phase. When the driver is
> built in to the kernel, this is fine because the clock maybe
> on by default, or the boot loader had enabled it.
>
> If stmmac is built as a module, when the module is loaded,
> the clock may be found unused and disabled by the kernel.

the clk_prepare_enable is then called in the open.
Is it not working for you?
Do you mean that the stmmac_hw_init fails if you do not move
the clk_get and clk_prepare_enable on top of the stmmac_dvr_probe?

Peppe

>
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +++++++++++++----------
>   1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8d4ccd3..7da71ed 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2688,10 +2688,17 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>   	if ((phyaddr >= 0) && (phyaddr <= 31))
>   		priv->plat->phy_addr = phyaddr;
>
> +	priv->stmmac_clk = clk_get(priv->device, STMMAC_RESOURCE_NAME);
> +	if (IS_ERR(priv->stmmac_clk)) {
> +		pr_warn("%s: warning: cannot get CSR clock\n", __func__);
> +		goto error_clk_get;
> +	}
> +	clk_prepare_enable(priv->stmmac_clk);
> +
>   	/* Init MAC and get the capabilities */
>   	ret = stmmac_hw_init(priv);
>   	if (ret)
> -		goto error_free_netdev;
> +		goto error_hw_init;
>
>   	ndev->netdev_ops = &stmmac_netdev_ops;
>
> @@ -2729,12 +2736,6 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>   		goto error_netdev_register;
>   	}
>
> -	priv->stmmac_clk = clk_get(priv->device, STMMAC_RESOURCE_NAME);
> -	if (IS_ERR(priv->stmmac_clk)) {
> -		pr_warn("%s: warning: cannot get CSR clock\n", __func__);
> -		goto error_clk_get;
> -	}
> -
>   	/* If a specific clk_csr value is passed from the platform
>   	 * this means that the CSR Clock Range selection cannot be
>   	 * changed at run-time and it is fixed. Viceversa the driver'll try to
> @@ -2759,15 +2760,18 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>   		}
>   	}
>
> +	clk_disable_unprepare(priv->stmmac_clk);
> +
>   	return priv;
>
>   error_mdio_register:
> -	clk_put(priv->stmmac_clk);
> -error_clk_get:
>   	unregister_netdev(ndev);
>   error_netdev_register:
>   	netif_napi_del(&priv->napi);
> -error_free_netdev:
> +error_hw_init:
> +	clk_disable_unprepare(priv->stmmac_clk);
> +	clk_put(priv->stmmac_clk);
> +error_clk_get:
>   	free_netdev(ndev);
>
>   	return NULL;
>


  parent reply	other threads:[~2013-12-09  7:16 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 17:29 [PATCH 00/10] net: stmmac: Add sun7i GMAC glue layer Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 01/10] net: stmmac: Enable stmmac main clock when probing hardware Chen-Yu Tsai
2013-12-07 10:33   ` Maxime Ripard
2013-12-09  2:43     ` Chen-Yu Tsai
2013-12-09 10:09       ` [linux-sunxi] " Hans de Goede
2013-12-10 20:05       ` Maxime Ripard
2013-12-12  4:31         ` Chen-Yu Tsai
2013-12-09  7:14   ` Giuseppe CAVALLARO [this message]
2013-12-09  7:26     ` Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 02/10] net: stmmac: Honor DT parameter to force DMA store and forward mode Chen-Yu Tsai
2013-12-06 21:26   ` David Miller
2013-12-07  1:23     ` Chen-Yu Tsai
2013-12-07 10:07       ` maxime.ripard
2013-12-07 11:06         ` Tomasz Figa
2013-12-09  2:59           ` [linux-sunxi] " Chen-Yu Tsai
2013-12-10 20:10             ` maxime.ripard
2013-12-06 17:29 ` [PATCH 03/10] net: stmmac: Use platform data tied with compatible strings Chen-Yu Tsai
2013-12-06 21:26   ` David Miller
2013-12-07  2:13     ` Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 04/10] net: stmmac: sunxi platfrom extensions for GMAC in Allwinner A20 SoC's Chen-Yu Tsai
2013-12-07 10:27   ` Maxime Ripard
2013-12-07 11:12     ` Tomasz Figa
2013-12-07 11:46       ` Maxime Ripard
2013-12-07 12:50         ` Tomasz Figa
2013-12-07 13:34           ` [linux-sunxi] " Emilio López
2013-12-09 11:10   ` srinivas kandagatla
2013-12-09 16:16     ` [linux-sunxi] " Hans de Goede
2013-12-09 17:56       ` Chen-Yu Tsai
2013-12-09 19:04         ` Hans de Goede
2013-12-10 20:14           ` Maxime Ripard
2013-12-09 17:34     ` Chen-Yu Tsai
2013-12-10 14:59       ` srinivas kandagatla
2013-12-10 20:23         ` Maxime Ripard
2013-12-11 12:17         ` Chen-Yu Tsai
2013-12-11 14:45           ` srinivas kandagatla
2013-12-12  7:27             ` Chen-Yu Tsai
2013-12-12  9:04             ` Maxime Ripard
2013-12-12 10:31               ` Chen-Yu Tsai
2013-12-13 10:38                 ` Maxime Ripard
2013-12-24  3:27                   ` [linux-sunxi] " Chen-Yu Tsai
2014-01-02 13:11                     ` srinivas kandagatla
2014-01-07 10:24                       ` Chen-Yu Tsai
2013-12-09 11:21   ` srinivas kandagatla
2013-12-09 13:44     ` Sergei Shtylyov
2013-12-09 15:45       ` [linux-sunxi] " Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 05/10] ARM: dts: sun7i: Add GMAC controller node to sun7i DTSI Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 06/10] ARM: dts: sun7i: Add pin muxing options for the GMAC Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 07/10] ARM: dts: sun7i: cubietruck: Enable " Chen-Yu Tsai
2013-12-06 21:09   ` Florian Fainelli
2013-12-07  1:35     ` Chen-Yu Tsai
2013-12-07  1:57       ` Florian Fainelli
2013-12-09  2:55         ` Chen-Yu Tsai
2013-12-09 17:48           ` Florian Fainelli
2013-12-10  4:11             ` Chen-Yu Tsai
2013-12-10 17:23               ` Florian Fainelli
2013-12-13 10:21         ` Giuseppe CAVALLARO
2013-12-06 17:29 ` [PATCH 08/10] ARM: dts: sun7i: cubieboard2: Enable GMAC instead of EMAC Chen-Yu Tsai
2013-12-06 21:10   ` Florian Fainelli
2013-12-06 17:29 ` [PATCH 09/10] ARM: dts: sun7i: olinuxino-micro: " Chen-Yu Tsai
2013-12-06 17:29 ` [PATCH 10/10] ARM: dts: sun7i: Add ethernet alias for GMAC Chen-Yu Tsai
2013-12-07 10:15   ` Maxime Ripard
2013-12-07 16:20     ` Chen-Yu Tsai
2013-12-06 20:52 ` [linux-sunxi] [PATCH 00/10] net: stmmac: Add sun7i GMAC glue layer Michal Suchanek

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=52A56DE5.5010206@st.com \
    --to=peppe.cavallaro@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=netdev@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=srinivas.kandagatla@st.com \
    --cc=wens@csie.org \
    /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