io.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. */
  4. /*
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __ASM_ARCH_MXC_IO_H__
  10. #define __ASM_ARCH_MXC_IO_H__
  11. /* Allow IO space to be anywhere in the memory */
  12. #define IO_SPACE_LIMIT 0xffffffff
  13. #if defined(CONFIG_SOC_IMX31) || defined(CONFIG_SOC_IMX35)
  14. #include <mach/hardware.h>
  15. #define __arch_ioremap __imx_ioremap
  16. #define __arch_iounmap __iounmap
  17. #define addr_in_module(addr, mod) \
  18. ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
  19. static inline void __iomem *
  20. __imx_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
  21. {
  22. if (mtype == MT_DEVICE && (cpu_is_mx31() || cpu_is_mx35())) {
  23. /*
  24. * Access all peripherals below 0x80000000 as nonshared device
  25. * on mx3, but leave l2cc alone. Otherwise cache corruptions
  26. * can occur.
  27. */
  28. if (phys_addr < 0x80000000 &&
  29. !addr_in_module(phys_addr, MX3x_L2CC))
  30. mtype = MT_DEVICE_NONSHARED;
  31. }
  32. return __arm_ioremap(phys_addr, size, mtype);
  33. }
  34. #endif
  35. /* io address mapping macro */
  36. #define __io(a) __typesafe_io(a)
  37. #define __mem_pci(a) (a)
  38. #endif