ioremap.h 908 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 BCM6328_CPU_ID:
  19. case BCM6368_CPU_ID:
  20. if (offset >= 0xb0000000 && offset < 0xb1000000)
  21. return 1;
  22. break;
  23. }
  24. return 0;
  25. }
  26. static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
  27. unsigned long flags)
  28. {
  29. if (is_bcm63xx_internal_registers(offset))
  30. return (void __iomem *)offset;
  31. return NULL;
  32. }
  33. static inline int plat_iounmap(const volatile void __iomem *addr)
  34. {
  35. return is_bcm63xx_internal_registers((unsigned long)addr);
  36. }
  37. #endif /* BCM63XX_IOREMAP_H_ */