diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-15 11:30:39 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-15 11:30:39 -0800 |
commit | 46f7b635569731ff81a3b72d1bcd4415b293b637 (patch) | |
tree | e97e5e28d1768bb281116d92292851758ea20024 /drivers/staging/ft1000 | |
parent | Merge tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core (diff) | |
parent | staging: lustre: lustre: libcfs: define symbols as static (diff) | |
download | linux-dev-46f7b635569731ff81a3b72d1bcd4415b293b637.tar.xz linux-dev-46f7b635569731ff81a3b72d1bcd4415b293b637.zip |
Merge tag 'staging-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging drivers patches from Greg KH:
"Here's the big staging driver tree update for 3.20-rc1.
Lots of little things in here, adding up to lots of overall cleanups.
The IIO driver updates are also in here as they cross the staging tree
boundry a lot. I2O has moved into staging as well, as a plan to drop
it from the tree eventually as that's a dead subsystem.
All of this has been in linux-next with no reported issues for a
while"
* tag 'staging-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (740 commits)
staging: lustre: lustre: libcfs: define symbols as static
staging: rtl8712: Do coding style cleanup
staging: lustre: make obd_updatemax_lock static
staging: rtl8188eu: core: switch with redundant cases
staging: rtl8188eu: odm: conditional setting with no effect
staging: rtl8188eu: odm: condition with no effect
staging: ft1000: fix braces warning
staging: sm7xxfb: fix remaining CamelCase
staging: sm7xxfb: fix CamelCase
staging: rtl8723au: multiple condition with no effect - if identical to else
staging: sm7xxfb: make smtc_scr_info static
staging/lustre/mdc: Initialize req in mdc_enqueue for !it case
staging/lustre/clio: Do not allow group locks with gid 0
staging/lustre/llite: don't add to page cache upon failure
staging/lustre/llite: Add exception entry check after radix_tree
staging/lustre/libcfs: protect kkuc_groups from write access
staging/lustre/fld: refer to MDT0 for fld lookup in some cases
staging/lustre/llite: Solve a race to access lli_has_smd in read case
staging/lustre/ptlrpc: hold rq_lock when modify rq_flags
staging/lustre/lnet: portal spreading rotor should be unsigned
...
Diffstat (limited to 'drivers/staging/ft1000')
-rw-r--r-- | drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 111 | ||||
-rw-r--r-- | drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 8 |
2 files changed, 49 insertions, 70 deletions
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index d5475b7270a8..017c3b92f51b 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -172,11 +172,11 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) spin_lock_irqsave(&info->dpram_lock, flags); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); /* check if we want to read upper or lower 32-bit word */ - if (Index) { + if (Index) data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL); - } else { + else data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAH); - } + spin_unlock_irqrestore(&info->dpram_lock, flags); return data; @@ -204,11 +204,11 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev, /* Provide mutual exclusive access while reading ASIC registers. */ spin_lock_irqsave(&info->dpram_lock, flags); ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset); - if (Index) { + if (Index) ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAL, value); - } else { + else ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, value); - } + spin_unlock_irqrestore(&info->dpram_lock, flags); } @@ -440,9 +440,8 @@ static int ft1000_reset_card(struct net_device *dev) tempword = ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE, FT1000_MAG_DPRAM_FEFE_INDX); - if (tempword == 0xfefe) { + if (tempword == 0xfefe) break; - } mdelay(20); } @@ -570,12 +569,12 @@ static void ft1000_hbchk(u_long data) pr_debug("hi_ho value = 0x%x\n", tempword); /* Let's perform another check if ho is not detected */ if (tempword != ho) { - if (info->AsicID == ELECTRABUZZ_ID) { + if (info->AsicID == ELECTRABUZZ_ID) tempword = ft1000_read_dpram(dev, FT1000_HI_HO); - } - else { - tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); - } + else + tempword = ntohs(ft1000_read_dpram_mag_16(dev, + FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX)); } if (tempword != ho) { pr_info("heartbeat failed - no ho detected\n"); @@ -621,9 +620,9 @@ static void ft1000_hbchk(u_long data) tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); /* Let's check doorbell again if fail */ - if (tempword & FT1000_DB_HB) { + if (tempword & FT1000_DB_HB) tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - } + if (tempword & FT1000_DB_HB) { pr_info("heartbeat doorbell not clear by firmware\n"); if (info->AsicID == ELECTRABUZZ_ID) { @@ -686,19 +685,15 @@ static void ft1000_hbchk(u_long data) } /* Let's write hi again if fail */ if (tempword != hi) { - if (info->AsicID == ELECTRABUZZ_ID) { + if (info->AsicID == ELECTRABUZZ_ID) ft1000_write_dpram(dev, FT1000_HI_HO, hi); - } - else { + else ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, hi_mag, FT1000_MAG_HI_HO_INDX); - } - if (info->AsicID == ELECTRABUZZ_ID) { + if (info->AsicID == ELECTRABUZZ_ID) tempword = ft1000_read_dpram(dev, FT1000_HI_HO); - } - else { + else tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); - } } @@ -770,9 +765,8 @@ static void ft1000_send_cmd(struct net_device *dev, u16 *ptempbuffer, int size, size += sizeof(struct pseudo_hdr); /* check for odd byte and increment to 16-bit word align value */ - if ((size & 0x0001)) { + if ((size & 0x0001)) size++; - } pr_debug("total length = %d\n", size); pr_debug("length = %d\n", ntohs(*ptempbuffer)); /* @@ -915,9 +909,8 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, * Calculate pseudo header checksum */ tempword = *ppseudohdr++; - for (i = 1; i < 7; i++) { + for (i = 1; i < 7; i++) tempword ^= *ppseudohdr++; - } if ((tempword != *ppseudohdr)) { pr_debug("Pseudo header checksum mismatch\n"); /* Drop this message */ @@ -957,12 +950,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev) u16 wrd; } convert; - if (info->AsicID == ELECTRABUZZ_ID) { + if (info->AsicID == ELECTRABUZZ_ID) tempword = FT1000_DPRAM_RX_BASE+2; - } - else { + else tempword = FT1000_DPRAM_MAG_RX_BASE; - } + if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) { /* Get the message type which is total_len + PSEUDO header + msgtype + message body */ @@ -982,9 +974,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) while (tempword & FT1000_DB_DPRAM_TX) { mdelay(5); i++; - if (i == 10) { + if (i == 10) break; - } } ptr = list_entry(info->prov_list.next, @@ -1039,8 +1030,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev) info->ConTm = 0; } } - } - else { + } else { pr_debug("Media is down\n"); if (info->mediastate == 1) { info->mediastate = 0; @@ -1105,9 +1095,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) mdelay(10); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { + if (tempword & FT1000_DB_DPRAM_TX) mdelay(10); - } } if ((tempword & FT1000_DB_DPRAM_TX) == 0) { @@ -1134,9 +1123,9 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ppseudo_hdr->portsrc = 0; /* Calculate new checksum */ ppseudo_hdr->checksum = *pmsg++; - for (i = 1; i < 7; i++) { + for (i = 1; i < 7; i++) ppseudo_hdr->checksum ^= *pmsg++; - } + info->DSPInfoBlk[8] = 0x7200; info->DSPInfoBlk[9] = htons(info->DSPInfoBlklen); @@ -1156,9 +1145,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) mdelay(10); tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { + if (tempword & FT1000_DB_DPRAM_TX) mdelay(10); - } } if ((tempword & FT1000_DB_DPRAM_TX) == 0) { @@ -1184,9 +1172,9 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ppseudo_hdr->portsrc = 0; /* Calculate new checksum */ ppseudo_hdr->checksum = *pmsg++; - for (i = 1; i < 7; i++) { + for (i = 1; i < 7; i++) ppseudo_hdr->checksum ^= *pmsg++; - } + pmsg = (u16 *)&tempbuffer[16]; *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); *pmsg++ = htons(0x000e); @@ -1508,9 +1496,8 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) tempword = inw(dev->base_addr + FT1000_REG_MAG_DFSR); pr_debug("FT1000_REG_MAG_DFSR = 0x%x\n", tempword); } - if (DrvErrNum) { + if (DrvErrNum) pcmcia->PktIntfErr++; - } } } @@ -1567,9 +1554,9 @@ static int ft1000_copy_up_pkt(struct net_device *dev) if (skb == NULL) { pr_debug("No Network buffers available\n"); /* Read High word to complete 32 bit access */ - if (info->AsicID == MAGNEMITE_ID) { + if (info->AsicID == MAGNEMITE_ID) tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); - } + ft1000_flush_fifo(dev, 0); info->stats.rx_errors++; return FAILURE; @@ -1673,9 +1660,8 @@ static int ft1000_copy_up_pkt(struct net_device *dev) } pr_debug("Data passed to Protocol layer:\n"); - for (i = 0; i < len + 12; i++) { + for (i = 0; i < len + 12; i++) pr_debug("Protocol Data: 0x%x\n", *ptemp++); - } skb->dev = dev; skb->protocol = eth_type_trans(skb, dev); @@ -1729,21 +1715,16 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) /* Check if there is room on the FIFO */ if (len > ft1000_read_fifo_len(dev)) { udelay(10); - if (len > ft1000_read_fifo_len(dev)) { + if (len > ft1000_read_fifo_len(dev)) udelay(20); - } - if (len > ft1000_read_fifo_len(dev)) { + if (len > ft1000_read_fifo_len(dev)) udelay(20); - } - if (len > ft1000_read_fifo_len(dev)) { + if (len > ft1000_read_fifo_len(dev)) udelay(20); - } - if (len > ft1000_read_fifo_len(dev)) { + if (len > ft1000_read_fifo_len(dev)) udelay(20); - } - if (len > ft1000_read_fifo_len(dev)) { + if (len > ft1000_read_fifo_len(dev)) udelay(20); - } if (len > ft1000_read_fifo_len(dev)) { pr_debug("Transmit FIFO is full - pkt drop\n"); info->stats.tx_errors++; @@ -1751,11 +1732,11 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) } } /* Create pseudo header and send pseudo/ip to hardware */ - if (info->AsicID == ELECTRABUZZ_ID) { + if (info->AsicID == ELECTRABUZZ_ID) pseudo.blk.length = len; - } else { + else pseudo.blk.length = ntohs(len); - } + pseudo.blk.source = DSPID; /* Need to swap to get in correct order */ pseudo.blk.destination = HOSTID; pseudo.blk.portdest = NETWORKID; /* Need to swap to get in correct order */ @@ -1768,9 +1749,8 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) pseudo.blk.qos_class = 0; /* Calculate pseudo header checksum */ pseudo.blk.checksum = pseudo.buff[0]; - for (i = 1; i < 7; i++) { + for (i = 1; i < 7; i++) pseudo.blk.checksum ^= pseudo.buff[i]; - } /* Production Mode */ if (info->AsicID == ELECTRABUZZ_ID) { @@ -1835,9 +1815,8 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) plong = (u32 *)packet; /* Write PPP type + IP Packet into Downlink FIFO */ - for (i = 0; i < (len >> 2); i++) { + for (i = 0; i < (len >> 2); i++) outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); - } /* Check for odd alignment */ if (len & 0x0003) { diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index d12cfc9aa32a..f0ac43838461 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -332,15 +332,15 @@ int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, pr_debug("enter card_send_command... size=%d\n", size); + ret = ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); + if (ret) + return ret; + commandbuf = kmalloc(size + 2, GFP_KERNEL); if (!commandbuf) return -ENOMEM; memcpy((void *)commandbuf + 2, (void *)ptempbuffer, size); - ret = ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); - if (ret) - return ret; - if (temp & 0x0100) usleep_range(900, 1100); |