From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 11/16] i.MX: iomuxv3: Use helper functions in iomux-v3.h
Date: Mon, 5 Dec 2016 06:54:39 -0800 [thread overview]
Message-ID: <1480949684-18520-12-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1480949684-18520-1-git-send-email-andrew.smirnov@gmail.com>
Avoid code duplication by using helper functions from iomux-v3.h
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/pinctrl/imx-iomux-v3.c | 38 ++++----------------------------------
1 file changed, 4 insertions(+), 34 deletions(-)
diff --git a/drivers/pinctrl/imx-iomux-v3.c b/drivers/pinctrl/imx-iomux-v3.c
index 4b3f033..bc93140 100644
--- a/drivers/pinctrl/imx-iomux-v3.c
+++ b/drivers/pinctrl/imx-iomux-v3.c
@@ -31,46 +31,17 @@ struct imx_iomux_v3 {
};
static void __iomem *iomuxv3_base;
-static struct device_d *iomuxv3_dev;
-static void imx_iomuxv3_setup_single(void __iomem *base, struct device_d *dev,
- u32 mux_reg, u32 conf_reg, u32 input_reg,
- u32 mux_val, u32 conf_val, u32 input_val)
-{
- dev_dbg(dev,
- "mux: 0x%08x -> 0x%04x, conf: 0x%08x -> 0x%04x input: 0x%08x -> 0x%04x\n",
- mux_val, mux_reg, conf_val, conf_reg, input_val, input_reg);
-
- if (mux_reg)
- writel(mux_val, base + mux_reg);
- if (conf_reg)
- writel(conf_val, base + conf_reg);
- if (input_reg)
- writel(input_val, base + input_reg);
-}
/*
* configures a single pad in the iomuxer
*/
int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
{
- u32 mux_reg = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT;
- u32 mux_val = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT;
- u32 input_reg = (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT;
- u32 input_val = (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT;
- u32 conf_reg = (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT;
- u32 conf_val = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT;
-
if (!iomuxv3_base)
return -EINVAL;
- if (conf_val & NO_PAD_CTRL)
- conf_reg = 0;
-
- imx_iomuxv3_setup_single(iomuxv3_base, iomuxv3_dev,
- mux_reg, conf_reg, input_reg,
- mux_val, conf_val, input_val);
-
+ imx_setup_pad(iomuxv3_base, pad);
return 0;
}
EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
@@ -140,9 +111,9 @@ static int imx_iomux_v3_set_state(struct pinctrl_device *pdev, struct device_nod
if (conf_val & IMX_DT_NO_PAD_CTL)
conf_reg = 0;
- imx_iomuxv3_setup_single(iomux->base, iomux->pinctrl.dev,
- mux_reg, conf_reg, input_reg,
- mux_val, conf_val, input_val);
+ iomux_v3_setup_pad(iomux->base, 0,
+ mux_reg, conf_reg, input_reg,
+ mux_val, conf_val, input_val);
}
return 0;
@@ -183,7 +154,6 @@ static int imx_iomux_v3_probe(struct device_d *dev)
if (IS_ERR(iores))
return PTR_ERR(iores);
iomuxv3_base = IOMEM(iores->start);
- iomuxv3_dev = dev;
if (IS_ENABLED(CONFIG_PINCTRL) && dev->device_node)
ret = imx_pinctrl_dt(dev, iomuxv3_base);
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-12-05 14:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 14:54 [PATCH 00/16] Vybrid related patches Andrey Smirnov
2016-12-05 14:54 ` [PATCH 01/16] i.MX: esdhc: Enable host->clk during initialization Andrey Smirnov
2016-12-05 14:54 ` [PATCH 02/16] i.MX: ocotp: Add provisions for storing multiple MAC addresses Andrey Smirnov
2016-12-05 15:14 ` Stefan Lengfeld
2016-12-06 14:48 ` Andrey Smirnov
2016-12-07 8:51 ` Stefan Lengfeld
2016-12-07 19:13 ` Sascha Hauer
2016-12-07 19:36 ` Andrey Smirnov
2016-12-07 20:57 ` Sascha Hauer
2016-12-07 19:32 ` Andrey Smirnov
2016-12-05 14:54 ` [PATCH 03/16] i.MX: ocotp: Initialize OCOTP as early as possible Andrey Smirnov
2016-12-05 14:54 ` [PATCH 04/16] i.MX: ocotp: Initialize 'sense_enable' to true on Vybrid Andrey Smirnov
2016-12-05 14:54 ` [PATCH 05/16] i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype Andrey Smirnov
2016-12-05 14:54 ` [PATCH 06/16] i.MX: vf610: Ramp CPU clock to maximum frequency Andrey Smirnov
2016-12-07 19:27 ` Sascha Hauer
2016-12-12 5:24 ` Andrey Smirnov
2016-12-05 14:54 ` [PATCH 07/16] i.MX: iomuxv3: Add low-level pad code to headers Andrey Smirnov
2016-12-05 14:54 ` [PATCH 08/16] i.MX: iomuxv3: Add helper type to deconstruct iomux_v3_cfg_t values Andrey Smirnov
2016-12-05 14:54 ` [PATCH 09/16] i.MX: iomuxv3: Add low-level pad configuration routine Andrey Smirnov
2016-12-05 14:54 ` [PATCH 10/16] i.MX6: sabresd: Remove magic numbers in setup_uart Andrey Smirnov
2016-12-05 14:54 ` Andrey Smirnov [this message]
2016-12-05 14:54 ` [PATCH 12/16] i.MX: vf610: Add low-level pin configuration helper Andrey Smirnov
2016-12-05 14:54 ` [PATCH 13/16] i.MX: iomux-vf610: Add missing pad definitions Andrey Smirnov
2016-12-05 14:54 ` [PATCH 14/16] i.MX: imx-usb-phy: Add VF610 OF compatiblity string Andrey Smirnov
2016-12-05 14:54 ` [PATCH 15/16] i.MX: Default CONFI_USB_IMX_PHY to 'y' on Vybrid Andrey Smirnov
2016-12-05 14:54 ` [PATCH 16/16] i.MX: imx-usb-misc: Add Vybrid support Andrey Smirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480949684-18520-12-git-send-email-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox