Message ID | 20240528062008.1594657-3-vineeth.karumanchi@amd.com (mailing list archive) |
---|---|
State | Accepted |
Commit | daab0ac53e774f14ea78a1849358dbefb0d3efd2 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: xilinx_gmii2rgmii: Add clock support | expand |
On 28.05.2024 08:20, Vineeth Karumanchi wrote: > Add clock support to the gmii_to_rgmii IP. > Make clk optional to keep DTB backward compatibility. > > Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com> > --- Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com> > drivers/net/phy/xilinx_gmii2rgmii.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c > index 7b1bc5fcef9b..7c51daecf18e 100644 > --- a/drivers/net/phy/xilinx_gmii2rgmii.c > +++ b/drivers/net/phy/xilinx_gmii2rgmii.c > @@ -15,6 +15,7 @@ > #include <linux/mii.h> > #include <linux/mdio.h> > #include <linux/phy.h> > +#include <linux/clk.h> > #include <linux/of_mdio.h> > > #define XILINX_GMII2RGMII_REG 0x10 > @@ -85,11 +86,17 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) > struct device *dev = &mdiodev->dev; > struct device_node *np = dev->of_node, *phy_node; > struct gmii2rgmii *priv; > + struct clk *clkin; > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > return -ENOMEM; > > + clkin = devm_clk_get_optional_enabled(dev, NULL); > + if (IS_ERR(clkin)) > + return dev_err_probe(dev, PTR_ERR(clkin), > + "Failed to get and enable clock from Device Tree\n"); > + > phy_node = of_parse_phandle(np, "phy-handle", 0); > if (!phy_node) { > dev_err(dev, "Couldn't parse phy-handle\n");
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 7b1bc5fcef9b..7c51daecf18e 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -15,6 +15,7 @@ #include <linux/mii.h> #include <linux/mdio.h> #include <linux/phy.h> +#include <linux/clk.h> #include <linux/of_mdio.h> #define XILINX_GMII2RGMII_REG 0x10 @@ -85,11 +86,17 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) struct device *dev = &mdiodev->dev; struct device_node *np = dev->of_node, *phy_node; struct gmii2rgmii *priv; + struct clk *clkin; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + clkin = devm_clk_get_optional_enabled(dev, NULL); + if (IS_ERR(clkin)) + return dev_err_probe(dev, PTR_ERR(clkin), + "Failed to get and enable clock from Device Tree\n"); + phy_node = of_parse_phandle(np, "phy-handle", 0); if (!phy_node) { dev_err(dev, "Couldn't parse phy-handle\n");
Add clock support to the gmii_to_rgmii IP. Make clk optional to keep DTB backward compatibility. Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com> --- drivers/net/phy/xilinx_gmii2rgmii.c | 7 +++++++ 1 file changed, 7 insertions(+)