summaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.h
blob: 35e7876c255e7418398b847e9924b16724f2988b (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 *	Defines for ADM5120 built in ethernet switch driver
 *
 *	Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005
 *
 *	Values come from ADM5120 datasheet and original ADMtek 2.4 driver,
 *	Copyright ADMtek Inc.
 */

#ifndef _INCLUDE_ADM5120SW_H_
#define _INCLUDE_ADM5120SW_H_

#define SW_BASE	KSEG1ADDR(0x12000000)
#define SW_DEVS	6

#define ETH_TX_TIMEOUT	HZ/4
#define ETH_FCS 4;

#define ADM5120_CODE		0x00		/* CPU description */
#define ADM5120_CODE_PQFP	0x20000000	/* package type */
#define ADM5120_CPUP_CONF	0x24		/* CPU port config */
#define ADM5120_DISCCPUPORT	0x00000001	/* disable cpu port */
#define ADM5120_CRC_PADDING	0x00000002	/* software crc */
#define ADM5120_DISUNSHIFT	9
#define ADM5120_DISUNALL	0x00007e00	/* disable unknown from all */
#define ADM5120_DISMCSHIFT	16
#define ADM5120_DISMCALL	0x003f0000	/* disable multicast from all */
#define ADM5120_PORT_CONF0	0x28
#define ADM5120_ENMC		0x00003f00	/* Enable MC routing (ex cpu) */
#define ADM5120_ENBP		0x003f0000	/* Enable Back Pressure */
#define ADM5120_VLAN_GI		0x40		/* VLAN settings */
#define ADM5120_VLAN_GII	0x44
#define ADM5120_SEND_TRIG	0x48
#define ADM5120_SEND_TRIG_L	0x00000001
#define ADM5120_SEND_TRIG_H	0x00000002
#define ADM5120_MAC_WT0		0x58
#define ADM5120_MAC_WRITE	0x00000001
#define ADM5120_MAC_WRITE_DONE	0x00000002
#define ADM5120_VLAN_EN		0x00000040
#define ADM5120_MAC_WT1		0x5c
#define ADM5120_BW_CTL0		0x60		/* Bandwidth control 0 */
#define ADM5120_BW_CTL1		0x64		/* Bandwidth control 1 */
#define ADM5120_PHY_CNTL2	0x7c
#define ADM5120_AUTONEG		0x0000001f	/* Auto negotiate */
#define ADM5120_NORMAL		0x01f00000	/* PHY normal mode */
#define ADM5120_AUTOMDIX	0x3e000000	/* Auto MDIX */
#define ADM5120_PHY_CNTL3	0x80
#define ADM5120_PHY_NTH		0x00000400
#define ADM5120_INT_ST		0xb0
#define ADM5120_INT_RXH		0x0000004
#define ADM5120_INT_RXL		0x0000008
#define ADM5120_INT_HFULL	0x0000010
#define ADM5120_INT_LFULL	0x0000020
#define ADM5120_INT_TXH		0x0000001
#define ADM5120_INT_TXL		0x0000002
#define ADM5120_INT_MASK	0xb4
#define ADM5120_INTMASKALL	0x1FDEFFF	/* All interrupts */
#define ADM5120_INTHANDLE	(ADM5120_INT_RXH | ADM5120_INT_RXL | \
				 ADM5120_INT_HFULL | ADM5120_INT_LFULL | \
				 ADM5120_INT_TXH | ADM5120_INT_TXL)
#define ADM5120_SEND_HBADDR	0xd0
#define ADM5120_SEND_LBADDR	0xd4
#define ADM5120_RECEIVE_HBADDR	0xd8
#define ADM5120_RECEIVE_LBADDR	0xdc

struct adm5120_dma {
	u32 data;
	u32 cntl;
	u32 len;
	u32 status;
} __attribute__ ((packed));

#define	ADM5120_DMA_MASK	0x01ffffff
#define ADM5120_DMA_OWN		0x80000000	/* buffer owner */
#define ADM5120_DMA_RINGEND	0x10000000	/* Last in DMA ring */

#define ADM5120_DMA_ADDR(ptr)	((u32)(ptr) & ADM5120_DMA_MASK)
#define ADM5120_DMA_PORTID	0x00007000
#define ADM5120_DMA_PORTSHIFT	12
#define ADM5120_DMA_LEN		0x07ff0000
#define ADM5120_DMA_LENSHIFT	16
#define ADM5120_DMA_FCSERR	0x00000008

#define ADM5120_DMA_TXH		16
#define ADM5120_DMA_TXL		64
#define ADM5120_DMA_RXH		16
#define ADM5120_DMA_RXL		8

#define ADM5120_DMA_RXSIZE	1550
#define ADM5120_DMA_EXTRA	20

struct adm5120_sw {
	int			port;
	struct net_device_stats	stats;
};

#define SIOCSMATRIX	SIOCDEVPRIVATE
#define SIOCGMATRIX	SIOCDEVPRIVATE+1
#define SIOCGADMINFO	SIOCDEVPRIVATE+2
#define SIOCGETBW	SIOCDEVPRIVATE+3
#define SIOCSETBW	SIOCDEVPRIVATE+4

struct adm5120_sw_info {
	u16	magic;
	u16	ports;
	u16	vlan;
};

#endif /* _INCLUDE_ADM5120SW_H_ */