pinctrl: imx: attach iomuxc device to gpr syscon
authorPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 25 Feb 2016 17:23:07 +0000 (18:23 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 8 Mar 2016 08:54:03 +0000 (15:54 +0700)
Commit bdb0066df96e ("mfd: syscon: Decouple syscon interface from platform
devices") added the possibility to register syscon devices without
associated platform device. This also removed regmap debugfs facilities,
which don't work without a device. This patch associates the syscon regmap
that handles the IOMUX controller's general purpose registers with the
pinctrl device so that the GPR registers appear in the regmap debugfs
directory again. For example, on i.MX6Q the GPR registers now can be
read from /sys/kernel/debug/regmap/20e0000.iomuxc-gpr/registers.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/freescale/pinctrl-imx.c
drivers/pinctrl/freescale/pinctrl-imx.h
drivers/pinctrl/freescale/pinctrl-imx50.c
drivers/pinctrl/freescale/pinctrl-imx53.c
drivers/pinctrl/freescale/pinctrl-imx6dl.c
drivers/pinctrl/freescale/pinctrl-imx6q.c
drivers/pinctrl/freescale/pinctrl-imx6sl.c
drivers/pinctrl/freescale/pinctrl-imx6sx.c
drivers/pinctrl/freescale/pinctrl-imx6ul.c
drivers/pinctrl/freescale/pinctrl-imx7d.c

index 4c435cfa5d6e258a50a229e6a6efb88b0b505987..46210512d8ecff75cac22f306928798af8436454 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -24,6 +25,7 @@
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/pinctrl/pinmux.h>
 #include <linux/slab.h>
+#include <linux/regmap.h>
 
 #include "../core.h"
 #include "pinctrl-imx.h"
@@ -718,10 +720,12 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev,
 int imx_pinctrl_probe(struct platform_device *pdev,
                      struct imx_pinctrl_soc_info *info)
 {
+       struct regmap_config config = { .name = "gpr" };
        struct device_node *dev_np = pdev->dev.of_node;
        struct device_node *np;
        struct imx_pinctrl *ipctl;
        struct resource *res;
+       struct regmap *gpr;
        int ret, i;
 
        if (!info || !info->pins || !info->npins) {
@@ -730,6 +734,12 @@ int imx_pinctrl_probe(struct platform_device *pdev,
        }
        info->dev = &pdev->dev;
 
+       if (info->gpr_compatible) {
+               gpr = syscon_regmap_lookup_by_compatible(info->gpr_compatible);
+               if (!IS_ERR(gpr))
+                       regmap_attach_dev(&pdev->dev, gpr, &config);
+       }
+
        /* Create state holders etc for this driver */
        ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL);
        if (!ipctl)
index 2a592f657c184918ab1e7fbb6d9a4d862f0a2ab5..3b8bd81a39a4362172956933becd64ccad3f7afd 100644 (file)
@@ -82,6 +82,7 @@ struct imx_pinctrl_soc_info {
        struct imx_pmx_func *functions;
        unsigned int nfunctions;
        unsigned int flags;
+       const char *gpr_compatible;
 };
 
 #define SHARE_MUX_CONF_REG     0x1
index 51b31df96273602f5a7077bf66bc94a91c699957..8acc4d960cfa3f833565a51386d896879bd39132 100644 (file)
@@ -389,6 +389,7 @@ static const struct pinctrl_pin_desc imx50_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx50_pinctrl_info = {
        .pins = imx50_pinctrl_pads,
        .npins = ARRAY_SIZE(imx50_pinctrl_pads),
+       .gpr_compatible = "fsl,imx50-iomuxc-gpr",
 };
 
 static const struct of_device_id imx50_pinctrl_of_match[] = {
index 7344d340013c01d2ff67dae7ecfbda77b31f3a5f..d39dfd6a3a44b68b6b9843d615c571e38b217349 100644 (file)
@@ -452,6 +452,7 @@ static const struct pinctrl_pin_desc imx53_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx53_pinctrl_info = {
        .pins = imx53_pinctrl_pads,
        .npins = ARRAY_SIZE(imx53_pinctrl_pads),
+       .gpr_compatible = "fsl,imx53-iomuxc-gpr",
 };
 
 static const struct of_device_id imx53_pinctrl_of_match[] = {
index 6805c678c3b220d2e0d5622466441b69e2071bf6..5a2cdb0549cefba4baeb79be44f712b7c7d64c75 100644 (file)
@@ -458,6 +458,7 @@ static const struct pinctrl_pin_desc imx6dl_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx6dl_pinctrl_info = {
        .pins = imx6dl_pinctrl_pads,
        .npins = ARRAY_SIZE(imx6dl_pinctrl_pads),
+       .gpr_compatible = "fsl,imx6q-iomuxc-gpr",
 };
 
 static const struct of_device_id imx6dl_pinctrl_of_match[] = {
index 4d1fcb861ac1ae2f252cf303f4ac0bdc41bf1c90..7d50a36b1086919a7ded811a498f4af97850b21b 100644 (file)
@@ -464,6 +464,7 @@ static const struct pinctrl_pin_desc imx6q_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx6q_pinctrl_info = {
        .pins = imx6q_pinctrl_pads,
        .npins = ARRAY_SIZE(imx6q_pinctrl_pads),
+       .gpr_compatible = "fsl,imx6q-iomuxc-gpr",
 };
 
 static const struct of_device_id imx6q_pinctrl_of_match[] = {
index 83fa5f19ae89ffefacb596af83b7127ff40400bd..e27d17fdc69d8f670458602d7590b7df6ae7da63 100644 (file)
@@ -364,6 +364,7 @@ static const struct pinctrl_pin_desc imx6sl_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx6sl_pinctrl_info = {
        .pins = imx6sl_pinctrl_pads,
        .npins = ARRAY_SIZE(imx6sl_pinctrl_pads),
+       .gpr_compatible = "fsl,imx6sl-iomuxc-gpr",
 };
 
 static const struct of_device_id imx6sl_pinctrl_of_match[] = {
index 0d78fe690818d17a5556e4a38e86ab02f24c1427..117180c26c500d139157030735f9fc443950036b 100644 (file)
@@ -368,6 +368,7 @@ static const struct pinctrl_pin_desc imx6sx_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx6sx_pinctrl_info = {
        .pins = imx6sx_pinctrl_pads,
        .npins = ARRAY_SIZE(imx6sx_pinctrl_pads),
+       .gpr_compatible = "fsl,imx6sx-iomuxc-gpr",
 };
 
 static const struct of_device_id imx6sx_pinctrl_of_match[] = {
index 08e75764e7be011931385df1d0ad6b3a1b68c6a7..78627c70c6baa66e89ba98190f2b915a5bc8df22 100644 (file)
@@ -284,6 +284,7 @@ static const struct pinctrl_pin_desc imx6ul_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx6ul_pinctrl_info = {
        .pins = imx6ul_pinctrl_pads,
        .npins = ARRAY_SIZE(imx6ul_pinctrl_pads),
+       .gpr_compatible = "fsl,imx6ul-iomuxc-gpr",
 };
 
 static struct of_device_id imx6ul_pinctrl_of_match[] = {
index 16dc925117de1ad63cb4fd36251eac746e5bc8a2..1c89613eb4b75d6a943318a5ccccae8fe3df5b02 100644 (file)
@@ -359,6 +359,7 @@ static const struct pinctrl_pin_desc imx7d_lpsr_pinctrl_pads[] = {
 static struct imx_pinctrl_soc_info imx7d_pinctrl_info = {
        .pins = imx7d_pinctrl_pads,
        .npins = ARRAY_SIZE(imx7d_pinctrl_pads),
+       .gpr_compatible = "fsl,imx7d-iomuxc-gpr",
 };
 
 static struct imx_pinctrl_soc_info imx7d_lpsr_pinctrl_info = {