linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] pinctrl: rockchip: handle first half of rk3188-bank0 correctly
Date: Wed, 26 Mar 2014 00:57:52 +0100	[thread overview]
Message-ID: <1405109.Gq1eC4TnP1@diego> (raw)
In-Reply-To: <1647754.qr1tAySXax@diego>

The first half of pinbank 0 only has one muxing function (as gpios) and
does not have a special mux-register.

Therefore ensure that no other mux function can be selected and also do not
write to a non-existent register.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/pinctrl/pinctrl-rockchip.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 80e28e5..ffcd4f4 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -350,6 +350,20 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
 	u8 bit;
 	u32 data;
 
+	/*
+	 * The first 16 pins of rk3188_bank0 are always gpios and do not have
+	 * a mux register at all.
+	 */
+	if (bank->bank_type == RK3188_BANK0 && pin < 16) {
+		if (mux != RK_FUNC_GPIO) {
+			dev_err(info->dev,
+				"pin %d only supports a gpio mux\n", pin);
+			return -ENOTSUPP;
+		} else {
+			return 0;
+		}
+	}
+
 	dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n",
 						bank->bank_num, pin, mux);
 
-- 
1.9.0

  parent reply	other threads:[~2014-03-25 23:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 22:36 [PATCH] pinctrl: rockchip: fix offset of mux registers for rk3188 Beniamino Galvani
2014-03-24 23:14 ` Heiko Stübner
2014-03-25 19:43   ` Beniamino Galvani
2014-03-25 23:56     ` [PATCH 0/2] pinctrl: rockchip: fix handling of first pinbank Heiko Stübner
2014-03-25 23:57       ` [PATCH 1/2] pinctrl: rockchip: add return value to rockchip_set_mux Heiko Stübner
2014-03-25 23:57       ` Heiko Stübner [this message]
2014-04-03 14:13       ` [PATCH 0/2] pinctrl: rockchip: fix handling of first pinbank Linus Walleij
2014-04-03 14:10 ` [PATCH] pinctrl: rockchip: fix offset of mux registers for rk3188 Linus Walleij
2014-04-03 14:20   ` Heiko Stübner
2014-04-03 15:27     ` Linus Walleij

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=1405109.Gq1eC4TnP1@diego \
    --to=heiko@sntech.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).