pinctrl: imx: Split imx_pinctrl_probe() into common and mmio parts

Split imx_pinctrl_probe() into imx_pinctrl_probe_common() and
imx_pinctrl_probe_mmio(). The former does the common setup, the
later does the common setup and MMIO access configuration. The
common setup can be used as-is for SCU based systems, update
the pinctrl-imx8 to call only the common setup, update all the
other pinctrl drivers to call imx_pinctrl_probe_mmio().

No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Marek Vasut
2025-01-24 15:50:54 +01:00
committed by Fabio Estevam
parent def8012d5b
commit 7ddd6d3c21
12 changed files with 33 additions and 22 deletions

View File

@@ -194,7 +194,24 @@ int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
return 0;
}
int imx_pinctrl_probe(struct udevice *dev)
int imx_pinctrl_probe_common(struct udevice *dev)
{
struct imx_pinctrl_soc_info *info =
(struct imx_pinctrl_soc_info *)dev_get_driver_data(dev);
struct imx_pinctrl_priv *priv = dev_get_priv(dev);
if (!info) {
dev_err(dev, "wrong pinctrl info\n");
return -EINVAL;
}
priv->dev = dev;
priv->info = info;
return 0;
}
int imx_pinctrl_probe_mmio(struct udevice *dev)
{
struct imx_pinctrl_soc_info *info =
(struct imx_pinctrl_soc_info *)dev_get_driver_data(dev);
@@ -205,16 +222,9 @@ int imx_pinctrl_probe(struct udevice *dev)
fdt_size_t size;
int ret;
if (!info) {
dev_err(dev, "wrong pinctrl info\n");
return -EINVAL;
}
priv->dev = dev;
priv->info = info;
if (info->flags & IMX8_USE_SCU)
return 0;
ret = imx_pinctrl_probe_common(dev);
if (ret)
return ret;
addr = ofnode_get_addr_size_index(node, 0, &size);
if (addr == FDT_ADDR_T_NONE)

View File

@@ -48,7 +48,8 @@ struct imx_pinctrl_priv {
#define IOMUXC_CONFIG_SION (0x1 << 4)
int imx_pinctrl_probe(struct udevice *dev);
int imx_pinctrl_probe_common(struct udevice *dev);
int imx_pinctrl_probe_mmio(struct udevice *dev);
int imx_pinctrl_remove(struct udevice *dev);

View File

@@ -31,7 +31,7 @@ U_BOOT_DRIVER(imx5_pinctrl) = {
.name = "imx5-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx5_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx5_pinctrl_ops,

View File

@@ -40,7 +40,7 @@ U_BOOT_DRIVER(fsl_imx6q_iomuxc) = {
.name = "fsl_imx6q_iomuxc",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx6_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx6_pinctrl_ops,

View File

@@ -28,7 +28,7 @@ U_BOOT_DRIVER(imx7_pinctrl) = {
.name = "imx7-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx7_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx7_pinctrl_ops,

View File

@@ -32,7 +32,7 @@ U_BOOT_DRIVER(imx7ulp_pinctrl) = {
.name = "imx7ulp-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx7ulp_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx7ulp_pinctrl_ops,

View File

@@ -29,7 +29,7 @@ U_BOOT_DRIVER(imx8_pinctrl) = {
.name = "imx8_pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx8_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_common,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx8_pinctrl_ops,
.flags = DM_FLAG_PRE_RELOC,

View File

@@ -26,7 +26,7 @@ U_BOOT_DRIVER(imx8mq_pinctrl) = {
.name = "imx8mq-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx8m_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx8m_pinctrl_ops,

View File

@@ -31,7 +31,7 @@ U_BOOT_DRIVER(imx8ulp_pinctrl) = {
.name = "imx8ulp-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx8ulp_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx8ulp_pinctrl_ops,

View File

@@ -26,7 +26,7 @@ U_BOOT_DRIVER(imx93_pinctrl) = {
.name = "imx93-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imx93_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imx93_pinctrl_ops,

View File

@@ -27,7 +27,7 @@ U_BOOT_DRIVER(imxrt_pinctrl) = {
.name = "imxrt-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(imxrt_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &imxrt_pinctrl_ops,

View File

@@ -27,7 +27,7 @@ U_BOOT_DRIVER(vf610_pinctrl) = {
.name = "vf610-pinctrl",
.id = UCLASS_PINCTRL,
.of_match = of_match_ptr(vf610_pinctrl_match),
.probe = imx_pinctrl_probe,
.probe = imx_pinctrl_probe_mmio,
.remove = imx_pinctrl_remove,
.priv_auto = sizeof(struct imx_pinctrl_priv),
.ops = &vf610_pinctrl_ops,