1/***********************************************************************
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/gt64240/gt64240-dep.h
6 *     Board-dependent definitions for GT-64120 chip.
7 *
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.
12 ***********************************************************************
13 */
14
15#ifndef _ASM_GT64240_DEP_H
16#define _ASM_GT64240_DEP_H
17
18#include <asm/addrspace.h>		/* for KSEG1ADDR() */
19#include <asm/byteorder.h>		/* for cpu_to_le32() */
20
21/*
22 * PCI address allocation
23 */
24
25extern unsigned long gt64240_base;
26
27#define GT64240_BASE       (gt64240_base)
28
29/*
30 * Because of an error/peculiarity in the Galileo chip, we need to swap the
31 * bytes when running bigendian.
32 */
33
34#define GT_WRITE(ofs, data)  \
35        *(volatile u32 *)(GT64240_BASE+(ofs)) = cpu_to_le32(data)
36#define GT_READ(ofs, data)   \
37        *(data) = le32_to_cpu(*(volatile u32 *)(GT64240_BASE+(ofs)))
38#define GT_READ_DATA(ofs)    \
39        le32_to_cpu(*(volatile u32 *)(GT64240_BASE+(ofs)))
40
41#define GT_WRITE_16(ofs, data)  \
42        *(volatile u16 *)(GT64240_BASE+(ofs)) = cpu_to_le16(data)
43#define GT_READ_16(ofs, data)   \
44        *(data) = le16_to_cpu(*(volatile u16 *)(GT64240_BASE+(ofs)))
45
46#define GT_WRITE_8(ofs, data)  \
47        *(volatile u8 *)(GT64240_BASE+(ofs)) = data
48#define GT_READ_8(ofs, data)   \
49        *(data) = *(volatile u8 *)(GT64240_BASE+(ofs))
50
51#endif  /* _ASM_GT64120_MOMENCO_OCELOT_GT64120_DEP_H */
52