From: Martin Schiller <mschiller@tdt.de>
To: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@linux-mips.org
Cc: linus.walleij@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org, ralf@linux-mips.org, blogic@openwrt.org,
hauke@hauke-m.de, jogo@openwrt.org,
Martin Schiller <mschiller@tdt.de>
Subject: [PATCH 4/4] pinctrl/lantiq: fix up pinmux
Date: Fri, 20 Nov 2015 05:52:31 +0100 [thread overview]
Message-ID: <1447995151-3857-4-git-send-email-mschiller@tdt.de> (raw)
In-Reply-To: <1447995151-3857-1-git-send-email-mschiller@tdt.de>
From: John Crispin <blogic@openwrt.org>
This patch is included in the openwrt patchset for several years now and needs
to go upstream as well. It includes the following changes:
1. Fix up inline function call to xway_mux_apply
2. Fix GPIO Setup of GPIO Port3
3. Implement gpio_chip.to_irq
Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Martin Schiller <mschiller@tdt.de>
---
drivers/pinctrl/pinctrl-xway.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index 234d3f4..11ec71c 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -1507,10 +1507,9 @@ static struct pinctrl_desc xway_pctrl_desc = {
.confops = &xway_pinconf_ops,
};
-static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
+static int mux_apply(struct ltq_pinmux_info *info,
int pin, int mux)
{
- struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
int port = PORT(pin);
u32 alt1_reg = GPIO_ALT1(pin);
@@ -1530,6 +1529,14 @@ static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
return 0;
}
+static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
+ int pin, int mux)
+{
+ struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+
+ return mux_apply(info, pin, mux);
+}
+
static const struct ltq_cfg_param xway_cfg_params[] = {
{"lantiq,pull", LTQ_PINCONF_PARAM_PULL},
{"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
@@ -1574,12 +1581,28 @@ static int xway_gpio_dir_out(struct gpio_chip *chip, unsigned int pin, int val)
{
struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
+ if (PORT(pin) == PORT3)
+ gpio_setbit(info->membase[0], GPIO3_OD, PORT_PIN(pin));
+ else
+ gpio_setbit(info->membase[0], GPIO_OD(pin), PORT_PIN(pin));
gpio_setbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin));
xway_gpio_set(chip, pin, val);
return 0;
}
+static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+ struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
+ int i;
+
+ for (i = 0; i < info->num_exin; i++)
+ if (info->exin[i] == offset)
+ return ltq_eiu_get_irq(i);
+
+ return -1;
+}
+
static struct gpio_chip xway_chip = {
.label = "gpio-xway",
.direction_input = xway_gpio_dir_in,
@@ -1588,6 +1611,7 @@ static struct gpio_chip xway_chip = {
.set = xway_gpio_set,
.request = gpiochip_generic_request,
.free = gpiochip_generic_free,
+ .to_irq = xway_gpio_to_irq,
.base = -1,
};
--
2.1.4
next prev parent reply other threads:[~2015-11-20 4:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 4:52 [PATCH 1/4] pinctrl/lantiq: update devicetree bindings Documentation Martin Schiller
2015-11-20 4:52 ` [PATCH 2/4] pinctrl/lantiq: introduce new dedicated devicetree bindings Martin Schiller
2015-11-21 14:51 ` Hauke Mehrtens
2015-11-23 11:00 ` Martin Schiller
2015-11-20 4:52 ` [PATCH 3/4] pinctrl/lantiq: update devicetree binding in dts file Martin Schiller
2015-11-20 4:52 ` Martin Schiller [this message]
[not found] ` <1447995151-3857-1-git-send-email-mschiller-h82pf8jx2gI@public.gmane.org>
2015-11-20 14:26 ` [PATCH 1/4] pinctrl/lantiq: update devicetree bindings Documentation Rob Herring
2015-11-23 10:46 ` Martin Schiller
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=1447995151-3857-4-git-send-email-mschiller@tdt.de \
--to=mschiller@tdt.de \
--cc=blogic@openwrt.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=hauke@hauke-m.de \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jogo@openwrt.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=ralf@linux-mips.org \
--cc=robh+dt@kernel.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).