ioremap.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
  2. /*
  3. * Copyright (c) 2018 Microsemi Corporation
  4. */
  5. #ifndef __ASM_MACH_MSCC_IOREMAP_H
  6. #define __ASM_MACH_MSCC_IOREMAP_H
  7. #include <linux/types.h>
  8. #include <mach/common.h>
  9. /*
  10. * Allow physical addresses to be fixed up to help peripherals located
  11. * outside the low 32-bit range -- generic pass-through version.
  12. */
  13. static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr,
  14. phys_addr_t size)
  15. {
  16. return phys_addr;
  17. }
  18. static inline int is_vcoreiii_internal_registers(phys_addr_t offset)
  19. {
  20. if ((offset >= MSCC_IO_ORIGIN1_OFFSET &&
  21. offset < (MSCC_IO_ORIGIN1_OFFSET + MSCC_IO_ORIGIN1_SIZE)) ||
  22. (offset >= MSCC_IO_ORIGIN2_OFFSET &&
  23. offset < (MSCC_IO_ORIGIN2_OFFSET + MSCC_IO_ORIGIN2_SIZE)))
  24. return 1;
  25. return 0;
  26. }
  27. static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
  28. unsigned long flags)
  29. {
  30. if (is_vcoreiii_internal_registers(offset))
  31. return (void __iomem *)offset;
  32. return NULL;
  33. }
  34. static inline int plat_iounmap(const volatile void __iomem *addr)
  35. {
  36. return is_vcoreiii_internal_registers((unsigned long)addr);
  37. }
  38. #define _page_cachable_default _CACHE_CACHABLE_NONCOHERENT
  39. #endif /* __ASM_MACH_MSCC_IOREMAP_H */