uart_base.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2009 Lemote Inc.
  3. * Author: Wu Zhangjin, wuzhangjin@gmail.com
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #include <linux/export.h>
  11. #include <asm/bootinfo.h>
  12. #include <loongson.h>
  13. /* raw */
  14. unsigned long loongson_uart_base[MAX_UARTS] = {};
  15. /* ioremapped */
  16. unsigned long _loongson_uart_base[MAX_UARTS] = {};
  17. EXPORT_SYMBOL(loongson_uart_base);
  18. EXPORT_SYMBOL(_loongson_uart_base);
  19. void prom_init_loongson_uart_base(void)
  20. {
  21. switch (mips_machtype) {
  22. case MACH_LOONGSON_GENERIC:
  23. case MACH_LOONGSON_3A780E1W:
  24. /* The CPU provided serial port (CPU) */
  25. loongson_uart_base[0] = LOONGSON_REG_BASE + 0x1e0;
  26. break;
  27. case MACH_LEMOTE_FL2E:
  28. loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x3f8;
  29. break;
  30. case MACH_LEMOTE_FL2F:
  31. case MACH_LEMOTE_LL2F:
  32. loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x2f8;
  33. break;
  34. case MACH_LEMOTE_ML2F7:
  35. case MACH_LEMOTE_YL2F89:
  36. case MACH_DEXXON_GDIUM2F10:
  37. case MACH_LEMOTE_NAS:
  38. default:
  39. /* The CPU provided serial port (LPC) */
  40. loongson_uart_base[0] = LOONGSON_LIO1_BASE + 0x3f8;
  41. break;
  42. }
  43. _loongson_uart_base[0] =
  44. (unsigned long)ioremap_nocache(loongson_uart_base[0], 8);
  45. }