ioremap.h 930 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 BCM6362_CPU_ID:
  20. case BCM6368_CPU_ID:
  21. if (offset >= 0xb0000000 && offset < 0xb1000000)
  22. return 1;
  23. break;
  24. }
  25. return 0;
  26. }
  27. static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
  28. unsigned long flags)
  29. {
  30. if (is_bcm63xx_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_bcm63xx_internal_registers((unsigned long)addr);
  37. }
  38. #endif /* BCM63XX_IOREMAP_H_ */