ioremap.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_MACH_BMIPS_IOREMAP_H
  3. #define __ASM_MACH_BMIPS_IOREMAP_H
  4. #include <linux/types.h>
  5. /*
  6. * Allow physical addresses to be fixed up to help peripherals located
  7. * outside the low 32-bit range -- generic pass-through version.
  8. */
  9. static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr,
  10. phys_addr_t size)
  11. {
  12. return phys_addr;
  13. }
  14. static inline int is_bmips_internal_registers(phys_addr_t offset)
  15. {
  16. #if defined(CONFIG_SOC_BMIPS_BCM6338) || \
  17. defined(CONFIG_SOC_BMIPS_BCM6348) || \
  18. defined(CONFIG_SOC_BMIPS_BCM6358)
  19. if (offset >= 0xfffe0000)
  20. return 1;
  21. #endif
  22. return 0;
  23. }
  24. static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
  25. unsigned long flags)
  26. {
  27. if (is_bmips_internal_registers(offset))
  28. return (void __iomem *)offset;
  29. return NULL;
  30. }
  31. static inline int plat_iounmap(const volatile void __iomem *addr)
  32. {
  33. return is_bmips_internal_registers((unsigned long)addr);
  34. }
  35. #define _page_cachable_default _CACHE_CACHABLE_NONCOHERENT
  36. #endif /* __ASM_MACH_BMIPS_IOREMAP_H */