1 From 25494c55a4007a1409f53ddbafd661636e47ea34 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 9 Aug 2013 20:38:15 +0200
4 Subject: [PATCH 12/36] pinctrl/lantiq: fix up pinmux
6 We found out how to set the gphy led pinmuxing.
8 Signed-off-by: John Crispin <blogic@openwrt.org>
10 drivers/pinctrl/pinctrl-xway.c | 28 ++++++++++++++++++++++++++--
11 1 file changed, 26 insertions(+), 2 deletions(-)
13 diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
14 index e66f4ca..b5f43c8 100644
15 --- a/drivers/pinctrl/pinctrl-xway.c
16 +++ b/drivers/pinctrl/pinctrl-xway.c
17 @@ -609,10 +609,9 @@ static struct pinctrl_desc xway_pctrl_desc = {
18 .confops = &xway_pinconf_ops,
21 -static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
22 +static int mux_apply(struct ltq_pinmux_info *info,
25 - struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
27 u32 alt1_reg = GPIO_ALT1(pin);
29 @@ -632,6 +631,14 @@ static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
33 +static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
36 + struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
38 + return mux_apply(info, pin, mux);
41 static const struct ltq_cfg_param xway_cfg_params[] = {
42 {"lantiq,pull", LTQ_PINCONF_PARAM_PULL},
43 {"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
44 @@ -676,6 +683,10 @@ static int xway_gpio_dir_out(struct gpio_chip *chip, unsigned int pin, int val)
46 struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
48 + if (PORT(pin) == PORT3)
49 + gpio_setbit(info->membase[0], GPIO3_OD, PORT_PIN(pin));
51 + gpio_setbit(info->membase[0], GPIO_OD(pin), PORT_PIN(pin));
52 gpio_setbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin));
53 xway_gpio_set(chip, pin, val);
55 @@ -696,6 +707,18 @@ static void xway_gpio_free(struct gpio_chip *chip, unsigned offset)
56 pinctrl_free_gpio(gpio);
59 +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
61 + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
64 + for (i = 0; i < info->num_exin; i++)
65 + if (info->exin[i] == offset)
66 + return ltq_eiu_get_irq(i);
71 static struct gpio_chip xway_chip = {
73 .direction_input = xway_gpio_dir_in,
74 @@ -704,6 +727,7 @@ static struct gpio_chip xway_chip = {
76 .request = xway_gpio_req,
77 .free = xway_gpio_free,
78 + .to_irq = xway_gpio_to_irq,