ioremap.h 886 B

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