diff options
author | Rob Herring <rob.herring@calxeda.com> | 2012-04-03 11:34:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-04 18:09:37 -0400 |
commit | 695e00789a2703e79da9adf3cd868fe54142885e (patch) | |
tree | 0d6579b170108bec3e1fba058c67aba538f4879c /drivers/net/ethernet/xscale | |
parent | e7f8c1fe1705e78f56ca4c8350545ad58d73451a (diff) |
net: remove ixp2000 ethernet driver
The platform is removed, so there are no users of this driver.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Bruce Allan <bruce.w.allan@intel.com>
Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
Cc: Don Skidmore <donald.c.skidmore@intel.com>
Cc: Greg Rose <gregory.v.rose@intel.com>
Cc: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Cc: Alex Duyck <alexander.h.duyck@intel.com>
Cc: John Ronciak <john.ronciak@intel.com>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/xscale')
18 files changed, 2 insertions, 2542 deletions
diff --git a/drivers/net/ethernet/xscale/Kconfig b/drivers/net/ethernet/xscale/Kconfig index cf67352cea14..3f431019e615 100644 --- a/drivers/net/ethernet/xscale/Kconfig +++ b/drivers/net/ethernet/xscale/Kconfig | |||
@@ -5,8 +5,8 @@ | |||
5 | config NET_VENDOR_XSCALE | 5 | config NET_VENDOR_XSCALE |
6 | bool "Intel XScale IXP devices" | 6 | bool "Intel XScale IXP devices" |
7 | default y | 7 | default y |
8 | depends on NET_VENDOR_INTEL && ((ARM && ARCH_IXP4XX && \ | 8 | depends on NET_VENDOR_INTEL && (ARM && ARCH_IXP4XX && \ |
9 | IXP4XX_NPE && IXP4XX_QMGR) || ARCH_ENP2611) | 9 | IXP4XX_NPE && IXP4XX_QMGR) |
10 | ---help--- | 10 | ---help--- |
11 | If you have a network (Ethernet) card belonging to this class, say Y | 11 | If you have a network (Ethernet) card belonging to this class, say Y |
12 | and read the Ethernet-HOWTO, available from | 12 | and read the Ethernet-HOWTO, available from |
@@ -27,6 +27,4 @@ config IXP4XX_ETH | |||
27 | Say Y here if you want to use built-in Ethernet ports | 27 | Say Y here if you want to use built-in Ethernet ports |
28 | on IXP4xx processor. | 28 | on IXP4xx processor. |
29 | 29 | ||
30 | source "drivers/net/ethernet/xscale/ixp2000/Kconfig" | ||
31 | |||
32 | endif # NET_VENDOR_XSCALE | 30 | endif # NET_VENDOR_XSCALE |
diff --git a/drivers/net/ethernet/xscale/Makefile b/drivers/net/ethernet/xscale/Makefile index b195b9d7fe81..abc3b031fba7 100644 --- a/drivers/net/ethernet/xscale/Makefile +++ b/drivers/net/ethernet/xscale/Makefile | |||
@@ -2,5 +2,4 @@ | |||
2 | # Makefile for the Intel XScale IXP device drivers. | 2 | # Makefile for the Intel XScale IXP device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_ENP2611_MSF_NET) += ixp2000/ | ||
6 | obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o | 5 | obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o |
diff --git a/drivers/net/ethernet/xscale/ixp2000/Kconfig b/drivers/net/ethernet/xscale/ixp2000/Kconfig deleted file mode 100644 index 58dbc5b876bc..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/Kconfig +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | config ENP2611_MSF_NET | ||
2 | tristate "Radisys ENP2611 MSF network interface support" | ||
3 | depends on ARCH_ENP2611 | ||
4 | ---help--- | ||
5 | This is a driver for the MSF network interface unit in | ||
6 | the IXP2400 on the Radisys ENP2611 platform. | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/Makefile b/drivers/net/ethernet/xscale/ixp2000/Makefile deleted file mode 100644 index fd38351ceaa7..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/Makefile +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | obj-$(CONFIG_ENP2611_MSF_NET) += enp2611_mod.o | ||
2 | |||
3 | enp2611_mod-objs := caleb.o enp2611.o ixp2400-msf.o ixpdev.o pm3386.o | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/caleb.c b/drivers/net/ethernet/xscale/ixp2000/caleb.c deleted file mode 100644 index 7dea5b95012c..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/caleb.c +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* | ||
2 | * Helper functions for the SPI-3 bridge FPGA on the Radisys ENP2611 | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <asm/io.h> | ||
15 | #include "caleb.h" | ||
16 | |||
17 | #define CALEB_IDLO 0x00 | ||
18 | #define CALEB_IDHI 0x01 | ||
19 | #define CALEB_RID 0x02 | ||
20 | #define CALEB_RESET 0x03 | ||
21 | #define CALEB_INTREN0 0x04 | ||
22 | #define CALEB_INTREN1 0x05 | ||
23 | #define CALEB_INTRSTAT0 0x06 | ||
24 | #define CALEB_INTRSTAT1 0x07 | ||
25 | #define CALEB_PORTEN 0x08 | ||
26 | #define CALEB_BURST 0x09 | ||
27 | #define CALEB_PORTPAUS 0x0A | ||
28 | #define CALEB_PORTPAUSD 0x0B | ||
29 | #define CALEB_PHY0RX 0x10 | ||
30 | #define CALEB_PHY1RX 0x11 | ||
31 | #define CALEB_PHY0TX 0x12 | ||
32 | #define CALEB_PHY1TX 0x13 | ||
33 | #define CALEB_IXPRX_HI_CNTR 0x15 | ||
34 | #define CALEB_PHY0RX_HI_CNTR 0x16 | ||
35 | #define CALEB_PHY1RX_HI_CNTR 0x17 | ||
36 | #define CALEB_IXPRX_CNTR 0x18 | ||
37 | #define CALEB_PHY0RX_CNTR 0x19 | ||
38 | #define CALEB_PHY1RX_CNTR 0x1A | ||
39 | #define CALEB_IXPTX_CNTR 0x1B | ||
40 | #define CALEB_PHY0TX_CNTR 0x1C | ||
41 | #define CALEB_PHY1TX_CNTR 0x1D | ||
42 | #define CALEB_DEBUG0 0x1E | ||
43 | #define CALEB_DEBUG1 0x1F | ||
44 | |||
45 | |||
46 | static u8 caleb_reg_read(int reg) | ||
47 | { | ||
48 | u8 value; | ||
49 | |||
50 | value = *((volatile u8 *)(ENP2611_CALEB_VIRT_BASE + reg)); | ||
51 | |||
52 | // printk(KERN_INFO "caleb_reg_read(%d) = %.2x\n", reg, value); | ||
53 | |||
54 | return value; | ||
55 | } | ||
56 | |||
57 | static void caleb_reg_write(int reg, u8 value) | ||
58 | { | ||
59 | u8 dummy; | ||
60 | |||
61 | // printk(KERN_INFO "caleb_reg_write(%d, %.2x)\n", reg, value); | ||
62 | |||
63 | *((volatile u8 *)(ENP2611_CALEB_VIRT_BASE + reg)) = value; | ||
64 | |||
65 | dummy = *((volatile u8 *)ENP2611_CALEB_VIRT_BASE); | ||
66 | __asm__ __volatile__("mov %0, %0" : "+r" (dummy)); | ||
67 | } | ||
68 | |||
69 | |||
70 | void caleb_reset(void) | ||
71 | { | ||
72 | /* | ||
73 | * Perform a chip reset. | ||
74 | */ | ||
75 | caleb_reg_write(CALEB_RESET, 0x02); | ||
76 | udelay(1); | ||
77 | |||
78 | /* | ||
79 | * Enable all interrupt sources. This is needed to get | ||
80 | * meaningful results out of the status bits (register 6 | ||
81 | * and 7.) | ||
82 | */ | ||
83 | caleb_reg_write(CALEB_INTREN0, 0xff); | ||
84 | caleb_reg_write(CALEB_INTREN1, 0x07); | ||
85 | |||
86 | /* | ||
87 | * Set RX and TX FIFO thresholds to 1.5kb. | ||
88 | */ | ||
89 | caleb_reg_write(CALEB_PHY0RX, 0x11); | ||
90 | caleb_reg_write(CALEB_PHY1RX, 0x11); | ||
91 | caleb_reg_write(CALEB_PHY0TX, 0x11); | ||
92 | caleb_reg_write(CALEB_PHY1TX, 0x11); | ||
93 | |||
94 | /* | ||
95 | * Program SPI-3 burst size. | ||
96 | */ | ||
97 | caleb_reg_write(CALEB_BURST, 0); // 64-byte RBUF mpackets | ||
98 | // caleb_reg_write(CALEB_BURST, 1); // 128-byte RBUF mpackets | ||
99 | // caleb_reg_write(CALEB_BURST, 2); // 256-byte RBUF mpackets | ||
100 | } | ||
101 | |||
102 | void caleb_enable_rx(int port) | ||
103 | { | ||
104 | u8 temp; | ||
105 | |||
106 | temp = caleb_reg_read(CALEB_PORTEN); | ||
107 | temp |= 1 << port; | ||
108 | caleb_reg_write(CALEB_PORTEN, temp); | ||
109 | } | ||
110 | |||
111 | void caleb_disable_rx(int port) | ||
112 | { | ||
113 | u8 temp; | ||
114 | |||
115 | temp = caleb_reg_read(CALEB_PORTEN); | ||
116 | temp &= ~(1 << port); | ||
117 | caleb_reg_write(CALEB_PORTEN, temp); | ||
118 | } | ||
119 | |||
120 | void caleb_enable_tx(int port) | ||
121 | { | ||
122 | u8 temp; | ||
123 | |||
124 | temp = caleb_reg_read(CALEB_PORTEN); | ||
125 | temp |= 1 << (port + 4); | ||
126 | caleb_reg_write(CALEB_PORTEN, temp); | ||
127 | } | ||
128 | |||
129 | void caleb_disable_tx(int port) | ||
130 | { | ||
131 | u8 temp; | ||
132 | |||
133 | temp = caleb_reg_read(CALEB_PORTEN); | ||
134 | temp &= ~(1 << (port + 4)); | ||
135 | caleb_reg_write(CALEB_PORTEN, temp); | ||
136 | } | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/caleb.h b/drivers/net/ethernet/xscale/ixp2000/caleb.h deleted file mode 100644 index e93a1ef5b8a3..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/caleb.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Helper functions for the SPI-3 bridge FPGA on the Radisys ENP2611 | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __CALEB_H | ||
13 | #define __CALEB_H | ||
14 | |||
15 | void caleb_reset(void); | ||
16 | void caleb_enable_rx(int port); | ||
17 | void caleb_disable_rx(int port); | ||
18 | void caleb_enable_tx(int port); | ||
19 | void caleb_disable_tx(int port); | ||
20 | |||
21 | |||
22 | #endif | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/enp2611.c b/drivers/net/ethernet/xscale/ixp2000/enp2611.c deleted file mode 100644 index 34a6cfd17930..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/enp2611.c +++ /dev/null | |||
@@ -1,232 +0,0 @@ | |||
1 | /* | ||
2 | * IXP2400 MSF network device driver for the Radisys ENP2611 | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/netdevice.h> | ||
15 | #include <linux/etherdevice.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <asm/hardware/uengine.h> | ||
19 | #include <asm/mach-types.h> | ||
20 | #include <asm/io.h> | ||
21 | #include "ixpdev.h" | ||
22 | #include "caleb.h" | ||
23 | #include "ixp2400-msf.h" | ||
24 | #include "pm3386.h" | ||
25 | |||
26 | /*********************************************************************** | ||
27 | * The Radisys ENP2611 is a PCI form factor board with three SFP GBIC | ||
28 | * slots, connected via two PMC/Sierra 3386s and an SPI-3 bridge FPGA | ||
29 | * to the IXP2400. | ||
30 | * | ||
31 | * +-------------+ | ||
32 | * SFP GBIC #0 ---+ | +---------+ | ||
33 | * | PM3386 #0 +-------+ | | ||
34 | * SFP GBIC #1 ---+ | | "Caleb" | +---------+ | ||
35 | * +-------------+ | | | | | ||
36 | * | SPI-3 +---------+ IXP2400 | | ||
37 | * +-------------+ | bridge | | | | ||
38 | * SFP GBIC #2 ---+ | | FPGA | +---------+ | ||
39 | * | PM3386 #1 +-------+ | | ||
40 | * | | +---------+ | ||
41 | * +-------------+ | ||
42 | * ^ ^ ^ | ||
43 | * | 1.25Gbaud | 104MHz | 104MHz | ||
44 | * | SERDES ea. | SPI-3 ea. | SPI-3 | ||
45 | * | ||
46 | ***********************************************************************/ | ||
47 | static struct ixp2400_msf_parameters enp2611_msf_parameters = | ||
48 | { | ||
49 | .rx_mode = IXP2400_RX_MODE_UTOPIA_POS | | ||
50 | IXP2400_RX_MODE_1x32 | | ||
51 | IXP2400_RX_MODE_MPHY | | ||
52 | IXP2400_RX_MODE_MPHY_32 | | ||
53 | IXP2400_RX_MODE_MPHY_POLLED_STATUS | | ||
54 | IXP2400_RX_MODE_MPHY_LEVEL3 | | ||
55 | IXP2400_RX_MODE_RBUF_SIZE_64, | ||
56 | |||
57 | .rxclk01_multiplier = IXP2400_PLL_MULTIPLIER_16, | ||
58 | |||
59 | .rx_poll_ports = 3, | ||
60 | |||
61 | .rx_channel_mode = { | ||
62 | IXP2400_PORT_RX_MODE_MASTER | | ||
63 | IXP2400_PORT_RX_MODE_POS_PHY | | ||
64 | IXP2400_PORT_RX_MODE_POS_PHY_L3 | | ||
65 | IXP2400_PORT_RX_MODE_ODD_PARITY | | ||
66 | IXP2400_PORT_RX_MODE_2_CYCLE_DECODE, | ||
67 | |||
68 | IXP2400_PORT_RX_MODE_MASTER | | ||
69 | IXP2400_PORT_RX_MODE_POS_PHY | | ||
70 | IXP2400_PORT_RX_MODE_POS_PHY_L3 | | ||
71 | IXP2400_PORT_RX_MODE_ODD_PARITY | | ||
72 | IXP2400_PORT_RX_MODE_2_CYCLE_DECODE, | ||
73 | |||
74 | IXP2400_PORT_RX_MODE_MASTER | | ||
75 | IXP2400_PORT_RX_MODE_POS_PHY | | ||
76 | IXP2400_PORT_RX_MODE_POS_PHY_L3 | | ||
77 | IXP2400_PORT_RX_MODE_ODD_PARITY | | ||
78 | IXP2400_PORT_RX_MODE_2_CYCLE_DECODE, | ||
79 | |||
80 | IXP2400_PORT_RX_MODE_MASTER | | ||
81 | IXP2400_PORT_RX_MODE_POS_PHY | | ||
82 | IXP2400_PORT_RX_MODE_POS_PHY_L3 | | ||
83 | IXP2400_PORT_RX_MODE_ODD_PARITY | | ||
84 | IXP2400_PORT_RX_MODE_2_CYCLE_DECODE | ||
85 | }, | ||
86 | |||
87 | .tx_mode = IXP2400_TX_MODE_UTOPIA_POS | | ||
88 | IXP2400_TX_MODE_1x32 | | ||
89 | IXP2400_TX_MODE_MPHY | | ||
90 | IXP2400_TX_MODE_MPHY_32 | | ||
91 | IXP2400_TX_MODE_MPHY_POLLED_STATUS | | ||
92 | IXP2400_TX_MODE_MPHY_LEVEL3 | | ||
93 | IXP2400_TX_MODE_TBUF_SIZE_64, | ||
94 | |||
95 | .txclk01_multiplier = IXP2400_PLL_MULTIPLIER_16, | ||
96 | |||
97 | .tx_poll_ports = 3, | ||
98 | |||
99 | .tx_channel_mode = { | ||
100 | IXP2400_PORT_TX_MODE_MASTER | | ||
101 | IXP2400_PORT_TX_MODE_POS_PHY | | ||
102 | IXP2400_PORT_TX_MODE_ODD_PARITY | | ||
103 | IXP2400_PORT_TX_MODE_2_CYCLE_DECODE, | ||
104 | |||
105 | IXP2400_PORT_TX_MODE_MASTER | | ||
106 | IXP2400_PORT_TX_MODE_POS_PHY | | ||
107 | IXP2400_PORT_TX_MODE_ODD_PARITY | | ||
108 | IXP2400_PORT_TX_MODE_2_CYCLE_DECODE, | ||
109 | |||
110 | IXP2400_PORT_TX_MODE_MASTER | | ||
111 | IXP2400_PORT_TX_MODE_POS_PHY | | ||
112 | IXP2400_PORT_TX_MODE_ODD_PARITY | | ||
113 | IXP2400_PORT_TX_MODE_2_CYCLE_DECODE, | ||
114 | |||
115 | IXP2400_PORT_TX_MODE_MASTER | | ||
116 | IXP2400_PORT_TX_MODE_POS_PHY | | ||
117 | IXP2400_PORT_TX_MODE_ODD_PARITY | | ||
118 | IXP2400_PORT_TX_MODE_2_CYCLE_DECODE | ||
119 | } | ||
120 | }; | ||
121 | |||
122 | static struct net_device *nds[3]; | ||
123 | static struct timer_list link_check_timer; | ||
124 | |||
125 | /* @@@ Poll the SFP moddef0 line too. */ | ||
126 | /* @@@ Try to use the pm3386 DOOL interrupt as well. */ | ||
127 | static void enp2611_check_link_status(unsigned long __dummy) | ||
128 | { | ||
129 | int i; | ||
130 | |||
131 | for (i = 0; i < 3; i++) { | ||
132 | struct net_device *dev; | ||
133 | int status; | ||
134 | |||
135 | dev = nds[i]; | ||
136 | if (dev == NULL) | ||
137 | continue; | ||
138 | |||
139 | status = pm3386_is_link_up(i); | ||
140 | if (status && !netif_carrier_ok(dev)) { | ||
141 | /* @@@ Should report autonegotiation status. */ | ||
142 | printk(KERN_INFO "%s: NIC Link is Up\n", dev->name); | ||
143 | |||
144 | pm3386_enable_tx(i); | ||
145 | caleb_enable_tx(i); | ||
146 | netif_carrier_on(dev); | ||
147 | } else if (!status && netif_carrier_ok(dev)) { | ||
148 | printk(KERN_INFO "%s: NIC Link is Down\n", dev->name); | ||
149 | |||
150 | netif_carrier_off(dev); | ||
151 | caleb_disable_tx(i); | ||
152 | pm3386_disable_tx(i); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | link_check_timer.expires = jiffies + HZ / 10; | ||
157 | add_timer(&link_check_timer); | ||
158 | } | ||
159 | |||
160 | static void enp2611_set_port_admin_status(int port, int up) | ||
161 | { | ||
162 | if (up) { | ||
163 | caleb_enable_rx(port); | ||
164 | |||
165 | pm3386_set_carrier(port, 1); | ||
166 | pm3386_enable_rx(port); | ||
167 | } else { | ||
168 | caleb_disable_tx(port); | ||
169 | pm3386_disable_tx(port); | ||
170 | /* @@@ Flush out pending packets. */ | ||
171 | pm3386_set_carrier(port, 0); | ||
172 | |||
173 | pm3386_disable_rx(port); | ||
174 | caleb_disable_rx(port); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | static int __init enp2611_init_module(void) | ||
179 | { | ||
180 | int ports; | ||
181 | int i; | ||
182 | |||
183 | if (!machine_is_enp2611()) | ||
184 | return -ENODEV; | ||
185 | |||
186 | caleb_reset(); | ||
187 | pm3386_reset(); | ||
188 | |||
189 | ports = pm3386_port_count(); | ||
190 | for (i = 0; i < ports; i++) { | ||
191 | nds[i] = ixpdev_alloc(i, sizeof(struct ixpdev_priv)); | ||
192 | if (nds[i] == NULL) { | ||
193 | while (--i >= 0) | ||
194 | free_netdev(nds[i]); | ||
195 | return -ENOMEM; | ||
196 | } | ||
197 | |||
198 | pm3386_init_port(i); | ||
199 | pm3386_get_mac(i, nds[i]->dev_addr); | ||
200 | } | ||
201 | |||
202 | ixp2400_msf_init(&enp2611_msf_parameters); | ||
203 | |||
204 | if (ixpdev_init(ports, nds, enp2611_set_port_admin_status)) { | ||
205 | for (i = 0; i < ports; i++) | ||
206 | if (nds[i]) | ||
207 | free_netdev(nds[i]); | ||
208 | return -EINVAL; | ||
209 | } | ||
210 | |||
211 | init_timer(&link_check_timer); | ||
212 | link_check_timer.function = enp2611_check_link_status; | ||
213 | link_check_timer.expires = jiffies; | ||
214 | add_timer(&link_check_timer); | ||
215 | |||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | static void __exit enp2611_cleanup_module(void) | ||
220 | { | ||
221 | int i; | ||
222 | |||
223 | del_timer_sync(&link_check_timer); | ||
224 | |||
225 | ixpdev_deinit(); | ||
226 | for (i = 0; i < 3; i++) | ||
227 | free_netdev(nds[i]); | ||
228 | } | ||
229 | |||
230 | module_init(enp2611_init_module); | ||
231 | module_exit(enp2611_cleanup_module); | ||
232 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixp2400-msf.c b/drivers/net/ethernet/xscale/ixp2000/ixp2400-msf.c deleted file mode 100644 index f5ffd7e05d26..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixp2400-msf.c +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
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 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <mach/hardware.h> | ||
17 | #include <mach/ixp2000-regs.h> | ||
18 | #include <asm/delay.h> | ||
19 | #include <asm/io.h> | ||
20 | #include "ixp2400-msf.h" | ||
21 | |||
22 | /* | ||
23 | * This is the Intel recommended PLL init procedure as described on | ||
24 | * page 340 of the IXP2400/IXP2800 Programmer's Reference Manual. | ||
25 | */ | ||
26 | static void ixp2400_pll_init(struct ixp2400_msf_parameters *mp) | ||
27 | { | ||
28 | int rx_dual_clock; | ||
29 | int tx_dual_clock; | ||
30 | u32 value; | ||
31 | |||
32 | /* | ||
33 | * If the RX mode is not 1x32, we have to enable both RX PLLs | ||
34 | * (#0 and #1.) The same thing for the TX direction. | ||
35 | */ | ||
36 | rx_dual_clock = !!(mp->rx_mode & IXP2400_RX_MODE_WIDTH_MASK); | ||
37 | tx_dual_clock = !!(mp->tx_mode & IXP2400_TX_MODE_WIDTH_MASK); | ||
38 | |||
39 | /* | ||
40 | * Read initial value. | ||
41 | */ | ||
42 | value = ixp2000_reg_read(IXP2000_MSF_CLK_CNTRL); | ||
43 | |||
44 | /* | ||
45 | * Put PLLs in powerdown and bypass mode. | ||
46 | */ | ||
47 | value |= 0x0000f0f0; | ||
48 | ixp2000_reg_write(IXP2000_MSF_CLK_CNTRL, value); | ||
49 | |||
50 | /* | ||
51 | * Set single or dual clock mode bits. | ||
52 | */ | ||
53 | value &= ~0x03000000; | ||
54 | value |= (rx_dual_clock << 24) | (tx_dual_clock << 25); | ||
55 | |||
56 | /* | ||
57 | * Set multipliers. | ||
58 | */ | ||
59 | value &= ~0x00ff0000; | ||
60 | value |= mp->rxclk01_multiplier << 16; | ||
61 | value |= mp->rxclk23_multiplier << 18; | ||
62 | value |= mp->txclk01_multiplier << 20; | ||
63 | value |= mp->txclk23_multiplier << 22; | ||
64 | |||
65 | /* | ||
66 | * And write value. | ||
67 | */ | ||
68 | ixp2000_reg_write(IXP2000_MSF_CLK_CNTRL, value); | ||
69 | |||
70 | /* | ||
71 | * Disable PLL bypass mode. | ||
72 | */ | ||
73 | value &= ~(0x00005000 | rx_dual_clock << 13 | tx_dual_clock << 15); | ||
74 | ixp2000_reg_write(IXP2000_MSF_CLK_CNTRL, value); | ||
75 | |||
76 | /* | ||
77 | * Turn on PLLs. | ||
78 | */ | ||
79 | value &= ~(0x00000050 | rx_dual_clock << 5 | tx_dual_clock << 7); | ||
80 | ixp2000_reg_write(IXP2000_MSF_CLK_CNTRL, value); | ||
81 | |||
82 | /* | ||
83 | * Wait for PLLs to lock. There are lock status bits, but IXP2400 | ||
84 | * erratum #65 says that these lock bits should not be relied upon | ||
85 | * as they might not accurately reflect the true state of the PLLs. | ||
86 | */ | ||
87 | udelay(100); | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * Needed according to p480 of Programmer's Reference Manual. | ||
92 | */ | ||
93 | static void ixp2400_msf_free_rbuf_entries(struct ixp2400_msf_parameters *mp) | ||
94 | { | ||
95 | int size_bits; | ||
96 | int i; | ||
97 | |||
98 | /* | ||
99 | * Work around IXP2400 erratum #69 (silent RBUF-to-DRAM transfer | ||
100 | * corruption) in the Intel-recommended way: do not add the RBUF | ||
101 | * elements susceptible to corruption to the freelist. | ||
102 | */ | ||
103 | size_bits = mp->rx_mode & IXP2400_RX_MODE_RBUF_SIZE_MASK; | ||
104 | if (size_bits == IXP2400_RX_MODE_RBUF_SIZE_64) { | ||
105 | for (i = 1; i < 128; i++) { | ||
106 | if (i == 9 || i == 18 || i == 27) | ||
107 | continue; | ||
108 | ixp2000_reg_write(IXP2000_MSF_RBUF_ELEMENT_DONE, i); | ||
109 | } | ||
110 | } else if (size_bits == IXP2400_RX_MODE_RBUF_SIZE_128) { | ||
111 | for (i = 1; i < 64; i++) { | ||
112 | if (i == 4 || i == 9 || i == 13) | ||
113 | continue; | ||
114 | ixp2000_reg_write(IXP2000_MSF_RBUF_ELEMENT_DONE, i); | ||
115 | } | ||
116 | } else if (size_bits == IXP2400_RX_MODE_RBUF_SIZE_256) { | ||
117 | for (i = 1; i < 32; i++) { | ||
118 | if (i == 2 || i == 4 || i == 6) | ||
119 | continue; | ||
120 | ixp2000_reg_write(IXP2000_MSF_RBUF_ELEMENT_DONE, i); | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | |||
125 | static u32 ixp2400_msf_valid_channels(u32 reg) | ||
126 | { | ||
127 | u32 channels; | ||
128 | |||
129 | channels = 0; | ||
130 | switch (reg & IXP2400_RX_MODE_WIDTH_MASK) { | ||
131 | case IXP2400_RX_MODE_1x32: | ||
132 | channels = 0x1; | ||
133 | if (reg & IXP2400_RX_MODE_MPHY && | ||
134 | !(reg & IXP2400_RX_MODE_MPHY_32)) | ||
135 | channels = 0xf; | ||
136 | break; | ||
137 | |||
138 | case IXP2400_RX_MODE_2x16: | ||
139 | channels = 0x5; | ||
140 | break; | ||
141 | |||
142 | case IXP2400_RX_MODE_4x8: | ||
143 | channels = 0xf; | ||
144 | break; | ||
145 | |||
146 | case IXP2400_RX_MODE_1x16_2x8: | ||
147 | channels = 0xd; | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | return channels; | ||
152 | } | ||
153 | |||
154 | static void ixp2400_msf_enable_rx(struct ixp2400_msf_parameters *mp) | ||
155 | { | ||
156 | u32 value; | ||
157 | |||
158 | value = ixp2000_reg_read(IXP2000_MSF_RX_CONTROL) & 0x0fffffff; | ||
159 | value |= ixp2400_msf_valid_channels(mp->rx_mode) << 28; | ||
160 | ixp2000_reg_write(IXP2000_MSF_RX_CONTROL, value); | ||
161 | } | ||
162 | |||
163 | static void ixp2400_msf_enable_tx(struct ixp2400_msf_parameters *mp) | ||
164 | { | ||
165 | u32 value; | ||
166 | |||
167 | value = ixp2000_reg_read(IXP2000_MSF_TX_CONTROL) & 0x0fffffff; | ||
168 | value |= ixp2400_msf_valid_channels(mp->tx_mode) << 28; | ||
169 | ixp2000_reg_write(IXP2000_MSF_TX_CONTROL, value); | ||
170 | } | ||
171 | |||
172 | |||
173 | void ixp2400_msf_init(struct ixp2400_msf_parameters *mp) | ||
174 | { | ||
175 | u32 value; | ||
176 | int i; | ||
177 | |||
178 | /* | ||
179 | * Init the RX/TX PLLs based on the passed parameter block. | ||
180 | */ | ||
181 | ixp2400_pll_init(mp); | ||
182 | |||
183 | /* | ||
184 | * Reset MSF. Bit 7 in IXP_RESET_0 resets the MSF. | ||
185 | */ | ||
186 | value = ixp2000_reg_read(IXP2000_RESET0); | ||
187 | ixp2000_reg_write(IXP2000_RESET0, value | 0x80); | ||
188 | ixp2000_reg_write(IXP2000_RESET0, value & ~0x80); | ||
189 | |||
190 | /* | ||
191 | * Initialise the RX section. | ||
192 | */ | ||
193 | ixp2000_reg_write(IXP2000_MSF_RX_MPHY_POLL_LIMIT, mp->rx_poll_ports - 1); | ||
194 | ixp2000_reg_write(IXP2000_MSF_RX_CONTROL, mp->rx_mode); | ||
195 | for (i = 0; i < 4; i++) { | ||
196 | ixp2000_reg_write(IXP2000_MSF_RX_UP_CONTROL_0 + i, | ||
197 | mp->rx_channel_mode[i]); | ||
198 | } | ||
199 | ixp2400_msf_free_rbuf_entries(mp); | ||
200 | ixp2400_msf_enable_rx(mp); | ||
201 | |||
202 | /* | ||
203 | * Initialise the TX section. | ||
204 | */ | ||
205 | ixp2000_reg_write(IXP2000_MSF_TX_MPHY_POLL_LIMIT, mp->tx_poll_ports - 1); | ||
206 | ixp2000_reg_write(IXP2000_MSF_TX_CONTROL, mp->tx_mode); | ||
207 | for (i = 0; i < 4; i++) { | ||
208 | ixp2000_reg_write(IXP2000_MSF_TX_UP_CONTROL_0 + i, | ||
209 | mp->tx_channel_mode[i]); | ||
210 | } | ||
211 | ixp2400_msf_enable_tx(mp); | ||
212 | } | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixp2400-msf.h b/drivers/net/ethernet/xscale/ixp2000/ixp2400-msf.h deleted file mode 100644 index 3ac1af2771da..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixp2400-msf.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
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 | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixp2400_rx.uc b/drivers/net/ethernet/xscale/ixp2000/ixp2400_rx.uc deleted file mode 100644 index 42a73e357afa..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixp2400_rx.uc +++ /dev/null | |||
@@ -1,408 +0,0 @@ | |||
1 | /* | ||
2 | * RX ucode for the Intel IXP2400 in POS-PHY mode. | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * Assumptions made in this code: | ||
12 | * - The IXP2400 MSF is configured for POS-PHY mode, in a mode where | ||
13 | * only one full element list is used. This includes, for example, | ||
14 | * 1x32 SPHY and 1x32 MPHY32, but not 4x8 SPHY or 1x32 MPHY4. (This | ||
15 | * is not an exhaustive list.) | ||
16 | * - The RBUF uses 64-byte mpackets. | ||
17 | * - RX descriptors reside in SRAM, and have the following format: | ||
18 | * struct rx_desc | ||
19 | * { | ||
20 | * // to uengine | ||
21 | * u32 buf_phys_addr; | ||
22 | * u32 buf_length; | ||
23 | * | ||
24 | * // from uengine | ||
25 | * u32 channel; | ||
26 | * u32 pkt_length; | ||
27 | * }; | ||
28 | * - Packet data resides in DRAM. | ||
29 | * - Packet buffer addresses are 8-byte aligned. | ||
30 | * - Scratch ring 0 is rx_pending. | ||
31 | * - Scratch ring 1 is rx_done, and has status condition 'full'. | ||
32 | * - The host triggers rx_done flush and rx_pending refill on seeing INTA. | ||
33 | * - This code is run on all eight threads of the microengine it runs on. | ||
34 | * | ||
35 | * Local memory is used for per-channel RX state. | ||
36 | */ | ||
37 | |||
38 | #define RX_THREAD_FREELIST_0 0x0030 | ||
39 | #define RBUF_ELEMENT_DONE 0x0044 | ||
40 | |||
41 | #define CHANNEL_FLAGS *l$index0[0] | ||
42 | #define CHANNEL_FLAG_RECEIVING 1 | ||
43 | #define PACKET_LENGTH *l$index0[1] | ||
44 | #define PACKET_CHECKSUM *l$index0[2] | ||
45 | #define BUFFER_HANDLE *l$index0[3] | ||
46 | #define BUFFER_START *l$index0[4] | ||
47 | #define BUFFER_LENGTH *l$index0[5] | ||
48 | |||
49 | #define CHANNEL_STATE_SIZE 24 // in bytes | ||
50 | #define CHANNEL_STATE_SHIFT 5 // ceil(log2(state size)) | ||
51 | |||
52 | |||
53 | .sig volatile sig1 | ||
54 | .sig volatile sig2 | ||
55 | .sig volatile sig3 | ||
56 | |||
57 | .sig mpacket_arrived | ||
58 | .reg add_to_rx_freelist | ||
59 | .reg read $rsw0, $rsw1 | ||
60 | .xfer_order $rsw0 $rsw1 | ||
61 | |||
62 | .reg zero | ||
63 | |||
64 | /* | ||
65 | * Initialise add_to_rx_freelist. | ||
66 | */ | ||
67 | .begin | ||
68 | .reg temp | ||
69 | .reg temp2 | ||
70 | |||
71 | immed[add_to_rx_freelist, RX_THREAD_FREELIST_0] | ||
72 | immed_w1[add_to_rx_freelist, (&$rsw0 | (&mpacket_arrived << 12))] | ||
73 | |||
74 | local_csr_rd[ACTIVE_CTX_STS] | ||
75 | immed[temp, 0] | ||
76 | alu[temp2, temp, and, 0x1f] | ||
77 | alu_shf[add_to_rx_freelist, add_to_rx_freelist, or, temp2, <<20] | ||
78 | alu[temp2, temp, and, 0x80] | ||
79 | alu_shf[add_to_rx_freelist, add_to_rx_freelist, or, temp2, <<18] | ||
80 | .end | ||
81 | |||
82 | immed[zero, 0] | ||
83 | |||
84 | /* | ||
85 | * Skip context 0 initialisation? | ||
86 | */ | ||
87 | .begin | ||
88 | br!=ctx[0, mpacket_receive_loop#] | ||
89 | .end | ||
90 | |||
91 | /* | ||
92 | * Initialise local memory. | ||
93 | */ | ||
94 | .begin | ||
95 | .reg addr | ||
96 | .reg temp | ||
97 | |||
98 | immed[temp, 0] | ||
99 | init_local_mem_loop#: | ||
100 | alu_shf[addr, --, b, temp, <<CHANNEL_STATE_SHIFT] | ||
101 | local_csr_wr[ACTIVE_LM_ADDR_0, addr] | ||
102 | nop | ||
103 | nop | ||
104 | nop | ||
105 | |||
106 | immed[CHANNEL_FLAGS, 0] | ||
107 | |||
108 | alu[temp, temp, +, 1] | ||
109 | alu[--, temp, and, 0x20] | ||
110 | beq[init_local_mem_loop#] | ||
111 | .end | ||
112 | |||
113 | /* | ||
114 | * Initialise signal pipeline. | ||
115 | */ | ||
116 | .begin | ||
117 | local_csr_wr[SAME_ME_SIGNAL, (&sig1 << 3)] | ||
118 | .set_sig sig1 | ||
119 | |||
120 | local_csr_wr[SAME_ME_SIGNAL, (&sig2 << 3)] | ||
121 | .set_sig sig2 | ||
122 | |||
123 | local_csr_wr[SAME_ME_SIGNAL, (&sig3 << 3)] | ||
124 | .set_sig sig3 | ||
125 | .end | ||
126 | |||
127 | mpacket_receive_loop#: | ||
128 | /* | ||
129 | * Synchronise and wait for mpacket. | ||
130 | */ | ||
131 | .begin | ||
132 | ctx_arb[sig1] | ||
133 | local_csr_wr[SAME_ME_SIGNAL, (0x80 | (&sig1 << 3))] | ||
134 | |||
135 | msf[fast_wr, --, add_to_rx_freelist, 0] | ||
136 | .set_sig mpacket_arrived | ||
137 | ctx_arb[mpacket_arrived] | ||
138 | .set $rsw0 $rsw1 | ||
139 | .end | ||
140 | |||
141 | /* | ||
142 | * We halt if we see {inbparerr,parerr,null,soperror}. | ||
143 | */ | ||
144 | .begin | ||
145 | alu_shf[--, 0x1b, and, $rsw0, >>8] | ||
146 | bne[abort_rswerr#] | ||
147 | .end | ||
148 | |||
149 | /* | ||
150 | * Point local memory pointer to this channel's state area. | ||
151 | */ | ||
152 | .begin | ||
153 | .reg chanaddr | ||
154 | |||
155 | alu[chanaddr, $rsw0, and, 0x1f] | ||
156 | alu_shf[chanaddr, --, b, chanaddr, <<CHANNEL_STATE_SHIFT] | ||
157 | local_csr_wr[ACTIVE_LM_ADDR_0, chanaddr] | ||
158 | nop | ||
159 | nop | ||
160 | nop | ||
161 | .end | ||
162 | |||
163 | /* | ||
164 | * Check whether we received a SOP mpacket while we were already | ||
165 | * working on a packet, or a non-SOP mpacket while there was no | ||
166 | * packet pending. (SOP == RECEIVING -> abort) If everything's | ||
167 | * okay, update the RECEIVING flag to reflect our new state. | ||
168 | */ | ||
169 | .begin | ||
170 | .reg temp | ||
171 | .reg eop | ||
172 | |||
173 | #if CHANNEL_FLAG_RECEIVING != 1 | ||
174 | #error CHANNEL_FLAG_RECEIVING is not 1 | ||
175 | #endif | ||
176 | |||
177 | alu_shf[temp, 1, and, $rsw0, >>15] | ||
178 | alu[temp, temp, xor, CHANNEL_FLAGS] | ||
179 | alu[--, temp, and, CHANNEL_FLAG_RECEIVING] | ||
180 | beq[abort_proterr#] | ||
181 | |||
182 | alu_shf[eop, 1, and, $rsw0, >>14] | ||
183 | alu[CHANNEL_FLAGS, temp, xor, eop] | ||
184 | .end | ||
185 | |||
186 | /* | ||
187 | * Copy the mpacket into the right spot, and in case of EOP, | ||
188 | * write back the descriptor and pass the packet on. | ||
189 | */ | ||
190 | .begin | ||
191 | .reg buffer_offset | ||
192 | .reg _packet_length | ||
193 | .reg _packet_checksum | ||
194 | .reg _buffer_handle | ||
195 | .reg _buffer_start | ||
196 | .reg _buffer_length | ||
197 | |||
198 | /* | ||
199 | * Determine buffer_offset, _packet_length and | ||
200 | * _packet_checksum. | ||
201 | */ | ||
202 | .begin | ||
203 | .reg temp | ||
204 | |||
205 | alu[--, 1, and, $rsw0, >>15] | ||
206 | beq[not_sop#] | ||
207 | |||
208 | immed[PACKET_LENGTH, 0] | ||
209 | immed[PACKET_CHECKSUM, 0] | ||
210 | |||
211 | not_sop#: | ||
212 | alu[buffer_offset, --, b, PACKET_LENGTH] | ||
213 | alu_shf[temp, 0xff, and, $rsw0, >>16] | ||
214 | alu[_packet_length, buffer_offset, +, temp] | ||
215 | alu[PACKET_LENGTH, --, b, _packet_length] | ||
216 | |||
217 | immed[temp, 0xffff] | ||
218 | alu[temp, $rsw1, and, temp] | ||
219 | alu[_packet_checksum, PACKET_CHECKSUM, +, temp] | ||
220 | alu[PACKET_CHECKSUM, --, b, _packet_checksum] | ||
221 | .end | ||
222 | |||
223 | /* | ||
224 | * Allocate buffer in case of SOP. | ||
225 | */ | ||
226 | .begin | ||
227 | .reg temp | ||
228 | |||
229 | alu[temp, 1, and, $rsw0, >>15] | ||
230 | beq[skip_buffer_alloc#] | ||
231 | |||
232 | .begin | ||
233 | .sig zzz | ||
234 | .reg read $stemp $stemp2 | ||
235 | .xfer_order $stemp $stemp2 | ||
236 | |||
237 | rx_nobufs#: | ||
238 | scratch[get, $stemp, zero, 0, 1], ctx_swap[zzz] | ||
239 | alu[_buffer_handle, --, b, $stemp] | ||
240 | beq[rx_nobufs#] | ||
241 | |||
242 | sram[read, $stemp, _buffer_handle, 0, 2], | ||
243 | ctx_swap[zzz] | ||
244 | alu[_buffer_start, --, b, $stemp] | ||
245 | alu[_buffer_length, --, b, $stemp2] | ||
246 | .end | ||
247 | |||
248 | skip_buffer_alloc#: | ||
249 | .end | ||
250 | |||
251 | /* | ||
252 | * Resynchronise. | ||
253 | */ | ||
254 | .begin | ||
255 | ctx_arb[sig2] | ||
256 | local_csr_wr[SAME_ME_SIGNAL, (0x80 | (&sig2 << 3))] | ||
257 | .end | ||
258 | |||
259 | /* | ||
260 | * Synchronise buffer state. | ||
261 | */ | ||
262 | .begin | ||
263 | .reg temp | ||
264 | |||
265 | alu[temp, 1, and, $rsw0, >>15] | ||
266 | beq[copy_from_local_mem#] | ||
267 | |||
268 | alu[BUFFER_HANDLE, --, b, _buffer_handle] | ||
269 | alu[BUFFER_START, --, b, _buffer_start] | ||
270 | alu[BUFFER_LENGTH, --, b, _buffer_length] | ||
271 | br[sync_state_done#] | ||
272 | |||
273 | copy_from_local_mem#: | ||
274 | alu[_buffer_handle, --, b, BUFFER_HANDLE] | ||
275 | alu[_buffer_start, --, b, BUFFER_START] | ||
276 | alu[_buffer_length, --, b, BUFFER_LENGTH] | ||
277 | |||
278 | sync_state_done#: | ||
279 | .end | ||
280 | |||
281 | #if 0 | ||
282 | /* | ||
283 | * Debug buffer state management. | ||
284 | */ | ||
285 | .begin | ||
286 | .reg temp | ||
287 | |||
288 | alu[temp, 1, and, $rsw0, >>14] | ||
289 | beq[no_poison#] | ||
290 | immed[BUFFER_HANDLE, 0xdead] | ||
291 | immed[BUFFER_START, 0xdead] | ||
292 | immed[BUFFER_LENGTH, 0xdead] | ||
293 | no_poison#: | ||
294 | |||
295 | immed[temp, 0xdead] | ||
296 | alu[--, _buffer_handle, -, temp] | ||
297 | beq[state_corrupted#] | ||
298 | alu[--, _buffer_start, -, temp] | ||
299 | beq[state_corrupted#] | ||
300 | alu[--, _buffer_length, -, temp] | ||
301 | beq[state_corrupted#] | ||
302 | .end | ||
303 | #endif | ||
304 | |||
305 | /* | ||
306 | * Check buffer length. | ||
307 | */ | ||
308 | .begin | ||
309 | alu[--, _buffer_length, -, _packet_length] | ||
310 | blo[buffer_overflow#] | ||
311 | .end | ||
312 | |||
313 | /* | ||
314 | * Copy the mpacket and give back the RBUF element. | ||
315 | */ | ||
316 | .begin | ||
317 | .reg element | ||
318 | .reg xfer_size | ||
319 | .reg temp | ||
320 | .sig copy_sig | ||
321 | |||
322 | alu_shf[element, 0x7f, and, $rsw0, >>24] | ||
323 | alu_shf[xfer_size, 0xff, and, $rsw0, >>16] | ||
324 | |||
325 | alu[xfer_size, xfer_size, -, 1] | ||
326 | alu_shf[xfer_size, 0x10, or, xfer_size, >>3] | ||
327 | alu_shf[temp, 0x10, or, xfer_size, <<21] | ||
328 | alu_shf[temp, temp, or, element, <<11] | ||
329 | alu_shf[--, temp, or, 1, <<18] | ||
330 | |||
331 | dram[rbuf_rd, --, _buffer_start, buffer_offset, max_8], | ||
332 | indirect_ref, sig_done[copy_sig] | ||
333 | ctx_arb[copy_sig] | ||
334 | |||
335 | alu[temp, RBUF_ELEMENT_DONE, or, element, <<16] | ||
336 | msf[fast_wr, --, temp, 0] | ||
337 | .end | ||
338 | |||
339 | /* | ||
340 | * If EOP, write back the packet descriptor. | ||
341 | */ | ||
342 | .begin | ||
343 | .reg write $stemp $stemp2 | ||
344 | .xfer_order $stemp $stemp2 | ||
345 | .sig zzz | ||
346 | |||
347 | alu_shf[--, 1, and, $rsw0, >>14] | ||
348 | beq[no_writeback#] | ||
349 | |||
350 | alu[$stemp, $rsw0, and, 0x1f] | ||
351 | alu[$stemp2, --, b, _packet_length] | ||
352 | sram[write, $stemp, _buffer_handle, 8, 2], ctx_swap[zzz] | ||
353 | |||
354 | no_writeback#: | ||
355 | .end | ||
356 | |||
357 | /* | ||
358 | * Resynchronise. | ||
359 | */ | ||
360 | .begin | ||
361 | ctx_arb[sig3] | ||
362 | local_csr_wr[SAME_ME_SIGNAL, (0x80 | (&sig3 << 3))] | ||
363 | .end | ||
364 | |||
365 | /* | ||
366 | * If EOP, put the buffer back onto the scratch ring. | ||
367 | */ | ||
368 | .begin | ||
369 | .reg write $stemp | ||
370 | .sig zzz | ||
371 | |||
372 | br_inp_state[SCR_Ring1_Status, rx_done_ring_overflow#] | ||
373 | |||
374 | alu_shf[--, 1, and, $rsw0, >>14] | ||
375 | beq[mpacket_receive_loop#] | ||
376 | |||
377 | alu[--, 1, and, $rsw0, >>10] | ||
378 | bne[rxerr#] | ||
379 | |||
380 | alu[$stemp, --, b, _buffer_handle] | ||
381 | scratch[put, $stemp, zero, 4, 1], ctx_swap[zzz] | ||
382 | cap[fast_wr, 0, XSCALE_INT_A] | ||
383 | br[mpacket_receive_loop#] | ||
384 | |||
385 | rxerr#: | ||
386 | alu[$stemp, --, b, _buffer_handle] | ||
387 | scratch[put, $stemp, zero, 0, 1], ctx_swap[zzz] | ||
388 | br[mpacket_receive_loop#] | ||
389 | .end | ||
390 | .end | ||
391 | |||
392 | |||
393 | abort_rswerr#: | ||
394 | halt | ||
395 | |||
396 | abort_proterr#: | ||
397 | halt | ||
398 | |||
399 | state_corrupted#: | ||
400 | halt | ||
401 | |||
402 | buffer_overflow#: | ||
403 | halt | ||
404 | |||
405 | rx_done_ring_overflow#: | ||
406 | halt | ||
407 | |||
408 | |||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixp2400_rx.ucode b/drivers/net/ethernet/xscale/ixp2000/ixp2400_rx.ucode deleted file mode 100644 index e8aee2f81aad..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixp2400_rx.ucode +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | static struct ixp2000_uengine_code ixp2400_rx = | ||
2 | { | ||
3 | .cpu_model_bitmask = 0x000003fe, | ||
4 | .cpu_min_revision = 0, | ||
5 | .cpu_max_revision = 255, | ||
6 | |||
7 | .uengine_parameters = IXP2000_UENGINE_8_CONTEXTS | | ||
8 | IXP2000_UENGINE_PRN_UPDATE_EVERY | | ||
9 | IXP2000_UENGINE_NN_FROM_PREVIOUS | | ||
10 | IXP2000_UENGINE_ASSERT_EMPTY_AT_0 | | ||
11 | IXP2000_UENGINE_LM_ADDR1_PER_CONTEXT | | ||
12 | IXP2000_UENGINE_LM_ADDR0_PER_CONTEXT, | ||
13 | |||
14 | .initial_reg_values = (struct ixp2000_reg_value []) { | ||
15 | { -1, -1 } | ||
16 | }, | ||
17 | |||
18 | .num_insns = 109, | ||
19 | .insns = (u8 []) { | ||
20 | 0xf0, 0x00, 0x0c, 0xc0, 0x05, | ||
21 | 0xf4, 0x44, 0x0c, 0x00, 0x05, | ||
22 | 0xfc, 0x04, 0x4c, 0x00, 0x00, | ||
23 | 0xf0, 0x00, 0x00, 0x3b, 0x00, | ||
24 | 0xb4, 0x40, 0xf0, 0x3b, 0x1f, | ||
25 | 0x8a, 0xc0, 0x50, 0x3e, 0x05, | ||
26 | 0xb4, 0x40, 0xf0, 0x3b, 0x80, | ||
27 | 0x9a, 0xe0, 0x00, 0x3e, 0x05, | ||
28 | 0xf0, 0x00, 0x00, 0x07, 0x00, | ||
29 | 0xd8, 0x05, 0xc0, 0x00, 0x11, | ||
30 | 0xf0, 0x00, 0x00, 0x0f, 0x00, | ||
31 | 0x91, 0xb0, 0x20, 0x0e, 0x00, | ||
32 | 0xfc, 0x06, 0x60, 0x0b, 0x00, | ||
33 | 0xf0, 0x00, 0x0c, 0x03, 0x00, | ||
34 | 0xf0, 0x00, 0x0c, 0x03, 0x00, | ||
35 | 0xf0, 0x00, 0x0c, 0x03, 0x00, | ||
36 | 0xf0, 0x00, 0x0c, 0x02, 0x00, | ||
37 | 0xb0, 0xc0, 0x30, 0x0f, 0x01, | ||
38 | 0xa4, 0x70, 0x00, 0x0f, 0x20, | ||
39 | 0xd8, 0x02, 0xc0, 0x01, 0x00, | ||
40 | 0xfc, 0x10, 0xac, 0x23, 0x08, | ||
41 | 0xfc, 0x10, 0xac, 0x43, 0x10, | ||
42 | 0xfc, 0x10, 0xac, 0x63, 0x18, | ||
43 | 0xe0, 0x00, 0x00, 0x00, 0x02, | ||
44 | 0xfc, 0x10, 0xae, 0x23, 0x88, | ||
45 | 0x3d, 0x00, 0x04, 0x03, 0x20, | ||
46 | 0xe0, 0x00, 0x00, 0x00, 0x10, | ||
47 | 0x84, 0x82, 0x02, 0x01, 0x3b, | ||
48 | 0xd8, 0x1a, 0x00, 0x01, 0x01, | ||
49 | 0xb4, 0x00, 0x8c, 0x7d, 0x80, | ||
50 | 0x91, 0xb0, 0x80, 0x22, 0x00, | ||
51 | 0xfc, 0x06, 0x60, 0x23, 0x00, | ||
52 | 0xf0, 0x00, 0x0c, 0x03, 0x00, | ||
53 | 0xf0, 0x00, 0x0c, 0x03, 0x00, | ||
54 | 0xf0, 0x00, 0x0c, 0x03, 0x00, | ||
55 | 0x94, 0xf0, 0x92, 0x01, 0x21, | ||
56 | 0xac, 0x40, 0x60, 0x26, 0x00, | ||
57 | 0xa4, 0x30, 0x0c, 0x04, 0x06, | ||
58 | 0xd8, 0x1a, 0x40, 0x01, 0x00, | ||
59 | 0x94, 0xe0, 0xa2, 0x01, 0x21, | ||
60 | 0xac, 0x20, 0x00, 0x28, 0x06, | ||
61 | 0x84, 0xf2, 0x02, 0x01, 0x21, | ||
62 | 0xd8, 0x0b, 0x40, 0x01, 0x00, | ||
63 | 0xf0, 0x00, 0x0c, 0x02, 0x01, | ||
64 | 0xf0, 0x00, 0x0c, 0x02, 0x02, | ||
65 | 0xa0, 0x00, 0x08, 0x04, 0x00, | ||
66 | 0x95, 0x00, 0xc6, 0x01, 0xff, | ||
67 | 0xa0, 0x80, 0x10, 0x30, 0x00, | ||
68 | 0xa0, 0x60, 0x1c, 0x00, 0x01, | ||
69 | 0xf0, 0x0f, 0xf0, 0x33, 0xff, | ||
70 | 0xb4, 0x00, 0xc0, 0x31, 0x81, | ||
71 | 0xb0, 0x80, 0xb0, 0x32, 0x02, | ||
72 | 0xa0, 0x20, 0x20, 0x2c, 0x00, | ||
73 | 0x94, 0xf0, 0xd2, 0x01, 0x21, | ||
74 | 0xd8, 0x0f, 0x40, 0x01, 0x00, | ||
75 | 0x19, 0x40, 0x10, 0x04, 0x20, | ||
76 | 0xa0, 0x00, 0x26, 0x04, 0x00, | ||
77 | 0xd8, 0x0d, 0xc0, 0x01, 0x00, | ||
78 | 0x00, 0x42, 0x10, 0x80, 0x02, | ||
79 | 0xb0, 0x00, 0x46, 0x04, 0x00, | ||
80 | 0xb0, 0x00, 0x56, 0x08, 0x00, | ||
81 | 0xe0, 0x00, 0x00, 0x00, 0x04, | ||
82 | 0xfc, 0x10, 0xae, 0x43, 0x90, | ||
83 | 0x84, 0xf0, 0x32, 0x01, 0x21, | ||
84 | 0xd8, 0x11, 0x40, 0x01, 0x00, | ||
85 | 0xa0, 0x60, 0x3c, 0x00, 0x02, | ||
86 | 0xa0, 0x20, 0x40, 0x10, 0x00, | ||
87 | 0xa0, 0x20, 0x50, 0x14, 0x00, | ||
88 | 0xd8, 0x12, 0x00, 0x00, 0x18, | ||
89 | 0xa0, 0x00, 0x28, 0x0c, 0x00, | ||
90 | 0xb0, 0x00, 0x48, 0x10, 0x00, | ||
91 | 0xb0, 0x00, 0x58, 0x14, 0x00, | ||
92 | 0xaa, 0xf0, 0x00, 0x14, 0x01, | ||
93 | 0xd8, 0x1a, 0xc0, 0x01, 0x05, | ||
94 | 0x85, 0x80, 0x42, 0x01, 0xff, | ||
95 | 0x95, 0x00, 0x66, 0x01, 0xff, | ||
96 | 0xba, 0xc0, 0x60, 0x1b, 0x01, | ||
97 | 0x9a, 0x30, 0x60, 0x19, 0x30, | ||
98 | 0x9a, 0xb0, 0x70, 0x1a, 0x30, | ||
99 | 0x9b, 0x50, 0x78, 0x1e, 0x04, | ||
100 | 0x8a, 0xe2, 0x08, 0x1e, 0x21, | ||
101 | 0x6a, 0x4e, 0x00, 0x13, 0x00, | ||
102 | 0xe0, 0x00, 0x00, 0x00, 0x30, | ||
103 | 0x9b, 0x00, 0x7a, 0x92, 0x04, | ||
104 | 0x3d, 0x00, 0x04, 0x1f, 0x20, | ||
105 | 0x84, 0xe2, 0x02, 0x01, 0x21, | ||
106 | 0xd8, 0x16, 0x80, 0x01, 0x00, | ||
107 | 0xa4, 0x18, 0x0c, 0x7d, 0x80, | ||
108 | 0xa0, 0x58, 0x1c, 0x00, 0x01, | ||
109 | 0x01, 0x42, 0x00, 0xa0, 0x02, | ||
110 | 0xe0, 0x00, 0x00, 0x00, 0x08, | ||
111 | 0xfc, 0x10, 0xae, 0x63, 0x98, | ||
112 | 0xd8, 0x1b, 0x00, 0xc2, 0x14, | ||
113 | 0x84, 0xe2, 0x02, 0x01, 0x21, | ||
114 | 0xd8, 0x05, 0xc0, 0x01, 0x00, | ||
115 | 0x84, 0xa2, 0x02, 0x01, 0x21, | ||
116 | 0xd8, 0x19, 0x40, 0x01, 0x01, | ||
117 | 0xa0, 0x58, 0x0c, 0x00, 0x02, | ||
118 | 0x1a, 0x40, 0x00, 0x04, 0x24, | ||
119 | 0x33, 0x00, 0x01, 0x2f, 0x20, | ||
120 | 0xd8, 0x05, 0xc0, 0x00, 0x18, | ||
121 | 0xa0, 0x58, 0x0c, 0x00, 0x02, | ||
122 | 0x1a, 0x40, 0x00, 0x04, 0x20, | ||
123 | 0xd8, 0x05, 0xc0, 0x00, 0x18, | ||
124 | 0xe0, 0x00, 0x02, 0x00, 0x00, | ||
125 | 0xe0, 0x00, 0x02, 0x00, 0x00, | ||
126 | 0xe0, 0x00, 0x02, 0x00, 0x00, | ||
127 | 0xe0, 0x00, 0x02, 0x00, 0x00, | ||
128 | 0xe0, 0x00, 0x02, 0x00, 0x00, | ||
129 | } | ||
130 | }; | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixp2400_tx.uc b/drivers/net/ethernet/xscale/ixp2000/ixp2400_tx.uc deleted file mode 100644 index d090d1884fb7..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixp2400_tx.uc +++ /dev/null | |||
@@ -1,272 +0,0 @@ | |||
1 | /* | ||
2 | * TX ucode for the Intel IXP2400 in POS-PHY mode. | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * Assumptions made in this code: | ||
12 | * - The IXP2400 MSF is configured for POS-PHY mode, in a mode where | ||
13 | * only one TBUF partition is used. This includes, for example, | ||
14 | * 1x32 SPHY and 1x32 MPHY32, but not 4x8 SPHY or 1x32 MPHY4. (This | ||
15 | * is not an exhaustive list.) | ||
16 | * - The TBUF uses 64-byte mpackets. | ||
17 | * - TX descriptors reside in SRAM, and have the following format: | ||
18 | * struct tx_desc | ||
19 | * { | ||
20 | * // to uengine | ||
21 | * u32 buf_phys_addr; | ||
22 | * u32 pkt_length; | ||
23 | * u32 channel; | ||
24 | * }; | ||
25 | * - Packet data resides in DRAM. | ||
26 | * - Packet buffer addresses are 8-byte aligned. | ||
27 | * - Scratch ring 2 is tx_pending. | ||
28 | * - Scratch ring 3 is tx_done, and has status condition 'full'. | ||
29 | * - This code is run on all eight threads of the microengine it runs on. | ||
30 | */ | ||
31 | |||
32 | #define TX_SEQUENCE_0 0x0060 | ||
33 | #define TBUF_CTRL 0x1800 | ||
34 | |||
35 | #define PARTITION_SIZE 128 | ||
36 | #define PARTITION_THRESH 96 | ||
37 | |||
38 | |||
39 | .sig volatile sig1 | ||
40 | .sig volatile sig2 | ||
41 | .sig volatile sig3 | ||
42 | |||
43 | .reg @old_tx_seq_0 | ||
44 | .reg @mpkts_in_flight | ||
45 | .reg @next_tbuf_mpacket | ||
46 | |||
47 | .reg @buffer_handle | ||
48 | .reg @buffer_start | ||
49 | .reg @packet_length | ||
50 | .reg @channel | ||
51 | .reg @packet_offset | ||
52 | |||
53 | .reg zero | ||
54 | |||
55 | immed[zero, 0] | ||
56 | |||
57 | /* | ||
58 | * Skip context 0 initialisation? | ||
59 | */ | ||
60 | .begin | ||
61 | br!=ctx[0, mpacket_tx_loop#] | ||
62 | .end | ||
63 | |||
64 | /* | ||
65 | * Wait until all pending TBUF elements have been transmitted. | ||
66 | */ | ||
67 | .begin | ||
68 | .reg read $tx | ||
69 | .sig zzz | ||
70 | |||
71 | loop_empty#: | ||
72 | msf[read, $tx, zero, TX_SEQUENCE_0, 1], ctx_swap[zzz] | ||
73 | alu_shf[--, --, b, $tx, >>31] | ||
74 | beq[loop_empty#] | ||
75 | |||
76 | alu[@old_tx_seq_0, --, b, $tx] | ||
77 | .end | ||
78 | |||
79 | immed[@mpkts_in_flight, 0] | ||
80 | alu[@next_tbuf_mpacket, @old_tx_seq_0, and, (PARTITION_SIZE - 1)] | ||
81 | |||
82 | immed[@buffer_handle, 0] | ||
83 | |||
84 | /* | ||
85 | * Initialise signal pipeline. | ||
86 | */ | ||
87 | .begin | ||
88 | local_csr_wr[SAME_ME_SIGNAL, (&sig1 << 3)] | ||
89 | .set_sig sig1 | ||
90 | |||
91 | local_csr_wr[SAME_ME_SIGNAL, (&sig2 << 3)] | ||
92 | .set_sig sig2 | ||
93 | |||
94 | local_csr_wr[SAME_ME_SIGNAL, (&sig3 << 3)] | ||
95 | .set_sig sig3 | ||
96 | .end | ||
97 | |||
98 | mpacket_tx_loop#: | ||
99 | .begin | ||
100 | .reg tbuf_element_index | ||
101 | .reg buffer_handle | ||
102 | .reg sop_eop | ||
103 | .reg packet_data | ||
104 | .reg channel | ||
105 | .reg mpacket_size | ||
106 | |||
107 | /* | ||
108 | * If there is no packet currently being transmitted, | ||
109 | * dequeue the next TX descriptor, and fetch the buffer | ||
110 | * address, packet length and destination channel number. | ||
111 | */ | ||
112 | .begin | ||
113 | .reg read $stemp $stemp2 $stemp3 | ||
114 | .xfer_order $stemp $stemp2 $stemp3 | ||
115 | .sig zzz | ||
116 | |||
117 | ctx_arb[sig1] | ||
118 | |||
119 | alu[--, --, b, @buffer_handle] | ||
120 | bne[already_got_packet#] | ||
121 | |||
122 | tx_nobufs#: | ||
123 | scratch[get, $stemp, zero, 8, 1], ctx_swap[zzz] | ||
124 | alu[@buffer_handle, --, b, $stemp] | ||
125 | beq[tx_nobufs#] | ||
126 | |||
127 | sram[read, $stemp, $stemp, 0, 3], ctx_swap[zzz] | ||
128 | alu[@buffer_start, --, b, $stemp] | ||
129 | alu[@packet_length, --, b, $stemp2] | ||
130 | beq[zero_byte_packet#] | ||
131 | alu[@channel, --, b, $stemp3] | ||
132 | immed[@packet_offset, 0] | ||
133 | |||
134 | already_got_packet#: | ||
135 | local_csr_wr[SAME_ME_SIGNAL, (0x80 | (&sig1 << 3))] | ||
136 | .end | ||
137 | |||
138 | /* | ||
139 | * Determine tbuf element index, SOP/EOP flags, mpacket | ||
140 | * offset and mpacket size and cache buffer_handle and | ||
141 | * channel number. | ||
142 | */ | ||
143 | .begin | ||
144 | alu[tbuf_element_index, --, b, @next_tbuf_mpacket] | ||
145 | alu[@next_tbuf_mpacket, @next_tbuf_mpacket, +, 1] | ||
146 | alu[@next_tbuf_mpacket, @next_tbuf_mpacket, and, | ||
147 | (PARTITION_SIZE - 1)] | ||
148 | |||
149 | alu[buffer_handle, --, b, @buffer_handle] | ||
150 | immed[@buffer_handle, 0] | ||
151 | |||
152 | immed[sop_eop, 1] | ||
153 | |||
154 | alu[packet_data, --, b, @packet_offset] | ||
155 | bne[no_sop#] | ||
156 | alu[sop_eop, sop_eop, or, 2] | ||
157 | no_sop#: | ||
158 | alu[packet_data, packet_data, +, @buffer_start] | ||
159 | |||
160 | alu[channel, --, b, @channel] | ||
161 | |||
162 | alu[mpacket_size, @packet_length, -, @packet_offset] | ||
163 | alu[--, 64, -, mpacket_size] | ||
164 | bhs[eop#] | ||
165 | alu[@buffer_handle, --, b, buffer_handle] | ||
166 | immed[mpacket_size, 64] | ||
167 | alu[sop_eop, sop_eop, and, 2] | ||
168 | eop#: | ||
169 | |||
170 | alu[@packet_offset, @packet_offset, +, mpacket_size] | ||
171 | .end | ||
172 | |||
173 | /* | ||
174 | * Wait until there's enough space in the TBUF. | ||
175 | */ | ||
176 | .begin | ||
177 | .reg read $tx | ||
178 | .reg temp | ||
179 | .sig zzz | ||
180 | |||
181 | ctx_arb[sig2] | ||
182 | |||
183 | br[test_space#] | ||
184 | |||
185 | loop_space#: | ||
186 | msf[read, $tx, zero, TX_SEQUENCE_0, 1], ctx_swap[zzz] | ||
187 | |||
188 | alu[temp, $tx, -, @old_tx_seq_0] | ||
189 | alu[temp, temp, and, 0xff] | ||
190 | alu[@mpkts_in_flight, @mpkts_in_flight, -, temp] | ||
191 | |||
192 | alu[@old_tx_seq_0, --, b, $tx] | ||
193 | |||
194 | test_space#: | ||
195 | alu[--, PARTITION_THRESH, -, @mpkts_in_flight] | ||
196 | blo[loop_space#] | ||
197 | |||
198 | alu[@mpkts_in_flight, @mpkts_in_flight, +, 1] | ||
199 | |||
200 | local_csr_wr[SAME_ME_SIGNAL, (0x80 | (&sig2 << 3))] | ||
201 | .end | ||
202 | |||
203 | /* | ||
204 | * Copy the packet data to the TBUF. | ||
205 | */ | ||
206 | .begin | ||
207 | .reg temp | ||
208 | .sig copy_sig | ||
209 | |||
210 | alu[temp, mpacket_size, -, 1] | ||
211 | alu_shf[temp, 0x10, or, temp, >>3] | ||
212 | alu_shf[temp, 0x10, or, temp, <<21] | ||
213 | alu_shf[temp, temp, or, tbuf_element_index, <<11] | ||
214 | alu_shf[--, temp, or, 1, <<18] | ||
215 | |||
216 | dram[tbuf_wr, --, packet_data, 0, max_8], | ||
217 | indirect_ref, sig_done[copy_sig] | ||
218 | ctx_arb[copy_sig] | ||
219 | .end | ||
220 | |||
221 | /* | ||
222 | * Mark TBUF element as ready-to-be-transmitted. | ||
223 | */ | ||
224 | .begin | ||
225 | .reg write $tsw $tsw2 | ||
226 | .xfer_order $tsw $tsw2 | ||
227 | .reg temp | ||
228 | .sig zzz | ||
229 | |||
230 | alu_shf[temp, channel, or, mpacket_size, <<24] | ||
231 | alu_shf[$tsw, temp, or, sop_eop, <<8] | ||
232 | immed[$tsw2, 0] | ||
233 | |||
234 | immed[temp, TBUF_CTRL] | ||
235 | alu_shf[temp, temp, or, tbuf_element_index, <<3] | ||
236 | msf[write, $tsw, temp, 0, 2], ctx_swap[zzz] | ||
237 | .end | ||
238 | |||
239 | /* | ||
240 | * Resynchronise. | ||
241 | */ | ||
242 | .begin | ||
243 | ctx_arb[sig3] | ||
244 | local_csr_wr[SAME_ME_SIGNAL, (0x80 | (&sig3 << 3))] | ||
245 | .end | ||
246 | |||
247 | /* | ||
248 | * If this was an EOP mpacket, recycle the TX buffer | ||
249 | * and signal the host. | ||
250 | */ | ||
251 | .begin | ||
252 | .reg write $stemp | ||
253 | .sig zzz | ||
254 | |||
255 | alu[--, sop_eop, and, 1] | ||
256 | beq[mpacket_tx_loop#] | ||
257 | |||
258 | tx_done_ring_full#: | ||
259 | br_inp_state[SCR_Ring3_Status, tx_done_ring_full#] | ||
260 | |||
261 | alu[$stemp, --, b, buffer_handle] | ||
262 | scratch[put, $stemp, zero, 12, 1], ctx_swap[zzz] | ||
263 | cap[fast_wr, 0, XSCALE_INT_A] | ||
264 | br[mpacket_tx_loop#] | ||
265 | .end | ||
266 | .end | ||
267 | |||
268 | |||
269 | zero_byte_packet#: | ||
270 | halt | ||
271 | |||
272 | |||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixp2400_tx.ucode b/drivers/net/ethernet/xscale/ixp2000/ixp2400_tx.ucode deleted file mode 100644 index a433e24b0a51..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixp2400_tx.ucode +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | static struct ixp2000_uengine_code ixp2400_tx = | ||
2 | { | ||
3 | .cpu_model_bitmask = 0x000003fe, | ||
4 | .cpu_min_revision = 0, | ||
5 | .cpu_max_revision = 255, | ||
6 | |||
7 | .uengine_parameters = IXP2000_UENGINE_8_CONTEXTS | | ||
8 | IXP2000_UENGINE_PRN_UPDATE_EVERY | | ||
9 | IXP2000_UENGINE_NN_FROM_PREVIOUS | | ||
10 | IXP2000_UENGINE_ASSERT_EMPTY_AT_0 | | ||
11 | IXP2000_UENGINE_LM_ADDR1_PER_CONTEXT | | ||
12 | IXP2000_UENGINE_LM_ADDR0_PER_CONTEXT, | ||
13 | |||
14 | .initial_reg_values = (struct ixp2000_reg_value []) { | ||
15 | { -1, -1 } | ||
16 | }, | ||
17 | |||
18 | .num_insns = 77, | ||
19 | .insns = (u8 []) { | ||
20 | 0xf0, 0x00, 0x00, 0x07, 0x00, | ||
21 | 0xd8, 0x03, 0x00, 0x00, 0x11, | ||
22 | 0x3c, 0x40, 0x00, 0x04, 0xe0, | ||
23 | 0x81, 0xf2, 0x02, 0x01, 0x00, | ||
24 | 0xd8, 0x00, 0x80, 0x01, 0x00, | ||
25 | 0xb0, 0x08, 0x06, 0x00, 0x00, | ||
26 | 0xf0, 0x00, 0x0c, 0x00, 0x80, | ||
27 | 0xb4, 0x49, 0x02, 0x03, 0x7f, | ||
28 | 0xf0, 0x00, 0x02, 0x83, 0x00, | ||
29 | 0xfc, 0x10, 0xac, 0x23, 0x08, | ||
30 | 0xfc, 0x10, 0xac, 0x43, 0x10, | ||
31 | 0xfc, 0x10, 0xac, 0x63, 0x18, | ||
32 | 0xe0, 0x00, 0x00, 0x00, 0x02, | ||
33 | 0xa0, 0x30, 0x02, 0x80, 0x00, | ||
34 | 0xd8, 0x06, 0x00, 0x01, 0x01, | ||
35 | 0x19, 0x40, 0x00, 0x04, 0x28, | ||
36 | 0xb0, 0x0a, 0x06, 0x00, 0x00, | ||
37 | 0xd8, 0x03, 0xc0, 0x01, 0x00, | ||
38 | 0x00, 0x44, 0x00, 0x80, 0x80, | ||
39 | 0xa0, 0x09, 0x06, 0x00, 0x00, | ||
40 | 0xb0, 0x0b, 0x06, 0x04, 0x00, | ||
41 | 0xd8, 0x13, 0x00, 0x01, 0x00, | ||
42 | 0xb0, 0x0c, 0x06, 0x08, 0x00, | ||
43 | 0xf0, 0x00, 0x0c, 0x00, 0xa0, | ||
44 | 0xfc, 0x10, 0xae, 0x23, 0x88, | ||
45 | 0xa0, 0x00, 0x12, 0x40, 0x00, | ||
46 | 0xb0, 0xc9, 0x02, 0x43, 0x01, | ||
47 | 0xb4, 0x49, 0x02, 0x43, 0x7f, | ||
48 | 0xb0, 0x00, 0x22, 0x80, 0x00, | ||
49 | 0xf0, 0x00, 0x02, 0x83, 0x00, | ||
50 | 0xf0, 0x00, 0x0c, 0x04, 0x02, | ||
51 | 0xb0, 0x40, 0x6c, 0x00, 0xa0, | ||
52 | 0xd8, 0x08, 0x80, 0x01, 0x01, | ||
53 | 0xaa, 0x00, 0x2c, 0x08, 0x02, | ||
54 | 0xa0, 0xc0, 0x30, 0x18, 0x90, | ||
55 | 0xa0, 0x00, 0x43, 0x00, 0x00, | ||
56 | 0xba, 0xc0, 0x32, 0xc0, 0xa0, | ||
57 | 0xaa, 0xb0, 0x00, 0x0f, 0x40, | ||
58 | 0xd8, 0x0a, 0x80, 0x01, 0x04, | ||
59 | 0xb0, 0x0a, 0x00, 0x08, 0x00, | ||
60 | 0xf0, 0x00, 0x00, 0x0f, 0x40, | ||
61 | 0xa4, 0x00, 0x2c, 0x08, 0x02, | ||
62 | 0xa0, 0x8a, 0x00, 0x0c, 0xa0, | ||
63 | 0xe0, 0x00, 0x00, 0x00, 0x04, | ||
64 | 0xd8, 0x0c, 0x80, 0x00, 0x18, | ||
65 | 0x3c, 0x40, 0x00, 0x04, 0xe0, | ||
66 | 0xba, 0x80, 0x42, 0x01, 0x80, | ||
67 | 0xb4, 0x40, 0x40, 0x13, 0xff, | ||
68 | 0xaa, 0x88, 0x00, 0x10, 0x80, | ||
69 | 0xb0, 0x08, 0x06, 0x00, 0x00, | ||
70 | 0xaa, 0xf0, 0x0d, 0x80, 0x80, | ||
71 | 0xd8, 0x0b, 0x40, 0x01, 0x05, | ||
72 | 0xa0, 0x88, 0x0c, 0x04, 0x80, | ||
73 | 0xfc, 0x10, 0xae, 0x43, 0x90, | ||
74 | 0xba, 0xc0, 0x50, 0x0f, 0x01, | ||
75 | 0x9a, 0x30, 0x50, 0x15, 0x30, | ||
76 | 0x9a, 0xb0, 0x50, 0x16, 0x30, | ||
77 | 0x9b, 0x50, 0x58, 0x16, 0x01, | ||
78 | 0x8a, 0xe2, 0x08, 0x16, 0x21, | ||
79 | 0x6b, 0x4e, 0x00, 0x83, 0x03, | ||
80 | 0xe0, 0x00, 0x00, 0x00, 0x30, | ||
81 | 0x9a, 0x80, 0x70, 0x0e, 0x04, | ||
82 | 0x8b, 0x88, 0x08, 0x1e, 0x02, | ||
83 | 0xf0, 0x00, 0x0c, 0x01, 0x81, | ||
84 | 0xf0, 0x01, 0x80, 0x1f, 0x00, | ||
85 | 0x9b, 0xd0, 0x78, 0x1e, 0x01, | ||
86 | 0x3d, 0x42, 0x00, 0x1c, 0x20, | ||
87 | 0xe0, 0x00, 0x00, 0x00, 0x08, | ||
88 | 0xfc, 0x10, 0xae, 0x63, 0x98, | ||
89 | 0xa4, 0x30, 0x0c, 0x04, 0x02, | ||
90 | 0xd8, 0x03, 0x00, 0x01, 0x00, | ||
91 | 0xd8, 0x11, 0xc1, 0x42, 0x14, | ||
92 | 0xa0, 0x18, 0x00, 0x08, 0x00, | ||
93 | 0x1a, 0x40, 0x00, 0x04, 0x2c, | ||
94 | 0x33, 0x00, 0x01, 0x2f, 0x20, | ||
95 | 0xd8, 0x03, 0x00, 0x00, 0x18, | ||
96 | 0xe0, 0x00, 0x02, 0x00, 0x00, | ||
97 | } | ||
98 | }; | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixpdev.c b/drivers/net/ethernet/xscale/ixp2000/ixpdev.c deleted file mode 100644 index 45008377c8bf..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixpdev.c +++ /dev/null | |||
@@ -1,437 +0,0 @@ | |||
1 | /* | ||
2 | * IXP2000 MSF network device driver | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/netdevice.h> | ||
15 | #include <linux/etherdevice.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/moduleparam.h> | ||
19 | #include <linux/gfp.h> | ||
20 | #include <asm/hardware/uengine.h> | ||
21 | #include <asm/io.h> | ||
22 | #include "ixp2400_rx.ucode" | ||
23 | #include "ixp2400_tx.ucode" | ||
24 | #include "ixpdev_priv.h" | ||
25 | #include "ixpdev.h" | ||
26 | #include "pm3386.h" | ||
27 | |||
28 | #define DRV_MODULE_VERSION "0.2" | ||
29 | |||
30 | static int nds_count; | ||
31 | static struct net_device **nds; | ||
32 | static int nds_open; | ||
33 | static void (*set_port_admin_status)(int port, int up); | ||
34 | |||
35 | static struct ixpdev_rx_desc * const rx_desc = | ||
36 | (struct ixpdev_rx_desc *)(IXP2000_SRAM0_VIRT_BASE + RX_BUF_DESC_BASE); | ||
37 | static struct ixpdev_tx_desc * const tx_desc = | ||
38 | (struct ixpdev_tx_desc *)(IXP2000_SRAM0_VIRT_BASE + TX_BUF_DESC_BASE); | ||
39 | static int tx_pointer; | ||
40 | |||
41 | |||
42 | static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev) | ||
43 | { | ||
44 | struct ixpdev_priv *ip = netdev_priv(dev); | ||
45 | struct ixpdev_tx_desc *desc; | ||
46 | int entry; | ||
47 | unsigned long flags; | ||
48 | |||
49 | if (unlikely(skb->len > PAGE_SIZE)) { | ||
50 | /* @@@ Count drops. */ | ||
51 | dev_kfree_skb(skb); | ||
52 | return NETDEV_TX_OK; | ||
53 | } | ||
54 | |||
55 | entry = tx_pointer; | ||
56 | tx_pointer = (tx_pointer + 1) % TX_BUF_COUNT; | ||
57 | |||
58 | desc = tx_desc + entry; | ||
59 | desc->pkt_length = skb->len; | ||
60 | desc->channel = ip->channel; | ||
61 | |||
62 | skb_copy_and_csum_dev(skb, phys_to_virt(desc->buf_addr)); | ||
63 | dev_kfree_skb(skb); | ||
64 | |||
65 | ixp2000_reg_write(RING_TX_PENDING, | ||
66 | TX_BUF_DESC_BASE + (entry * sizeof(struct ixpdev_tx_desc))); | ||
67 | |||
68 | local_irq_save(flags); | ||
69 | ip->tx_queue_entries++; | ||
70 | if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) | ||
71 | netif_stop_queue(dev); | ||
72 | local_irq_restore(flags); | ||
73 | |||
74 | return NETDEV_TX_OK; | ||
75 | } | ||
76 | |||
77 | |||
78 | static int ixpdev_rx(struct net_device *dev, int processed, int budget) | ||
79 | { | ||
80 | while (processed < budget) { | ||
81 | struct ixpdev_rx_desc *desc; | ||
82 | struct sk_buff *skb; | ||
83 | void *buf; | ||
84 | u32 _desc; | ||
85 | |||
86 | _desc = ixp2000_reg_read(RING_RX_DONE); | ||
87 | if (_desc == 0) | ||
88 | return 0; | ||
89 | |||
90 | desc = rx_desc + | ||
91 | ((_desc - RX_BUF_DESC_BASE) / sizeof(struct ixpdev_rx_desc)); | ||
92 | buf = phys_to_virt(desc->buf_addr); | ||
93 | |||
94 | if (desc->pkt_length < 4 || desc->pkt_length > PAGE_SIZE) { | ||
95 | printk(KERN_ERR "ixp2000: rx err, length %d\n", | ||
96 | desc->pkt_length); | ||
97 | goto err; | ||
98 | } | ||
99 | |||
100 | if (desc->channel < 0 || desc->channel >= nds_count) { | ||
101 | printk(KERN_ERR "ixp2000: rx err, channel %d\n", | ||
102 | desc->channel); | ||
103 | goto err; | ||
104 | } | ||
105 | |||
106 | /* @@@ Make FCS stripping configurable. */ | ||
107 | desc->pkt_length -= 4; | ||
108 | |||
109 | if (unlikely(!netif_running(nds[desc->channel]))) | ||
110 | goto err; | ||
111 | |||
112 | skb = netdev_alloc_skb_ip_align(dev, desc->pkt_length); | ||
113 | if (likely(skb != NULL)) { | ||
114 | skb_copy_to_linear_data(skb, buf, desc->pkt_length); | ||
115 | skb_put(skb, desc->pkt_length); | ||
116 | skb->protocol = eth_type_trans(skb, nds[desc->channel]); | ||
117 | |||
118 | netif_receive_skb(skb); | ||
119 | } | ||
120 | |||
121 | err: | ||
122 | ixp2000_reg_write(RING_RX_PENDING, _desc); | ||
123 | processed++; | ||
124 | } | ||
125 | |||
126 | return processed; | ||
127 | } | ||
128 | |||
129 | /* dev always points to nds[0]. */ | ||
130 | static int ixpdev_poll(struct napi_struct *napi, int budget) | ||
131 | { | ||
132 | struct ixpdev_priv *ip = container_of(napi, struct ixpdev_priv, napi); | ||
133 | struct net_device *dev = ip->dev; | ||
134 | int rx; | ||
135 | |||
136 | rx = 0; | ||
137 | do { | ||
138 | ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff); | ||
139 | |||
140 | rx = ixpdev_rx(dev, rx, budget); | ||
141 | if (rx >= budget) | ||
142 | break; | ||
143 | } while (ixp2000_reg_read(IXP2000_IRQ_THD_RAW_STATUS_A_0) & 0x00ff); | ||
144 | |||
145 | napi_complete(napi); | ||
146 | ixp2000_reg_write(IXP2000_IRQ_THD_ENABLE_SET_A_0, 0x00ff); | ||
147 | |||
148 | return rx; | ||
149 | } | ||
150 | |||
151 | static void ixpdev_tx_complete(void) | ||
152 | { | ||
153 | int channel; | ||
154 | u32 wake; | ||
155 | |||
156 | wake = 0; | ||
157 | while (1) { | ||
158 | struct ixpdev_priv *ip; | ||
159 | u32 desc; | ||
160 | int entry; | ||
161 | |||
162 | desc = ixp2000_reg_read(RING_TX_DONE); | ||
163 | if (desc == 0) | ||
164 | break; | ||
165 | |||
166 | /* @@@ Check whether entries come back in order. */ | ||
167 | entry = (desc - TX_BUF_DESC_BASE) / sizeof(struct ixpdev_tx_desc); | ||
168 | channel = tx_desc[entry].channel; | ||
169 | |||
170 | if (channel < 0 || channel >= nds_count) { | ||
171 | printk(KERN_ERR "ixp2000: txcomp channel index " | ||
172 | "out of bounds (%d, %.8i, %d)\n", | ||
173 | channel, (unsigned int)desc, entry); | ||
174 | continue; | ||
175 | } | ||
176 | |||
177 | ip = netdev_priv(nds[channel]); | ||
178 | if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) | ||
179 | wake |= 1 << channel; | ||
180 | ip->tx_queue_entries--; | ||
181 | } | ||
182 | |||
183 | for (channel = 0; wake != 0; channel++) { | ||
184 | if (wake & (1 << channel)) { | ||
185 | netif_wake_queue(nds[channel]); | ||
186 | wake &= ~(1 << channel); | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
191 | static irqreturn_t ixpdev_interrupt(int irq, void *dev_id) | ||
192 | { | ||
193 | u32 status; | ||
194 | |||
195 | status = ixp2000_reg_read(IXP2000_IRQ_THD_STATUS_A_0); | ||
196 | if (status == 0) | ||
197 | return IRQ_NONE; | ||
198 | |||
199 | /* | ||
200 | * Any of the eight receive units signaled RX? | ||
201 | */ | ||
202 | if (status & 0x00ff) { | ||
203 | struct net_device *dev = nds[0]; | ||
204 | struct ixpdev_priv *ip = netdev_priv(dev); | ||
205 | |||
206 | ixp2000_reg_wrb(IXP2000_IRQ_THD_ENABLE_CLEAR_A_0, 0x00ff); | ||
207 | if (likely(napi_schedule_prep(&ip->napi))) { | ||
208 | __napi_schedule(&ip->napi); | ||
209 | } else { | ||
210 | printk(KERN_CRIT "ixp2000: irq while polling!!\n"); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Any of the eight transmit units signaled TXdone? | ||
216 | */ | ||
217 | if (status & 0xff00) { | ||
218 | ixp2000_reg_wrb(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0xff00); | ||
219 | ixpdev_tx_complete(); | ||
220 | } | ||
221 | |||
222 | return IRQ_HANDLED; | ||
223 | } | ||
224 | |||
225 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
226 | static void ixpdev_poll_controller(struct net_device *dev) | ||
227 | { | ||
228 | disable_irq(IRQ_IXP2000_THDA0); | ||
229 | ixpdev_interrupt(IRQ_IXP2000_THDA0, dev); | ||
230 | enable_irq(IRQ_IXP2000_THDA0); | ||
231 | } | ||
232 | #endif | ||
233 | |||
234 | static int ixpdev_open(struct net_device *dev) | ||
235 | { | ||
236 | struct ixpdev_priv *ip = netdev_priv(dev); | ||
237 | int err; | ||
238 | |||
239 | napi_enable(&ip->napi); | ||
240 | if (!nds_open++) { | ||
241 | err = request_irq(IRQ_IXP2000_THDA0, ixpdev_interrupt, | ||
242 | IRQF_SHARED, "ixp2000_eth", nds); | ||
243 | if (err) { | ||
244 | nds_open--; | ||
245 | napi_disable(&ip->napi); | ||
246 | return err; | ||
247 | } | ||
248 | |||
249 | ixp2000_reg_write(IXP2000_IRQ_THD_ENABLE_SET_A_0, 0xffff); | ||
250 | } | ||
251 | |||
252 | set_port_admin_status(ip->channel, 1); | ||
253 | netif_start_queue(dev); | ||
254 | |||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | static int ixpdev_close(struct net_device *dev) | ||
259 | { | ||
260 | struct ixpdev_priv *ip = netdev_priv(dev); | ||
261 | |||
262 | netif_stop_queue(dev); | ||
263 | napi_disable(&ip->napi); | ||
264 | set_port_admin_status(ip->channel, 0); | ||
265 | |||
266 | if (!--nds_open) { | ||
267 | ixp2000_reg_write(IXP2000_IRQ_THD_ENABLE_CLEAR_A_0, 0xffff); | ||
268 | free_irq(IRQ_IXP2000_THDA0, nds); | ||
269 | } | ||
270 | |||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static struct net_device_stats *ixpdev_get_stats(struct net_device *dev) | ||
275 | { | ||
276 | struct ixpdev_priv *ip = netdev_priv(dev); | ||
277 | |||
278 | pm3386_get_stats(ip->channel, &(dev->stats)); | ||
279 | |||
280 | return &(dev->stats); | ||
281 | } | ||
282 | |||
283 | static const struct net_device_ops ixpdev_netdev_ops = { | ||
284 | .ndo_open = ixpdev_open, | ||
285 | .ndo_stop = ixpdev_close, | ||
286 | .ndo_start_xmit = ixpdev_xmit, | ||
287 | .ndo_change_mtu = eth_change_mtu, | ||
288 | .ndo_validate_addr = eth_validate_addr, | ||
289 | .ndo_set_mac_address = eth_mac_addr, | ||
290 | .ndo_get_stats = ixpdev_get_stats, | ||
291 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
292 | .ndo_poll_controller = ixpdev_poll_controller, | ||
293 | #endif | ||
294 | }; | ||
295 | |||
296 | struct net_device *ixpdev_alloc(int channel, int sizeof_priv) | ||
297 | { | ||
298 | struct net_device *dev; | ||
299 | struct ixpdev_priv *ip; | ||
300 | |||
301 | dev = alloc_etherdev(sizeof_priv); | ||
302 | if (dev == NULL) | ||
303 | return NULL; | ||
304 | |||
305 | dev->netdev_ops = &ixpdev_netdev_ops; | ||
306 | |||
307 | dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; | ||
308 | |||
309 | ip = netdev_priv(dev); | ||
310 | ip->dev = dev; | ||
311 | netif_napi_add(dev, &ip->napi, ixpdev_poll, 64); | ||
312 | ip->channel = channel; | ||
313 | ip->tx_queue_entries = 0; | ||
314 | |||
315 | return dev; | ||
316 | } | ||
317 | |||
318 | int ixpdev_init(int __nds_count, struct net_device **__nds, | ||
319 | void (*__set_port_admin_status)(int port, int up)) | ||
320 | { | ||
321 | int i; | ||
322 | int err; | ||
323 | |||
324 | BUILD_BUG_ON(RX_BUF_COUNT > 192 || TX_BUF_COUNT > 192); | ||
325 | |||
326 | printk(KERN_INFO "IXP2000 MSF ethernet driver %s\n", DRV_MODULE_VERSION); | ||
327 | |||
328 | nds_count = __nds_count; | ||
329 | nds = __nds; | ||
330 | set_port_admin_status = __set_port_admin_status; | ||
331 | |||
332 | for (i = 0; i < RX_BUF_COUNT; i++) { | ||
333 | void *buf; | ||
334 | |||
335 | buf = (void *)get_zeroed_page(GFP_KERNEL); | ||
336 | if (buf == NULL) { | ||
337 | err = -ENOMEM; | ||
338 | while (--i >= 0) | ||
339 | free_page((unsigned long)phys_to_virt(rx_desc[i].buf_addr)); | ||
340 | goto err_out; | ||
341 | } | ||
342 | rx_desc[i].buf_addr = virt_to_phys(buf); | ||
343 | rx_desc[i].buf_length = PAGE_SIZE; | ||
344 | } | ||
345 | |||
346 | /* @@@ Maybe we shouldn't be preallocating TX buffers. */ | ||
347 | for (i = 0; i < TX_BUF_COUNT; i++) { | ||
348 | void *buf; | ||
349 | |||
350 | buf = (void *)get_zeroed_page(GFP_KERNEL); | ||
351 | if (buf == NULL) { | ||
352 | err = -ENOMEM; | ||
353 | while (--i >= 0) | ||
354 | free_page((unsigned long)phys_to_virt(tx_desc[i].buf_addr)); | ||
355 | goto err_free_rx; | ||
356 | } | ||
357 | tx_desc[i].buf_addr = virt_to_phys(buf); | ||
358 | } | ||
359 | |||
360 | /* 256 entries, ring status set means 'empty', base address 0x0000. */ | ||
361 | ixp2000_reg_write(RING_RX_PENDING_BASE, 0x44000000); | ||
362 | ixp2000_reg_write(RING_RX_PENDING_HEAD, 0x00000000); | ||
363 | ixp2000_reg_write(RING_RX_PENDING_TAIL, 0x00000000); | ||
364 | |||
365 | /* 256 entries, ring status set means 'full', base address 0x0400. */ | ||
366 | ixp2000_reg_write(RING_RX_DONE_BASE, 0x40000400); | ||
367 | ixp2000_reg_write(RING_RX_DONE_HEAD, 0x00000000); | ||
368 | ixp2000_reg_write(RING_RX_DONE_TAIL, 0x00000000); | ||
369 | |||
370 | for (i = 0; i < RX_BUF_COUNT; i++) { | ||
371 | ixp2000_reg_write(RING_RX_PENDING, | ||
372 | RX_BUF_DESC_BASE + (i * sizeof(struct ixpdev_rx_desc))); | ||
373 | } | ||
374 | |||
375 | ixp2000_uengine_load(0, &ixp2400_rx); | ||
376 | ixp2000_uengine_start_contexts(0, 0xff); | ||
377 | |||
378 | /* 256 entries, ring status set means 'empty', base address 0x0800. */ | ||
379 | ixp2000_reg_write(RING_TX_PENDING_BASE, 0x44000800); | ||
380 | ixp2000_reg_write(RING_TX_PENDING_HEAD, 0x00000000); | ||
381 | ixp2000_reg_write(RING_TX_PENDING_TAIL, 0x00000000); | ||
382 | |||
383 | /* 256 entries, ring status set means 'full', base address 0x0c00. */ | ||
384 | ixp2000_reg_write(RING_TX_DONE_BASE, 0x40000c00); | ||
385 | ixp2000_reg_write(RING_TX_DONE_HEAD, 0x00000000); | ||
386 | ixp2000_reg_write(RING_TX_DONE_TAIL, 0x00000000); | ||
387 | |||
388 | ixp2000_uengine_load(1, &ixp2400_tx); | ||
389 | ixp2000_uengine_start_contexts(1, 0xff); | ||
390 | |||
391 | for (i = 0; i < nds_count; i++) { | ||
392 | err = register_netdev(nds[i]); | ||
393 | if (err) { | ||
394 | while (--i >= 0) | ||
395 | unregister_netdev(nds[i]); | ||
396 | goto err_free_tx; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | for (i = 0; i < nds_count; i++) { | ||
401 | printk(KERN_INFO "%s: IXP2000 MSF ethernet (port %d), %pM.\n", | ||
402 | nds[i]->name, i, nds[i]->dev_addr); | ||
403 | } | ||
404 | |||
405 | return 0; | ||
406 | |||
407 | err_free_tx: | ||
408 | for (i = 0; i < TX_BUF_COUNT; i++) | ||
409 | free_page((unsigned long)phys_to_virt(tx_desc[i].buf_addr)); | ||
410 | |||
411 | err_free_rx: | ||
412 | for (i = 0; i < RX_BUF_COUNT; i++) | ||
413 | free_page((unsigned long)phys_to_virt(rx_desc[i].buf_addr)); | ||
414 | |||
415 | err_out: | ||
416 | return err; | ||
417 | } | ||
418 | |||
419 | void ixpdev_deinit(void) | ||
420 | { | ||
421 | int i; | ||
422 | |||
423 | /* @@@ Flush out pending packets. */ | ||
424 | |||
425 | for (i = 0; i < nds_count; i++) | ||
426 | unregister_netdev(nds[i]); | ||
427 | |||
428 | ixp2000_uengine_stop_contexts(1, 0xff); | ||
429 | ixp2000_uengine_stop_contexts(0, 0xff); | ||
430 | ixp2000_uengine_reset(0x3); | ||
431 | |||
432 | for (i = 0; i < TX_BUF_COUNT; i++) | ||
433 | free_page((unsigned long)phys_to_virt(tx_desc[i].buf_addr)); | ||
434 | |||
435 | for (i = 0; i < RX_BUF_COUNT; i++) | ||
436 | free_page((unsigned long)phys_to_virt(rx_desc[i].buf_addr)); | ||
437 | } | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixpdev.h b/drivers/net/ethernet/xscale/ixp2000/ixpdev.h deleted file mode 100644 index 391ece623243..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixpdev.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * IXP2000 MSF network device driver | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __IXPDEV_H | ||
13 | #define __IXPDEV_H | ||
14 | |||
15 | struct ixpdev_priv | ||
16 | { | ||
17 | struct net_device *dev; | ||
18 | struct napi_struct napi; | ||
19 | int channel; | ||
20 | int tx_queue_entries; | ||
21 | }; | ||
22 | |||
23 | struct net_device *ixpdev_alloc(int channel, int sizeof_priv); | ||
24 | int ixpdev_init(int num_ports, struct net_device **nds, | ||
25 | void (*set_port_admin_status)(int port, int up)); | ||
26 | void ixpdev_deinit(void); | ||
27 | |||
28 | |||
29 | #endif | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/ixpdev_priv.h b/drivers/net/ethernet/xscale/ixp2000/ixpdev_priv.h deleted file mode 100644 index 86aa08ea0c33..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/ixpdev_priv.h +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * IXP2000 MSF network device driver | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __IXPDEV_PRIV_H | ||
13 | #define __IXPDEV_PRIV_H | ||
14 | |||
15 | #define RX_BUF_DESC_BASE 0x00001000 | ||
16 | #define RX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_rx_desc))) | ||
17 | #define TX_BUF_DESC_BASE 0x00002000 | ||
18 | #define TX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_tx_desc))) | ||
19 | #define TX_BUF_COUNT_PER_CHAN (TX_BUF_COUNT / 4) | ||
20 | |||
21 | #define RING_RX_PENDING ((u32 *)IXP2000_SCRATCH_RING_VIRT_BASE) | ||
22 | #define RING_RX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 4)) | ||
23 | #define RING_TX_PENDING ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 8)) | ||
24 | #define RING_TX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 12)) | ||
25 | |||
26 | #define SCRATCH_REG(x) ((u32 *)(IXP2000_GLOBAL_REG_VIRT_BASE | 0x0800 | (x))) | ||
27 | #define RING_RX_PENDING_BASE SCRATCH_REG(0x00) | ||
28 | #define RING_RX_PENDING_HEAD SCRATCH_REG(0x04) | ||
29 | #define RING_RX_PENDING_TAIL SCRATCH_REG(0x08) | ||
30 | #define RING_RX_DONE_BASE SCRATCH_REG(0x10) | ||
31 | #define RING_RX_DONE_HEAD SCRATCH_REG(0x14) | ||
32 | #define RING_RX_DONE_TAIL SCRATCH_REG(0x18) | ||
33 | #define RING_TX_PENDING_BASE SCRATCH_REG(0x20) | ||
34 | #define RING_TX_PENDING_HEAD SCRATCH_REG(0x24) | ||
35 | #define RING_TX_PENDING_TAIL SCRATCH_REG(0x28) | ||
36 | #define RING_TX_DONE_BASE SCRATCH_REG(0x30) | ||
37 | #define RING_TX_DONE_HEAD SCRATCH_REG(0x34) | ||
38 | #define RING_TX_DONE_TAIL SCRATCH_REG(0x38) | ||
39 | |||
40 | struct ixpdev_rx_desc | ||
41 | { | ||
42 | u32 buf_addr; | ||
43 | u32 buf_length; | ||
44 | u32 channel; | ||
45 | u32 pkt_length; | ||
46 | }; | ||
47 | |||
48 | struct ixpdev_tx_desc | ||
49 | { | ||
50 | u32 buf_addr; | ||
51 | u32 pkt_length; | ||
52 | u32 channel; | ||
53 | u32 unused; | ||
54 | }; | ||
55 | |||
56 | |||
57 | #endif | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/pm3386.c b/drivers/net/ethernet/xscale/ixp2000/pm3386.c deleted file mode 100644 index e08d3f9863b8..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/pm3386.c +++ /dev/null | |||
@@ -1,351 +0,0 @@ | |||
1 | /* | ||
2 | * Helper functions for the PM3386s on the Radisys ENP2611 | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/netdevice.h> | ||
15 | #include <asm/io.h> | ||
16 | #include "pm3386.h" | ||
17 | |||
18 | /* | ||
19 | * Read from register 'reg' of PM3386 device 'pm'. | ||
20 | */ | ||
21 | static u16 pm3386_reg_read(int pm, int reg) | ||
22 | { | ||
23 | void *_reg; | ||
24 | u16 value; | ||
25 | |||
26 | _reg = (void *)ENP2611_PM3386_0_VIRT_BASE; | ||
27 | if (pm == 1) | ||
28 | _reg = (void *)ENP2611_PM3386_1_VIRT_BASE; | ||
29 | |||
30 | value = *((volatile u16 *)(_reg + (reg << 1))); | ||
31 | |||
32 | // printk(KERN_INFO "pm3386_reg_read(%d, %.3x) = %.8x\n", pm, reg, value); | ||
33 | |||
34 | return value; | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * Write to register 'reg' of PM3386 device 'pm', and perform | ||
39 | * a readback from the identification register. | ||
40 | */ | ||
41 | static void pm3386_reg_write(int pm, int reg, u16 value) | ||
42 | { | ||
43 | void *_reg; | ||
44 | u16 dummy; | ||
45 | |||
46 | // printk(KERN_INFO "pm3386_reg_write(%d, %.3x, %.8x)\n", pm, reg, value); | ||
47 | |||
48 | _reg = (void *)ENP2611_PM3386_0_VIRT_BASE; | ||
49 | if (pm == 1) | ||
50 | _reg = (void *)ENP2611_PM3386_1_VIRT_BASE; | ||
51 | |||
52 | *((volatile u16 *)(_reg + (reg << 1))) = value; | ||
53 | |||
54 | dummy = *((volatile u16 *)_reg); | ||
55 | __asm__ __volatile__("mov %0, %0" : "+r" (dummy)); | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * Read from port 'port' register 'reg', where the registers | ||
60 | * for the different ports are 'spacing' registers apart. | ||
61 | */ | ||
62 | static u16 pm3386_port_reg_read(int port, int _reg, int spacing) | ||
63 | { | ||
64 | int reg; | ||
65 | |||
66 | reg = _reg; | ||
67 | if (port & 1) | ||
68 | reg += spacing; | ||
69 | |||
70 | return pm3386_reg_read(port >> 1, reg); | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * Write to port 'port' register 'reg', where the registers | ||
75 | * for the different ports are 'spacing' registers apart. | ||
76 | */ | ||
77 | static void pm3386_port_reg_write(int port, int _reg, int spacing, u16 value) | ||
78 | { | ||
79 | int reg; | ||
80 | |||
81 | reg = _reg; | ||
82 | if (port & 1) | ||
83 | reg += spacing; | ||
84 | |||
85 | pm3386_reg_write(port >> 1, reg, value); | ||
86 | } | ||
87 | |||
88 | int pm3386_secondary_present(void) | ||
89 | { | ||
90 | return pm3386_reg_read(1, 0) == 0x3386; | ||
91 | } | ||
92 | |||
93 | void pm3386_reset(void) | ||
94 | { | ||
95 | u8 mac[3][6]; | ||
96 | int secondary; | ||
97 | |||
98 | secondary = pm3386_secondary_present(); | ||
99 | |||
100 | /* Save programmed MAC addresses. */ | ||
101 | pm3386_get_mac(0, mac[0]); | ||
102 | pm3386_get_mac(1, mac[1]); | ||
103 | if (secondary) | ||
104 | pm3386_get_mac(2, mac[2]); | ||
105 | |||
106 | /* Assert analog and digital reset. */ | ||
107 | pm3386_reg_write(0, 0x002, 0x0060); | ||
108 | if (secondary) | ||
109 | pm3386_reg_write(1, 0x002, 0x0060); | ||
110 | mdelay(1); | ||
111 | |||
112 | /* Deassert analog reset. */ | ||
113 | pm3386_reg_write(0, 0x002, 0x0062); | ||
114 | if (secondary) | ||
115 | pm3386_reg_write(1, 0x002, 0x0062); | ||
116 | mdelay(10); | ||
117 | |||
118 | /* Deassert digital reset. */ | ||
119 | pm3386_reg_write(0, 0x002, 0x0063); | ||
120 | if (secondary) | ||
121 | pm3386_reg_write(1, 0x002, 0x0063); | ||
122 | mdelay(10); | ||
123 | |||
124 | /* Restore programmed MAC addresses. */ | ||
125 | pm3386_set_mac(0, mac[0]); | ||
126 | pm3386_set_mac(1, mac[1]); | ||
127 | if (secondary) | ||
128 | pm3386_set_mac(2, mac[2]); | ||
129 | |||
130 | /* Disable carrier on all ports. */ | ||
131 | pm3386_set_carrier(0, 0); | ||
132 | pm3386_set_carrier(1, 0); | ||
133 | if (secondary) | ||
134 | pm3386_set_carrier(2, 0); | ||
135 | } | ||
136 | |||
137 | static u16 swaph(u16 x) | ||
138 | { | ||
139 | return ((x << 8) | (x >> 8)) & 0xffff; | ||
140 | } | ||
141 | |||
142 | int pm3386_port_count(void) | ||
143 | { | ||
144 | return 2 + pm3386_secondary_present(); | ||
145 | } | ||
146 | |||
147 | void pm3386_init_port(int port) | ||
148 | { | ||
149 | int pm = port >> 1; | ||
150 | |||
151 | /* | ||
152 | * Work around ENP2611 bootloader programming MAC address | ||
153 | * in reverse. | ||
154 | */ | ||
155 | if (pm3386_port_reg_read(port, 0x30a, 0x100) == 0x0000 && | ||
156 | (pm3386_port_reg_read(port, 0x309, 0x100) & 0xff00) == 0x5000) { | ||
157 | u16 temp[3]; | ||
158 | |||
159 | temp[0] = pm3386_port_reg_read(port, 0x308, 0x100); | ||
160 | temp[1] = pm3386_port_reg_read(port, 0x309, 0x100); | ||
161 | temp[2] = pm3386_port_reg_read(port, 0x30a, 0x100); | ||
162 | pm3386_port_reg_write(port, 0x308, 0x100, swaph(temp[2])); | ||
163 | pm3386_port_reg_write(port, 0x309, 0x100, swaph(temp[1])); | ||
164 | pm3386_port_reg_write(port, 0x30a, 0x100, swaph(temp[0])); | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Initialise narrowbanding mode. See application note 2010486 | ||
169 | * for more information. (@@@ We also need to issue a reset | ||
170 | * when ROOL or DOOL are detected.) | ||
171 | */ | ||
172 | pm3386_port_reg_write(port, 0x708, 0x10, 0xd055); | ||
173 | udelay(500); | ||
174 | pm3386_port_reg_write(port, 0x708, 0x10, 0x5055); | ||
175 | |||
176 | /* | ||
177 | * SPI-3 ingress block. Set 64 bytes SPI-3 burst size | ||
178 | * towards SPI-3 bridge. | ||
179 | */ | ||
180 | pm3386_port_reg_write(port, 0x122, 0x20, 0x0002); | ||
181 | |||
182 | /* | ||
183 | * Enable ingress protocol checking, and soft reset the | ||
184 | * SPI-3 ingress block. | ||
185 | */ | ||
186 | pm3386_reg_write(pm, 0x103, 0x0003); | ||
187 | while (!(pm3386_reg_read(pm, 0x103) & 0x80)) | ||
188 | ; | ||
189 | |||
190 | /* | ||
191 | * SPI-3 egress block. Gather 12288 bytes of the current | ||
192 | * packet in the TX fifo before initiating transmit on the | ||
193 | * SERDES interface. (Prevents TX underflows.) | ||
194 | */ | ||
195 | pm3386_port_reg_write(port, 0x221, 0x20, 0x0007); | ||
196 | |||
197 | /* | ||
198 | * Enforce odd parity from the SPI-3 bridge, and soft reset | ||
199 | * the SPI-3 egress block. | ||
200 | */ | ||
201 | pm3386_reg_write(pm, 0x203, 0x000d & ~(4 << (port & 1))); | ||
202 | while ((pm3386_reg_read(pm, 0x203) & 0x000c) != 0x000c) | ||
203 | ; | ||
204 | |||
205 | /* | ||
206 | * EGMAC block. Set this channels to reject long preambles, | ||
207 | * not send or transmit PAUSE frames, enable preamble checking, | ||
208 | * disable frame length checking, enable FCS appending, enable | ||
209 | * TX frame padding. | ||
210 | */ | ||
211 | pm3386_port_reg_write(port, 0x302, 0x100, 0x0113); | ||
212 | |||
213 | /* | ||
214 | * Soft reset the EGMAC block. | ||
215 | */ | ||
216 | pm3386_port_reg_write(port, 0x301, 0x100, 0x8000); | ||
217 | pm3386_port_reg_write(port, 0x301, 0x100, 0x0000); | ||
218 | |||
219 | /* | ||
220 | * Auto-sense autonegotiation status. | ||
221 | */ | ||
222 | pm3386_port_reg_write(port, 0x306, 0x100, 0x0100); | ||
223 | |||
224 | /* | ||
225 | * Allow reception of jumbo frames. | ||
226 | */ | ||
227 | pm3386_port_reg_write(port, 0x310, 0x100, 9018); | ||
228 | |||
229 | /* | ||
230 | * Allow transmission of jumbo frames. | ||
231 | */ | ||
232 | pm3386_port_reg_write(port, 0x336, 0x100, 9018); | ||
233 | |||
234 | /* @@@ Should set 0x337/0x437 (RX forwarding threshold.) */ | ||
235 | |||
236 | /* | ||
237 | * Set autonegotiation parameters to 'no PAUSE, full duplex.' | ||
238 | */ | ||
239 | pm3386_port_reg_write(port, 0x31c, 0x100, 0x0020); | ||
240 | |||
241 | /* | ||
242 | * Enable and restart autonegotiation. | ||
243 | */ | ||
244 | pm3386_port_reg_write(port, 0x318, 0x100, 0x0003); | ||
245 | pm3386_port_reg_write(port, 0x318, 0x100, 0x0002); | ||
246 | } | ||
247 | |||
248 | void pm3386_get_mac(int port, u8 *mac) | ||
249 | { | ||
250 | u16 temp; | ||
251 | |||
252 | temp = pm3386_port_reg_read(port, 0x308, 0x100); | ||
253 | mac[0] = temp & 0xff; | ||
254 | mac[1] = (temp >> 8) & 0xff; | ||
255 | |||
256 | temp = pm3386_port_reg_read(port, 0x309, 0x100); | ||
257 | mac[2] = temp & 0xff; | ||
258 | mac[3] = (temp >> 8) & 0xff; | ||
259 | |||
260 | temp = pm3386_port_reg_read(port, 0x30a, 0x100); | ||
261 | mac[4] = temp & 0xff; | ||
262 | mac[5] = (temp >> 8) & 0xff; | ||
263 | } | ||
264 | |||
265 | void pm3386_set_mac(int port, u8 *mac) | ||
266 | { | ||
267 | pm3386_port_reg_write(port, 0x308, 0x100, (mac[1] << 8) | mac[0]); | ||
268 | pm3386_port_reg_write(port, 0x309, 0x100, (mac[3] << 8) | mac[2]); | ||
269 | pm3386_port_reg_write(port, 0x30a, 0x100, (mac[5] << 8) | mac[4]); | ||
270 | } | ||
271 | |||
272 | static u32 pm3386_get_stat(int port, u16 base) | ||
273 | { | ||
274 | u32 value; | ||
275 | |||
276 | value = pm3386_port_reg_read(port, base, 0x100); | ||
277 | value |= pm3386_port_reg_read(port, base + 1, 0x100) << 16; | ||
278 | |||
279 | return value; | ||
280 | } | ||
281 | |||
282 | void pm3386_get_stats(int port, struct net_device_stats *stats) | ||
283 | { | ||
284 | /* | ||
285 | * Snapshot statistics counters. | ||
286 | */ | ||
287 | pm3386_port_reg_write(port, 0x500, 0x100, 0x0001); | ||
288 | while (pm3386_port_reg_read(port, 0x500, 0x100) & 0x0001) | ||
289 | ; | ||
290 | |||
291 | memset(stats, 0, sizeof(*stats)); | ||
292 | |||
293 | stats->rx_packets = pm3386_get_stat(port, 0x510); | ||
294 | stats->tx_packets = pm3386_get_stat(port, 0x590); | ||
295 | stats->rx_bytes = pm3386_get_stat(port, 0x514); | ||
296 | stats->tx_bytes = pm3386_get_stat(port, 0x594); | ||
297 | /* @@@ Add other stats. */ | ||
298 | } | ||
299 | |||
300 | void pm3386_set_carrier(int port, int state) | ||
301 | { | ||
302 | pm3386_port_reg_write(port, 0x703, 0x10, state ? 0x1001 : 0x0000); | ||
303 | } | ||
304 | |||
305 | int pm3386_is_link_up(int port) | ||
306 | { | ||
307 | u16 temp; | ||
308 | |||
309 | temp = pm3386_port_reg_read(port, 0x31a, 0x100); | ||
310 | temp = pm3386_port_reg_read(port, 0x31a, 0x100); | ||
311 | |||
312 | return !!(temp & 0x0002); | ||
313 | } | ||
314 | |||
315 | void pm3386_enable_rx(int port) | ||
316 | { | ||
317 | u16 temp; | ||
318 | |||
319 | temp = pm3386_port_reg_read(port, 0x303, 0x100); | ||
320 | temp |= 0x1000; | ||
321 | pm3386_port_reg_write(port, 0x303, 0x100, temp); | ||
322 | } | ||
323 | |||
324 | void pm3386_disable_rx(int port) | ||
325 | { | ||
326 | u16 temp; | ||
327 | |||
328 | temp = pm3386_port_reg_read(port, 0x303, 0x100); | ||
329 | temp &= 0xefff; | ||
330 | pm3386_port_reg_write(port, 0x303, 0x100, temp); | ||
331 | } | ||
332 | |||
333 | void pm3386_enable_tx(int port) | ||
334 | { | ||
335 | u16 temp; | ||
336 | |||
337 | temp = pm3386_port_reg_read(port, 0x303, 0x100); | ||
338 | temp |= 0x4000; | ||
339 | pm3386_port_reg_write(port, 0x303, 0x100, temp); | ||
340 | } | ||
341 | |||
342 | void pm3386_disable_tx(int port) | ||
343 | { | ||
344 | u16 temp; | ||
345 | |||
346 | temp = pm3386_port_reg_read(port, 0x303, 0x100); | ||
347 | temp &= 0xbfff; | ||
348 | pm3386_port_reg_write(port, 0x303, 0x100, temp); | ||
349 | } | ||
350 | |||
351 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/ethernet/xscale/ixp2000/pm3386.h b/drivers/net/ethernet/xscale/ixp2000/pm3386.h deleted file mode 100644 index cc4183dca911..000000000000 --- a/drivers/net/ethernet/xscale/ixp2000/pm3386.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * Helper functions for the PM3386s on the Radisys ENP2611 | ||
3 | * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> | ||
4 | * Dedicated to Marija Kulikova. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __PM3386_H | ||
13 | #define __PM3386_H | ||
14 | |||
15 | void pm3386_reset(void); | ||
16 | int pm3386_port_count(void); | ||
17 | void pm3386_init_port(int port); | ||
18 | void pm3386_get_mac(int port, u8 *mac); | ||
19 | void pm3386_set_mac(int port, u8 *mac); | ||
20 | void pm3386_get_stats(int port, struct net_device_stats *stats); | ||
21 | void pm3386_set_carrier(int port, int state); | ||
22 | int pm3386_is_link_up(int port); | ||
23 | void pm3386_enable_rx(int port); | ||
24 | void pm3386_disable_rx(int port); | ||
25 | void pm3386_enable_tx(int port); | ||
26 | void pm3386_disable_tx(int port); | ||
27 | |||
28 | |||
29 | #endif | ||