aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorKrzysztof Hałasa <khc@pm.waw.pl>2008-07-01 15:43:39 -0400
committerKrzysztof Hałasa <khc@pm.waw.pl>2008-07-23 17:00:38 -0400
commitb22267d3883ebc76093e9f36c4c738125e092402 (patch)
treecbe1075a9cc3440b09174daa0f53395c6b966433 /drivers/net/wan
parentc36936ce4bc6d2a0d6520bd798e85abbb139c2aa (diff)
WAN: Convert PC300 driver to use normal u8/u16/u32 types
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/pc300.h184
-rw-r--r--drivers/net/wan/pc300_drv.c120
2 files changed, 150 insertions, 154 deletions
diff --git a/drivers/net/wan/pc300.h b/drivers/net/wan/pc300.h
index cee799dabd97..2e4f84f6cad4 100644
--- a/drivers/net/wan/pc300.h
+++ b/drivers/net/wan/pc300.h
@@ -103,10 +103,6 @@
103#include "hd64572.h" 103#include "hd64572.h"
104#include "pc300-falc-lh.h" 104#include "pc300-falc-lh.h"
105 105
106typedef __u32 uclong; /* 32 bits, unsigned */
107typedef __u16 ucshort; /* 16 bits, unsigned */
108typedef __u8 ucchar; /* 8 bits, unsigned */
109
110#define PC300_PROTO_MLPPP 1 106#define PC300_PROTO_MLPPP 1
111 107
112#define PC300_MAXCHAN 2 /* Number of channels per card */ 108#define PC300_MAXCHAN 2 /* Number of channels per card */
@@ -147,9 +143,9 @@ typedef __u8 ucchar; /* 8 bits, unsigned */
147 * Memory access functions/macros * 143 * Memory access functions/macros *
148 * (required to support Alpha systems) * 144 * (required to support Alpha systems) *
149 ***************************************/ 145 ***************************************/
150#define cpc_writeb(port,val) {writeb((ucchar)(val),(port)); mb();} 146#define cpc_writeb(port,val) {writeb((u8)(val),(port)); mb();}
151#define cpc_writew(port,val) {writew((ushort)(val),(port)); mb();} 147#define cpc_writew(port,val) {writew((ushort)(val),(port)); mb();}
152#define cpc_writel(port,val) {writel((uclong)(val),(port)); mb();} 148#define cpc_writel(port,val) {writel((u32)(val),(port)); mb();}
153 149
154#define cpc_readb(port) readb(port) 150#define cpc_readb(port) readb(port)
155#define cpc_readw(port) readw(port) 151#define cpc_readw(port) readw(port)
@@ -163,15 +159,15 @@ typedef __u8 ucchar; /* 8 bits, unsigned */
163 * (memory mapped). 159 * (memory mapped).
164 */ 160 */
165struct RUNTIME_9050 { 161struct RUNTIME_9050 {
166 uclong loc_addr_range[4]; /* 00-0Ch : Local Address Ranges */ 162 u32 loc_addr_range[4]; /* 00-0Ch : Local Address Ranges */
167 uclong loc_rom_range; /* 10h : Local ROM Range */ 163 u32 loc_rom_range; /* 10h : Local ROM Range */
168 uclong loc_addr_base[4]; /* 14-20h : Local Address Base Addrs */ 164 u32 loc_addr_base[4]; /* 14-20h : Local Address Base Addrs */
169 uclong loc_rom_base; /* 24h : Local ROM Base */ 165 u32 loc_rom_base; /* 24h : Local ROM Base */
170 uclong loc_bus_descr[4]; /* 28-34h : Local Bus Descriptors */ 166 u32 loc_bus_descr[4]; /* 28-34h : Local Bus Descriptors */
171 uclong rom_bus_descr; /* 38h : ROM Bus Descriptor */ 167 u32 rom_bus_descr; /* 38h : ROM Bus Descriptor */
172 uclong cs_base[4]; /* 3C-48h : Chip Select Base Addrs */ 168 u32 cs_base[4]; /* 3C-48h : Chip Select Base Addrs */
173 uclong intr_ctrl_stat; /* 4Ch : Interrupt Control/Status */ 169 u32 intr_ctrl_stat; /* 4Ch : Interrupt Control/Status */
174 uclong init_ctrl; /* 50h : EEPROM ctrl, Init Ctrl, etc */ 170 u32 init_ctrl; /* 50h : EEPROM ctrl, Init Ctrl, etc */
175}; 171};
176 172
177#define PLX_9050_LINT1_ENABLE 0x01 173#define PLX_9050_LINT1_ENABLE 0x01
@@ -215,66 +211,66 @@ struct RUNTIME_9050 {
215#define PC300_FALC_MAXLOOP 0x0000ffff /* for falc_issue_cmd() */ 211#define PC300_FALC_MAXLOOP 0x0000ffff /* for falc_issue_cmd() */
216 212
217typedef struct falc { 213typedef struct falc {
218 ucchar sync; /* If true FALC is synchronized */ 214 u8 sync; /* If true FALC is synchronized */
219 ucchar active; /* if TRUE then already active */ 215 u8 active; /* if TRUE then already active */
220 ucchar loop_active; /* if TRUE a line loopback UP was received */ 216 u8 loop_active; /* if TRUE a line loopback UP was received */
221 ucchar loop_gen; /* if TRUE a line loopback UP was issued */ 217 u8 loop_gen; /* if TRUE a line loopback UP was issued */
222 218
223 ucchar num_channels; 219 u8 num_channels;
224 ucchar offset; /* 1 for T1, 0 for E1 */ 220 u8 offset; /* 1 for T1, 0 for E1 */
225 ucchar full_bandwidth; 221 u8 full_bandwidth;
226 222
227 ucchar xmb_cause; 223 u8 xmb_cause;
228 ucchar multiframe_mode; 224 u8 multiframe_mode;
229 225
230 /* Statistics */ 226 /* Statistics */
231 ucshort pden; /* Pulse Density violation count */ 227 u16 pden; /* Pulse Density violation count */
232 ucshort los; /* Loss of Signal count */ 228 u16 los; /* Loss of Signal count */
233 ucshort losr; /* Loss of Signal recovery count */ 229 u16 losr; /* Loss of Signal recovery count */
234 ucshort lfa; /* Loss of frame alignment count */ 230 u16 lfa; /* Loss of frame alignment count */
235 ucshort farec; /* Frame Alignment Recovery count */ 231 u16 farec; /* Frame Alignment Recovery count */
236 ucshort lmfa; /* Loss of multiframe alignment count */ 232 u16 lmfa; /* Loss of multiframe alignment count */
237 ucshort ais; /* Remote Alarm indication Signal count */ 233 u16 ais; /* Remote Alarm indication Signal count */
238 ucshort sec; /* One-second timer */ 234 u16 sec; /* One-second timer */
239 ucshort es; /* Errored second */ 235 u16 es; /* Errored second */
240 ucshort rai; /* remote alarm received */ 236 u16 rai; /* remote alarm received */
241 ucshort bec; 237 u16 bec;
242 ucshort fec; 238 u16 fec;
243 ucshort cvc; 239 u16 cvc;
244 ucshort cec; 240 u16 cec;
245 ucshort ebc; 241 u16 ebc;
246 242
247 /* Status */ 243 /* Status */
248 ucchar red_alarm; 244 u8 red_alarm;
249 ucchar blue_alarm; 245 u8 blue_alarm;
250 ucchar loss_fa; 246 u8 loss_fa;
251 ucchar yellow_alarm; 247 u8 yellow_alarm;
252 ucchar loss_mfa; 248 u8 loss_mfa;
253 ucchar prbs; 249 u8 prbs;
254} falc_t; 250} falc_t;
255 251
256typedef struct falc_status { 252typedef struct falc_status {
257 ucchar sync; /* If true FALC is synchronized */ 253 u8 sync; /* If true FALC is synchronized */
258 ucchar red_alarm; 254 u8 red_alarm;
259 ucchar blue_alarm; 255 u8 blue_alarm;
260 ucchar loss_fa; 256 u8 loss_fa;
261 ucchar yellow_alarm; 257 u8 yellow_alarm;
262 ucchar loss_mfa; 258 u8 loss_mfa;
263 ucchar prbs; 259 u8 prbs;
264} falc_status_t; 260} falc_status_t;
265 261
266typedef struct rsv_x21_status { 262typedef struct rsv_x21_status {
267 ucchar dcd; 263 u8 dcd;
268 ucchar dsr; 264 u8 dsr;
269 ucchar cts; 265 u8 cts;
270 ucchar rts; 266 u8 rts;
271 ucchar dtr; 267 u8 dtr;
272} rsv_x21_status_t; 268} rsv_x21_status_t;
273 269
274typedef struct pc300stats { 270typedef struct pc300stats {
275 int hw_type; 271 int hw_type;
276 uclong line_on; 272 u32 line_on;
277 uclong line_off; 273 u32 line_off;
278 struct net_device_stats gen_stats; 274 struct net_device_stats gen_stats;
279 falc_t te_stats; 275 falc_t te_stats;
280} pc300stats_t; 276} pc300stats_t;
@@ -292,14 +288,14 @@ typedef struct pc300loopback {
292 288
293typedef struct pc300patterntst { 289typedef struct pc300patterntst {
294 char patrntst_on; /* 0 - off; 1 - on; 2 - read num_errors */ 290 char patrntst_on; /* 0 - off; 1 - on; 2 - read num_errors */
295 ucshort num_errors; 291 u16 num_errors;
296} pc300patterntst_t; 292} pc300patterntst_t;
297 293
298typedef struct pc300dev { 294typedef struct pc300dev {
299 struct pc300ch *chan; 295 struct pc300ch *chan;
300 ucchar trace_on; 296 u8 trace_on;
301 uclong line_on; /* DCD(X.21, RSV) / sync(TE) change counters */ 297 u32 line_on; /* DCD(X.21, RSV) / sync(TE) change counters */
302 uclong line_off; 298 u32 line_off;
303 char name[16]; 299 char name[16];
304 struct net_device *dev; 300 struct net_device *dev;
305#ifdef CONFIG_PC300_MLPPP 301#ifdef CONFIG_PC300_MLPPP
@@ -312,42 +308,42 @@ typedef struct pc300hw {
312 int bus; /* Bus (PCI, PMC, etc.) */ 308 int bus; /* Bus (PCI, PMC, etc.) */
313 int nchan; /* number of channels */ 309 int nchan; /* number of channels */
314 int irq; /* interrupt request level */ 310 int irq; /* interrupt request level */
315 uclong clock; /* Board clock */ 311 u32 clock; /* Board clock */
316 ucchar cpld_id; /* CPLD ID (TE only) */ 312 u8 cpld_id; /* CPLD ID (TE only) */
317 ucshort cpld_reg1; /* CPLD reg 1 (TE only) */ 313 u16 cpld_reg1; /* CPLD reg 1 (TE only) */
318 ucshort cpld_reg2; /* CPLD reg 2 (TE only) */ 314 u16 cpld_reg2; /* CPLD reg 2 (TE only) */
319 ucshort gpioc_reg; /* PLX GPIOC reg */ 315 u16 gpioc_reg; /* PLX GPIOC reg */
320 ucshort intctl_reg; /* PLX Int Ctrl/Status reg */ 316 u16 intctl_reg; /* PLX Int Ctrl/Status reg */
321 uclong iophys; /* PLX registers I/O base */ 317 u32 iophys; /* PLX registers I/O base */
322 uclong iosize; /* PLX registers I/O size */ 318 u32 iosize; /* PLX registers I/O size */
323 uclong plxphys; /* PLX registers MMIO base (physical) */ 319 u32 plxphys; /* PLX registers MMIO base (physical) */
324 void __iomem * plxbase; /* PLX registers MMIO base (virtual) */ 320 void __iomem * plxbase; /* PLX registers MMIO base (virtual) */
325 uclong plxsize; /* PLX registers MMIO size */ 321 u32 plxsize; /* PLX registers MMIO size */
326 uclong scaphys; /* SCA registers MMIO base (physical) */ 322 u32 scaphys; /* SCA registers MMIO base (physical) */
327 void __iomem * scabase; /* SCA registers MMIO base (virtual) */ 323 void __iomem * scabase; /* SCA registers MMIO base (virtual) */
328 uclong scasize; /* SCA registers MMIO size */ 324 u32 scasize; /* SCA registers MMIO size */
329 uclong ramphys; /* On-board RAM MMIO base (physical) */ 325 u32 ramphys; /* On-board RAM MMIO base (physical) */
330 void __iomem * rambase; /* On-board RAM MMIO base (virtual) */ 326 void __iomem * rambase; /* On-board RAM MMIO base (virtual) */
331 uclong alloc_ramsize; /* RAM MMIO size allocated by the PCI bridge */ 327 u32 alloc_ramsize; /* RAM MMIO size allocated by the PCI bridge */
332 uclong ramsize; /* On-board RAM MMIO size */ 328 u32 ramsize; /* On-board RAM MMIO size */
333 uclong falcphys; /* FALC registers MMIO base (physical) */ 329 u32 falcphys; /* FALC registers MMIO base (physical) */
334 void __iomem * falcbase;/* FALC registers MMIO base (virtual) */ 330 void __iomem * falcbase;/* FALC registers MMIO base (virtual) */
335 uclong falcsize; /* FALC registers MMIO size */ 331 u32 falcsize; /* FALC registers MMIO size */
336} pc300hw_t; 332} pc300hw_t;
337 333
338typedef struct pc300chconf { 334typedef struct pc300chconf {
339 sync_serial_settings phys_settings; /* Clock type/rate (in bps), 335 sync_serial_settings phys_settings; /* Clock type/rate (in bps),
340 loopback mode */ 336 loopback mode */
341 raw_hdlc_proto proto_settings; /* Encoding, parity (CRC) */ 337 raw_hdlc_proto proto_settings; /* Encoding, parity (CRC) */
342 uclong media; /* HW media (RS232, V.35, etc.) */ 338 u32 media; /* HW media (RS232, V.35, etc.) */
343 uclong proto; /* Protocol (PPP, X.25, etc.) */ 339 u32 proto; /* Protocol (PPP, X.25, etc.) */
344 340
345 /* TE-specific parameters */ 341 /* TE-specific parameters */
346 ucchar lcode; /* Line Code (AMI, B8ZS, etc.) */ 342 u8 lcode; /* Line Code (AMI, B8ZS, etc.) */
347 ucchar fr_mode; /* Frame Mode (ESF, D4, etc.) */ 343 u8 fr_mode; /* Frame Mode (ESF, D4, etc.) */
348 ucchar lbo; /* Line Build Out */ 344 u8 lbo; /* Line Build Out */
349 ucchar rx_sens; /* Rx Sensitivity (long- or short-haul) */ 345 u8 rx_sens; /* Rx Sensitivity (long- or short-haul) */
350 uclong tslot_bitmap; /* bit[i]=1 => timeslot _i_ is active */ 346 u32 tslot_bitmap; /* bit[i]=1 => timeslot _i_ is active */
351} pc300chconf_t; 347} pc300chconf_t;
352 348
353typedef struct pc300ch { 349typedef struct pc300ch {
@@ -355,12 +351,12 @@ typedef struct pc300ch {
355 int channel; 351 int channel;
356 pc300dev_t d; 352 pc300dev_t d;
357 pc300chconf_t conf; 353 pc300chconf_t conf;
358 ucchar tx_first_bd; /* First TX DMA block descr. w/ data */ 354 u8 tx_first_bd; /* First TX DMA block descr. w/ data */
359 ucchar tx_next_bd; /* Next free TX DMA block descriptor */ 355 u8 tx_next_bd; /* Next free TX DMA block descriptor */
360 ucchar rx_first_bd; /* First free RX DMA block descriptor */ 356 u8 rx_first_bd; /* First free RX DMA block descriptor */
361 ucchar rx_last_bd; /* Last free RX DMA block descriptor */ 357 u8 rx_last_bd; /* Last free RX DMA block descriptor */
362 ucchar nfree_tx_bd; /* Number of free TX DMA block descriptors */ 358 u8 nfree_tx_bd; /* Number of free TX DMA block descriptors */
363 falc_t falc; /* FALC structure (TE only) */ 359 falc_t falc; /* FALC structure (TE only) */
364} pc300ch_t; 360} pc300ch_t;
365 361
366typedef struct pc300 { 362typedef struct pc300 {
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 65c40cd4a08f..d0a8d1e352ac 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -283,8 +283,8 @@ static void rx_dma_buf_init(pc300_t *, int);
283static void tx_dma_buf_check(pc300_t *, int); 283static void tx_dma_buf_check(pc300_t *, int);
284static void rx_dma_buf_check(pc300_t *, int); 284static void rx_dma_buf_check(pc300_t *, int);
285static irqreturn_t cpc_intr(int, void *); 285static irqreturn_t cpc_intr(int, void *);
286static int clock_rate_calc(uclong, uclong, int *); 286static int clock_rate_calc(u32, u32, int *);
287static uclong detect_ram(pc300_t *); 287static u32 detect_ram(pc300_t *);
288static void plx_init(pc300_t *); 288static void plx_init(pc300_t *);
289static void cpc_trace(struct net_device *, struct sk_buff *, char); 289static void cpc_trace(struct net_device *, struct sk_buff *, char);
290static int cpc_attach(struct net_device *, unsigned short, unsigned short); 290static int cpc_attach(struct net_device *, unsigned short, unsigned short);
@@ -309,10 +309,10 @@ static void tx_dma_buf_pt_init(pc300_t * card, int ch)
309 + DMA_TX_BD_BASE + ch_factor * sizeof(pcsca_bd_t)); 309 + DMA_TX_BD_BASE + ch_factor * sizeof(pcsca_bd_t));
310 310
311 for (i = 0; i < N_DMA_TX_BUF; i++, ptdescr++) { 311 for (i = 0; i < N_DMA_TX_BUF; i++, ptdescr++) {
312 cpc_writel(&ptdescr->next, (uclong) (DMA_TX_BD_BASE + 312 cpc_writel(&ptdescr->next, (u32)(DMA_TX_BD_BASE +
313 (ch_factor + ((i + 1) & (N_DMA_TX_BUF - 1))) * sizeof(pcsca_bd_t))); 313 (ch_factor + ((i + 1) & (N_DMA_TX_BUF - 1))) * sizeof(pcsca_bd_t)));
314 cpc_writel(&ptdescr->ptbuf, 314 cpc_writel(&ptdescr->ptbuf,
315 (uclong) (DMA_TX_BASE + (ch_factor + i) * BD_DEF_LEN)); 315 (u32)(DMA_TX_BASE + (ch_factor + i) * BD_DEF_LEN));
316 } 316 }
317} 317}
318 318
@@ -339,10 +339,10 @@ static void rx_dma_buf_pt_init(pc300_t * card, int ch)
339 + DMA_RX_BD_BASE + ch_factor * sizeof(pcsca_bd_t)); 339 + DMA_RX_BD_BASE + ch_factor * sizeof(pcsca_bd_t));
340 340
341 for (i = 0; i < N_DMA_RX_BUF; i++, ptdescr++) { 341 for (i = 0; i < N_DMA_RX_BUF; i++, ptdescr++) {
342 cpc_writel(&ptdescr->next, (uclong) (DMA_RX_BD_BASE + 342 cpc_writel(&ptdescr->next, (u32)(DMA_RX_BD_BASE +
343 (ch_factor + ((i + 1) & (N_DMA_RX_BUF - 1))) * sizeof(pcsca_bd_t))); 343 (ch_factor + ((i + 1) & (N_DMA_RX_BUF - 1))) * sizeof(pcsca_bd_t)));
344 cpc_writel(&ptdescr->ptbuf, 344 cpc_writel(&ptdescr->ptbuf,
345 (uclong) (DMA_RX_BASE + (ch_factor + i) * BD_DEF_LEN)); 345 (u32)(DMA_RX_BASE + (ch_factor + i) * BD_DEF_LEN));
346 } 346 }
347} 347}
348 348
@@ -365,8 +365,8 @@ static void tx_dma_buf_check(pc300_t * card, int ch)
365{ 365{
366 volatile pcsca_bd_t __iomem *ptdescr; 366 volatile pcsca_bd_t __iomem *ptdescr;
367 int i; 367 int i;
368 ucshort first_bd = card->chan[ch].tx_first_bd; 368 u16 first_bd = card->chan[ch].tx_first_bd;
369 ucshort next_bd = card->chan[ch].tx_next_bd; 369 u16 next_bd = card->chan[ch].tx_next_bd;
370 370
371 printk("#CH%d: f_bd = %d(0x%08zx), n_bd = %d(0x%08zx)\n", ch, 371 printk("#CH%d: f_bd = %d(0x%08zx), n_bd = %d(0x%08zx)\n", ch,
372 first_bd, TX_BD_ADDR(ch, first_bd), 372 first_bd, TX_BD_ADDR(ch, first_bd),
@@ -390,9 +390,9 @@ static void tx1_dma_buf_check(pc300_t * card, int ch)
390{ 390{
391 volatile pcsca_bd_t __iomem *ptdescr; 391 volatile pcsca_bd_t __iomem *ptdescr;
392 int i; 392 int i;
393 ucshort first_bd = card->chan[ch].tx_first_bd; 393 u16 first_bd = card->chan[ch].tx_first_bd;
394 ucshort next_bd = card->chan[ch].tx_next_bd; 394 u16 next_bd = card->chan[ch].tx_next_bd;
395 uclong scabase = card->hw.scabase; 395 u32 scabase = card->hw.scabase;
396 396
397 printk ("\nnfree_tx_bd = %d \n", card->chan[ch].nfree_tx_bd); 397 printk ("\nnfree_tx_bd = %d \n", card->chan[ch].nfree_tx_bd);
398 printk("#CH%d: f_bd = %d(0x%08x), n_bd = %d(0x%08x)\n", ch, 398 printk("#CH%d: f_bd = %d(0x%08x), n_bd = %d(0x%08x)\n", ch,
@@ -411,13 +411,13 @@ static void tx1_dma_buf_check(pc300_t * card, int ch)
411 printk("\n"); 411 printk("\n");
412} 412}
413#endif 413#endif
414 414
415static void rx_dma_buf_check(pc300_t * card, int ch) 415static void rx_dma_buf_check(pc300_t * card, int ch)
416{ 416{
417 volatile pcsca_bd_t __iomem *ptdescr; 417 volatile pcsca_bd_t __iomem *ptdescr;
418 int i; 418 int i;
419 ucshort first_bd = card->chan[ch].rx_first_bd; 419 u16 first_bd = card->chan[ch].rx_first_bd;
420 ucshort last_bd = card->chan[ch].rx_last_bd; 420 u16 last_bd = card->chan[ch].rx_last_bd;
421 int ch_factor; 421 int ch_factor;
422 422
423 ch_factor = ch * N_DMA_RX_BUF; 423 ch_factor = ch * N_DMA_RX_BUF;
@@ -438,9 +438,9 @@ static void rx_dma_buf_check(pc300_t * card, int ch)
438static int dma_get_rx_frame_size(pc300_t * card, int ch) 438static int dma_get_rx_frame_size(pc300_t * card, int ch)
439{ 439{
440 volatile pcsca_bd_t __iomem *ptdescr; 440 volatile pcsca_bd_t __iomem *ptdescr;
441 ucshort first_bd = card->chan[ch].rx_first_bd; 441 u16 first_bd = card->chan[ch].rx_first_bd;
442 int rcvd = 0; 442 int rcvd = 0;
443 volatile ucchar status; 443 volatile u8 status;
444 444
445 ptdescr = (card->hw.rambase + RX_BD_ADDR(ch, first_bd)); 445 ptdescr = (card->hw.rambase + RX_BD_ADDR(ch, first_bd));
446 while ((status = cpc_readb(&ptdescr->status)) & DST_OSB) { 446 while ((status = cpc_readb(&ptdescr->status)) & DST_OSB) {
@@ -460,12 +460,12 @@ static int dma_get_rx_frame_size(pc300_t * card, int ch)
460 * dma_buf_write: writes a frame to the Tx DMA buffers 460 * dma_buf_write: writes a frame to the Tx DMA buffers
461 * NOTE: this function writes one frame at a time. 461 * NOTE: this function writes one frame at a time.
462 */ 462 */
463static int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) 463static int dma_buf_write(pc300_t *card, int ch, u8 *ptdata, int len)
464{ 464{
465 int i, nchar; 465 int i, nchar;
466 volatile pcsca_bd_t __iomem *ptdescr; 466 volatile pcsca_bd_t __iomem *ptdescr;
467 int tosend = len; 467 int tosend = len;
468 ucchar nbuf = ((len - 1) / BD_DEF_LEN) + 1; 468 u8 nbuf = ((len - 1) / BD_DEF_LEN) + 1;
469 469
470 if (nbuf >= card->chan[ch].nfree_tx_bd) { 470 if (nbuf >= card->chan[ch].nfree_tx_bd) {
471 return -ENOMEM; 471 return -ENOMEM;
@@ -507,7 +507,7 @@ static int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb)
507 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 507 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
508 volatile pcsca_bd_t __iomem *ptdescr; 508 volatile pcsca_bd_t __iomem *ptdescr;
509 int rcvd = 0; 509 int rcvd = 0;
510 volatile ucchar status; 510 volatile u8 status;
511 511
512 ptdescr = (card->hw.rambase + 512 ptdescr = (card->hw.rambase +
513 RX_BD_ADDR(ch, chan->rx_first_bd)); 513 RX_BD_ADDR(ch, chan->rx_first_bd));
@@ -561,8 +561,8 @@ static int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb)
561static void tx_dma_stop(pc300_t * card, int ch) 561static void tx_dma_stop(pc300_t * card, int ch)
562{ 562{
563 void __iomem *scabase = card->hw.scabase; 563 void __iomem *scabase = card->hw.scabase;
564 ucchar drr_ena_bit = 1 << (5 + 2 * ch); 564 u8 drr_ena_bit = 1 << (5 + 2 * ch);
565 ucchar drr_rst_bit = 1 << (1 + 2 * ch); 565 u8 drr_rst_bit = 1 << (1 + 2 * ch);
566 566
567 /* Disable DMA */ 567 /* Disable DMA */
568 cpc_writeb(scabase + DRR, drr_ena_bit); 568 cpc_writeb(scabase + DRR, drr_ena_bit);
@@ -572,8 +572,8 @@ static void tx_dma_stop(pc300_t * card, int ch)
572static void rx_dma_stop(pc300_t * card, int ch) 572static void rx_dma_stop(pc300_t * card, int ch)
573{ 573{
574 void __iomem *scabase = card->hw.scabase; 574 void __iomem *scabase = card->hw.scabase;
575 ucchar drr_ena_bit = 1 << (4 + 2 * ch); 575 u8 drr_ena_bit = 1 << (4 + 2 * ch);
576 ucchar drr_rst_bit = 1 << (2 * ch); 576 u8 drr_rst_bit = 1 << (2 * ch);
577 577
578 /* Disable DMA */ 578 /* Disable DMA */
579 cpc_writeb(scabase + DRR, drr_ena_bit); 579 cpc_writeb(scabase + DRR, drr_ena_bit);
@@ -605,7 +605,7 @@ static void rx_dma_start(pc300_t * card, int ch)
605/*************************/ 605/*************************/
606/*** FALC Routines ***/ 606/*** FALC Routines ***/
607/*************************/ 607/*************************/
608static void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd) 608static void falc_issue_cmd(pc300_t *card, int ch, u8 cmd)
609{ 609{
610 void __iomem *falcbase = card->hw.falcbase; 610 void __iomem *falcbase = card->hw.falcbase;
611 unsigned long i = 0; 611 unsigned long i = 0;
@@ -673,7 +673,7 @@ static void falc_intr_enable(pc300_t * card, int ch)
673static void falc_open_timeslot(pc300_t * card, int ch, int timeslot) 673static void falc_open_timeslot(pc300_t * card, int ch, int timeslot)
674{ 674{
675 void __iomem *falcbase = card->hw.falcbase; 675 void __iomem *falcbase = card->hw.falcbase;
676 ucchar tshf = card->chan[ch].falc.offset; 676 u8 tshf = card->chan[ch].falc.offset;
677 677
678 cpc_writeb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch), 678 cpc_writeb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch),
679 cpc_readb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch)) & 679 cpc_readb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch)) &
@@ -689,7 +689,7 @@ static void falc_open_timeslot(pc300_t * card, int ch, int timeslot)
689static void falc_close_timeslot(pc300_t * card, int ch, int timeslot) 689static void falc_close_timeslot(pc300_t * card, int ch, int timeslot)
690{ 690{
691 void __iomem *falcbase = card->hw.falcbase; 691 void __iomem *falcbase = card->hw.falcbase;
692 ucchar tshf = card->chan[ch].falc.offset; 692 u8 tshf = card->chan[ch].falc.offset;
693 693
694 cpc_writeb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch), 694 cpc_writeb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch),
695 cpc_readb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch)) | 695 cpc_readb(falcbase + F_REG((ICB1 + (timeslot - tshf) / 8), ch)) |
@@ -810,7 +810,7 @@ static void falc_init_t1(pc300_t * card, int ch)
810 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 810 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
811 falc_t *pfalc = (falc_t *) & chan->falc; 811 falc_t *pfalc = (falc_t *) & chan->falc;
812 void __iomem *falcbase = card->hw.falcbase; 812 void __iomem *falcbase = card->hw.falcbase;
813 ucchar dja = (ch ? (LIM2_DJA2 | LIM2_DJA1) : 0); 813 u8 dja = (ch ? (LIM2_DJA2 | LIM2_DJA1) : 0);
814 814
815 /* Switch to T1 mode (PCM 24) */ 815 /* Switch to T1 mode (PCM 24) */
816 cpc_writeb(falcbase + F_REG(FMR1, ch), FMR1_PMOD); 816 cpc_writeb(falcbase + F_REG(FMR1, ch), FMR1_PMOD);
@@ -979,7 +979,7 @@ static void falc_init_e1(pc300_t * card, int ch)
979 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 979 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
980 falc_t *pfalc = (falc_t *) & chan->falc; 980 falc_t *pfalc = (falc_t *) & chan->falc;
981 void __iomem *falcbase = card->hw.falcbase; 981 void __iomem *falcbase = card->hw.falcbase;
982 ucchar dja = (ch ? (LIM2_DJA2 | LIM2_DJA1) : 0); 982 u8 dja = (ch ? (LIM2_DJA2 | LIM2_DJA1) : 0);
983 983
984 /* Switch to E1 mode (PCM 30) */ 984 /* Switch to E1 mode (PCM 30) */
985 cpc_writeb(falcbase + F_REG(FMR1, ch), 985 cpc_writeb(falcbase + F_REG(FMR1, ch),
@@ -1185,7 +1185,7 @@ static void te_config(pc300_t * card, int ch)
1185 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1185 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
1186 falc_t *pfalc = (falc_t *) & chan->falc; 1186 falc_t *pfalc = (falc_t *) & chan->falc;
1187 void __iomem *falcbase = card->hw.falcbase; 1187 void __iomem *falcbase = card->hw.falcbase;
1188 ucchar dummy; 1188 u8 dummy;
1189 unsigned long flags; 1189 unsigned long flags;
1190 1190
1191 memset(pfalc, 0, sizeof(falc_t)); 1191 memset(pfalc, 0, sizeof(falc_t));
@@ -1401,7 +1401,7 @@ static void falc_update_stats(pc300_t * card, int ch)
1401 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1401 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
1402 falc_t *pfalc = (falc_t *) & chan->falc; 1402 falc_t *pfalc = (falc_t *) & chan->falc;
1403 void __iomem *falcbase = card->hw.falcbase; 1403 void __iomem *falcbase = card->hw.falcbase;
1404 ucshort counter; 1404 u16 counter;
1405 1405
1406 counter = cpc_readb(falcbase + F_REG(FECL, ch)); 1406 counter = cpc_readb(falcbase + F_REG(FECL, ch));
1407 counter |= cpc_readb(falcbase + F_REG(FECH, ch)) << 8; 1407 counter |= cpc_readb(falcbase + F_REG(FECH, ch)) << 8;
@@ -1727,7 +1727,7 @@ static void falc_pattern_test(pc300_t * card, int ch, unsigned int activate)
1727 * Description: This routine returns the bit error counter value 1727 * Description: This routine returns the bit error counter value
1728 *---------------------------------------------------------------------------- 1728 *----------------------------------------------------------------------------
1729 */ 1729 */
1730static ucshort falc_pattern_test_error(pc300_t * card, int ch) 1730static u16 falc_pattern_test_error(pc300_t * card, int ch)
1731{ 1731{
1732 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1732 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1733 falc_t *pfalc = (falc_t *) & chan->falc; 1733 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -1774,7 +1774,7 @@ static void cpc_tx_timeout(struct net_device *dev)
1774 pc300_t *card = (pc300_t *) chan->card; 1774 pc300_t *card = (pc300_t *) chan->card;
1775 int ch = chan->channel; 1775 int ch = chan->channel;
1776 unsigned long flags; 1776 unsigned long flags;
1777 ucchar ilar; 1777 u8 ilar;
1778 1778
1779 dev->stats.tx_errors++; 1779 dev->stats.tx_errors++;
1780 dev->stats.tx_aborted_errors++; 1780 dev->stats.tx_aborted_errors++;
@@ -1830,7 +1830,7 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1830 } 1830 }
1831 1831
1832 /* Write buffer to DMA buffers */ 1832 /* Write buffer to DMA buffers */
1833 if (dma_buf_write(card, ch, (ucchar *) skb->data, skb->len) != 0) { 1833 if (dma_buf_write(card, ch, (u8 *)skb->data, skb->len) != 0) {
1834// printk("%s: write error. Dropping TX packet.\n", dev->name); 1834// printk("%s: write error. Dropping TX packet.\n", dev->name);
1835 netif_stop_queue(dev); 1835 netif_stop_queue(dev);
1836 dev_kfree_skb(skb); 1836 dev_kfree_skb(skb);
@@ -1995,7 +1995,7 @@ static void sca_tx_intr(pc300dev_t *dev)
1995static void sca_intr(pc300_t * card) 1995static void sca_intr(pc300_t * card)
1996{ 1996{
1997 void __iomem *scabase = card->hw.scabase; 1997 void __iomem *scabase = card->hw.scabase;
1998 volatile uclong status; 1998 volatile u32 status;
1999 int ch; 1999 int ch;
2000 int intr_count = 0; 2000 int intr_count = 0;
2001 unsigned char dsr_rx; 2001 unsigned char dsr_rx;
@@ -2010,7 +2010,7 @@ static void sca_intr(pc300_t * card)
2010 2010
2011 /**** Reception ****/ 2011 /**** Reception ****/
2012 if (status & IR0_DRX((IR0_DMIA | IR0_DMIB), ch)) { 2012 if (status & IR0_DRX((IR0_DMIA | IR0_DMIB), ch)) {
2013 ucchar drx_stat = cpc_readb(scabase + DSR_RX(ch)); 2013 u8 drx_stat = cpc_readb(scabase + DSR_RX(ch));
2014 2014
2015 /* Clear RX interrupts */ 2015 /* Clear RX interrupts */
2016 cpc_writeb(scabase + DSR_RX(ch), drx_stat | DSR_DWE); 2016 cpc_writeb(scabase + DSR_RX(ch), drx_stat | DSR_DWE);
@@ -2084,7 +2084,7 @@ static void sca_intr(pc300_t * card)
2084 2084
2085 /**** Transmission ****/ 2085 /**** Transmission ****/
2086 if (status & IR0_DTX((IR0_EFT | IR0_DMIA | IR0_DMIB), ch)) { 2086 if (status & IR0_DTX((IR0_EFT | IR0_DMIA | IR0_DMIB), ch)) {
2087 ucchar dtx_stat = cpc_readb(scabase + DSR_TX(ch)); 2087 u8 dtx_stat = cpc_readb(scabase + DSR_TX(ch));
2088 2088
2089 /* Clear TX interrupts */ 2089 /* Clear TX interrupts */
2090 cpc_writeb(scabase + DSR_TX(ch), dtx_stat | DSR_DWE); 2090 cpc_writeb(scabase + DSR_TX(ch), dtx_stat | DSR_DWE);
@@ -2128,7 +2128,7 @@ static void sca_intr(pc300_t * card)
2128 2128
2129 /**** MSCI ****/ 2129 /**** MSCI ****/
2130 if (status & IR0_M(IR0_RXINTA, ch)) { 2130 if (status & IR0_M(IR0_RXINTA, ch)) {
2131 ucchar st1 = cpc_readb(scabase + M_REG(ST1, ch)); 2131 u8 st1 = cpc_readb(scabase + M_REG(ST1, ch));
2132 2132
2133 /* Clear MSCI interrupts */ 2133 /* Clear MSCI interrupts */
2134 cpc_writeb(scabase + M_REG(ST1, ch), st1); 2134 cpc_writeb(scabase + M_REG(ST1, ch), st1);
@@ -2170,7 +2170,7 @@ static void sca_intr(pc300_t * card)
2170 } 2170 }
2171} 2171}
2172 2172
2173static void falc_t1_loop_detection(pc300_t * card, int ch, ucchar frs1) 2173static void falc_t1_loop_detection(pc300_t *card, int ch, u8 frs1)
2174{ 2174{
2175 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 2175 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
2176 falc_t *pfalc = (falc_t *) & chan->falc; 2176 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -2195,7 +2195,7 @@ static void falc_t1_loop_detection(pc300_t * card, int ch, ucchar frs1)
2195 } 2195 }
2196} 2196}
2197 2197
2198static void falc_e1_loop_detection(pc300_t * card, int ch, ucchar rsp) 2198static void falc_e1_loop_detection(pc300_t *card, int ch, u8 rsp)
2199{ 2199{
2200 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 2200 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
2201 falc_t *pfalc = (falc_t *) & chan->falc; 2201 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -2225,8 +2225,8 @@ static void falc_t1_intr(pc300_t * card, int ch)
2225 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 2225 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
2226 falc_t *pfalc = (falc_t *) & chan->falc; 2226 falc_t *pfalc = (falc_t *) & chan->falc;
2227 void __iomem *falcbase = card->hw.falcbase; 2227 void __iomem *falcbase = card->hw.falcbase;
2228 ucchar isr0, isr3, gis; 2228 u8 isr0, isr3, gis;
2229 ucchar dummy; 2229 u8 dummy;
2230 2230
2231 while ((gis = cpc_readb(falcbase + F_REG(GIS, ch))) != 0) { 2231 while ((gis = cpc_readb(falcbase + F_REG(GIS, ch))) != 0) {
2232 if (gis & GIS_ISR0) { 2232 if (gis & GIS_ISR0) {
@@ -2272,8 +2272,8 @@ static void falc_e1_intr(pc300_t * card, int ch)
2272 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 2272 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
2273 falc_t *pfalc = (falc_t *) & chan->falc; 2273 falc_t *pfalc = (falc_t *) & chan->falc;
2274 void __iomem *falcbase = card->hw.falcbase; 2274 void __iomem *falcbase = card->hw.falcbase;
2275 ucchar isr1, isr2, isr3, gis, rsp; 2275 u8 isr1, isr2, isr3, gis, rsp;
2276 ucchar dummy; 2276 u8 dummy;
2277 2277
2278 while ((gis = cpc_readb(falcbase + F_REG(GIS, ch))) != 0) { 2278 while ((gis = cpc_readb(falcbase + F_REG(GIS, ch))) != 0) {
2279 rsp = cpc_readb(falcbase + F_REG(RSP, ch)); 2279 rsp = cpc_readb(falcbase + F_REG(RSP, ch));
@@ -2355,7 +2355,7 @@ static void falc_intr(pc300_t * card)
2355static irqreturn_t cpc_intr(int irq, void *dev_id) 2355static irqreturn_t cpc_intr(int irq, void *dev_id)
2356{ 2356{
2357 pc300_t *card = dev_id; 2357 pc300_t *card = dev_id;
2358 volatile ucchar plx_status; 2358 volatile u8 plx_status;
2359 2359
2360 if (!card) { 2360 if (!card) {
2361#ifdef PC300_DEBUG_INTR 2361#ifdef PC300_DEBUG_INTR
@@ -2394,7 +2394,7 @@ static irqreturn_t cpc_intr(int irq, void *dev_id)
2394 2394
2395static void cpc_sca_status(pc300_t * card, int ch) 2395static void cpc_sca_status(pc300_t * card, int ch)
2396{ 2396{
2397 ucchar ilar; 2397 u8 ilar;
2398 void __iomem *scabase = card->hw.scabase; 2398 void __iomem *scabase = card->hw.scabase;
2399 unsigned long flags; 2399 unsigned long flags;
2400 2400
@@ -2812,7 +2812,7 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2812 } 2812 }
2813} 2813}
2814 2814
2815static int clock_rate_calc(uclong rate, uclong clock, int *br_io) 2815static int clock_rate_calc(u32 rate, u32 clock, int *br_io)
2816{ 2816{
2817 int br, tc; 2817 int br, tc;
2818 int br_pwr, error; 2818 int br_pwr, error;
@@ -2849,12 +2849,12 @@ static int ch_config(pc300dev_t * d)
2849 void __iomem *scabase = card->hw.scabase; 2849 void __iomem *scabase = card->hw.scabase;
2850 void __iomem *plxbase = card->hw.plxbase; 2850 void __iomem *plxbase = card->hw.plxbase;
2851 int ch = chan->channel; 2851 int ch = chan->channel;
2852 uclong clkrate = chan->conf.phys_settings.clock_rate; 2852 u32 clkrate = chan->conf.phys_settings.clock_rate;
2853 uclong clktype = chan->conf.phys_settings.clock_type; 2853 u32 clktype = chan->conf.phys_settings.clock_type;
2854 ucshort encoding = chan->conf.proto_settings.encoding; 2854 u16 encoding = chan->conf.proto_settings.encoding;
2855 ucshort parity = chan->conf.proto_settings.parity; 2855 u16 parity = chan->conf.proto_settings.parity;
2856 ucchar md0, md2; 2856 u8 md0, md2;
2857 2857
2858 /* Reset the channel */ 2858 /* Reset the channel */
2859 cpc_writeb(scabase + M_REG(CMD, ch), CMD_CH_RST); 2859 cpc_writeb(scabase + M_REG(CMD, ch), CMD_CH_RST);
2860 2860
@@ -3193,16 +3193,16 @@ static int cpc_close(struct net_device *dev)
3193 return 0; 3193 return 0;
3194} 3194}
3195 3195
3196static uclong detect_ram(pc300_t * card) 3196static u32 detect_ram(pc300_t * card)
3197{ 3197{
3198 uclong i; 3198 u32 i;
3199 ucchar data; 3199 u8 data;
3200 void __iomem *rambase = card->hw.rambase; 3200 void __iomem *rambase = card->hw.rambase;
3201 3201
3202 card->hw.ramsize = PC300_RAMSIZE; 3202 card->hw.ramsize = PC300_RAMSIZE;
3203 /* Let's find out how much RAM is present on this board */ 3203 /* Let's find out how much RAM is present on this board */
3204 for (i = 0; i < card->hw.ramsize; i++) { 3204 for (i = 0; i < card->hw.ramsize; i++) {
3205 data = (ucchar) (i & 0xff); 3205 data = (u8)(i & 0xff);
3206 cpc_writeb(rambase + i, data); 3206 cpc_writeb(rambase + i, data);
3207 if (cpc_readb(rambase + i) != data) { 3207 if (cpc_readb(rambase + i) != data) {
3208 break; 3208 break;
@@ -3279,7 +3279,7 @@ static void cpc_init_card(pc300_t * card)
3279 cpc_writeb(card->hw.scabase + DMER, 0x80); 3279 cpc_writeb(card->hw.scabase + DMER, 0x80);
3280 3280
3281 if (card->hw.type == PC300_TE) { 3281 if (card->hw.type == PC300_TE) {
3282 ucchar reg1; 3282 u8 reg1;
3283 3283
3284 /* Check CPLD version */ 3284 /* Check CPLD version */
3285 reg1 = cpc_readb(card->hw.falcbase + CPLD_REG1); 3285 reg1 = cpc_readb(card->hw.falcbase + CPLD_REG1);
@@ -3413,7 +3413,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3413{ 3413{
3414 static int first_time = 1; 3414 static int first_time = 1;
3415 int err, eeprom_outdated = 0; 3415 int err, eeprom_outdated = 0;
3416 ucshort device_id; 3416 u16 device_id;
3417 pc300_t *card; 3417 pc300_t *card;
3418 3418
3419 if (first_time) { 3419 if (first_time) {