Patchwork [RFC,v2,3/4] ARM: imx6q: using pinmux subsystem

login
register
mail settings
Submitter Dong Aisheng
Date Dec. 14, 2011, 4:03 p.m.
Message ID <1323878622-26602-4-git-send-email-b29396@freescale.com>
Download mbox | patch
Permalink /patch/131430/
State New
Headers show

Comments

Dong Aisheng - Dec. 14, 2011, 4:03 p.m.
From: Dong Aisheng <dong.aisheng@linaro.org>

Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shanw.guo@freescale.com>
---
 arch/arm/boot/dts/imx6q-sabreauto.dts |   22 ++++++++++++++++++++++
 arch/arm/boot/dts/imx6q.dtsi          |    1 +
 arch/arm/mach-imx/Kconfig             |    1 +
 arch/arm/mach-imx/mach-imx6q.c        |    8 +++++++-
 4 files changed, 31 insertions(+), 1 deletions(-)
Linus Walleij - Dec. 14, 2011, 6:02 p.m.
On Wed, Dec 14, 2011 at 5:03 PM, Dong Aisheng <b29396@freescale.com> wrote:

> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shanw.guo@freescale.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

> +static struct pinmux_map imx6q_pinmux_map[] = {
> +       PINMUX_MAP_PRIMARY("usdhc4", "sd4", "219c000.usdhc"),
> +};
> +
>  static void __init imx6q_init_machine(void)
>  {
>        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> -
> +       pinmux_register_mappings(imx6q_pinmux_map,
> +                                ARRAY_SIZE(imx6q_pinmux_map));
>        imx6q_pm_init();
>  }

So ideally this bit of code should also go into the device tree
and we should add a DT hook inside drivers/pinctrl/pinmux.c

Please make a patch for this if you have a clear idea on how
it should work!

Yours,
Linus Walleij
Dong Aisheng - Dec. 15, 2011, 7:36 a.m.
> -----Original Message-----
> From: Linus Walleij [mailto:linus.walleij@linaro.org]
> Sent: Thursday, December 15, 2011 2:03 AM
> To: Dong Aisheng-B29396
> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linus.walleij@stericsson.com; s.hauer@pengutronix.de; Guo Shawn-R65073;
> kernel@pengutronix.de; grant.likely@secretlab.ca; rob.herring@calxeda.com
> Subject: Re: [RFC PATCH v2 3/4] ARM: imx6q: using pinmux subsystem
> Importance: High
> 
> On Wed, Dec 14, 2011 at 5:03 PM, Dong Aisheng <b29396@freescale.com>
> wrote:
> 
> > From: Dong Aisheng <dong.aisheng@linaro.org>
> >
> > Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Shawn Guo <shanw.guo@freescale.com>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> > +static struct pinmux_map imx6q_pinmux_map[] = {
> > +       PINMUX_MAP_PRIMARY("usdhc4", "sd4", "219c000.usdhc"), };
> > +
> >  static void __init imx6q_init_machine(void)
> >  {
> >        of_platform_populate(NULL, of_default_bus_match_table, NULL,
> > NULL);
> > -
> > +       pinmux_register_mappings(imx6q_pinmux_map,
> > +                                ARRAY_SIZE(imx6q_pinmux_map));
> >        imx6q_pm_init();
> >  }
> 
> So ideally this bit of code should also go into the device tree and we
> should add a DT hook inside drivers/pinctrl/pinmux.c
> 
> Please make a patch for this if you have a clear idea on how it should
> work!
> 
Yes, I will try to see that and will discuss with you once got an idea.

Regards
Dong Aisheng

Patch

diff --git a/arch/arm/boot/dts/imx6q-sabreauto.dts b/arch/arm/boot/dts/imx6q-sabreauto.dts
index 072974e..1bd1ef9 100644
--- a/arch/arm/boot/dts/imx6q-sabreauto.dts
+++ b/arch/arm/boot/dts/imx6q-sabreauto.dts
@@ -26,6 +26,28 @@ 
 	};
 
 	soc {
+		aips-bus@02000000 { /* AIPS1 */
+			iomuxc@020e0000 {
+				pinmux_uart4 {
+					func_name = "uart4";
+					grp_name = "uart4grp";
+					grp_pins = <107 108>;
+					num_pins = <2>;
+					grp_mux = <4 4>;
+					num_mux = <2>;
+				};
+
+				pinmux_sd4 {
+					func_name = "sd4";
+					grp_name = "sd4grp";
+					grp_pins = <170 171 180 181 182 183 184 185 186 187>;
+					num_pins = <10>;
+					grp_mux = <0 0 1 1 1 1 1 1 1 1>;
+					num_mux = <10>;
+				};
+			};
+		};
+
 		aips-bus@02100000 { /* AIPS2 */
 			enet@02188000 {
 				phy-mode = "rgmii";
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 7dda599..42499bb 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -386,6 +386,7 @@ 
 			};
 
 			iomuxc@020e0000 {
+				compatible = "fsl,imx6q-iomuxc";
 				reg = <0x020e0000 0x4000>;
 			};
 
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index c44aa97..1e0befa 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -602,6 +602,7 @@  config SOC_IMX6Q
 	select HAVE_IMX_GPC
 	select HAVE_IMX_MMDC
 	select HAVE_IMX_SRC
+	select PINCTRL
 	select USE_OF
 
 	help
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 9cd860a..e12ae63 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -16,6 +16,7 @@ 
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/pinctrl/machine.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/hardware/gic.h>
 #include <asm/mach/arch.h>
@@ -23,10 +24,15 @@ 
 #include <mach/common.h>
 #include <mach/hardware.h>
 
+static struct pinmux_map imx6q_pinmux_map[] = {
+	PINMUX_MAP_PRIMARY("usdhc4", "sd4", "219c000.usdhc"),
+};
+
 static void __init imx6q_init_machine(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-
+	pinmux_register_mappings(imx6q_pinmux_map,
+				 ARRAY_SIZE(imx6q_pinmux_map));
 	imx6q_pm_init();
 }