marvell.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2004 by Ralf Baechle
  7. */
  8. #ifndef __ASM_MIPS_MARVELL_H
  9. #define __ASM_MIPS_MARVELL_H
  10. #include <linux/pci.h>
  11. #include <asm/byteorder.h>
  12. extern unsigned long marvell_base;
  13. /*
  14. * Because of an error/peculiarity in the Galileo chip, we need to swap the
  15. * bytes when running bigendian.
  16. */
  17. #define __MV_READ(ofs) \
  18. (*(volatile u32 *)(marvell_base+(ofs)))
  19. #define __MV_WRITE(ofs, data) \
  20. do { *(volatile u32 *)(marvell_base+(ofs)) = (data); } while (0)
  21. #define MV_READ(ofs) le32_to_cpu(__MV_READ(ofs))
  22. #define MV_WRITE(ofs, data) __MV_WRITE(ofs, cpu_to_le32(data))
  23. #define MV_READ_16(ofs) \
  24. le16_to_cpu(*(volatile u16 *)(marvell_base+(ofs)))
  25. #define MV_WRITE_16(ofs, data) \
  26. *(volatile u16 *)(marvell_base+(ofs)) = cpu_to_le16(data)
  27. #define MV_READ_8(ofs) \
  28. *(volatile u8 *)(marvell_base+(ofs))
  29. #define MV_WRITE_8(ofs, data) \
  30. *(volatile u8 *)(marvell_base+(ofs)) = data
  31. #define MV_SET_REG_BITS(ofs, bits) \
  32. (*((volatile u32 *)(marvell_base + (ofs)))) |= ((u32)cpu_to_le32(bits))
  33. #define MV_RESET_REG_BITS(ofs, bits) \
  34. (*((volatile u32 *)(marvell_base + (ofs)))) &= ~((u32)cpu_to_le32(bits))
  35. extern struct pci_ops mv_pci_ops;
  36. struct mv_pci_controller {
  37. struct pci_controller pcic;
  38. /*
  39. * GT-64240/MV-64340 specific, per host bus information
  40. */
  41. unsigned long config_addr;
  42. unsigned long config_vreg;
  43. };
  44. #endif /* __ASM_MIPS_MARVELL_H */