uncompress.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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/mach-types.h>
  22. #include <plat/serial.h>
  23. static volatile u8 *uart1_base;
  24. static int uart1_shift;
  25. static volatile u8 *uart_base;
  26. static int uart_shift;
  27. /*
  28. * Store the DEBUG_LL uart number into UART1 scratchpad register.
  29. * See also debug-macro.S, and serial.c for related code.
  30. *
  31. * Please note that we currently assume that:
  32. * - UART1 clocks are enabled for register access
  33. * - UART1 scratchpad register can be used
  34. */
  35. static void set_uart1_scratchpad(unsigned char port)
  36. {
  37. uart1_base[UART_SCR << uart1_shift] = port;
  38. }
  39. static void putc(int c)
  40. {
  41. if (!uart_base)
  42. return;
  43. while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
  44. barrier();
  45. uart_base[UART_TX << uart_shift] = c;
  46. }
  47. static inline void flush(void)
  48. {
  49. }
  50. /*
  51. * Macros to configure UART1 and debug UART
  52. */
  53. #define _DEBUG_LL_ENTRY(mach, uart1_phys, uart1_shft, \
  54. dbg_uart, dbg_shft, dbg_id) \
  55. if (machine_is_##mach()) { \
  56. uart1_base = (volatile u8 *)(uart1_phys); \
  57. uart1_shift = (uart1_shft); \
  58. uart_base = (volatile u8 *)(dbg_uart); \
  59. uart_shift = (dbg_shft); \
  60. port = (dbg_id); \
  61. set_uart1_scratchpad(port); \
  62. break; \
  63. }
  64. #define DEBUG_LL_OMAP7XX(p, mach) \
  65. _DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP7XX_PORT_SHIFT, \
  66. OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, OMAP1UART##p)
  67. #define DEBUG_LL_OMAP1(p, mach) \
  68. _DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP_PORT_SHIFT, \
  69. OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP1UART##p)
  70. #define DEBUG_LL_OMAP2(p, mach) \
  71. _DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP_PORT_SHIFT, \
  72. OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP2UART##p)
  73. #define DEBUG_LL_OMAP3(p, mach) \
  74. _DEBUG_LL_ENTRY(mach, OMAP3_UART1_BASE, OMAP_PORT_SHIFT, \
  75. OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP3UART##p)
  76. #define DEBUG_LL_OMAP4(p, mach) \
  77. _DEBUG_LL_ENTRY(mach, OMAP4_UART1_BASE, OMAP_PORT_SHIFT, \
  78. OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP4UART##p)
  79. /* Zoom2/3 shift is different for UART1 and external port */
  80. #define DEBUG_LL_ZOOM(mach) \
  81. _DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP_PORT_SHIFT, \
  82. ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
  83. static inline void __arch_decomp_setup(unsigned long arch_id)
  84. {
  85. int port = 0;
  86. /*
  87. * Initialize the port based on the machine ID from the bootloader.
  88. * Note that we're using macros here instead of switch statement
  89. * as machine_is functions are optimized out for the boards that
  90. * are not selected.
  91. */
  92. do {
  93. /* omap7xx/8xx based boards using UART1 with shift 0 */
  94. DEBUG_LL_OMAP7XX(1, herald);
  95. DEBUG_LL_OMAP7XX(1, omap_perseus2);
  96. /* omap15xx/16xx based boards using UART1 */
  97. DEBUG_LL_OMAP1(1, ams_delta);
  98. DEBUG_LL_OMAP1(1, nokia770);
  99. DEBUG_LL_OMAP1(1, omap_h2);
  100. DEBUG_LL_OMAP1(1, omap_h3);
  101. DEBUG_LL_OMAP1(1, omap_innovator);
  102. DEBUG_LL_OMAP1(1, omap_osk);
  103. DEBUG_LL_OMAP1(1, omap_palmte);
  104. DEBUG_LL_OMAP1(1, omap_palmz71);
  105. /* omap15xx/16xx based boards using UART2 */
  106. DEBUG_LL_OMAP1(2, omap_palmtt);
  107. /* omap15xx/16xx based boards using UART3 */
  108. DEBUG_LL_OMAP1(3, sx1);
  109. /* omap2 based boards using UART1 */
  110. DEBUG_LL_OMAP2(1, omap2evm);
  111. DEBUG_LL_OMAP2(1, omap_2430sdp);
  112. DEBUG_LL_OMAP2(1, omap_apollon);
  113. DEBUG_LL_OMAP2(1, omap_h4);
  114. /* omap2 based boards using UART3 */
  115. DEBUG_LL_OMAP2(3, nokia_n800);
  116. DEBUG_LL_OMAP2(3, nokia_n810);
  117. DEBUG_LL_OMAP2(3, nokia_n810_wimax);
  118. /* omap3 based boards using UART1 */
  119. DEBUG_LL_OMAP2(1, omap3evm);
  120. DEBUG_LL_OMAP3(1, omap_3430sdp);
  121. DEBUG_LL_OMAP3(1, omap_3630sdp);
  122. /* omap3 based boards using UART3 */
  123. DEBUG_LL_OMAP3(3, cm_t35);
  124. DEBUG_LL_OMAP3(3, igep0020);
  125. DEBUG_LL_OMAP3(3, nokia_rx51);
  126. DEBUG_LL_OMAP3(3, omap3517evm);
  127. DEBUG_LL_OMAP3(3, omap3_beagle);
  128. DEBUG_LL_OMAP3(3, omap3_pandora);
  129. DEBUG_LL_OMAP3(3, omap_ldp);
  130. DEBUG_LL_OMAP3(3, overo);
  131. DEBUG_LL_OMAP3(3, touchbook);
  132. /* omap4 based boards using UART3 */
  133. DEBUG_LL_OMAP4(3, omap_4430sdp);
  134. /* zoom2/3 external uart */
  135. DEBUG_LL_ZOOM(omap_zoom2);
  136. DEBUG_LL_ZOOM(omap_zoom3);
  137. } while (0);
  138. }
  139. #define arch_decomp_setup() __arch_decomp_setup(arch_id)
  140. /*
  141. * nothing to do
  142. */
  143. #define arch_decomp_wdog()