From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] pinctrl/imx: add zero register offset valid for Vybrid platform
Date: Thu, 2 May 2013 20:27:59 +0200 [thread overview]
Message-ID: <20130502182759.GQ32299@pengutronix.de> (raw)
In-Reply-To: <1367480932-22318-2-git-send-email-b35083@freescale.com>
On Thu, May 02, 2013 at 03:48:52PM +0800, Jingchang Lu wrote:
> On some platform such as Vybrid, offset of mux and pad ctrl register
> may be zero. This patch add a platform condition to imx core pinctrl
> framework, making zero register offset valid on setting mux_mode and
> pad config value.
>
> Signed-off-by: Jingchang Lu <b35083@freescale.com>
> ---
> drivers/pinctrl/pinctrl-imx.c | 34 ++++++++++++++++++++++------------
> 1 file changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
> index 4fcfff92..b4d7c91 100644
> --- a/drivers/pinctrl/pinctrl-imx.c
> +++ b/drivers/pinctrl/pinctrl-imx.c
> @@ -221,10 +221,14 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
> pin_id = pins[i];
> pin_reg = &info->pin_regs[pin_id];
>
> - if (!pin_reg->mux_reg) {
> - dev_err(ipctl->dev, "Pin(%s) does not support mux function\n",
> - info->pins[pin_id].name);
> - return -EINVAL;
> + /* mux_reg offset maybe zero on some platform such as Vybrid */
> + if (!of_machine_is_compatible("fsl,mvf600")) {
> + if (!pin_reg->mux_reg) {
Please add a zero_offset_valid flag to the drivers private structure
instead of using a rather expensive function in a frequently used path.
Also the && operator can be used to test for two conditions being true.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-05-02 18:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 7:48 [PATCH V2 1/2] pinctrl/mvf: add MVF pinctrl driver Jingchang Lu
2013-05-02 7:48 ` [PATCH 2/2] pinctrl/imx: add zero register offset valid for Vybrid platform Jingchang Lu
2013-05-02 18:27 ` Sascha Hauer [this message]
2013-05-03 8:35 ` Shawn Guo
2013-05-06 2:54 ` [PATCH V2 1/2] pinctrl/mvf: add MVF pinctrl driver Shawn Guo
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=20130502182759.GQ32299@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).