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