uncompress.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. static void putc(int c)
  26. {
  27. volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
  28. int shift = 2;
  29. if (uart == NULL)
  30. return;
  31. while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
  32. barrier();
  33. uart[UART_TX << shift] = c;
  34. }
  35. static inline void flush(void)
  36. {
  37. }
  38. static inline void arch_decomp_setup(void)
  39. {
  40. volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
  41. u32 chip, div;
  42. volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
  43. int shift = 2;
  44. if (uart == NULL)
  45. return;
  46. chip = (apb_misc[0x804 / 4] >> 8) & 0xff;
  47. if (chip == 0x20)
  48. div = 0x0075;
  49. else
  50. div = 0x00dd;
  51. uart[UART_LCR << shift] |= UART_LCR_DLAB;
  52. uart[UART_DLL << shift] = div & 0xff;
  53. uart[UART_DLM << shift] = div >> 8;
  54. uart[UART_LCR << shift] = 3;
  55. }
  56. static inline void arch_decomp_wdog(void)
  57. {
  58. }
  59. #endif