Add basic 2.6.24 support for rb532, korina napi code has to be adapted to work
[openwrt.git] / target / linux / rb532 / files-2.6.24 / include / asm-mips / rc32434 / rb.h
1 /*
2  *  Copyright (C) 2004 IDT Inc.
3  *  Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  */
16 #ifndef __MIPS_RB_H__
17 #define __MIPS_RB_H__
18 #include <linux/genhd.h>
19
20 #define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(0x18000000))
21 #define DEV0BASE 0x010000
22 #define DEV0MASK 0x010004
23 #define DEV0C 0x010008
24 #define DEV0TC 0x01000C
25 #define DEV1BASE 0x010010
26 #define DEV1MASK 0x010014
27 #define DEV1C 0x010018
28 #define DEV1TC 0x01001C
29 #define DEV2BASE 0x010020
30 #define DEV2MASK 0x010024
31 #define DEV2C 0x010028
32 #define DEV2TC 0x01002C
33 #define DEV3BASE 0x010030
34 #define DEV3MASK 0x010034
35 #define DEV3C 0x010038
36 #define DEV3TC 0x01003C
37 #define BTCS 0x010040
38 #define BTCOMPARE 0x010044
39 #define GPIOFUNC 0x050000
40 #define GPIOCFG 0x050004
41 #define GPIOD 0x050008
42 #define GPIOILEVEL 0x05000C
43 #define GPIOISTAT 0x050010
44 #define GPIONMIEN 0x050014
45 #define IMASK6 0x038038
46
47 #define LO_WPX (1 << 0)
48 #define LO_ALE (1 << 1)
49 #define LO_CLE (1 << 2)
50 #define LO_CEX (1 << 3)
51 #define LO_FOFF (1 << 5)
52 #define LO_SPICS (1 << 6)
53 #define LO_ULED (1 << 7)
54
55 typedef enum {
56         FUNC = 0x00,
57         CFG = 0x04,
58         DATA = 0x08,
59         ILEVEL = 0x0c,
60         ISTAT = 0x10,
61         NMIEN = 0x14
62 } gpio_func;
63
64 extern void changeLatchU5(unsigned char orMask, unsigned char nandMask);
65 extern unsigned get434Reg(unsigned regOffs);
66 extern void set434Reg(unsigned regOffs, unsigned bit, unsigned len, unsigned val);
67 extern void gpio_set(gpio_func func, u32 mask, u32 value);
68 extern u32 gpio_get(gpio_func func);
69
70 #define get434Reg(x) (*(volatile unsigned *) (IDT434_REG_BASE + (x)))
71
72 struct korina_device {
73         char *name;
74         unsigned char mac[6];
75         struct net_device *dev;
76 };
77
78 struct cf_device {
79         int gpio_pin;
80         void *dev;
81         struct gendisk *gd;
82 };
83
84 #endif