uncompress.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 <plat/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. *(volatile u32 *)OMAP_UART_INFO = port;
  34. }
  35. static void putc(int c)
  36. {
  37. if (!uart_base)
  38. return;
  39. /* Check for UART 16x mode */
  40. if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
  41. return;
  42. while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
  43. barrier();
  44. uart_base[UART_TX << uart_shift] = c;
  45. }
  46. static inline void flush(void)
  47. {
  48. }
  49. /*
  50. * Macros to configure UART1 and debug UART
  51. */
  52. #define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
  53. if (machine_is_##mach()) { \
  54. uart_base = (volatile u8 *)(dbg_uart); \
  55. uart_shift = (dbg_shft); \
  56. port = (dbg_id); \
  57. set_omap_uart_info(port); \
  58. break; \
  59. }
  60. #define DEBUG_LL_OMAP7XX(p, mach) \
  61. _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
  62. OMAP1UART##p)
  63. #define DEBUG_LL_OMAP1(p, mach) \
  64. _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
  65. OMAP1UART##p)
  66. #define DEBUG_LL_OMAP2(p, mach) \
  67. _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
  68. OMAP2UART##p)
  69. #define DEBUG_LL_OMAP3(p, mach) \
  70. _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
  71. OMAP3UART##p)
  72. #define DEBUG_LL_OMAP4(p, mach) \
  73. _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
  74. OMAP4UART##p)
  75. /* Zoom2/3 shift is different for UART1 and external port */
  76. #define DEBUG_LL_ZOOM(mach) \
  77. _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
  78. #define DEBUG_LL_TI816X(p, mach) \
  79. _DEBUG_LL_ENTRY(mach, TI816X_UART##p##_BASE, OMAP_PORT_SHIFT, \
  80. TI816XUART##p)
  81. static inline void __arch_decomp_setup(unsigned long arch_id)
  82. {
  83. int port = 0;
  84. /*
  85. * Initialize the port based on the machine ID from the bootloader.
  86. * Note that we're using macros here instead of switch statement
  87. * as machine_is functions are optimized out for the boards that
  88. * are not selected.
  89. */
  90. do {
  91. /* omap7xx/8xx based boards using UART1 with shift 0 */
  92. DEBUG_LL_OMAP7XX(1, herald);
  93. DEBUG_LL_OMAP7XX(1, omap_perseus2);
  94. /* omap15xx/16xx based boards using UART1 */
  95. DEBUG_LL_OMAP1(1, ams_delta);
  96. DEBUG_LL_OMAP1(1, nokia770);
  97. DEBUG_LL_OMAP1(1, omap_h2);
  98. DEBUG_LL_OMAP1(1, omap_h3);
  99. DEBUG_LL_OMAP1(1, omap_innovator);
  100. DEBUG_LL_OMAP1(1, omap_osk);
  101. DEBUG_LL_OMAP1(1, omap_palmte);
  102. DEBUG_LL_OMAP1(1, omap_palmz71);
  103. /* omap15xx/16xx based boards using UART2 */
  104. DEBUG_LL_OMAP1(2, omap_palmtt);
  105. /* omap15xx/16xx based boards using UART3 */
  106. DEBUG_LL_OMAP1(3, sx1);
  107. /* omap2 based boards using UART1 */
  108. DEBUG_LL_OMAP2(1, omap_2430sdp);
  109. DEBUG_LL_OMAP2(1, omap_apollon);
  110. DEBUG_LL_OMAP2(1, omap_h4);
  111. /* omap2 based boards using UART3 */
  112. DEBUG_LL_OMAP2(3, nokia_n800);
  113. DEBUG_LL_OMAP2(3, nokia_n810);
  114. DEBUG_LL_OMAP2(3, nokia_n810_wimax);
  115. /* omap3 based boards using UART1 */
  116. DEBUG_LL_OMAP2(1, omap3evm);
  117. DEBUG_LL_OMAP3(1, omap_3430sdp);
  118. DEBUG_LL_OMAP3(1, omap_3630sdp);
  119. DEBUG_LL_OMAP3(1, omap3530_lv_som);
  120. DEBUG_LL_OMAP3(1, omap3_torpedo);
  121. /* omap3 based boards using UART3 */
  122. DEBUG_LL_OMAP3(3, cm_t35);
  123. DEBUG_LL_OMAP3(3, cm_t3517);
  124. DEBUG_LL_OMAP3(3, cm_t3730);
  125. DEBUG_LL_OMAP3(3, craneboard);
  126. DEBUG_LL_OMAP3(3, devkit8000);
  127. DEBUG_LL_OMAP3(3, igep0020);
  128. DEBUG_LL_OMAP3(3, igep0030);
  129. DEBUG_LL_OMAP3(3, nokia_rm680);
  130. DEBUG_LL_OMAP3(3, nokia_rx51);
  131. DEBUG_LL_OMAP3(3, omap3517evm);
  132. DEBUG_LL_OMAP3(3, omap3_beagle);
  133. DEBUG_LL_OMAP3(3, omap3_pandora);
  134. DEBUG_LL_OMAP3(3, omap_ldp);
  135. DEBUG_LL_OMAP3(3, overo);
  136. DEBUG_LL_OMAP3(3, touchbook);
  137. /* omap4 based boards using UART3 */
  138. DEBUG_LL_OMAP4(3, omap_4430sdp);
  139. DEBUG_LL_OMAP4(3, omap4_panda);
  140. /* zoom2/3 external uart */
  141. DEBUG_LL_ZOOM(omap_zoom2);
  142. DEBUG_LL_ZOOM(omap_zoom3);
  143. /* TI8168 base boards using UART3 */
  144. DEBUG_LL_TI816X(3, ti8168evm);
  145. } while (0);
  146. }
  147. #define arch_decomp_setup() __arch_decomp_setup(arch_id)
  148. /*
  149. * nothing to do
  150. */
  151. #define arch_decomp_wdog()