pinctrl: Support print pinmux settings for i.MX8M/9
Subsystems (4)
cover pinctrl: Support print pinmux settings for i.MX8M/9
This patchset is to add support for printing pinmux settings when using "pinmux status [x]" in U-Boot with CONFIG_CMD_PINMUX enabled.
So these items are included in this patchset.
- imx_pinctrl_pin_desc structure and PINCTRL_PIN()/IMX_PINCTRL_PIN() helpers for defining pin descriptors.
- A full pin descriptor table for i.MX8MP pads.
- Implementation of get_pins_count(), get_pin_name(), and get_pin_muxing() in the i.MX8M pinctrl driver.
- Guard pinctrl match table
CI: https://dev.azure.com/pengfan/uboot-ci/_build/results?buildId=27
---
Peng Fan (10):
pinctrl: nxp: Kconfig: Typo fix
pinctrl: nxp: imx8mp: Support print pin muxing
pinctrl: nxp: imx8mn: Support print pin muxing
pinctrl: nxp: imx8mm: Support print pin muxing
pinctrl: nxp: imx8mq: Support print pin muxing
pinctrl: nxp: imx8m: Guard pinctrl match table with CONFIG_IMX8M[X]
pinctrl: nxp: imx93: Rename to imx9
pinctrl: nxp: imx93: Support print pin muxing
pinctrl: nxp: imx91: Support print pin muxing
pinctrl: nxp: imx9: Guard pinctrl match table with CONFIG_IMX9[X]
drivers/pinctrl/nxp/Kconfig | 6 +- drivers/pinctrl/nxp/Makefile | 2 +- drivers/pinctrl/nxp/pinctrl-imx.h | 8 + drivers/pinctrl/nxp/pinctrl-imx8m.c | 62 +++++++ drivers/pinctrl/nxp/pinctrl-imx8mm.c | 310 +++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx8mn.c | 310 +++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx8mp.c | 309 ++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx8mq.c | 310 +++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx9.c | 89 ++++++++++ drivers/pinctrl/nxp/pinctrl-imx91.c | 228 ++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx93.c | 244 ++++++++++++++++++++++++--- 11 files changed, 1849 insertions(+), 29 deletions(-)
---
base-commit: ee2c4f999c633c3d175aadbb77d08be5a91b354e
change-id: 20260222-imx-pinctrl-ef2e6624d6ab
Best regards,
Signature · 1 line
Peng Fan <[email protected]>
PATCH 1/10 pinctrl: nxp: Kconfig: Typo fix
From: Peng Fan <[email protected]>
PINCTRL_IMX93 is for i.MX9[3,1], not for i.MX8M, correct the typo.
--- drivers/pinctrl/nxp/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/nxp/Kconfig +3 -3
@@ -103,13 +103,13 @@ config PINCTRL_IMX8M registers. config PINCTRL_IMX93 - bool "IMX8M pinctrl driver" + bool "IMX93/1 pinctrl driver" depends on ARCH_IMX9 && PINCTRL_FULL select PINCTRL_IMX_MMIO help - Say Y here to enable the imx8m pinctrl driver + Say Y here to enable the imx9[3,1] pinctrl driver - This provides a simple pinctrl driver for i.MX8M SoC familiy. + This provides a simple pinctrl driver for i.MX9[3,1] SoC. This feature depends on device tree configuration. This driver is different from the linux one, this is a simple implementation, only parses the 'fsl,pins' property and configure related
Signature · 1 line
2.51.0
PATCH 2/10 pinctrl: nxp: imx8mp: Support print pin muxing
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add support for printing pin names and current mux configuration on i.MX8MP when CMD_PINMUX is enabled.
- imx_pinctrl_pin_desc structure and PINCTRL_PIN()/IMX_PINCTRL_PIN() helpers for defining pin descriptors.
- A full pin descriptor table for i.MX8MP pads.
- Implementation of get_pins_count(), get_pin_name(), and get_pin_muxing() in the i.MX8M pinctrl driver.
There is no good way to add real mux names, so just dump the function ID from the mux register.
--- drivers/pinctrl/nxp/pinctrl-imx.h | 8 + drivers/pinctrl/nxp/pinctrl-imx8m.c | 48 ++++++ drivers/pinctrl/nxp/pinctrl-imx8mp.c | 309 +++++++++++++++++++++++++++++++++++ 3 files changed, 365 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx.h +8 -0
@@ -6,6 +6,14 @@#ifndef __DRIVERS_PINCTRL_IMX_H#define __DRIVERS_PINCTRL_IMX_H +#define PINCTRL_PIN (a, b) { .number = a, .name = b } +#define IMX_PINCTRL_PIN (pin) PINCTRL_PIN(pin, #pin) + +struct imx_pinctrl_pin_desc { +unsigned int number; +const char *name; +}; +/** * @base: the address to the controller in virtual memory * @input_sel_base: the address of the select input in virtual memory.
drivers/pinctrl/nxp/pinctrl-imx8m.c +48 -0
62 lines not on this page · raw message
drivers/pinctrl/nxp/pinctrl-imx8mp.c new file +309 -0
309 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 3/10 pinctrl: nxp: imx8mn: Support print pin muxing
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add support for printing pin names and current mux configuration on i.MX8MN when CMD_PINMUX is enabled by adding full pin descriptor table for i.MX8MN pads.
--- drivers/pinctrl/nxp/pinctrl-imx8m.c | 2 + drivers/pinctrl/nxp/pinctrl-imx8mn.c | 310 +++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx8m.c +2 -0
@@ -26,6 +26,8 @@ static const struct udevice_id imx8m_pinctrl_match[] = {#if IS_ENABLED (CONFIG_IMX8MP )#include "pinctrl-imx8mp.c" +#elif IS_ENABLED (CONFIG_IMX8MN ) +#include "pinctrl-imx8mn.c" #endif static int imx8m_get_pins_count (struct udevice *dev)
drivers/pinctrl/nxp/pinctrl-imx8mn.c new file +310 -0
310 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 4/10 pinctrl: nxp: imx8mm: Support print pin muxing
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add support for printing pin names and current mux configuration on i.MX8MM when CMD_PINMUX is enabled by adding full pin descriptor table for i.MX8MM pads.
--- drivers/pinctrl/nxp/pinctrl-imx8m.c | 2 + drivers/pinctrl/nxp/pinctrl-imx8mm.c | 310 +++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx8m.c +2 -0
@@ -28,6 +28,8 @@ static const struct udevice_id imx8m_pinctrl_match[] = {#include "pinctrl-imx8mp.c" #elif IS_ENABLED (CONFIG_IMX8MN )#include "pinctrl-imx8mn.c" +#elif IS_ENABLED (CONFIG_IMX8MM ) +#include "pinctrl-imx8mm.c" #endif static int imx8m_get_pins_count (struct udevice *dev)
drivers/pinctrl/nxp/pinctrl-imx8mm.c new file +310 -0
310 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 5/10 pinctrl: nxp: imx8mq: Support print pin muxing
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add support for printing pin names and current mux configuration on i.MX8MQ when CMD_PINMUX is enabled by adding full pin descriptor table for i.MX8MQ pads.
--- drivers/pinctrl/nxp/pinctrl-imx8m.c | 2 + drivers/pinctrl/nxp/pinctrl-imx8mq.c | 310 +++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx8m.c +2 -0
@@ -30,6 +30,8 @@ static const struct udevice_id imx8m_pinctrl_match[] = {#include "pinctrl-imx8mn.c" #elif IS_ENABLED (CONFIG_IMX8MM )#include "pinctrl-imx8mm.c" +#elif IS_ENABLED (CONFIG_IMX8MQ ) +#include "pinctrl-imx8mq.c" #endif static int imx8m_get_pins_count (struct udevice *dev)
drivers/pinctrl/nxp/pinctrl-imx8mq.c new file +310 -0
310 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 6/10 pinctrl: nxp: imx8m: Guard pinctrl match table with CONFIG_IMX8M[X]
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The i.MX8M pinctrl match table currently lists all SoC compatibles unconditionally, which may lead to unused entries being included when building for specific SoC variants. Guard each compatible entry with the corresponding CONFIG_IMX8M[X] option so only the required SoC entries are compiled in, which reduces unnecessary data.
--- drivers/pinctrl/nxp/pinctrl-imx8m.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx8m.c +8 -0
@@ -15,10 +15,18 @@ static struct imx_pinctrl_soc_info imx8mq_pinctrl_soc_info __section(".data");static const struct udevice_id imx8m_pinctrl_match[] = { +#if IS_ENABLED(CONFIG_IMX8MQ) { .compatible ="fsl,imx8mq-iomuxc" , .data = (ulong)&imx8mq_pinctrl_soc_info }, +#endif +#if IS_ENABLED(CONFIG_IMX8MM) { .compatible ="fsl,imx8mm-iomuxc" , .data = (ulong)&imx8mq_pinctrl_soc_info }, +#endif +#if IS_ENABLED(CONFIG_IMX8MN) { .compatible ="fsl,imx8mn-iomuxc" , .data = (ulong)&imx8mq_pinctrl_soc_info }, +#endif +#if IS_ENABLED(CONFIG_IMX8MP) { .compatible ="fsl,imx8mp-iomuxc" , .data = (ulong)&imx8mq_pinctrl_soc_info }, +#endif {/* sentinel */ } };
Signature · 1 line
2.51.0
PATCH 7/10 pinctrl: nxp: imx93: Rename to imx9
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
We are going to add pinctrl data support for both i.MX93 and i.MX91. Since these SoCs share the same pinctrl driver structure, rename pinctrl-imx93.c to a more generic pinctrl-imx9.c and update all related variable and function names accordingly.
This prepares the driver for supporting additional i.MX9 family SoCs.
--- drivers/pinctrl/nxp/Makefile | 2 +- drivers/pinctrl/nxp/pinctrl-imx9.c | 34 ++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx93.c | 34 ---------------------------------- 3 files changed, 35 insertions(+), 35 deletions(-)
drivers/pinctrl/nxp/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-$(CONFIG_PINCTRL_IMX7ULP) += pinctrl-imx7ulp.o obj-$(CONFIG_PINCTRL_IMX8ULP) += pinctrl-imx8ulp.o obj-$(CONFIG_PINCTRL_IMX8) += pinctrl-imx8.o obj-$(CONFIG_PINCTRL_IMX8M) += pinctrl-imx8m.o -obj-$(CONFIG_PINCTRL_IMX93) += pinctrl-imx93.o +obj-$(CONFIG_PINCTRL_IMX93) += pinctrl-imx9.o obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o obj-$(CONFIG_PINCTRL_VYBRID) += pinctrl-vf610.o obj-$(CONFIG_PINCTRL_IMXRT) += pinctrl-imxrt.o
drivers/pinctrl/nxp/pinctrl-imx9.c new file +34 -0
@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2022 NXP +*/ + +#include <dm/device.h> +#include <dm/pinctrl.h> + +#include "pinctrl-imx.h" + +static struct imx_pinctrl_soc_info imx9_pinctrl_soc_info __section(".data") = { + .flags = ZERO_OFFSET_VALID, +}; + +static const struct udevice_id imx9_pinctrl_match[] = { + { .compatible ="fsl,imx93-iomuxc" , .data = (ulong)&imx9_pinctrl_soc_info }, + { .compatible ="fsl,imx91-iomuxc" , .data = (ulong)&imx9_pinctrl_soc_info }, + {/* sentinel */ } +}; + +static const struct pinctrl_ops imx9_pinctrl_ops = { + .set_state = imx_pinctrl_set_state_mmio, +}; + +U_BOOT_DRIVER (imx9_pinctrl) = { + .name ="imx9-pinctrl" , + .id =UCLASS_PINCTRL , + .of_match =of_match_ptr (imx9_pinctrl_match), + .probe = imx_pinctrl_probe_mmio, + .remove = imx_pinctrl_remove_mmio, + .priv_auto =sizeof (struct imx_pinctrl_priv ), + .ops = &imx9_pinctrl_ops, + .flags =DM_FLAG_PRE_RELOC , +};
drivers/pinctrl/nxp/pinctrl-imx93.c deleted +0 -34
@@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright 2022 NXP -*/ - -#include <dm/device.h> -#include <dm/pinctrl.h> - -#include "pinctrl-imx.h" - -static struct imx_pinctrl_soc_info imx93_pinctrl_soc_info __section(".data") = { - .flags = ZERO_OFFSET_VALID, -}; - -static const struct udevice_id imx93_pinctrl_match[] = { - { .compatible ="fsl,imx93-iomuxc" , .data = (ulong)&imx93_pinctrl_soc_info }, - { .compatible ="fsl,imx91-iomuxc" , .data = (ulong)&imx93_pinctrl_soc_info }, - {/* sentinel */ } -}; - -static const struct pinctrl_ops imx93_pinctrl_ops = { - .set_state = imx_pinctrl_set_state_mmio, -}; - -U_BOOT_DRIVER (imx93_pinctrl) = { - .name ="imx93-pinctrl" , - .id =UCLASS_PINCTRL , - .of_match =of_match_ptr (imx93_pinctrl_match), - .probe = imx_pinctrl_probe_mmio, - .remove = imx_pinctrl_remove_mmio, - .priv_auto =sizeof (struct imx_pinctrl_priv ), - .ops = &imx93_pinctrl_ops, - .flags =DM_FLAG_PRE_RELOC , -};
Signature · 1 line
2.51.0
Fabio Estevam
maintainerRe: [PATCH 07/10] pinctrl: nxp: imx93: Rename to imx9
Hi Peng,
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
We are going to add pinctrl data support for both i.MX93 and i.MX91. Since these SoCs share the same pinctrl driver structure, rename
pinctrl-imx93.cto a more genericpinctrl-imx9.cand update all related variable and function names accordingly.
Quoted 7 lines
This prepares the driver for supporting additional i.MX9 family SoCs.
Signed-off-by Peng Fan <[email protected]>--- drivers/pinctrl/nxp/Makefile | 2 +- drivers/pinctrl/nxp/pinctrl-imx9.c | 34 ++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx93.c | 34 ----------------------------------
Please generate this using "git mv" so it appears as a rename rather than adding and removing files.
RE: [PATCH 07/10] pinctrl: nxp: imx93: Rename to imx9
Hi Fabio,
Quoted 24 lines
Subject: Re: [PATCH 07/10] pinctrl: nxp: imx93: Rename to imx9
Hi Peng,
Quoted 10 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
We are going to add pinctrl data support for both i.MX93 and i.MX91. Since these SoCs share the same pinctrl driver structure, rename
pinctrl-imx93.cto a more genericpinctrl-imx9.cand update all related variable and function names accordingly.This prepares the driver for supporting additional i.MX9 family SoCs.
Quoted 7 lines
Signed-off-by Peng Fan <[email protected]>--- drivers/pinctrl/nxp/Makefile | 2 +- drivers/pinctrl/nxp/pinctrl-imx9.c | 34 ++++++++++++++++++++++++++++++++++ drivers/pinctrl/nxp/pinctrl-imx93.c | 34----------------------------------
Quoted 2 lines
Please generate this using "git mv" so it appears as a rename rather than adding and removing files.
I updated all related variable and function names accordingly, such as imx93_pinctrl_ops to imx9_pinctrl_ops.
Thanks,
Peng.
PATCH 8/10 pinctrl: nxp: imx93: Support print pin muxing
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add support for printing pin names and current mux configuration on i.MX93 when CMD_PINMUX is enabled.
- A full pin descriptor table for i.MX93 pads.
- Implementation of get_pins_count(), get_pin_name(), and get_pin_muxing() in the i.MX9 pinctrl driver.
There is no good way to add real mux names, so just dump the function ID from the mux register.
--- drivers/pinctrl/nxp/pinctrl-imx9.c | 49 ++++++++ drivers/pinctrl/nxp/pinctrl-imx93.c | 228 ++++++++++++++++++++++++++++++++++++ 2 files changed, 277 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx9.c +49 -0
@@ -4,7 +4,11 @@*/ #include <dm/device.h> +#include <dm/device_compat.h> #include <dm/pinctrl.h> +#include <linux/bitops.h> +#include <linux/types.h> +#include <asm/io.h> #include "pinctrl-imx.h"
@@ -18,7 +22,52 @@ static const struct udevice_id imx9_pinctrl_match[] = { {/* sentinel */ } }; +#if CONFIG_IS_ENABLED (CMD_PINMUX ) + +#if IS_ENABLED (CONFIG_IMX93 ) +#include "pinctrl-imx93.c" +#endif + +static int imx9_get_pins_count (struct udevice *dev) +{ +return ARRAY_SIZE (imx9_pinctrl_pads); +} + +static const char *imx9_get_pin_name (struct udevice *dev,unsigned int selector) +{ +/* sanity checking */ +if (selector != imx9_pinctrl_pads[selector].number) { +dev_err (dev, +"selector(%u) not match with imx9_pinctrl_pads[selector].number(%u)\n" , + selector, imx9_pinctrl_pads[selector].number); +return NULL ; + } + +return imx9_pinctrl_pads[selector].name; +} + +static int imx9_get_pin_muxing (struct udevice *dev,unsigned int selector, +char *buf,int size) +{ +struct imx_pinctrl_priv *priv =dev_get_priv (dev); +struct imx_pinctrl_soc_info *info = priv->info; +u32 mux_reg = selector <<2 ; +u32 mux_mode =readl (info->base + mux_reg); +u32 sion = mux_mode >>4 ; + +snprintf (buf, size,"Function(%d) SION(%d) at: 0x%p" , mux_mode &0x7 , sion, + info->base + mux_reg); + +return 0 ; +} +#endif +static const struct pinctrl_ops imx9_pinctrl_ops = { +#if CONFIG_IS_ENABLED(CMD_PINMUX) + .get_pin_name = imx9_get_pin_name, + .get_pins_count = imx9_get_pins_count, + .get_pin_muxing = imx9_get_pin_muxing, +#endif .set_state = imx_pinctrl_set_state_mmio, };
drivers/pinctrl/nxp/pinctrl-imx93.c new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 9/10 pinctrl: nxp: imx91: Support print pin muxing
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add support for printing pin names and current mux configuration on i.MX91 when CMD_PINMUX is enabled by adding full pin descriptor table for i.MX91 pads.
--- drivers/pinctrl/nxp/pinctrl-imx9.c | 2 + drivers/pinctrl/nxp/pinctrl-imx91.c | 228 ++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx9.c +2 -0
@@ -26,6 +26,8 @@ static const struct udevice_id imx9_pinctrl_match[] = {#if IS_ENABLED (CONFIG_IMX93 )#include "pinctrl-imx93.c" +#elif IS_ENABLED (CONFIG_IMX91 ) +#include "pinctrl-imx91.c" #endif static int imx9_get_pins_count (struct udevice *dev)
drivers/pinctrl/nxp/pinctrl-imx91.c new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH 10/10 pinctrl: nxp: imx9: Guard pinctrl match table with CONFIG_IMX9[X]
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The i.MX9 pinctrl match table currently lists all SoC compatibles unconditionally, which may lead to unused entries being included when building for specific SoC variants. Guard each compatible entry with the corresponding CONFIG_IMX9[X] option so only the required SoC entries are compiled in, which reduces unnecessary data.
--- drivers/pinctrl/nxp/pinctrl-imx9.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pinctrl/nxp/pinctrl-imx9.c +4 -0
@@ -17,8 +17,12 @@ static struct imx_pinctrl_soc_info imx9_pinctrl_soc_info __section(".data") = { };static const struct udevice_id imx9_pinctrl_match[] = { +#if IS_ENABLED(CONFIG_IMX93) { .compatible ="fsl,imx93-iomuxc" , .data = (ulong)&imx9_pinctrl_soc_info }, +#endif +#if IS_ENABLED(CONFIG_IMX91) { .compatible ="fsl,imx91-iomuxc" , .data = (ulong)&imx9_pinctrl_soc_info }, +#endif {/* sentinel */ } };
Signature · 1 line
2.51.0