diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 15:19:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 15:19:35 -0700 |
commit | 6445ced8670f37cfc2c5e24a9de9b413dbfc788d (patch) | |
tree | 7c98481159008a4080cda929ea8c7bc7598a2c39 /drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | |
parent | e6bee325e49f17c65c1fd66e9e8b348c85788341 (diff) | |
parent | 12bb12fac06d6212be9a5ed282c5670d4e90747f (diff) |
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (961 commits)
staging: hv: fix memory leaks
staging: hv: Remove NULL check before kfree
Staging: hv: Get rid of vmbus_child_dev_add()
Staging: hv: Change the signature for vmbus_child_device_register()
Staging: hv: Get rid of vmbus_cleanup() function
Staging: hv: Get rid of vmbus_dev_rm() function
Staging: hv: Change the signature for vmbus_on_isr()
Staging: hv: Eliminate vmbus_event_dpc()
Staging: hv: Get rid of the function vmbus_msg_dpc()
Staging: hv: Change the signature for vmbus_cleanup()
Staging: hv: Simplify root device management
staging: rtl8192e: Don't copy dev pointer to skb
staging: rtl8192e: Pass priv to cmdpkt functions
staging: rtl8192e: Pass priv to firmware download functions
staging: rtl8192e: Pass priv to rtl8192_interrupt
staging: rtl8192e: Pass rtl8192_priv to dm functions
staging: rtl8192e: Pass ieee80211_device to callbacks
staging: rtl8192e: Pass ieee80211_device to callbacks
staging: rtl8192e: Pass ieee80211_device to callbacks
staging: rtl8192e: Pass ieee80211_device to callbacks
...
Diffstat (limited to 'drivers/staging/ft1000/ft1000-usb/ft1000_hw.c')
-rw-r--r-- | drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 2201 |
1 files changed, 1079 insertions, 1122 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 643a63794ade..78dcd49bb985 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -65,45 +65,26 @@ static u8 tempbuffer[1600]; // Notes: // //--------------------------------------------------------------------------- -static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, - u8 request, - u8 requesttype, - u16 value, - u16 index, - void *data, - u16 size, - int timeout) +static int ft1000_control(struct ft1000_device *ft1000dev, unsigned int pipe, + u8 request, u8 requesttype, u16 value, u16 index, + void *data, u16 size, int timeout) { u16 ret; - if (ft1000dev == NULL ) - { - DEBUG("NULL ft1000dev, failure\n"); - return -ENODEV; - } - else if ( ft1000dev->dev == NULL ) - { - DEBUG("NULL ft1000dev->dev, failure\n"); - return -ENODEV; - } + if ((ft1000dev == NULL) || (ft1000dev->dev == NULL)) { + DEBUG("ft1000dev or ft1000dev->dev == NULL, failure\n"); + return -ENODEV; + } - ret = usb_control_msg(ft1000dev->dev, - pipe, - request, - requesttype, - value, - index, - data, - size, - LARGE_TIMEOUT); + ret = usb_control_msg(ft1000dev->dev, pipe, request, requesttype, + value, index, data, size, LARGE_TIMEOUT); if (ret > 0) ret = 0; - return ret; - - + return ret; } + //--------------------------------------------------------------------------- // Function: ft1000_read_register // @@ -120,28 +101,22 @@ static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, // //--------------------------------------------------------------------------- -u16 ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, u16 nRegIndx) +int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, + u16 nRegIndx) { - u16 ret = STATUS_SUCCESS; - - //DEBUG("ft1000_read_register: reg index is %d\n", nRegIndx); - //DEBUG("ft1000_read_register: spin_lock locked\n"); - ret = ft1000_control(ft1000dev, - usb_rcvctrlpipe(ft1000dev->dev,0), - HARLEY_READ_REGISTER, //request --READ_REGISTER - HARLEY_READ_OPERATION, //requestType - 0, //value - nRegIndx, //index - Data, //data - 2, //data size - LARGE_TIMEOUT ); //timeout - - //DEBUG("ft1000_read_register: ret is %d \n", ret); - - //DEBUG("ft1000_read_register: data is %x \n", *Data); - - return ret; + int ret = STATUS_SUCCESS; + + ret = ft1000_control(ft1000dev, + usb_rcvctrlpipe(ft1000dev->dev, 0), + HARLEY_READ_REGISTER, + HARLEY_READ_OPERATION, + 0, + nRegIndx, + Data, + 2, + LARGE_TIMEOUT); + return ret; } //--------------------------------------------------------------------------- @@ -159,23 +134,22 @@ u16 ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, u16 nRegInd // Notes: // //--------------------------------------------------------------------------- -u16 ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, u16 nRegIndx) +int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, + u16 nRegIndx) { - u16 ret = STATUS_SUCCESS; - - //DEBUG("ft1000_write_register: value is: %d, reg index is: %d\n", value, nRegIndx); + int ret = STATUS_SUCCESS; + + ret = ft1000_control(ft1000dev, + usb_sndctrlpipe(ft1000dev->dev, 0), + HARLEY_WRITE_REGISTER, + HARLEY_WRITE_OPERATION, + value, + nRegIndx, + NULL, + 0, + LARGE_TIMEOUT); - ret = ft1000_control(ft1000dev, - usb_sndctrlpipe(ft1000dev->dev, 0), - HARLEY_WRITE_REGISTER, //request -- WRITE_REGISTER - HARLEY_WRITE_OPERATION, //requestType - value, - nRegIndx, - NULL, - 0, - LARGE_TIMEOUT ); - - return ret; + return ret; } //--------------------------------------------------------------------------- @@ -195,27 +169,22 @@ u16 ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, u16 nRegIn // //--------------------------------------------------------------------------- -u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt) +int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, + u16 cnt) { - u16 ret = STATUS_SUCCESS; - - //DEBUG("ft1000_read_dpram32: indx: %d cnt: %d\n", indx, cnt); - ret =ft1000_control(ft1000dev, - usb_rcvctrlpipe(ft1000dev->dev,0), - HARLEY_READ_DPRAM_32, //request --READ_DPRAM_32 - HARLEY_READ_OPERATION, //requestType - 0, //value - indx, //index - buffer, //data - cnt, //data size - LARGE_TIMEOUT ); //timeout - - //DEBUG("ft1000_read_dpram32: ret is %d \n", ret); - - //DEBUG("ft1000_read_dpram32: ret=%d \n", ret); - - return ret; + int ret = STATUS_SUCCESS; + + ret = ft1000_control(ft1000dev, + usb_rcvctrlpipe(ft1000dev->dev, 0), + HARLEY_READ_DPRAM_32, + HARLEY_READ_OPERATION, + 0, + indx, + buffer, + cnt, + LARGE_TIMEOUT); + return ret; } //--------------------------------------------------------------------------- @@ -234,25 +203,25 @@ u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u // Notes: // //--------------------------------------------------------------------------- -u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt) +int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, + u16 cnt) { - u16 ret = STATUS_SUCCESS; - - //DEBUG("ft1000_write_dpram32: indx: %d buffer: %x cnt: %d\n", indx, buffer, cnt); - if ( cnt % 4) - cnt += cnt - (cnt % 4); - - ret = ft1000_control(ft1000dev, - usb_sndctrlpipe(ft1000dev->dev, 0), - HARLEY_WRITE_DPRAM_32, //request -- WRITE_DPRAM_32 - HARLEY_WRITE_OPERATION, //requestType - 0, //value - indx, //index - buffer, //buffer - cnt, //buffer size - LARGE_TIMEOUT ); - - return ret; + int ret = STATUS_SUCCESS; + + if (cnt % 4) + cnt += cnt - (cnt % 4); + + ret = ft1000_control(ft1000dev, + usb_sndctrlpipe(ft1000dev->dev, 0), + HARLEY_WRITE_DPRAM_32, + HARLEY_WRITE_OPERATION, + 0, + indx, + buffer, + cnt, + LARGE_TIMEOUT); + + return ret; } //--------------------------------------------------------------------------- @@ -271,36 +240,28 @@ u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, // Notes: // //--------------------------------------------------------------------------- -u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u8 highlow) +int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, + u8 highlow) { - u16 ret = STATUS_SUCCESS; - - //DEBUG("ft1000_read_dpram16: indx: %d hightlow: %d\n", indx, highlow); - - u8 request; - - if (highlow == 0 ) - request = HARLEY_READ_DPRAM_LOW; - else - request = HARLEY_READ_DPRAM_HIGH; - - ret = ft1000_control(ft1000dev, - usb_rcvctrlpipe(ft1000dev->dev,0), - request, //request --READ_DPRAM_H/L - HARLEY_READ_OPERATION, //requestType - 0, //value - indx, //index - buffer, //data - 2, //data size - LARGE_TIMEOUT ); //timeout - - //DEBUG("ft1000_read_dpram16: ret is %d \n", ret); - - - //DEBUG("ft1000_read_dpram16: data is %x \n", *buffer); - - return ret; + int ret = STATUS_SUCCESS; + u8 request; + + if (highlow == 0) + request = HARLEY_READ_DPRAM_LOW; + else + request = HARLEY_READ_DPRAM_HIGH; + + ret = ft1000_control(ft1000dev, + usb_rcvctrlpipe(ft1000dev->dev, 0), + request, + HARLEY_READ_OPERATION, + 0, + indx, + buffer, + 2, + LARGE_TIMEOUT); + return ret; } //--------------------------------------------------------------------------- @@ -319,33 +280,27 @@ u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u // Notes: // //--------------------------------------------------------------------------- -u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u8 highlow) +int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u8 highlow) { - u16 ret = STATUS_SUCCESS; - - + int ret = STATUS_SUCCESS; + u8 request; + + if (highlow == 0) + request = HARLEY_WRITE_DPRAM_LOW; + else + request = HARLEY_WRITE_DPRAM_HIGH; + + ret = ft1000_control(ft1000dev, + usb_sndctrlpipe(ft1000dev->dev, 0), + request, + HARLEY_WRITE_OPERATION, + value, + indx, + NULL, + 0, + LARGE_TIMEOUT); - //DEBUG("ft1000_write_dpram16: indx: %d value: %d highlow: %d\n", indx, value, highlow); - - u8 request; - - - if ( highlow == 0 ) - request = HARLEY_WRITE_DPRAM_LOW; - else - request = HARLEY_WRITE_DPRAM_HIGH; - - ret = ft1000_control(ft1000dev, - usb_sndctrlpipe(ft1000dev->dev, 0), - request, //request -- WRITE_DPRAM_H/L - HARLEY_WRITE_OPERATION, //requestType - value, //value - indx, //index - NULL, //buffer - 0, //buffer size - LARGE_TIMEOUT ); - - return ret; + return ret; } //--------------------------------------------------------------------------- @@ -364,36 +319,31 @@ u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u // Notes: // //--------------------------------------------------------------------------- -u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer) +int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, + u8 *buffer) { - u8 buf[16]; - u16 pos; - u16 ret = STATUS_SUCCESS; - - //DEBUG("fix_ft1000_read_dpram32: indx: %d \n", indx); - pos = (indx / 4)*4; - ret = ft1000_read_dpram32(ft1000dev, pos, buf, 16); - if (ret == STATUS_SUCCESS) - { - pos = (indx % 4)*4; - *buffer++ = buf[pos++]; - *buffer++ = buf[pos++]; - *buffer++ = buf[pos++]; - *buffer++ = buf[pos++]; - } - else - { - DEBUG("fix_ft1000_read_dpram32: DPRAM32 Read failed\n"); - *buffer++ = 0; - *buffer++ = 0; - *buffer++ = 0; - *buffer++ = 0; - - } - - //DEBUG("fix_ft1000_read_dpram32: data is %x \n", *buffer); - return ret; + u8 buf[16]; + u16 pos; + int ret = STATUS_SUCCESS; + + pos = (indx / 4) * 4; + ret = ft1000_read_dpram32(ft1000dev, pos, buf, 16); + + if (ret == STATUS_SUCCESS) { + pos = (indx % 4) * 4; + *buffer++ = buf[pos++]; + *buffer++ = buf[pos++]; + *buffer++ = buf[pos++]; + *buffer++ = buf[pos++]; + } else { + DEBUG("fix_ft1000_read_dpram32: DPRAM32 Read failed\n"); + *buffer++ = 0; + *buffer++ = 0; + *buffer++ = 0; + *buffer++ = 0; + } + return ret; } @@ -413,70 +363,60 @@ u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffe // Notes: // //--------------------------------------------------------------------------- -u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer) +int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer) { - u16 pos1; - u16 pos2; - u16 i; - u8 buf[32]; - u8 resultbuffer[32]; - u8 *pdata; - u16 ret = STATUS_SUCCESS; - - //DEBUG("fix_ft1000_write_dpram32: Entered:\n"); - - pos1 = (indx / 4)*4; - pdata = buffer; - ret = ft1000_read_dpram32(ft1000dev, pos1, buf, 16); - if (ret == STATUS_SUCCESS) - { - pos2 = (indx % 4)*4; - buf[pos2++] = *buffer++; - buf[pos2++] = *buffer++; - buf[pos2++] = *buffer++; - buf[pos2++] = *buffer++; - ret = ft1000_write_dpram32(ft1000dev, pos1, buf, 16); - } - else - { - DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n"); - - return ret; - } - - ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16); - if (ret == STATUS_SUCCESS) - { - buffer = pdata; - for (i=0; i<16; i++) - { - if (buf[i] != resultbuffer[i]){ + u16 pos1; + u16 pos2; + u16 i; + u8 buf[32]; + u8 resultbuffer[32]; + u8 *pdata; + int ret = STATUS_SUCCESS; + + pos1 = (indx / 4) * 4; + pdata = buffer; + ret = ft1000_read_dpram32(ft1000dev, pos1, buf, 16); + + if (ret == STATUS_SUCCESS) { + pos2 = (indx % 4)*4; + buf[pos2++] = *buffer++; + buf[pos2++] = *buffer++; + buf[pos2++] = *buffer++; + buf[pos2++] = *buffer++; + ret = ft1000_write_dpram32(ft1000dev, pos1, buf, 16); + } else { + DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n"); + return ret; + } - ret = STATUS_FAILURE; - } - } - } + ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16); - if (ret == STATUS_FAILURE) - { - ret = ft1000_write_dpram32(ft1000dev, pos1, (u8 *)&tempbuffer[0], 16); - ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16); - if (ret == STATUS_SUCCESS) - { - buffer = pdata; - for (i=0; i<16; i++) - { - if (tempbuffer[i] != resultbuffer[i]) - { - ret = STATUS_FAILURE; - DEBUG("fix_ft1000_write_dpram32 Failed to write\n"); - } - } - } - } + if (ret == STATUS_SUCCESS) { + buffer = pdata; + for (i = 0; i < 16; i++) { + if (buf[i] != resultbuffer[i]) + ret = STATUS_FAILURE; + } + } - return ret; + if (ret == STATUS_FAILURE) { + ret = ft1000_write_dpram32(ft1000dev, pos1, + (u8 *)&tempbuffer[0], 16); + ret = ft1000_read_dpram32(ft1000dev, pos1, + (u8 *)&resultbuffer[0], 16); + if (ret == STATUS_SUCCESS) { + buffer = pdata; + for (i = 0; i < 16; i++) { + if (tempbuffer[i] != resultbuffer[i]) { + ret = STATUS_FAILURE; + DEBUG("%s Failed to write\n", + __func__); + } + } + } + } + return ret; } @@ -490,37 +430,44 @@ u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buff // // Returns: None //----------------------------------------------------------------------- -static void card_reset_dsp (struct ft1000_device *ft1000dev, bool value) +static void card_reset_dsp(struct ft1000_device *ft1000dev, bool value) { - u16 status = STATUS_SUCCESS; - u16 tempword; - - status = ft1000_write_register (ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); - status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_CTRL); - if (value) - { - DEBUG("Reset DSP\n"); - status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); - tempword |= DSP_RESET_BIT; - status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); - } - else - { - DEBUG("Activate DSP\n"); - status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); - tempword |= DSP_ENCRYPTED; - tempword &= ~DSP_UNENCRYPTED; - status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); - status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); - tempword &= ~EFUSE_MEM_DISABLE; - tempword &= ~DSP_RESET_BIT; - status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); - status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); - } + u16 status = STATUS_SUCCESS; + u16 tempword; + + status = ft1000_write_register(ft1000dev, HOST_INTF_BE, + FT1000_REG_SUP_CTRL); + status = ft1000_read_register(ft1000dev, &tempword, + FT1000_REG_SUP_CTRL); + + if (value) { + DEBUG("Reset DSP\n"); + status = ft1000_read_register(ft1000dev, &tempword, + FT1000_REG_RESET); + tempword |= DSP_RESET_BIT; + status = ft1000_write_register(ft1000dev, tempword, + FT1000_REG_RESET); + } else { + DEBUG("Activate DSP\n"); + status = ft1000_read_register(ft1000dev, &tempword, + FT1000_REG_RESET); + tempword |= DSP_ENCRYPTED; + tempword &= ~DSP_UNENCRYPTED; + status = ft1000_write_register(ft1000dev, tempword, + FT1000_REG_RESET); + status = ft1000_read_register(ft1000dev, &tempword, + FT1000_REG_RESET); + tempword &= ~EFUSE_MEM_DISABLE; + tempword &= ~DSP_RESET_BIT; + status = ft1000_write_register(ft1000dev, tempword, + FT1000_REG_RESET); + status = ft1000_read_register(ft1000dev, &tempword, + FT1000_REG_RESET); + } } //--------------------------------------------------------------------------- -// Function: CardSendCommand +// Function: card_send_command // // Parameters: ft1000_device - device structure // ptempbuffer - command buffer @@ -534,51 +481,47 @@ static void card_reset_dsp (struct ft1000_device *ft1000dev, bool value) // Notes: // //--------------------------------------------------------------------------- -void CardSendCommand(struct ft1000_device *ft1000dev, void *ptempbuffer, int size) +void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, + int size) { - unsigned short temp; - unsigned char *commandbuf; + unsigned short temp; + unsigned char *commandbuf; - DEBUG("CardSendCommand: enter CardSendCommand... size=%d\n", size); + DEBUG("card_send_command: enter card_send_command... size=%d\n", size); - commandbuf =(unsigned char*) kmalloc(size+2, GFP_KERNEL); - memcpy((void*)commandbuf+2, (void*)ptempbuffer, size); + commandbuf = (unsigned char *)kmalloc(size + 2, GFP_KERNEL); + memcpy((void *)commandbuf + 2, (void *)ptempbuffer, size); - //DEBUG("CardSendCommand: Command Send\n"); + //DEBUG("card_send_command: Command Send\n"); - ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); + ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); - if (temp & 0x0100) - { - msleep(10); - } + if (temp & 0x0100) + msleep(10); - // check for odd word - size = size + 2; - if (size % 4) - { - // Must force to be 32 bit aligned - size += 4 - (size % 4); - } + /* check for odd word */ + size = size + 2; + /* Must force to be 32 bit aligned */ + if (size % 4) + size += 4 - (size % 4); - //DEBUG("CardSendCommand: write dpram ... size=%d\n", size); - ft1000_write_dpram32(ft1000dev, 0,commandbuf, size); - msleep(1); - //DEBUG("CardSendCommand: write into doorbell ...\n"); - ft1000_write_register(ft1000dev, FT1000_DB_DPRAM_TX ,FT1000_REG_DOORBELL) ; - msleep(1); + //DEBUG("card_send_command: write dpram ... size=%d\n", size); + ft1000_write_dpram32(ft1000dev, 0, commandbuf, size); + msleep(1); + //DEBUG("card_send_command: write into doorbell ...\n"); + ft1000_write_register(ft1000dev, FT1000_DB_DPRAM_TX, + FT1000_REG_DOORBELL); + msleep(1); - ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); - //DEBUG("CardSendCommand: read doorbell ...temp=%x\n", temp); - if ( (temp & 0x0100) == 0) - { - //DEBUG("CardSendCommand: Message sent\n"); - } + ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); + //DEBUG("card_send_command: read doorbell ...temp=%x\n", temp); + if ((temp & 0x0100) == 0) { + //DEBUG("card_send_command: Message sent\n"); + } } - //-------------------------------------------------------------------------- // // Function: dsp_reload @@ -591,49 +534,52 @@ void CardSendCommand(struct ft1000_device *ft1000dev, void *ptempbuffer, int siz //----------------------------------------------------------------------- int dsp_reload(struct ft1000_device *ft1000dev) { - u16 status; - u16 tempword; - u32 templong; + u16 status; + u16 tempword; + u32 templong; struct ft1000_info *pft1000info; - pft1000info = netdev_priv(ft1000dev->net); + pft1000info = netdev_priv(ft1000dev->net); - pft1000info->CardReady = 0; + pft1000info->CardReady = 0; - // Program Interrupt Mask register - status = ft1000_write_register (ft1000dev, 0xffff, FT1000_REG_SUP_IMASK); + /* Program Interrupt Mask register */ + status = ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_SUP_IMASK); - status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_RESET); - tempword |= ASIC_RESET_BIT; - status = ft1000_write_register (ft1000dev, tempword, FT1000_REG_RESET); - msleep(1000); - status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_RESET); - DEBUG("Reset Register = 0x%x\n", tempword); + status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); + tempword |= ASIC_RESET_BIT; + status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); + msleep(1000); + status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); + DEBUG("Reset Register = 0x%x\n", tempword); - // Toggle DSP reset - card_reset_dsp (ft1000dev, 1); - msleep(1000); - card_reset_dsp (ft1000dev, 0); - msleep(1000); + /* Toggle DSP reset */ + card_reset_dsp(ft1000dev, 1); + msleep(1000); + card_reset_dsp(ft1000dev, 0); + msleep(1000); - status = ft1000_write_register (ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); + status = + ft1000_write_register(ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); - // Let's check for FEFE - status = ft1000_read_dpram32 (ft1000dev, FT1000_MAG_DPRAM_FEFE_INDX, (u8 *)&templong, 4); - DEBUG("templong (fefe) = 0x%8x\n", templong); + /* Let's check for FEFE */ + status = + ft1000_read_dpram32(ft1000dev, FT1000_MAG_DPRAM_FEFE_INDX, + (u8 *) &templong, 4); + DEBUG("templong (fefe) = 0x%8x\n", templong); - // call codeloader - status = scram_dnldr(ft1000dev, pFileStart, FileLength); + /* call codeloader */ + status = scram_dnldr(ft1000dev, pFileStart, FileLength); if (status != STATUS_SUCCESS) return -EIO; - msleep(1000); + msleep(1000); - DEBUG("dsp_reload returned\n"); - return 0; + DEBUG("dsp_reload returned\n"); + return 0; } //--------------------------------------------------------------------------- @@ -647,32 +593,33 @@ int dsp_reload(struct ft1000_device *ft1000dev) // none // //--------------------------------------------------------------------------- -static void ft1000_reset_asic (struct net_device *dev) +static void ft1000_reset_asic(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); - struct ft1000_device *ft1000dev = info->pFt1000Dev; - u16 tempword; + struct ft1000_device *ft1000dev = info->pFt1000Dev; + u16 tempword; - DEBUG("ft1000_hw:ft1000_reset_asic called\n"); + DEBUG("ft1000_hw:ft1000_reset_asic called\n"); - info->ASICResetNum++; + info->ASICResetNum++; - // Let's use the register provided by the Magnemite ASIC to reset the - // ASIC and DSP. - ft1000_write_register(ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT), FT1000_REG_RESET ); + /* Let's use the register provided by the Magnemite ASIC to reset the + * ASIC and DSP. + */ + ft1000_write_register(ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT), + FT1000_REG_RESET); - mdelay(1); + mdelay(1); - // set watermark to -1 in order to not generate an interrrupt - ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_MAG_WATERMARK); - - // clear interrupts - ft1000_read_register (ft1000dev, &tempword, FT1000_REG_SUP_ISR); - DEBUG("ft1000_hw: interrupt status register = 0x%x\n",tempword); - ft1000_write_register (ft1000dev, tempword, FT1000_REG_SUP_ISR); - ft1000_read_register (ft1000dev, &tempword, FT1000_REG_SUP_ISR); - DEBUG("ft1000_hw: interrupt status register = 0x%x\n",tempword); + /* set watermark to -1 in order to not generate an interrrupt */ + ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_MAG_WATERMARK); + /* clear interrupts */ + ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_ISR); + DEBUG("ft1000_hw: interrupt status register = 0x%x\n", tempword); + ft1000_write_register(ft1000dev, tempword, FT1000_REG_SUP_ISR); + ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_ISR); + DEBUG("ft1000_hw: interrupt status register = 0x%x\n", tempword); } @@ -687,54 +634,53 @@ static void ft1000_reset_asic (struct net_device *dev) // TRUE (card reset successful) // //--------------------------------------------------------------------------- -static int ft1000_reset_card (struct net_device *dev) +static int ft1000_reset_card(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); - struct ft1000_device *ft1000dev = info->pFt1000Dev; - u16 tempword; + struct ft1000_device *ft1000dev = info->pFt1000Dev; + u16 tempword; struct prov_record *ptr; - DEBUG("ft1000_hw:ft1000_reset_card called.....\n"); - - info->fCondResetPend = 1; - info->CardReady = 0; - info->fProvComplete = 0; - - // Make sure we free any memory reserve for provisioning - while (list_empty(&info->prov_list) == 0) { - DEBUG("ft1000_hw:ft1000_reset_card:deleting provisioning record\n"); - ptr = list_entry(info->prov_list.next, struct prov_record, list); - list_del(&ptr->list); - kfree(ptr->pprov_data); - kfree(ptr); - } - - DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n"); - //reset ASIC - ft1000_reset_asic(dev); + DEBUG("ft1000_hw:ft1000_reset_card called.....\n"); - info->DSPResetNum++; + info->fCondResetPend = 1; + info->CardReady = 0; + info->fProvComplete = 0; - DEBUG("ft1000_hw:ft1000_reset_card: call dsp_reload\n"); - dsp_reload(ft1000dev); + /* Make sure we free any memory reserve for provisioning */ + while (list_empty(&info->prov_list) == 0) { + DEBUG("ft1000_reset_card:deleting provisioning record\n"); + ptr = + list_entry(info->prov_list.next, struct prov_record, list); + list_del(&ptr->list); + kfree(ptr->pprov_data); + kfree(ptr); + } - DEBUG("dsp reload successful\n"); + DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n"); + ft1000_reset_asic(dev); + info->DSPResetNum++; - mdelay(10); + DEBUG("ft1000_hw:ft1000_reset_card: call dsp_reload\n"); + dsp_reload(ft1000dev); - // Initialize DSP heartbeat area to ho - ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag, FT1000_MAG_HI_HO_INDX); - ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO, (u8 *)&tempword, FT1000_MAG_HI_HO_INDX); - DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword); + DEBUG("dsp reload successful\n"); + mdelay(10); + /* Initialize DSP heartbeat area */ + ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag, + FT1000_MAG_HI_HO_INDX); + ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO, (u8 *) &tempword, + FT1000_MAG_HI_HO_INDX); + DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword); - info->CardReady = 1; + info->CardReady = 1; - info->fCondResetPend = 0; - return TRUE; + info->fCondResetPend = 0; + return TRUE; } @@ -742,10 +688,10 @@ static int ft1000_reset_card (struct net_device *dev) #ifdef HAVE_NET_DEVICE_OPS static const struct net_device_ops ftnet_ops = { -.ndo_open = &ft1000_open, -.ndo_stop = &ft1000_close, -.ndo_start_xmit = &ft1000_start_xmit, -.ndo_get_stats = &ft1000_netdev_stats, + .ndo_open = &ft1000_open, + .ndo_stop = &ft1000_close, + .ndo_start_xmit = &ft1000_start_xmit, + .ndo_get_stats = &ft1000_netdev_stats, }; #endif @@ -764,9 +710,9 @@ static const struct net_device_ops ftnet_ops = // Notes: // //--------------------------------------------------------------------------- -u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) +int init_ft1000_netdev(struct ft1000_device *ft1000dev) { - struct net_device *netdev; + struct net_device *netdev; struct ft1000_info *pInfo = NULL; struct dpram_blk *pdpram_blk; int i, ret_val; @@ -774,27 +720,23 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) char card_nr[2]; unsigned long gCardIndex = 0; - DEBUG("Enter init_ft1000_netdev...\n"); - + DEBUG("Enter init_ft1000_netdev...\n"); netdev = alloc_etherdev(sizeof(struct ft1000_info)); - if (!netdev ) - { - DEBUG("init_ft1000_netdev: can not allocate network device\n"); - return -ENOMEM; - } + if (!netdev) { + DEBUG("init_ft1000_netdev: can not allocate network device\n"); + return -ENOMEM; + } pInfo = netdev_priv(netdev); - //DEBUG("init_ft1000_netdev: gFt1000Info=%x, netdev=%x, ft1000dev=%x\n", gFt1000Info, netdev, ft1000dev); - memset(pInfo, 0, sizeof(struct ft1000_info)); - dev_alloc_name(netdev, netdev->name); + dev_alloc_name(netdev, netdev->name); - DEBUG("init_ft1000_netdev: network device name is %s\n", netdev->name); + DEBUG("init_ft1000_netdev: network device name is %s\n", netdev->name); - if ( strncmp(netdev->name,"eth", 3) == 0) { + if (strncmp(netdev->name, "eth", 3) == 0) { card_nr[0] = netdev->name[3]; card_nr[1] = '\0'; ret_val = strict_strtoul(card_nr, 10, &gCardIndex); @@ -803,89 +745,83 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) goto err_net; } - pInfo->CardNumber = gCardIndex; - DEBUG("card number = %d\n", pInfo->CardNumber); - } - else { - printk(KERN_ERR "ft1000: Invalid device name\n"); + pInfo->CardNumber = gCardIndex; + DEBUG("card number = %d\n", pInfo->CardNumber); + } else { + printk(KERN_ERR "ft1000: Invalid device name\n"); ret_val = -ENXIO; goto err_net; - } + } - memset(&pInfo->stats, 0, sizeof(struct net_device_stats) ); - - spin_lock_init(&pInfo->dpram_lock); - pInfo->pFt1000Dev = ft1000dev; - pInfo->DrvErrNum = 0; - pInfo->ASICResetNum = 0; - pInfo->registered = 1; - pInfo->ft1000_reset = ft1000_reset; - pInfo->mediastate = 0; - pInfo->fifo_cnt = 0; - pInfo->DeviceCreated = FALSE; - pInfo->CurrentInterruptEnableMask = ISR_DEFAULT_MASK; - pInfo->InterruptsEnabled = FALSE; - pInfo->CardReady = 0; - pInfo->DSP_TIME[0] = 0; - pInfo->DSP_TIME[1] = 0; - pInfo->DSP_TIME[2] = 0; - pInfo->DSP_TIME[3] = 0; - pInfo->fAppMsgPend = 0; - pInfo->fCondResetPend = 0; + memset(&pInfo->stats, 0, sizeof(struct net_device_stats)); + + spin_lock_init(&pInfo->dpram_lock); + pInfo->pFt1000Dev = ft1000dev; + pInfo->DrvErrNum = 0; + pInfo->ASICResetNum = 0; + pInfo->registered = 1; + pInfo->ft1000_reset = ft1000_reset; + pInfo->mediastate = 0; + pInfo->fifo_cnt = 0; + pInfo->DeviceCreated = FALSE; + pInfo->CurrentInterruptEnableMask = ISR_DEFAULT_MASK; + pInfo->InterruptsEnabled = FALSE; + pInfo->CardReady = 0; + pInfo->DSP_TIME[0] = 0; + pInfo->DSP_TIME[1] = 0; + pInfo->DSP_TIME[2] = 0; + pInfo->DSP_TIME[3] = 0; + pInfo->fAppMsgPend = 0; + pInfo->fCondResetPend = 0; pInfo->usbboot = 0; pInfo->dspalive = 0; memset(&pInfo->tempbuf[0], 0, sizeof(pInfo->tempbuf)); - INIT_LIST_HEAD(&pInfo->prov_list); + INIT_LIST_HEAD(&pInfo->prov_list); INIT_LIST_HEAD(&pInfo->nodes.list); -//mbelian + #ifdef HAVE_NET_DEVICE_OPS netdev->netdev_ops = &ftnet_ops; #else - netdev->hard_start_xmit = &ft1000_start_xmit; - netdev->get_stats = &ft1000_netdev_stats; - netdev->open = &ft1000_open; - netdev->stop = &ft1000_close; + netdev->hard_start_xmit = &ft1000_start_xmit; + netdev->get_stats = &ft1000_netdev_stats; + netdev->open = &ft1000_open; + netdev->stop = &ft1000_close; #endif - ft1000dev->net = netdev; + ft1000dev->net = netdev; + DEBUG("Initialize free_buff_lock and freercvpool\n"); + spin_lock_init(&free_buff_lock); + /* initialize a list of buffers to be use for queuing + * up receive command data + */ + INIT_LIST_HEAD(&freercvpool); -//init free_buff_lock, freercvpool, numofmsgbuf, pdpram_blk -//only init once per card -//Jim - DEBUG("Initialize free_buff_lock and freercvpool\n"); - spin_lock_init(&free_buff_lock); - - // initialize a list of buffers to be use for queuing up receive command data - INIT_LIST_HEAD (&freercvpool); - - // create list of free buffers - for (i=0; i<NUM_OF_FREE_BUFFERS; i++) { - // Get memory for DPRAM_DATA link list + /* create list of free buffers */ + for (i = 0; i < NUM_OF_FREE_BUFFERS; i++) { + /* Get memory for DPRAM_DATA link list */ pdpram_blk = kmalloc(sizeof(struct dpram_blk), GFP_KERNEL); if (pdpram_blk == NULL) { ret_val = -ENOMEM; goto err_free; } - // Get a block of memory to store command data - pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL ); + /* Get a block of memory to store command data */ + pdpram_blk->pbuffer = kmalloc(MAX_CMD_SQSIZE, GFP_KERNEL); if (pdpram_blk->pbuffer == NULL) { ret_val = -ENOMEM; kfree(pdpram_blk); goto err_free; } - // link provisioning data - list_add_tail (&pdpram_blk->list, &freercvpool); - } - numofmsgbuf = NUM_OF_FREE_BUFFERS; - + /* link provisioning data */ + list_add_tail(&pdpram_blk->list, &freercvpool); + } + numofmsgbuf = NUM_OF_FREE_BUFFERS; return 0; - err_free: list_for_each_safe(cur, tmp, &freercvpool) { pdpram_blk = list_entry(cur, struct dpram_blk, list); @@ -898,8 +834,6 @@ err_net: return ret_val; } - - //--------------------------------------------------------------------------- // Function: reg_ft1000_netdev // @@ -914,46 +848,42 @@ err_net: // Notes: // //--------------------------------------------------------------------------- -int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf) +int reg_ft1000_netdev(struct ft1000_device *ft1000dev, + struct usb_interface *intf) { - struct net_device *netdev; + struct net_device *netdev; struct ft1000_info *pInfo; int rc; - netdev = ft1000dev->net; - pInfo = netdev_priv(ft1000dev->net); - DEBUG("Enter reg_ft1000_netdev...\n"); + netdev = ft1000dev->net; + pInfo = netdev_priv(ft1000dev->net); + DEBUG("Enter reg_ft1000_netdev...\n"); + ft1000_read_register(ft1000dev, &pInfo->AsicID, FT1000_REG_ASIC_ID); - ft1000_read_register(ft1000dev, &pInfo->AsicID, FT1000_REG_ASIC_ID); - - usb_set_intfdata(intf, pInfo); - SET_NETDEV_DEV(netdev, &intf->dev); - - rc = register_netdev(netdev); - if (rc) - { - DEBUG("reg_ft1000_netdev: could not register network device\n"); - free_netdev(netdev); - return rc; - } - + usb_set_intfdata(intf, pInfo); + SET_NETDEV_DEV(netdev, &intf->dev); - //Create character device, implemented by Jim - ft1000_create_dev(ft1000dev); + rc = register_netdev(netdev); + if (rc) { + DEBUG("reg_ft1000_netdev: could not register network device\n"); + free_netdev(netdev); + return rc; + } - DEBUG ("reg_ft1000_netdev returned\n"); + ft1000_create_dev(ft1000dev); - pInfo->CardReady = 1; + DEBUG("reg_ft1000_netdev returned\n"); + pInfo->CardReady = 1; return 0; } static int ft1000_reset(struct net_device *dev) { - ft1000_reset_card(dev); - return 0; + ft1000_reset_card(dev); + return 0; } //--------------------------------------------------------------------------- @@ -972,14 +902,14 @@ static int ft1000_reset(struct net_device *dev) static void ft1000_usb_transmit_complete(struct urb *urb) { - struct ft1000_device *ft1000dev = urb->context; + struct ft1000_device *ft1000dev = urb->context; //DEBUG("ft1000_usb_transmit_complete entered\n"); - if (urb->status) - printk("%s: TX status %d\n", ft1000dev->net->name, urb->status); + if (urb->status) + pr_err("%s: TX status %d\n", ft1000dev->net->name, urb->status); - netif_wake_queue(ft1000dev->net); + netif_wake_queue(ft1000dev->net); //DEBUG("Return from ft1000_usb_transmit_complete\n"); } @@ -999,37 +929,31 @@ static void ft1000_usb_transmit_complete(struct urb *urb) // SUCCESS // //--------------------------------------------------------------------------- -static int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) +static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len) { struct ft1000_info *pInfo = netdev_priv(netdev); - struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev; - + struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev; int count, ret; - u8 *t; + u8 *t; struct pseudo_hdr hdr; - if (!pInfo->CardReady) - { - - DEBUG("ft1000_copy_down_pkt::Card Not Ready\n"); - return -ENODEV; - - } - + if (!pInfo->CardReady) { + DEBUG("ft1000_copy_down_pkt::Card Not Ready\n"); + return -ENODEV; + } - //DEBUG("ft1000_copy_down_pkt() entered, len = %d\n", len); + //DEBUG("ft1000_copy_down_pkt() entered, len = %d\n", len); count = sizeof(struct pseudo_hdr) + len; - if(count > MAX_BUF_SIZE) - { - DEBUG("Error:ft1000_copy_down_pkt:Message Size Overflow!\n"); - DEBUG("size = %d\n", count); - return -EINVAL; - } + if (count > MAX_BUF_SIZE) { + DEBUG("Error:ft1000_copy_down_pkt:Message Size Overflow!\n"); + DEBUG("size = %d\n", count); + return -EINVAL; + } - if ( count % 4) - count = count + (4- (count %4) ); + if (count % 4) + count = count + (4 - (count % 4)); memset(&hdr, 0, sizeof(struct pseudo_hdr)); @@ -1042,46 +966,45 @@ static int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) hdr.control = 0x00; hdr.checksum = hdr.length ^ hdr.source ^ hdr.destination ^ - hdr.portdest ^ hdr.portsrc ^ hdr.sh_str_id ^ - hdr.control; + hdr.portdest ^ hdr.portsrc ^ hdr.sh_str_id ^ hdr.control; memcpy(&pFt1000Dev->tx_buf[0], &hdr, sizeof(hdr)); memcpy(&(pFt1000Dev->tx_buf[sizeof(struct pseudo_hdr)]), packet, len); - netif_stop_queue(netdev); + netif_stop_queue(netdev); - //DEBUG ("ft1000_copy_down_pkt: count = %d\n", count); + //DEBUG ("ft1000_copy_down_pkt: count = %d\n", count); - usb_fill_bulk_urb(pFt1000Dev->tx_urb, - pFt1000Dev->dev, - usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr), - pFt1000Dev->tx_buf, - count, - ft1000_usb_transmit_complete, - (void*)pFt1000Dev); - - t = (u8 *)pFt1000Dev->tx_urb->transfer_buffer; - //DEBUG("transfer_length=%d\n", pFt1000Dev->tx_urb->transfer_buffer_length); - /*for (i=0; i<count; i++ ) - { - DEBUG("%x ", *t++ ); - }*/ + usb_fill_bulk_urb(pFt1000Dev->tx_urb, + pFt1000Dev->dev, + usb_sndbulkpipe(pFt1000Dev->dev, + pFt1000Dev->bulk_out_endpointAddr), + pFt1000Dev->tx_buf, count, + ft1000_usb_transmit_complete, (void *)pFt1000Dev); + t = (u8 *) pFt1000Dev->tx_urb->transfer_buffer; + //DEBUG("transfer_length=%d\n", pFt1000Dev->tx_urb->transfer_buffer_length); + /*for (i=0; i<count; i++ ) + { + DEBUG("%x ", *t++ ); + } */ ret = usb_submit_urb(pFt1000Dev->tx_urb, GFP_ATOMIC); + if (ret) { DEBUG("ft1000 failed tx_urb %d\n", ret); return ret; } else { pInfo->stats.tx_packets++; - pInfo->stats.tx_bytes += (len+14); + pInfo->stats.tx_bytes += (len + 14); } - //DEBUG("ft1000_copy_down_pkt() exit\n"); + //DEBUG("ft1000_copy_down_pkt() exit\n"); return 0; } + //--------------------------------------------------------------------------- // Function: ft1000_start_xmit // @@ -1099,61 +1022,56 @@ static int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); - struct ft1000_device *pFt1000Dev= pInfo->pFt1000Dev; - u8 *pdata; - int maxlen, pipe; - + struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev; + u8 *pdata; + int maxlen, pipe; - //DEBUG(" ft1000_start_xmit() entered\n"); - - if ( skb == NULL ) - { - DEBUG ("ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n" ); - return NETDEV_TX_OK; - } - - if ( pFt1000Dev->status & FT1000_STATUS_CLOSING) - { - DEBUG("network driver is closed, return\n"); - goto err; - } - - //DEBUG("ft1000_start_xmit 1:length of packet = %d\n", skb->len); - pipe = usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr); - maxlen = usb_maxpacket(pFt1000Dev->dev, pipe, usb_pipeout(pipe)); - //DEBUG("ft1000_start_xmit 2: pipe=%d dev->maxpacket = %d\n", pipe, maxlen); - - pdata = (u8 *)skb->data; - /*for (i=0; i<skb->len; i++) - DEBUG("skb->data[%d]=%x ", i, *(skb->data+i)); - - DEBUG("\n");*/ + //DEBUG(" ft1000_start_xmit() entered\n"); + if (skb == NULL) { + DEBUG("ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n"); + return NETDEV_TX_OK; + } - if (pInfo->mediastate == 0) - { - /* Drop packet is mediastate is down */ - DEBUG("ft1000_hw:ft1000_start_xmit:mediastate is down\n"); - goto err; - } + if (pFt1000Dev->status & FT1000_STATUS_CLOSING) { + DEBUG("network driver is closed, return\n"); + goto err; + } + //DEBUG("ft1000_start_xmit 1:length of packet = %d\n", skb->len); + pipe = + usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr); + maxlen = usb_maxpacket(pFt1000Dev->dev, pipe, usb_pipeout(pipe)); + //DEBUG("ft1000_start_xmit 2: pipe=%d dev->maxpacket = %d\n", pipe, maxlen); + + pdata = (u8 *) skb->data; + /*for (i=0; i<skb->len; i++) + DEBUG("skb->data[%d]=%x ", i, *(skb->data+i)); + + DEBUG("\n"); */ + + if (pInfo->mediastate == 0) { + /* Drop packet is mediastate is down */ + DEBUG("ft1000_hw:ft1000_start_xmit:mediastate is down\n"); + goto err; + } - if ( (skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE) ) - { - /* Drop packet which has invalid size */ - DEBUG("ft1000_hw:ft1000_start_xmit:invalid ethernet length\n"); - goto err; - } + if ((skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE)) { + /* Drop packet which has invalid size */ + DEBUG("ft1000_hw:ft1000_start_xmit:invalid ethernet length\n"); + goto err; + } //mbelian - ft1000_copy_down_pkt(dev, (pdata+ENET_HEADER_SIZE-2), - skb->len - ENET_HEADER_SIZE + 2); + ft1000_copy_down_pkt(dev, (pdata + ENET_HEADER_SIZE - 2), + skb->len - ENET_HEADER_SIZE + 2); err: dev_kfree_skb(skb); - //DEBUG(" ft1000_start_xmit() exit\n"); + //DEBUG(" ft1000_start_xmit() exit\n"); return NETDEV_TX_OK; } + //--------------------------------------------------------------------------- // // Function: ft1000_copy_up_pkt @@ -1167,109 +1085,100 @@ err: // SUCCESS // //--------------------------------------------------------------------------- -static int ft1000_copy_up_pkt (struct urb *urb) +static int ft1000_copy_up_pkt(struct urb *urb) { struct ft1000_info *info = urb->context; - struct ft1000_device *ft1000dev = info->pFt1000Dev; - struct net_device *net = ft1000dev->net; - - u16 tempword; - u16 len; - u16 lena; //mbelian - struct sk_buff *skb; - u16 i; - u8 *pbuffer=NULL; - u8 *ptemp=NULL; - u16 *chksum; - - - //DEBUG("ft1000_copy_up_pkt entered\n"); - - if ( ft1000dev->status & FT1000_STATUS_CLOSING) - { - DEBUG("network driver is closed, return\n"); - return STATUS_SUCCESS; - } - - // Read length - len = urb->transfer_buffer_length; - lena = urb->actual_length; //mbelian - //DEBUG("ft1000_copy_up_pkt: transfer_buffer_length=%d, actual_buffer_len=%d\n", - // urb->transfer_buffer_length, urb->actual_length); - - chksum = (u16 *)ft1000dev->rx_buf; - - tempword = *chksum++; - for (i=1; i<7; i++) - { - tempword ^= *chksum++; - } - - if (tempword != *chksum) - { - info->stats.rx_errors ++; - ft1000_submit_rx_urb(info); - return STATUS_FAILURE; - } - - - //DEBUG("ft1000_copy_up_pkt: checksum is correct %x\n", *chksum); - - skb = dev_alloc_skb(len+12+2); - - if (skb == NULL) - { - DEBUG("ft1000_copy_up_pkt: No Network buffers available\n"); - info->stats.rx_errors++; - ft1000_submit_rx_urb(info); - return STATUS_FAILURE; - } - - pbuffer = (u8 *)skb_put(skb, len+12); - - //subtract the number of bytes read already - ptemp = pbuffer; - - // fake MAC address - *pbuffer++ = net->dev_addr[0]; - *pbuffer++ = net->dev_addr[1]; - *pbuffer++ = net->dev_addr[2]; - *pbuffer++ = net->dev_addr[3]; - *pbuffer++ = net->dev_addr[4]; - *pbuffer++ = net->dev_addr[5]; - *pbuffer++ = 0x00; - *pbuffer++ = 0x07; - *pbuffer++ = 0x35; - *pbuffer++ = 0xff; - *pbuffer++ = 0xff; - *pbuffer++ = 0xfe; - - - - - memcpy(pbuffer, ft1000dev->rx_buf+sizeof(struct pseudo_hdr), len-sizeof(struct pseudo_hdr)); - - //DEBUG("ft1000_copy_up_pkt: Data passed to Protocol layer\n"); - /*for (i=0; i<len+12; i++) - { - DEBUG("ft1000_copy_up_pkt: Protocol Data: 0x%x\n ", *ptemp++); - }*/ + struct ft1000_device *ft1000dev = info->pFt1000Dev; + struct net_device *net = ft1000dev->net; + + u16 tempword; + u16 len; + u16 lena; //mbelian + struct sk_buff *skb; + u16 i; + u8 *pbuffer = NULL; + u8 *ptemp = NULL; + u16 *chksum; + + //DEBUG("ft1000_copy_up_pkt entered\n"); + + if (ft1000dev->status & FT1000_STATUS_CLOSING) { + DEBUG("network driver is closed, return\n"); + return STATUS_SUCCESS; + } + // Read length + len = urb->transfer_buffer_length; + lena = urb->actual_length; //mbelian + //DEBUG("ft1000_copy_up_pkt: transfer_buffer_length=%d, actual_buffer_len=%d\n", + // urb->transfer_buffer_length, urb->actual_length); + + chksum = (u16 *) ft1000dev->rx_buf; + + tempword = *chksum++; + for (i = 1; i < 7; i++) + tempword ^= *chksum++; + + if (tempword != *chksum) { + info->stats.rx_errors++; + ft1000_submit_rx_urb(info); + return STATUS_FAILURE; + } - skb->dev = net; + //DEBUG("ft1000_copy_up_pkt: checksum is correct %x\n", *chksum); - skb->protocol = eth_type_trans(skb, net); - skb->ip_summed = CHECKSUM_UNNECESSARY; - netif_rx(skb); + skb = dev_alloc_skb(len + 12 + 2); - info->stats.rx_packets++; - // Add on 12 bytes for MAC address which was removed - info->stats.rx_bytes += (lena+12); //mbelian + if (skb == NULL) { + DEBUG("ft1000_copy_up_pkt: No Network buffers available\n"); + info->stats.rx_errors++; + ft1000_submit_rx_urb(info); + return STATUS_FAILURE; + } - ft1000_submit_rx_urb(info); - //DEBUG("ft1000_copy_up_pkt exited\n"); - return SUCCESS; + pbuffer = (u8 *) skb_put(skb, len + 12); + + /* subtract the number of bytes read already */ + ptemp = pbuffer; + + /* fake MAC address */ + *pbuffer++ = net->dev_addr[0]; + *pbuffer++ = net->dev_addr[1]; + *pbuffer++ = net->dev_addr[2]; + *pbuffer++ = net->dev_addr[3]; + *pbuffer++ = net->dev_addr[4]; + *pbuffer++ = net->dev_addr[5]; + *pbuffer++ = 0x00; + *pbuffer++ = 0x07; + *pbuffer++ = 0x35; + *pbuffer++ = 0xff; + *pbuffer++ = 0xff; + *pbuffer++ = 0xfe; + + memcpy(pbuffer, ft1000dev->rx_buf + sizeof(struct pseudo_hdr), + len - sizeof(struct pseudo_hdr)); + + //DEBUG("ft1000_copy_up_pkt: Data passed to Protocol layer\n"); + /*for (i=0; i<len+12; i++) + { + DEBUG("ft1000_copy_up_pkt: Protocol Data: 0x%x\n ", *ptemp++); + } */ + + skb->dev = net; + + skb->protocol = eth_type_trans(skb, net); + skb->ip_summed = CHECKSUM_UNNECESSARY; + netif_rx(skb); + + info->stats.rx_packets++; + /* Add on 12 bytes for MAC address which was removed */ + info->stats.rx_bytes += (lena + 12); //mbelian + + ft1000_submit_rx_urb(info); + //DEBUG("ft1000_copy_up_pkt exited\n"); + return SUCCESS; } + //--------------------------------------------------------------------------- // // Function: ft1000_submit_rx_urb @@ -1285,38 +1194,36 @@ static int ft1000_copy_up_pkt (struct urb *urb) //--------------------------------------------------------------------------- static int ft1000_submit_rx_urb(struct ft1000_info *info) { - int result; - struct ft1000_device *pFt1000Dev = info->pFt1000Dev; - - - //DEBUG ("ft1000_submit_rx_urb entered: sizeof rx_urb is %d\n", sizeof(*pFt1000Dev->rx_urb)); - if ( pFt1000Dev->status & FT1000_STATUS_CLOSING) - { - DEBUG("network driver is closed, return\n"); - //usb_kill_urb(pFt1000Dev->rx_urb); //mbelian - return -ENODEV; - } - - usb_fill_bulk_urb(pFt1000Dev->rx_urb, - pFt1000Dev->dev, - usb_rcvbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_in_endpointAddr), - pFt1000Dev->rx_buf, - MAX_BUF_SIZE, - (usb_complete_t)ft1000_copy_up_pkt, - info); + int result; + struct ft1000_device *pFt1000Dev = info->pFt1000Dev; + + //DEBUG ("ft1000_submit_rx_urb entered: sizeof rx_urb is %d\n", sizeof(*pFt1000Dev->rx_urb)); + if (pFt1000Dev->status & FT1000_STATUS_CLOSING) { + DEBUG("network driver is closed, return\n"); + //usb_kill_urb(pFt1000Dev->rx_urb); //mbelian + return -ENODEV; + } + usb_fill_bulk_urb(pFt1000Dev->rx_urb, + pFt1000Dev->dev, + usb_rcvbulkpipe(pFt1000Dev->dev, + pFt1000Dev->bulk_in_endpointAddr), + pFt1000Dev->rx_buf, MAX_BUF_SIZE, + (usb_complete_t) ft1000_copy_up_pkt, info); - if((result = usb_submit_urb(pFt1000Dev->rx_urb, GFP_ATOMIC))) - { - printk("ft1000_submit_rx_urb: submitting rx_urb %d failed\n", result); - return result; - } + result = usb_submit_urb(pFt1000Dev->rx_urb, GFP_ATOMIC); - //DEBUG("ft1000_submit_rx_urb exit: result=%d\n", result); + if (result) { + pr_err("ft1000_submit_rx_urb: submitting rx_urb %d failed\n", + result); + return result; + } + //DEBUG("ft1000_submit_rx_urb exit: result=%d\n", result); return 0; } + //--------------------------------------------------------------------------- // Function: ft1000_open // @@ -1331,27 +1238,26 @@ static int ft1000_submit_rx_urb(struct ft1000_info *info) // Notes: // //--------------------------------------------------------------------------- -static int ft1000_open (struct net_device *dev) +static int ft1000_open(struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); - struct timeval tv; //mbelian + struct timeval tv; //mbelian int ret; - DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber); - //DEBUG("ft1000_open: dev->addr=%x, dev->addr_len=%d\n", dev->addr, dev->addr_len); + DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber); + //DEBUG("ft1000_open: dev->addr=%x, dev->addr_len=%d\n", dev->addr, dev->addr_len); - pInfo->stats.rx_bytes = 0; //mbelian - pInfo->stats.tx_bytes = 0; //mbelian - pInfo->stats.rx_packets = 0; //mbelian - pInfo->stats.tx_packets = 0; //mbelian + pInfo->stats.rx_bytes = 0; //mbelian + pInfo->stats.tx_bytes = 0; //mbelian + pInfo->stats.rx_packets = 0; //mbelian + pInfo->stats.tx_packets = 0; //mbelian do_gettimeofday(&tv); - pInfo->ConTm = tv.tv_sec; - pInfo->ProgConStat = 0; //mbelian - + pInfo->ConTm = tv.tv_sec; + pInfo->ProgConStat = 0; //mbelian - netif_start_queue(dev); + netif_start_queue(dev); - netif_carrier_on(dev); //mbelian + netif_carrier_on(dev); //mbelian ret = ft1000_submit_rx_urb(pInfo); @@ -1375,24 +1281,23 @@ static int ft1000_open (struct net_device *dev) int ft1000_close(struct net_device *net) { struct ft1000_info *pInfo = netdev_priv(net); - struct ft1000_device *ft1000dev = pInfo->pFt1000Dev; + struct ft1000_device *ft1000dev = pInfo->pFt1000Dev; - //DEBUG ("ft1000_close: netdev->refcnt=%d\n", net->refcnt); + //DEBUG ("ft1000_close: netdev->refcnt=%d\n", net->refcnt); - ft1000dev->status |= FT1000_STATUS_CLOSING; - - //DEBUG("ft1000_close: calling usb_kill_urb \n"); + ft1000dev->status |= FT1000_STATUS_CLOSING; - DEBUG("ft1000_close: pInfo=%p, ft1000dev=%p\n", pInfo, ft1000dev); - netif_carrier_off(net);//mbelian - netif_stop_queue(net); - //DEBUG("ft1000_close: netif_stop_queue called\n"); - ft1000dev->status &= ~FT1000_STATUS_CLOSING; + //DEBUG("ft1000_close: calling usb_kill_urb \n"); - pInfo->ProgConStat = 0xff; //mbelian + DEBUG("ft1000_close: pInfo=%p, ft1000dev=%p\n", pInfo, ft1000dev); + netif_carrier_off(net); //mbelian + netif_stop_queue(net); + //DEBUG("ft1000_close: netif_stop_queue called\n"); + ft1000dev->status &= ~FT1000_STATUS_CLOSING; + pInfo->ProgConStat = 0xff; //mbelian - return 0; + return 0; } static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev) @@ -1420,40 +1325,41 @@ Jim // TRUE (device is present) // //--------------------------------------------------------------------------- -static int ft1000_chkcard (struct ft1000_device *dev) { - u16 tempword; - u16 status; +static int ft1000_chkcard(struct ft1000_device *dev) +{ + u16 tempword; + u16 status; struct ft1000_info *info = netdev_priv(dev->net); - if (info->fCondResetPend) - { - DEBUG("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n"); - return TRUE; - } - - // Mask register is used to check for device presence since it is never - // set to zero. - status = ft1000_read_register(dev, &tempword, FT1000_REG_SUP_IMASK); - //DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_SUP_IMASK = %x\n", tempword); - if (tempword == 0) { - DEBUG("ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); - return FALSE; - } - - // The system will return the value of 0xffff for the version register - // if the device is not present. - status = ft1000_read_register(dev, &tempword, FT1000_REG_ASIC_ID); - //DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_ASIC_ID = %x\n", tempword); - if (tempword != 0x1b01 ){ - dev->status |= FT1000_STATUS_CLOSING; //mbelian - DEBUG("ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); - return FALSE; - } - return TRUE; + if (info->fCondResetPend) { + DEBUG + ("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n"); + return TRUE; + } + /* Mask register is used to check for device presence since it is never + * set to zero. + */ + status = ft1000_read_register(dev, &tempword, FT1000_REG_SUP_IMASK); + //DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_SUP_IMASK = %x\n", tempword); + if (tempword == 0) { + DEBUG + ("ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); + return FALSE; + } + /* The system will return the value of 0xffff for the version register + * if the device is not present. + */ + status = ft1000_read_register(dev, &tempword, FT1000_REG_ASIC_ID); + //DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_ASIC_ID = %x\n", tempword); + if (tempword != 0x1b01) { + dev->status |= FT1000_STATUS_CLOSING; //mbelian + DEBUG + ("ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); + return FALSE; + } + return TRUE; } - - //--------------------------------------------------------------------------- // // Function: ft1000_receive_cmd @@ -1467,425 +1373,476 @@ static int ft1000_chkcard (struct ft1000_device *dev) { // = 1 (successful) // //--------------------------------------------------------------------------- -static bool ft1000_receive_cmd (struct ft1000_device *dev, u16 *pbuffer, int maxsz, u16 *pnxtph) { - u16 size, ret; - u16 *ppseudohdr; - int i; - u16 tempword; +static bool ft1000_receive_cmd(struct ft1000_device *dev, u16 *pbuffer, + int maxsz, u16 *pnxtph) +{ + u16 size, ret; + u16 *ppseudohdr; + int i; + u16 tempword; + + ret = + ft1000_read_dpram16(dev, FT1000_MAG_PH_LEN, (u8 *) &size, + FT1000_MAG_PH_LEN_INDX); + size = ntohs(size) + PSEUDOSZ; + if (size > maxsz) { + DEBUG("FT1000:ft1000_receive_cmd:Invalid command length = %d\n", + size); + return FALSE; + } else { + ppseudohdr = (u16 *) pbuffer; + ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE, + FT1000_REG_DPRAM_ADDR); + ret = + ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); + //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); + pbuffer++; + ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE + 1, + FT1000_REG_DPRAM_ADDR); + for (i = 0; i <= (size >> 2); i++) { + ret = + ft1000_read_register(dev, pbuffer, + FT1000_REG_MAG_DPDATAL); + pbuffer++; + ret = + ft1000_read_register(dev, pbuffer, + FT1000_REG_MAG_DPDATAH); + pbuffer++; + } + /* copy odd aligned word */ + ret = + ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL); + //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); + pbuffer++; + ret = + ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); + //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); + pbuffer++; + if (size & 0x0001) { + /* copy odd byte from fifo */ + ret = + ft1000_read_register(dev, &tempword, + FT1000_REG_DPRAM_DATA); + *pbuffer = ntohs(tempword); + } + /* Check if pseudo header checksum is good + * Calculate pseudo header checksum + */ + tempword = *ppseudohdr++; + for (i = 1; i < 7; i++) + tempword ^= *ppseudohdr++; - ret = ft1000_read_dpram16(dev, FT1000_MAG_PH_LEN, (u8 *)&size, FT1000_MAG_PH_LEN_INDX); - size = ntohs(size) + PSEUDOSZ; - if (size > maxsz) { - DEBUG("FT1000:ft1000_receive_cmd:Invalid command length = %d\n", size); - return FALSE; - } - else { - ppseudohdr = (u16 *)pbuffer; - ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE, FT1000_REG_DPRAM_ADDR); - ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); - //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); - pbuffer++; - ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE+1, FT1000_REG_DPRAM_ADDR); - for (i=0; i<=(size>>2); i++) { - ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL); - pbuffer++; - ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); - pbuffer++; - } - //copy odd aligned word - ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL); - //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); - pbuffer++; - ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); - //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); - pbuffer++; - if (size & 0x0001) { - //copy odd byte from fifo - ret = ft1000_read_register(dev, &tempword, FT1000_REG_DPRAM_DATA); - *pbuffer = ntohs(tempword); - } + if ((tempword != *ppseudohdr)) + return FALSE; - // Check if pseudo header checksum is good - // Calculate pseudo header checksum - tempword = *ppseudohdr++; - for (i=1; i<7; i++) { - tempword ^= *ppseudohdr++; - } - if ( (tempword != *ppseudohdr) ) { - return FALSE; - } - - return TRUE; - } + return TRUE; + } } - static int ft1000_dsp_prov(void *arg) { - struct ft1000_device *dev = (struct ft1000_device *)arg; + struct ft1000_device *dev = (struct ft1000_device *)arg; struct ft1000_info *info = netdev_priv(dev->net); - u16 tempword; - u16 len; - u16 i=0; + u16 tempword; + u16 len; + u16 i = 0; struct prov_record *ptr; struct pseudo_hdr *ppseudo_hdr; - u16 *pmsg; - u16 status; - u16 TempShortBuf [256]; - - DEBUG("*** DspProv Entered\n"); - - while (list_empty(&info->prov_list) == 0) - { - DEBUG("DSP Provisioning List Entry\n"); - - // Check if doorbell is available - DEBUG("check if doorbell is cleared\n"); - status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL); - if (status) - { - DEBUG("ft1000_dsp_prov::ft1000_read_register error\n"); - break; - } - - while (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - i++; - if (i==10) { - DEBUG("FT1000:ft1000_dsp_prov:message drop\n"); - return STATUS_FAILURE; - } - ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); - } + u16 *pmsg; + u16 status; + u16 TempShortBuf[256]; + + DEBUG("*** DspProv Entered\n"); + + while (list_empty(&info->prov_list) == 0) { + DEBUG("DSP Provisioning List Entry\n"); + + /* Check if doorbell is available */ + DEBUG("check if doorbell is cleared\n"); + status = + ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); + if (status) { + DEBUG("ft1000_dsp_prov::ft1000_read_register error\n"); + break; + } - if ( !(tempword & FT1000_DB_DPRAM_TX) ) { - DEBUG("*** Provision Data Sent to DSP\n"); - - // Send provisioning data - ptr = list_entry(info->prov_list.next, struct prov_record, list); - len = *(u16 *)ptr->pprov_data; - len = htons(len); - len += PSEUDOSZ; - - pmsg = (u16 *)ptr->pprov_data; - ppseudo_hdr = (struct pseudo_hdr *)pmsg; - // Insert slow queue sequence number - ppseudo_hdr->seq_num = info->squeseqnum++; - ppseudo_hdr->portsrc = 0; - // Calculate new checksum - ppseudo_hdr->checksum = *pmsg++; - //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); - for (i=1; i<7; i++) { - ppseudo_hdr->checksum ^= *pmsg++; - //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); - } + while (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + i++; + if (i == 10) { + DEBUG("FT1000:ft1000_dsp_prov:message drop\n"); + return STATUS_FAILURE; + } + ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + } - TempShortBuf[0] = 0; - TempShortBuf[1] = htons (len); - memcpy(&TempShortBuf[2], ppseudo_hdr, len); + if (!(tempword & FT1000_DB_DPRAM_TX)) { + DEBUG("*** Provision Data Sent to DSP\n"); - status = ft1000_write_dpram32 (dev, 0, (u8 *)&TempShortBuf[0], (unsigned short)(len+2)); - status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); + /* Send provisioning data */ + ptr = + list_entry(info->prov_list.next, struct prov_record, + list); + len = *(u16 *) ptr->pprov_data; + len = htons(len); + len += PSEUDOSZ; - list_del(&ptr->list); - kfree(ptr->pprov_data); - kfree(ptr); - } - msleep(10); - } + pmsg = (u16 *) ptr->pprov_data; + ppseudo_hdr = (struct pseudo_hdr *)pmsg; + /* Insert slow queue sequence number */ + ppseudo_hdr->seq_num = info->squeseqnum++; + ppseudo_hdr->portsrc = 0; + /* Calculate new checksum */ + ppseudo_hdr->checksum = *pmsg++; + //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); + for (i = 1; i < 7; i++) { + ppseudo_hdr->checksum ^= *pmsg++; + //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); + } + + TempShortBuf[0] = 0; + TempShortBuf[1] = htons(len); + memcpy(&TempShortBuf[2], ppseudo_hdr, len); + + status = + ft1000_write_dpram32(dev, 0, + (u8 *) &TempShortBuf[0], + (unsigned short)(len + 2)); + status = + ft1000_write_register(dev, FT1000_DB_DPRAM_TX, + FT1000_REG_DOORBELL); + + list_del(&ptr->list); + kfree(ptr->pprov_data); + kfree(ptr); + } + msleep(10); + } - DEBUG("DSP Provisioning List Entry finished\n"); + DEBUG("DSP Provisioning List Entry finished\n"); - msleep(100); + msleep(100); - info->fProvComplete = 1; - info->CardReady = 1; - return STATUS_SUCCESS; + info->fProvComplete = 1; + info->CardReady = 1; + return STATUS_SUCCESS; } - -static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { +static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size) +{ struct ft1000_info *info = netdev_priv(dev->net); - u16 msgtype; - u16 tempword; + u16 msgtype; + u16 tempword; struct media_msg *pmediamsg; struct dsp_init_msg *pdspinitmsg; struct drv_msg *pdrvmsg; - u16 i; + u16 i; struct pseudo_hdr *ppseudo_hdr; - u16 *pmsg; - u16 status; - union { - u8 byte[2]; - u16 wrd; - } convert; - - - char *cmdbuffer = kmalloc(1600, GFP_KERNEL); - if (!cmdbuffer) - return STATUS_FAILURE; - - status = ft1000_read_dpram32(dev, 0x200, cmdbuffer, size); + u16 *pmsg; + u16 status; + union { + u8 byte[2]; + u16 wrd; + } convert; + char *cmdbuffer = kmalloc(1600, GFP_KERNEL); + if (!cmdbuffer) + return STATUS_FAILURE; + status = ft1000_read_dpram32(dev, 0x200, cmdbuffer, size); #ifdef JDEBUG - DEBUG("ft1000_proc_drvmsg:cmdbuffer\n"); - for(i = 0; i < size; i+=5) - { - if( (i + 5) < size ) - DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i], cmdbuffer[i+1], cmdbuffer[i+2], cmdbuffer[i+3], cmdbuffer[i+4]); - else - { - for (j = i; j < size; j++) - DEBUG("0x%x ", cmdbuffer[j]); - DEBUG("\n"); - break; - } - } + DEBUG("ft1000_proc_drvmsg:cmdbuffer\n"); + for (i = 0; i < size; i += 5) { + if ((i + 5) < size) + DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i], + cmdbuffer[i + 1], cmdbuffer[i + 2], + cmdbuffer[i + 3], cmdbuffer[i + 4]); + else { + for (j = i; j < size; j++) + DEBUG("0x%x ", cmdbuffer[j]); + DEBUG("\n"); + break; + } + } #endif pdrvmsg = (struct drv_msg *)&cmdbuffer[2]; - msgtype = ntohs(pdrvmsg->type); - DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n", msgtype); - switch (msgtype) { - case MEDIA_STATE: { - DEBUG("ft1000_proc_drvmsg:Command message type = MEDIA_STATE"); - - pmediamsg = (struct media_msg *)&cmdbuffer[0]; - if (info->ProgConStat != 0xFF) { - if (pmediamsg->state) { - DEBUG("Media is up\n"); - if (info->mediastate == 0) { - if ( info->NetDevRegDone ) - { - //netif_carrier_on(dev->net);//mbelian - netif_wake_queue(dev->net); - } - info->mediastate = 1; - /*do_gettimeofday(&tv); - info->ConTm = tv.tv_sec;*/ //mbelian - } - } - else { - DEBUG("Media is down\n"); - if (info->mediastate == 1) { - info->mediastate = 0; - if ( info->NetDevRegDone ) - { - //netif_carrier_off(dev->net); mbelian - //netif_stop_queue(dev->net); - } - info->ConTm = 0; - } - } - } - else { - DEBUG("Media is down\n"); - if (info->mediastate == 1) { - info->mediastate = 0; - if ( info->NetDevRegDone) - { - //netif_carrier_off(dev->net); //mbelian - //netif_stop_queue(dev->net); - } - info->ConTm = 0; - } - } - break; - } - case DSP_INIT_MSG: { - DEBUG("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG"); - - pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[2]; - memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); - DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", info->DspVer[0], info->DspVer[1], info->DspVer[2], info->DspVer[3]); - memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, HWSERNUMSZ); - memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); - memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); - DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n", info->eui64[0],info->eui64[1], info->eui64[2], info->eui64[3], info->eui64[4], info->eui64[5],info->eui64[6], info->eui64[7]); - dev->net->dev_addr[0] = info->eui64[0]; - dev->net->dev_addr[1] = info->eui64[1]; - dev->net->dev_addr[2] = info->eui64[2]; - dev->net->dev_addr[3] = info->eui64[5]; - dev->net->dev_addr[4] = info->eui64[6]; - dev->net->dev_addr[5] = info->eui64[7]; - - if (ntohs(pdspinitmsg->length) == (sizeof(struct dsp_init_msg) - 20)) { - memcpy(info->ProductMode, pdspinitmsg->ProductMode, MODESZ); - memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ); - memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, CALDATESZ); - DEBUG("RFCalVer = 0x%2x 0x%2x\n", info->RfCalVer[0], info->RfCalVer[1]); - } - break; - } - case DSP_PROVISION: { - DEBUG("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n"); - - // kick off dspprov routine to start provisioning - // Send provisioning data to DSP - if (list_empty(&info->prov_list) == 0) - { - info->fProvComplete = 0; - status = ft1000_dsp_prov(dev); - if (status != STATUS_SUCCESS) - goto out; - } - else { - info->fProvComplete = 1; - status = ft1000_write_register (dev, FT1000_DB_HB, FT1000_REG_DOORBELL); - DEBUG("FT1000:drivermsg:No more DSP provisioning data in dsp image\n"); - } - DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n"); - break; - } - case DSP_STORE_INFO: { - DEBUG("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO"); - - DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n"); - tempword = ntohs(pdrvmsg->length); - info->DSPInfoBlklen = tempword; - if (tempword < (MAX_DSP_SESS_REC-4) ) { - pmsg = (u16 *)&pdrvmsg->data[0]; - for (i=0; i<((tempword+1)/2); i++) { - DEBUG("FT1000:drivermsg:dsp info data = 0x%x\n", *pmsg); - info->DSPInfoBlk[i+10] = *pmsg++; - } - } - else { - info->DSPInfoBlklen = 0; - } - break; - } - case DSP_GET_INFO: { - DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n"); - // copy dsp info block to dsp - info->DrvMsgPend = 1; - // allow any outstanding ioctl to finish - mdelay(10); - status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - break; - } - } - } - - // Put message into Slow Queue - // Form Pseudo header - pmsg = (u16 *)info->DSPInfoBlk; - *pmsg++ = 0; - *pmsg++ = htons(info->DSPInfoBlklen+20+info->DSPInfoBlklen); - ppseudo_hdr = (struct pseudo_hdr *)(u16 *)&info->DSPInfoBlk[2]; - ppseudo_hdr->length = htons(info->DSPInfoBlklen+4+info->DSPInfoBlklen); - ppseudo_hdr->source = 0x10; - ppseudo_hdr->destination = 0x20; - ppseudo_hdr->portdest = 0; - ppseudo_hdr->portsrc = 0; - ppseudo_hdr->sh_str_id = 0; - ppseudo_hdr->control = 0; - ppseudo_hdr->rsvd1 = 0; - ppseudo_hdr->rsvd2 = 0; - ppseudo_hdr->qos_class = 0; - // Insert slow queue sequence number - ppseudo_hdr->seq_num = info->squeseqnum++; - // Insert application id - ppseudo_hdr->portsrc = 0; - // Calculate new checksum - ppseudo_hdr->checksum = *pmsg++; - for (i=1; i<7; i++) { - ppseudo_hdr->checksum ^= *pmsg++; - } - info->DSPInfoBlk[10] = 0x7200; - info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen); - status = ft1000_write_dpram32 (dev, 0, (u8 *)&info->DSPInfoBlk[0], (unsigned short)(info->DSPInfoBlklen+22)); - status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); - info->DrvMsgPend = 0; - - break; - } + msgtype = ntohs(pdrvmsg->type); + DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n", msgtype); + switch (msgtype) { + case MEDIA_STATE:{ + DEBUG + ("ft1000_proc_drvmsg:Command message type = MEDIA_STATE"); + + pmediamsg = (struct media_msg *)&cmdbuffer[0]; + if (info->ProgConStat != 0xFF) { + if (pmediamsg->state) { + DEBUG("Media is up\n"); + if (info->mediastate == 0) { + if (info->NetDevRegDone) { + //netif_carrier_on(dev->net);//mbelian + netif_wake_queue(dev-> + net); + } + info->mediastate = 1; + /*do_gettimeofday(&tv); + info->ConTm = tv.tv_sec; *///mbelian + } + } else { + DEBUG("Media is down\n"); + if (info->mediastate == 1) { + info->mediastate = 0; + if (info->NetDevRegDone) { + //netif_carrier_off(dev->net); mbelian + //netif_stop_queue(dev->net); + } + info->ConTm = 0; + } + } + } else { + DEBUG("Media is down\n"); + if (info->mediastate == 1) { + info->mediastate = 0; + if (info->NetDevRegDone) { + //netif_carrier_off(dev->net); //mbelian + //netif_stop_queue(dev->net); + } + info->ConTm = 0; + } + } + break; + } + case DSP_INIT_MSG:{ + DEBUG + ("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG"); + + pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[2]; + memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); + DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", + info->DspVer[0], info->DspVer[1], info->DspVer[2], + info->DspVer[3]); + memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, + HWSERNUMSZ); + memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); + memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); + DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n", + info->eui64[0], info->eui64[1], info->eui64[2], + info->eui64[3], info->eui64[4], info->eui64[5], + info->eui64[6], info->eui64[7]); + dev->net->dev_addr[0] = info->eui64[0]; + dev->net->dev_addr[1] = info->eui64[1]; + dev->net->dev_addr[2] = info->eui64[2]; + dev->net->dev_addr[3] = info->eui64[5]; + dev->net->dev_addr[4] = info->eui64[6]; + dev->net->dev_addr[5] = info->eui64[7]; + + if (ntohs(pdspinitmsg->length) == + (sizeof(struct dsp_init_msg) - 20)) { + memcpy(info->ProductMode, + pdspinitmsg->ProductMode, MODESZ); + memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, + CALVERSZ); + memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, + CALDATESZ); + DEBUG("RFCalVer = 0x%2x 0x%2x\n", + info->RfCalVer[0], info->RfCalVer[1]); + } + break; + } + case DSP_PROVISION:{ + DEBUG + ("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n"); + + /* kick off dspprov routine to start provisioning + * Send provisioning data to DSP + */ + if (list_empty(&info->prov_list) == 0) { + info->fProvComplete = 0; + status = ft1000_dsp_prov(dev); + if (status != STATUS_SUCCESS) + goto out; + } else { + info->fProvComplete = 1; + status = + ft1000_write_register(dev, FT1000_DB_HB, + FT1000_REG_DOORBELL); + DEBUG + ("FT1000:drivermsg:No more DSP provisioning data in dsp image\n"); + } + DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n"); + break; + } + case DSP_STORE_INFO:{ + DEBUG + ("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO"); + + DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n"); + tempword = ntohs(pdrvmsg->length); + info->DSPInfoBlklen = tempword; + if (tempword < (MAX_DSP_SESS_REC - 4)) { + pmsg = (u16 *) &pdrvmsg->data[0]; + for (i = 0; i < ((tempword + 1) / 2); i++) { + DEBUG + ("FT1000:drivermsg:dsp info data = 0x%x\n", + *pmsg); + info->DSPInfoBlk[i + 10] = *pmsg++; + } + } else { + info->DSPInfoBlklen = 0; + } + break; + } + case DSP_GET_INFO:{ + DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n"); + /* copy dsp info block to dsp */ + info->DrvMsgPend = 1; + /* allow any outstanding ioctl to finish */ + mdelay(10); + status = + ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + status = + ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + status = + ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) + break; + } + } + /* Put message into Slow Queue + * Form Pseudo header + */ + pmsg = (u16 *) info->DSPInfoBlk; + *pmsg++ = 0; + *pmsg++ = + htons(info->DSPInfoBlklen + 20 + + info->DSPInfoBlklen); + ppseudo_hdr = + (struct pseudo_hdr *)(u16 *) &info->DSPInfoBlk[2]; + ppseudo_hdr->length = + htons(info->DSPInfoBlklen + 4 + + info->DSPInfoBlklen); + ppseudo_hdr->source = 0x10; + ppseudo_hdr->destination = 0x20; + ppseudo_hdr->portdest = 0; + ppseudo_hdr->portsrc = 0; + ppseudo_hdr->sh_str_id = 0; + ppseudo_hdr->control = 0; + ppseudo_hdr->rsvd1 = 0; + ppseudo_hdr->rsvd2 = 0; + ppseudo_hdr->qos_class = 0; + /* Insert slow queue sequence number */ + ppseudo_hdr->seq_num = info->squeseqnum++; + /* Insert application id */ + ppseudo_hdr->portsrc = 0; + /* Calculate new checksum */ + ppseudo_hdr->checksum = *pmsg++; + for (i = 1; i < 7; i++) + ppseudo_hdr->checksum ^= *pmsg++; + + info->DSPInfoBlk[10] = 0x7200; + info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen); + status = + ft1000_write_dpram32(dev, 0, + (u8 *) &info->DSPInfoBlk[0], + (unsigned short)(info-> + DSPInfoBlklen + + 22)); + status = + ft1000_write_register(dev, FT1000_DB_DPRAM_TX, + FT1000_REG_DOORBELL); + info->DrvMsgPend = 0; + + break; + } - case GET_DRV_ERR_RPT_MSG: { - DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); - // copy driver error message to dsp - info->DrvMsgPend = 1; - // allow any outstanding ioctl to finish - mdelay(10); - status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - } - } - - if ( (tempword & FT1000_DB_DPRAM_TX) == 0) { - // Put message into Slow Queue - // Form Pseudo header - pmsg = (u16 *)&tempbuffer[0]; - ppseudo_hdr = (struct pseudo_hdr *)pmsg; - ppseudo_hdr->length = htons(0x0012); - ppseudo_hdr->source = 0x10; - ppseudo_hdr->destination = 0x20; - ppseudo_hdr->portdest = 0; - ppseudo_hdr->portsrc = 0; - ppseudo_hdr->sh_str_id = 0; - ppseudo_hdr->control = 0; - ppseudo_hdr->rsvd1 = 0; - ppseudo_hdr->rsvd2 = 0; - ppseudo_hdr->qos_class = 0; - // Insert slow queue sequence number - ppseudo_hdr->seq_num = info->squeseqnum++; - // Insert application id - ppseudo_hdr->portsrc = 0; - // Calculate new checksum - ppseudo_hdr->checksum = *pmsg++; - for (i=1; i<7; i++) { - ppseudo_hdr->checksum ^= *pmsg++; - } - pmsg = (u16 *)&tempbuffer[16]; - *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); - *pmsg++ = htons(0x000e); - *pmsg++ = htons(info->DSP_TIME[0]); - *pmsg++ = htons(info->DSP_TIME[1]); - *pmsg++ = htons(info->DSP_TIME[2]); - *pmsg++ = htons(info->DSP_TIME[3]); - convert.byte[0] = info->DspVer[0]; - convert.byte[1] = info->DspVer[1]; - *pmsg++ = convert.wrd; - convert.byte[0] = info->DspVer[2]; - convert.byte[1] = info->DspVer[3]; - *pmsg++ = convert.wrd; - *pmsg++ = htons(info->DrvErrNum); - - CardSendCommand (dev, (unsigned char*)&tempbuffer[0], (u16)(0x0012 + PSEUDOSZ)); - info->DrvErrNum = 0; - } - info->DrvMsgPend = 0; - - break; - } - - default: - break; - } + case GET_DRV_ERR_RPT_MSG:{ + DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); + /* copy driver error message to dsp */ + info->DrvMsgPend = 1; + /* allow any outstanding ioctl to finish */ + mdelay(10); + status = + ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + status = + ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) + mdelay(10); + } + + if ((tempword & FT1000_DB_DPRAM_TX) == 0) { + /* Put message into Slow Queue + * Form Pseudo header + */ + pmsg = (u16 *) &tempbuffer[0]; + ppseudo_hdr = (struct pseudo_hdr *)pmsg; + ppseudo_hdr->length = htons(0x0012); + ppseudo_hdr->source = 0x10; + ppseudo_hdr->destination = 0x20; + ppseudo_hdr->portdest = 0; + ppseudo_hdr->portsrc = 0; + ppseudo_hdr->sh_str_id = 0; + ppseudo_hdr->control = 0; + ppseudo_hdr->rsvd1 = 0; + ppseudo_hdr->rsvd2 = 0; + ppseudo_hdr->qos_class = 0; + /* Insert slow queue sequence number */ + ppseudo_hdr->seq_num = info->squeseqnum++; + /* Insert application id */ + ppseudo_hdr->portsrc = 0; + /* Calculate new checksum */ + ppseudo_hdr->checksum = *pmsg++; + for (i = 1; i < 7; i++) + ppseudo_hdr->checksum ^= *pmsg++; + + pmsg = (u16 *) &tempbuffer[16]; + *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); + *pmsg++ = htons(0x000e); + *pmsg++ = htons(info->DSP_TIME[0]); + *pmsg++ = htons(info->DSP_TIME[1]); + *pmsg++ = htons(info->DSP_TIME[2]); + *pmsg++ = htons(info->DSP_TIME[3]); + convert.byte[0] = info->DspVer[0]; + convert.byte[1] = info->DspVer[1]; + *pmsg++ = convert.wrd; + convert.byte[0] = info->DspVer[2]; + convert.byte[1] = info->DspVer[3]; + *pmsg++ = convert.wrd; + *pmsg++ = htons(info->DrvErrNum); + + card_send_command(dev, + (unsigned char *)&tempbuffer[0], + (u16) (0x0012 + PSEUDOSZ)); + info->DrvErrNum = 0; + } + info->DrvMsgPend = 0; + + break; + } + default: + break; + } - status = STATUS_SUCCESS; + status = STATUS_SUCCESS; out: - kfree(cmdbuffer); - DEBUG("return from ft1000_proc_drvmsg\n"); - return status; + kfree(cmdbuffer); + DEBUG("return from ft1000_proc_drvmsg\n"); + return status; } - - int ft1000_poll(void* dev_id) { struct ft1000_device *dev = (struct ft1000_device *)dev_id; |