pinctrl: imx: fix initialization of imx_pinctrl_desc
Subsystems (4)
PATCH 1/1 pinctrl: imx: fix initialization of imx_pinctrl_desc
To i.MX7D, there are two iomux controllers, iomuxc and iomuxc_lpsr. They should not share one pin controller descriptor, otherwise the value filled into imx_pinctrl_desc when probing the first iomux controller will be overridden when probing the second one.
In this patch, discard the static allcoated imx_pinctrl_desc and switch to dynamically allcate pin controller descriptor for each iomux controller.
--- drivers/pinctrl/freescale/pinctrl-imx.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx.c +14 -11
@@ -513,13 +513,6 @@ static const struct pinconf_ops imx_pinconf_ops = { .pin_config_group_dbg_show = imx_pinconf_group_dbg_show, }; -static struct pinctrl_desc imx_pinctrl_desc = { - .pctlops = &imx_pctrl_ops, - .pmxops = &imx_pmx_ops, - .confops = &imx_pinconf_ops, - .owner =THIS_MODULE , -}; -/* * Each pin represented in fsl,pins consists of 5 u32 PIN_FUNC_ID and * 1 u32 CONFIG, so 24 types in total for each pin.
@@ -722,6 +715,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, {struct regmap_config config = { .name ="gpr" };struct device_node *dev_np = pdev->dev.of_node; +struct pinctrl_desc *imx_pinctrl_desc;struct device_node *np;struct imx_pinctrl *ipctl;struct resource *res;
@@ -776,9 +770,18 @@ int imx_pinctrl_probe(struct platform_device *pdev, } } - imx_pinctrl_desc.name =dev_name (&pdev->dev); - imx_pinctrl_desc.pins = info->pins; - imx_pinctrl_desc.npins = info->npins; + imx_pinctrl_desc =devm_kzalloc (&pdev->dev,sizeof (*imx_pinctrl_desc), +GFP_KERNEL ); +if (!imx_pinctrl_desc) +return -ENOMEM ; + + imx_pinctrl_desc->name =dev_name (&pdev->dev); + imx_pinctrl_desc->pins = info->pins; + imx_pinctrl_desc->npins = info->npins; + imx_pinctrl_desc->pctlops = &imx_pctrl_ops, + imx_pinctrl_desc->pmxops = &imx_pmx_ops, + imx_pinctrl_desc->confops = &imx_pinconf_ops, + imx_pinctrl_desc->owner =THIS_MODULE , ret =imx_pinctrl_probe_dt (pdev, info);if (ret) {
@@ -789,7 +792,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, ipctl->info = info; ipctl->dev = info->dev;platform_set_drvdata (pdev, ipctl); - ipctl->pctl =pinctrl_register (&imx_pinctrl_desc, &pdev->dev, ipctl); + ipctl->pctl =pinctrl_register (imx_pinctrl_desc, &pdev->dev, ipctl);if (IS_ERR (ipctl->pctl)) {dev_err (&pdev->dev,"could not register IMX pinctrl driver\n" );return PTR_ERR (ipctl->pctl);
Signature · 1 line
2.6.2
Hi Linus, Shawn
Kindly ping.. Do you have any comments on this patch?
Thanks,
Peng.
Quoted 79 lines · Peng Fan
To i.MX7D, there are two iomux controllers, iomuxc and
iomuxc_lpsr. They should not share one pin controller descriptor, otherwise the value filled intoimx_pinctrl_descwhen probing the first iomux controller will be overridden when probing the second one.In this patch, discard the static allcoated
imx_pinctrl_descand switch to dynamically allcate pin controller descriptor for each iomux controller.Signed-off-by Peng Fan <[email protected]>Cc Linus Walleij <[email protected]>Cc Shawn Guo <[email protected]>Cc Philipp Zabel <[email protected]>Cc Stefan Agner <[email protected]>Cc Vladimir Zapolskiy <[email protected]>---
drivers/pinctrl/freescale/pinctrl-imx.c| 25 ++++++++++++++-----------1 file changed, 14 insertions(+), 11 deletions(-)drivers/pinctrl/freescale/pinctrl-imx.c +14
-11@@ -513,13 +513,6 @@ static const struct pinconf_ops imx_pinconf_ops = { .pin_config_group_dbg_show = imx_pinconf_group_dbg_show, }; -static struct pinctrl_desc imx_pinctrl_desc = { - .pctlops = &imx_pctrl_ops, - .pmxops = &imx_pmx_ops, - .confops = &imx_pinconf_ops, - .owner =THIS_MODULE , -}; -/* * Each pin represented in fsl,pins consists of 5 u32 PIN_FUNC_ID and * 1 u32 CONFIG, so 24 types in total for each pin. @@ -722,6 +715,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, {struct regmap_config config = { .name ="gpr" };struct device_node *dev_np = pdev->dev.of_node; +struct pinctrl_desc *imx_pinctrl_desc;struct device_node *np;struct imx_pinctrl *ipctl;struct resource *res;@@ -776,9 +770,18 @@ int imx_pinctrl_probe(struct platform_device *pdev, } } - imx_pinctrl_desc.name =dev_name (&pdev->dev); - imx_pinctrl_desc.pins = info->pins; - imx_pinctrl_desc.npins = info->npins; + imx_pinctrl_desc =devm_kzalloc (&pdev->dev,sizeof (*imx_pinctrl_desc), +GFP_KERNEL ); +if (!imx_pinctrl_desc) +return -ENOMEM ; + + imx_pinctrl_desc->name =dev_name (&pdev->dev); + imx_pinctrl_desc->pins = info->pins; + imx_pinctrl_desc->npins = info->npins; + imx_pinctrl_desc->pctlops = &imx_pctrl_ops, + imx_pinctrl_desc->pmxops = &imx_pmx_ops, + imx_pinctrl_desc->confops = &imx_pinconf_ops, + imx_pinctrl_desc->owner =THIS_MODULE , ret =imx_pinctrl_probe_dt (pdev, info);if (ret) {@@ -789,7 +792,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, ipctl->info = info; ipctl->dev = info->dev;platform_set_drvdata (pdev, ipctl); - ipctl->pctl =pinctrl_register (&imx_pinctrl_desc, &pdev->dev, ipctl); + ipctl->pctl =pinctrl_register (imx_pinctrl_desc, &pdev->dev, ipctl);if (IS_ERR (ipctl->pctl)) {dev_err (&pdev->dev,"could not register IMX pinctrl driver\n" );return PTR_ERR (ipctl->pctl);Signature · 1 line
2.6.2
Quoted 9 lines · Peng Fan
To i.MX7D, there are two iomux controllers, iomuxc and
iomuxc_lpsr. They should not share one pin controller descriptor, otherwise the value filled intoimx_pinctrl_descwhen probing the first iomux controller will be overridden when probing the second one.In this patch, discard the static allcoated
imx_pinctrl_descand switch to dynamically allcate pin controller descriptor for each iomux controller.
Quoted 6 lines
Signed-off-by Peng Fan <[email protected]>Cc Linus Walleij <[email protected]>Cc Shawn Guo <[email protected]>Cc Philipp Zabel <[email protected]>Cc Stefan Agner <[email protected]>Cc Vladimir Zapolskiy <[email protected]>
Looks reasonable to me so patch applied since noone is responding.
Yours,
Linus Walleij