Fix IP22 timer calibration.
[linux-2.6/linux-mips.git] / include / asm-mips64 / mv64340_dep.h
blobf550fdfba7fa65b3c99da4a1472b16e7b53cd99d
1 /*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
5 * include/asm-mips/mv64340-dep.h
6 * Board-dependent definitions for MV-64340 chip.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #ifndef __MV64340_DEP_H__
15 #define __MV64340_DEP_H__
17 #include <asm/addrspace.h> /* for KSEG1ADDR() */
18 #include <asm/byteorder.h> /* for cpu_to_le32() */
20 extern unsigned long mv64340_base;
22 #define MV64340_BASE (mv64340_base)
25 * Because of an error/peculiarity in the Galileo chip, we need to swap the
26 * bytes when running bigendian.
29 #define MV_WRITE(ofs, data) \
30 *(volatile u32 *)(MV64340_BASE+(ofs)) = cpu_to_le32(data)
31 #define MV_READ(ofs, data) \
32 *(data) = le32_to_cpu(*(volatile u32 *)(MV64340_BASE+(ofs)))
33 #define MV_READ_DATA(ofs) \
34 le32_to_cpu(*(volatile u32 *)(MV64340_BASE+(ofs)))
36 #define MV_WRITE_16(ofs, data) \
37 *(volatile u16 *)(MV64340_BASE+(ofs)) = cpu_to_le16(data)
38 #define MV_READ_16(ofs, data) \
39 *(data) = le16_to_cpu(*(volatile u16 *)(MV64340_BASE+(ofs)))
41 #define MV_WRITE_8(ofs, data) \
42 *(volatile u8 *)(MV64340_BASE+(ofs)) = data
43 #define MV_READ_8(ofs, data) \
44 *(data) = *(volatile u8 *)(MV64340_BASE+(ofs))
46 #define MV_SET_REG_BITS(ofs,bits) \
47 (*((volatile u32 *)(MV64340_BASE+(ofs)))) |= ((u32)cpu_to_le32(bits))
48 #define MV_RESET_REG_BITS(ofs,bits) \
49 (*((volatile u32 *)(MV64340_BASE+(ofs)))) &= ~((u32)cpu_to_le32(bits))
51 #endif