0012-pinctrl-lantiq-fix-up-pinmux.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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
  5. We found out how to set the gphy led pinmuxing.
  6. Signed-off-by: John Crispin <blogic@openwrt.org>
  7. ---
  8. drivers/pinctrl/pinctrl-xway.c | 28 ++++++++++++++++++++++++++--
  9. 1 file changed, 26 insertions(+), 2 deletions(-)
  10. --- a/drivers/pinctrl/pinctrl-xway.c
  11. +++ b/drivers/pinctrl/pinctrl-xway.c
  12. @@ -609,10 +609,9 @@ static struct pinctrl_desc xway_pctrl_de
  13. .confops = &xway_pinconf_ops,
  14. };
  15. -static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
  16. +static int mux_apply(struct ltq_pinmux_info *info,
  17. int pin, int mux)
  18. {
  19. - struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
  20. int port = PORT(pin);
  21. u32 alt1_reg = GPIO_ALT1(pin);
  22. @@ -632,6 +631,14 @@ static inline int xway_mux_apply(struct
  23. return 0;
  24. }
  25. +static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
  26. + int pin, int mux)
  27. +{
  28. + struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
  29. +
  30. + return mux_apply(info, pin, mux);
  31. +}
  32. +
  33. static const struct ltq_cfg_param xway_cfg_params[] = {
  34. {"lantiq,pull", LTQ_PINCONF_PARAM_PULL},
  35. {"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
  36. @@ -682,6 +689,18 @@ static int xway_gpio_dir_out(struct gpio
  37. return 0;
  38. }
  39. +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
  40. +{
  41. + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
  42. + int i;
  43. +
  44. + for (i = 0; i < info->num_exin; i++)
  45. + if (info->exin[i] == offset)
  46. + return ltq_eiu_get_irq(i);
  47. +
  48. + return -1;
  49. +}
  50. +
  51. static struct gpio_chip xway_chip = {
  52. .label = "gpio-xway",
  53. .direction_input = xway_gpio_dir_in,
  54. @@ -690,6 +709,7 @@ static struct gpio_chip xway_chip = {
  55. .set = xway_gpio_set,
  56. .request = gpiochip_generic_request,
  57. .free = gpiochip_generic_free,
  58. + .to_irq = xway_gpio_to_irq,
  59. .base = -1,
  60. };