io.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2014 Altera Corporation
  3. * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
  4. * Copyright (C) 2004 Microtronix Datacom Ltd.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #ifndef _ASM_NIOS2_IO_H
  11. #define _ASM_NIOS2_IO_H
  12. #include <linux/types.h>
  13. #include <asm/pgtable-bits.h>
  14. /* PCI is not supported in nios2, set this to 0. */
  15. #define IO_SPACE_LIMIT 0
  16. #define readb_relaxed(addr) readb(addr)
  17. #define readw_relaxed(addr) readw(addr)
  18. #define readl_relaxed(addr) readl(addr)
  19. #define writeb_relaxed(x, addr) writeb(x, addr)
  20. #define writew_relaxed(x, addr) writew(x, addr)
  21. #define writel_relaxed(x, addr) writel(x, addr)
  22. extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
  23. unsigned long cacheflag);
  24. extern void __iounmap(void __iomem *addr);
  25. static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
  26. {
  27. return __ioremap(physaddr, size, 0);
  28. }
  29. static inline void __iomem *ioremap_nocache(unsigned long physaddr,
  30. unsigned long size)
  31. {
  32. return __ioremap(physaddr, size, 0);
  33. }
  34. static inline void iounmap(void __iomem *addr)
  35. {
  36. __iounmap(addr);
  37. }
  38. #define ioremap_wc ioremap_nocache
  39. #define ioremap_wt ioremap_nocache
  40. /* Pages to physical address... */
  41. #define page_to_phys(page) virt_to_phys(page_to_virt(page))
  42. /* Macros used for converting between virtual and physical mappings. */
  43. #define phys_to_virt(vaddr) \
  44. ((void *)((unsigned long)(vaddr) | CONFIG_NIOS2_KERNEL_REGION_BASE))
  45. /* Clear top 3 bits */
  46. #define virt_to_phys(vaddr) \
  47. ((unsigned long)((unsigned long)(vaddr) & ~0xE0000000))
  48. #include <asm-generic/io.h>
  49. #endif /* _ASM_NIOS2_IO_H */