Commit 26d8cde5 authored by Adrian Alonso's avatar Adrian Alonso Committed by Linus Walleij

pinctrl: freescale: imx: add shared input select reg support

- Add shared input select register support
- imx7d has two iomux controllers iomuxc and iomuxc-lpsr
  which share select_input register for daisy chain settings
Signed-off-by: default avatarAdrian Alonso <aalonso@freescale.com>
Acked-by: default avatarShawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e7b37a52
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#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>
#include <linux/of_address.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
...@@ -39,6 +40,7 @@ struct imx_pinctrl { ...@@ -39,6 +40,7 @@ struct imx_pinctrl {
struct device *dev; struct device *dev;
struct pinctrl_dev *pctl; struct pinctrl_dev *pctl;
void __iomem *base; void __iomem *base;
void __iomem *input_sel_base;
const struct imx_pinctrl_soc_info *info; const struct imx_pinctrl_soc_info *info;
}; };
...@@ -254,7 +256,12 @@ static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -254,7 +256,12 @@ static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
* Regular select input register can never be at offset * Regular select input register can never be at offset
* 0, and we only print register value for regular case. * 0, and we only print register value for regular case.
*/ */
writel(pin->input_val, ipctl->base + pin->input_reg); if (ipctl->input_sel_base)
writel(pin->input_val, ipctl->input_sel_base +
pin->input_reg);
else
writel(pin->input_val, ipctl->base +
pin->input_reg);
dev_dbg(ipctl->dev, dev_dbg(ipctl->dev,
"==>select_input: offset 0x%x val 0x%x\n", "==>select_input: offset 0x%x val 0x%x\n",
pin->input_reg, pin->input_val); pin->input_reg, pin->input_val);
...@@ -685,6 +692,8 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, ...@@ -685,6 +692,8 @@ 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 device_node *dev_np = pdev->dev.of_node;
struct device_node *np;
struct imx_pinctrl *ipctl; struct imx_pinctrl *ipctl;
struct resource *res; struct resource *res;
int ret, i; int ret, i;
...@@ -715,6 +724,23 @@ int imx_pinctrl_probe(struct platform_device *pdev, ...@@ -715,6 +724,23 @@ int imx_pinctrl_probe(struct platform_device *pdev,
if (IS_ERR(ipctl->base)) if (IS_ERR(ipctl->base))
return PTR_ERR(ipctl->base); return PTR_ERR(ipctl->base);
if (of_property_read_bool(dev_np, "fsl,input-sel")) {
np = of_parse_phandle(dev_np, "fsl,input-sel", 0);
if (np) {
ipctl->input_sel_base = of_iomap(np, 0);
if (IS_ERR(ipctl->input_sel_base)) {
of_node_put(np);
dev_err(&pdev->dev,
"iomuxc input select base address not found\n");
return PTR_ERR(ipctl->input_sel_base);
}
} else {
dev_err(&pdev->dev, "iomuxc fsl,input-sel property not found\n");
return -EINVAL;
}
of_node_put(np);
}
imx_pinctrl_desc.name = dev_name(&pdev->dev); imx_pinctrl_desc.name = dev_name(&pdev->dev);
imx_pinctrl_desc.pins = info->pins; imx_pinctrl_desc.pins = info->pins;
imx_pinctrl_desc.npins = info->npins; imx_pinctrl_desc.npins = info->npins;
......
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