kernel: update linux 3.8 to 3.8.7
[openwrt/staging/mkresin.git] / target / linux / lantiq / patches-3.8 / 0042-PINCTRL-lantiq-fix-pinmux.patch
1 --- a/drivers/pinctrl/pinctrl-xway.c
2 +++ b/drivers/pinctrl/pinctrl-xway.c
3 @@ -563,10 +563,9 @@ static struct pinctrl_desc xway_pctrl_de
4 .confops = &xway_pinconf_ops,
5 };
6
7 -static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
8 +static int mux_apply(struct ltq_pinmux_info *info,
9 int pin, int mux)
10 {
11 - struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
12 int port = PORT(pin);
13 u32 alt1_reg = GPIO_ALT1(pin);
14
15 @@ -586,6 +585,14 @@ static inline int xway_mux_apply(struct
16 return 0;
17 }
18
19 +static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
20 + int pin, int mux)
21 +{
22 + struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
23 +
24 + return mux_apply(info, pin, mux);
25 +}
26 +
27 static const struct ltq_cfg_param xway_cfg_params[] = {
28 {"lantiq,pull", LTQ_PINCONF_PARAM_PULL},
29 {"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
30 @@ -630,6 +637,10 @@ static int xway_gpio_dir_out(struct gpio
31 {
32 struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
33
34 + if (PORT(pin) == PORT3)
35 + gpio_setbit(info->membase[0], GPIO3_OD, PORT_PIN(pin));
36 + else
37 + gpio_setbit(info->membase[0], GPIO_OD(pin), PORT_PIN(pin));
38 gpio_setbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin));
39 xway_gpio_set(chip, pin, val);
40
41 @@ -650,6 +661,18 @@ static void xway_gpio_free(struct gpio_c
42 pinctrl_free_gpio(gpio);
43 }
44
45 +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
46 +{
47 + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
48 + int i;
49 +
50 + for (i = 0; i < info->num_exin; i++)
51 + if (info->exin[i] == offset)
52 + return ltq_eiu_get_irq(i);
53 +
54 + return -1;
55 +}
56 +
57 static struct gpio_chip xway_chip = {
58 .label = "gpio-xway",
59 .direction_input = xway_gpio_dir_in,
60 @@ -658,6 +681,7 @@ static struct gpio_chip xway_chip = {
61 .set = xway_gpio_set,
62 .request = xway_gpio_req,
63 .free = xway_gpio_free,
64 + .to_irq = xway_gpio_to_irq,
65 .base = -1,
66 };
67