aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/rb532/files/include/asm-mips/rc32434/rb.h
blob: 6800eb090ac84b2fe623c5f02aa8d7507216db33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 *  Copyright (C) 2004 IDT Inc.
 *  Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 */
#ifndef __MIPS_RB_H__
#define __MIPS_RB_H__
#include <linux/genhd.h>

#define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(0x18000000))
#define DEV0BASE 0x010000
#define DEV0MASK 0x010004
#define DEV0C 0x010008
#define DEV0TC 0x01000C
#define DEV1BASE 0x010010
#define DEV1MASK 0x010014
#define DEV1C 0x010018
#define DEV1TC 0x01001C
#define DEV2BASE 0x010020
#define DEV2MASK 0x010024
#define DEV2C 0x010028
#define DEV2TC 0x01002C
#define DEV3BASE 0x010030
#define DEV3MASK 0x010034
#define DEV3C 0x010038
#define DEV3TC 0x01003C
#define BTCS 0x010040
#define BTCOMPARE 0x010044
#define GPIOFUNC 0x050000
#define GPIOCFG 0x050004
#define GPIOD 0x050008
#define GPIOILEVEL 0x05000C
#define GPIOISTAT 0x050010
#define GPIONMIEN 0x050014
#define IMASK6 0x038038

#define LO_WPX (1 << 0)
#define LO_ALE (1 << 1)
#define LO_CLE (1 << 2)
#define LO_CEX (1 << 3)
#define LO_FOFF (1 << 5)
#define LO_SPICS (1 << 6)
#define LO_ULED (1 << 7)

typedef enum {
	FUNC = 0x00,
	CFG = 0x04,
	DATA = 0x08,
	ILEVEL = 0x0c,
	ISTAT = 0x10,
	NMIEN = 0x14
} gpio_func;

extern void changeLatchU5(unsigned char orMask, unsigned char nandMask);
extern unsigned get434Reg(unsigned regOffs);
extern void set434Reg(unsigned regOffs, unsigned bit, unsigned len, unsigned val);
extern void gpio_set(gpio_func func, u32 mask, u32 value);
extern u32 gpio_get(gpio_func func);

#define get434Reg(x) (*(volatile unsigned *) (IDT434_REG_BASE + (x)))

struct korina_device {
	char *name;
	unsigned char mac[6];
	struct net_device *dev;
};

struct cf_device {
	int gpio_pin;
	void *dev;
	struct gendisk *gd;
};

#endif