Commit 8626ada8 authored by Philipp Zabel's avatar Philipp Zabel Committed by Linus Walleij

pinctrl: imx: attach iomuxc device to gpr syscon

Commit bdb0066d ("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: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Acked-by: default avatarShawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 2c7e3306
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h> #include <linux/pinctrl/pinmux.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/regmap.h>
#include "../core.h" #include "../core.h"
#include "pinctrl-imx.h" #include "pinctrl-imx.h"
...@@ -718,10 +720,12 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, ...@@ -718,10 +720,12 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev,
int imx_pinctrl_probe(struct platform_device *pdev, int imx_pinctrl_probe(struct platform_device *pdev,
struct imx_pinctrl_soc_info *info) struct imx_pinctrl_soc_info *info)
{ {
struct regmap_config config = { .name = "gpr" };
struct device_node *dev_np = pdev->dev.of_node; struct device_node *dev_np = pdev->dev.of_node;
struct device_node *np; struct device_node *np;
struct imx_pinctrl *ipctl; struct imx_pinctrl *ipctl;
struct resource *res; struct resource *res;
struct regmap *gpr;
int ret, i; int ret, i;
if (!info || !info->pins || !info->npins) { if (!info || !info->pins || !info->npins) {
...@@ -730,6 +734,12 @@ int imx_pinctrl_probe(struct platform_device *pdev, ...@@ -730,6 +734,12 @@ int imx_pinctrl_probe(struct platform_device *pdev,
} }
info->dev = &pdev->dev; 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 */ /* Create state holders etc for this driver */
ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL); ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL);
if (!ipctl) if (!ipctl)
......
...@@ -82,6 +82,7 @@ struct imx_pinctrl_soc_info { ...@@ -82,6 +82,7 @@ struct imx_pinctrl_soc_info {
struct imx_pmx_func *functions; struct imx_pmx_func *functions;
unsigned int nfunctions; unsigned int nfunctions;
unsigned int flags; unsigned int flags;
const char *gpr_compatible;
}; };
#define SHARE_MUX_CONF_REG 0x1 #define SHARE_MUX_CONF_REG 0x1
......
...@@ -389,6 +389,7 @@ static const struct pinctrl_pin_desc imx50_pinctrl_pads[] = { ...@@ -389,6 +389,7 @@ static const struct pinctrl_pin_desc imx50_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx50_pinctrl_info = { static struct imx_pinctrl_soc_info imx50_pinctrl_info = {
.pins = imx50_pinctrl_pads, .pins = imx50_pinctrl_pads,
.npins = ARRAY_SIZE(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[] = { static const struct of_device_id imx50_pinctrl_of_match[] = {
......
...@@ -452,6 +452,7 @@ static const struct pinctrl_pin_desc imx53_pinctrl_pads[] = { ...@@ -452,6 +452,7 @@ static const struct pinctrl_pin_desc imx53_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx53_pinctrl_info = { static struct imx_pinctrl_soc_info imx53_pinctrl_info = {
.pins = imx53_pinctrl_pads, .pins = imx53_pinctrl_pads,
.npins = ARRAY_SIZE(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[] = { static const struct of_device_id imx53_pinctrl_of_match[] = {
......
...@@ -458,6 +458,7 @@ static const struct pinctrl_pin_desc imx6dl_pinctrl_pads[] = { ...@@ -458,6 +458,7 @@ static const struct pinctrl_pin_desc imx6dl_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx6dl_pinctrl_info = { static struct imx_pinctrl_soc_info imx6dl_pinctrl_info = {
.pins = imx6dl_pinctrl_pads, .pins = imx6dl_pinctrl_pads,
.npins = ARRAY_SIZE(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[] = { static const struct of_device_id imx6dl_pinctrl_of_match[] = {
......
...@@ -464,6 +464,7 @@ static const struct pinctrl_pin_desc imx6q_pinctrl_pads[] = { ...@@ -464,6 +464,7 @@ static const struct pinctrl_pin_desc imx6q_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx6q_pinctrl_info = { static struct imx_pinctrl_soc_info imx6q_pinctrl_info = {
.pins = imx6q_pinctrl_pads, .pins = imx6q_pinctrl_pads,
.npins = ARRAY_SIZE(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[] = { static const struct of_device_id imx6q_pinctrl_of_match[] = {
......
...@@ -364,6 +364,7 @@ static const struct pinctrl_pin_desc imx6sl_pinctrl_pads[] = { ...@@ -364,6 +364,7 @@ static const struct pinctrl_pin_desc imx6sl_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx6sl_pinctrl_info = { static struct imx_pinctrl_soc_info imx6sl_pinctrl_info = {
.pins = imx6sl_pinctrl_pads, .pins = imx6sl_pinctrl_pads,
.npins = ARRAY_SIZE(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[] = { static const struct of_device_id imx6sl_pinctrl_of_match[] = {
......
...@@ -368,6 +368,7 @@ static const struct pinctrl_pin_desc imx6sx_pinctrl_pads[] = { ...@@ -368,6 +368,7 @@ static const struct pinctrl_pin_desc imx6sx_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx6sx_pinctrl_info = { static struct imx_pinctrl_soc_info imx6sx_pinctrl_info = {
.pins = imx6sx_pinctrl_pads, .pins = imx6sx_pinctrl_pads,
.npins = ARRAY_SIZE(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[] = { static const struct of_device_id imx6sx_pinctrl_of_match[] = {
......
...@@ -284,6 +284,7 @@ static const struct pinctrl_pin_desc imx6ul_pinctrl_pads[] = { ...@@ -284,6 +284,7 @@ static const struct pinctrl_pin_desc imx6ul_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx6ul_pinctrl_info = { static struct imx_pinctrl_soc_info imx6ul_pinctrl_info = {
.pins = imx6ul_pinctrl_pads, .pins = imx6ul_pinctrl_pads,
.npins = ARRAY_SIZE(imx6ul_pinctrl_pads), .npins = ARRAY_SIZE(imx6ul_pinctrl_pads),
.gpr_compatible = "fsl,imx6ul-iomuxc-gpr",
}; };
static struct of_device_id imx6ul_pinctrl_of_match[] = { static struct of_device_id imx6ul_pinctrl_of_match[] = {
......
...@@ -359,6 +359,7 @@ static const struct pinctrl_pin_desc imx7d_lpsr_pinctrl_pads[] = { ...@@ -359,6 +359,7 @@ static const struct pinctrl_pin_desc imx7d_lpsr_pinctrl_pads[] = {
static struct imx_pinctrl_soc_info imx7d_pinctrl_info = { static struct imx_pinctrl_soc_info imx7d_pinctrl_info = {
.pins = imx7d_pinctrl_pads, .pins = imx7d_pinctrl_pads,
.npins = ARRAY_SIZE(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 = { static struct imx_pinctrl_soc_info imx7d_lpsr_pinctrl_info = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment