pinctrl: imx6ul: add IOMUXC SNVS pinctrl driver for i.MX 6ULL
PATCH 1/1 pinctrl: imx6ul: add IOMUXC SNVS pinctrl driver for i.MX 6ULL
From: Bai Ping <[email protected]>
On i.MX 6ULL, the BOOT_MODEx and TAMPERx pin MUX and CTRL registers are available in a separate IOMUXC_SNVS module. Add support for the IOMUXC_SNVS module to the i.MX 6UL pinctrl driver.
--- .../bindings/pinctrl/fsl,imx6ul-pinctrl.txt | 3 +- drivers/pinctrl/freescale/pinctrl-imx6ul.c | 52 +++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pinctrl/fsl,imx6ul-pinctrl.txt +2 -1
@@ -4,7 +4,8 @@ Please refer to fsl,imx-pinctrl.txt in this directory for common binding part and usage. Required properties: -- compatible: "fsl,imx6ul-iomuxc" +- compatible: "fsl,imx6ul-iomuxc" for main IOMUX controller or + "fsl,imx6ull-iomuxc-snvs" for i.MX 6ULL's SNVS IOMUX controller. - fsl,pins: each entry consists of 6 integers and represents the mux and config setting for one pin. The first 5 integers <mux_reg conf_reg input_reg mux_val input_val> are specified using a PIN_FUNC_ID macro, which can be found in
drivers/pinctrl/freescale/pinctrl-imx6ul.c +50 -2
76 lines not on this page · raw message
Signature · 1 line
2.15.1
Quoted 8 lines · Stefan Agner
From: Bai Ping <[email protected]>
On i.MX 6ULL, the
BOOT_MODExand TAMPERx pin MUX and CTRL registers are available in a separateIOMUXC_SNVSmodule. Add support for theIOMUXC_SNVSmodule to the i.MX 6UL pinctrl driver.Signed-off-by Bai Ping <[email protected]>Signed-off-by Stefan Agner <[email protected]>
So 6 unsigned long 32 bit is succeeded by 6 unsigned long long, 64 bit?
Someone is having fun naming these platforms I see.
Quoted 4 lines
Required properties:
-- compatible: "fsl,imx6ul-iomuxc"+- compatible: "fsl,imx6ul-iomuxc" for main IOMUX controller or + "fsl,imx6ull-iomuxc-snvs" for i.MX 6ULL's SNVS IOMUX controller.
Pretty uncontroversial change but still nice to give the DT people a chance to ACK it.
drivers/pinctrl/freescale/pinctrl-imx6ul.c static const struct pinctrl_pin_desc imx6ul_pinctrl_pads[] = { · line 345
Quoted 12 lines
static int
imx6ul_pinctrl_probe(struct platform_device *pdev){drivers/pinctrl/freescale/pinctrl-imx6ul.c +9
-1-return imx_pinctrl_probe (pdev, &imx6ul_pinctrl_info); +const struct of_device_id *match; +struct imx_pinctrl_soc_info *pinctrl_info; + + match =of_match_device (imx6ul_pinctrl_of_match, &pdev->dev); + +if (!match) +return -ENODEV ; + + pinctrl_info = (struct imx_pinctrl_soc_info *) match->data;
1. Do not use a cast on void * pointers.
2. Use this function:
extern const void *of_device_get_match_data(const struct device *dev);
Quoted 1 line
From <
linux/of_device.h>
Yours,
Linus Walleij
Quoted 8 lines · Linus Walleij
Quoted 6 lines · Stefan Agner
From: Bai Ping <[email protected]>
On i.MX 6ULL, the
BOOT_MODExand TAMPERx pin MUX and CTRL registers are available in a separateIOMUXC_SNVSmodule. Add support for theIOMUXC_SNVSmodule to the i.MX 6UL pinctrl driver.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Bai Ping <[email protected]>Signed-off-by Stefan Agner <[email protected]>So 6 unsigned long 32 bit is succeeded by 6 unsigned long long, 64 bit?
Someone is having fun naming these platforms I see.
Hehe, yeah definitely. At least they use proper type suffixes ;-)
Quoted 24 lines
Quoted 5 lines
Required properties:
-- compatible: "fsl,imx6ul-iomuxc"+- compatible: "fsl,imx6ul-iomuxc" for main IOMUX controller or + "fsl,imx6ull-iomuxc-snvs" for i.MX 6ULL's SNVS IOMUX controller.Pretty uncontroversial change but still nice to give the DT people a chance to ACK it.
drivers/pinctrl/freescale/pinctrl-imx6ul.c static const struct pinctrl_pin_desc imx6ul_pinctrl_pads[] = { · line 345
Quoted 12 lines
static int
imx6ul_pinctrl_probe(struct platform_device *pdev){drivers/pinctrl/freescale/pinctrl-imx6ul.c +9
-1-return imx_pinctrl_probe (pdev, &imx6ul_pinctrl_info); +const struct of_device_id *match; +struct imx_pinctrl_soc_info *pinctrl_info; + + match =of_match_device (imx6ul_pinctrl_of_match, &pdev->dev); + +if (!match) +return -ENODEV ; + + pinctrl_info = (struct imx_pinctrl_soc_info *) match->data;1. Do not use a cast on void * pointers.
Quoted 4 lines
2. Use this function:
extern const void *of_device_get_match_data(const struct device *dev);From <
linux/of_device.h>
Ok. We use the same code in pinmux-imx7d.c, will send a patch to simplify that too.
--
Stefan
Quoted 9 lines · Stefan Agner
Quoted 8 lines · Linus Walleij
Quoted 6 lines · Stefan Agner
From: Bai Ping <[email protected]>
On i.MX 6ULL, the
BOOT_MODExand TAMPERx pin MUX and CTRL registers are available in a separateIOMUXC_SNVSmodule. Add support for theIOMUXC_SNVSmodule to the i.MX 6UL pinctrl driver.
Quoted 35 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Bai Ping <[email protected]>Signed-off-by Stefan Agner <[email protected]>So 6 unsigned long 32 bit is succeeded by 6 unsigned long long, 64 bit?
Someone is having fun naming these platforms I see.
Hehe, yeah definitely. At least they use proper type suffixes ;-)
Quoted 26 lines
Quoted 5 lines
Required properties:
-- compatible: "fsl,imx6ul-iomuxc"+- compatible: "fsl,imx6ul-iomuxc" for main IOMUX controller or + "fsl,imx6ull-iomuxc-snvs" for i.MX 6ULL's SNVS IOMUX controller.Pretty uncontroversial change but still nice to give the DT people a chance to ACK it.
drivers/pinctrl/freescale/pinctrl-imx6ul.c static const struct pinctrl_pin_desc imx6ul_pinctrl_pads[] = { · line 345
Quoted 12 lines
static int
imx6ul_pinctrl_probe(struct platform_device *pdev){drivers/pinctrl/freescale/pinctrl-imx6ul.c +9
-1-return imx_pinctrl_probe (pdev, &imx6ul_pinctrl_info); +const struct of_device_id *match; +struct imx_pinctrl_soc_info *pinctrl_info; + + match =of_match_device (imx6ul_pinctrl_of_match, &pdev->dev); + +if (!match) +return -ENODEV ; + + pinctrl_info = (struct imx_pinctrl_soc_info *) match->data;1. Do not use a cast on void * pointers.
2. Use this function:
extern const void *of_device_get_match_data(const struct device *dev);
Just realized that imx_pinctrl_probe needs a non-const struct imx_pinctrl_soc_info *...
Afaik, while casting to non-const struct pointers in imxXX_pinctrl_probe is not nice but should be technically ok since it is a non-const declaration. However, in pinmux-imx7d.c the struct imx_pinctrl_soc_info declarations have even been constified with b3060044e495 ("pinctrl:
freescale: imx7d: make of_device_ids const"). That seems not ok!
I wonder how that even works under the light of CONFIG_STRICT_KERNEL_RWX. In a quick test it seems to boot fine though, as far as I can tell rodata are set to ro once boot completed... It seems at that point the pinmux driver has been initialized completely and does not write to the struct anymore.
How can we fix this properly? IMHO we should at least unconstify the struct imx7d_pinctrl_info/imx7d_lpsr_pinctrl_info declarations in pinctrl-imx7d.c...
--
Stefan
Quoted 8 lines
Quoted 2 lines
From <
linux/of_device.h>Ok. We use the same code in
pinmux-imx7d.c, will send a patch to simplify that too.--
Stefan
Quoted 10 lines · Stefan Agner
From: Bai Ping <[email protected]>
On i.MX 6ULL, the
BOOT_MODExand TAMPERx pin MUX and CTRL registers are available in a separateIOMUXC_SNVSmodule. Add support for theIOMUXC_SNVSmodule to the i.MX 6UL pinctrl driver.Signed-off-by Bai Ping <[email protected]>Signed-off-by Stefan Agner <[email protected]>--- .../bindings/pinctrl/fsl,imx6ul-pinctrl.txt | 3 +-
Quoted 2 lines
drivers/pinctrl/freescale/pinctrl-imx6ul.c | 52 +++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)