1 /*
2  * Generic library functions for the MSF (Media and Switch Fabric) unit
3  * found on the Intel IXP2400 network processor.
4  *
5  * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
6  * Dedicated to Marija Kulikova.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as
10  * published by the Free Software Foundation; either version 2.1 of the
11  * License, or (at your option) any later version.
12  */
13 
14 #ifndef __IXP2400_MSF_H
15 #define __IXP2400_MSF_H
16 
17 struct ixp2400_msf_parameters
18 {
19 	u32				rx_mode;
20 	unsigned			rxclk01_multiplier:2;
21 	unsigned			rxclk23_multiplier:2;
22 	unsigned			rx_poll_ports:6;
23 	u32				rx_channel_mode[4];
24 
25 	u32				tx_mode;
26 	unsigned			txclk01_multiplier:2;
27 	unsigned			txclk23_multiplier:2;
28 	unsigned			tx_poll_ports:6;
29 	u32				tx_channel_mode[4];
30 };
31 
32 void ixp2400_msf_init(struct ixp2400_msf_parameters *mp);
33 
34 #define IXP2400_PLL_MULTIPLIER_48		0x00
35 #define IXP2400_PLL_MULTIPLIER_24		0x01
36 #define IXP2400_PLL_MULTIPLIER_16		0x02
37 #define IXP2400_PLL_MULTIPLIER_12		0x03
38 
39 #define IXP2400_RX_MODE_CSIX			0x00400000
40 #define IXP2400_RX_MODE_UTOPIA_POS		0x00000000
41 #define IXP2400_RX_MODE_WIDTH_MASK		0x00300000
42 #define IXP2400_RX_MODE_1x16_2x8		0x00300000
43 #define IXP2400_RX_MODE_4x8			0x00200000
44 #define IXP2400_RX_MODE_2x16			0x00100000
45 #define IXP2400_RX_MODE_1x32			0x00000000
46 #define IXP2400_RX_MODE_MPHY			0x00080000
47 #define IXP2400_RX_MODE_SPHY			0x00000000
48 #define IXP2400_RX_MODE_MPHY_32			0x00040000
49 #define IXP2400_RX_MODE_MPHY_4			0x00000000
50 #define IXP2400_RX_MODE_MPHY_POLLED_STATUS	0x00020000
51 #define IXP2400_RX_MODE_MPHY_DIRECT_STATUS	0x00000000
52 #define IXP2400_RX_MODE_CBUS_FULL_DUPLEX	0x00010000
53 #define IXP2400_RX_MODE_CBUS_SIMPLEX		0x00000000
54 #define IXP2400_RX_MODE_MPHY_LEVEL2		0x00004000
55 #define IXP2400_RX_MODE_MPHY_LEVEL3		0x00000000
56 #define IXP2400_RX_MODE_CBUS_8BIT		0x00002000
57 #define IXP2400_RX_MODE_CBUS_4BIT		0x00000000
58 #define IXP2400_RX_MODE_CSIX_SINGLE_FREELIST	0x00000200
59 #define IXP2400_RX_MODE_CSIX_SPLIT_FREELISTS	0x00000000
60 #define IXP2400_RX_MODE_RBUF_SIZE_MASK		0x0000000c
61 #define IXP2400_RX_MODE_RBUF_SIZE_256		0x00000008
62 #define IXP2400_RX_MODE_RBUF_SIZE_128		0x00000004
63 #define IXP2400_RX_MODE_RBUF_SIZE_64		0x00000000
64 
65 #define IXP2400_PORT_RX_MODE_SLAVE		0x00000040
66 #define IXP2400_PORT_RX_MODE_MASTER		0x00000000
67 #define IXP2400_PORT_RX_MODE_POS_PHY_L3		0x00000020
68 #define IXP2400_PORT_RX_MODE_POS_PHY_L2		0x00000000
69 #define IXP2400_PORT_RX_MODE_POS_PHY		0x00000010
70 #define IXP2400_PORT_RX_MODE_UTOPIA		0x00000000
71 #define IXP2400_PORT_RX_MODE_EVEN_PARITY	0x0000000c
72 #define IXP2400_PORT_RX_MODE_ODD_PARITY		0x00000008
73 #define IXP2400_PORT_RX_MODE_NO_PARITY		0x00000000
74 #define IXP2400_PORT_RX_MODE_UTOPIA_BIG_CELLS	0x00000002
75 #define IXP2400_PORT_RX_MODE_UTOPIA_NORMAL_CELLS	0x00000000
76 #define IXP2400_PORT_RX_MODE_2_CYCLE_DECODE	0x00000001
77 #define IXP2400_PORT_RX_MODE_1_CYCLE_DECODE	0x00000000
78 
79 #define IXP2400_TX_MODE_CSIX			0x00400000
80 #define IXP2400_TX_MODE_UTOPIA_POS		0x00000000
81 #define IXP2400_TX_MODE_WIDTH_MASK		0x00300000
82 #define IXP2400_TX_MODE_1x16_2x8		0x00300000
83 #define IXP2400_TX_MODE_4x8			0x00200000
84 #define IXP2400_TX_MODE_2x16			0x00100000
85 #define IXP2400_TX_MODE_1x32			0x00000000
86 #define IXP2400_TX_MODE_MPHY			0x00080000
87 #define IXP2400_TX_MODE_SPHY			0x00000000
88 #define IXP2400_TX_MODE_MPHY_32			0x00040000
89 #define IXP2400_TX_MODE_MPHY_4			0x00000000
90 #define IXP2400_TX_MODE_MPHY_POLLED_STATUS	0x00020000
91 #define IXP2400_TX_MODE_MPHY_DIRECT_STATUS	0x00000000
92 #define IXP2400_TX_MODE_CBUS_FULL_DUPLEX	0x00010000
93 #define IXP2400_TX_MODE_CBUS_SIMPLEX		0x00000000
94 #define IXP2400_TX_MODE_MPHY_LEVEL2		0x00004000
95 #define IXP2400_TX_MODE_MPHY_LEVEL3		0x00000000
96 #define IXP2400_TX_MODE_CBUS_8BIT		0x00002000
97 #define IXP2400_TX_MODE_CBUS_4BIT		0x00000000
98 #define IXP2400_TX_MODE_TBUF_SIZE_MASK		0x0000000c
99 #define IXP2400_TX_MODE_TBUF_SIZE_256		0x00000008
100 #define IXP2400_TX_MODE_TBUF_SIZE_128		0x00000004
101 #define IXP2400_TX_MODE_TBUF_SIZE_64		0x00000000
102 
103 #define IXP2400_PORT_TX_MODE_SLAVE		0x00000040
104 #define IXP2400_PORT_TX_MODE_MASTER		0x00000000
105 #define IXP2400_PORT_TX_MODE_POS_PHY		0x00000010
106 #define IXP2400_PORT_TX_MODE_UTOPIA		0x00000000
107 #define IXP2400_PORT_TX_MODE_EVEN_PARITY	0x0000000c
108 #define IXP2400_PORT_TX_MODE_ODD_PARITY		0x00000008
109 #define IXP2400_PORT_TX_MODE_NO_PARITY		0x00000000
110 #define IXP2400_PORT_TX_MODE_UTOPIA_BIG_CELLS	0x00000002
111 #define IXP2400_PORT_TX_MODE_2_CYCLE_DECODE	0x00000001
112 #define IXP2400_PORT_TX_MODE_1_CYCLE_DECODE	0x00000000
113 
114 
115 #endif
116