Re: [PATCH v3 02/11] net: stmmac: dwmac-stm32: Separate out external clock rate validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/3/24 11:38, Russell King (Oracle) wrote:
On Mon, Jun 03, 2024 at 11:27:48AM +0200, Christophe Roullier wrote:
+static int stm32mp1_validate_ethck_rate(struct plat_stmmacenet_data *plat_dat)
+{
+	struct stm32_dwmac *dwmac = plat_dat->bsp_priv;
+	const u32 clk_rate = clk_get_rate(dwmac->clk_eth_ck);
+
+	switch (plat_dat->mac_interface) {
Should these be phy_interface?

Hi,

The code is validating the clock frequency of clock that are INPUT into the MAC. These clock can be generated by either the PHY, or Xtal, or some other source, but they are still the clock which are INPUT into the MAC. Therefore I believe mac_interface is correct here.

Does this clock depend on the interface
mode used with the PHY?

I don't think the clock depend on the PHY mode. Look at drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c :
"
458         plat->phy_interface = phy_mode;
459         rc = stmmac_of_get_mac_mode(np);
460         plat->mac_interface = rc < 0 ? plat->phy_interface : rc;
"
and this comment:
"
382 /**
383  * stmmac_of_get_mac_mode - retrieves the interface of the MAC
384  * @np: - device-tree node
385  * Description:
386  * Similar to `of_get_phy_mode()`, this function will retrieve (from
387  * the device-tree) the interface mode on the MAC side. This assumes
388  * that there is mode converter in-between the MAC & PHY
389  * (e.g. GMII-to-RGMII).
390  */
391 static int stmmac_of_get_mac_mode(struct device_node *np)
"
I think in the unlikely case that you would have a mode converter between the MAC and PHY, the clock that are validated by this code would still be the clock that are INPUT into the MAC, i.e. clock on the MAC side of the mode converter and NOT on the PHY side , and those clock would not depend on the PHY mode, they would depend on the MAC mode .




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux