On Sun, Nov 08, 2026 at 11:06:52AM +0100, Vincent Jardin via B4 Relay wrote: > From: Vincent Jardin <[email protected]> > > The LX2160A muxes its IIC, XSPI, SDHC, UART, IRQ and EVT pads from > fields of the RCW, read-only in RCWSR12..14 of DCFG and changed at > runtime through the same fields of the override registers in its DCSR > view, which read 0 until written. > > Since commit 8a1365c7bbc1 ("arm64: dts: lx2160a: add pinmux and i2c > gpio to support bus recovery") Linux drives them with pinctrl-single on > the override registers, so its first pin state clears every other field > of the word: a board whose RCW programs a non-zero pad mux loses those > pads at the first I2C probe. > > Add a driver for the pad mux as a child of the DCFG node: the fields > of RCWSR12..14 and their encoding. > Then pin states select them with the generic function and groups > properties, and every change goes through the RCW override > of fsl-guts, which reads the status register, writes the override and > waits for the status register to follow. > > Signed-off-by: Vincent Jardin <[email protected]> > --- > MAINTAINERS | 7 + > drivers/pinctrl/freescale/Kconfig | 15 ++ > drivers/pinctrl/freescale/Makefile | 1 + > drivers/pinctrl/freescale/pinctrl-lx2160a.c | 355 > ++++++++++++++++++++++++++++ > 4 files changed, 378 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 93abbb315065..6c488605f5da 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -20207,6 +20207,13 @@ F: Documentation/devicetree/bindings/clock/*imx* > F: drivers/clk/imx/ > F: include/dt-bindings/clock/*imx* > > +NXP LX2160A RCW PAD-MUX DRIVER > +M: Vincent Jardin <[email protected]> > +L: [email protected]
Add [email protected] > +S: Maintained > +F: Documentation/devicetree/bindings/pinctrl/fsl,lx2160a-rcw-pinmux.yaml > +F: drivers/pinctrl/freescale/pinctrl-lx2160a.c > + > NXP NETC ETHERNET SWITCH DRIVER > M: Wei Fang <[email protected]> > R: Clark Wang <[email protected]> > diff --git a/drivers/pinctrl/freescale/Kconfig > b/drivers/pinctrl/freescale/Kconfig > index fd53cf5bb843..a3222714c970 100644 > --- a/drivers/pinctrl/freescale/Kconfig > +++ b/drivers/pinctrl/freescale/Kconfig > @@ -283,3 +283,18 @@ config PINCTRL_IMXRT1170 > select PINCTRL_IMX > help > Say Y here to enable the imxrt1170 pinctrl driver > + > +config PINCTRL_LX2160A > + bool "NXP LX2160A RCW pad-mux driver" > + depends on OF > + depends on ARCH_LAYERSCAPE || COMPILE_TEST > + default ARCH_LAYERSCAPE > + select FSL_GUTS > + select GENERIC_PINCTRL_GROUPS > + select GENERIC_PINMUX_FUNCTIONS > + select GENERIC_PINCONF > + help > + Say Y here to mux the IIC, XSPI, SDHC, UART, IRQ and EVT pads of the > + LX2160A at runtime. The pads are muxed by fields of the RCW: > + the driver changes it in the DCSR view of the DCFG that fsl-guts > + drives, and is what the I2C bus recovery of the LX2160A needs. > diff --git a/drivers/pinctrl/freescale/Makefile > b/drivers/pinctrl/freescale/Makefile > index d27085c2b4c4..5ec0d1710ad5 100644 > --- a/drivers/pinctrl/freescale/Makefile > +++ b/drivers/pinctrl/freescale/Makefile > @@ -35,3 +35,4 @@ obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o > obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o > obj-$(CONFIG_PINCTRL_IMXRT1050) += pinctrl-imxrt1050.o > obj-$(CONFIG_PINCTRL_IMXRT1170) += pinctrl-imxrt1170.o > +obj-$(CONFIG_PINCTRL_LX2160A) += pinctrl-lx2160a.o > diff --git a/drivers/pinctrl/freescale/pinctrl-lx2160a.c > b/drivers/pinctrl/freescale/pinctrl-lx2160a.c > new file mode 100644 > index 000000000000..ba5bbcfab9fd > --- /dev/null > +++ b/drivers/pinctrl/freescale/pinctrl-lx2160a.c > @@ -0,0 +1,355 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * LX2160A pad muxes: fields of the RCW, changed at > + * runtime. > + * > + * Copyright 2026 Free Mobile - Vincent Jardin > + */ > + > +#include <linux/bits.h> > +#include <linux/fsl/guts.h> > +#include <linux/module.h> > +#include <linux/of.h> > +#include <linux/pinctrl/pinconf-generic.h> > +#include <linux/pinctrl/pinctrl.h> > +#include <linux/pinctrl/pinmux.h> > +#include <linux/platform_device.h> > +#include <linux/seq_file.h> > + > +#include "../core.h" > +#include "../pinmux.h" > + > +struct lx2160a_pmux_func { > + const char *name; > + u8 val; > +}; > + > +struct lx2160a_pmux_group { > + const char *name; > + u8 rcwsr; /* 12..14 */ > + u8 shift; > + u8 width; > + const struct lx2160a_pmux_func *funcs; > + u8 nfuncs; > +}; > + > +#define FUNC(_name, _val) { .name = _name, .val = _val } > +#define GROUP(_name, _rcwsr, _shift, _width, _funcs) \ The name is too common and short, easy happen name collision. Frank
