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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 24 Nov 2023 18:11:45 +0200
From:   Vladimir Oltean <olteanv@...il.com>
To:     Ante Knezic <ante.knezic@...mholz.de>
Cc:     netdev@...r.kernel.org, woojung.huh@...rochip.com, andrew@...n.ch,
        f.fainelli@...il.com, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
        marex@...x.de, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v5 2/2] net: dsa: microchip: add property to
 select internal RMII reference clock

On Fri, Nov 24, 2023 at 05:01:48PM +0100, Ante Knezic wrote:
> +static int ksz88x3_config_rmii_clk(struct ksz_device *dev, int cpu_port)
> +{
> +	struct device_node *ports, *port, *cpu_node;
> +	bool rmii_clk_internal;
> +
> +	if (!ksz_is_ksz88x3(dev))
> +		return 0;
> +
> +	cpu_node = NULL;
> +
> +	ports = of_get_child_by_name(dev->dev->of_node, "ports");
> +	if (!ports)
> +		ports = of_get_child_by_name(dev->dev->of_node,
> +					     "ethernet-ports");
> +	if (!ports)
> +		return -ENODEV;
> +
> +	for_each_available_child_of_node(ports, port) {
> +		u32 index;
> +
> +		if (of_property_read_u32(port, "reg", &index) < 0)
> +			return -ENODEV;
> +
> +		if (index == cpu_port) {
> +			cpu_node = port;
> +			break;
> +		}
> +	}
> +
> +	if (!cpu_node)
> +		return -ENODEV;

Too much code. Assuming you have struct dsa_port *cpu_dp, you can access
cpu_dp->dn instead of re-parsing the device tree.

> +
> +	rmii_clk_internal = of_property_read_bool(cpu_node,
> +						  "microchip,rmii-clk-internal");
> +
> +	ksz_cfg(dev, KSZ88X3_REG_FVID_AND_HOST_MODE,
> +		KSZ88X3_PORT3_RMII_CLK_INTERNAL, rmii_clk_internal);
> +
> +	return 0;
> +}

Please wait for 24 hours before reposting, maybe you get more feedback.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ