lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 11 May 2020 08:25:42 +0200
From:   Sascha Hauer <s.hauer@...gutronix.de>
To:     zhoubo.mr@...mail.com
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/davicom: Add SOC to dm9000 to initialize SROM_BANK
 clock.

On Sun, May 10, 2020 at 07:02:13PM +0800, zhoubo.mr@...mail.com wrote:
> From: To-run-away <zhoubo.mr@...mail.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@...00000 {
>     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 |

Powered by blists - more mailing lists