1
0

0015-MIPS-ath79-enable-uart-during-early_prink.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From f55a400f4a691f3750eaf7bfcd6ecbf7ed1622f0 Mon Sep 17 00:00:00 2001
  2. From: Gabor Juhos <juhosg@openwrt.org>
  3. Date: Mon, 5 Mar 2018 11:38:21 +0100
  4. Subject: [PATCH 15/33] MIPS: ath79: enable uart during early_prink
  5. This patch ensures, that the poinmux register is properly setup for the
  6. boot console uart when early_printk is enabled.
  7. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  8. Signed-off-by: John Crispin <john@phrozen.org>
  9. ---
  10. arch/mips/ath79/early_printk.c | 44 +++++++++++++++++++++++++++++++++++++++++-
  11. 1 file changed, 43 insertions(+), 1 deletion(-)
  12. --- a/arch/mips/ath79/early_printk.c
  13. +++ b/arch/mips/ath79/early_printk.c
  14. @@ -58,6 +58,46 @@ static void prom_putchar_dummy(unsigned
  15. /* nothing to do */
  16. }
  17. +static void prom_enable_uart(u32 id)
  18. +{
  19. + void __iomem *gpio_base;
  20. + u32 uart_en;
  21. + u32 t;
  22. +
  23. + switch (id) {
  24. + case REV_ID_MAJOR_AR71XX:
  25. + uart_en = AR71XX_GPIO_FUNC_UART_EN;
  26. + break;
  27. +
  28. + case REV_ID_MAJOR_AR7240:
  29. + case REV_ID_MAJOR_AR7241:
  30. + case REV_ID_MAJOR_AR7242:
  31. + uart_en = AR724X_GPIO_FUNC_UART_EN;
  32. + break;
  33. +
  34. + case REV_ID_MAJOR_AR913X:
  35. + uart_en = AR913X_GPIO_FUNC_UART_EN;
  36. + break;
  37. +
  38. + case REV_ID_MAJOR_AR9330:
  39. + case REV_ID_MAJOR_AR9331:
  40. + uart_en = AR933X_GPIO_FUNC_UART_EN;
  41. + break;
  42. +
  43. + case REV_ID_MAJOR_AR9341:
  44. + case REV_ID_MAJOR_AR9342:
  45. + case REV_ID_MAJOR_AR9344:
  46. + /* TODO */
  47. + default:
  48. + return;
  49. + }
  50. +
  51. + gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
  52. + t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
  53. + t |= uart_en;
  54. + __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
  55. +}
  56. +
  57. static void prom_putchar_init(void)
  58. {
  59. void __iomem *base;
  60. @@ -92,8 +132,10 @@ static void prom_putchar_init(void)
  61. default:
  62. _prom_putchar = prom_putchar_dummy;
  63. - break;
  64. + return;
  65. }
  66. +
  67. + prom_enable_uart(id);
  68. }
  69. void prom_putchar(unsigned char ch)