Message ID | c1f36ea96ba703540a6ba63abee29242d64daeca.1693482665.git.ante.knezic@helmholz.de |
---|---|
State | New |
Headers | show |
Series | net: dsa: microchip: enable setting rmii reference | expand |
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index 91aba470fb2f..c5df571153ab 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -1434,6 +1434,10 @@ 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) && dev->rmii_clk_internal) + ksz_cfg(dev, KSZ8863_REG_FVID_AND_HOST_MODE, + KSZ8863_PORT3_RMII_CLK_INTERNAL, true); + 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 7a57c6088f80..0a3fff7d6d32 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 KSZ8863_REG_FVID_AND_HOST_MODE 0xC6 +#define KSZ8863_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 6673122266b7..dc8cf59c6dd9 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -3631,6 +3631,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"); + 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 a4de58847dea..54589736398a 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -157,6 +157,7 @@ struct ksz_device { phy_interface_t compat_interface; bool synclko_125; bool synclko_disable; + bool rmii_clk_internal; struct vlan_table *vlan_cache;
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. Signed-off-by: Ante Knezic <ante.knezic@helmholz.de> --- drivers/net/dsa/microchip/ksz8795.c | 4 ++++ 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, 11 insertions(+)