aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-imx.c
diff options
context:
space:
mode:
authorSherman Yin <syin@broadcom.com>2013-08-27 14:32:12 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-08-28 07:34:41 -0400
commit03b054e9696c3cbd3d5905ec96da15acd0a2fe8d (patch)
tree7123b780c194d350b3e5134c267e17262effb385 /drivers/pinctrl/pinctrl-imx.c
parentf5ba9c52bf1e236c4698c240955e5f119db62a28 (diff)
pinctrl: Pass all configs to driver on pin_config_set()
When setting pin configuration in the pinctrl framework, pin_config_set() or pin_config_group_set() is called in a loop to set one configuration at a time for the specified pin or group. This patch 1) removes the loop and 2) changes the API to pass the whole pin config array to the driver. It is now up to the driver to loop through the configs. This allows the driver to potentially combine configs and reduce the number of writes to pin config registers. All c files changed have been build-tested to verify the change compiles and that the corresponding .o is successfully generated. Signed-off-by: Sherman Yin <syin@broadcom.com> Reviewed-by: Christian Daudt <csd@broadcom.com> Reviewed-by: Matt Porter <matt.porter@linaro.org> Tested-by: Stephen Warren <swarren@nvidia.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-imx.c')
-rw-r--r--drivers/pinctrl/pinctrl-imx.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 360249301315..d78dd813bff9 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -323,11 +323,13 @@ static int imx_pinconf_get(struct pinctrl_dev *pctldev,
323} 323}
324 324
325static int imx_pinconf_set(struct pinctrl_dev *pctldev, 325static int imx_pinconf_set(struct pinctrl_dev *pctldev,
326 unsigned pin_id, unsigned long config) 326 unsigned pin_id, unsigned long *configs,
327 unsigned num_configs)
327{ 328{
328 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); 329 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
329 const struct imx_pinctrl_soc_info *info = ipctl->info; 330 const struct imx_pinctrl_soc_info *info = ipctl->info;
330 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; 331 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id];
332 int i;
331 333
332 if (!(info->flags & ZERO_OFFSET_VALID) && !pin_reg->conf_reg) { 334 if (!(info->flags & ZERO_OFFSET_VALID) && !pin_reg->conf_reg) {
333 dev_err(info->dev, "Pin(%s) does not support config function\n", 335 dev_err(info->dev, "Pin(%s) does not support config function\n",
@@ -338,17 +340,19 @@ static int imx_pinconf_set(struct pinctrl_dev *pctldev,
338 dev_dbg(ipctl->dev, "pinconf set pin %s\n", 340 dev_dbg(ipctl->dev, "pinconf set pin %s\n",
339 info->pins[pin_id].name); 341 info->pins[pin_id].name);
340 342
341 if (info->flags & SHARE_MUX_CONF_REG) { 343 for (i = 0; i < num_configs; i++) {
342 u32 reg; 344 if (info->flags & SHARE_MUX_CONF_REG) {
343 reg = readl(ipctl->base + pin_reg->conf_reg); 345 u32 reg;
344 reg &= ~0xffff; 346 reg = readl(ipctl->base + pin_reg->conf_reg);
345 reg |= config; 347 reg &= ~0xffff;
346 writel(reg, ipctl->base + pin_reg->conf_reg); 348 reg |= configs[i];
347 } else { 349 writel(reg, ipctl->base + pin_reg->conf_reg);
348 writel(config, ipctl->base + pin_reg->conf_reg); 350 } else {
349 } 351 writel(configs[i], ipctl->base + pin_reg->conf_reg);
350 dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%lx\n", 352 }
351 pin_reg->conf_reg, config); 353 dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%lx\n",
354 pin_reg->conf_reg, configs[i]);
355 } /* for each config */
352 356
353 return 0; 357 return 0;
354} 358}