io.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * include/asm-arm/arch-ixp23xx/io.h
  3. *
  4. * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
  5. * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  6. *
  7. * Copyright (C) 2003-2005 Intel Corp.
  8. * Copyright (C) 2005 MontaVista Software, Inc
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __ASM_ARCH_IO_H
  15. #define __ASM_ARCH_IO_H
  16. #define IO_SPACE_LIMIT 0xffffffff
  17. #define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
  18. #define __mem_pci(a) (a)
  19. #include <linux/kernel.h> /* For BUG */
  20. static inline void __iomem *
  21. ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned long flags)
  22. {
  23. if (addr >= IXP23XX_PCI_MEM_START &&
  24. addr <= IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE) {
  25. if (addr + size > IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE)
  26. return NULL;
  27. return (void __iomem *)
  28. ((addr - IXP23XX_PCI_MEM_START) + IXP23XX_PCI_MEM_VIRT);
  29. }
  30. return __ioremap(addr, size, flags);
  31. }
  32. static inline void
  33. ixp23xx_iounmap(void __iomem *addr)
  34. {
  35. if ((((u32)addr) >= IXP23XX_PCI_MEM_VIRT) &&
  36. (((u32)addr) < IXP23XX_PCI_MEM_VIRT + IXP23XX_PCI_MEM_SIZE))
  37. return;
  38. __iounmap(addr);
  39. }
  40. #define __arch_ioremap(a,s,f) ixp23xx_ioremap(a,s,f)
  41. #define __arch_iounmap(a) ixp23xx_iounmap(a)
  42. #endif