RE: [PATCH 2/2] ARM64: dts: Remove unused properties from FSL QSPI nodes
Hi Shawn/Leo, Removing the "big-endian" property has caused problems in our UEFI firmware. In UEFI, we use the device tree to detect and use the qspi controller and flashes attached to it. We don't maintain a list of platforms like linux driver. Can you please revert the endianness change from linux mainline ? Regards, Pankaj Bansal > -Original Message- > From: devicetree-ow...@vger.kernel.org > On Behalf Of Schrempf Frieder > Sent: Wednesday, 20 March, 2019 08:08 PM > To: Shawn Guo ; Leo Li > Cc: Schrempf Frieder ; Rob Herring > ; Mark Rutland ; linux-arm- > ker...@lists.infradead.org; devicet...@vger.kernel.org; linux- > ker...@vger.kernel.org > Subject: [PATCH 2/2] ARM64: dts: Remove unused properties from FSL QSPI > nodes > > From: Frieder Schrempf > > After switching to the new FSL QSPI driver the properties > 'fsl,qspi-has-second- > chip' and 'big-endian' are not used anymore. > > The driver now uses the 'reg' property to determine the bus and the > chipselect. > The endianness is selected by the driver depending on which SoC is used. > > Signed-off-by: Frieder Schrempf > --- > arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 1 - > arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 2 -- > 2 files changed, 3 deletions(-) > > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi > b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi > index 6fd6116509cc..2fb8138c6bb0 100644 > --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi > @@ -296,7 +296,6 @@ > interrupts = <0 99 0x4>; > clock-names = "qspi_en", "qspi"; > clocks = < 4 0>, < 4 0>; > - big-endian; > status = "disabled"; > }; > > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi > b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi > index cb7185014d3a..b0ef08b090dd 100644 > --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi > @@ -215,8 +215,6 @@ > interrupts = ; > clock-names = "qspi_en", "qspi"; > clocks = < 4 1>, < 4 1>; > - big-endian; > - fsl,qspi-has-second-chip; > status = "disabled"; > }; > > -- > 2.17.1
RE: [PATCH v6 2/2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
HI Peter, Have these changes been applied in any linux branch? I did not see these changes in https://elixir.bootlin.com/linux/v5.1-rc5/source/drivers/mux/mmio.c#L46 Regards, Pankaj Bansal > -Original Message- > From: Pankaj Bansal [mailto:pankaj.ban...@nxp.com] > Sent: Thursday, 28 February, 2019 07:38 PM > To: Leo Li ; Peter Rosin > Cc: Pankaj Bansal ; linux-kernel@vger.kernel.org > Subject: [PATCH v6 2/2] drivers: mux: Add Generic regmap bitfield-based > multiplexer in mmio-mux > > Generic register bitfield-based multiplexer that controls the multiplexer > producer > defined under a parent node. > The driver corresponding to parent node provides register read/write > capabilities. > > Signed-off-by: Pankaj Bansal > --- > > Notes: > V6: > - No Change > V5: > - No Change > V4: > - As per Peter's suggestion fixup the NULL from dev_get_regmap as early as > possible using ternary operator. > V3: > - Added the patch in series with device tree binding patch > - Added the NULL return handling for regmap > V2: > - removed seperate driver regmap.c and added the regmap function in mmio.c > based on compatible field, the syscon or regmap function would be called > - Modified the KConfig as per Peter's comments > > drivers/mux/Kconfig | 12 ++-- > drivers/mux/mmio.c | 6 +- > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index > 7659d6c5f718..e5c571fd232c 100644 > --- a/drivers/mux/Kconfig > +++ b/drivers/mux/Kconfig > @@ -46,14 +46,14 @@ config MUX_GPIO > be called mux-gpio. > > config MUX_MMIO > - tristate "MMIO register bitfield-controlled Multiplexer" > - depends on (OF && MFD_SYSCON) || COMPILE_TEST > + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" > + depends on OF || COMPILE_TEST > help > - MMIO register bitfield-controlled Multiplexer controller. > + MMIO/Regmap register bitfield-controlled Multiplexer controller. > > - The driver builds multiplexer controllers for bitfields in a syscon > - register. For N bit wide bitfields, there will be 2^N possible > - multiplexer states. > + The driver builds multiplexer controllers for bitfields in either > + a syscon register or a driver regmap register. For N bit wide > + bitfields, there will be 2^N possible multiplexer states. > > To compile the driver as a module, choose M here: the module will > be called mux-mmio. > diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index > 935ac44aa209..44a7a0e885b8 100644 > --- a/drivers/mux/mmio.c > +++ b/drivers/mux/mmio.c > @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { > > static const struct of_device_id mux_mmio_dt_ids[] = { > { .compatible = "mmio-mux", }, > + { .compatible = "reg-mux", }, > { /* sentinel */ } > }; > MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,7 +44,10 @@ static > int mux_mmio_probe(struct platform_device *pdev) > int ret; > int i; > > - regmap = syscon_node_to_regmap(np->parent); > + if (of_device_is_compatible(np, "mmio-mux")) > + regmap = syscon_node_to_regmap(np->parent); > + else > + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(- > ENODEV); > if (IS_ERR(regmap)) { > ret = PTR_ERR(regmap); > dev_err(dev, "failed to get regmap: %d\n", ret); > -- > 2.17.1
[PATCH v6 2/2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
Generic register bitfield-based multiplexer that controls the multiplexer producer defined under a parent node. The driver corresponding to parent node provides register read/write capabilities. Signed-off-by: Pankaj Bansal --- Notes: V6: - No Change V5: - No Change V4: - As per Peter's suggestion fixup the NULL from dev_get_regmap as early as possible using ternary operator. V3: - Added the patch in series with device tree binding patch - Added the NULL return handling for regmap V2: - removed seperate driver regmap.c and added the regmap function in mmio.c based on compatible field, the syscon or regmap function would be called - Modified the KConfig as per Peter's comments drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 6 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index 7659d6c5f718..e5c571fd232c 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -46,14 +46,14 @@ config MUX_GPIO be called mux-gpio. config MUX_MMIO - tristate "MMIO register bitfield-controlled Multiplexer" - depends on (OF && MFD_SYSCON) || COMPILE_TEST + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" + depends on OF || COMPILE_TEST help - MMIO register bitfield-controlled Multiplexer controller. + MMIO/Regmap register bitfield-controlled Multiplexer controller. - The driver builds multiplexer controllers for bitfields in a syscon - register. For N bit wide bitfields, there will be 2^N possible - multiplexer states. + The driver builds multiplexer controllers for bitfields in either + a syscon register or a driver regmap register. For N bit wide + bitfields, there will be 2^N possible multiplexer states. To compile the driver as a module, choose M here: the module will be called mux-mmio. diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 935ac44aa209..44a7a0e885b8 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { static const struct of_device_id mux_mmio_dt_ids[] = { { .compatible = "mmio-mux", }, + { .compatible = "reg-mux", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,7 +44,10 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - regmap = syscon_node_to_regmap(np->parent); + if (of_device_is_compatible(np, "mmio-mux")) + regmap = syscon_node_to_regmap(np->parent); + else + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); dev_err(dev, "failed to get regmap: %d\n", ret); -- 2.17.1
[PATCH v5 2/2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
Generic register bitfield-based multiplexer that controls the multiplexer producer defined under a parent node. The driver corresponding to parent node provides register read/write capabilities. Signed-off-by: Pankaj Bansal --- Notes: V5: - No Change V4: - As per Peter's suggestion fixup the NULL from dev_get_regmap as early as possible using ternary operator. V3: - Added the patch in series with device tree binding patch - Added the NULL return handling for regmap V2: - removed seperate driver regmap.c and added the regmap function in mmio.c based on compatible field, the syscon or regmap function would be called - Modified the KConfig as per Peter's comments drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 6 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index 7659d6c5f718..e5c571fd232c 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -46,14 +46,14 @@ config MUX_GPIO be called mux-gpio. config MUX_MMIO - tristate "MMIO register bitfield-controlled Multiplexer" - depends on (OF && MFD_SYSCON) || COMPILE_TEST + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" + depends on OF || COMPILE_TEST help - MMIO register bitfield-controlled Multiplexer controller. + MMIO/Regmap register bitfield-controlled Multiplexer controller. - The driver builds multiplexer controllers for bitfields in a syscon - register. For N bit wide bitfields, there will be 2^N possible - multiplexer states. + The driver builds multiplexer controllers for bitfields in either + a syscon register or a driver regmap register. For N bit wide + bitfields, there will be 2^N possible multiplexer states. To compile the driver as a module, choose M here: the module will be called mux-mmio. diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 935ac44aa209..44a7a0e885b8 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { static const struct of_device_id mux_mmio_dt_ids[] = { { .compatible = "mmio-mux", }, + { .compatible = "reg-mux", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,7 +44,10 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - regmap = syscon_node_to_regmap(np->parent); + if (of_device_is_compatible(np, "mmio-mux")) + regmap = syscon_node_to_regmap(np->parent); + else + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); dev_err(dev, "failed to get regmap: %d\n", ret); -- 2.17.1
[PATCH v4 2/2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
Generic register bitfield-based multiplexer that controls the multiplexer producer defined under a parent node. The driver corresponding to parent node provides register read/write capabilities. Signed-off-by: Pankaj Bansal --- Notes: V4: - As per Peter's suggestion fixup the NULL from dev_get_regmap as early as possible using ternary operator. V3: - Added the patch in series with device tree binding patch - Added the NULL return handling for regmap V2: - removed seperate driver regmap.c and added the regmap function in mmio.c based on compatible field, the syscon or regmap function would be called - Modified the KConfig as per Peter's comments drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 6 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index 7659d6c5f718..e5c571fd232c 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -46,14 +46,14 @@ config MUX_GPIO be called mux-gpio. config MUX_MMIO - tristate "MMIO register bitfield-controlled Multiplexer" - depends on (OF && MFD_SYSCON) || COMPILE_TEST + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" + depends on OF || COMPILE_TEST help - MMIO register bitfield-controlled Multiplexer controller. + MMIO/Regmap register bitfield-controlled Multiplexer controller. - The driver builds multiplexer controllers for bitfields in a syscon - register. For N bit wide bitfields, there will be 2^N possible - multiplexer states. + The driver builds multiplexer controllers for bitfields in either + a syscon register or a driver regmap register. For N bit wide + bitfields, there will be 2^N possible multiplexer states. To compile the driver as a module, choose M here: the module will be called mux-mmio. diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 935ac44aa209..44a7a0e885b8 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { static const struct of_device_id mux_mmio_dt_ids[] = { { .compatible = "mmio-mux", }, + { .compatible = "reg-mux", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,7 +44,10 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - regmap = syscon_node_to_regmap(np->parent); + if (of_device_is_compatible(np, "mmio-mux")) + regmap = syscon_node_to_regmap(np->parent); + else + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); dev_err(dev, "failed to get regmap: %d\n", ret); -- 2.17.1
RE: [PATCH v3 2/2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
Hi Peter, > -Original Message- > From: Peter Rosin [mailto:p...@axentia.se] > Sent: Monday, 25 February, 2019 08:14 PM > To: Pankaj Bansal ; Leo Li > Cc: linux-kernel@vger.kernel.org > Subject: Re: [PATCH v3 2/2] drivers: mux: Add Generic regmap bitfield-based > multiplexer in mmio-mux > > On 2019-02-24 09:27, Pankaj Bansal wrote: > > Generic register bitfield-based multiplexer that controls the > > multiplexer producer defined under a parent node. > > The driver corresponding to parent node provides register read/write > > capabilities. > > > > Signed-off-by: Pankaj Bansal > > --- > > > > Notes: > > V3: > > - Added the patch in series with device tree binding patch > > - Added the NULL return handling for regmap > > V2: > > - removed seperate driver regmap.c and added the regmap function in > mmio.c > > based on compatible field, the syscon or regmap function would be > > called > > - Modified the KConfig as per Peter's comments > > > > drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 10 > > +++--- > > 2 files changed, 13 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index > > 7659d6c5f718..e5c571fd232c 100644 > > --- a/drivers/mux/Kconfig > > +++ b/drivers/mux/Kconfig > > @@ -46,14 +46,14 @@ config MUX_GPIO > > be called mux-gpio. > > > > config MUX_MMIO > > - tristate "MMIO register bitfield-controlled Multiplexer" > > - depends on (OF && MFD_SYSCON) || COMPILE_TEST > > + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" > > + depends on OF || COMPILE_TEST > > help > > - MMIO register bitfield-controlled Multiplexer controller. > > + MMIO/Regmap register bitfield-controlled Multiplexer controller. > > > > - The driver builds multiplexer controllers for bitfields in a syscon > > - register. For N bit wide bitfields, there will be 2^N possible > > - multiplexer states. > > + The driver builds multiplexer controllers for bitfields in either > > + a syscon register or a driver regmap register. For N bit wide > > + bitfields, there will be 2^N possible multiplexer states. > > > > To compile the driver as a module, choose M here: the module will > > be called mux-mmio. > > diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index > > 935ac44aa209..cc02155e4644 100644 > > --- a/drivers/mux/mmio.c > > +++ b/drivers/mux/mmio.c > > @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { > > > > static const struct of_device_id mux_mmio_dt_ids[] = { > > { .compatible = "mmio-mux", }, > > + { .compatible = "reg-mux", }, > > { /* sentinel */ } > > }; > > MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,9 +44,12 @@ > static > > int mux_mmio_probe(struct platform_device *pdev) > > int ret; > > int i; > > > > - regmap = syscon_node_to_regmap(np->parent); > > - if (IS_ERR(regmap)) { > > - ret = PTR_ERR(regmap); > > + if (of_device_is_compatible(np, "mmio-mux")) > > + regmap = syscon_node_to_regmap(np->parent); > > + else > > + regmap = dev_get_regmap(dev->parent, NULL); > > + if (IS_ERR_OR_NULL(regmap)) { > > + ret = PTR_ERR_OR_ZERO(regmap) ? PTR_ERR(regmap) : - > ENODEV; > > The above is not correct, this should be better (untested): > > ret = PTR_ERR(regmap) ?: -ENODEV; Omitting the second operand in ternary operator is not standard. https://stackoverflow.com/questions/34559705/ternary-operator-without-the-middle-expression Although, it *has been* used in kernel in many places https://livegrep.com/search/linux?q=file%3A%5C.c%24%20%5C%3F%5C%3A_case=auto=true=true > > Cheers, > Peter > > > dev_err(dev, "failed to get regmap: %d\n", ret); > > return ret; > > } > >
[PATCH v3 2/2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
Generic register bitfield-based multiplexer that controls the multiplexer producer defined under a parent node. The driver corresponding to parent node provides register read/write capabilities. Signed-off-by: Pankaj Bansal --- Notes: V3: - Added the patch in series with device tree binding patch - Added the NULL return handling for regmap V2: - removed seperate driver regmap.c and added the regmap function in mmio.c based on compatible field, the syscon or regmap function would be called - Modified the KConfig as per Peter's comments drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 10 +++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index 7659d6c5f718..e5c571fd232c 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -46,14 +46,14 @@ config MUX_GPIO be called mux-gpio. config MUX_MMIO - tristate "MMIO register bitfield-controlled Multiplexer" - depends on (OF && MFD_SYSCON) || COMPILE_TEST + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" + depends on OF || COMPILE_TEST help - MMIO register bitfield-controlled Multiplexer controller. + MMIO/Regmap register bitfield-controlled Multiplexer controller. - The driver builds multiplexer controllers for bitfields in a syscon - register. For N bit wide bitfields, there will be 2^N possible - multiplexer states. + The driver builds multiplexer controllers for bitfields in either + a syscon register or a driver regmap register. For N bit wide + bitfields, there will be 2^N possible multiplexer states. To compile the driver as a module, choose M here: the module will be called mux-mmio. diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 935ac44aa209..cc02155e4644 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { static const struct of_device_id mux_mmio_dt_ids[] = { { .compatible = "mmio-mux", }, + { .compatible = "reg-mux", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,9 +44,12 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - regmap = syscon_node_to_regmap(np->parent); - if (IS_ERR(regmap)) { - ret = PTR_ERR(regmap); + if (of_device_is_compatible(np, "mmio-mux")) + regmap = syscon_node_to_regmap(np->parent); + else + regmap = dev_get_regmap(dev->parent, NULL); + if (IS_ERR_OR_NULL(regmap)) { + ret = PTR_ERR_OR_ZERO(regmap) ? PTR_ERR(regmap) : -ENODEV; dev_err(dev, "failed to get regmap: %d\n", ret); return ret; } -- 2.17.1
RE: [PATCH v2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
> -Original Message- > From: Peter Rosin [mailto:p...@axentia.se] > Sent: Thursday, 21 February, 2019 07:12 PM > To: Pankaj Bansal ; Leo Li > Cc: linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2] drivers: mux: Add Generic regmap bitfield-based > multiplexer in mmio-mux > > Hi! > > Much better, thanks! One nit below: > > On 2019-02-21 13:48, Pankaj Bansal wrote: > > Generic register bitfield-based multiplexer that controls the > > multiplexer producer defined under a parent node. > > The driver corresponding to parent node provides register read/write > > capabilities. > > > > Signed-off-by: Pankaj Bansal > > --- > > > > Notes: > > V2: > > - removed seperate driver regmap.c and added the regmap function in > mmio.c > > based on compatible field, the syscon or regmap function would be > > called > > - Modified the KConfig as per Peter's comments > > > > drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 6 > > +- > > 2 files changed, 11 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index > > 7659d6c5f718..e5c571fd232c 100644 > > --- a/drivers/mux/Kconfig > > +++ b/drivers/mux/Kconfig > > @@ -46,14 +46,14 @@ config MUX_GPIO > > be called mux-gpio. > > > > config MUX_MMIO > > - tristate "MMIO register bitfield-controlled Multiplexer" > > - depends on (OF && MFD_SYSCON) || COMPILE_TEST > > + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" > > + depends on OF || COMPILE_TEST > > help > > - MMIO register bitfield-controlled Multiplexer controller. > > + MMIO/Regmap register bitfield-controlled Multiplexer controller. > > > > - The driver builds multiplexer controllers for bitfields in a syscon > > - register. For N bit wide bitfields, there will be 2^N possible > > - multiplexer states. > > + The driver builds multiplexer controllers for bitfields in either > > + a syscon register or a driver regmap register. For N bit wide > > + bitfields, there will be 2^N possible multiplexer states. > > > > To compile the driver as a module, choose M here: the module will > > be called mux-mmio. > > diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index > > 935ac44aa209..37fbcde7f1fc 100644 > > --- a/drivers/mux/mmio.c > > +++ b/drivers/mux/mmio.c > > @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { > > > > static const struct of_device_id mux_mmio_dt_ids[] = { > > { .compatible = "mmio-mux", }, > > + { .compatible = "reg-mux", }, > > { /* sentinel */ } > > }; > > MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,7 +44,10 @@ > static > > int mux_mmio_probe(struct platform_device *pdev) > > int ret; > > int i; > > > > - regmap = syscon_node_to_regmap(np->parent); > > + if (of_device_is_compatible(np, "mmio-mux")) > > + regmap = syscon_node_to_regmap(np->parent); > > + else > > + regmap = dev_get_regmap(dev->parent, NULL); > > dev_get_regmap() returns NULL on failure, so I think you need something like: > > regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(- > EINVAL); > > Or perhaps -ENODEV, -ENOTSUPP or something, not sure? How about IS_ERR_OR_NULL just below this, where right now IS_ERR is being used ? > > Cheers, > Peter > > > if (IS_ERR(regmap)) { > > ret = PTR_ERR(regmap); > > dev_err(dev, "failed to get regmap: %d\n", ret); > >
[PATCH v2] drivers: mux: Add Generic regmap bitfield-based multiplexer in mmio-mux
Generic register bitfield-based multiplexer that controls the multiplexer producer defined under a parent node. The driver corresponding to parent node provides register read/write capabilities. Signed-off-by: Pankaj Bansal --- Notes: V2: - removed seperate driver regmap.c and added the regmap function in mmio.c based on compatible field, the syscon or regmap function would be called - Modified the KConfig as per Peter's comments drivers/mux/Kconfig | 12 ++-- drivers/mux/mmio.c | 6 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index 7659d6c5f718..e5c571fd232c 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -46,14 +46,14 @@ config MUX_GPIO be called mux-gpio. config MUX_MMIO - tristate "MMIO register bitfield-controlled Multiplexer" - depends on (OF && MFD_SYSCON) || COMPILE_TEST + tristate "MMIO/Regmap register bitfield-controlled Multiplexer" + depends on OF || COMPILE_TEST help - MMIO register bitfield-controlled Multiplexer controller. + MMIO/Regmap register bitfield-controlled Multiplexer controller. - The driver builds multiplexer controllers for bitfields in a syscon - register. For N bit wide bitfields, there will be 2^N possible - multiplexer states. + The driver builds multiplexer controllers for bitfields in either + a syscon register or a driver regmap register. For N bit wide + bitfields, there will be 2^N possible multiplexer states. To compile the driver as a module, choose M here: the module will be called mux-mmio. diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 935ac44aa209..37fbcde7f1fc 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -28,6 +28,7 @@ static const struct mux_control_ops mux_mmio_ops = { static const struct of_device_id mux_mmio_dt_ids[] = { { .compatible = "mmio-mux", }, + { .compatible = "reg-mux", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids); @@ -43,7 +44,10 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - regmap = syscon_node_to_regmap(np->parent); + if (of_device_is_compatible(np, "mmio-mux")) + regmap = syscon_node_to_regmap(np->parent); + else + regmap = dev_get_regmap(dev->parent, NULL); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); dev_err(dev, "failed to get regmap: %d\n", ret); -- 2.17.1
RE: [PATCH] drivers: mux: Generic register bitfield-based multiplexer driver
Hi Peter, > -Original Message- > From: Peter Rosin [mailto:p...@axentia.se] > Sent: Monday, 18 February, 2019 03:17 PM > To: Pankaj Bansal ; Leo Li ; > linux-kernel@vger.kernel.org; Philipp Zabel > Subject: Re: [PATCH] drivers: mux: Generic register bitfield-based multiplexer > driver > > Hi! > > On 2019-02-18 06:40, Pankaj Bansal wrote: > > Generic register bitfield-based multiplexer driver that controls the > > multiplexer producer defined under a parent node. > > The driver corresponding to parent node provides register read/write > > capabilities. > > This driver is just a rename of drivers/mux/mmio.c with a one-liner on top. > And > there's a license change too. That's obnoxious. Please keep this as GPL v2. > Not > that I /think/ Philipp nor Pengutronix cares deeply, but what do I know? > Changing the license as you copy the code is simply not all right. My Apologies. I will fix it as I send V2. > > Anyway, I would prefer if you could extend drivers/mux/mmio.c to support both > compatibles, and using the compatible to select if > > regmap = syscon_node_to_regmap(np->parent); > > or > > regmap = dev_get_regmap(dev->parent, NULL); > > is called to get to the desired regmap. This can be done. The name mmio.c however suggests that mux is controlled by a Memory mapped device. IMO, if the generic regmap API is to be added to it, the name needs to changed. Any suggestions ? > > Philipp, you don't object to extending the mmio driver, right? > > Or are there more differences that I failed to notice? Nope, it's the only difference. > > Cheers, > Peter > > > > > Signed-off-by: Pankaj Bansal > > --- > > > > Notes: > > Dependencies: > > - > > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpat > > > chwork.ozlabs.org%2Fpatch%2F1043790%2Fdata=02%7C01%7Cpankaj.b > ansa > > > l%40nxp.com%7C3b8a1e8520ce4345105108d695861210%7C686ea1d3bc2b4c6f > a92cd > > > 99c5c301635%7C0%7C0%7C636860800396857042sdata=5e%2BhyasYwf > uc%2Fbr > > 1u6WKlKybYipz5c4ndBeLZDflHqk%3Dreserved=0 > > > > drivers/mux/Kconfig | 13 > > drivers/mux/Makefile | 2 + > > drivers/mux/regmap.c | 139 > + > > 3 files changed, 154 insertions(+) > > > > diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index > > 7659d6c5f718..a412d0955258 100644 > > --- a/drivers/mux/Kconfig > > +++ b/drivers/mux/Kconfig > > @@ -58,4 +58,17 @@ config MUX_MMIO > > To compile the driver as a module, choose M here: the module will > > be called mux-mmio. > > > > +config MUX_REGMAP > > + tristate "Regmap register bitfield-controlled Multiplexer" > > + depends on (OF && REGMAP) || COMPILE_TEST > > + help > > + Regmap register bitfield-controlled Multiplexer controller. > > + > > + The driver builds multiplexer controllers for bitfields in a regmap > > + device register. For N bit wide bitfields, there will be 2^N possible > > + multiplexer states. > > + > > + To compile the driver as a module, choose M here: the module will > > + be called regmap-mmio. > > + > > endmenu > > diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile index > > 6e9fa47daf56..ae1bafac0cbd 100644 > > --- a/drivers/mux/Makefile > > +++ b/drivers/mux/Makefile > > @@ -8,9 +8,11 @@ mux-adg792a-objs := adg792a.o > > mux-adgs1408-objs := adgs1408.o > > mux-gpio-objs := gpio.o > > mux-mmio-objs := mmio.o > > +mux-regmap-objs:= regmap.o > > > > obj-$(CONFIG_MULTIPLEXER) += mux-core.o > > obj-$(CONFIG_MUX_ADG792A) += mux-adg792a.o > > obj-$(CONFIG_MUX_ADGS1408) += mux-adgs1408.o > > obj-$(CONFIG_MUX_GPIO) += mux-gpio.o > > obj-$(CONFIG_MUX_MMIO) += mux-mmio.o > > +obj-$(CONFIG_MUX_REGMAP) += mux-regmap.o > > diff --git a/drivers/mux/regmap.c b/drivers/mux/regmap.c new file mode > > 100644 index ..c2156302929a > > --- /dev/null > > +++ b/drivers/mux/regmap.c > > @@ -0,0 +1,139 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Regmap register bitfield-controlled multiplexer driver > > + * > > + * Based on drivers/mux/mmio.c > > + * > > + * Copyright 2019 NXP > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#inclu
FW: [PATCH] drivers: mux: Generic register bitfield-based multiplexer driver
Cc: linux-kernel@vger.kernel.org > -Original Message- > From: Pankaj Bansal [mailto:pankaj.ban...@nxp.com] > Sent: Monday, 18 February, 2019 11:10 AM > To: Leo Li ; Peter Rosin > Cc: Pankaj Bansal > Subject: [PATCH] drivers: mux: Generic register bitfield-based multiplexer > driver > > Generic register bitfield-based multiplexer driver that controls the > multiplexer > producer defined under a parent node. > The driver corresponding to parent node provides register read/write > capabilities. > > Signed-off-by: Pankaj Bansal > --- > > Notes: > Dependencies: > - https://patchwork.ozlabs.org/patch/1043790/ > > drivers/mux/Kconfig | 13 > drivers/mux/Makefile | 2 + > drivers/mux/regmap.c | 139 + > 3 files changed, 154 insertions(+) > > diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index > 7659d6c5f718..a412d0955258 100644 > --- a/drivers/mux/Kconfig > +++ b/drivers/mux/Kconfig > @@ -58,4 +58,17 @@ config MUX_MMIO > To compile the driver as a module, choose M here: the module will > be called mux-mmio. > > +config MUX_REGMAP > + tristate "Regmap register bitfield-controlled Multiplexer" > + depends on (OF && REGMAP) || COMPILE_TEST > + help > + Regmap register bitfield-controlled Multiplexer controller. > + > + The driver builds multiplexer controllers for bitfields in a regmap > + device register. For N bit wide bitfields, there will be 2^N possible > + multiplexer states. > + > + To compile the driver as a module, choose M here: the module will > + be called regmap-mmio. > + > endmenu > diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile index > 6e9fa47daf56..ae1bafac0cbd 100644 > --- a/drivers/mux/Makefile > +++ b/drivers/mux/Makefile > @@ -8,9 +8,11 @@ mux-adg792a-objs := adg792a.o > mux-adgs1408-objs:= adgs1408.o > mux-gpio-objs:= gpio.o > mux-mmio-objs:= mmio.o > +mux-regmap-objs := regmap.o > > obj-$(CONFIG_MULTIPLEXER)+= mux-core.o > obj-$(CONFIG_MUX_ADG792A)+= mux-adg792a.o > obj-$(CONFIG_MUX_ADGS1408) += mux-adgs1408.o > obj-$(CONFIG_MUX_GPIO) += mux-gpio.o > obj-$(CONFIG_MUX_MMIO) += mux-mmio.o > +obj-$(CONFIG_MUX_REGMAP) += mux-regmap.o > diff --git a/drivers/mux/regmap.c b/drivers/mux/regmap.c new file mode > 100644 index ..c2156302929a > --- /dev/null > +++ b/drivers/mux/regmap.c > @@ -0,0 +1,139 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Regmap register bitfield-controlled multiplexer driver > + * > + * Based on drivers/mux/mmio.c > + * > + * Copyright 2019 NXP > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static int mux_regmap_set(struct mux_control *mux, int state) { > + struct regmap_field **fields = mux_chip_priv(mux->chip); > + > + return regmap_field_write(fields[mux_control_get_index(mux)], state); > +} > + > +static const struct mux_control_ops mux_regmap_ops = { > + .set = mux_regmap_set, > +}; > + > +static const struct of_device_id mux_regmap_dt_ids[] = { > + { .compatible = "reg-mux", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, mux_regmap_dt_ids); > + > +static int mux_regmap_probe(struct platform_device *pdev) { > + struct device *dev = >dev; > + struct device_node *np = dev->of_node; > + struct regmap_field **fields; > + struct mux_chip *mux_chip; > + struct regmap *regmap; > + int num_fields; > + int ret; > + int i; > + > + regmap = dev_get_regmap(dev->parent, NULL); > + if (IS_ERR(regmap)) { > + ret = PTR_ERR(regmap); > + dev_err(dev, "failed to get regmap: %d\n", ret); > + return ret; > + } > + > + ret = of_property_count_u32_elems(np, "mux-reg-masks"); > + if (ret == 0 || ret % 2) > + ret = -EINVAL; > + if (ret < 0) { > + dev_err(dev, "mux-reg-masks property missing or invalid: %d\n", > + ret); > + return ret; > + } > + num_fields = ret / 2; > + > + mux_chip = devm_mux_chip_alloc(dev, num_fields, num_fields * > +sizeof(*fields)); > + if (IS_ERR(mux_chip)) > + return PTR_ERR(mux_chip); > + > + fields = mux_chip_priv(mux_chip); > +
RE: [PATCH v5 3/5] arm64: dts: lx2160a: add FlexSPI node property
> -Original Message- > From: devicetree-ow...@vger.kernel.org [mailto:devicetree- > ow...@vger.kernel.org] On Behalf Of Yogesh Narayan Gaur > Sent: Friday, November 16, 2018 4:44 PM > To: linux-...@lists.infradead.org; boris.brezil...@bootlin.com; > marek.va...@gmail.com; broo...@kernel.org; linux-...@vger.kernel.org; > devicet...@vger.kernel.org > Cc: r...@kernel.org; mark.rutl...@arm.com; shawn...@kernel.org; linux- > arm-ker...@lists.infradead.org; computersforpe...@gmail.com; > frieder.schre...@kontron.de; linux-kernel@vger.kernel.org; Yogesh Narayan > Gaur > Subject: [PATCH v5 3/5] arm64: dts: lx2160a: add FlexSPI node property > > Add fspi node property for LX2160A SoC for FlexSPI driver. > Property added for the FlexSPI controller and for the connected slave device > for > the LX2160ARDB target. > This is having two SPI-NOR flash device, mt35xu512aba, connected at CS0 and > CS1. > > Signed-off-by: Yogesh Gaur > --- > Changes for v5: > - None > Changes for v4: > - Incorporated Rob review comments. > Changes for v3: > - None. > Changes for v2: > - - Incorporated Shawn review comments. > --- > arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts | 22 > ++ > arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi| 13 + > 2 files changed, 35 insertions(+) > > diff --git a/arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts > b/arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts > index 1483071..3b20c97 100644 > --- a/arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts > +++ b/arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts > @@ -35,6 +35,28 @@ > status = "okay"; > }; > > + { > + status = "okay"; > + > + mt35xu512aba0: flash@0 { > + #address-cells = <1>; > + #size-cells = <1>; > + compatible = "spansion,m25p80"; > + m25p,fast-read; > + spi-max-frequency = <2000>; The SPI flash supports 50MHz frequency. Please update to 50Mhz > + reg = <0>; > + }; > + > + mt35xu512aba1: flash@1 { > + #address-cells = <1>; > + #size-cells = <1>; > + compatible = "spansion,m25p80"; > + m25p,fast-read; > + spi-max-frequency = <2000>; > + reg = <1>; > + }; > +}; > + > { > status = "okay"; > i2c-mux@77 { > diff --git a/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi > b/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi > index c758268..5d0025a 100644 > --- a/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi > +++ b/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi > @@ -698,5 +698,18 @@ > interrupts = ; > timeout-sec = <30>; > }; > + > + fspi: spi@20c { > + compatible = "nxp,lx2160a-fspi"; > + #address-cells = <1>; > + #size-cells = <0>; > + reg = <0x0 0x20c 0x0 0x1>, > + <0x0 0x2000 0x0 0x1000>; > + reg-names = "fspi_base", "fspi_mmap"; > + interrupts = <0 25 0x4>; /* Level high type */ > + clocks = < 4 3>, < 4 3>; > + clock-names = "fspi_en", "fspi"; > + status = "disabled"; > + }; > }; > }; > -- > 2.7.4