board-ralink.c 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Arch specific code for Ralink based boards
  3. *
  4. * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation.
  9. */
  10. #include <stddef.h>
  11. #include "config.h"
  12. #define READREG(r) *(volatile unsigned int *)(r)
  13. #define WRITEREG(r,v) *(volatile unsigned int *)(r) = v
  14. #define KSEG1ADDR(_x) (((_x) & 0x1fffffff) | 0xa0000000)
  15. #ifdef CONFIG_SOC_RT288X
  16. #define UART_BASE 0xb0300c00
  17. #else
  18. #define UART_BASE 0xb0000c00
  19. #endif
  20. #define UART_TX 1
  21. #define UART_LSR 7
  22. #define UART_LSR_THRE 0x20
  23. #define UART_READ(r) READREG(UART_BASE + 4 * (r))
  24. #define UART_WRITE(r,v) WRITEREG(UART_BASE + 4 * (r), (v))
  25. void board_putc(int ch)
  26. {
  27. while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0);
  28. UART_WRITE(UART_TX, ch);
  29. while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0);
  30. }
  31. void board_init(void)
  32. {
  33. }