Marek Belisko (21):
staging: ft1000: Replace camelcase CardSendCommand function name.
staging: ft1000: Fix coding style in card_send_command function.
staging: ft1000: Fix coding style in dsp_reload function.
staging: ft1000: Fix coding style in ft1000_reset_asic function.
staging: ft1000: Fix coding style in ft1000_reset_card function.
staging: ft1000: Fix identation in ftnet_ops struct.
staging: ft1000: Fix coding style in init_ft1000_netdev function.
staging: ft1000: Change return value for init_ft1000_netdev function.
staging: ft1000: Fix coding style in reg_ft1000_netdev function.
staging: ft1000: Fix coding style in ft1000_reset function.
staging: ft1000: Fix coding style in ft1000_usb_transmit_complete
function.
staging: ft1000: Fix coding style in ft1000_copy_down_pkt function.
staging: ft1000: Fix coding style in ft1000_start_xmit function.
staging: ft1000: Fix coding style in ft1000_submit_rx_urb function.
staging: ft1000: Fix coding style in ft1000_copy_up_pkt function.
staging: ft1000: Fix coding style in ft1000_open function.
staging: ft1000: Fix coding style in ft1000_close function.
staging: ft1000: Fix coding style in ft1000_chkcard function.
staging: ft1000: Fix coding style in ft1000_receive_cmd function.
staging: ft1000: Fix coding style in ft1000_dsp_prov function.
staging: ft1000: Fix coding style in ft1000_proc_drvmsg function.
drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 6 +-
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 1724 +++++++++++-----------
drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 4 +-
3 files changed, 872 insertions(+), 862 deletions(-)
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 37 +++++++++++++------------
1 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 53073d5..188a8e3 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -593,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;
-
- DEBUG("ft1000_hw:ft1000_reset_asic called\n");
+ struct ft1000_device *ft1000dev = info->pFt1000Dev;
+ u16 tempword;
- info->ASICResetNum++;
+ DEBUG("ft1000_hw:ft1000_reset_asic called\n");
- // 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 );
+ info->ASICResetNum++;
- mdelay(1);
+ /* 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);
- // set watermark to -1 in order to not generate an interrrupt
- ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_MAG_WATERMARK);
+ mdelay(1);
- // 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);
}
--
1.7.1
Replace CardSendCommand by card_send_command.
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 6 +++---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 18 +++++++++---------
drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 149ba59..19db23f 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -471,14 +471,14 @@ static long ft1000_ioctl (struct file *file, unsigned int command,
// Connect Message
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n");
ConnectionMsg[79] = 0xfc;
- CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
+ card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
break;
case IOCTL_DISCONNECT:
// Disconnect Message
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n");
ConnectionMsg[79] = 0xfd;
- CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
+ card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
break;
case IOCTL_GET_DSP_STAT_CMD:
//DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n");
@@ -642,7 +642,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command,
}
pmsg++;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
- CardSendCommand(ft1000dev,(unsigned short*)dpram_data,total_len+2);
+ card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2);
info->app_info[app_index].nTxMsg++;
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index e3b9934..293a469 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -467,7 +467,7 @@ static void card_reset_dsp(struct ft1000_device *ft1000dev, bool value)
}
//---------------------------------------------------------------------------
-// Function: CardSendCommand
+// Function: card_send_command
//
// Parameters: ft1000_device - device structure
// ptempbuffer - command buffer
@@ -481,17 +481,17 @@ 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;
- 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);
- //DEBUG("CardSendCommand: Command Send\n");
+ //DEBUG("card_send_command: Command Send\n");
ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
@@ -509,18 +509,18 @@ void CardSendCommand(struct ft1000_device *ft1000dev, void *ptempbuffer, int siz
}
- //DEBUG("CardSendCommand: write dpram ... size=%d\n", size);
+ //DEBUG("card_send_command: write dpram ... size=%d\n", size);
ft1000_write_dpram32(ft1000dev, 0,commandbuf, size);
msleep(1);
- //DEBUG("CardSendCommand: write into doorbell ...\n");
+ //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);
+ //DEBUG("card_send_command: read doorbell ...temp=%x\n", temp);
if ( (temp & 0x0100) == 0)
{
- //DEBUG("CardSendCommand: Message sent\n");
+ //DEBUG("card_send_command: Message sent\n");
}
}
@@ -1811,7 +1811,7 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
*pmsg++ = convert.wrd;
*pmsg++ = htons(info->DrvErrNum);
- CardSendCommand (dev, (unsigned char*)&tempbuffer[0], (u16)(0x0012 + PSEUDOSZ));
+ card_send_command (dev, (unsigned char*)&tempbuffer[0], (u16)(0x0012 + PSEUDOSZ));
info->DrvErrNum = 0;
}
info->DrvMsgPend = 0;
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
index 88183fe..84ff53d 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
@@ -581,7 +581,7 @@ extern spinlock_t free_buff_lock; // lock to arbitrate free buffer list for re
int ft1000_create_dev(struct ft1000_device *dev);
void ft1000_destroy_dev(struct net_device *dev);
-extern void CardSendCommand(struct ft1000_device *ft1000dev, void *ptempbuffer, int size);
+extern void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, int size);
struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 65 ++++++++++++-------------
1 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 188a8e3..71c7c5d 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -634,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;
+ DEBUG("ft1000_hw:ft1000_reset_card called.....\n");
- // 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);
- }
+ info->fCondResetPend = 1;
+ info->CardReady = 0;
+ info->fProvComplete = 0;
- DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n");
- //reset ASIC
- ft1000_reset_asic(dev);
-
- info->DSPResetNum++;
+ /* 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("ft1000_hw:ft1000_reset_card: call dsp_reload\n");
- dsp_reload(ft1000dev);
+ DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n");
+ ft1000_reset_asic(dev);
- DEBUG("dsp reload successful\n");
+ info->DSPResetNum++;
+ DEBUG("ft1000_hw:ft1000_reset_card: call dsp_reload\n");
+ dsp_reload(ft1000dev);
- mdelay(10);
+ DEBUG("dsp reload successful\n");
- // 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);
+ 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;
}
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 0b8ff3d..4c5f443 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -882,8 +882,8 @@ int reg_ft1000_netdev(struct ft1000_device *ft1000dev,
static int ft1000_reset(struct net_device *dev)
{
- ft1000_reset_card(dev);
- return 0;
+ ft1000_reset_card(dev);
+ return 0;
}
//---------------------------------------------------------------------------
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 0b2acec..a76e380 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1281,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)
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 83 ++++++++++++-------------
1 files changed, 39 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 0685070..8095dd2 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1022,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;
-
-
- //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));
+ struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev;
+ u8 *pdata;
+ int maxlen, pipe;
- 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
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 46 ++++++++++++-------------
1 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 8095dd2..d2e8de5 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1203,38 +1203,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;
+ 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;
+ }
- //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);
-
+ 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) {
+ DEBUG("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
//
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 167 ++++++++++++-------------
1 files changed, 79 insertions(+), 88 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index d2e8de5..26981ed 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1085,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);
+ struct ft1000_device *ft1000dev = info->pFt1000Dev;
+ struct net_device *net = ft1000dev->net;
- //subtract the number of bytes read already
- ptemp = pbuffer;
+ u16 tempword;
+ u16 len;
+ u16 lena; //mbelian
+ struct sk_buff *skb;
+ u16 i;
+ u8 *pbuffer = NULL;
+ u8 *ptemp = NULL;
+ u16 *chksum;
- // 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;
+ //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);
- memcpy(pbuffer, ft1000dev->rx_buf+sizeof(struct pseudo_hdr), len-sizeof(struct pseudo_hdr));
+ 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;
+ }
- //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++);
- }*/
+ 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->dev = net;
- skb->protocol = eth_type_trans(skb, net);
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- netif_rx(skb);
+ 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
+ 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;
+ ft1000_submit_rx_urb(info);
+ //DEBUG("ft1000_copy_up_pkt exited\n");
+ return SUCCESS;
}
+
//---------------------------------------------------------------------------
//
// Function: ft1000_submit_rx_urb
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 566 +++++++++++++------------
1 files changed, 299 insertions(+), 267 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index deefefd..d3231e8 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1530,286 +1530,318 @@ static int ft1000_dsp_prov(void *arg)
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");
+ 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++;
- // 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;
- }
+ 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;
- 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;
- }
+ 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;
- status = STATUS_SUCCESS;
-out:
- kfree(cmdbuffer);
- DEBUG("return from ft1000_proc_drvmsg\n");
- return status;
-}
+ break;
+ }
+ default:
+ break;
+ }
+ status = STATUS_SUCCESS;
+out:
+ kfree(cmdbuffer);
+ DEBUG("return from ft1000_proc_drvmsg\n");
+ return status;
+}
int ft1000_poll(void* dev_id) {
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 161 +++++++++++++------------
1 files changed, 83 insertions(+), 78 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 9e0b696..deefefd 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1439,92 +1439,97 @@ static bool ft1000_receive_cmd(struct ft1000_device *dev, u16 *pbuffer,
}
}
-
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];
+ u16 *pmsg;
+ u16 status;
+ u16 TempShortBuf[256];
- DEBUG("*** DspProv Entered\n");
+ 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 (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);
- }
+ 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);
+ }
- 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);
- }
+ if (!(tempword & FT1000_DB_DPRAM_TX)) {
+ DEBUG("*** Provision Data Sent to DSP\n");
- TempShortBuf[0] = 0;
- TempShortBuf[1] = htons (len);
- memcpy(&TempShortBuf[2], ppseudo_hdr, len);
+ /* Send provisioning data */
+ ptr =
+ list_entry(info->prov_list.next, struct prov_record,
+ list);
+ len = *(u16 *) ptr->pprov_data;
+ len = htons(len);
+ len += PSEUDOSZ;
- 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);
+ 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);
+ }
- list_del(&ptr->list);
- kfree(ptr->pprov_data);
- kfree(ptr);
- }
- msleep(10);
- }
+ 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) {
struct ft1000_info *info = netdev_priv(dev->net);
u16 msgtype;
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 112 ++++++++++++++-----------
1 files changed, 63 insertions(+), 49 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 5fdfbbd..9e0b696 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1373,56 +1373,70 @@ 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);
- }
+ 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++;
- // 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;
- }
+ if ((tempword != *ppseudohdr))
+ return FALSE;
- return TRUE;
- }
+ return TRUE;
+ }
}
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 26981ed..0b2acec 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1238,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);
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 61 +++++++++++++------------
1 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index a76e380..5fdfbbd 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1325,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
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 75 +++++++++++-------------
1 files changed, 34 insertions(+), 41 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 6e89336..0685070 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -929,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));
@@ -972,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);
-
- //DEBUG ("ft1000_copy_down_pkt: count = %d\n", count);
+ netif_stop_queue(netdev);
- 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);
+ //DEBUG ("ft1000_copy_down_pkt: count = %d\n", count);
- 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
//
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 4c5f443..6e89336 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -902,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)
+ DEBUG("%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");
}
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 40 +++++++++++-------------
1 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 55998ec..0b8ff3d 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -848,38 +848,34 @@ 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);
+ 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;
- }
-
-
- //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;
}
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 2 +-
drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index adf16c6..55998ec 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -710,7 +710,7 @@ 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 ft1000_info *pInfo = NULL;
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
index 84ff53d..e047c03 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
@@ -589,7 +589,7 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
char *getfw (char *fn, size_t *pimgsz);
int dsp_reload(struct ft1000_device *ft1000dev);
-u16 init_ft1000_netdev(struct ft1000_device *ft1000dev);
+int init_ft1000_netdev(struct ft1000_device *ft1000dev);
struct usb_interface;
int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf);
int ft1000_poll(void* dev_id);
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 126 +++++++++++--------------
1 files changed, 57 insertions(+), 69 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index bf2c729..adf16c6 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -712,7 +712,7 @@ static const struct net_device_ops ftnet_ops =
//---------------------------------------------------------------------------
u16 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;
@@ -720,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);
@@ -749,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;
-//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);
+ 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);
+ /* 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);
@@ -844,8 +834,6 @@ err_net:
return ret_val;
}
-
-
//---------------------------------------------------------------------------
// Function: reg_ft1000_netdev
//
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 71c7c5d..bf2c729 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -688,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
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 57 +++++++++++++------------
1 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index ded13f2..53073d5 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -534,49 +534,52 @@ void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer,
//-----------------------------------------------------------------------
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;
}
//---------------------------------------------------------------------------
--
1.7.1
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 60 +++++++++++-------------
1 files changed, 28 insertions(+), 32 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 293a469..ded13f2 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -481,51 +481,47 @@ static void card_reset_dsp(struct ft1000_device *ft1000dev, bool value)
// Notes:
//
//---------------------------------------------------------------------------
-void card_send_command(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("card_send_command: enter card_send_command... 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("card_send_command: 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("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);
+ //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("card_send_command: read doorbell ...temp=%x\n", temp);
- if ( (temp & 0x0100) == 0)
- {
- //DEBUG("card_send_command: 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
--
1.7.1
On Mon, Mar 07, 2011 at 09:21:16AM +0100, Marek Belisko wrote:
> - if (urb->status)
> - printk("%s: TX status %d\n", ft1000dev->net->name, urb->status);
> + if (urb->status)
> + DEBUG("%s: TX status %d\n", ft1000dev->net->name, urb->status);
>
Why did you change the printk() to a DEBUG()? That's a behavior change,
and it should have been mentioned in the commit message.
regards,
dan carpenter
> - netif_wake_queue(ft1000dev->net);
> + netif_wake_queue(ft1000dev->net);
>
> //DEBUG("Return from ft1000_usb_transmit_complete\n");
> }
On Mon, Mar 7, 2011 at 4:55 PM, Dan Carpenter <[email protected]> wrote:
> On Mon, Mar 07, 2011 at 09:21:16AM +0100, Marek Belisko wrote:
>> - if (urb->status)
>> - printk("%s: TX status %d\n", ft1000dev->net->name, urb->status);
>> + if (urb->status)
>> + DEBUG("%s: TX status %d\n", ft1000dev->net->name, urb->status);
>>
>
> Why did you change the printk() to a DEBUG()? That's a behavior change,
> and it should have been mentioned in the commit message.
Mea culpa. checkpatch.pl complain about no KERN_... prefix so just fix with
replace to DEBUG. Will return back to printk.
@Greg: should resend whole serie or just this patch?
>
> regards,
> dan carpenter
>
>> - netif_wake_queue(ft1000dev->net);
>> + netif_wake_queue(ft1000dev->net);
>>
>> //DEBUG("Return from ft1000_usb_transmit_complete\n");
>> }
>
>
thansk,
marek
--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com
On Mon, Mar 07, 2011 at 08:25:07PM +0100, Belisko Marek wrote:
> On Mon, Mar 7, 2011 at 4:55 PM, Dan Carpenter <[email protected]> wrote:
> > On Mon, Mar 07, 2011 at 09:21:16AM +0100, Marek Belisko wrote:
> >> - ? ?if (urb->status)
> >> - ? ? ? ?printk("%s: TX status %d\n", ft1000dev->net->name, urb->status);
> >> + ? ? if (urb->status)
> >> + ? ? ? ? ? ? DEBUG("%s: TX status %d\n", ft1000dev->net->name, urb->status);
> >>
> >
> > Why did you change the printk() to a DEBUG()? ?That's a behavior change,
> > and it should have been mentioned in the commit message.
> Mea culpa. checkpatch.pl complain about no KERN_... prefix so just fix with
> replace to DEBUG. Will return back to printk.
> @Greg: should resend whole serie or just this patch?
pr_err() or pr_info() would probably be better.
Here is how the usb-skeleton driver handles this btw:
/* sync/async unlink faults aren't errors */
if (urb->status) {
if (!(urb->status == -ENOENT ||
urb->status == -ECONNRESET ||
urb->status == -ESHUTDOWN))
err("%s - nonzero write bulk status received: %d",
__func__, urb->status);
dev->errors = urb->status;
} else {
dev->bulk_in_filled = urb->actual_length;
}
That uses the old usb err() macro which I think is not recomended these
days. Use pr_err() instead.
Do the other patches still apply if you resend just this patch? Btw
git send-email has a --in-reply-to option so that the V2 is attached to
the same thread as the original patch.
regards,
dan carpenter
On Mon, Mar 07, 2011 at 08:25:07PM +0100, Belisko Marek wrote:
> On Mon, Mar 7, 2011 at 4:55 PM, Dan Carpenter <[email protected]> wrote:
> > On Mon, Mar 07, 2011 at 09:21:16AM +0100, Marek Belisko wrote:
> >> - ? ?if (urb->status)
> >> - ? ? ? ?printk("%s: TX status %d\n", ft1000dev->net->name, urb->status);
> >> + ? ? if (urb->status)
> >> + ? ? ? ? ? ? DEBUG("%s: TX status %d\n", ft1000dev->net->name, urb->status);
> >>
> >
> > Why did you change the printk() to a DEBUG()? ?That's a behavior change,
> > and it should have been mentioned in the commit message.
> Mea culpa. checkpatch.pl complain about no KERN_... prefix so just fix with
> replace to DEBUG. Will return back to printk.
> @Greg: should resend whole serie or just this patch?
Which ever you feel ok with.
thanks,
greg k-h
Fix coding style and also replace printk with proper pr_err
function.
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 46 ++++++++++++-------------
1 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 8095dd2..8115e2c 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1203,38 +1203,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;
+ 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;
+ }
- //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);
-
+ 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
//
--
1.7.1
Fix coding style and also replace printk with proper pr_err
function.
Signed-off-by: Marek Belisko <[email protected]>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 4c5f443..958292e 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -902,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");
}
--
1.7.1
On Mon, Mar 07, 2011 at 09:21:05AM +0100, Marek Belisko wrote:
> Marek Belisko (21):
> staging: ft1000: Replace camelcase CardSendCommand function name.
> staging: ft1000: Fix coding style in card_send_command function.
> staging: ft1000: Fix coding style in dsp_reload function.
> staging: ft1000: Fix coding style in ft1000_reset_asic function.
> staging: ft1000: Fix coding style in ft1000_reset_card function.
> staging: ft1000: Fix identation in ftnet_ops struct.
> staging: ft1000: Fix coding style in init_ft1000_netdev function.
> staging: ft1000: Change return value for init_ft1000_netdev function.
> staging: ft1000: Fix coding style in reg_ft1000_netdev function.
> staging: ft1000: Fix coding style in ft1000_reset function.
> staging: ft1000: Fix coding style in ft1000_usb_transmit_complete
> function.
> staging: ft1000: Fix coding style in ft1000_copy_down_pkt function.
> staging: ft1000: Fix coding style in ft1000_start_xmit function.
> staging: ft1000: Fix coding style in ft1000_submit_rx_urb function.
> staging: ft1000: Fix coding style in ft1000_copy_up_pkt function.
> staging: ft1000: Fix coding style in ft1000_open function.
> staging: ft1000: Fix coding style in ft1000_close function.
> staging: ft1000: Fix coding style in ft1000_chkcard function.
> staging: ft1000: Fix coding style in ft1000_receive_cmd function.
> staging: ft1000: Fix coding style in ft1000_dsp_prov function.
> staging: ft1000: Fix coding style in ft1000_proc_drvmsg function.
>
> drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 6 +-
> drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 1724 +++++++++++-----------
> drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 4 +-
After applying this series, I get the following build error:
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c: In function ‘ft1000_proc_drvmsg’:
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1825:5: error: implicit declaration of function ‘CardSendCommand’
So I've dropped the whole series.
Care to try it again?
thanks,
greg k-h