All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] MIIM regmap and RTL8231 GPIO expander support
@ 2021-04-08 20:52 Sander Vanheule
  2021-04-08 20:52 ` [RFC PATCH 1/2] regmap: add miim bus support Sander Vanheule
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Sander Vanheule @ 2021-04-08 20:52 UTC (permalink / raw)
  To: netdev, devicetree, linux-gpio, Mark Brown, Greg Kroah-Hartman,
	Rafael J . Wysocki
  Cc: bert, Sander Vanheule

The RTL8231 GPIO and LED expander can be configured for use as an MIIM or I2C
bus device. To provide uniform data access between these two modes, the regmap
interface is used. Since no regmap interface exists for MIIM busses, a basic
implementation is provided.

Currently outstanding questions:
- The REGMAP_MIIM symbol should depend on MDIO_DEVICE (or a better suited,
  related symbol), but this results in circular Kconfig dependencies:
    drivers/of/Kconfig:69:error: recursive dependency detected!
    drivers/of/Kconfig:69:	symbol OF_IRQ depends on IRQ_DOMAIN
    kernel/irq/Kconfig:59:	symbol IRQ_DOMAIN is selected by REGMAP
    drivers/base/regmap/Kconfig:7:	symbol REGMAP default is visible depending on REGMAP_MIIM
    drivers/base/regmap/Kconfig:39:	symbol REGMAP_MIIM depends on MDIO_DEVICE
    drivers/net/mdio/Kconfig:6:	symbol MDIO_DEVICE is selected by PHYLIB
    drivers/net/phy/Kconfig:16:	symbol PHYLIB is selected by ARC_EMAC_CORE
    drivers/net/ethernet/arc/Kconfig:19:	symbol ARC_EMAC_CORE is selected by ARC_EMAC
    drivers/net/ethernet/arc/Kconfig:25:	symbol ARC_EMAC depends on OF_IRQ
  Suggestions on how to resolve this are welcome.

- Providing no compatible for an MDIO child node is considered to be equivalent
  to a c22 ethernet phy, so one must be provided. However, this node is then
  not automatically probed. Is it okay to provide a binding without a driver?
  If some code is required, where should this be put?
  Current devicetree structure:
    mdio-bus {
        compatible = "vendor,mdio";
        ...

        expander0: expander@0 {
            /*
             * Provide compatible for working registration of mdio device.
             * Device probing happens in gpio1 node.
             */
            compatible = "realtek,rtl8231-expander";
            reg = <0>;
        };

    };
    gpio1 : ext_gpio {
        compatible = "realtek,rtl8231-mdio";
        gpio-controller;
        ...
    };

- MFD driver:
  The RTL8231 is not just a GPIO expander, but also a pin controller and LED
  matrix controller. Regmap initialisation could probably be moved to a parent
  MFD, with gpio, led, and pinctrl cells. Is this a hard requirement if only a
  GPIO controller is provided?

Sander Vanheule (2):
  regmap: add miim bus support
  gpio: Add Realtek RTL8231 support

 drivers/base/regmap/Kconfig       |   6 +-
 drivers/base/regmap/Makefile      |   1 +
 drivers/base/regmap/regmap-miim.c |  58 +++++
 drivers/gpio/Kconfig              |   9 +
 drivers/gpio/Makefile             |   1 +
 drivers/gpio/gpio-rtl8231.c       | 404 ++++++++++++++++++++++++++++++
 include/linux/regmap.h            |  36 +++
 7 files changed, 514 insertions(+), 1 deletion(-)
 create mode 100644 drivers/base/regmap/regmap-miim.c
 create mode 100644 drivers/gpio/gpio-rtl8231.c

-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-16 12:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 20:52 [RFC PATCH 0/2] MIIM regmap and RTL8231 GPIO expander support Sander Vanheule
2021-04-08 20:52 ` [RFC PATCH 1/2] regmap: add miim bus support Sander Vanheule
2021-04-09 16:07   ` Mark Brown
2021-04-09 18:14     ` Sander Vanheule
2021-04-09 18:16       ` Mark Brown
2021-04-09 19:44         ` Andrew Lunn
2021-04-08 20:52 ` [RFC PATCH 2/2] gpio: Add Realtek RTL8231 support Sander Vanheule
2021-04-08 22:18 ` [RFC PATCH 0/2] MIIM regmap and RTL8231 GPIO expander support Andrew Lunn
2021-04-09  5:42   ` Sander Vanheule
2021-04-09 20:10     ` Andrew Lunn
2021-04-16 12:01       ` Sander Vanheule

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.