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 --- a/drivers/pinctrl/pinctrl-xway.c
14 +++ b/drivers/pinctrl/pinctrl-xway.c
15 @@ -609,10 +609,9 @@ static struct pinctrl_desc xway_pctrl_de
16 .confops = &xway_pinconf_ops,
19 -static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
20 +static int mux_apply(struct ltq_pinmux_info *info,
23 - struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
25 u32 alt1_reg = GPIO_ALT1(pin);
27 @@ -632,6 +631,14 @@ static inline int xway_mux_apply(struct
31 +static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
34 + struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
36 + return mux_apply(info, pin, mux);
39 static const struct ltq_cfg_param xway_cfg_params[] = {
40 {"lantiq,pull", LTQ_PINCONF_PARAM_PULL},
41 {"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
42 @@ -676,6 +683,10 @@ static int xway_gpio_dir_out(struct gpio
44 struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
46 + if (PORT(pin) == PORT3)
47 + gpio_setbit(info->membase[0], GPIO3_OD, PORT_PIN(pin));
49 + gpio_setbit(info->membase[0], GPIO_OD(pin), PORT_PIN(pin));
50 gpio_setbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin));
51 xway_gpio_set(chip, pin, val);
53 @@ -696,6 +707,18 @@ static void xway_gpio_free(struct gpio_c
54 pinctrl_free_gpio(gpio);
57 +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
59 + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
62 + for (i = 0; i < info->num_exin; i++)
63 + if (info->exin[i] == offset)
64 + return ltq_eiu_get_irq(i);
69 static struct gpio_chip xway_chip = {
71 .direction_input = xway_gpio_dir_in,
72 @@ -704,6 +727,7 @@ static struct gpio_chip xway_chip = {
74 .request = xway_gpio_req,
75 .free = xway_gpio_free,
76 + .to_irq = xway_gpio_to_irq,