io.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * include/asm-xtensa/io.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2001 - 2005 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_IO_H
  11. #define _XTENSA_IO_H
  12. #include <asm/byteorder.h>
  13. #include <asm/page.h>
  14. #include <asm/vectors.h>
  15. #include <linux/bug.h>
  16. #include <linux/kernel.h>
  17. #include <linux/pgtable.h>
  18. #include <linux/types.h>
  19. #define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
  20. #define IO_SPACE_LIMIT ~0
  21. #define PCI_IOBASE ((void __iomem *)XCHAL_KIO_BYPASS_VADDR)
  22. #ifdef CONFIG_MMU
  23. /*
  24. * I/O memory mapping functions.
  25. */
  26. void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
  27. unsigned long prot);
  28. #define ioremap_prot ioremap_prot
  29. #define iounmap iounmap
  30. static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
  31. {
  32. if (offset >= XCHAL_KIO_PADDR
  33. && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
  34. return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
  35. else
  36. return ioremap_prot(offset, size,
  37. pgprot_val(pgprot_noncached(PAGE_KERNEL)));
  38. }
  39. #define ioremap ioremap
  40. static inline void __iomem *ioremap_cache(unsigned long offset,
  41. unsigned long size)
  42. {
  43. if (offset >= XCHAL_KIO_PADDR
  44. && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
  45. return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
  46. else
  47. return ioremap_prot(offset, size, pgprot_val(PAGE_KERNEL));
  48. }
  49. #define ioremap_cache ioremap_cache
  50. #endif /* CONFIG_MMU */
  51. #include <asm-generic/io.h>
  52. #endif /* _XTENSA_IO_H */