0055-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  2. Date: Fri, 24 Jul 2015 09:10:00 +0000
  3. Subject: ar71xx: Allow to use ath79_gpio_output_select on QCA955x
  4. Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  5. Backport of r46459
  6. Forwarded: https://patchwork.ozlabs.org/patch/624182/
  7. diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch
  8. new file mode 100644
  9. index 0000000..e71b6e2
  10. --- /dev/null
  11. +++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch
  12. @@ -0,0 +1,63 @@
  13. +--- a/arch/mips/ath79/gpio.c
  14. ++++ b/arch/mips/ath79/gpio.c
  15. +@@ -187,15 +187,30 @@ void __init ath79_gpio_output_select(uns
  16. + {
  17. + void __iomem *base = ath79_gpio_base;
  18. + unsigned long flags;
  19. +- unsigned int reg;
  20. ++ unsigned int reg, reg_base;
  21. ++ unsigned long gpio_count;
  22. + u32 t, s;
  23. +
  24. +- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
  25. ++ if (soc_is_ar934x()) {
  26. ++ gpio_count = AR934X_GPIO_COUNT;
  27. ++ reg_base = AR934X_GPIO_REG_OUT_FUNC0;
  28. ++ } else if (soc_is_qca953x()) {
  29. ++ gpio_count = QCA953X_GPIO_COUNT;
  30. ++ reg_base = QCA953X_GPIO_REG_OUT_FUNC0;
  31. ++ } else if (soc_is_qca955x()) {
  32. ++ gpio_count = QCA955X_GPIO_COUNT;
  33. ++ reg_base = QCA955X_GPIO_REG_OUT_FUNC0;
  34. ++ } else if (soc_is_qca956x()) {
  35. ++ gpio_count = QCA956X_GPIO_COUNT;
  36. ++ reg_base = QCA956X_GPIO_REG_OUT_FUNC0;
  37. ++ } else {
  38. ++ BUG();
  39. ++ }
  40. +
  41. +- if (gpio >= AR934X_GPIO_COUNT)
  42. ++ if (gpio >= gpio_count)
  43. + return;
  44. +
  45. +- reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
  46. ++ reg = reg_base + 4 * (gpio / 4);
  47. + s = 8 * (gpio % 4);
  48. +
  49. + spin_lock_irqsave(&ath79_gpio_lock, flags);
  50. +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  51. ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  52. +@@ -875,6 +875,14 @@
  53. + #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
  54. + #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
  55. +
  56. ++#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c
  57. ++#define QCA955X_GPIO_REG_OUT_FUNC1 0x30
  58. ++#define QCA955X_GPIO_REG_OUT_FUNC2 0x34
  59. ++#define QCA955X_GPIO_REG_OUT_FUNC3 0x38
  60. ++#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c
  61. ++#define QCA955X_GPIO_REG_OUT_FUNC5 0x40
  62. ++#define QCA955X_GPIO_REG_FUNC 0x6c
  63. ++
  64. + #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c
  65. + #define QCA956X_GPIO_REG_OUT_FUNC1 0x30
  66. + #define QCA956X_GPIO_REG_OUT_FUNC2 0x34
  67. +@@ -1014,6 +1022,8 @@
  68. + #define AR934X_GPIO_OUT_EXT_LNA0 46
  69. + #define AR934X_GPIO_OUT_EXT_LNA1 47
  70. +
  71. ++#define QCA955X_GPIO_OUT_GPIO 0
  72. ++
  73. + /*
  74. + * MII_CTRL block
  75. + */