ioremap.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef BCM63XX_IOREMAP_H_
  3. #define BCM63XX_IOREMAP_H_
  4. #include <bcm63xx_cpu.h>
  5. static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size)
  6. {
  7. return phys_addr;
  8. }
  9. static inline int is_bcm63xx_internal_registers(phys_addr_t offset)
  10. {
  11. switch (bcm63xx_get_cpu_id()) {
  12. case BCM3368_CPU_ID:
  13. if (offset >= 0xfff80000)
  14. return 1;
  15. break;
  16. case BCM6338_CPU_ID:
  17. case BCM6345_CPU_ID:
  18. case BCM6348_CPU_ID:
  19. case BCM6358_CPU_ID:
  20. if (offset >= 0xfff00000)
  21. return 1;
  22. break;
  23. case BCM6328_CPU_ID:
  24. case BCM6362_CPU_ID:
  25. case BCM6368_CPU_ID:
  26. if (offset >= 0xb0000000 && offset < 0xb1000000)
  27. return 1;
  28. break;
  29. }
  30. return 0;
  31. }
  32. static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
  33. unsigned long flags)
  34. {
  35. if (is_bcm63xx_internal_registers(offset))
  36. return (void __iomem *)offset;
  37. return NULL;
  38. }
  39. static inline int plat_iounmap(const volatile void __iomem *addr)
  40. {
  41. return is_bcm63xx_internal_registers((unsigned long)addr);
  42. }
  43. #endif /* BCM63XX_IOREMAP_H_ */