uncompress.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * arch/arm/mach-ep93xx/include/mach/uncompress.h
  3. *
  4. * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or (at
  9. * your option) any later version.
  10. */
  11. #include <mach/ep93xx-regs.h>
  12. static unsigned char __raw_readb(unsigned int ptr)
  13. {
  14. return *((volatile unsigned char *)ptr);
  15. }
  16. static unsigned int __raw_readl(unsigned int ptr)
  17. {
  18. return *((volatile unsigned int *)ptr);
  19. }
  20. static void __raw_writeb(unsigned char value, unsigned int ptr)
  21. {
  22. *((volatile unsigned char *)ptr) = value;
  23. }
  24. static void __raw_writel(unsigned int value, unsigned int ptr)
  25. {
  26. *((volatile unsigned int *)ptr) = value;
  27. }
  28. #if defined(CONFIG_EP93XX_EARLY_UART1)
  29. #define UART_BASE EP93XX_UART1_PHYS_BASE
  30. #elif defined(CONFIG_EP93XX_EARLY_UART2)
  31. #define UART_BASE EP93XX_UART2_PHYS_BASE
  32. #elif defined(CONFIG_EP93XX_EARLY_UART3)
  33. #define UART_BASE EP93XX_UART3_PHYS_BASE
  34. #else
  35. #define UART_BASE EP93XX_UART1_PHYS_BASE
  36. #endif
  37. #define PHYS_UART_DATA (UART_BASE + 0x00)
  38. #define PHYS_UART_FLAG (UART_BASE + 0x18)
  39. #define UART_FLAG_TXFF 0x20
  40. static inline void putc(int c)
  41. {
  42. /* Transmit fifo not full? */
  43. while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)
  44. ;
  45. __raw_writeb(c, PHYS_UART_DATA);
  46. }
  47. static inline void flush(void)
  48. {
  49. }
  50. /*
  51. * Some bootloaders don't turn off DMA from the ethernet MAC before
  52. * jumping to linux, which means that we might end up with bits of RX
  53. * status and packet data scribbled over the uncompressed kernel image.
  54. * Work around this by resetting the ethernet MAC before we uncompress.
  55. */
  56. #define PHYS_ETH_SELF_CTL 0x80010020
  57. #define ETH_SELF_CTL_RESET 0x00000001
  58. static void ethernet_reset(void)
  59. {
  60. unsigned int v;
  61. /* Reset the ethernet MAC. */
  62. v = __raw_readl(PHYS_ETH_SELF_CTL);
  63. __raw_writel(v | ETH_SELF_CTL_RESET, PHYS_ETH_SELF_CTL);
  64. /* Wait for reset to finish. */
  65. while (__raw_readl(PHYS_ETH_SELF_CTL) & ETH_SELF_CTL_RESET)
  66. ;
  67. }
  68. static void arch_decomp_setup(void)
  69. {
  70. ethernet_reset();
  71. }
  72. #define arch_decomp_wdog()