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]
Message-ID: <20231016103708.6ka5vxfkdatrjvdk@skbuf>
Date: Mon, 16 Oct 2023 13:37:08 +0300
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 v2 1/2] net:dsa:microchip: add property to
 select internal RMII reference clock

Commit message: "net: dsa: microchip: ".

On Thu, Oct 12, 2023 at 12:55:55PM +0200, Ante Knezic wrote:
> Microchip KSZ8863/KSZ8873 have the ability to select between internal
> and external RMII reference clock. By default, reference clock
> needs to be provided via REFCLKI_3 pin. If required, device can be
> setup to provide RMII clock internally so that REFCLKI_3 pin can be
> left unconnected.
> Add a new "microchip,rmii-clk-internal" property which will set
> RMII clock reference to internal. If property is not set, reference
> clock needs to be provided externally.
> 
> Signed-off-by: Ante Knezic <ante.knezic@...mholz.de>
> ---
>  drivers/net/dsa/microchip/ksz8795.c     | 5 +++++
>  drivers/net/dsa/microchip/ksz8795_reg.h | 3 +++
>  drivers/net/dsa/microchip/ksz_common.c  | 3 +++
>  drivers/net/dsa/microchip/ksz_common.h  | 1 +
>  4 files changed, 12 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
> index 91aba470fb2f..78f3a668aa99 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -1434,6 +1434,11 @@ int ksz8_setup(struct dsa_switch *ds)
>  	for (i = 0; i < (dev->info->num_vlans / 4); i++)
>  		ksz8_r_vlan_entries(dev, i);
>  
> +	if (ksz_is_ksz88x3(dev))
> +		ksz_cfg(dev, KSZ88X3_REG_FVID_AND_HOST_MODE,
> +			KSZ88X3_PORT3_RMII_CLK_INTERNAL,
> +			dev->rmii_clk_internal);
> +

Can this be done in dev->dev_ops->phylink_mac_config() (which so far has no implementation)
for port 3 of ksz88x3?

>  	return ksz8_handle_global_errata(ds);
>  }
>  
> diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
> index 3c9dae53e4d8..beca974e0171 100644
> --- a/drivers/net/dsa/microchip/ksz8795_reg.h
> +++ b/drivers/net/dsa/microchip/ksz8795_reg.h
> @@ -22,6 +22,9 @@
>  #define KSZ8863_GLOBAL_SOFTWARE_RESET	BIT(4)
>  #define KSZ8863_PCS_RESET		BIT(0)
>  
> +#define KSZ88X3_REG_FVID_AND_HOST_MODE  0xC6
> +#define KSZ88X3_PORT3_RMII_CLK_INTERNAL BIT(3)
> +
>  #define REG_SW_CTRL_0			0x02
>  
>  #define SW_NEW_BACKOFF			BIT(7)
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index b800ace40ce1..0a0a53ce5b1b 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -4160,6 +4160,9 @@ int ksz_switch_register(struct ksz_device *dev)
>  		}
>  	}
>  
> +	dev->rmii_clk_internal = of_property_read_bool(dev->dev->of_node,
> +						       "microchip,rmii-clk-internal");

Port property.

> +
>  	ret = dsa_register_switch(dev->ds);
>  	if (ret) {
>  		dev->dev_ops->exit(dev);
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index 8842efca0871..e5b0445fe2ca 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -163,6 +163,7 @@ struct ksz_device {
>  	phy_interface_t compat_interface;
>  	bool synclko_125;
>  	bool synclko_disable;
> +	bool rmii_clk_internal;
>  
>  	struct vlan_table *vlan_cache;
>  
> -- 
> 2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ