uncompress.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * arch/arm/mach-pxa/include/mach/uncompress.h
  3. *
  4. * Author: Nicolas Pitre
  5. * Copyright: (C) 2001 MontaVista Software Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/serial_reg.h>
  12. #include <asm/mach-types.h>
  13. #define FFUART_BASE (0x40100000)
  14. #define BTUART_BASE (0x40200000)
  15. #define STUART_BASE (0x40700000)
  16. unsigned long uart_base;
  17. unsigned int uart_shift;
  18. unsigned int uart_is_pxa;
  19. static inline unsigned char uart_read(int offset)
  20. {
  21. return *(volatile unsigned char *)(uart_base + (offset << uart_shift));
  22. }
  23. static inline void uart_write(unsigned char val, int offset)
  24. {
  25. *(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val;
  26. }
  27. static inline int uart_is_enabled(void)
  28. {
  29. /* assume enabled by default for non-PXA uarts */
  30. return uart_is_pxa ? uart_read(UART_IER) & UART_IER_UUE : 1;
  31. }
  32. static inline void putc(char c)
  33. {
  34. if (!uart_is_enabled())
  35. return;
  36. while (!(uart_read(UART_LSR) & UART_LSR_THRE))
  37. barrier();
  38. uart_write(c, UART_TX);
  39. }
  40. /*
  41. * This does not append a newline
  42. */
  43. static inline void flush(void)
  44. {
  45. }
  46. static inline void arch_decomp_setup(void)
  47. {
  48. /* initialize to default */
  49. uart_base = FFUART_BASE;
  50. uart_shift = 2;
  51. uart_is_pxa = 1;
  52. if (machine_is_littleton() || machine_is_intelmote2()
  53. || machine_is_csb726() || machine_is_stargate2()
  54. || machine_is_cm_x300() || machine_is_balloon3())
  55. uart_base = STUART_BASE;
  56. if (machine_is_arcom_zeus()) {
  57. uart_base = 0x10000000; /* nCS4 */
  58. uart_shift = 1;
  59. uart_is_pxa = 0;
  60. }
  61. }
  62. /*
  63. * nothing to do
  64. */
  65. #define arch_decomp_wdog()