uncompress.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * arch/arm/mach-tegra/include/mach/uncompress.h
  3. *
  4. * Copyright (C) 2010 Google, Inc.
  5. *
  6. * Author:
  7. * Colin Cross <ccross@google.com>
  8. * Erik Gilling <konkers@google.com>
  9. *
  10. * This software is licensed under the terms of the GNU General Public
  11. * License version 2, as published by the Free Software Foundation, and
  12. * may be copied, distributed, and modified under those terms.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. */
  20. #ifndef __MACH_TEGRA_UNCOMPRESS_H
  21. #define __MACH_TEGRA_UNCOMPRESS_H
  22. #include <linux/types.h>
  23. #include <linux/serial_reg.h>
  24. #include <mach/iomap.h>
  25. #if defined(CONFIG_TEGRA_DEBUG_UARTA)
  26. #define DEBUG_UART_BASE TEGRA_UARTA_BASE
  27. #elif defined(CONFIG_TEGRA_DEBUG_UARTB)
  28. #define DEBUG_UART_BASE TEGRA_UARTB_BASE
  29. #elif defined(CONFIG_TEGRA_DEBUG_UARTC)
  30. #define DEBUG_UART_BASE TEGRA_UARTC_BASE
  31. #elif defined(CONFIG_TEGRA_DEBUG_UARTD)
  32. #define DEBUG_UART_BASE TEGRA_UARTD_BASE
  33. #elif defined(CONFIG_TEGRA_DEBUG_UARTE)
  34. #define DEBUG_UART_BASE TEGRA_UARTE_BASE
  35. #else
  36. #define DEBUG_UART_BASE NULL
  37. #endif
  38. static void putc(int c)
  39. {
  40. volatile u8 *uart = (volatile u8 *)DEBUG_UART_BASE;
  41. int shift = 2;
  42. if (uart == NULL)
  43. return;
  44. while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
  45. barrier();
  46. uart[UART_TX << shift] = c;
  47. }
  48. static inline void flush(void)
  49. {
  50. }
  51. static inline void arch_decomp_setup(void)
  52. {
  53. volatile u8 *uart = (volatile u8 *)DEBUG_UART_BASE;
  54. int shift = 2;
  55. if (uart == NULL)
  56. return;
  57. uart[UART_LCR << shift] |= UART_LCR_DLAB;
  58. uart[UART_DLL << shift] = 0x75;
  59. uart[UART_DLM << shift] = 0x0;
  60. uart[UART_LCR << shift] = 3;
  61. }
  62. static inline void arch_decomp_wdog(void)
  63. {
  64. }
  65. #endif