aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/hd64572.c
diff options
context:
space:
mode:
authorKrzysztof Hałasa <khc@pm.waw.pl>2008-07-09 17:13:49 -0400
committerKrzysztof Hałasa <khc@pm.waw.pl>2008-11-21 20:49:48 -0500
commit61e0a6a268947f7385282c6841f3e3d64b4c5cb9 (patch)
tree86a9ee7c3eb2028fe1589df5a94091b153fb273a /drivers/net/wan/hd64572.c
parent967834361a4beb3bbd3069189c192dc6fdeef8a9 (diff)
WAN: Simplify HD64572 drivers.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers/net/wan/hd64572.c')
-rw-r--r--drivers/net/wan/hd64572.c139
1 files changed, 70 insertions, 69 deletions
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c
index 46a99a668e41..c7eff0a66a8e 100644
--- a/drivers/net/wan/hd64572.c
+++ b/drivers/net/wan/hd64572.c
@@ -11,13 +11,13 @@
11 * 11 *
12 * We use the following SCA memory map: 12 * We use the following SCA memory map:
13 * 13 *
14 * Packet buffer descriptor rings - starting from winbase or win0base: 14 * Packet buffer descriptor rings - starting from card->rambase:
15 * rx_ring_buffers * sizeof(pkt_desc) = logical channel #0 RX ring 15 * rx_ring_buffers * sizeof(pkt_desc) = logical channel #0 RX ring
16 * tx_ring_buffers * sizeof(pkt_desc) = logical channel #0 TX ring 16 * tx_ring_buffers * sizeof(pkt_desc) = logical channel #0 TX ring
17 * rx_ring_buffers * sizeof(pkt_desc) = logical channel #1 RX ring (if used) 17 * rx_ring_buffers * sizeof(pkt_desc) = logical channel #1 RX ring (if used)
18 * tx_ring_buffers * sizeof(pkt_desc) = logical channel #1 TX ring (if used) 18 * tx_ring_buffers * sizeof(pkt_desc) = logical channel #1 TX ring (if used)
19 * 19 *
20 * Packet data buffers - starting from winbase + buff_offset: 20 * Packet data buffers - starting from card->rambase + buff_offset:
21 * rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers 21 * rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers
22 * tx_ring_buffers * HDLC_MAX_MRU = logical channel #0 TX buffers 22 * tx_ring_buffers * HDLC_MAX_MRU = logical channel #0 TX buffers
23 * rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers (if used) 23 * rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers (if used)
@@ -47,16 +47,18 @@
47 47
48#define NAPI_WEIGHT 16 48#define NAPI_WEIGHT 16
49 49
50#define get_msci(port) (phy_node(port) ? MSCI1_OFFSET : MSCI0_OFFSET) 50#define get_msci(port) (port->chan ? MSCI1_OFFSET : MSCI0_OFFSET)
51#define get_dmac_rx(port) (phy_node(port) ? DMAC1RX_OFFSET : DMAC0RX_OFFSET) 51#define get_dmac_rx(port) (port->chan ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)
52#define get_dmac_tx(port) (phy_node(port) ? DMAC1TX_OFFSET : DMAC0TX_OFFSET) 52#define get_dmac_tx(port) (port->chan ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)
53 53
54static int sca_poll(struct napi_struct *napi, int budget); 54#define sca_in(reg, card) readb(card->scabase + (reg))
55#define sca_out(value, reg, card) writeb(value, card->scabase + (reg))
56#define sca_inw(reg, card) readw(card->scabase + (reg))
57#define sca_outw(value, reg, card) writew(value, card->scabase + (reg))
58#define sca_inl(reg, card) readl(card->scabase + (reg))
59#define sca_outl(value, reg, card) writel(value, card->scabase + (reg))
55 60
56static inline struct net_device *port_to_dev(port_t *port) 61static int sca_poll(struct napi_struct *napi, int budget);
57{
58 return port->dev;
59}
60 62
61static inline port_t* dev_to_port(struct net_device *dev) 63static inline port_t* dev_to_port(struct net_device *dev)
62{ 64{
@@ -67,30 +69,29 @@ static inline void enable_intr(port_t *port)
67{ 69{
68 /* enable DMIB and MSCI RXINTA interrupts */ 70 /* enable DMIB and MSCI RXINTA interrupts */
69 sca_outl(sca_inl(IER0, port->card) | 71 sca_outl(sca_inl(IER0, port->card) |
70 (phy_node(port) ? 0x08002200 : 0x00080022), IER0, port->card); 72 (port->chan ? 0x08002200 : 0x00080022), IER0, port->card);
71} 73}
72 74
73static inline void disable_intr(port_t *port) 75static inline void disable_intr(port_t *port)
74{ 76{
75 sca_outl(sca_inl(IER0, port->card) & 77 sca_outl(sca_inl(IER0, port->card) &
76 (phy_node(port) ? 0x00FF00FF : 0xFF00FF00), IER0, port->card); 78 (port->chan ? 0x00FF00FF : 0xFF00FF00), IER0, port->card);
77} 79}
78 80
79static inline u16 next_desc(port_t *port, u16 desc, int transmit) 81static inline u16 next_desc(port_t *port, u16 desc, int transmit)
80{ 82{
81 return (desc + 1) % (transmit ? port_to_card(port)->tx_ring_buffers 83 return (desc + 1) % (transmit ? port->card->tx_ring_buffers
82 : port_to_card(port)->rx_ring_buffers); 84 : port->card->rx_ring_buffers);
83} 85}
84 86
85 87
86static inline u16 desc_abs_number(port_t *port, u16 desc, int transmit) 88static inline u16 desc_abs_number(port_t *port, u16 desc, int transmit)
87{ 89{
88 u16 rx_buffs = port_to_card(port)->rx_ring_buffers; 90 u16 rx_buffs = port->card->rx_ring_buffers;
89 u16 tx_buffs = port_to_card(port)->tx_ring_buffers; 91 u16 tx_buffs = port->card->tx_ring_buffers;
90 92
91 desc %= (transmit ? tx_buffs : rx_buffs); // called with "X + 1" etc. 93 desc %= (transmit ? tx_buffs : rx_buffs); // called with "X + 1" etc.
92 return log_node(port) * (rx_buffs + tx_buffs) + 94 return port->chan * (rx_buffs + tx_buffs) + transmit * rx_buffs + desc;
93 transmit * rx_buffs + desc;
94} 95}
95 96
96 97
@@ -104,39 +105,39 @@ static inline u16 desc_offset(port_t *port, u16 desc, int transmit)
104static inline pkt_desc __iomem *desc_address(port_t *port, u16 desc, 105static inline pkt_desc __iomem *desc_address(port_t *port, u16 desc,
105 int transmit) 106 int transmit)
106{ 107{
107 return (pkt_desc __iomem *)(winbase(port_to_card(port)) 108 return (pkt_desc __iomem *)(port->card->rambase +
108 + desc_offset(port, desc, transmit)); 109 desc_offset(port, desc, transmit));
109} 110}
110 111
111 112
112static inline u32 buffer_offset(port_t *port, u16 desc, int transmit) 113static inline u32 buffer_offset(port_t *port, u16 desc, int transmit)
113{ 114{
114 return port_to_card(port)->buff_offset + 115 return port->card->buff_offset +
115 desc_abs_number(port, desc, transmit) * (u32)HDLC_MAX_MRU; 116 desc_abs_number(port, desc, transmit) * (u32)HDLC_MAX_MRU;
116} 117}
117 118
118 119
119static inline void sca_set_carrier(port_t *port) 120static inline void sca_set_carrier(port_t *port)
120{ 121{
121 if (!(sca_in(get_msci(port) + ST3, port_to_card(port)) & ST3_DCD)) { 122 if (!(sca_in(get_msci(port) + ST3, port->card) & ST3_DCD)) {
122#ifdef DEBUG_LINK 123#ifdef DEBUG_LINK
123 printk(KERN_DEBUG "%s: sca_set_carrier on\n", 124 printk(KERN_DEBUG "%s: sca_set_carrier on\n",
124 port_to_dev(port)->name); 125 port->netdev.name);
125#endif 126#endif
126 netif_carrier_on(port_to_dev(port)); 127 netif_carrier_on(port->netdev);
127 } else { 128 } else {
128#ifdef DEBUG_LINK 129#ifdef DEBUG_LINK
129 printk(KERN_DEBUG "%s: sca_set_carrier off\n", 130 printk(KERN_DEBUG "%s: sca_set_carrier off\n",
130 port_to_dev(port)->name); 131 port->netdev.name);
131#endif 132#endif
132 netif_carrier_off(port_to_dev(port)); 133 netif_carrier_off(port->netdev);
133 } 134 }
134} 135}
135 136
136 137
137static void sca_init_port(port_t *port) 138static void sca_init_port(port_t *port)
138{ 139{
139 card_t *card = port_to_card(port); 140 card_t *card = port->card;
140 int transmit, i; 141 int transmit, i;
141 142
142 port->rxin = 0; 143 port->rxin = 0;
@@ -160,11 +161,11 @@ static void sca_init_port(port_t *port)
160 } 161 }
161 162
162 /* DMA disable - to halt state */ 163 /* DMA disable - to halt state */
163 sca_out(0, transmit ? DSR_TX(phy_node(port)) : 164 sca_out(0, transmit ? DSR_TX(port->chan) :
164 DSR_RX(phy_node(port)), card); 165 DSR_RX(port->chan), card);
165 /* software ABORT - to initial state */ 166 /* software ABORT - to initial state */
166 sca_out(DCR_ABORT, transmit ? DCR_TX(phy_node(port)) : 167 sca_out(DCR_ABORT, transmit ? DCR_TX(port->chan) :
167 DCR_RX(phy_node(port)), card); 168 DCR_RX(port->chan), card);
168 169
169 /* current desc addr */ 170 /* current desc addr */
170 sca_outl(desc_offset(port, 0, transmit), dmac + CDAL, card); 171 sca_outl(desc_offset(port, 0, transmit), dmac + CDAL, card);
@@ -176,26 +177,26 @@ static void sca_init_port(port_t *port)
176 card); 177 card);
177 178
178 /* clear frame end interrupt counter */ 179 /* clear frame end interrupt counter */
179 sca_out(DCR_CLEAR_EOF, transmit ? DCR_TX(phy_node(port)) : 180 sca_out(DCR_CLEAR_EOF, transmit ? DCR_TX(port->chan) :
180 DCR_RX(phy_node(port)), card); 181 DCR_RX(port->chan), card);
181 182
182 if (!transmit) { /* Receive */ 183 if (!transmit) { /* Receive */
183 /* set buffer length */ 184 /* set buffer length */
184 sca_outw(HDLC_MAX_MRU, dmac + BFLL, card); 185 sca_outw(HDLC_MAX_MRU, dmac + BFLL, card);
185 /* Chain mode, Multi-frame */ 186 /* Chain mode, Multi-frame */
186 sca_out(0x14, DMR_RX(phy_node(port)), card); 187 sca_out(0x14, DMR_RX(port->chan), card);
187 sca_out(DIR_EOME, DIR_RX(phy_node(port)), card); 188 sca_out(DIR_EOME, DIR_RX(port->chan), card);
188 /* DMA enable */ 189 /* DMA enable */
189 sca_out(DSR_DE, DSR_RX(phy_node(port)), card); 190 sca_out(DSR_DE, DSR_RX(port->chan), card);
190 } else { /* Transmit */ 191 } else { /* Transmit */
191 /* Chain mode, Multi-frame */ 192 /* Chain mode, Multi-frame */
192 sca_out(0x14, DMR_TX(phy_node(port)), card); 193 sca_out(0x14, DMR_TX(port->chan), card);
193 /* enable underflow interrupts */ 194 /* enable underflow interrupts */
194 sca_out(DIR_EOME, DIR_TX(phy_node(port)), card); 195 sca_out(DIR_EOME, DIR_TX(port->chan), card);
195 } 196 }
196 } 197 }
197 sca_set_carrier(port); 198 sca_set_carrier(port);
198 netif_napi_add(port_to_dev(port), &port->napi, sca_poll, NAPI_WEIGHT); 199 netif_napi_add(port->netdev, &port->napi, sca_poll, NAPI_WEIGHT);
199} 200}
200 201
201 202
@@ -203,7 +204,7 @@ static void sca_init_port(port_t *port)
203static inline void sca_msci_intr(port_t *port) 204static inline void sca_msci_intr(port_t *port)
204{ 205{
205 u16 msci = get_msci(port); 206 u16 msci = get_msci(port);
206 card_t* card = port_to_card(port); 207 card_t* card = port->card;
207 208
208 if (sca_in(msci + ST1, card) & ST1_CDCD) { 209 if (sca_in(msci + ST1, card) & ST1_CDCD) {
209 /* Reset MSCI CDCD status bit */ 210 /* Reset MSCI CDCD status bit */
@@ -216,7 +217,7 @@ static inline void sca_msci_intr(port_t *port)
216static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, 217static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
217 u16 rxin) 218 u16 rxin)
218{ 219{
219 struct net_device *dev = port_to_dev(port); 220 struct net_device *dev = port->netdev;
220 struct sk_buff *skb; 221 struct sk_buff *skb;
221 u16 len; 222 u16 len;
222 u32 buff; 223 u32 buff;
@@ -229,7 +230,7 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
229 } 230 }
230 231
231 buff = buffer_offset(port, rxin, 0); 232 buff = buffer_offset(port, rxin, 0);
232 memcpy_fromio(skb->data, winbase(card) + buff, len); 233 memcpy_fromio(skb->data, card->rambase + buff, len);
233 234
234 skb_put(skb, len); 235 skb_put(skb, len);
235#ifdef DEBUG_PKT 236#ifdef DEBUG_PKT
@@ -246,15 +247,15 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
246/* Receive DMA service */ 247/* Receive DMA service */
247static inline int sca_rx_done(port_t *port, int budget) 248static inline int sca_rx_done(port_t *port, int budget)
248{ 249{
249 struct net_device *dev = port_to_dev(port); 250 struct net_device *dev = port->netdev;
250 u16 dmac = get_dmac_rx(port); 251 u16 dmac = get_dmac_rx(port);
251 card_t *card = port_to_card(port); 252 card_t *card = port->card;
252 u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */ 253 u8 stat = sca_in(DSR_RX(port->chan), card); /* read DMA Status */
253 int received = 0; 254 int received = 0;
254 255
255 /* Reset DSR status bits */ 256 /* Reset DSR status bits */
256 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, 257 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE,
257 DSR_RX(phy_node(port)), card); 258 DSR_RX(port->chan), card);
258 259
259 if (stat & DSR_BOF) 260 if (stat & DSR_BOF)
260 /* Dropped one or more frames */ 261 /* Dropped one or more frames */
@@ -294,7 +295,7 @@ static inline int sca_rx_done(port_t *port, int budget)
294 } 295 }
295 296
296 /* make sure RX DMA is enabled */ 297 /* make sure RX DMA is enabled */
297 sca_out(DSR_DE, DSR_RX(phy_node(port)), card); 298 sca_out(DSR_DE, DSR_RX(port->chan), card);
298 return received; 299 return received;
299} 300}
300 301
@@ -302,17 +303,17 @@ static inline int sca_rx_done(port_t *port, int budget)
302/* Transmit DMA service */ 303/* Transmit DMA service */
303static inline void sca_tx_done(port_t *port) 304static inline void sca_tx_done(port_t *port)
304{ 305{
305 struct net_device *dev = port_to_dev(port); 306 struct net_device *dev = port->netdev;
306 card_t* card = port_to_card(port); 307 card_t* card = port->card;
307 u8 stat; 308 u8 stat;
308 309
309 spin_lock(&port->lock); 310 spin_lock(&port->lock);
310 311
311 stat = sca_in(DSR_TX(phy_node(port)), card); /* read DMA Status */ 312 stat = sca_in(DSR_TX(port->chan), card); /* read DMA Status */
312 313
313 /* Reset DSR status bits */ 314 /* Reset DSR status bits */
314 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, 315 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE,
315 DSR_TX(phy_node(port)), card); 316 DSR_TX(port->chan), card);
316 317
317 while (1) { 318 while (1) {
318 pkt_desc __iomem *desc = desc_address(port, port->txlast, 1); 319 pkt_desc __iomem *desc = desc_address(port, port->txlast, 1);
@@ -342,17 +343,17 @@ static int sca_poll(struct napi_struct *napi, int budget)
342 u32 isr0 = sca_inl(ISR0, port->card); 343 u32 isr0 = sca_inl(ISR0, port->card);
343 int received = 0; 344 int received = 0;
344 345
345 if (isr0 & (port->phy_node ? 0x08000000 : 0x00080000)) 346 if (isr0 & (port->chan ? 0x08000000 : 0x00080000))
346 sca_msci_intr(port); 347 sca_msci_intr(port);
347 348
348 if (isr0 & (port->phy_node ? 0x00002000 : 0x00000020)) 349 if (isr0 & (port->chan ? 0x00002000 : 0x00000020))
349 sca_tx_done(port); 350 sca_tx_done(port);
350 351
351 if (isr0 & (port->phy_node ? 0x00000200 : 0x00000002)) 352 if (isr0 & (port->chan ? 0x00000200 : 0x00000002))
352 received = sca_rx_done(port, budget); 353 received = sca_rx_done(port, budget);
353 354
354 if (received < budget) { 355 if (received < budget) {
355 netif_rx_complete(port->dev, napi); 356 netif_rx_complete(port->netdev, napi);
356 enable_intr(port); 357 enable_intr(port);
357 } 358 }
358 359
@@ -370,7 +371,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
370 if (port && (isr0 & (i ? 0x08002200 : 0x00080022))) { 371 if (port && (isr0 & (i ? 0x08002200 : 0x00080022))) {
371 handled = 1; 372 handled = 1;
372 disable_intr(port); 373 disable_intr(port);
373 netif_rx_schedule(port->dev, &port->napi); 374 netif_rx_schedule(port->netdev, &port->napi);
374 } 375 }
375 } 376 }
376 377
@@ -380,7 +381,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
380 381
381static void sca_set_port(port_t *port) 382static void sca_set_port(port_t *port)
382{ 383{
383 card_t* card = port_to_card(port); 384 card_t* card = port->card;
384 u16 msci = get_msci(port); 385 u16 msci = get_msci(port);
385 u8 md2 = sca_in(msci + MD2, card); 386 u8 md2 = sca_in(msci + MD2, card);
386 unsigned int tmc, br = 10, brv = 1024; 387 unsigned int tmc, br = 10, brv = 1024;
@@ -435,7 +436,7 @@ static void sca_set_port(port_t *port)
435static void sca_open(struct net_device *dev) 436static void sca_open(struct net_device *dev)
436{ 437{
437 port_t *port = dev_to_port(dev); 438 port_t *port = dev_to_port(dev);
438 card_t* card = port_to_card(port); 439 card_t* card = port->card;
439 u16 msci = get_msci(port); 440 u16 msci = get_msci(port);
440 u8 md0, md2; 441 u8 md0, md2;
441 442
@@ -496,7 +497,7 @@ static void sca_close(struct net_device *dev)
496 port_t *port = dev_to_port(dev); 497 port_t *port = dev_to_port(dev);
497 498
498 /* reset channel */ 499 /* reset channel */
499 sca_out(CMD_RESET, get_msci(port) + CMD, port_to_card(port)); 500 sca_out(CMD_RESET, get_msci(port) + CMD, port->card);
500 disable_intr(port); 501 disable_intr(port);
501 napi_disable(&port->napi); 502 napi_disable(&port->napi);
502 netif_stop_queue(dev); 503 netif_stop_queue(dev);
@@ -530,25 +531,25 @@ static int sca_attach(struct net_device *dev, unsigned short encoding,
530static void sca_dump_rings(struct net_device *dev) 531static void sca_dump_rings(struct net_device *dev)
531{ 532{
532 port_t *port = dev_to_port(dev); 533 port_t *port = dev_to_port(dev);
533 card_t *card = port_to_card(port); 534 card_t *card = port->card;
534 u16 cnt; 535 u16 cnt;
535 536
536 printk(KERN_DEBUG "RX ring: CDA=%u EDA=%u DSR=%02X in=%u %sactive", 537 printk(KERN_DEBUG "RX ring: CDA=%u EDA=%u DSR=%02X in=%u %sactive",
537 sca_inl(get_dmac_rx(port) + CDAL, card), 538 sca_inl(get_dmac_rx(port) + CDAL, card),
538 sca_inl(get_dmac_rx(port) + EDAL, card), 539 sca_inl(get_dmac_rx(port) + EDAL, card),
539 sca_in(DSR_RX(phy_node(port)), card), port->rxin, 540 sca_in(DSR_RX(port->chan), card), port->rxin,
540 sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); 541 sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in");
541 for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) 542 for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++)
542 printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); 543 printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
543 544
544 printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " 545 printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
545 "last=%u %sactive", 546 "last=%u %sactive",
546 sca_inl(get_dmac_tx(port) + CDAL, card), 547 sca_inl(get_dmac_tx(port) + CDAL, card),
547 sca_inl(get_dmac_tx(port) + EDAL, card), 548 sca_inl(get_dmac_tx(port) + EDAL, card),
548 sca_in(DSR_TX(phy_node(port)), card), port->txin, port->txlast, 549 sca_in(DSR_TX(port->chan), card), port->txin, port->txlast,
549 sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in"); 550 sca_in(DSR_TX(port->chan), card) & DSR_DE ? "" : "in");
550 551
551 for (cnt = 0; cnt < port_to_card(port)->tx_ring_buffers; cnt++) 552 for (cnt = 0; cnt < port->card->tx_ring_buffers; cnt++)
552 printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); 553 printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
553 printk("\n"); 554 printk("\n");
554 555
@@ -575,7 +576,7 @@ static void sca_dump_rings(struct net_device *dev)
575static int sca_xmit(struct sk_buff *skb, struct net_device *dev) 576static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
576{ 577{
577 port_t *port = dev_to_port(dev); 578 port_t *port = dev_to_port(dev);
578 card_t *card = port_to_card(port); 579 card_t *card = port->card;
579 pkt_desc __iomem *desc; 580 pkt_desc __iomem *desc;
580 u32 buff, len; 581 u32 buff, len;
581 582
@@ -592,7 +593,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
592 desc = desc_address(port, port->txin, 1); 593 desc = desc_address(port, port->txin, 1);
593 buff = buffer_offset(port, port->txin, 1); 594 buff = buffer_offset(port, port->txin, 1);
594 len = skb->len; 595 len = skb->len;
595 memcpy_toio(winbase(card) + buff, skb->data, len); 596 memcpy_toio(card->rambase + buff, skb->data, len);
596 597
597 writew(len, &desc->len); 598 writew(len, &desc->len);
598 writeb(ST_TX_EOM, &desc->stat); 599 writeb(ST_TX_EOM, &desc->stat);
@@ -602,7 +603,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
602 sca_outl(desc_offset(port, port->txin, 1), 603 sca_outl(desc_offset(port, port->txin, 1),
603 get_dmac_tx(port) + EDAL, card); 604 get_dmac_tx(port) + EDAL, card);
604 605
605 sca_out(DSR_DE, DSR_TX(phy_node(port)), card); /* Enable TX DMA */ 606 sca_out(DSR_DE, DSR_TX(port->chan), card); /* Enable TX DMA */
606 607
607 desc = desc_address(port, port->txin + 1, 1); 608 desc = desc_address(port, port->txin + 1, 1);
608 if (readb(&desc->stat)) /* allow 1 packet gap */ 609 if (readb(&desc->stat)) /* allow 1 packet gap */