diff options
| -rw-r--r-- | drivers/staging/arlan/arlan.h | 132 |
1 files changed, 64 insertions, 68 deletions
diff --git a/drivers/staging/arlan/arlan.h b/drivers/staging/arlan/arlan.h index fb3ad51a1caf..19161f1feb5b 100644 --- a/drivers/staging/arlan/arlan.h +++ b/drivers/staging/arlan/arlan.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 1997 Cullen Jennings | 2 | * Copyright (C) 1997 Cullen Jennings |
| 3 | * Copyright (C) 1998 Elmer.Joandi@ut.ee, +37-255-13500 | 3 | * Copyright (C) 1998 Elmer.Joandi@ut.ee, +37-255-13500 |
| 4 | * GNU General Public License applies | 4 | * GNU General Public License applies |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -20,14 +20,14 @@ | |||
| 20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
| 22 | #include <asm/system.h> | 22 | #include <asm/system.h> |
| 23 | #include <asm/io.h> | 23 | #include <linux/io.h> |
| 24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
| 27 | #include <linux/etherdevice.h> | 27 | #include <linux/etherdevice.h> |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | //#define ARLAN_DEBUGGING 1 | 30 | /* #define ARLAN_DEBUGGING 1 */ |
| 31 | 31 | ||
| 32 | #define ARLAN_PROC_INTERFACE | 32 | #define ARLAN_PROC_INTERFACE |
| 33 | #define MAX_ARLANS 4 /* not more than 4 ! */ | 33 | #define MAX_ARLANS 4 /* not more than 4 ! */ |
| @@ -51,8 +51,8 @@ extern int arlan_debug; | |||
| 51 | extern int arlan_entry_debug; | 51 | extern int arlan_entry_debug; |
| 52 | extern int arlan_exit_debug; | 52 | extern int arlan_exit_debug; |
| 53 | extern int testMemory; | 53 | extern int testMemory; |
| 54 | extern int arlan_command(struct net_device * dev, int command); | 54 | extern int arlan_command(struct net_device *dev, int command); |
| 55 | 55 | ||
| 56 | #define SIDUNKNOWN -1 | 56 | #define SIDUNKNOWN -1 |
| 57 | #define radioNodeIdUNKNOWN -1 | 57 | #define radioNodeIdUNKNOWN -1 |
| 58 | #define irqUNKNOWN 0 | 58 | #define irqUNKNOWN 0 |
| @@ -65,22 +65,21 @@ extern int arlan_command(struct net_device * dev, int command); | |||
| 65 | #define registrationModeUNKNOWN -1 | 65 | #define registrationModeUNKNOWN -1 |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | #define IFDEBUG( L ) if ( (L) & arlan_debug ) | 68 | #define IFDEBUG(L) if ((L) & arlan_debug) |
| 69 | #define ARLAN_FAKE_HDR_LEN 12 | 69 | #define ARLAN_FAKE_HDR_LEN 12 |
| 70 | 70 | ||
| 71 | #ifdef ARLAN_DEBUGGING | 71 | #ifdef ARLAN_DEBUGGING |
| 72 | #define DEBUG 1 | 72 | #define DEBUG 1 |
| 73 | #define ARLAN_ENTRY_EXIT_DEBUGGING 1 | 73 | #define ARLAN_ENTRY_EXIT_DEBUGGING 1 |
| 74 | #define ARLAN_DEBUG(a,b) printk(KERN_DEBUG a, b) | 74 | #define ARLAN_DEBUG(a, b) printk(KERN_DEBUG a, b) |
| 75 | #else | 75 | #else |
| 76 | #define ARLAN_DEBUG(a,b) | 76 | #define ARLAN_DEBUG(a, b) |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| 79 | #define ARLAN_SHMEM_SIZE 0x2000 | 79 | #define ARLAN_SHMEM_SIZE 0x2000 |
| 80 | 80 | ||
| 81 | struct arlan_shmem | 81 | struct arlan_shmem { |
| 82 | { | 82 | /* Header Signature */ |
| 83 | /* Header Signature */ | ||
| 84 | volatile char textRegion[48]; | 83 | volatile char textRegion[48]; |
| 85 | volatile u_char resetFlag; | 84 | volatile u_char resetFlag; |
| 86 | volatile u_char diagnosticInfo; | 85 | volatile u_char diagnosticInfo; |
| @@ -94,7 +93,7 @@ struct arlan_shmem | |||
| 94 | volatile u_char radioModule;// shows EEPROM, can be overridden at 0x111 | 93 | volatile u_char radioModule;// shows EEPROM, can be overridden at 0x111 |
| 95 | volatile u_char defaultChannelSet; // shows EEProm, can be overriiden at 0x10A | 94 | volatile u_char defaultChannelSet; // shows EEProm, can be overriiden at 0x10A |
| 96 | volatile u_char _2[47]; | 95 | volatile u_char _2[47]; |
| 97 | 96 | ||
| 98 | /* Control/Status Block - 0x0080 */ | 97 | /* Control/Status Block - 0x0080 */ |
| 99 | volatile u_char interruptInProgress; /* not used by lancpu */ | 98 | volatile u_char interruptInProgress; /* not used by lancpu */ |
| 100 | volatile u_char cntrlRegImage; /* not used by lancpu */ | 99 | volatile u_char cntrlRegImage; /* not used by lancpu */ |
| @@ -113,7 +112,7 @@ struct arlan_shmem | |||
| 113 | volatile u_char rxQuality; | 112 | volatile u_char rxQuality; |
| 114 | volatile u_char scrambled; | 113 | volatile u_char scrambled; |
| 115 | volatile u_char _4[1]; | 114 | volatile u_char _4[1]; |
| 116 | 115 | ||
| 117 | /* Transmit Status - 0x00b0 */ | 116 | /* Transmit Status - 0x00b0 */ |
| 118 | volatile u_char txStatus; | 117 | volatile u_char txStatus; |
| 119 | volatile u_char txAckQuality; | 118 | volatile u_char txAckQuality; |
| @@ -151,7 +150,7 @@ struct arlan_shmem | |||
| 151 | volatile u_short routerId; | 150 | volatile u_short routerId; |
| 152 | volatile u_char _10[9]; | 151 | volatile u_char _10[9]; |
| 153 | volatile u_char txAttenuation; | 152 | volatile u_char txAttenuation; |
| 154 | volatile u_char systemId[4]; | 153 | volatile u_char systemId[4]; |
| 155 | volatile u_short globalChecksum; | 154 | volatile u_short globalChecksum; |
| 156 | volatile u_char _11[4]; | 155 | volatile u_char _11[4]; |
| 157 | volatile u_short maxDatagramSize; | 156 | volatile u_short maxDatagramSize; |
| @@ -207,19 +206,19 @@ struct arlan_shmem | |||
| 207 | volatile u_char hostcpuLock; | 206 | volatile u_char hostcpuLock; |
| 208 | volatile u_char lancpuLock; | 207 | volatile u_char lancpuLock; |
| 209 | volatile u_char resetTime[18]; | 208 | volatile u_char resetTime[18]; |
| 210 | 209 | ||
| 211 | volatile u_char numDatagramsTransmitted[4]; | 210 | volatile u_char numDatagramsTransmitted[4]; |
| 212 | volatile u_char numReTransmissions[4]; | 211 | volatile u_char numReTransmissions[4]; |
| 213 | volatile u_char numFramesDiscarded[4]; | 212 | volatile u_char numFramesDiscarded[4]; |
| 214 | volatile u_char numDatagramsReceived[4]; | 213 | volatile u_char numDatagramsReceived[4]; |
| 215 | volatile u_char numDuplicateReceivedFrames[4]; | 214 | volatile u_char numDuplicateReceivedFrames[4]; |
| 216 | volatile u_char numDatagramsDiscarded[4]; | 215 | volatile u_char numDatagramsDiscarded[4]; |
| 217 | 216 | ||
| 218 | volatile u_short maxNumReTransmitDatagram; | 217 | volatile u_short maxNumReTransmitDatagram; |
| 219 | volatile u_short maxNumReTransmitFrames; | 218 | volatile u_short maxNumReTransmitFrames; |
| 220 | volatile u_short maxNumConsecutiveDuplicateFrames; | 219 | volatile u_short maxNumConsecutiveDuplicateFrames; |
| 221 | /* misaligned here so we have to go to characters */ | 220 | /* misaligned here so we have to go to characters */ |
| 222 | 221 | ||
| 223 | volatile u_char numBytesTransmitted[4]; | 222 | volatile u_char numBytesTransmitted[4]; |
| 224 | volatile u_char numBytesReceived[4]; | 223 | volatile u_char numBytesReceived[4]; |
| 225 | volatile u_char numCRCErrors[4]; | 224 | volatile u_char numCRCErrors[4]; |
| @@ -259,7 +258,7 @@ struct arlan_conf_stru { | |||
| 259 | int channelNumber; | 258 | int channelNumber; |
| 260 | int scramblingDisable; | 259 | int scramblingDisable; |
| 261 | int txAttenuation; | 260 | int txAttenuation; |
| 262 | int systemId; | 261 | int systemId; |
| 263 | int maxDatagramSize; | 262 | int maxDatagramSize; |
| 264 | int maxFrameSize; | 263 | int maxFrameSize; |
| 265 | int maxRetries; | 264 | int maxRetries; |
| @@ -316,8 +315,7 @@ struct arlan_conf_stru { | |||
| 316 | 315 | ||
| 317 | extern struct arlan_conf_stru arlan_conf[MAX_ARLANS]; | 316 | extern struct arlan_conf_stru arlan_conf[MAX_ARLANS]; |
| 318 | 317 | ||
| 319 | struct TxParam | 318 | struct TxParam { |
| 320 | { | ||
| 321 | volatile short offset; | 319 | volatile short offset; |
| 322 | volatile short length; | 320 | volatile short length; |
| 323 | volatile u_char dest[6]; | 321 | volatile u_char dest[6]; |
| @@ -330,12 +328,12 @@ struct TxParam | |||
| 330 | #define TX_RING_SIZE 2 | 328 | #define TX_RING_SIZE 2 |
| 331 | /* Information that need to be kept for each board. */ | 329 | /* Information that need to be kept for each board. */ |
| 332 | struct arlan_private { | 330 | struct arlan_private { |
| 333 | struct arlan_shmem __iomem * card; | 331 | struct arlan_shmem __iomem *card; |
| 334 | struct arlan_shmem * conf; | 332 | struct arlan_shmem *conf; |
| 335 | 333 | ||
| 336 | struct arlan_conf_stru * Conf; | 334 | struct arlan_conf_stru *Conf; |
| 337 | int bad; | 335 | int bad; |
| 338 | int reset; | 336 | int reset; |
| 339 | unsigned long lastReset; | 337 | unsigned long lastReset; |
| 340 | struct timer_list timer; | 338 | struct timer_list timer; |
| 341 | struct timer_list tx_delay_timer; | 339 | struct timer_list tx_delay_timer; |
| @@ -407,38 +405,38 @@ struct arlan_private { | |||
| 407 | 405 | ||
| 408 | #define TXBuffStart(dev) offsetof(struct arlan_shmem, txBuffer) | 406 | #define TXBuffStart(dev) offsetof(struct arlan_shmem, txBuffer) |
| 409 | #define TXBuffEnd(dev) offsetof(struct arlan_shmem, xxBuffer) | 407 | #define TXBuffEnd(dev) offsetof(struct arlan_shmem, xxBuffer) |
| 410 | 408 | ||
| 411 | #define READSHM(to,from,atype) {\ | 409 | #define READSHM(to, from, atype) {\ |
| 412 | atype tmp;\ | 410 | atype tmp;\ |
| 413 | memcpy_fromio(&(tmp),&(from),sizeof(atype));\ | 411 | memcpy_fromio(&(tmp), &(from), sizeof(atype));\ |
| 414 | to = tmp;\ | 412 | to = tmp;\ |
| 415 | } | 413 | } |
| 416 | 414 | ||
| 417 | #define READSHMEM(from,atype)\ | 415 | #define READSHMEM(from, atype)\ |
| 418 | atype from; \ | 416 | atype from; \ |
| 419 | READSHM(from, arlan->from, atype); | 417 | READSHM(from, arlan->from, atype); |
| 420 | 418 | ||
| 421 | #define WRITESHM(to,from,atype) \ | 419 | #define WRITESHM(to, from, atype) \ |
| 422 | { atype tmpSHM = from;\ | 420 | { atype tmpSHM = from;\ |
| 423 | memcpy_toio(&(to),&tmpSHM,sizeof(atype));\ | 421 | memcpy_toio(&(to), &tmpSHM, sizeof(atype));\ |
| 424 | } | 422 | } |
| 425 | 423 | ||
| 426 | #define DEBUGSHM(levelSHM,stringSHM,stuff,atype) \ | 424 | #define DEBUGSHM(levelSHM, stringSHM, stuff, atype) \ |
| 427 | { atype tmpSHM; \ | 425 | { atype tmpSHM; \ |
| 428 | memcpy_fromio(&tmpSHM,&(stuff),sizeof(atype));\ | 426 | memcpy_fromio(&tmpSHM, &(stuff), sizeof(atype));\ |
| 429 | IFDEBUG(levelSHM) printk(stringSHM,tmpSHM);\ | 427 | IFDEBUG(levelSHM) printk(stringSHM, tmpSHM);\ |
| 430 | } | 428 | } |
| 431 | 429 | ||
| 432 | #define WRITESHMB(to, val) \ | 430 | #define WRITESHMB(to, val) \ |
| 433 | writeb(val,&(to)) | 431 | writeb(val, &(to)) |
| 434 | #define READSHMB(to) \ | 432 | #define READSHMB(to) \ |
| 435 | readb(&(to)) | 433 | readb(&(to)) |
| 436 | #define WRITESHMS(to, val) \ | 434 | #define WRITESHMS(to, val) \ |
| 437 | writew(val,&(to)) | 435 | writew(val, &(to)) |
| 438 | #define READSHMS(to) \ | 436 | #define READSHMS(to) \ |
| 439 | readw(&(to)) | 437 | readw(&(to)) |
| 440 | #define WRITESHMI(to, val) \ | 438 | #define WRITESHMI(to, val) \ |
| 441 | writel(val,&(to)) | 439 | writel(val, &(to)) |
| 442 | #define READSHMI(to) \ | 440 | #define READSHMI(to) \ |
| 443 | readl(&(to)) | 441 | readl(&(to)) |
| 444 | 442 | ||
| @@ -447,51 +445,51 @@ struct arlan_private { | |||
| 447 | 445 | ||
| 448 | 446 | ||
| 449 | #define registrationBad(dev)\ | 447 | #define registrationBad(dev)\ |
| 450 | ( ( READSHMB(((struct arlan_private *)netdev_priv(dev))->card->registrationMode) > 0) && \ | 448 | (( READSHMB(((struct arlan_private *)netdev_priv(dev))->card->registrationMode) > 0) && \ |
| 451 | ( READSHMB(((struct arlan_private *)netdev_priv(dev))->card->registrationStatus) == 0) ) | 449 | ( READSHMB(((struct arlan_private *)netdev_priv(dev))->card->registrationStatus) == 0)) |
| 452 | 450 | ||
| 453 | 451 | ||
| 454 | #define readControlRegister(dev)\ | 452 | #define readControlRegister(dev)\ |
| 455 | READSHMB(((struct arlan_private *)netdev_priv(dev))->card->cntrlRegImage) | 453 | READSHMB(((struct arlan_private *)netdev_priv(dev))->card->cntrlRegImage) |
| 456 | 454 | ||
| 457 | #define writeControlRegister(dev, v){\ | 455 | #define writeControlRegister(dev, v) {\ |
| 458 | WRITESHMB(((struct arlan_private *)netdev_priv(dev))->card->cntrlRegImage ,((v) &0xF) );\ | 456 | WRITESHMB(((struct arlan_private *)netdev_priv(dev))->card->cntrlRegImage, ((v) & 0xF));\ |
| 459 | WRITESHMB(((struct arlan_private *)netdev_priv(dev))->card->controlRegister ,(v) );} | 457 | WRITESHMB(((struct arlan_private *)netdev_priv(dev))->card->controlRegister, (v)); } |
| 460 | 458 | ||
| 461 | 459 | ||
| 462 | #define arlan_interrupt_lancpu(dev) {\ | 460 | #define arlan_interrupt_lancpu(dev) {\ |
| 463 | int cr; \ | 461 | int cr; \ |
| 464 | \ | 462 | \ |
| 465 | cr = readControlRegister(dev);\ | 463 | cr = readControlRegister(dev);\ |
| 466 | if (cr & ARLAN_CHANNEL_ATTENTION){ \ | 464 | if (cr & ARLAN_CHANNEL_ATTENTION) { \ |
| 467 | writeControlRegister(dev, (cr & ~ARLAN_CHANNEL_ATTENTION));\ | 465 | writeControlRegister(dev, (cr & ~ARLAN_CHANNEL_ATTENTION));\ |
| 468 | }else \ | 466 | } else \ |
| 469 | writeControlRegister(dev, (cr | ARLAN_CHANNEL_ATTENTION));\ | 467 | writeControlRegister(dev, (cr | ARLAN_CHANNEL_ATTENTION));\ |
| 470 | } | 468 | } |
| 471 | 469 | ||
| 472 | #define clearChannelAttention(dev){ \ | 470 | #define clearChannelAttention(dev) { \ |
| 473 | writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_CHANNEL_ATTENTION);} | 471 | writeControlRegister(dev, readControlRegister(dev) & ~ARLAN_CHANNEL_ATTENTION); } |
| 474 | #define setHardwareReset(dev) {\ | 472 | #define setHardwareReset(dev) {\ |
| 475 | writeControlRegister(dev,readControlRegister(dev) | ARLAN_RESET);} | 473 | writeControlRegister(dev, readControlRegister(dev) | ARLAN_RESET); } |
| 476 | #define clearHardwareReset(dev) {\ | 474 | #define clearHardwareReset(dev) {\ |
| 477 | writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_RESET);} | 475 | writeControlRegister(dev, readControlRegister(dev) & ~ARLAN_RESET); } |
| 478 | #define setInterruptEnable(dev){\ | 476 | #define setInterruptEnable(dev) {\ |
| 479 | writeControlRegister(dev,readControlRegister(dev) | ARLAN_INTERRUPT_ENABLE) ;} | 477 | writeControlRegister(dev, readControlRegister(dev) | ARLAN_INTERRUPT_ENABLE) ; } |
| 480 | #define clearInterruptEnable(dev){\ | 478 | #define clearInterruptEnable(dev) {\ |
| 481 | writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_INTERRUPT_ENABLE) ;} | 479 | writeControlRegister(dev, readControlRegister(dev) & ~ARLAN_INTERRUPT_ENABLE) ; } |
| 482 | #define setClearInterrupt(dev){\ | 480 | #define setClearInterrupt(dev) {\ |
| 483 | writeControlRegister(dev,readControlRegister(dev) | ARLAN_CLEAR_INTERRUPT) ;} | 481 | writeControlRegister(dev, readControlRegister(dev) | ARLAN_CLEAR_INTERRUPT) ; } |
| 484 | #define clearClearInterrupt(dev){\ | 482 | #define clearClearInterrupt(dev) {\ |
| 485 | writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_CLEAR_INTERRUPT);} | 483 | writeControlRegister(dev, readControlRegister(dev) & ~ARLAN_CLEAR_INTERRUPT); } |
| 486 | #define setPowerOff(dev){\ | 484 | #define setPowerOff(dev) {\ |
| 487 | writeControlRegister(dev,readControlRegister(dev) | (ARLAN_POWER && ARLAN_ACCESS));\ | 485 | writeControlRegister(dev, readControlRegister(dev) | (ARLAN_POWER && ARLAN_ACCESS));\ |
| 488 | writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_ACCESS);} | 486 | writeControlRegister(dev, readControlRegister(dev) & ~ARLAN_ACCESS); } |
| 489 | #define setPowerOn(dev){\ | 487 | #define setPowerOn(dev) {\ |
| 490 | writeControlRegister(dev,readControlRegister(dev) & ~(ARLAN_POWER)); } | 488 | writeControlRegister(dev, readControlRegister(dev) & ~(ARLAN_POWER)); } |
| 491 | #define arlan_lock_card_access(dev){\ | 489 | #define arlan_lock_card_access(dev) {\ |
| 492 | writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_ACCESS);} | 490 | writeControlRegister(dev, readControlRegister(dev) & ~ARLAN_ACCESS); } |
| 493 | #define arlan_unlock_card_access(dev){\ | 491 | #define arlan_unlock_card_access(dev) {\ |
| 494 | writeControlRegister(dev,readControlRegister(dev) | ARLAN_ACCESS ); } | 492 | writeControlRegister(dev, readControlRegister(dev) | ARLAN_ACCESS); } |
| 495 | 493 | ||
| 496 | 494 | ||
| 497 | 495 | ||
| @@ -525,7 +523,6 @@ struct arlan_private { | |||
| 525 | | ARLAN_COMMAND_RESET) | 523 | | ARLAN_COMMAND_RESET) |
| 526 | 524 | ||
| 527 | 525 | ||
| 528 | |||
| 529 | #define ARLAN_DEBUG_CHAIN_LOCKS 0x00001 | 526 | #define ARLAN_DEBUG_CHAIN_LOCKS 0x00001 |
| 530 | #define ARLAN_DEBUG_RESET 0x00002 | 527 | #define ARLAN_DEBUG_RESET 0x00002 |
| 531 | #define ARLAN_DEBUG_TIMING 0x00004 | 528 | #define ARLAN_DEBUG_TIMING 0x00004 |
| @@ -536,4 +533,3 @@ struct arlan_private { | |||
| 536 | #define ARLAN_DEBUG_INTERRUPT 0x00080 | 533 | #define ARLAN_DEBUG_INTERRUPT 0x00080 |
| 537 | #define ARLAN_DEBUG_STARTUP 0x00100 | 534 | #define ARLAN_DEBUG_STARTUP 0x00100 |
| 538 | #define ARLAN_DEBUG_SHUTDOWN 0x00200 | 535 | #define ARLAN_DEBUG_SHUTDOWN 0x00200 |
| 539 | |||
