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 #if 0
25 #define GT_PCI_MEM_BASE    (0x22000000)
26 #define GT_PCI_MEM_SIZE    GT_DEF_PCI0_MEM0_SIZE
27 #define GT_PCI_IO_BASE     (0x20000000)
28 #define GT_PCI_IO_SIZE     GT_DEF_PCI0_IO_SIZE
29 #endif
30 
31 extern unsigned long gt64240_base;
32 
33 #define GT64240_BASE       (gt64240_base)
34 
35 /*
36  * Because of an error/peculiarity in the Galileo chip, we need to swap the
37  * bytes when running bigendian.
38  */
39 
40 #define GT_WRITE(ofs, data)  \
41         *(volatile u32 *)(GT64240_BASE+(ofs)) = cpu_to_le32(data)
42 #define GT_READ(ofs, data)   \
43         *(data) = le32_to_cpu(*(volatile u32 *)(GT64240_BASE+(ofs)))
44 #define GT_READ_DATA(ofs)    \
45         le32_to_cpu(*(volatile u32 *)(GT64240_BASE+(ofs)))
46 
47 #define GT_WRITE_16(ofs, data)  \
48         *(volatile u16 *)(GT64240_BASE+(ofs)) = cpu_to_le16(data)
49 #define GT_READ_16(ofs, data)   \
50         *(data) = le16_to_cpu(*(volatile u16 *)(GT64240_BASE+(ofs)))
51 
52 #define GT_WRITE_8(ofs, data)  \
53         *(volatile u8 *)(GT64240_BASE+(ofs)) = data
54 #define GT_READ_8(ofs, data)   \
55         *(data) = *(volatile u8 *)(GT64240_BASE+(ofs))
56 
57 #endif  /* _ASM_GT64120_MOMENCO_OCELOT_GT64120_DEP_H */
58