uncompress.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * arch/arm/plat-omap/include/mach/uncompress.h
  3. *
  4. * Serial port stubs for kernel decompress status messages
  5. *
  6. * Initially based on:
  7. * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
  8. * Copyright (C) 2000 RidgeRun, Inc.
  9. * Author: Greg Lonnon <glonnon@ridgerun.com>
  10. *
  11. * Rewritten by:
  12. * Author: <source@mvista.com>
  13. * 2004 (c) MontaVista Software, Inc.
  14. *
  15. * This file is licensed under the terms of the GNU General Public License
  16. * version 2. This program is licensed "as is" without any warranty of any
  17. * kind, whether express or implied.
  18. */
  19. #include <linux/types.h>
  20. #include <linux/serial_reg.h>
  21. #include <asm/memory.h>
  22. #include <asm/mach-types.h>
  23. #include "serial.h"
  24. #define MDR1_MODE_MASK 0x07
  25. volatile u8 *uart_base;
  26. int uart_shift;
  27. /*
  28. * Store the DEBUG_LL uart number into memory.
  29. * See also debug-macro.S, and serial.c for related code.
  30. */
  31. static void set_omap_uart_info(unsigned char port)
  32. {
  33. /*
  34. * Get address of some.bss variable and round it down
  35. * a la CONFIG_AUTO_ZRELADDR.
  36. */
  37. u32 ram_start = (u32)&uart_shift & 0xf8000000;
  38. u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
  39. *uart_info = port;
  40. }
  41. static inline void putc(int c)
  42. {
  43. if (!uart_base)
  44. return;
  45. /* Check for UART 16x mode */
  46. if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
  47. return;
  48. while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
  49. barrier();
  50. uart_base[UART_TX << uart_shift] = c;
  51. }
  52. static inline void flush(void)
  53. {
  54. }
  55. /*
  56. * Macros to configure UART1 and debug UART
  57. */
  58. #define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
  59. if (machine_is_##mach()) { \
  60. uart_base = (volatile u8 *)(dbg_uart); \
  61. uart_shift = (dbg_shft); \
  62. port = (dbg_id); \
  63. set_omap_uart_info(port); \
  64. break; \
  65. }
  66. #define DEBUG_LL_OMAP7XX(p, mach) \
  67. _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
  68. OMAP1UART##p)
  69. #define DEBUG_LL_OMAP1(p, mach) \
  70. _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
  71. OMAP1UART##p)
  72. static inline void arch_decomp_setup(void)
  73. {
  74. int port = 0;
  75. /*
  76. * Initialize the port based on the machine ID from the bootloader.
  77. * Note that we're using macros here instead of switch statement
  78. * as machine_is functions are optimized out for the boards that
  79. * are not selected.
  80. */
  81. do {
  82. /* omap7xx/8xx based boards using UART1 with shift 0 */
  83. DEBUG_LL_OMAP7XX(1, herald);
  84. DEBUG_LL_OMAP7XX(1, omap_perseus2);
  85. /* omap15xx/16xx based boards using UART1 */
  86. DEBUG_LL_OMAP1(1, ams_delta);
  87. DEBUG_LL_OMAP1(1, nokia770);
  88. DEBUG_LL_OMAP1(1, omap_h2);
  89. DEBUG_LL_OMAP1(1, omap_h3);
  90. DEBUG_LL_OMAP1(1, omap_innovator);
  91. DEBUG_LL_OMAP1(1, omap_osk);
  92. DEBUG_LL_OMAP1(1, omap_palmte);
  93. DEBUG_LL_OMAP1(1, omap_palmz71);
  94. /* omap15xx/16xx based boards using UART2 */
  95. DEBUG_LL_OMAP1(2, omap_palmtt);
  96. /* omap15xx/16xx based boards using UART3 */
  97. DEBUG_LL_OMAP1(3, sx1);
  98. } while (0);
  99. }