521-MIPS-ath79-enable-UART-for-early_serial.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --- a/arch/mips/ath79/early_printk.c
  2. +++ b/arch/mips/ath79/early_printk.c
  3. @@ -56,6 +56,46 @@ static void prom_putchar_dummy(unsigned
  4. /* nothing to do */
  5. }
  6. +static void prom_enable_uart(u32 id)
  7. +{
  8. + void __iomem *gpio_base;
  9. + u32 uart_en;
  10. + u32 t;
  11. +
  12. + switch (id) {
  13. + case REV_ID_MAJOR_AR71XX:
  14. + uart_en = AR71XX_GPIO_FUNC_UART_EN;
  15. + break;
  16. +
  17. + case REV_ID_MAJOR_AR7240:
  18. + case REV_ID_MAJOR_AR7241:
  19. + case REV_ID_MAJOR_AR7242:
  20. + uart_en = AR724X_GPIO_FUNC_UART_EN;
  21. + break;
  22. +
  23. + case REV_ID_MAJOR_AR913X:
  24. + uart_en = AR913X_GPIO_FUNC_UART_EN;
  25. + break;
  26. +
  27. + case REV_ID_MAJOR_AR9330:
  28. + case REV_ID_MAJOR_AR9331:
  29. + uart_en = AR933X_GPIO_FUNC_UART_EN;
  30. + break;
  31. +
  32. + case REV_ID_MAJOR_AR9341:
  33. + case REV_ID_MAJOR_AR9342:
  34. + case REV_ID_MAJOR_AR9344:
  35. + /* TODO */
  36. + default:
  37. + return;
  38. + }
  39. +
  40. + gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
  41. + t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
  42. + t |= uart_en;
  43. + __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
  44. +}
  45. +
  46. static void prom_putchar_init(void)
  47. {
  48. void __iomem *base;
  49. @@ -86,8 +126,10 @@ static void prom_putchar_init(void)
  50. default:
  51. _prom_putchar = prom_putchar_dummy;
  52. - break;
  53. + return;
  54. }
  55. +
  56. + prom_enable_uart(id);
  57. }
  58. void prom_putchar(unsigned char ch)