netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] net/davicom: Add SOC to dm9000 to initialize SROM_BANK clock.
       [not found] <20200510110213.2432-1-zhoubo.mr@foxmail.com>
@ 2020-05-11  6:25 ` Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2020-05-11  6:25 UTC (permalink / raw)
  To: zhoubo.mr; +Cc: davem, netdev, linux-kernel

On Sun, May 10, 2020 at 07:02:13PM +0800, zhoubo.mr@foxmail.com wrote:
> From: To-run-away <zhoubo.mr@foxmail.com>
> 
> Increase the use of dm9000 to initialize the SROM_BANK clock in the SOC,
> otherwise the chip will not work.

The dm9000 doesn't have anything called SROM in it. You have to
describe the clock input pin of the dm9000 here, not the pin of
your SoC where the clock is coming out.

> The device tree file can be increased like this:
> ethernet@88000000 {
>     compatible = "davicom,dm9000";
>     ....
>     clocks = <&clocks CLK_SROMC>;
>     clock-names = "sromc";

This must be documented in
Documentation/devicetree/bindings/net/davicom-dm9000.txt.

> +	/* Enable clock if specified */
> +	if (!of_property_read_string(dev->of_node, "clock-names", &clk_name)) {
> +		struct clk *clk = devm_clk_get(dev, clk_name);
> +		if (IS_ERR(clk)) {
> +			dev_err(dev, "cannot get clock of %s\n", clk_name);
> +			ret = PTR_ERR(clk);
> +			goto out;
> +		}
> +		clk_prepare_enable(clk);
> +		dev_info(dev, "enable clock '%s'\n", clk_name);
> +	}

There's devm_clk_get_optional() which you should use here.

the "name" passed to devm_clk_get_optional() should match the name of
the clock, you must specify it according to the dm9000 datasheet. It
makes no sense to read the name from the device tree, instead pick a
name which you expect to be there.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-11  6:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200510110213.2432-1-zhoubo.mr@foxmail.com>
2020-05-11  6:25 ` [PATCH] net/davicom: Add SOC to dm9000 to initialize SROM_BANK clock Sascha Hauer

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).