console.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Carsten Langgaard, carstenl@mips.com
  3. * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
  4. *
  5. * This program is free software; you can distribute it and/or modify it
  6. * under the terms of the GNU General Public License (Version 2) as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  17. *
  18. * Putting things on the screen/serial line using YAMONs facilities.
  19. */
  20. #include <linux/console.h>
  21. #include <linux/init.h>
  22. #include <linux/serial_reg.h>
  23. #include <asm/io.h>
  24. #ifdef CONFIG_MIPS_ATLAS
  25. #include <asm/mips-boards/atlas.h>
  26. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  27. #define PORT(offset) (ATLAS_UART_REGS_BASE + ((offset)<<3))
  28. #else
  29. #define PORT(offset) (ATLAS_UART_REGS_BASE + 3 + ((offset)<<3))
  30. #endif
  31. #elif defined(CONFIG_MIPS_SEAD)
  32. #include <asm/mips-boards/sead.h>
  33. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  34. #define PORT(offset) (SEAD_UART0_REGS_BASE + ((offset)<<3))
  35. #else
  36. #define PORT(offset) (SEAD_UART0_REGS_BASE + 3 + ((offset)<<3))
  37. #endif
  38. #else
  39. #define PORT(offset) (0x3f8 + (offset))
  40. #endif
  41. static inline unsigned int serial_in(int offset)
  42. {
  43. return inb(PORT(offset));
  44. }
  45. static inline void serial_out(int offset, int value)
  46. {
  47. outb(value, PORT(offset));
  48. }
  49. int prom_putchar(char c)
  50. {
  51. while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
  52. ;
  53. serial_out(UART_TX, c);
  54. return 1;
  55. }