uncompress.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Serial port stubs for kernel decompress status messages
  3. *
  4. * Initially based on:
  5. * arch/arm/plat-omap/include/mach/uncompress.h
  6. *
  7. * Original copyrights follow.
  8. *
  9. * Copyright (C) 2000 RidgeRun, Inc.
  10. * Author: Greg Lonnon <glonnon@ridgerun.com>
  11. *
  12. * Rewritten by:
  13. * Author: <source@mvista.com>
  14. * 2004 (c) MontaVista Software, Inc.
  15. *
  16. * This file is licensed under the terms of the GNU General Public License
  17. * version 2. This program is licensed "as is" without any warranty of any
  18. * kind, whether express or implied.
  19. */
  20. #include <linux/types.h>
  21. #include <linux/serial_reg.h>
  22. #include <asm/mach-types.h>
  23. #include <mach/serial.h>
  24. u32 *uart;
  25. /* PORT_16C550A, in polled non-fifo mode */
  26. static void putc(char c)
  27. {
  28. while (!(uart[UART_LSR] & UART_LSR_THRE))
  29. barrier();
  30. uart[UART_TX] = c;
  31. }
  32. static inline void flush(void)
  33. {
  34. while (!(uart[UART_LSR] & UART_LSR_THRE))
  35. barrier();
  36. }
  37. static inline void set_uart_info(u32 phys, void * __iomem virt)
  38. {
  39. /*
  40. * Get address of some.bss variable and round it down
  41. * a la CONFIG_AUTO_ZRELADDR.
  42. */
  43. u32 ram_start = (u32)&uart & 0xf8000000;
  44. u32 *uart_info = (u32 *)(ram_start + DAVINCI_UART_INFO_OFS);
  45. uart = (u32 *)phys;
  46. uart_info[0] = phys;
  47. uart_info[1] = (u32)virt;
  48. }
  49. #define _DEBUG_LL_ENTRY(machine, phys, virt) \
  50. if (machine_is_##machine()) { \
  51. set_uart_info(phys, virt); \
  52. break; \
  53. }
  54. #define DEBUG_LL_DAVINCI(machine, port) \
  55. _DEBUG_LL_ENTRY(machine, DAVINCI_UART##port##_BASE, \
  56. IO_ADDRESS(DAVINCI_UART##port##_BASE))
  57. #define DEBUG_LL_DA8XX(machine, port) \
  58. _DEBUG_LL_ENTRY(machine, DA8XX_UART##port##_BASE, \
  59. IO_ADDRESS(DA8XX_UART##port##_BASE))
  60. #define DEBUG_LL_TNETV107X(machine, port) \
  61. _DEBUG_LL_ENTRY(machine, TNETV107X_UART##port##_BASE, \
  62. TNETV107X_UART##port##_VIRT)
  63. static inline void __arch_decomp_setup(unsigned long arch_id)
  64. {
  65. /*
  66. * Initialize the port based on the machine ID from the bootloader.
  67. * Note that we're using macros here instead of switch statement
  68. * as machine_is functions are optimized out for the boards that
  69. * are not selected.
  70. */
  71. do {
  72. /* Davinci boards */
  73. DEBUG_LL_DAVINCI(davinci_evm, 0);
  74. DEBUG_LL_DAVINCI(sffsdr, 0);
  75. DEBUG_LL_DAVINCI(neuros_osd2, 0);
  76. DEBUG_LL_DAVINCI(davinci_dm355_evm, 0);
  77. DEBUG_LL_DAVINCI(dm355_leopard, 0);
  78. DEBUG_LL_DAVINCI(davinci_dm6467_evm, 0);
  79. DEBUG_LL_DAVINCI(davinci_dm365_evm, 0);
  80. /* DA8xx boards */
  81. DEBUG_LL_DA8XX(davinci_da830_evm, 2);
  82. DEBUG_LL_DA8XX(davinci_da850_evm, 2);
  83. DEBUG_LL_DA8XX(mityomapl138, 1);
  84. DEBUG_LL_DA8XX(omapl138_hawkboard, 2);
  85. /* TNETV107x boards */
  86. DEBUG_LL_TNETV107X(tnetv107x, 1);
  87. } while (0);
  88. }
  89. #define arch_decomp_setup() __arch_decomp_setup(arch_id)
  90. #define arch_decomp_wdog()