uncompress.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. static u32 *uart;
  25. static u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
  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. uart = (u32 *)phys;
  41. uart_info[0] = phys;
  42. uart_info[1] = (u32)virt;
  43. }
  44. #define _DEBUG_LL_ENTRY(machine, phys, virt) \
  45. if (machine_is_##machine()) { \
  46. set_uart_info(phys, virt); \
  47. break; \
  48. }
  49. #define DEBUG_LL_DAVINCI(machine, port) \
  50. _DEBUG_LL_ENTRY(machine, DAVINCI_UART##port##_BASE, \
  51. IO_ADDRESS(DAVINCI_UART##port##_BASE))
  52. #define DEBUG_LL_DA8XX(machine, port) \
  53. _DEBUG_LL_ENTRY(machine, DA8XX_UART##port##_BASE, \
  54. IO_ADDRESS(DA8XX_UART##port##_BASE))
  55. #define DEBUG_LL_TNETV107X(machine, port) \
  56. _DEBUG_LL_ENTRY(machine, TNETV107X_UART##port##_BASE, \
  57. TNETV107X_UART##port##_VIRT)
  58. static inline void __arch_decomp_setup(unsigned long arch_id)
  59. {
  60. /*
  61. * Initialize the port based on the machine ID from the bootloader.
  62. * Note that we're using macros here instead of switch statement
  63. * as machine_is functions are optimized out for the boards that
  64. * are not selected.
  65. */
  66. do {
  67. /* Davinci boards */
  68. DEBUG_LL_DAVINCI(davinci_evm, 0);
  69. DEBUG_LL_DAVINCI(sffsdr, 0);
  70. DEBUG_LL_DAVINCI(neuros_osd2, 0);
  71. DEBUG_LL_DAVINCI(davinci_dm355_evm, 0);
  72. DEBUG_LL_DAVINCI(dm355_leopard, 0);
  73. DEBUG_LL_DAVINCI(davinci_dm6467_evm, 0);
  74. DEBUG_LL_DAVINCI(davinci_dm365_evm, 0);
  75. /* DA8xx boards */
  76. DEBUG_LL_DA8XX(davinci_da830_evm, 2);
  77. DEBUG_LL_DA8XX(davinci_da850_evm, 2);
  78. /* TNETV107x boards */
  79. DEBUG_LL_TNETV107X(tnetv107x, 1);
  80. } while (0);
  81. }
  82. #define arch_decomp_setup() __arch_decomp_setup(arch_id)
  83. #define arch_decomp_wdog()