Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / drivers / net / ibm_emac / ibm_emac_zmii.h
1 /*
2  * ocp_zmii.h
3  *
4  * Defines for the IBM ZMII bridge
5  *
6  *      Armin Kuster akuster@mvista.com
7  *      Dec, 2001
8  *
9  * Copyright 2001 MontaVista Softare Inc.
10  *
11  * This program is free software; you can redistribute  it and/or modify it
12  * under  the terms of  the GNU General  Public License as published by the
13  * Free Software Foundation;  either version 2 of the  License, or (at your
14  * option) any later version.
15  */
16
17 #ifndef _IBM_EMAC_ZMII_H_
18 #define _IBM_EMAC_ZMII_H_
19
20 #include <linux/config.h>
21
22 /* ZMII bridge registers */
23 struct zmii_regs {
24         u32 fer;                /* Function enable reg */
25         u32 ssr;                /* Speed select reg */
26         u32 smiirs;             /* SMII status reg */
27 };
28
29 #define ZMII_INPUTS     4
30
31 /* ZMII device */
32 struct ibm_ocp_zmii {
33         struct zmii_regs *base;
34         int mode[ZMII_INPUTS];
35         int users;              /* number of EMACs using this ZMII bridge */
36 };
37
38 /* Fuctional Enable Reg */
39
40 #define ZMII_FER_MASK(x)        (0xf0000000 >> (4*x))
41
42 #define ZMII_MDI0       0x80000000
43 #define ZMII_SMII0      0x40000000
44 #define ZMII_RMII0      0x20000000
45 #define ZMII_MII0       0x10000000
46 #define ZMII_MDI1       0x08000000
47 #define ZMII_SMII1      0x04000000
48 #define ZMII_RMII1      0x02000000
49 #define ZMII_MII1       0x01000000
50 #define ZMII_MDI2       0x00800000
51 #define ZMII_SMII2      0x00400000
52 #define ZMII_RMII2      0x00200000
53 #define ZMII_MII2       0x00100000
54 #define ZMII_MDI3       0x00080000
55 #define ZMII_SMII3      0x00040000
56 #define ZMII_RMII3      0x00020000
57 #define ZMII_MII3       0x00010000
58
59 /* Speed Selection reg */
60
61 #define ZMII_SCI0       0x40000000
62 #define ZMII_FSS0       0x20000000
63 #define ZMII_SP0        0x10000000
64 #define ZMII_SCI1       0x04000000
65 #define ZMII_FSS1       0x02000000
66 #define ZMII_SP1        0x01000000
67 #define ZMII_SCI2       0x00400000
68 #define ZMII_FSS2       0x00200000
69 #define ZMII_SP2        0x00100000
70 #define ZMII_SCI3       0x00040000
71 #define ZMII_FSS3       0x00020000
72 #define ZMII_SP3        0x00010000
73
74 #define ZMII_MII0_100MB ZMII_SP0
75 #define ZMII_MII0_10MB  ~ZMII_SP0
76 #define ZMII_MII1_100MB ZMII_SP1
77 #define ZMII_MII1_10MB  ~ZMII_SP1
78 #define ZMII_MII2_100MB ZMII_SP2
79 #define ZMII_MII2_10MB  ~ZMII_SP2
80 #define ZMII_MII3_100MB ZMII_SP3
81 #define ZMII_MII3_10MB  ~ZMII_SP3
82
83 /* SMII Status reg */
84
85 #define ZMII_STS0 0xFF000000    /* EMAC0 smii status mask */
86 #define ZMII_STS1 0x00FF0000    /* EMAC1 smii status mask */
87
88 #define SMII    0
89 #define RMII    1
90 #define MII     2
91 #define MDI     3
92
93 #endif                          /* _IBM_EMAC_ZMII_H_ */