Thread (23 messages) 23 messages, 4 authors, 2022-05-03

Re: [net-next v2 04/12] net: pcs: add Renesas MII converter driver

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2022-05-03 15:53:44
Also in: linux-devicetree, linux-renesas-soc, lkml

Hi Clément,

On Fri, Apr 29, 2022 at 4:36 PM Clément Léger [off-list ref] wrote:
Add a PCS driver for the MII converter that is present on the Renesas
RZ/N1 SoC. This MII converter is reponsible for converting MII to
RMII/RGMII or act as a MII pass-trough. Exposing it as a PCS allows to
reuse it in both the switch driver and the stmmac driver. Currently,
this driver only allows the PCS to be used by the dual Cortex-A7
subsystem since the register locking system is not used.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
quoted hunk ↗ jump to hunk
--- a/drivers/net/pcs/Kconfig
+++ b/drivers/net/pcs/Kconfig
@@ -18,4 +18,11 @@ config PCS_LYNX
          This module provides helpers to phylink for managing the Lynx PCS
          which is part of the Layerscape and QorIQ Ethernet SERDES.

+config PCS_RZN1_MIIC
+       tristate "Renesas RZ/N1 MII converter"
depends on ARCH_RZN1 || COMPILE_TEST
+       help
+         This module provides a driver for the MII converter that is available
+         on RZ/N1 SoCs. This PCS convert MII to RMII/RGMII or can be set in
converts
+         pass-through mode for MII.
+
quoted hunk ↗ jump to hunk
--- /dev/null
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
+static int miic_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct miic *miic;
+       u32 mode_cfg;
+       int ret;
+
+       ret = miic_parse_dt(dev, &mode_cfg);
+       if (ret < 0)
+               return -EINVAL;
+
+       miic = devm_kzalloc(dev, sizeof(*miic), GFP_KERNEL);
+       if (!miic)
+               return -ENOMEM;
+
+       spin_lock_init(&miic->lock);
+       miic->dev = dev;
+       miic->base = devm_platform_ioremap_resource(pdev, 0);
+       if (!miic->base)
+               return -EINVAL;
+
+       miic->nclk = devm_clk_bulk_get_all(dev, &miic->clks);
+       if (miic->nclk < 0)
+               return miic->nclk;
+
+       ret = clk_bulk_prepare_enable(miic->nclk, miic->clks);
+       if (ret)
+               return ret;
As you don't seem to need any knowledge about the clocks' properties,
perhaps you can use Runtime PM instead?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help