739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --- a/arch/mips/ath79/gpio.c
  2. +++ b/arch/mips/ath79/gpio.c
  3. @@ -186,6 +186,7 @@ static void __iomem *ath79_gpio_get_func
  4. reg = AR71XX_GPIO_REG_FUNC;
  5. else if (soc_is_ar934x() ||
  6. soc_is_qca953x() ||
  7. + soc_is_qca955x() ||
  8. soc_is_qca956x() ||
  9. soc_is_tp9343())
  10. reg = AR934X_GPIO_REG_FUNC;
  11. @@ -223,15 +224,30 @@ void __init ath79_gpio_output_select(uns
  12. {
  13. void __iomem *base = ath79_gpio_base;
  14. unsigned long flags;
  15. - unsigned int reg;
  16. + unsigned int reg, reg_base;
  17. + unsigned long gpio_count;
  18. u32 t, s;
  19. - BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
  20. + if (soc_is_ar934x()) {
  21. + gpio_count = AR934X_GPIO_COUNT;
  22. + reg_base = AR934X_GPIO_REG_OUT_FUNC0;
  23. + } else if (soc_is_qca953x()) {
  24. + gpio_count = QCA953X_GPIO_COUNT;
  25. + reg_base = QCA953X_GPIO_REG_OUT_FUNC0;
  26. + } else if (soc_is_qca955x()) {
  27. + gpio_count = QCA955X_GPIO_COUNT;
  28. + reg_base = QCA955X_GPIO_REG_OUT_FUNC0;
  29. + } else if (soc_is_qca956x()) {
  30. + gpio_count = QCA956X_GPIO_COUNT;
  31. + reg_base = QCA956X_GPIO_REG_OUT_FUNC0;
  32. + } else {
  33. + BUG();
  34. + }
  35. - if (gpio >= AR934X_GPIO_COUNT)
  36. + if (gpio >= gpio_count)
  37. return;
  38. - reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
  39. + reg = reg_base + 4 * (gpio / 4);
  40. s = 8 * (gpio % 4);
  41. spin_lock_irqsave(&ath79_gpio_lock, flags);