uncompress.h 1.6 KB

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