uncompress.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #define IOMEM(x) ((void __force __iomem *)(x))
  25. u32 *uart;
  26. /* PORT_16C550A, in polled non-fifo mode */
  27. static void putc(char c)
  28. {
  29. while (!(uart[UART_LSR] & UART_LSR_THRE))
  30. barrier();
  31. uart[UART_TX] = c;
  32. }
  33. static inline void flush(void)
  34. {
  35. while (!(uart[UART_LSR] & UART_LSR_THRE))
  36. barrier();
  37. }
  38. static inline void set_uart_info(u32 phys, void * __iomem virt)
  39. {
  40. /*
  41. * Get address of some.bss variable and round it down
  42. * a la CONFIG_AUTO_ZRELADDR.
  43. */
  44. u32 ram_start = (u32)&uart & 0xf8000000;
  45. u32 *uart_info = (u32 *)(ram_start + DAVINCI_UART_INFO_OFS);
  46. uart = (u32 *)phys;
  47. uart_info[0] = phys;
  48. uart_info[1] = (u32)virt;
  49. }
  50. #define _DEBUG_LL_ENTRY(machine, phys, virt) \
  51. if (machine_is_##machine()) { \
  52. set_uart_info(phys, virt); \
  53. break; \
  54. }
  55. #define DEBUG_LL_DAVINCI(machine, port) \
  56. _DEBUG_LL_ENTRY(machine, DAVINCI_UART##port##_BASE, \
  57. IO_ADDRESS(DAVINCI_UART##port##_BASE))
  58. #define DEBUG_LL_DA8XX(machine, port) \
  59. _DEBUG_LL_ENTRY(machine, DA8XX_UART##port##_BASE, \
  60. IO_ADDRESS(DA8XX_UART##port##_BASE))
  61. #define DEBUG_LL_TNETV107X(machine, port) \
  62. _DEBUG_LL_ENTRY(machine, TNETV107X_UART##port##_BASE, \
  63. TNETV107X_UART##port##_VIRT)
  64. static inline void __arch_decomp_setup(unsigned long arch_id)
  65. {
  66. /*
  67. * Initialize the port based on the machine ID from the bootloader.
  68. * Note that we're using macros here instead of switch statement
  69. * as machine_is functions are optimized out for the boards that
  70. * are not selected.
  71. */
  72. do {
  73. /* Davinci boards */
  74. DEBUG_LL_DAVINCI(davinci_evm, 0);
  75. DEBUG_LL_DAVINCI(sffsdr, 0);
  76. DEBUG_LL_DAVINCI(neuros_osd2, 0);
  77. DEBUG_LL_DAVINCI(davinci_dm355_evm, 0);
  78. DEBUG_LL_DAVINCI(dm355_leopard, 0);
  79. DEBUG_LL_DAVINCI(davinci_dm6467_evm, 0);
  80. DEBUG_LL_DAVINCI(davinci_dm365_evm, 0);
  81. /* DA8xx boards */
  82. DEBUG_LL_DA8XX(davinci_da830_evm, 2);
  83. DEBUG_LL_DA8XX(davinci_da850_evm, 2);
  84. DEBUG_LL_DA8XX(mityomapl138, 1);
  85. DEBUG_LL_DA8XX(omapl138_hawkboard, 2);
  86. /* TNETV107x boards */
  87. DEBUG_LL_TNETV107X(tnetv107x, 1);
  88. } while (0);
  89. }
  90. #define arch_decomp_setup() __arch_decomp_setup(arch_id)
  91. #define arch_decomp_wdog()