aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Hałasa <khc@pm.waw.pl>2008-07-10 18:13:09 -0400
committerKrzysztof Hałasa <khc@pm.waw.pl>2008-11-21 20:49:48 -0500
commite1f024eb5d88e5b4f8e58e99c95082c342f70a1a (patch)
treeb00e6151af79d9ce4e4a90dfc5c3edae14b1eba8 /drivers
parentfcfe9ff3e2fb2b9606e2e375f34c157271b4555c (diff)
WAN: Simplify sca_init_port() in HD64572 driver.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wan/hd64572.c67
1 files changed, 31 insertions, 36 deletions
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c
index 1de3cb7371a7..0bcc0b5f22d7 100644
--- a/drivers/net/wan/hd64572.c
+++ b/drivers/net/wan/hd64572.c
@@ -131,6 +131,7 @@ static inline void sca_set_carrier(port_t *port)
131static void sca_init_port(port_t *port) 131static void sca_init_port(port_t *port)
132{ 132{
133 card_t *card = port->card; 133 card_t *card = port->card;
134 u16 dmac_rx = get_dmac_rx(port), dmac_tx = get_dmac_tx(port);
134 int transmit, i; 135 int transmit, i;
135 136
136 port->rxin = 0; 137 port->rxin = 0;
@@ -138,7 +139,6 @@ static void sca_init_port(port_t *port)
138 port->txlast = 0; 139 port->txlast = 0;
139 140
140 for (transmit = 0; transmit < 2; transmit++) { 141 for (transmit = 0; transmit < 2; transmit++) {
141 u16 dmac = transmit ? get_dmac_tx(port) : get_dmac_rx(port);
142 u16 buffs = transmit ? card->tx_ring_buffers 142 u16 buffs = transmit ? card->tx_ring_buffers
143 : card->rx_ring_buffers; 143 : card->rx_ring_buffers;
144 144
@@ -152,42 +152,37 @@ static void sca_init_port(port_t *port)
152 writew(0, &desc->len); 152 writew(0, &desc->len);
153 writeb(0, &desc->stat); 153 writeb(0, &desc->stat);
154 } 154 }
155
156 /* DMA disable - to halt state */
157 sca_out(0, transmit ? DSR_TX(port->chan) :
158 DSR_RX(port->chan), card);
159 /* software ABORT - to initial state */
160 sca_out(DCR_ABORT, transmit ? DCR_TX(port->chan) :
161 DCR_RX(port->chan), card);
162
163 /* current desc addr */
164 sca_outl(desc_offset(port, 0, transmit), dmac + CDAL, card);
165 if (!transmit)
166 sca_outl(desc_offset(port, buffs - 1, transmit),
167 dmac + EDAL, card);
168 else
169 sca_outl(desc_offset(port, 0, transmit), dmac + EDAL,
170 card);
171
172 /* clear frame end interrupt counter */
173 sca_out(DCR_CLEAR_EOF, transmit ? DCR_TX(port->chan) :
174 DCR_RX(port->chan), card);
175
176 if (!transmit) { /* Receive */
177 /* set buffer length */
178 sca_outw(HDLC_MAX_MRU, dmac + BFLL, card);
179 /* Chain mode, Multi-frame */
180 sca_out(0x14, DMR_RX(port->chan), card);
181 sca_out(DIR_EOME, DIR_RX(port->chan), card);
182 /* DMA enable */
183 sca_out(DSR_DE, DSR_RX(port->chan), card);
184 } else { /* Transmit */
185 /* Chain mode, Multi-frame */
186 sca_out(0x14, DMR_TX(port->chan), card);
187 /* enable underflow interrupts */
188 sca_out(DIR_EOME, DIR_TX(port->chan), card);
189 }
190 } 155 }
156
157 /* DMA disable - to halt state */
158 sca_out(0, DSR_RX(port->chan), card);
159 sca_out(0, DSR_TX(port->chan), card);
160
161 /* software ABORT - to initial state */
162 sca_out(DCR_ABORT, DCR_RX(port->chan), card);
163 sca_out(DCR_ABORT, DCR_TX(port->chan), card);
164
165 /* current desc addr */
166 sca_outl(desc_offset(port, 0, 0), dmac_rx + CDAL, card);
167 sca_outl(desc_offset(port, card->tx_ring_buffers - 1, 0),
168 dmac_rx + EDAL, card);
169 sca_outl(desc_offset(port, 0, 1), dmac_tx + CDAL, card);
170 sca_outl(desc_offset(port, 0, 1), dmac_tx + EDAL, card);
171
172 /* clear frame end interrupt counter */
173 sca_out(DCR_CLEAR_EOF, DCR_RX(port->chan), card);
174 sca_out(DCR_CLEAR_EOF, DCR_TX(port->chan), card);
175
176 /* Receive */
177 sca_outw(HDLC_MAX_MRU, dmac_rx + BFLL, card); /* set buffer length */
178 sca_out(0x14, DMR_RX(port->chan), card); /* Chain mode, Multi-frame */
179 sca_out(DIR_EOME, DIR_RX(port->chan), card); /* enable interrupts */
180 sca_out(DSR_DE, DSR_RX(port->chan), card); /* DMA enable */
181
182 /* Transmit */
183 sca_out(0x14, DMR_TX(port->chan), card); /* Chain mode, Multi-frame */
184 sca_out(DIR_EOME, DIR_TX(port->chan), card); /* enable interrupts */
185
191 sca_set_carrier(port); 186 sca_set_carrier(port);
192 netif_napi_add(port->netdev, &port->napi, sca_poll, NAPI_WEIGHT); 187 netif_napi_add(port->netdev, &port->napi, sca_poll, NAPI_WEIGHT);
193} 188}