diff options
author | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-03-24 14:12:23 -0400 |
---|---|---|
committer | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-11-21 20:49:47 -0500 |
commit | 88597364573a46a57496c62ff0ee4b8148831ed0 (patch) | |
tree | 2a3e2c3a324cd6d0319efdbc0b61c0a44179b677 | |
parent | 6b40aba304e6f94c747ad9559e03ea03a49e8008 (diff) |
WAN: remove SCA II support from SCA drivers
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
-rw-r--r-- | drivers/net/wan/c101.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/hd64570.c | 252 | ||||
-rw-r--r-- | drivers/net/wan/n2.c | 7 |
3 files changed, 58 insertions, 205 deletions
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 23d66060db87..b46897996f7e 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -88,7 +88,7 @@ static card_t **new_card = &first_card; | |||
88 | /* EDA address register must be set in EDAL, EDAH order - 8 bit ISA bus */ | 88 | /* EDA address register must be set in EDAL, EDAH order - 8 bit ISA bus */ |
89 | #define sca_outw(value, reg, card) do { \ | 89 | #define sca_outw(value, reg, card) do { \ |
90 | writeb(value & 0xFF, (card)->win0base + C101_SCA + (reg)); \ | 90 | writeb(value & 0xFF, (card)->win0base + C101_SCA + (reg)); \ |
91 | writeb((value >> 8 ) & 0xFF, (card)->win0base + C101_SCA + (reg+1));\ | 91 | writeb((value >> 8 ) & 0xFF, (card)->win0base + C101_SCA + (reg + 1));\ |
92 | } while(0) | 92 | } while(0) |
93 | 93 | ||
94 | #define port_to_card(port) (port) | 94 | #define port_to_card(port) (port) |
@@ -381,7 +381,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) | |||
381 | return result; | 381 | return result; |
382 | } | 382 | } |
383 | 383 | ||
384 | sca_init_sync_port(card); /* Set up C101 memory */ | 384 | sca_init_port(card); /* Set up C101 memory */ |
385 | set_carrier(card); | 385 | set_carrier(card); |
386 | 386 | ||
387 | printk(KERN_INFO "%s: Moxa C101 on IRQ%u," | 387 | printk(KERN_INFO "%s: Moxa C101 on IRQ%u," |
diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c index 434583a94b32..64ef6185aaba 100644 --- a/drivers/net/wan/hd64570.c +++ b/drivers/net/wan/hd64570.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Hitachi SCA HD64570 and HD64572 common driver for Linux | 2 | * Hitachi SCA HD64570 driver for Linux |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2003 Krzysztof Halasa <khc@pm.waw.pl> | 4 | * Copyright (C) 1998-2003 Krzysztof Halasa <khc@pm.waw.pl> |
5 | * | 5 | * |
@@ -7,9 +7,7 @@ | |||
7 | * under the terms of version 2 of the GNU General Public License | 7 | * under the terms of version 2 of the GNU General Public License |
8 | * as published by the Free Software Foundation. | 8 | * as published by the Free Software Foundation. |
9 | * | 9 | * |
10 | * Sources of information: | 10 | * Source of information: Hitachi HD64570 SCA User's Manual |
11 | * Hitachi HD64570 SCA User's Manual | ||
12 | * Hitachi HD64572 SCA-II User's Manual | ||
13 | * | 11 | * |
14 | * We use the following SCA memory map: | 12 | * We use the following SCA memory map: |
15 | * | 13 | * |
@@ -26,33 +24,26 @@ | |||
26 | * tx_ring_buffers * HDLC_MAX_MRU = logical channel #0 TX buffers (if used) | 24 | * tx_ring_buffers * HDLC_MAX_MRU = logical channel #0 TX buffers (if used) |
27 | */ | 25 | */ |
28 | 26 | ||
29 | #include <linux/module.h> | 27 | #include <linux/bitops.h> |
30 | #include <linux/kernel.h> | 28 | #include <linux/errno.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/jiffies.h> | ||
33 | #include <linux/types.h> | ||
34 | #include <linux/fcntl.h> | 29 | #include <linux/fcntl.h> |
35 | #include <linux/interrupt.h> | 30 | #include <linux/hdlc.h> |
36 | #include <linux/in.h> | 31 | #include <linux/in.h> |
37 | #include <linux/string.h> | ||
38 | #include <linux/errno.h> | ||
39 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/interrupt.h> | ||
40 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
41 | #include <linux/bitops.h> | 35 | #include <linux/jiffies.h> |
42 | 36 | #include <linux/kernel.h> | |
43 | #include <asm/system.h> | 37 | #include <linux/module.h> |
44 | #include <asm/uaccess.h> | ||
45 | #include <asm/io.h> | ||
46 | |||
47 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
48 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
49 | 40 | #include <linux/slab.h> | |
50 | #include <linux/hdlc.h> | 41 | #include <linux/string.h> |
51 | 42 | #include <linux/types.h> | |
52 | #if (!defined (__HD64570_H) && !defined (__HD64572_H)) || \ | 43 | #include <asm/io.h> |
53 | (defined (__HD64570_H) && defined (__HD64572_H)) | 44 | #include <asm/system.h> |
54 | #error Either hd64570.h or hd64572.h must be included | 45 | #include <asm/uaccess.h> |
55 | #endif | 46 | #include "hd64570.h" |
56 | 47 | ||
57 | #define get_msci(port) (phy_node(port) ? MSCI1_OFFSET : MSCI0_OFFSET) | 48 | #define get_msci(port) (phy_node(port) ? MSCI1_OFFSET : MSCI0_OFFSET) |
58 | #define get_dmac_rx(port) (phy_node(port) ? DMAC1RX_OFFSET : DMAC0RX_OFFSET) | 49 | #define get_dmac_rx(port) (phy_node(port) ? DMAC1RX_OFFSET : DMAC0RX_OFFSET) |
@@ -62,16 +53,6 @@ | |||
62 | #define SCA_INTR_DMAC_RX(node) (node ? 0x20 : 0x02) | 53 | #define SCA_INTR_DMAC_RX(node) (node ? 0x20 : 0x02) |
63 | #define SCA_INTR_DMAC_TX(node) (node ? 0x40 : 0x04) | 54 | #define SCA_INTR_DMAC_TX(node) (node ? 0x40 : 0x04) |
64 | 55 | ||
65 | #ifdef __HD64570_H /* HD64570 */ | ||
66 | #define sca_outa(value, reg, card) sca_outw(value, reg, card) | ||
67 | #define sca_ina(reg, card) sca_inw(reg, card) | ||
68 | #define writea(value, ptr) writew(value, ptr) | ||
69 | |||
70 | #else /* HD64572 */ | ||
71 | #define sca_outa(value, reg, card) sca_outl(value, reg, card) | ||
72 | #define sca_ina(reg, card) sca_inl(reg, card) | ||
73 | #define writea(value, ptr) writel(value, ptr) | ||
74 | #endif | ||
75 | 56 | ||
76 | static inline struct net_device *port_to_dev(port_t *port) | 57 | static inline struct net_device *port_to_dev(port_t *port) |
77 | { | 58 | { |
@@ -81,8 +62,6 @@ static inline struct net_device *port_to_dev(port_t *port) | |||
81 | static inline int sca_intr_status(card_t *card) | 62 | static inline int sca_intr_status(card_t *card) |
82 | { | 63 | { |
83 | u8 result = 0; | 64 | u8 result = 0; |
84 | |||
85 | #ifdef __HD64570_H /* HD64570 */ | ||
86 | u8 isr0 = sca_in(ISR0, card); | 65 | u8 isr0 = sca_in(ISR0, card); |
87 | u8 isr1 = sca_in(ISR1, card); | 66 | u8 isr1 = sca_in(ISR1, card); |
88 | 67 | ||
@@ -93,18 +72,6 @@ static inline int sca_intr_status(card_t *card) | |||
93 | if (isr0 & 0x0F) result |= SCA_INTR_MSCI(0); | 72 | if (isr0 & 0x0F) result |= SCA_INTR_MSCI(0); |
94 | if (isr0 & 0xF0) result |= SCA_INTR_MSCI(1); | 73 | if (isr0 & 0xF0) result |= SCA_INTR_MSCI(1); |
95 | 74 | ||
96 | #else /* HD64572 */ | ||
97 | u32 isr0 = sca_inl(ISR0, card); | ||
98 | |||
99 | if (isr0 & 0x0000000F) result |= SCA_INTR_DMAC_RX(0); | ||
100 | if (isr0 & 0x000000F0) result |= SCA_INTR_DMAC_TX(0); | ||
101 | if (isr0 & 0x00000F00) result |= SCA_INTR_DMAC_RX(1); | ||
102 | if (isr0 & 0x0000F000) result |= SCA_INTR_DMAC_TX(1); | ||
103 | if (isr0 & 0x003E0000) result |= SCA_INTR_MSCI(0); | ||
104 | if (isr0 & 0x3E000000) result |= SCA_INTR_MSCI(1); | ||
105 | |||
106 | #endif /* HD64570 vs HD64572 */ | ||
107 | |||
108 | if (!(result & SCA_INTR_DMAC_TX(0))) | 75 | if (!(result & SCA_INTR_DMAC_TX(0))) |
109 | if (sca_in(DSR_TX(0), card) & DSR_EOM) | 76 | if (sca_in(DSR_TX(0), card) & DSR_EOM) |
110 | result |= SCA_INTR_DMAC_TX(0); | 77 | result |= SCA_INTR_DMAC_TX(0); |
@@ -127,7 +94,6 @@ static inline u16 next_desc(port_t *port, u16 desc, int transmit) | |||
127 | } | 94 | } |
128 | 95 | ||
129 | 96 | ||
130 | |||
131 | static inline u16 desc_abs_number(port_t *port, u16 desc, int transmit) | 97 | static inline u16 desc_abs_number(port_t *port, u16 desc, int transmit) |
132 | { | 98 | { |
133 | u16 rx_buffs = port_to_card(port)->rx_ring_buffers; | 99 | u16 rx_buffs = port_to_card(port)->rx_ring_buffers; |
@@ -139,7 +105,6 @@ static inline u16 desc_abs_number(port_t *port, u16 desc, int transmit) | |||
139 | } | 105 | } |
140 | 106 | ||
141 | 107 | ||
142 | |||
143 | static inline u16 desc_offset(port_t *port, u16 desc, int transmit) | 108 | static inline u16 desc_offset(port_t *port, u16 desc, int transmit) |
144 | { | 109 | { |
145 | /* Descriptor offset always fits in 16 bytes */ | 110 | /* Descriptor offset always fits in 16 bytes */ |
@@ -147,20 +112,19 @@ static inline u16 desc_offset(port_t *port, u16 desc, int transmit) | |||
147 | } | 112 | } |
148 | 113 | ||
149 | 114 | ||
150 | 115 | static inline pkt_desc __iomem *desc_address(port_t *port, u16 desc, | |
151 | static inline pkt_desc __iomem *desc_address(port_t *port, u16 desc, int transmit) | 116 | int transmit) |
152 | { | 117 | { |
153 | #ifdef PAGE0_ALWAYS_MAPPED | 118 | #ifdef PAGE0_ALWAYS_MAPPED |
154 | return (pkt_desc __iomem *)(win0base(port_to_card(port)) | 119 | return (pkt_desc __iomem *)(win0base(port_to_card(port)) |
155 | + desc_offset(port, desc, transmit)); | 120 | + desc_offset(port, desc, transmit)); |
156 | #else | 121 | #else |
157 | return (pkt_desc __iomem *)(winbase(port_to_card(port)) | 122 | return (pkt_desc __iomem *)(winbase(port_to_card(port)) |
158 | + desc_offset(port, desc, transmit)); | 123 | + desc_offset(port, desc, transmit)); |
159 | #endif | 124 | #endif |
160 | } | 125 | } |
161 | 126 | ||
162 | 127 | ||
163 | |||
164 | static inline u32 buffer_offset(port_t *port, u16 desc, int transmit) | 128 | static inline u32 buffer_offset(port_t *port, u16 desc, int transmit) |
165 | { | 129 | { |
166 | return port_to_card(port)->buff_offset + | 130 | return port_to_card(port)->buff_offset + |
@@ -186,7 +150,7 @@ static inline void sca_set_carrier(port_t *port) | |||
186 | } | 150 | } |
187 | 151 | ||
188 | 152 | ||
189 | static void sca_init_sync_port(port_t *port) | 153 | static void sca_init_port(port_t *port) |
190 | { | 154 | { |
191 | card_t *card = port_to_card(port); | 155 | card_t *card = port_to_card(port); |
192 | int transmit, i; | 156 | int transmit, i; |
@@ -195,7 +159,7 @@ static void sca_init_sync_port(port_t *port) | |||
195 | port->txin = 0; | 159 | port->txin = 0; |
196 | port->txlast = 0; | 160 | port->txlast = 0; |
197 | 161 | ||
198 | #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) | 162 | #ifndef PAGE0_ALWAYS_MAPPED |
199 | openwin(card, 0); | 163 | openwin(card, 0); |
200 | #endif | 164 | #endif |
201 | 165 | ||
@@ -209,7 +173,7 @@ static void sca_init_sync_port(port_t *port) | |||
209 | u16 chain_off = desc_offset(port, i + 1, transmit); | 173 | u16 chain_off = desc_offset(port, i + 1, transmit); |
210 | u32 buff_off = buffer_offset(port, i, transmit); | 174 | u32 buff_off = buffer_offset(port, i, transmit); |
211 | 175 | ||
212 | writea(chain_off, &desc->cp); | 176 | writew(chain_off, &desc->cp); |
213 | writel(buff_off, &desc->bp); | 177 | writel(buff_off, &desc->bp); |
214 | writew(0, &desc->len); | 178 | writew(0, &desc->len); |
215 | writeb(0, &desc->stat); | 179 | writeb(0, &desc->stat); |
@@ -222,16 +186,14 @@ static void sca_init_sync_port(port_t *port) | |||
222 | sca_out(DCR_ABORT, transmit ? DCR_TX(phy_node(port)) : | 186 | sca_out(DCR_ABORT, transmit ? DCR_TX(phy_node(port)) : |
223 | DCR_RX(phy_node(port)), card); | 187 | DCR_RX(phy_node(port)), card); |
224 | 188 | ||
225 | #ifdef __HD64570_H | ||
226 | sca_out(0, dmac + CPB, card); /* pointer base */ | ||
227 | #endif | ||
228 | /* current desc addr */ | 189 | /* current desc addr */ |
229 | sca_outa(desc_offset(port, 0, transmit), dmac + CDAL, card); | 190 | sca_out(0, dmac + CPB, card); /* pointer base */ |
191 | sca_outw(desc_offset(port, 0, transmit), dmac + CDAL, card); | ||
230 | if (!transmit) | 192 | if (!transmit) |
231 | sca_outa(desc_offset(port, buffs - 1, transmit), | 193 | sca_outw(desc_offset(port, buffs - 1, transmit), |
232 | dmac + EDAL, card); | 194 | dmac + EDAL, card); |
233 | else | 195 | else |
234 | sca_outa(desc_offset(port, 0, transmit), dmac + EDAL, | 196 | sca_outw(desc_offset(port, 0, transmit), dmac + EDAL, |
235 | card); | 197 | card); |
236 | 198 | ||
237 | /* clear frame end interrupt counter */ | 199 | /* clear frame end interrupt counter */ |
@@ -258,7 +220,6 @@ static void sca_init_sync_port(port_t *port) | |||
258 | } | 220 | } |
259 | 221 | ||
260 | 222 | ||
261 | |||
262 | #ifdef NEED_SCA_MSCI_INTR | 223 | #ifdef NEED_SCA_MSCI_INTR |
263 | /* MSCI interrupt service */ | 224 | /* MSCI interrupt service */ |
264 | static inline void sca_msci_intr(port_t *port) | 225 | static inline void sca_msci_intr(port_t *port) |
@@ -282,17 +243,15 @@ static inline void sca_msci_intr(port_t *port) | |||
282 | #endif | 243 | #endif |
283 | 244 | ||
284 | 245 | ||
285 | 246 | static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, | |
286 | static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin) | 247 | u16 rxin) |
287 | { | 248 | { |
288 | struct net_device *dev = port_to_dev(port); | 249 | struct net_device *dev = port_to_dev(port); |
289 | struct sk_buff *skb; | 250 | struct sk_buff *skb; |
290 | u16 len; | 251 | u16 len; |
291 | u32 buff; | 252 | u32 buff; |
292 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
293 | u32 maxlen; | 253 | u32 maxlen; |
294 | u8 page; | 254 | u8 page; |
295 | #endif | ||
296 | 255 | ||
297 | len = readw(&desc->len); | 256 | len = readw(&desc->len); |
298 | skb = dev_alloc_skb(len); | 257 | skb = dev_alloc_skb(len); |
@@ -302,7 +261,6 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1 | |||
302 | } | 261 | } |
303 | 262 | ||
304 | buff = buffer_offset(port, rxin, 0); | 263 | buff = buffer_offset(port, rxin, 0); |
305 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
306 | page = buff / winsize(card); | 264 | page = buff / winsize(card); |
307 | buff = buff % winsize(card); | 265 | buff = buff % winsize(card); |
308 | maxlen = winsize(card) - buff; | 266 | maxlen = winsize(card) - buff; |
@@ -314,12 +272,10 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1 | |||
314 | openwin(card, page + 1); | 272 | openwin(card, page + 1); |
315 | memcpy_fromio(skb->data + maxlen, winbase(card), len - maxlen); | 273 | memcpy_fromio(skb->data + maxlen, winbase(card), len - maxlen); |
316 | } else | 274 | } else |
317 | #endif | 275 | memcpy_fromio(skb->data, winbase(card) + buff, len); |
318 | memcpy_fromio(skb->data, winbase(card) + buff, len); | ||
319 | 276 | ||
320 | #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) | 277 | #ifndef PAGE0_ALWAYS_MAPPED |
321 | /* select pkt_desc table page back */ | 278 | openwin(card, 0); /* select pkt_desc table page back */ |
322 | openwin(card, 0); | ||
323 | #endif | 279 | #endif |
324 | skb_put(skb, len); | 280 | skb_put(skb, len); |
325 | #ifdef DEBUG_PKT | 281 | #ifdef DEBUG_PKT |
@@ -333,7 +289,6 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1 | |||
333 | } | 289 | } |
334 | 290 | ||
335 | 291 | ||
336 | |||
337 | /* Receive DMA interrupt service */ | 292 | /* Receive DMA interrupt service */ |
338 | static inline void sca_rx_intr(port_t *port) | 293 | static inline void sca_rx_intr(port_t *port) |
339 | { | 294 | { |
@@ -353,7 +308,7 @@ static inline void sca_rx_intr(port_t *port) | |||
353 | while (1) { | 308 | while (1) { |
354 | u32 desc_off = desc_offset(port, port->rxin, 0); | 309 | u32 desc_off = desc_offset(port, port->rxin, 0); |
355 | pkt_desc __iomem *desc; | 310 | pkt_desc __iomem *desc; |
356 | u32 cda = sca_ina(dmac + CDAL, card); | 311 | u32 cda = sca_inw(dmac + CDAL, card); |
357 | 312 | ||
358 | if ((cda >= desc_off) && (cda < desc_off + sizeof(pkt_desc))) | 313 | if ((cda >= desc_off) && (cda < desc_off + sizeof(pkt_desc))) |
359 | break; /* No frame received */ | 314 | break; /* No frame received */ |
@@ -377,7 +332,7 @@ static inline void sca_rx_intr(port_t *port) | |||
377 | sca_rx(card, port, desc, port->rxin); | 332 | sca_rx(card, port, desc, port->rxin); |
378 | 333 | ||
379 | /* Set new error descriptor address */ | 334 | /* Set new error descriptor address */ |
380 | sca_outa(desc_off, dmac + EDAL, card); | 335 | sca_outw(desc_off, dmac + EDAL, card); |
381 | port->rxin = next_desc(port, port->rxin, 0); | 336 | port->rxin = next_desc(port, port->rxin, 0); |
382 | } | 337 | } |
383 | 338 | ||
@@ -386,7 +341,6 @@ static inline void sca_rx_intr(port_t *port) | |||
386 | } | 341 | } |
387 | 342 | ||
388 | 343 | ||
389 | |||
390 | /* Transmit DMA interrupt service */ | 344 | /* Transmit DMA interrupt service */ |
391 | static inline void sca_tx_intr(port_t *port) | 345 | static inline void sca_tx_intr(port_t *port) |
392 | { | 346 | { |
@@ -407,7 +361,7 @@ static inline void sca_tx_intr(port_t *port) | |||
407 | pkt_desc __iomem *desc; | 361 | pkt_desc __iomem *desc; |
408 | 362 | ||
409 | u32 desc_off = desc_offset(port, port->txlast, 1); | 363 | u32 desc_off = desc_offset(port, port->txlast, 1); |
410 | u32 cda = sca_ina(dmac + CDAL, card); | 364 | u32 cda = sca_inw(dmac + CDAL, card); |
411 | if ((cda >= desc_off) && (cda < desc_off + sizeof(pkt_desc))) | 365 | if ((cda >= desc_off) && (cda < desc_off + sizeof(pkt_desc))) |
412 | break; /* Transmitter is/will_be sending this frame */ | 366 | break; /* Transmitter is/will_be sending this frame */ |
413 | 367 | ||
@@ -423,17 +377,13 @@ static inline void sca_tx_intr(port_t *port) | |||
423 | } | 377 | } |
424 | 378 | ||
425 | 379 | ||
426 | |||
427 | static irqreturn_t sca_intr(int irq, void* dev_id) | 380 | static irqreturn_t sca_intr(int irq, void* dev_id) |
428 | { | 381 | { |
429 | card_t *card = dev_id; | 382 | card_t *card = dev_id; |
430 | int i; | 383 | int i; |
431 | u8 stat; | 384 | u8 stat; |
432 | int handled = 0; | 385 | int handled = 0; |
433 | |||
434 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
435 | u8 page = sca_get_page(card); | 386 | u8 page = sca_get_page(card); |
436 | #endif | ||
437 | 387 | ||
438 | while((stat = sca_intr_status(card)) != 0) { | 388 | while((stat = sca_intr_status(card)) != 0) { |
439 | handled = 1; | 389 | handled = 1; |
@@ -452,14 +402,11 @@ static irqreturn_t sca_intr(int irq, void* dev_id) | |||
452 | } | 402 | } |
453 | } | 403 | } |
454 | 404 | ||
455 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
456 | openwin(card, page); /* Restore original page */ | 405 | openwin(card, page); /* Restore original page */ |
457 | #endif | ||
458 | return IRQ_RETVAL(handled); | 406 | return IRQ_RETVAL(handled); |
459 | } | 407 | } |
460 | 408 | ||
461 | 409 | ||
462 | |||
463 | static void sca_set_port(port_t *port) | 410 | static void sca_set_port(port_t *port) |
464 | { | 411 | { |
465 | card_t* card = port_to_card(port); | 412 | card_t* card = port_to_card(port); |
@@ -497,12 +444,7 @@ static void sca_set_port(port_t *port) | |||
497 | port->tmc = tmc; | 444 | port->tmc = tmc; |
498 | 445 | ||
499 | /* baud divisor - time constant*/ | 446 | /* baud divisor - time constant*/ |
500 | #ifdef __HD64570_H | ||
501 | sca_out(port->tmc, msci + TMC, card); | 447 | sca_out(port->tmc, msci + TMC, card); |
502 | #else | ||
503 | sca_out(port->tmc, msci + TMCR, card); | ||
504 | sca_out(port->tmc, msci + TMCT, card); | ||
505 | #endif | ||
506 | 448 | ||
507 | /* Set BRG bits */ | 449 | /* Set BRG bits */ |
508 | sca_out(port->rxs, msci + RXS, card); | 450 | sca_out(port->rxs, msci + RXS, card); |
@@ -518,7 +460,6 @@ static void sca_set_port(port_t *port) | |||
518 | } | 460 | } |
519 | 461 | ||
520 | 462 | ||
521 | |||
522 | static void sca_open(struct net_device *dev) | 463 | static void sca_open(struct net_device *dev) |
523 | { | 464 | { |
524 | port_t *port = dev_to_port(dev); | 465 | port_t *port = dev_to_port(dev); |
@@ -540,11 +481,7 @@ static void sca_open(struct net_device *dev) | |||
540 | switch(port->parity) { | 481 | switch(port->parity) { |
541 | case PARITY_CRC16_PR0: md0 = MD0_HDLC | MD0_CRC_16_0; break; | 482 | case PARITY_CRC16_PR0: md0 = MD0_HDLC | MD0_CRC_16_0; break; |
542 | case PARITY_CRC16_PR1: md0 = MD0_HDLC | MD0_CRC_16; break; | 483 | case PARITY_CRC16_PR1: md0 = MD0_HDLC | MD0_CRC_16; break; |
543 | #ifdef __HD64570_H | ||
544 | case PARITY_CRC16_PR0_CCITT: md0 = MD0_HDLC | MD0_CRC_ITU_0; break; | 484 | case PARITY_CRC16_PR0_CCITT: md0 = MD0_HDLC | MD0_CRC_ITU_0; break; |
545 | #else | ||
546 | case PARITY_CRC32_PR1_CCITT: md0 = MD0_HDLC | MD0_CRC_ITU32; break; | ||
547 | #endif | ||
548 | case PARITY_CRC16_PR1_CCITT: md0 = MD0_HDLC | MD0_CRC_ITU; break; | 485 | case PARITY_CRC16_PR1_CCITT: md0 = MD0_HDLC | MD0_CRC_ITU; break; |
549 | default: md0 = MD0_HDLC | MD0_CRC_NONE; | 486 | default: md0 = MD0_HDLC | MD0_CRC_NONE; |
550 | } | 487 | } |
@@ -554,35 +491,20 @@ static void sca_open(struct net_device *dev) | |||
554 | sca_out(0x00, msci + MD1, card); /* no address field check */ | 491 | sca_out(0x00, msci + MD1, card); /* no address field check */ |
555 | sca_out(md2, msci + MD2, card); | 492 | sca_out(md2, msci + MD2, card); |
556 | sca_out(0x7E, msci + IDL, card); /* flag character 0x7E */ | 493 | sca_out(0x7E, msci + IDL, card); /* flag character 0x7E */ |
557 | #ifdef __HD64570_H | ||
558 | sca_out(CTL_IDLE, msci + CTL, card); | 494 | sca_out(CTL_IDLE, msci + CTL, card); |
559 | #else | ||
560 | /* Skip the rest of underrun frame */ | ||
561 | sca_out(CTL_IDLE | CTL_URCT | CTL_URSKP, msci + CTL, card); | ||
562 | #endif | ||
563 | 495 | ||
564 | #ifdef __HD64570_H | ||
565 | /* Allow at least 8 bytes before requesting RX DMA operation */ | 496 | /* Allow at least 8 bytes before requesting RX DMA operation */ |
566 | /* TX with higher priority and possibly with shorter transfers */ | 497 | /* TX with higher priority and possibly with shorter transfers */ |
567 | sca_out(0x07, msci + RRC, card); /* +1=RXRDY/DMA activation condition*/ | 498 | sca_out(0x07, msci + RRC, card); /* +1=RXRDY/DMA activation condition*/ |
568 | sca_out(0x10, msci + TRC0, card); /* = TXRDY/DMA activation condition*/ | 499 | sca_out(0x10, msci + TRC0, card); /* = TXRDY/DMA activation condition*/ |
569 | sca_out(0x14, msci + TRC1, card); /* +1=TXRDY/DMA deactiv condition */ | 500 | sca_out(0x14, msci + TRC1, card); /* +1=TXRDY/DMA deactiv condition */ |
570 | #else | ||
571 | sca_out(0x0F, msci + RNR, card); /* +1=RX DMA activation condition */ | ||
572 | sca_out(0x3C, msci + TFS, card); /* +1 = TX start */ | ||
573 | sca_out(0x38, msci + TCR, card); /* =Critical TX DMA activ condition */ | ||
574 | sca_out(0x38, msci + TNR0, card); /* =TX DMA activation condition */ | ||
575 | sca_out(0x3F, msci + TNR1, card); /* +1=TX DMA deactivation condition*/ | ||
576 | #endif | ||
577 | 501 | ||
578 | /* We're using the following interrupts: | 502 | /* We're using the following interrupts: |
579 | - TXINT (DMAC completed all transmisions, underrun or DCD change) | 503 | - TXINT (DMAC completed all transmisions, underrun or DCD change) |
580 | - all DMA interrupts | 504 | - all DMA interrupts |
581 | */ | 505 | */ |
582 | |||
583 | sca_set_carrier(port); | 506 | sca_set_carrier(port); |
584 | 507 | ||
585 | #ifdef __HD64570_H | ||
586 | /* MSCI TX INT and RX INT A IRQ enable */ | 508 | /* MSCI TX INT and RX INT A IRQ enable */ |
587 | sca_out(IE0_TXINT | IE0_RXINTA, msci + IE0, card); | 509 | sca_out(IE0_TXINT | IE0_RXINTA, msci + IE0, card); |
588 | sca_out(IE1_UDRN | IE1_CDCD, msci + IE1, card); | 510 | sca_out(IE1_UDRN | IE1_CDCD, msci + IE1, card); |
@@ -591,21 +513,8 @@ static void sca_open(struct net_device *dev) | |||
591 | /* enable DMA IRQ */ | 513 | /* enable DMA IRQ */ |
592 | sca_out(sca_in(IER1, card) | (phy_node(port) ? 0xF0 : 0x0F), | 514 | sca_out(sca_in(IER1, card) | (phy_node(port) ? 0xF0 : 0x0F), |
593 | IER1, card); | 515 | IER1, card); |
594 | #else | ||
595 | /* MSCI TXINT and RXINTA interrupt enable */ | ||
596 | sca_outl(IE0_TXINT | IE0_RXINTA | IE0_UDRN | IE0_CDCD, msci + IE0, | ||
597 | card); | ||
598 | /* DMA & MSCI IRQ enable */ | ||
599 | sca_outl(sca_inl(IER0, card) | | ||
600 | (phy_node(port) ? 0x0A006600 : 0x000A0066), IER0, card); | ||
601 | #endif | ||
602 | 516 | ||
603 | #ifdef __HD64570_H | ||
604 | sca_out(port->tmc, msci + TMC, card); /* Restore registers */ | 517 | sca_out(port->tmc, msci + TMC, card); /* Restore registers */ |
605 | #else | ||
606 | sca_out(port->tmc, msci + TMCR, card); | ||
607 | sca_out(port->tmc, msci + TMCT, card); | ||
608 | #endif | ||
609 | sca_out(port->rxs, msci + RXS, card); | 518 | sca_out(port->rxs, msci + RXS, card); |
610 | sca_out(port->txs, msci + TXS, card); | 519 | sca_out(port->txs, msci + TXS, card); |
611 | sca_out(CMD_TX_ENABLE, msci + CMD, card); | 520 | sca_out(CMD_TX_ENABLE, msci + CMD, card); |
@@ -615,7 +524,6 @@ static void sca_open(struct net_device *dev) | |||
615 | } | 524 | } |
616 | 525 | ||
617 | 526 | ||
618 | |||
619 | static void sca_close(struct net_device *dev) | 527 | static void sca_close(struct net_device *dev) |
620 | { | 528 | { |
621 | port_t *port = dev_to_port(dev); | 529 | port_t *port = dev_to_port(dev); |
@@ -623,23 +531,17 @@ static void sca_close(struct net_device *dev) | |||
623 | 531 | ||
624 | /* reset channel */ | 532 | /* reset channel */ |
625 | sca_out(CMD_RESET, get_msci(port) + CMD, port_to_card(port)); | 533 | sca_out(CMD_RESET, get_msci(port) + CMD, port_to_card(port)); |
626 | #ifdef __HD64570_H | ||
627 | /* disable MSCI interrupts */ | 534 | /* disable MSCI interrupts */ |
628 | sca_out(sca_in(IER0, card) & (phy_node(port) ? 0x0F : 0xF0), | 535 | sca_out(sca_in(IER0, card) & (phy_node(port) ? 0x0F : 0xF0), |
629 | IER0, card); | 536 | IER0, card); |
630 | /* disable DMA interrupts */ | 537 | /* disable DMA interrupts */ |
631 | sca_out(sca_in(IER1, card) & (phy_node(port) ? 0x0F : 0xF0), | 538 | sca_out(sca_in(IER1, card) & (phy_node(port) ? 0x0F : 0xF0), |
632 | IER1, card); | 539 | IER1, card); |
633 | #else | 540 | |
634 | /* disable DMA & MSCI IRQ */ | ||
635 | sca_outl(sca_inl(IER0, card) & | ||
636 | (phy_node(port) ? 0x00FF00FF : 0xFF00FF00), IER0, card); | ||
637 | #endif | ||
638 | netif_stop_queue(dev); | 541 | netif_stop_queue(dev); |
639 | } | 542 | } |
640 | 543 | ||
641 | 544 | ||
642 | |||
643 | static int sca_attach(struct net_device *dev, unsigned short encoding, | 545 | static int sca_attach(struct net_device *dev, unsigned short encoding, |
644 | unsigned short parity) | 546 | unsigned short parity) |
645 | { | 547 | { |
@@ -653,11 +555,7 @@ static int sca_attach(struct net_device *dev, unsigned short encoding, | |||
653 | if (parity != PARITY_NONE && | 555 | if (parity != PARITY_NONE && |
654 | parity != PARITY_CRC16_PR0 && | 556 | parity != PARITY_CRC16_PR0 && |
655 | parity != PARITY_CRC16_PR1 && | 557 | parity != PARITY_CRC16_PR1 && |
656 | #ifdef __HD64570_H | ||
657 | parity != PARITY_CRC16_PR0_CCITT && | 558 | parity != PARITY_CRC16_PR0_CCITT && |
658 | #else | ||
659 | parity != PARITY_CRC32_PR1_CCITT && | ||
660 | #endif | ||
661 | parity != PARITY_CRC16_PR1_CCITT) | 559 | parity != PARITY_CRC16_PR1_CCITT) |
662 | return -EINVAL; | 560 | return -EINVAL; |
663 | 561 | ||
@@ -667,34 +565,30 @@ static int sca_attach(struct net_device *dev, unsigned short encoding, | |||
667 | } | 565 | } |
668 | 566 | ||
669 | 567 | ||
670 | |||
671 | #ifdef DEBUG_RINGS | 568 | #ifdef DEBUG_RINGS |
672 | static void sca_dump_rings(struct net_device *dev) | 569 | static void sca_dump_rings(struct net_device *dev) |
673 | { | 570 | { |
674 | port_t *port = dev_to_port(dev); | 571 | port_t *port = dev_to_port(dev); |
675 | card_t *card = port_to_card(port); | 572 | card_t *card = port_to_card(port); |
676 | u16 cnt; | 573 | u16 cnt; |
677 | #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) | 574 | #ifndef PAGE0_ALWAYS_MAPPED |
678 | u8 page; | 575 | u8 page = sca_get_page(card); |
679 | #endif | ||
680 | 576 | ||
681 | #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) | ||
682 | page = sca_get_page(card); | ||
683 | openwin(card, 0); | 577 | openwin(card, 0); |
684 | #endif | 578 | #endif |
685 | 579 | ||
686 | printk(KERN_DEBUG "RX ring: CDA=%u EDA=%u DSR=%02X in=%u %sactive", | 580 | printk(KERN_DEBUG "RX ring: CDA=%u EDA=%u DSR=%02X in=%u %sactive", |
687 | sca_ina(get_dmac_rx(port) + CDAL, card), | 581 | sca_inw(get_dmac_rx(port) + CDAL, card), |
688 | sca_ina(get_dmac_rx(port) + EDAL, card), | 582 | sca_inw(get_dmac_rx(port) + EDAL, card), |
689 | sca_in(DSR_RX(phy_node(port)), card), port->rxin, | 583 | sca_in(DSR_RX(phy_node(port)), card), port->rxin, |
690 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE?"":"in"); | 584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); |
691 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) | 585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) |
692 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
693 | 587 | ||
694 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 588 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
695 | "last=%u %sactive", | 589 | "last=%u %sactive", |
696 | sca_ina(get_dmac_tx(port) + CDAL, card), | 590 | sca_inw(get_dmac_tx(port) + CDAL, card), |
697 | sca_ina(get_dmac_tx(port) + EDAL, card), | 591 | sca_inw(get_dmac_tx(port) + EDAL, card), |
698 | sca_in(DSR_TX(phy_node(port)), card), port->txin, port->txlast, | 592 | sca_in(DSR_TX(phy_node(port)), card), port->txin, port->txlast, |
699 | sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in"); | 593 | sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in"); |
700 | 594 | ||
@@ -702,12 +596,8 @@ static void sca_dump_rings(struct net_device *dev) | |||
702 | printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); | 596 | printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); |
703 | printk("\n"); | 597 | printk("\n"); |
704 | 598 | ||
705 | printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, " | 599 | printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, ST: %02x %02x %02x %02x," |
706 | "ST: %02x %02x %02x %02x" | 600 | " FST: %02x CST: %02x %02x\n", |
707 | #ifdef __HD64572_H | ||
708 | " %02x" | ||
709 | #endif | ||
710 | ", FST: %02x CST: %02x %02x\n", | ||
711 | sca_in(get_msci(port) + MD0, card), | 601 | sca_in(get_msci(port) + MD0, card), |
712 | sca_in(get_msci(port) + MD1, card), | 602 | sca_in(get_msci(port) + MD1, card), |
713 | sca_in(get_msci(port) + MD2, card), | 603 | sca_in(get_msci(port) + MD2, card), |
@@ -715,52 +605,33 @@ static void sca_dump_rings(struct net_device *dev) | |||
715 | sca_in(get_msci(port) + ST1, card), | 605 | sca_in(get_msci(port) + ST1, card), |
716 | sca_in(get_msci(port) + ST2, card), | 606 | sca_in(get_msci(port) + ST2, card), |
717 | sca_in(get_msci(port) + ST3, card), | 607 | sca_in(get_msci(port) + ST3, card), |
718 | #ifdef __HD64572_H | ||
719 | sca_in(get_msci(port) + ST4, card), | ||
720 | #endif | ||
721 | sca_in(get_msci(port) + FST, card), | 608 | sca_in(get_msci(port) + FST, card), |
722 | sca_in(get_msci(port) + CST0, card), | 609 | sca_in(get_msci(port) + CST0, card), |
723 | sca_in(get_msci(port) + CST1, card)); | 610 | sca_in(get_msci(port) + CST1, card)); |
724 | 611 | ||
725 | #ifdef __HD64572_H | ||
726 | printk(KERN_DEBUG "ILAR: %02x ISR: %08x %08x\n", sca_in(ILAR, card), | ||
727 | sca_inl(ISR0, card), sca_inl(ISR1, card)); | ||
728 | #else | ||
729 | printk(KERN_DEBUG "ISR: %02x %02x %02x\n", sca_in(ISR0, card), | 612 | printk(KERN_DEBUG "ISR: %02x %02x %02x\n", sca_in(ISR0, card), |
730 | sca_in(ISR1, card), sca_in(ISR2, card)); | 613 | sca_in(ISR1, card), sca_in(ISR2, card)); |
731 | #endif | ||
732 | 614 | ||
733 | #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) | 615 | #ifndef PAGE0_ALWAYS_MAPPED |
734 | openwin(card, page); /* Restore original page */ | 616 | openwin(card, page); /* Restore original page */ |
735 | #endif | 617 | #endif |
736 | } | 618 | } |
737 | #endif /* DEBUG_RINGS */ | 619 | #endif /* DEBUG_RINGS */ |
738 | 620 | ||
739 | 621 | ||
740 | |||
741 | static int sca_xmit(struct sk_buff *skb, struct net_device *dev) | 622 | static int sca_xmit(struct sk_buff *skb, struct net_device *dev) |
742 | { | 623 | { |
743 | port_t *port = dev_to_port(dev); | 624 | port_t *port = dev_to_port(dev); |
744 | card_t *card = port_to_card(port); | 625 | card_t *card = port_to_card(port); |
745 | pkt_desc __iomem *desc; | 626 | pkt_desc __iomem *desc; |
746 | u32 buff, len; | 627 | u32 buff, len; |
747 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
748 | u8 page; | 628 | u8 page; |
749 | u32 maxlen; | 629 | u32 maxlen; |
750 | #endif | ||
751 | 630 | ||
752 | spin_lock_irq(&port->lock); | 631 | spin_lock_irq(&port->lock); |
753 | 632 | ||
754 | desc = desc_address(port, port->txin + 1, 1); | 633 | desc = desc_address(port, port->txin + 1, 1); |
755 | if (readb(&desc->stat)) { /* allow 1 packet gap */ | 634 | BUG_ON(readb(&desc->stat)); /* previous xmit should stop queue */ |
756 | /* should never happen - previous xmit should stop queue */ | ||
757 | #ifdef DEBUG_PKT | ||
758 | printk(KERN_DEBUG "%s: transmitter buffer full\n", dev->name); | ||
759 | #endif | ||
760 | netif_stop_queue(dev); | ||
761 | spin_unlock_irq(&port->lock); | ||
762 | return 1; /* request packet to be queued */ | ||
763 | } | ||
764 | 635 | ||
765 | #ifdef DEBUG_PKT | 636 | #ifdef DEBUG_PKT |
766 | printk(KERN_DEBUG "%s TX(%i):", dev->name, skb->len); | 637 | printk(KERN_DEBUG "%s TX(%i):", dev->name, skb->len); |
@@ -770,7 +641,6 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev) | |||
770 | desc = desc_address(port, port->txin, 1); | 641 | desc = desc_address(port, port->txin, 1); |
771 | buff = buffer_offset(port, port->txin, 1); | 642 | buff = buffer_offset(port, port->txin, 1); |
772 | len = skb->len; | 643 | len = skb->len; |
773 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
774 | page = buff / winsize(card); | 644 | page = buff / winsize(card); |
775 | buff = buff % winsize(card); | 645 | buff = buff % winsize(card); |
776 | maxlen = winsize(card) - buff; | 646 | maxlen = winsize(card) - buff; |
@@ -780,12 +650,10 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev) | |||
780 | memcpy_toio(winbase(card) + buff, skb->data, maxlen); | 650 | memcpy_toio(winbase(card) + buff, skb->data, maxlen); |
781 | openwin(card, page + 1); | 651 | openwin(card, page + 1); |
782 | memcpy_toio(winbase(card), skb->data + maxlen, len - maxlen); | 652 | memcpy_toio(winbase(card), skb->data + maxlen, len - maxlen); |
783 | } | 653 | } else |
784 | else | ||
785 | #endif | ||
786 | memcpy_toio(winbase(card) + buff, skb->data, len); | 654 | memcpy_toio(winbase(card) + buff, skb->data, len); |
787 | 655 | ||
788 | #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) | 656 | #ifndef PAGE0_ALWAYS_MAPPED |
789 | openwin(card, 0); /* select pkt_desc table page back */ | 657 | openwin(card, 0); /* select pkt_desc table page back */ |
790 | #endif | 658 | #endif |
791 | writew(len, &desc->len); | 659 | writew(len, &desc->len); |
@@ -793,7 +661,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev) | |||
793 | dev->trans_start = jiffies; | 661 | dev->trans_start = jiffies; |
794 | 662 | ||
795 | port->txin = next_desc(port, port->txin, 1); | 663 | port->txin = next_desc(port, port->txin, 1); |
796 | sca_outa(desc_offset(port, port->txin, 1), | 664 | sca_outw(desc_offset(port, port->txin, 1), |
797 | get_dmac_tx(port) + EDAL, card); | 665 | get_dmac_tx(port) + EDAL, card); |
798 | 666 | ||
799 | sca_out(DSR_DE, DSR_TX(phy_node(port)), card); /* Enable TX DMA */ | 667 | sca_out(DSR_DE, DSR_TX(phy_node(port)), card); /* Enable TX DMA */ |
@@ -809,40 +677,29 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev) | |||
809 | } | 677 | } |
810 | 678 | ||
811 | 679 | ||
812 | |||
813 | #ifdef NEED_DETECT_RAM | 680 | #ifdef NEED_DETECT_RAM |
814 | static u32 __devinit sca_detect_ram(card_t *card, u8 __iomem *rambase, u32 ramsize) | 681 | static u32 __devinit sca_detect_ram(card_t *card, u8 __iomem *rambase, |
682 | u32 ramsize) | ||
815 | { | 683 | { |
816 | /* Round RAM size to 32 bits, fill from end to start */ | 684 | /* Round RAM size to 32 bits, fill from end to start */ |
817 | u32 i = ramsize &= ~3; | 685 | u32 i = ramsize &= ~3; |
818 | |||
819 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
820 | u32 size = winsize(card); | 686 | u32 size = winsize(card); |
821 | 687 | ||
822 | openwin(card, (i - 4) / size); /* select last window */ | 688 | openwin(card, (i - 4) / size); /* select last window */ |
823 | #endif | 689 | |
824 | do { | 690 | do { |
825 | i -= 4; | 691 | i -= 4; |
826 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
827 | if ((i + 4) % size == 0) | 692 | if ((i + 4) % size == 0) |
828 | openwin(card, i / size); | 693 | openwin(card, i / size); |
829 | writel(i ^ 0x12345678, rambase + i % size); | 694 | writel(i ^ 0x12345678, rambase + i % size); |
830 | #else | 695 | } while (i > 0); |
831 | writel(i ^ 0x12345678, rambase + i); | ||
832 | #endif | ||
833 | }while (i > 0); | ||
834 | 696 | ||
835 | for (i = 0; i < ramsize ; i += 4) { | 697 | for (i = 0; i < ramsize ; i += 4) { |
836 | #ifndef ALL_PAGES_ALWAYS_MAPPED | ||
837 | if (i % size == 0) | 698 | if (i % size == 0) |
838 | openwin(card, i / size); | 699 | openwin(card, i / size); |
839 | 700 | ||
840 | if (readl(rambase + i % size) != (i ^ 0x12345678)) | 701 | if (readl(rambase + i % size) != (i ^ 0x12345678)) |
841 | break; | 702 | break; |
842 | #else | ||
843 | if (readl(rambase + i) != (i ^ 0x12345678)) | ||
844 | break; | ||
845 | #endif | ||
846 | } | 703 | } |
847 | 704 | ||
848 | return i; | 705 | return i; |
@@ -850,7 +707,6 @@ static u32 __devinit sca_detect_ram(card_t *card, u8 __iomem *rambase, u32 ramsi | |||
850 | #endif /* NEED_DETECT_RAM */ | 707 | #endif /* NEED_DETECT_RAM */ |
851 | 708 | ||
852 | 709 | ||
853 | |||
854 | static void __devinit sca_init(card_t *card, int wait_states) | 710 | static void __devinit sca_init(card_t *card, int wait_states) |
855 | { | 711 | { |
856 | sca_out(wait_states, WCRL, card); /* Wait Control */ | 712 | sca_out(wait_states, WCRL, card); /* Wait Control */ |
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index 5b9cd2d561ca..697715ae80f4 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c | |||
@@ -53,7 +53,7 @@ static const char* devname = "RISCom/N2"; | |||
53 | #define NEED_SCA_MSCI_INTR | 53 | #define NEED_SCA_MSCI_INTR |
54 | #define MAX_TX_BUFFERS 10 | 54 | #define MAX_TX_BUFFERS 10 |
55 | 55 | ||
56 | static char *hw = NULL; /* pointer to hw=xxx command line string */ | 56 | static char *hw; /* pointer to hw=xxx command line string */ |
57 | 57 | ||
58 | /* RISCom/N2 Board Registers */ | 58 | /* RISCom/N2 Board Registers */ |
59 | 59 | ||
@@ -145,7 +145,6 @@ static card_t **new_card = &first_card; | |||
145 | &(card)->ports[port] : NULL) | 145 | &(card)->ports[port] : NULL) |
146 | 146 | ||
147 | 147 | ||
148 | |||
149 | static __inline__ u8 sca_get_page(card_t *card) | 148 | static __inline__ u8 sca_get_page(card_t *card) |
150 | { | 149 | { |
151 | return inb(card->io + N2_PSR) & PSR_PAGEBITS; | 150 | return inb(card->io + N2_PSR) & PSR_PAGEBITS; |
@@ -159,11 +158,9 @@ static __inline__ void openwin(card_t *card, u8 page) | |||
159 | } | 158 | } |
160 | 159 | ||
161 | 160 | ||
162 | |||
163 | #include "hd64570.c" | 161 | #include "hd64570.c" |
164 | 162 | ||
165 | 163 | ||
166 | |||
167 | static void n2_set_iface(port_t *port) | 164 | static void n2_set_iface(port_t *port) |
168 | { | 165 | { |
169 | card_t *card = port->card; | 166 | card_t *card = port->card; |
@@ -478,7 +475,7 @@ static int __init n2_run(unsigned long io, unsigned long irq, | |||
478 | n2_destroy_card(card); | 475 | n2_destroy_card(card); |
479 | return -ENOBUFS; | 476 | return -ENOBUFS; |
480 | } | 477 | } |
481 | sca_init_sync_port(port); /* Set up SCA memory */ | 478 | sca_init_port(port); /* Set up SCA memory */ |
482 | 479 | ||
483 | printk(KERN_INFO "%s: RISCom/N2 node %d\n", | 480 | printk(KERN_INFO "%s: RISCom/N2 node %d\n", |
484 | dev->name, port->phy_node); | 481 | dev->name, port->phy_node); |