提交 ecdd21c7 编写于 作者: J Joe Perches 提交者: Greg Kroah-Hartman

staging: ft1000: Whitespace neatening

Use normal kernel style, indentation and alignment.

git diff -w shows no difference
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4884434c
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 2002 Flarion Technologies, All rights reserved. Copyright (C) 2002 Flarion Technologies, All rights reserved.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any Software Foundation; either version 2 of the License, or (at your option) any
later version. This program is distributed in the hope that it will be useful, later version. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public more details. You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
File: boot.h File: boot.h
Description: boatloader Description: boatloader
History: History:
1/11/05 Whc Ported to Linux. 1/11/05 Whc Ported to Linux.
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef _BOOTH_ #ifndef _BOOTH_
#define _BOOTH_ #define _BOOTH_
......
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 2002 Flarion Technologies, All rights reserved. Copyright (C) 2002 Flarion Technologies, All rights reserved.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any Software Foundation; either version 2 of the License, or (at your option) any
later version. This program is distributed in the hope that it will be useful, later version. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public more details. You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Description: Common structures and defines Description: Common structures and defines
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef _FT1000H_ #ifndef _FT1000H_
#define _FT1000H_ #define _FT1000H_
......
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 1999 David A. Hinds. All Rights Reserved. Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Copyright (C) 2002 Flarion Technologies, All rights reserved. Copyright (C) 2002 Flarion Technologies, All rights reserved.
Copyright (C) 2006 Patrik Ostrihon, All rights reserved. Copyright (C) 2006 Patrik Ostrihon, All rights reserved.
Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved.
The initial developer of the original code is David A. Hinds The initial developer of the original code is David A. Hinds
<dahinds@users.sourceforge.net>. Portions created by David A. Hinds. <dahinds@users.sourceforge.net>. Portions created by David A. Hinds.
This file was modified to support the Flarion Flash OFDM NIC Device This file was modified to support the Flarion Flash OFDM NIC Device
by Wai Chan (w.chan@flarion.com). by Wai Chan (w.chan@flarion.com).
Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostrihon@pwc.sk) Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostrihon@pwc.sk)
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any Software Foundation; either version 2 of the License, or (at your option) any
later version. This program is distributed in the hope that it will be useful, later version. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public more details. You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -80,11 +80,11 @@ static int ft1000_confcheck(struct pcmcia_device *link, void *priv_data) ...@@ -80,11 +80,11 @@ static int ft1000_confcheck(struct pcmcia_device *link, void *priv_data)
/*====================================================================== /*======================================================================
ft1000_config() is scheduled to run after a CARD_INSERTION event ft1000_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the is received, to configure the PCMCIA socket, and to make the
device available to the system. device available to the system.
======================================================================*/ ======================================================================*/
static int ft1000_config(struct pcmcia_device *link) static int ft1000_config(struct pcmcia_device *link)
{ {
......
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 2002 Flarion Technologies, All rights reserved. Copyright (C) 2002 Flarion Technologies, All rights reserved.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any Software Foundation; either version 2 of the License, or (at your option) any
later version. This program is distributed in the hope that it will be useful, later version. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public more details. You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Description: This module will handshake with the DSP bootloader to Description: This module will handshake with the DSP bootloader to
download the DSP runtime image. download the DSP runtime image.
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__
...@@ -114,7 +114,7 @@ struct dsp_image_info { ...@@ -114,7 +114,7 @@ struct dsp_image_info {
void card_bootload(struct net_device *dev) void card_bootload(struct net_device *dev)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
unsigned long flags; unsigned long flags;
u32 *pdata; u32 *pdata;
u32 size; u32 size;
...@@ -123,7 +123,7 @@ void card_bootload(struct net_device *dev) ...@@ -123,7 +123,7 @@ void card_bootload(struct net_device *dev)
netdev_dbg(dev, "card_bootload is called\n"); netdev_dbg(dev, "card_bootload is called\n");
pdata = (u32 *) bootimage; pdata = (u32 *)bootimage;
size = sizeof(bootimage); size = sizeof(bootimage);
/* check for odd word */ /* check for odd word */
...@@ -146,7 +146,7 @@ void card_bootload(struct net_device *dev) ...@@ -146,7 +146,7 @@ void card_bootload(struct net_device *dev)
u16 get_handshake(struct net_device *dev, u16 expected_value) u16 get_handshake(struct net_device *dev, u16 expected_value)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
u16 handshake; u16 handshake;
u32 tempx; u32 tempx;
int loopcnt; int loopcnt;
...@@ -161,12 +161,12 @@ u16 get_handshake(struct net_device *dev, u16 expected_value) ...@@ -161,12 +161,12 @@ u16 get_handshake(struct net_device *dev, u16 expected_value)
} else { } else {
tempx = tempx =
ntohl(ft1000_read_dpram_mag_32 ntohl(ft1000_read_dpram_mag_32
(dev, DWNLD_MAG_HANDSHAKE_LOC)); (dev, DWNLD_MAG_HANDSHAKE_LOC));
handshake = (u16) tempx; handshake = (u16)tempx;
} }
if ((handshake == expected_value) if ((handshake == expected_value)
|| (handshake == HANDSHAKE_RESET_VALUE)) { || (handshake == HANDSHAKE_RESET_VALUE)) {
return handshake; return handshake;
} }
loopcnt++; loopcnt++;
...@@ -180,7 +180,7 @@ u16 get_handshake(struct net_device *dev, u16 expected_value) ...@@ -180,7 +180,7 @@ u16 get_handshake(struct net_device *dev, u16 expected_value)
void put_handshake(struct net_device *dev, u16 handshake_value) void put_handshake(struct net_device *dev, u16 handshake_value)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
u32 tempx; u32 tempx;
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
...@@ -188,7 +188,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value) ...@@ -188,7 +188,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value)
DWNLD_HANDSHAKE_LOC); DWNLD_HANDSHAKE_LOC);
ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, handshake_value); /* Handshake */ ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, handshake_value); /* Handshake */
} else { } else {
tempx = (u32) handshake_value; tempx = (u32)handshake_value;
tempx = ntohl(tempx); tempx = ntohl(tempx);
ft1000_write_dpram_mag_32(dev, DWNLD_MAG_HANDSHAKE_LOC, tempx); /* Handshake */ ft1000_write_dpram_mag_32(dev, DWNLD_MAG_HANDSHAKE_LOC, tempx); /* Handshake */
} }
...@@ -196,7 +196,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value) ...@@ -196,7 +196,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value)
u16 get_request_type(struct net_device *dev) u16 get_request_type(struct net_device *dev)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
u16 request_type; u16 request_type;
u32 tempx; u32 tempx;
...@@ -206,7 +206,7 @@ u16 get_request_type(struct net_device *dev) ...@@ -206,7 +206,7 @@ u16 get_request_type(struct net_device *dev)
} else { } else {
tempx = ft1000_read_dpram_mag_32(dev, DWNLD_MAG_TYPE_LOC); tempx = ft1000_read_dpram_mag_32(dev, DWNLD_MAG_TYPE_LOC);
tempx = ntohl(tempx); tempx = ntohl(tempx);
request_type = (u16) tempx; request_type = (u16)tempx;
} }
return request_type; return request_type;
...@@ -215,7 +215,7 @@ u16 get_request_type(struct net_device *dev) ...@@ -215,7 +215,7 @@ u16 get_request_type(struct net_device *dev)
long get_request_value(struct net_device *dev) long get_request_value(struct net_device *dev)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
long value; long value;
u16 w_val; u16 w_val;
...@@ -244,7 +244,7 @@ long get_request_value(struct net_device *dev) ...@@ -244,7 +244,7 @@ long get_request_value(struct net_device *dev)
void put_request_value(struct net_device *dev, long lvalue) void put_request_value(struct net_device *dev, long lvalue)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
u16 size; u16 size;
u32 tempx; u32 tempx;
...@@ -271,11 +271,11 @@ void put_request_value(struct net_device *dev, long lvalue) ...@@ -271,11 +271,11 @@ void put_request_value(struct net_device *dev, long lvalue)
u16 hdr_checksum(struct pseudo_hdr *pHdr) u16 hdr_checksum(struct pseudo_hdr *pHdr)
{ {
u16 *usPtr = (u16 *) pHdr; u16 *usPtr = (u16 *)pHdr;
u16 chksum; u16 chksum;
chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^
usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); usPtr[4]) ^ usPtr[5]) ^ usPtr[6]);
return chksum; return chksum;
} }
...@@ -283,7 +283,7 @@ u16 hdr_checksum(struct pseudo_hdr *pHdr) ...@@ -283,7 +283,7 @@ u16 hdr_checksum(struct pseudo_hdr *pHdr)
int card_download(struct net_device *dev, const u8 *pFileStart, int card_download(struct net_device *dev, const u8 *pFileStart,
size_t FileLength) size_t FileLength)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev);
int Status = SUCCESS; int Status = SUCCESS;
u32 uiState; u32 uiState;
u16 handshake; u16 handshake;
...@@ -322,7 +322,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -322,7 +322,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
uiState = STATE_START_DWNLD; uiState = STATE_START_DWNLD;
pFileHdr5 = (struct dsp_file_hdr *) pFileStart; pFileHdr5 = (struct dsp_file_hdr *)pFileStart;
pUsFile = (u16 *) ((long)pFileStart + pFileHdr5->loader_offset); pUsFile = (u16 *) ((long)pFileStart + pFileHdr5->loader_offset);
pUcFile = (u8 *) ((long)pFileStart + pFileHdr5->loader_offset); pUcFile = (u8 *) ((long)pFileStart + pFileHdr5->loader_offset);
...@@ -376,7 +376,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -376,7 +376,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
break; break;
} }
if ((word_length * 2 + (long)pUcFile) > if ((word_length * 2 + (long)pUcFile) >
(long)pBootEnd) { (long)pBootEnd) {
/* /*
* Error, beyond boot code range. * Error, beyond boot code range.
*/ */
...@@ -390,8 +390,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -390,8 +390,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) if (word_length & 0x01)
word_length++; word_length++;
word_length = word_length / 2; word_length = word_length / 2;
...@@ -402,12 +402,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -402,12 +402,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
(*pUsFile++ << 16); (*pUsFile++ << 16);
pUcFile += 4; pUcFile += 4;
outl(templong, outl(templong,
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
flags); flags);
break; break;
default: default:
Status = FAILURE; Status = FAILURE;
...@@ -430,7 +430,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -430,7 +430,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
switch (request) { switch (request) {
case REQUEST_FILE_CHECKSUM: case REQUEST_FILE_CHECKSUM:
netdev_dbg(dev, netdev_dbg(dev,
"ft1000_dnld: REQUEST_FOR_CHECKSUM\n"); "ft1000_dnld: REQUEST_FOR_CHECKSUM\n");
put_request_value(dev, image_chksum); put_request_value(dev, image_chksum);
break; break;
case REQUEST_RUN_ADDRESS: case REQUEST_RUN_ADDRESS:
...@@ -468,7 +468,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -468,7 +468,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
break; break;
} }
if ((word_length * 2 + (long)pUcFile) > if ((word_length * 2 + (long)pUcFile) >
(long)pCodeEnd) { (long)pCodeEnd) {
/* /*
* Error, beyond boot code range. * Error, beyond boot code range.
*/ */
...@@ -479,8 +479,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -479,8 +479,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) if (word_length & 0x01)
word_length++; word_length++;
word_length = word_length / 2; word_length = word_length / 2;
...@@ -491,8 +491,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -491,8 +491,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
(*pUsFile++ << 16); (*pUsFile++ << 16);
pUcFile += 4; pUcFile += 4;
outl(templong, outl(templong,
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
break; break;
...@@ -502,9 +502,9 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -502,9 +502,9 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
(long)(info->DSPInfoBlklen + 1) / 2; (long)(info->DSPInfoBlklen + 1) / 2;
put_request_value(dev, word_length); put_request_value(dev, word_length);
pMailBoxData = pMailBoxData =
(struct drv_msg *) &info->DSPInfoBlk[0]; (struct drv_msg *)&info->DSPInfoBlk[0];
pUsData = pUsData =
(u16 *) &pMailBoxData->data[0]; (u16 *)&pMailBoxData->data[0];
/* Provide mutual exclusive access while reading ASIC registers. */ /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, spin_lock_irqsave(&info->dpram_lock,
flags); flags);
...@@ -528,8 +528,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -528,8 +528,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) if (word_length & 0x01)
word_length++; word_length++;
...@@ -540,13 +540,13 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -540,13 +540,13 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
templong |= templong |=
(*pUsData++ << 16); (*pUsData++ << 16);
outl(templong, outl(templong,
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
} }
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
flags); flags);
break; break;
case REQUEST_VERSION_INFO: case REQUEST_VERSION_INFO:
...@@ -555,8 +555,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -555,8 +555,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
put_request_value(dev, word_length); put_request_value(dev, word_length);
pUsFile = pUsFile =
(u16 *) ((long)pFileStart + (u16 *) ((long)pFileStart +
pFileHdr5-> pFileHdr5->
version_data_offset); version_data_offset);
/* Provide mutual exclusive access while reading ASIC registers. */ /* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, spin_lock_irqsave(&info->dpram_lock,
flags); flags);
...@@ -564,8 +564,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -564,8 +564,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) if (word_length & 0x01)
word_length++; word_length++;
word_length = word_length / 2; word_length = word_length / 2;
...@@ -578,12 +578,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -578,12 +578,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
templong |= templong |=
(temp << 16); (temp << 16);
outl(templong, outl(templong,
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
flags); flags);
break; break;
case REQUEST_CODE_BY_VERSION: case REQUEST_CODE_BY_VERSION:
...@@ -592,14 +592,14 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -592,14 +592,14 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
get_request_value(dev); get_request_value(dev);
pDspImageInfoV6 = pDspImageInfoV6 =
(struct dsp_image_info *) ((long) (struct dsp_image_info *) ((long)
pFileStart pFileStart
+ +
sizeof sizeof
(struct dsp_file_hdr)); (struct dsp_file_hdr));
for (imageN = 0; for (imageN = 0;
imageN < imageN <
pFileHdr5->nDspImages; pFileHdr5->nDspImages;
imageN++) { imageN++) {
temp = (u16) temp = (u16)
(pDspImageInfoV6-> (pDspImageInfoV6->
version); version);
...@@ -610,30 +610,30 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -610,30 +610,30 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
templong |= templong |=
(temp << 16); (temp << 16);
if (templong == if (templong ==
requested_version) { requested_version) {
bGoodVersion = bGoodVersion =
true; true;
pUsFile = pUsFile =
(u16 (u16
*) ((long) *) ((long)
pFileStart pFileStart
+ +
pDspImageInfoV6-> pDspImageInfoV6->
begin_offset); begin_offset);
pUcFile = pUcFile =
(u8 (u8
*) ((long) *) ((long)
pFileStart pFileStart
+ +
pDspImageInfoV6-> pDspImageInfoV6->
begin_offset); begin_offset);
pCodeEnd = pCodeEnd =
(u8 (u8
*) ((long) *) ((long)
pFileStart pFileStart
+ +
pDspImageInfoV6-> pDspImageInfoV6->
end_offset); end_offset);
run_address = run_address =
pDspImageInfoV6-> pDspImageInfoV6->
run_address; run_address;
...@@ -645,10 +645,10 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -645,10 +645,10 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
pDspImageInfoV6-> pDspImageInfoV6->
checksum; checksum;
netdev_dbg(dev, netdev_dbg(dev,
"ft1000_dnld: image_chksum = 0x%8x\n", "ft1000_dnld: image_chksum = 0x%8x\n",
(unsigned (unsigned
int) int)
image_chksum); image_chksum);
break; break;
} }
pDspImageInfoV6++; pDspImageInfoV6++;
...@@ -674,25 +674,25 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -674,25 +674,25 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
break; break;
case STATE_DONE_DWNLD: case STATE_DONE_DWNLD:
if (((unsigned long) (pUcFile) - (unsigned long) pFileStart) >= if (((unsigned long)(pUcFile) - (unsigned long) pFileStart) >=
(unsigned long) FileLength) { (unsigned long)FileLength) {
uiState = STATE_DONE_FILE; uiState = STATE_DONE_FILE;
break; break;
} }
pHdr = (struct pseudo_hdr *) pUsFile; pHdr = (struct pseudo_hdr *)pUsFile;
if (pHdr->portdest == 0x80 /* DspOAM */ if (pHdr->portdest == 0x80 /* DspOAM */
&& (pHdr->portsrc == 0x00 /* Driver */ && (pHdr->portsrc == 0x00 /* Driver */
|| pHdr->portsrc == 0x10 /* FMM */)) { || pHdr->portsrc == 0x10 /* FMM */)) {
uiState = STATE_SECTION_PROV; uiState = STATE_SECTION_PROV;
} else { } else {
netdev_dbg(dev, netdev_dbg(dev,
"FT1000:download:Download error: Bad Port IDs in Pseudo Record\n"); "FT1000:download:Download error: Bad Port IDs in Pseudo Record\n");
netdev_dbg(dev, "\t Port Source = 0x%2.2x\n", netdev_dbg(dev, "\t Port Source = 0x%2.2x\n",
pHdr->portsrc); pHdr->portsrc);
netdev_dbg(dev, "\t Port Destination = 0x%2.2x\n", netdev_dbg(dev, "\t Port Destination = 0x%2.2x\n",
pHdr->portdest); pHdr->portdest);
Status = FAILURE; Status = FAILURE;
} }
...@@ -700,7 +700,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -700,7 +700,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
case STATE_SECTION_PROV: case STATE_SECTION_PROV:
pHdr = (struct pseudo_hdr *) pUcFile; pHdr = (struct pseudo_hdr *)pUcFile;
if (pHdr->checksum == hdr_checksum(pHdr)) { if (pHdr->checksum == hdr_checksum(pHdr)) {
if (pHdr->portdest != 0x80 /* Dsp OAM */) { if (pHdr->portdest != 0x80 /* Dsp OAM */) {
...@@ -715,8 +715,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -715,8 +715,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
GFP_ATOMIC); GFP_ATOMIC);
if (pbuffer) { if (pbuffer) {
memcpy(pbuffer, (void *)pUcFile, memcpy(pbuffer, (void *)pUcFile,
(u32) (usHdrLength + (u32) (usHdrLength +
sizeof(struct pseudo_hdr))); sizeof(struct pseudo_hdr)));
/* link provisioning data */ /* link provisioning data */
pprov_record = pprov_record =
kmalloc(sizeof(struct prov_record), kmalloc(sizeof(struct prov_record),
...@@ -725,15 +725,15 @@ int card_download(struct net_device *dev, const u8 *pFileStart, ...@@ -725,15 +725,15 @@ int card_download(struct net_device *dev, const u8 *pFileStart,
pprov_record->pprov_data = pprov_record->pprov_data =
pbuffer; pbuffer;
list_add_tail(&pprov_record-> list_add_tail(&pprov_record->
list, list,
&info->prov_list); &info->prov_list);
/* Move to next entry if available */ /* Move to next entry if available */
pUcFile = pUcFile =
(u8 *) ((unsigned long) pUcFile + (u8 *)((unsigned long) pUcFile +
(unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr)); (unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr));
if ((unsigned long) (pUcFile) - if ((unsigned long) (pUcFile) -
(unsigned long) (pFileStart) >= (unsigned long) (pFileStart) >=
(unsigned long) FileLength) { (unsigned long)FileLength) {
uiState = uiState =
STATE_DONE_FILE; STATE_DONE_FILE;
} }
......
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 2002 Flarion Technologies, All rights reserved. Copyright (C) 2002 Flarion Technologies, All rights reserved.
Copyright (C) 2006 Patrik Ostrihon, All rights reserved. Copyright (C) 2006 Patrik Ostrihon, All rights reserved.
Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any Software Foundation; either version 2 of the License, or (at your option) any
later version. This program is distributed in the hope that it will be useful, later version. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public more details. You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA. Suite 330, Boston, MA 02111-1307, USA.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -57,7 +57,7 @@ static const struct firmware *fw_entry; ...@@ -57,7 +57,7 @@ static const struct firmware *fw_entry;
static void ft1000_hbchk(u_long data); static void ft1000_hbchk(u_long data);
static struct timer_list poll_timer = { static struct timer_list poll_timer = {
.function = ft1000_hbchk .function = ft1000_hbchk
}; };
static u16 cmdbuffer[1024]; static u16 cmdbuffer[1024];
...@@ -72,7 +72,7 @@ static void ft1000_disable_interrupts(struct net_device *dev); ...@@ -72,7 +72,7 @@ static void ft1000_disable_interrupts(struct net_device *dev);
/* new kernel */ /* new kernel */
MODULE_AUTHOR(""); MODULE_AUTHOR("");
MODULE_DESCRIPTION MODULE_DESCRIPTION
("Support for Flarion Flash OFDM NIC Device. Support for PCMCIA when used with ft1000_cs."); ("Support for Flarion Flash OFDM NIC Device. Support for PCMCIA when used with ft1000_cs.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("FT1000"); MODULE_SUPPORTED_DEVICE("FT1000");
...@@ -80,15 +80,15 @@ MODULE_SUPPORTED_DEVICE("FT1000"); ...@@ -80,15 +80,15 @@ MODULE_SUPPORTED_DEVICE("FT1000");
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_read_fifo_len Function: ft1000_read_fifo_len
Description: This function will read the ASIC Uplink FIFO status register Description: This function will read the ASIC Uplink FIFO status register
which will return the number of bytes remaining in the Uplink FIFO. which will return the number of bytes remaining in the Uplink FIFO.
Sixteen bytes are subtracted to make sure that the ASIC does not Sixteen bytes are subtracted to make sure that the ASIC does not
reach its threshold. reach its threshold.
Input: Input:
dev - network device structure dev - network device structure
Output: Output:
value - number of bytes available in the ASIC Uplink FIFO. value - number of bytes available in the ASIC Uplink FIFO.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static inline u16 ft1000_read_fifo_len(struct net_device *dev) static inline u16 ft1000_read_fifo_len(struct net_device *dev)
...@@ -103,14 +103,14 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev) ...@@ -103,14 +103,14 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_read_dpram Function: ft1000_read_dpram
Description: This function will read the specific area of dpram Description: This function will read the specific area of dpram
(Electrabuzz ASIC only) (Electrabuzz ASIC only)
Input: Input:
dev - device structure dev - device structure
offset - index of dpram offset - index of dpram
Output: Output:
value - value of dpram value - value of dpram
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
u16 ft1000_read_dpram(struct net_device *dev, int offset) u16 ft1000_read_dpram(struct net_device *dev, int offset)
...@@ -130,19 +130,19 @@ u16 ft1000_read_dpram(struct net_device *dev, int offset) ...@@ -130,19 +130,19 @@ u16 ft1000_read_dpram(struct net_device *dev, int offset)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_write_dpram Function: ft1000_write_dpram
Description: This function will write to a specific area of dpram Description: This function will write to a specific area of dpram
(Electrabuzz ASIC only) (Electrabuzz ASIC only)
Input: Input:
dev - device structure dev - device structure
offset - index of dpram offset - index of dpram
value - value to write value - value to write
Output: Output:
none. none.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static inline void ft1000_write_dpram(struct net_device *dev, static inline void ft1000_write_dpram(struct net_device *dev,
int offset, u16 value) int offset, u16 value)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
...@@ -156,14 +156,14 @@ static inline void ft1000_write_dpram(struct net_device *dev, ...@@ -156,14 +156,14 @@ static inline void ft1000_write_dpram(struct net_device *dev,
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_read_dpram_mag_16 Function: ft1000_read_dpram_mag_16
Description: This function will read the specific area of dpram Description: This function will read the specific area of dpram
(Magnemite ASIC only) (Magnemite ASIC only)
Input: Input:
dev - device structure dev - device structure
offset - index of dpram offset - index of dpram
Output: Output:
value - value of dpram value - value of dpram
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
...@@ -188,19 +188,19 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) ...@@ -188,19 +188,19 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_write_dpram_mag_16 Function: ft1000_write_dpram_mag_16
Description: This function will write to a specific area of dpram Description: This function will write to a specific area of dpram
(Magnemite ASIC only) (Magnemite ASIC only)
Input: Input:
dev - device structure dev - device structure
offset - index of dpram offset - index of dpram
value - value to write value - value to write
Output: Output:
none. none.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static inline void ft1000_write_dpram_mag_16(struct net_device *dev, static inline void ft1000_write_dpram_mag_16(struct net_device *dev,
int offset, u16 value, int Index) int offset, u16 value, int Index)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
unsigned long flags; unsigned long flags;
...@@ -218,14 +218,14 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev, ...@@ -218,14 +218,14 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev,
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_read_dpram_mag_32 Function: ft1000_read_dpram_mag_32
Description: This function will read the specific area of dpram Description: This function will read the specific area of dpram
(Magnemite ASIC only) (Magnemite ASIC only)
Input: Input:
dev - device structure dev - device structure
offset - index of dpram offset - index of dpram
Output: Output:
value - value of dpram value - value of dpram
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset) u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset)
...@@ -245,15 +245,15 @@ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset) ...@@ -245,15 +245,15 @@ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_write_dpram_mag_32 Function: ft1000_write_dpram_mag_32
Description: This function will write to a specific area of dpram Description: This function will write to a specific area of dpram
(Magnemite ASIC only) (Magnemite ASIC only)
Input: Input:
dev - device structure dev - device structure
offset - index of dpram offset - index of dpram
value - value to write value - value to write
Output: Output:
none. none.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value) void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value)
...@@ -270,12 +270,12 @@ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value) ...@@ -270,12 +270,12 @@ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_enable_interrupts Function: ft1000_enable_interrupts
Description: This function will enable interrupts base on the current interrupt mask. Description: This function will enable interrupts base on the current interrupt mask.
Input: Input:
dev - device structure dev - device structure
Output: Output:
None. None.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_enable_interrupts(struct net_device *dev) static void ft1000_enable_interrupts(struct net_device *dev)
...@@ -286,18 +286,18 @@ static void ft1000_enable_interrupts(struct net_device *dev) ...@@ -286,18 +286,18 @@ static void ft1000_enable_interrupts(struct net_device *dev)
ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_DEFAULT_MASK); ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_DEFAULT_MASK);
tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK);
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_enable_interrupts:current interrupt enable mask = 0x%x\n", "ft1000_hw:ft1000_enable_interrupts:current interrupt enable mask = 0x%x\n",
tempword); tempword);
} }
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_disable_interrupts Function: ft1000_disable_interrupts
Description: This function will disable all interrupts. Description: This function will disable all interrupts.
Input: Input:
dev - device structure dev - device structure
Output: Output:
None. None.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_disable_interrupts(struct net_device *dev) static void ft1000_disable_interrupts(struct net_device *dev)
...@@ -308,19 +308,19 @@ static void ft1000_disable_interrupts(struct net_device *dev) ...@@ -308,19 +308,19 @@ static void ft1000_disable_interrupts(struct net_device *dev)
ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_MASK_ALL); ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_MASK_ALL);
tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK);
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_disable_interrupts:current interrupt enable mask = 0x%x\n", "ft1000_hw:ft1000_disable_interrupts:current interrupt enable mask = 0x%x\n",
tempword); tempword);
} }
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_reset_asic Function: ft1000_reset_asic
Description: This function will call the Card Service function to reset the Description: This function will call the Card Service function to reset the
ASIC. ASIC.
Input: Input:
dev - device structure dev - device structure
Output: Output:
none none
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_reset_asic(struct net_device *dev) static void ft1000_reset_asic(struct net_device *dev)
...@@ -360,13 +360,13 @@ static void ft1000_reset_asic(struct net_device *dev) ...@@ -360,13 +360,13 @@ static void ft1000_reset_asic(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_reset_card Function: ft1000_reset_card
Description: This function will reset the card Description: This function will reset the card
Input: Input:
dev - device structure dev - device structure
Output: Output:
status - false (card reset fail) status - false (card reset fail)
true (card reset successful) true (card reset successful)
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static int ft1000_reset_card(struct net_device *dev) static int ft1000_reset_card(struct net_device *dev)
...@@ -389,7 +389,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -389,7 +389,7 @@ static int ft1000_reset_card(struct net_device *dev)
/* Make sure we free any memory reserve for provisioning */ /* Make sure we free any memory reserve for provisioning */
while (list_empty(&info->prov_list) == 0) { while (list_empty(&info->prov_list) == 0) {
DEBUG(0, DEBUG(0,
"ft1000_hw:ft1000_reset_card:deleting provisioning record\n"); "ft1000_hw:ft1000_reset_card:deleting provisioning record\n");
ptr = list_entry(info->prov_list.next, struct prov_record, list); ptr = list_entry(info->prov_list.next, struct prov_record, list);
list_del(&ptr->list); list_del(&ptr->list);
kfree(ptr->pprov_data); kfree(ptr->pprov_data);
...@@ -401,7 +401,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -401,7 +401,7 @@ static int ft1000_reset_card(struct net_device *dev)
ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT);
} else { } else {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n"); "ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n");
ft1000_write_reg(dev, FT1000_REG_RESET, ft1000_write_reg(dev, FT1000_REG_RESET,
(DSP_RESET_BIT | ASIC_RESET_BIT)); (DSP_RESET_BIT | ASIC_RESET_BIT));
} }
...@@ -438,7 +438,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -438,7 +438,7 @@ static int ft1000_reset_card(struct net_device *dev)
if (info->AsicID == MAGNEMITE_ID) { if (info->AsicID == MAGNEMITE_ID) {
/* Put dsp in reset and take ASIC out of reset */ /* Put dsp in reset and take ASIC out of reset */
DEBUG(0, DEBUG(0,
"ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n"); "ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n");
ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT);
/* Setting MAGNEMITE ASIC to big endian mode */ /* Setting MAGNEMITE ASIC to big endian mode */
...@@ -465,7 +465,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -465,7 +465,7 @@ static int ft1000_reset_card(struct net_device *dev)
if (i == 50) { if (i == 50) {
DEBUG(0, DEBUG(0,
"ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n"); "ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n");
return false; return false;
} }
...@@ -495,7 +495,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -495,7 +495,7 @@ static int ft1000_reset_card(struct net_device *dev)
ft1000_write_dpram(dev, FT1000_HI_HO, ho); ft1000_write_dpram(dev, FT1000_HI_HO, ho);
tempword = ft1000_read_dpram(dev, FT1000_HI_HO); tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
DEBUG(1, "ft1000_hw:ft1000_reset_asic:hi_ho value = 0x%x\n", DEBUG(1, "ft1000_hw:ft1000_reset_asic:hi_ho value = 0x%x\n",
tempword); tempword);
} else { } else {
/* Initialize DSP heartbeat area to ho */ /* Initialize DSP heartbeat area to ho */
ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, ho_mag, ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, ho_mag,
...@@ -504,7 +504,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -504,7 +504,7 @@ static int ft1000_reset_card(struct net_device *dev)
ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO,
FT1000_MAG_HI_HO_INDX); FT1000_MAG_HI_HO_INDX);
DEBUG(1, "ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", DEBUG(1, "ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n",
tempword); tempword);
} }
info->CardReady = 1; info->CardReady = 1;
...@@ -521,14 +521,14 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -521,14 +521,14 @@ static int ft1000_reset_card(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_chkcard Function: ft1000_chkcard
Description: This function will check if the device is presently available on Description: This function will check if the device is presently available on
the system. the system.
Input: Input:
dev - device structure dev - device structure
Output: Output:
status - false (device is not present) status - false (device is not present)
true (device is present) true (device is present)
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static int ft1000_chkcard(struct net_device *dev) static int ft1000_chkcard(struct net_device *dev)
...@@ -542,7 +542,7 @@ static int ft1000_chkcard(struct net_device *dev) ...@@ -542,7 +542,7 @@ static int ft1000_chkcard(struct net_device *dev)
tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK);
if (tempword == 0) { if (tempword == 0) {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); "ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n");
return false; return false;
} }
/* /*
...@@ -552,7 +552,7 @@ static int ft1000_chkcard(struct net_device *dev) ...@@ -552,7 +552,7 @@ static int ft1000_chkcard(struct net_device *dev)
tempword = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); tempword = ft1000_read_reg(dev, FT1000_REG_ASIC_ID);
if (tempword == 0xffff) { if (tempword == 0xffff) {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); "ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n");
return false; return false;
} }
return true; return true;
...@@ -561,13 +561,13 @@ static int ft1000_chkcard(struct net_device *dev) ...@@ -561,13 +561,13 @@ static int ft1000_chkcard(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_hbchk Function: ft1000_hbchk
Description: This function will perform the heart beat check of the DSP as Description: This function will perform the heart beat check of the DSP as
well as the ASIC. well as the ASIC.
Input: Input:
dev - device structure dev - device structure
Output: Output:
none none
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_hbchk(u_long data) static void ft1000_hbchk(u_long data)
...@@ -586,11 +586,11 @@ static void ft1000_hbchk(u_long data) ...@@ -586,11 +586,11 @@ static void ft1000_hbchk(u_long data)
} else { } else {
tempword = tempword =
ntohs(ft1000_read_dpram_mag_16 ntohs(ft1000_read_dpram_mag_16
(dev, FT1000_MAG_HI_HO, (dev, FT1000_MAG_HI_HO,
FT1000_MAG_HI_HO_INDX)); FT1000_MAG_HI_HO_INDX));
} }
DEBUG(1, "ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n", DEBUG(1, "ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n",
tempword); tempword);
/* Let's perform another check if ho is not detected */ /* Let's perform another check if ho is not detected */
if (tempword != ho) { if (tempword != ho) {
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
...@@ -602,7 +602,7 @@ static void ft1000_hbchk(u_long data) ...@@ -602,7 +602,7 @@ static void ft1000_hbchk(u_long data)
} }
if (tempword != ho) { if (tempword != ho) {
printk(KERN_INFO printk(KERN_INFO
"ft1000: heartbeat failed - no ho detected\n"); "ft1000: heartbeat failed - no ho detected\n");
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
info->DSP_TIME[0] = info->DSP_TIME[0] =
ft1000_read_dpram(dev, FT1000_DSP_TIMER0); ft1000_read_dpram(dev, FT1000_DSP_TIMER0);
...@@ -633,7 +633,7 @@ static void ft1000_hbchk(u_long data) ...@@ -633,7 +633,7 @@ static void ft1000_hbchk(u_long data)
info->DrvErrNum = DSP_HB_INFO; info->DrvErrNum = DSP_HB_INFO;
if (ft1000_reset_card(dev) == 0) { if (ft1000_reset_card(dev) == 0) {
printk(KERN_INFO printk(KERN_INFO
"ft1000: Hardware Failure Detected - PC Card disabled\n"); "ft1000: Hardware Failure Detected - PC Card disabled\n");
info->ProgConStat = 0xff; info->ProgConStat = 0xff;
return; return;
} }
...@@ -651,7 +651,7 @@ static void ft1000_hbchk(u_long data) ...@@ -651,7 +651,7 @@ static void ft1000_hbchk(u_long data)
} }
if (tempword & FT1000_DB_HB) { if (tempword & FT1000_DB_HB) {
printk(KERN_INFO printk(KERN_INFO
"ft1000: heartbeat doorbell not clear by firmware\n"); "ft1000: heartbeat doorbell not clear by firmware\n");
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
info->DSP_TIME[0] = info->DSP_TIME[0] =
ft1000_read_dpram(dev, FT1000_DSP_TIMER0); ft1000_read_dpram(dev, FT1000_DSP_TIMER0);
...@@ -682,7 +682,7 @@ static void ft1000_hbchk(u_long data) ...@@ -682,7 +682,7 @@ static void ft1000_hbchk(u_long data)
info->DrvErrNum = DSP_HB_INFO; info->DrvErrNum = DSP_HB_INFO;
if (ft1000_reset_card(dev) == 0) { if (ft1000_reset_card(dev) == 0) {
printk(KERN_INFO printk(KERN_INFO
"ft1000: Hardware Failure Detected - PC Card disabled\n"); "ft1000: Hardware Failure Detected - PC Card disabled\n");
info->ProgConStat = 0xff; info->ProgConStat = 0xff;
return; return;
} }
...@@ -708,8 +708,8 @@ static void ft1000_hbchk(u_long data) ...@@ -708,8 +708,8 @@ static void ft1000_hbchk(u_long data)
} else { } else {
tempword = tempword =
ntohs(ft1000_read_dpram_mag_16 ntohs(ft1000_read_dpram_mag_16
(dev, FT1000_MAG_HI_HO, (dev, FT1000_MAG_HI_HO,
FT1000_MAG_HI_HO_INDX)); FT1000_MAG_HI_HO_INDX));
} }
/* Let's write hi again if fail */ /* Let's write hi again if fail */
if (tempword != hi) { if (tempword != hi) {
...@@ -731,7 +731,7 @@ static void ft1000_hbchk(u_long data) ...@@ -731,7 +731,7 @@ static void ft1000_hbchk(u_long data)
if (tempword != hi) { if (tempword != hi) {
printk(KERN_INFO printk(KERN_INFO
"ft1000: heartbeat failed - cannot write hi into DPRAM\n"); "ft1000: heartbeat failed - cannot write hi into DPRAM\n");
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
info->DSP_TIME[0] = info->DSP_TIME[0] =
ft1000_read_dpram(dev, FT1000_DSP_TIMER0); ft1000_read_dpram(dev, FT1000_DSP_TIMER0);
...@@ -762,7 +762,7 @@ static void ft1000_hbchk(u_long data) ...@@ -762,7 +762,7 @@ static void ft1000_hbchk(u_long data)
info->DrvErrNum = DSP_HB_INFO; info->DrvErrNum = DSP_HB_INFO;
if (ft1000_reset_card(dev) == 0) { if (ft1000_reset_card(dev) == 0) {
printk(KERN_INFO printk(KERN_INFO
"ft1000: Hardware Failure Detected - PC Card disabled\n"); "ft1000: Hardware Failure Detected - PC Card disabled\n");
info->ProgConStat = 0xff; info->ProgConStat = 0xff;
return; return;
} }
...@@ -778,19 +778,19 @@ static void ft1000_hbchk(u_long data) ...@@ -778,19 +778,19 @@ static void ft1000_hbchk(u_long data)
/* Schedule this module to run every 2 seconds */ /* Schedule this module to run every 2 seconds */
poll_timer.expires = jiffies + (2 * HZ); poll_timer.expires = jiffies + (2 * HZ);
poll_timer.data = (u_long) dev; poll_timer.data = (u_long)dev;
add_timer(&poll_timer); add_timer(&poll_timer);
} }
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_send_cmd Function: ft1000_send_cmd
Description: Description:
Input: Input:
Output: Output:
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qtype) static void ft1000_send_cmd(struct net_device *dev, u16 *ptempbuffer, int size, u16 qtype)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
int i; int i;
...@@ -831,7 +831,7 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -831,7 +831,7 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
/* Write pseudo header and messgae body */ /* Write pseudo header and messgae body */
for (i = 0; i < (size >> 1); i++) { for (i = 0; i < (size >> 1); i++) {
DEBUG(1, "FT1000:ft1000_send_cmd:data %d = 0x%x\n", i, DEBUG(1, "FT1000:ft1000_send_cmd:data %d = 0x%x\n", i,
*ptempbuffer); *ptempbuffer);
tempword = htons(*ptempbuffer++); tempword = htons(*ptempbuffer++);
ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, tempword); ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, tempword);
} }
...@@ -845,13 +845,13 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -845,13 +845,13 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
FT1000_DPRAM_MAG_TX_BASE + 1); FT1000_DPRAM_MAG_TX_BASE + 1);
for (i = 0; i < (size >> 2); i++) { for (i = 0; i < (size >> 2); i++) {
DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n",
*ptempbuffer); *ptempbuffer);
outw(*ptempbuffer++, outw(*ptempbuffer++,
dev->base_addr + FT1000_REG_MAG_DPDATAL); dev->base_addr + FT1000_REG_MAG_DPDATAL);
DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n",
*ptempbuffer); *ptempbuffer);
outw(*ptempbuffer++, outw(*ptempbuffer++,
dev->base_addr + FT1000_REG_MAG_DPDATAH); dev->base_addr + FT1000_REG_MAG_DPDATAH);
} }
DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", *ptempbuffer); DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", *ptempbuffer);
outw(*ptempbuffer++, dev->base_addr + FT1000_REG_MAG_DPDATAL); outw(*ptempbuffer++, dev->base_addr + FT1000_REG_MAG_DPDATAL);
...@@ -866,19 +866,19 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, ...@@ -866,19 +866,19 @@ static void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size,
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_receive_cmd Function: ft1000_receive_cmd
Description: This function will read a message from the dpram area. Description: This function will read a message from the dpram area.
Input: Input:
dev - network device structure dev - network device structure
pbuffer - caller supply address to buffer pbuffer - caller supply address to buffer
pnxtph - pointer to next pseudo header pnxtph - pointer to next pseudo header
Output: Output:
Status = 0 (unsuccessful) Status = 0 (unsuccessful)
= 1 (successful) = 1 (successful)
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
int maxsz, u16 *pnxtph) int maxsz, u16 *pnxtph)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
u16 size; u16 size;
...@@ -888,20 +888,20 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -888,20 +888,20 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
unsigned long flags; unsigned long flags;
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
size = ( ft1000_read_dpram(dev, *pnxtph) ) + sizeof(struct pseudo_hdr); size = (ft1000_read_dpram(dev, *pnxtph)) + sizeof(struct pseudo_hdr);
} else { } else {
size = size =
ntohs(ft1000_read_dpram_mag_16 ntohs(ft1000_read_dpram_mag_16
(dev, FT1000_MAG_PH_LEN, (dev, FT1000_MAG_PH_LEN,
FT1000_MAG_PH_LEN_INDX)) + sizeof(struct pseudo_hdr); FT1000_MAG_PH_LEN_INDX)) + sizeof(struct pseudo_hdr);
} }
if (size > maxsz) { if (size > maxsz) {
DEBUG(1, DEBUG(1,
"FT1000:ft1000_receive_cmd:Invalid command length = %d\n", "FT1000:ft1000_receive_cmd:Invalid command length = %d\n",
size); size);
return false; return false;
} else { } else {
ppseudohdr = (u16 *) pbuffer; ppseudohdr = (u16 *)pbuffer;
spin_lock_irqsave(&info->dpram_lock, flags); spin_lock_irqsave(&info->dpram_lock, flags);
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR,
...@@ -922,11 +922,11 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -922,11 +922,11 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
for (i = 0; i <= (size >> 2); i++) { for (i = 0; i <= (size >> 2); i++) {
*pbuffer = *pbuffer =
inw(dev->base_addr + inw(dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
pbuffer++; pbuffer++;
*pbuffer = *pbuffer =
inw(dev->base_addr + inw(dev->base_addr +
FT1000_REG_MAG_DPDATAH); FT1000_REG_MAG_DPDATAH);
pbuffer++; pbuffer++;
} }
/* copy odd aligned word */ /* copy odd aligned word */
...@@ -954,7 +954,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -954,7 +954,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
} }
if ((tempword != *ppseudohdr)) { if ((tempword != *ppseudohdr)) {
DEBUG(1, DEBUG(1,
"FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n"); "FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n");
/* Drop this message */ /* Drop this message */
return false; return false;
} }
...@@ -964,13 +964,13 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, ...@@ -964,13 +964,13 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer,
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_proc_drvmsg Function: ft1000_proc_drvmsg
Description: This function will process the various driver messages. Description: This function will process the various driver messages.
Input: Input:
dev - device structure dev - device structure
pnxtph - pointer to next pseudo header pnxtph - pointer to next pseudo header
Output: Output:
none none
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_proc_drvmsg(struct net_device *dev) static void ft1000_proc_drvmsg(struct net_device *dev)
...@@ -992,22 +992,22 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -992,22 +992,22 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
u16 wrd; u16 wrd;
} convert; } convert;
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
tempword = FT1000_DPRAM_RX_BASE+2; tempword = FT1000_DPRAM_RX_BASE+2;
} }
else { else {
tempword = FT1000_DPRAM_MAG_RX_BASE; tempword = FT1000_DPRAM_MAG_RX_BASE;
} }
if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) { if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) {
/* Get the message type which is total_len + PSEUDO header + msgtype + message body */ /* Get the message type which is total_len + PSEUDO header + msgtype + message body */
pdrvmsg = (struct drv_msg *) & cmdbuffer[0]; pdrvmsg = (struct drv_msg *)&cmdbuffer[0];
msgtype = ntohs(pdrvmsg->type); msgtype = ntohs(pdrvmsg->type);
DEBUG(1, "Command message type = 0x%x\n", msgtype); DEBUG(1, "Command message type = 0x%x\n", msgtype);
switch (msgtype) { switch (msgtype) {
case DSP_PROVISION: case DSP_PROVISION:
DEBUG(0, DEBUG(0,
"Got a provisioning request message from DSP\n"); "Got a provisioning request message from DSP\n");
mdelay(25); mdelay(25);
while (list_empty(&info->prov_list) == 0) { while (list_empty(&info->prov_list) == 0) {
DEBUG(0, "Sending a provisioning message\n"); DEBUG(0, "Sending a provisioning message\n");
...@@ -1025,25 +1025,25 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1025,25 +1025,25 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
ptr = ptr =
list_entry(info->prov_list.next, list_entry(info->prov_list.next,
struct prov_record, list); struct prov_record, list);
len = *(u16 *) ptr->pprov_data; len = *(u16 *)ptr->pprov_data;
len = htons(len); len = htons(len);
pmsg = (u16 *) ptr->pprov_data; pmsg = (u16 *)ptr->pprov_data;
ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr = (struct pseudo_hdr *)pmsg;
/* Insert slow queue sequence number */ /* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->seq_num = info->squeseqnum++;
ppseudo_hdr->portsrc = 0; ppseudo_hdr->portsrc = 0;
/* Calculate new checksum */ /* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++; ppseudo_hdr->checksum = *pmsg++;
DEBUG(1, "checksum = 0x%x\n", DEBUG(1, "checksum = 0x%x\n",
ppseudo_hdr->checksum); ppseudo_hdr->checksum);
for (i = 1; i < 7; i++) { for (i = 1; i < 7; i++) {
ppseudo_hdr->checksum ^= *pmsg++; ppseudo_hdr->checksum ^= *pmsg++;
DEBUG(1, "checksum = 0x%x\n", DEBUG(1, "checksum = 0x%x\n",
ppseudo_hdr->checksum); ppseudo_hdr->checksum);
} }
ft1000_send_cmd (dev, (u16 *)ptr->pprov_data, len, SLOWQ_TYPE); ft1000_send_cmd(dev, (u16 *)ptr->pprov_data, len, SLOWQ_TYPE);
list_del(&ptr->list); list_del(&ptr->list);
kfree(ptr->pprov_data); kfree(ptr->pprov_data);
kfree(ptr); kfree(ptr);
...@@ -1055,18 +1055,28 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1055,18 +1055,28 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
info->CardReady = 1; info->CardReady = 1;
break; break;
case MEDIA_STATE: case MEDIA_STATE:
pmediamsg = (struct media_msg *) & cmdbuffer[0]; pmediamsg = (struct media_msg *)&cmdbuffer[0];
if (info->ProgConStat != 0xFF) { if (info->ProgConStat != 0xFF) {
if (pmediamsg->state) { if (pmediamsg->state) {
DEBUG(1, "Media is up\n"); DEBUG(1, "Media is up\n");
if (info->mediastate == 0) { if (info->mediastate == 0) {
netif_carrier_on(dev); netif_carrier_on(dev);
netif_wake_queue(dev); netif_wake_queue(dev);
info->mediastate = 1; info->mediastate = 1;
do_gettimeofday(&tv); do_gettimeofday(&tv);
info->ConTm = tv.tv_sec; info->ConTm = tv.tv_sec;
}
} else {
DEBUG(1, "Media is down\n");
if (info->mediastate == 1) {
info->mediastate = 0;
netif_carrier_off(dev);
netif_stop_queue(dev);
info->ConTm = 0;
}
} }
} else { }
else {
DEBUG(1, "Media is down\n"); DEBUG(1, "Media is down\n");
if (info->mediastate == 1) { if (info->mediastate == 1) {
info->mediastate = 0; info->mediastate = 0;
...@@ -1075,25 +1085,15 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1075,25 +1085,15 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
info->ConTm = 0; info->ConTm = 0;
} }
} }
}
else {
DEBUG(1, "Media is down\n");
if (info->mediastate == 1) {
info->mediastate = 0;
netif_carrier_off(dev);
netif_stop_queue(dev);
info->ConTm = 0;
}
}
break; break;
case DSP_INIT_MSG: case DSP_INIT_MSG:
pdspinitmsg = (struct dsp_init_msg *) & cmdbuffer[0]; pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[0];
memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ);
DEBUG(1, "DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", DEBUG(1, "DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n",
info->DspVer[0], info->DspVer[1], info->DspVer[2], info->DspVer[0], info->DspVer[1], info->DspVer[2],
info->DspVer[3]); info->DspVer[3]);
memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, memcpy(info->HwSerNum, pdspinitmsg->HwSerNum,
HWSERNUMSZ); HWSERNUMSZ);
memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ);
memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); memcpy(info->eui64, pdspinitmsg->eui64, EUISZ);
dev->dev_addr[0] = info->eui64[0]; dev->dev_addr[0] = info->eui64[0];
...@@ -1104,28 +1104,28 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1104,28 +1104,28 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
dev->dev_addr[5] = info->eui64[7]; dev->dev_addr[5] = info->eui64[7];
if (ntohs(pdspinitmsg->length) == if (ntohs(pdspinitmsg->length) ==
(sizeof(struct dsp_init_msg) - 20)) { (sizeof(struct dsp_init_msg) - 20)) {
memcpy(info->ProductMode, memcpy(info->ProductMode,
pdspinitmsg->ProductMode, MODESZ); pdspinitmsg->ProductMode, MODESZ);
memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, memcpy(info->RfCalVer, pdspinitmsg->RfCalVer,
CALVERSZ); CALVERSZ);
memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, memcpy(info->RfCalDate, pdspinitmsg->RfCalDate,
CALDATESZ); CALDATESZ);
DEBUG(1, "RFCalVer = 0x%2x 0x%2x\n", DEBUG(1, "RFCalVer = 0x%2x 0x%2x\n",
info->RfCalVer[0], info->RfCalVer[1]); info->RfCalVer[0], info->RfCalVer[1]);
} }
break ; break;
case DSP_STORE_INFO: case DSP_STORE_INFO:
DEBUG(1, "FT1000:drivermsg:Got DSP_STORE_INFO\n"); DEBUG(1, "FT1000:drivermsg:Got DSP_STORE_INFO\n");
tempword = ntohs(pdrvmsg->length); tempword = ntohs(pdrvmsg->length);
info->DSPInfoBlklen = tempword; info->DSPInfoBlklen = tempword;
if (tempword < (MAX_DSP_SESS_REC - 4)) { if (tempword < (MAX_DSP_SESS_REC - 4)) {
pmsg = (u16 *) & pdrvmsg->data[0]; pmsg = (u16 *)&pdrvmsg->data[0];
for (i = 0; i < ((tempword + 1) / 2); i++) { for (i = 0; i < ((tempword + 1) / 2); i++) {
DEBUG(1, DEBUG(1,
"FT1000:drivermsg:dsp info data = 0x%x\n", "FT1000:drivermsg:dsp info data = 0x%x\n",
*pmsg); *pmsg);
info->DSPInfoBlk[i + 10] = *pmsg++; info->DSPInfoBlk[i + 10] = *pmsg++;
} }
} }
...@@ -1152,8 +1152,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1152,8 +1152,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
* Put message into Slow Queue * Put message into Slow Queue
* Form Pseudo header * Form Pseudo header
*/ */
pmsg = (u16 *) info->DSPInfoBlk; pmsg = (u16 *)info->DSPInfoBlk;
ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr = (struct pseudo_hdr *)pmsg;
ppseudo_hdr->length = ppseudo_hdr->length =
htons(info->DSPInfoBlklen + 4); htons(info->DSPInfoBlklen + 4);
ppseudo_hdr->source = 0x10; ppseudo_hdr->source = 0x10;
...@@ -1177,7 +1177,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1177,7 +1177,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
info->DSPInfoBlk[8] = 0x7200; info->DSPInfoBlk[8] = 0x7200;
info->DSPInfoBlk[9] = info->DSPInfoBlk[9] =
htons(info->DSPInfoBlklen); htons(info->DSPInfoBlklen);
ft1000_send_cmd (dev, (u16 *)info->DSPInfoBlk, (u16)(info->DSPInfoBlklen+4), 0); ft1000_send_cmd(dev, (u16 *)info->DSPInfoBlk, (u16)(info->DSPInfoBlklen+4), 0);
} }
break; break;
...@@ -1203,8 +1203,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1203,8 +1203,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
* Put message into Slow Queue * Put message into Slow Queue
* Form Pseudo header * Form Pseudo header
*/ */
pmsg = (u16 *) & tempbuffer[0]; pmsg = (u16 *)&tempbuffer[0];
ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr = (struct pseudo_hdr *)pmsg;
ppseudo_hdr->length = htons(0x0012); ppseudo_hdr->length = htons(0x0012);
ppseudo_hdr->source = 0x10; ppseudo_hdr->source = 0x10;
ppseudo_hdr->destination = 0x20; ppseudo_hdr->destination = 0x20;
...@@ -1220,11 +1220,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1220,11 +1220,11 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
/* Insert application id */ /* Insert application id */
ppseudo_hdr->portsrc = 0; ppseudo_hdr->portsrc = 0;
/* Calculate new checksum */ /* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++; ppseudo_hdr->checksum = *pmsg++;
for (i=1; i<7; i++) { for (i = 1; i < 7; i++) {
ppseudo_hdr->checksum ^= *pmsg++; ppseudo_hdr->checksum ^= *pmsg++;
} }
pmsg = (u16 *) &tempbuffer[16]; pmsg = (u16 *)&tempbuffer[16];
*pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
*pmsg++ = htons(0x000e); *pmsg++ = htons(0x000e);
*pmsg++ = htons(info->DSP_TIME[0]); *pmsg++ = htons(info->DSP_TIME[0]);
...@@ -1239,7 +1239,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1239,7 +1239,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
*pmsg++ = convert.wrd; *pmsg++ = convert.wrd;
*pmsg++ = htons(info->DrvErrNum); *pmsg++ = htons(info->DrvErrNum);
ft1000_send_cmd (dev, (u16 *)&tempbuffer[0], (u16)(0x0012), 0); ft1000_send_cmd(dev, (u16 *)&tempbuffer[0], (u16)(0x0012), 0);
info->DrvErrNum = 0; info->DrvErrNum = 0;
} }
...@@ -1252,14 +1252,14 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ...@@ -1252,14 +1252,14 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_parse_dpram_msg Function: ft1000_parse_dpram_msg
Description: This function will parse the message received from the DSP Description: This function will parse the message received from the DSP
via the DPRAM interface. via the DPRAM interface.
Input: Input:
dev - device structure dev - device structure
Output: Output:
status - FAILURE status - FAILURE
SUCCESS SUCCESS
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static int ft1000_parse_dpram_msg(struct net_device *dev) static int ft1000_parse_dpram_msg(struct net_device *dev)
...@@ -1290,7 +1290,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1290,7 +1290,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
FT1000_DPRAM_MAG_RX_BASE); FT1000_DPRAM_MAG_RX_BASE);
for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) { for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) {
outl(info->DSPSess.MagRec[i], outl(info->DSPSess.MagRec[i],
dev->base_addr + FT1000_REG_MAG_DPDATA); dev->base_addr + FT1000_REG_MAG_DPDATA);
} }
} }
spin_unlock_irqrestore(&info->dpram_lock, flags); spin_unlock_irqrestore(&info->dpram_lock, flags);
...@@ -1311,7 +1311,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1311,7 +1311,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
if (doorbell & FT1000_DSP_ASIC_RESET) { if (doorbell & FT1000_DSP_ASIC_RESET) {
DEBUG(0, DEBUG(0,
"FT1000:ft1000_parse_dpram_msg: Got a dsp ASIC reset message\n"); "FT1000:ft1000_parse_dpram_msg: Got a dsp ASIC reset message\n");
ft1000_write_reg(dev, FT1000_REG_DOORBELL, ft1000_write_reg(dev, FT1000_REG_DOORBELL,
FT1000_DSP_ASIC_RESET); FT1000_DSP_ASIC_RESET);
udelay(200); udelay(200);
...@@ -1320,7 +1320,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1320,7 +1320,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
if (doorbell & FT1000_DB_DPRAM_RX) { if (doorbell & FT1000_DB_DPRAM_RX) {
DEBUG(1, DEBUG(1,
"FT1000:ft1000_parse_dpram_msg: Got a slow queue message\n"); "FT1000:ft1000_parse_dpram_msg: Got a slow queue message\n");
nxtph = FT1000_DPRAM_RX_BASE + 2; nxtph = FT1000_DPRAM_RX_BASE + 2;
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
total_len = total_len =
...@@ -1328,13 +1328,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1328,13 +1328,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
} else { } else {
total_len = total_len =
ntohs(ft1000_read_dpram_mag_16 ntohs(ft1000_read_dpram_mag_16
(dev, FT1000_MAG_TOTAL_LEN, (dev, FT1000_MAG_TOTAL_LEN,
FT1000_MAG_TOTAL_LEN_INDX)); FT1000_MAG_TOTAL_LEN_INDX));
} }
DEBUG(1, "FT1000:ft1000_parse_dpram_msg:total length = %d\n", DEBUG(1, "FT1000:ft1000_parse_dpram_msg:total length = %d\n",
total_len); total_len);
if ((total_len < MAX_CMD_SQSIZE) && (total_len > sizeof(struct pseudo_hdr))) { if ((total_len < MAX_CMD_SQSIZE) && (total_len > sizeof(struct pseudo_hdr))) {
total_len += nxtph; total_len += nxtph;
/* /*
* ft1000_read_reg will return a value that needs to be byteswap * ft1000_read_reg will return a value that needs to be byteswap
* in order to get DSP_QID_OFFSET. * in order to get DSP_QID_OFFSET.
...@@ -1395,7 +1395,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1395,7 +1395,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
/* let's clear any unexpected doorbells from DSP */ /* let's clear any unexpected doorbells from DSP */
doorbell = doorbell =
doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ | doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ |
FT1000_DB_COND_RESET | 0xff00); FT1000_DB_COND_RESET | 0xff00);
if (doorbell) { if (doorbell) {
DEBUG(1, "Clearing unexpected doorbell = 0x%x\n", doorbell); DEBUG(1, "Clearing unexpected doorbell = 0x%x\n", doorbell);
ft1000_write_reg(dev, FT1000_REG_DOORBELL, doorbell); ft1000_write_reg(dev, FT1000_REG_DOORBELL, doorbell);
...@@ -1407,14 +1407,14 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1407,14 +1407,14 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_flush_fifo Function: ft1000_flush_fifo
Description: This function will flush one packet from the downlink Description: This function will flush one packet from the downlink
FIFO. FIFO.
Input: Input:
dev - device structure dev - device structure
drv_err - driver error causing the flush fifo drv_err - driver error causing the flush fifo
Output: Output:
None. None.
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
...@@ -1512,7 +1512,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1512,7 +1512,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
*/ */
tempword = tempword =
inw(dev->base_addr + inw(dev->base_addr +
FT1000_REG_SUP_IMASK); FT1000_REG_SUP_IMASK);
if (tempword == 0) { if (tempword == 0) {
/* This indicates that we can not communicate with the ASIC */ /* This indicates that we can not communicate with the ASIC */
info->DrvErrNum = info->DrvErrNum =
...@@ -1557,15 +1557,15 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1557,15 +1557,15 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_copy_up_pkt Function: ft1000_copy_up_pkt
Description: This function will pull Flarion packets out of the Downlink Description: This function will pull Flarion packets out of the Downlink
FIFO and convert it to an ethernet packet. The ethernet packet will FIFO and convert it to an ethernet packet. The ethernet packet will
then be deliver to the TCP/IP stack. then be deliver to the TCP/IP stack.
Input: Input:
dev - device structure dev - device structure
Output: Output:
status - FAILURE status - FAILURE
SUCCESS SUCCESS
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static int ft1000_copy_up_pkt(struct net_device *dev) static int ft1000_copy_up_pkt(struct net_device *dev)
...@@ -1616,7 +1616,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1616,7 +1616,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
info->stats.rx_errors++; info->stats.rx_errors++;
return FAILURE; return FAILURE;
} }
pbuffer = (u8 *) skb_put(skb, len + 12); pbuffer = (u8 *)skb_put(skb, len + 12);
/* Pseudo header */ /* Pseudo header */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
...@@ -1658,7 +1658,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1658,7 +1658,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
if (chksum != tempword) { if (chksum != tempword) {
DEBUG(0, "Packet checksum mismatch 0x%x 0x%x\n", chksum, DEBUG(0, "Packet checksum mismatch 0x%x 0x%x\n", chksum,
tempword); tempword);
ft1000_flush_fifo(dev, DSP_PKTPHCKSUM_INFO); ft1000_flush_fifo(dev, DSP_PKTPHCKSUM_INFO);
info->stats.rx_errors++; info->stats.rx_errors++;
kfree_skb(skb); kfree_skb(skb);
...@@ -1685,7 +1685,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1685,7 +1685,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
for (i = 0; i < len / 2; i++) { for (i = 0; i < len / 2; i++) {
tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO);
*pbuffer++ = (u8) (tempword >> 8); *pbuffer++ = (u8) (tempword >> 8);
*pbuffer++ = (u8) tempword; *pbuffer++ = (u8)tempword;
if (ft1000_chkcard(dev) == false) { if (ft1000_chkcard(dev) == false) {
kfree_skb(skb); kfree_skb(skb);
return FAILURE; return FAILURE;
...@@ -1698,7 +1698,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1698,7 +1698,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
*pbuffer++ = (u8) (tempword >> 8); *pbuffer++ = (u8) (tempword >> 8);
} }
} else { } else {
ptemplong = (u32 *) pbuffer; ptemplong = (u32 *)pbuffer;
for (i = 0; i < len / 4; i++) { for (i = 0; i < len / 4; i++) {
templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); templong = inl(dev->base_addr + FT1000_REG_MAG_DFR);
DEBUG(1, "Data = 0x%8x\n", templong); DEBUG(1, "Data = 0x%8x\n", templong);
...@@ -1743,17 +1743,17 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1743,17 +1743,17 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Function: ft1000_copy_down_pkt Function: ft1000_copy_down_pkt
Description: This function will take an ethernet packet and convert it to Description: This function will take an ethernet packet and convert it to
a Flarion packet prior to sending it to the ASIC Downlink a Flarion packet prior to sending it to the ASIC Downlink
FIFO. FIFO.
Input: Input:
dev - device structure dev - device structure
packet - address of ethernet packet packet - address of ethernet packet
len - length of IP packet len - length of IP packet
Output: Output:
status - FAILURE status - FAILURE
SUCCESS SUCCESS
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len)
...@@ -1790,7 +1790,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) ...@@ -1790,7 +1790,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len)
} }
if (len > ft1000_read_fifo_len(dev)) { if (len > ft1000_read_fifo_len(dev)) {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n"); "ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n");
info->stats.tx_errors++; info->stats.tx_errors++;
return SUCCESS; return SUCCESS;
} }
...@@ -1822,38 +1822,38 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) ...@@ -1822,38 +1822,38 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len)
/* copy first word to UFIFO_BEG reg */ /* copy first word to UFIFO_BEG reg */
ft1000_write_reg(dev, FT1000_REG_UFIFO_BEG, pseudo.buff[0]); ft1000_write_reg(dev, FT1000_REG_UFIFO_BEG, pseudo.buff[0]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 0 BEG = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 0 BEG = 0x%04x\n",
pseudo.buff[0]); pseudo.buff[0]);
/* copy subsequent words to UFIFO_MID reg */ /* copy subsequent words to UFIFO_MID reg */
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[1]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[1]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 1 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 1 MID = 0x%04x\n",
pseudo.buff[1]); pseudo.buff[1]);
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[2]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[2]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 2 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 2 MID = 0x%04x\n",
pseudo.buff[2]); pseudo.buff[2]);
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[3]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[3]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 3 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 3 MID = 0x%04x\n",
pseudo.buff[3]); pseudo.buff[3]);
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[4]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[4]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 4 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 4 MID = 0x%04x\n",
pseudo.buff[4]); pseudo.buff[4]);
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[5]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[5]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 5 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 5 MID = 0x%04x\n",
pseudo.buff[5]); pseudo.buff[5]);
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[6]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[6]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 6 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 6 MID = 0x%04x\n",
pseudo.buff[6]); pseudo.buff[6]);
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[7]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[7]);
DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 7 MID = 0x%04x\n", DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 7 MID = 0x%04x\n",
pseudo.buff[7]); pseudo.buff[7]);
/* Write PPP type + IP Packet into Downlink FIFO */ /* Write PPP type + IP Packet into Downlink FIFO */
for (i = 0; i < (len >> 1) - 1; i++) { for (i = 0; i < (len >> 1) - 1; i++) {
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, ft1000_write_reg(dev, FT1000_REG_UFIFO_MID,
htons(*packet)); htons(*packet));
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n",
i + 8, htons(*packet)); i + 8, htons(*packet));
packet++; packet++;
} }
...@@ -1862,40 +1862,40 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) ...@@ -1862,40 +1862,40 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len)
ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, ft1000_write_reg(dev, FT1000_REG_UFIFO_MID,
htons(*packet)); htons(*packet));
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:data MID = 0x%04x\n", "ft1000_hw:ft1000_copy_down_pkt:data MID = 0x%04x\n",
htons(*packet)); htons(*packet));
packet++; packet++;
ft1000_write_reg(dev, FT1000_REG_UFIFO_END, ft1000_write_reg(dev, FT1000_REG_UFIFO_END,
htons(*packet)); htons(*packet));
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n",
i + 8, htons(*packet)); i + 8, htons(*packet));
} else { } else {
ft1000_write_reg(dev, FT1000_REG_UFIFO_END, ft1000_write_reg(dev, FT1000_REG_UFIFO_END,
htons(*packet)); htons(*packet));
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n",
i + 8, htons(*packet)); i + 8, htons(*packet));
} }
} else { } else {
outl(*(u32 *) & pseudo.buff[0], outl(*(u32 *)&pseudo.buff[0],
dev->base_addr + FT1000_REG_MAG_UFDR); dev->base_addr + FT1000_REG_MAG_UFDR);
DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n",
*(u32 *) & pseudo.buff[0]); *(u32 *)&pseudo.buff[0]);
outl(*(u32 *) & pseudo.buff[2], outl(*(u32 *)&pseudo.buff[2],
dev->base_addr + FT1000_REG_MAG_UFDR); dev->base_addr + FT1000_REG_MAG_UFDR);
DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n",
*(u32 *) & pseudo.buff[2]); *(u32 *)&pseudo.buff[2]);
outl(*(u32 *) & pseudo.buff[4], outl(*(u32 *)&pseudo.buff[4],
dev->base_addr + FT1000_REG_MAG_UFDR); dev->base_addr + FT1000_REG_MAG_UFDR);
DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n",
*(u32 *) & pseudo.buff[4]); *(u32 *)&pseudo.buff[4]);
outl(*(u32 *) & pseudo.buff[6], outl(*(u32 *)&pseudo.buff[6],
dev->base_addr + FT1000_REG_MAG_UFDR); dev->base_addr + FT1000_REG_MAG_UFDR);
DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n",
*(u32 *) & pseudo.buff[6]); *(u32 *)&pseudo.buff[6]);
plong = (u32 *) packet; plong = (u32 *)packet;
/* Write PPP type + IP Packet into Downlink FIFO */ /* 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); outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR);
...@@ -1904,8 +1904,8 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) ...@@ -1904,8 +1904,8 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len)
/* Check for odd alignment */ /* Check for odd alignment */
if (len & 0x0003) { if (len & 0x0003) {
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n", "ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n",
*plong); *plong);
outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR);
} }
outl(1, dev->base_addr + FT1000_REG_MAG_UFER); outl(1, dev->base_addr + FT1000_REG_MAG_UFER);
...@@ -1935,7 +1935,7 @@ static int ft1000_open(struct net_device *dev) ...@@ -1935,7 +1935,7 @@ static int ft1000_open(struct net_device *dev)
/* schedule ft1000_hbchk to perform periodic heartbeat checks on DSP and ASIC */ /* schedule ft1000_hbchk to perform periodic heartbeat checks on DSP and ASIC */
init_timer(&poll_timer); init_timer(&poll_timer);
poll_timer.expires = jiffies + (2 * HZ); poll_timer.expires = jiffies + (2 * HZ);
poll_timer.data = (u_long) dev; poll_timer.data = (u_long)dev;
add_timer(&poll_timer); add_timer(&poll_timer);
DEBUG(0, "ft1000_hw: ft1000_open is ended2\n"); DEBUG(0, "ft1000_hw: ft1000_open is ended2\n");
...@@ -1976,9 +1976,9 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1976,9 +1976,9 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
DEBUG(1, "ft1000_hw: ft1000_start_xmit:length of packet = %d\n", DEBUG(1, "ft1000_hw: ft1000_start_xmit:length of packet = %d\n",
skb->len); skb->len);
pdata = (u8 *) skb->data; pdata = (u8 *)skb->data;
if (info->mediastate == 0) { if (info->mediastate == 0) {
/* Drop packet is mediastate is down */ /* Drop packet is mediastate is down */
...@@ -1989,11 +1989,11 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1989,11 +1989,11 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
if ((skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE)) { if ((skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE)) {
/* Drop packet which has invalid size */ /* Drop packet which has invalid size */
DEBUG(1, DEBUG(1,
"ft1000_hw:ft1000_copy_down_pkt:invalid ethernet length\n"); "ft1000_hw:ft1000_copy_down_pkt:invalid ethernet length\n");
return SUCCESS; return SUCCESS;
} }
ft1000_copy_down_pkt(dev, (u16 *) (pdata + ENET_HEADER_SIZE - 2), ft1000_copy_down_pkt(dev, (u16 *) (pdata + ENET_HEADER_SIZE - 2),
skb->len - ENET_HEADER_SIZE + 2); skb->len - ENET_HEADER_SIZE + 2);
dev_kfree_skb(skb); dev_kfree_skb(skb);
...@@ -2038,12 +2038,12 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ...@@ -2038,12 +2038,12 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
/* Check if we have packets in the Downlink FIFO */ /* Check if we have packets in the Downlink FIFO */
if (info->AsicID == ELECTRABUZZ_ID) { if (info->AsicID == ELECTRABUZZ_ID) {
tempword = tempword =
ft1000_read_reg(dev, ft1000_read_reg(dev,
FT1000_REG_DFIFO_STAT); FT1000_REG_DFIFO_STAT);
} else { } else {
tempword = tempword =
ft1000_read_reg(dev, ft1000_read_reg(dev,
FT1000_REG_MAG_DFSR); FT1000_REG_MAG_DFSR);
} }
if (tempword & 0x1f) { if (tempword & 0x1f) {
ft1000_copy_up_pkt(dev); ft1000_copy_up_pkt(dev);
...@@ -2060,7 +2060,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ...@@ -2060,7 +2060,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword);
/* Read interrupt type */ /* Read interrupt type */
inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR); inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR);
DEBUG(1, "ft1000_hw: interrupt status register after clear = 0x%x\n", inttype); DEBUG(1, "ft1000_hw: interrupt status register after clear = 0x%x\n", inttype);
} }
ft1000_enable_interrupts(dev); ft1000_enable_interrupts(dev);
...@@ -2103,7 +2103,7 @@ void stop_ft1000_card(struct net_device *dev) ...@@ -2103,7 +2103,7 @@ void stop_ft1000_card(struct net_device *dev)
} }
static void ft1000_get_drvinfo(struct net_device *dev, static void ft1000_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct ft1000_info *ft_info; struct ft1000_info *ft_info;
ft_info = netdev_priv(dev); ft_info = netdev_priv(dev);
...@@ -2129,19 +2129,19 @@ static const struct ethtool_ops ops = { ...@@ -2129,19 +2129,19 @@ static const struct ethtool_ops ops = {
}; };
struct net_device *init_ft1000_card(struct pcmcia_device *link, struct net_device *init_ft1000_card(struct pcmcia_device *link,
void *ft1000_reset) void *ft1000_reset)
{ {
struct ft1000_info *info; struct ft1000_info *info;
struct ft1000_pcmcia *pcmcia; struct ft1000_pcmcia *pcmcia;
struct net_device *dev; struct net_device *dev;
static const struct net_device_ops ft1000ops = /* Slavius 21.10.2009 due to kernel changes */ static const struct net_device_ops ft1000ops = /* Slavius 21.10.2009 due to kernel changes */
{ {
.ndo_open = &ft1000_open, .ndo_open = &ft1000_open,
.ndo_stop = &ft1000_close, .ndo_stop = &ft1000_close,
.ndo_start_xmit = &ft1000_start_xmit, .ndo_start_xmit = &ft1000_start_xmit,
.ndo_get_stats = &ft1000_stats, .ndo_get_stats = &ft1000_stats,
}; };
DEBUG(1, "ft1000_hw: init_ft1000_card()\n"); DEBUG(1, "ft1000_hw: init_ft1000_card()\n");
DEBUG(1, "ft1000_hw: irq = %d\n", link->irq); DEBUG(1, "ft1000_hw: irq = %d\n", link->irq);
...@@ -2153,7 +2153,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2153,7 +2153,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,
flarion_ft1000_cnt--; flarion_ft1000_cnt--;
dev_info(&link->dev, dev_info(&link->dev,
"This driver can not support more than one instance\n"); "This driver can not support more than one instance\n");
return NULL; return NULL;
} }
...@@ -2168,8 +2168,8 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2168,8 +2168,8 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,
memset(info, 0, sizeof(struct ft1000_info)); memset(info, 0, sizeof(struct ft1000_info));
DEBUG(1, "address of dev = 0x%8x\n", (u32) dev); DEBUG(1, "address of dev = 0x%8x\n", (u32)dev);
DEBUG(1, "address of dev info = 0x%8x\n", (u32) info); DEBUG(1, "address of dev info = 0x%8x\n", (u32)info);
DEBUG(0, "device name = %s\n", dev->name); DEBUG(0, "device name = %s\n", dev->name);
memset(&info->stats, 0, sizeof(struct net_device_stats)); memset(&info->stats, 0, sizeof(struct net_device_stats));
...@@ -2246,7 +2246,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2246,7 +2246,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,
ft1000_card_present = 1; ft1000_card_present = 1;
dev->ethtool_ops = &ops; dev->ethtool_ops = &ops;
printk(KERN_INFO "ft1000: %s: addr 0x%04lx irq %d, MAC addr %pM\n", printk(KERN_INFO "ft1000: %s: addr 0x%04lx irq %d, MAC addr %pM\n",
dev->name, dev->base_addr, dev->irq, dev->dev_addr); dev->name, dev->base_addr, dev->irq, dev->dev_addr);
return dev; return dev;
err_unreg: err_unreg:
......
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* FT1000 driver for Flarion Flash OFDM NIC Device * FT1000 driver for Flarion Flash OFDM NIC Device
* *
* Copyright (C) 2006 Flarion Technologies, All rights reserved. * Copyright (C) 2006 Flarion Technologies, All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any * Software Foundation; either version 2 of the License, or (at your option) any
* later version. This program is distributed in the hope that it will be useful, * later version. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. You should have received a copy of the GNU General Public * more details. You should have received a copy of the GNU General Public
* License along with this program; if not, write to the * License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - * Free Software Foundation, Inc., 59 Temple Place -
* Suite 330, Boston, MA 02111-1307, USA. * Suite 330, Boston, MA 02111-1307, USA.
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* *
* File: ft1000_chdev.c * File: ft1000_chdev.c
* *
* Description: Custom character device dispatch routines. * Description: Custom character device dispatch routines.
* *
* History: * History:
* 8/29/02 Whc Ported to Linux. * 8/29/02 Whc Ported to Linux.
* 6/05/06 Whc Porting to Linux 2.6.9 * 6/05/06 Whc Porting to Linux 2.6.9
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -43,7 +43,7 @@ static int ft1000_flarion_cnt; ...@@ -43,7 +43,7 @@ static int ft1000_flarion_cnt;
static int ft1000_open(struct inode *inode, struct file *file); static int ft1000_open(struct inode *inode, struct file *file);
static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait); static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait);
static long ft1000_ioctl(struct file *file, unsigned int command, static long ft1000_ioctl(struct file *file, unsigned int command,
unsigned long argument); unsigned long argument);
static int ft1000_release(struct inode *inode, struct file *file); static int ft1000_release(struct inode *inode, struct file *file);
/* List to free receive command buffer pool */ /* List to free receive command buffer pool */
...@@ -55,8 +55,8 @@ spinlock_t free_buff_lock; ...@@ -55,8 +55,8 @@ spinlock_t free_buff_lock;
int numofmsgbuf = 0; int numofmsgbuf = 0;
/* /*
* Table of entry-point routines for char device * Table of entry-point routines for char device
*/ */
static const struct file_operations ft1000fops = { static const struct file_operations ft1000fops = {
.unlocked_ioctl = ft1000_ioctl, .unlocked_ioctl = ft1000_ioctl,
.poll = ft1000_poll_dev, .poll = ft1000_poll_dev,
...@@ -66,104 +66,104 @@ static const struct file_operations ft1000fops = { ...@@ -66,104 +66,104 @@ static const struct file_operations ft1000fops = {
}; };
/* /*
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
* Function: ft1000_get_buffer * Function: ft1000_get_buffer
* *
* Parameters: * Parameters:
* *
* Returns: * Returns:
* *
* Description: * Description:
* *
* Notes: * Notes:
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist) struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
{ {
unsigned long flags; unsigned long flags;
struct dpram_blk *ptr; struct dpram_blk *ptr;
spin_lock_irqsave(&free_buff_lock, flags); spin_lock_irqsave(&free_buff_lock, flags);
/* Check if buffer is available */ /* Check if buffer is available */
if (list_empty(bufflist)) { if (list_empty(bufflist)) {
DEBUG("ft1000_get_buffer: No more buffer - %d\n", numofmsgbuf); DEBUG("ft1000_get_buffer: No more buffer - %d\n", numofmsgbuf);
ptr = NULL; ptr = NULL;
} else { } else {
numofmsgbuf--; numofmsgbuf--;
ptr = list_entry(bufflist->next, struct dpram_blk, list); ptr = list_entry(bufflist->next, struct dpram_blk, list);
list_del(&ptr->list); list_del(&ptr->list);
/* DEBUG("ft1000_get_buffer: number of free msg buffers = %d\n", numofmsgbuf); */ /* DEBUG("ft1000_get_buffer: number of free msg buffers = %d\n", numofmsgbuf); */
} }
spin_unlock_irqrestore(&free_buff_lock, flags); spin_unlock_irqrestore(&free_buff_lock, flags);
return ptr; return ptr;
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_free_buffer * Function: ft1000_free_buffer
* *
* Parameters: * Parameters:
* *
* Returns: * Returns:
* *
* Description: * Description:
* *
* Notes: * Notes:
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist) void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&free_buff_lock, flags); spin_lock_irqsave(&free_buff_lock, flags);
/* Put memory back to list */ /* Put memory back to list */
list_add_tail(&pdpram_blk->list, plist); list_add_tail(&pdpram_blk->list, plist);
numofmsgbuf++; numofmsgbuf++;
/*DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n", numofmsgbuf); */ /*DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n", numofmsgbuf); */
spin_unlock_irqrestore(&free_buff_lock, flags); spin_unlock_irqrestore(&free_buff_lock, flags);
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_CreateDevice * Function: ft1000_CreateDevice
* *
* Parameters: dev - pointer to adapter object * Parameters: dev - pointer to adapter object
* *
* Returns: 0 if successful * Returns: 0 if successful
* *
* Description: Creates a private char device. * Description: Creates a private char device.
* *
* Notes: Only called by init_module(). * Notes: Only called by init_module().
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
int ft1000_create_dev(struct ft1000_usb *dev) int ft1000_create_dev(struct ft1000_usb *dev)
{ {
int result; int result;
int i; int i;
struct dentry *dir, *file; struct dentry *dir, *file;
struct ft1000_debug_dirs *tmp; struct ft1000_debug_dirs *tmp;
/* make a new device name */ /* make a new device name */
sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber); sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt); DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
DEBUG("DeviceCreated = %x\n", dev->DeviceCreated); DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
if (dev->DeviceCreated) { if (dev->DeviceCreated) {
DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName); DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
return -EIO; return -EIO;
} }
/* register the device */ /* register the device */
DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName); DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName);
tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL); tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL);
if (tmp == NULL) { if (tmp == NULL) {
...@@ -178,7 +178,7 @@ int ft1000_create_dev(struct ft1000_usb *dev) ...@@ -178,7 +178,7 @@ int ft1000_create_dev(struct ft1000_usb *dev)
} }
file = debugfs_create_file("device", S_IRUGO | S_IWUSR, dir, file = debugfs_create_file("device", S_IRUGO | S_IWUSR, dir,
dev, &ft1000fops); dev, &ft1000fops);
if (IS_ERR(file)) { if (IS_ERR(file)) {
result = PTR_ERR(file); result = PTR_ERR(file);
goto debug_file_fail; goto debug_file_fail;
...@@ -189,25 +189,25 @@ int ft1000_create_dev(struct ft1000_usb *dev) ...@@ -189,25 +189,25 @@ int ft1000_create_dev(struct ft1000_usb *dev)
tmp->int_number = dev->CardNumber; tmp->int_number = dev->CardNumber;
list_add(&(tmp->list), &(dev->nodes.list)); list_add(&(tmp->list), &(dev->nodes.list));
DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName); DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName);
/* initialize application information */ /* initialize application information */
dev->appcnt = 0; dev->appcnt = 0;
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
dev->app_info[i].nTxMsg = 0; dev->app_info[i].nTxMsg = 0;
dev->app_info[i].nRxMsg = 0; dev->app_info[i].nRxMsg = 0;
dev->app_info[i].nTxMsgReject = 0; dev->app_info[i].nTxMsgReject = 0;
dev->app_info[i].nRxMsgMiss = 0; dev->app_info[i].nRxMsgMiss = 0;
dev->app_info[i].fileobject = NULL; dev->app_info[i].fileobject = NULL;
dev->app_info[i].app_id = i+1; dev->app_info[i].app_id = i+1;
dev->app_info[i].DspBCMsgFlag = 0; dev->app_info[i].DspBCMsgFlag = 0;
dev->app_info[i].NumOfMsg = 0; dev->app_info[i].NumOfMsg = 0;
init_waitqueue_head(&dev->app_info[i].wait_dpram_msg); init_waitqueue_head(&dev->app_info[i].wait_dpram_msg);
INIT_LIST_HEAD(&dev->app_info[i].app_sqlist); INIT_LIST_HEAD(&dev->app_info[i].app_sqlist);
} }
dev->DeviceCreated = TRUE; dev->DeviceCreated = TRUE;
ft1000_flarion_cnt++; ft1000_flarion_cnt++;
return 0; return 0;
...@@ -220,33 +220,33 @@ int ft1000_create_dev(struct ft1000_usb *dev) ...@@ -220,33 +220,33 @@ int ft1000_create_dev(struct ft1000_usb *dev)
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_DestroyDeviceDEBUG * Function: ft1000_DestroyDeviceDEBUG
* *
* Parameters: dev - pointer to adapter object * Parameters: dev - pointer to adapter object
* *
* Description: Destroys a private char device. * Description: Destroys a private char device.
* *
* Notes: Only called by cleanup_module(). * Notes: Only called by cleanup_module().
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
void ft1000_destroy_dev(struct net_device *netdev) void ft1000_destroy_dev(struct net_device *netdev)
{ {
struct ft1000_info *info = netdev_priv(netdev); struct ft1000_info *info = netdev_priv(netdev);
struct ft1000_usb *dev = info->priv; struct ft1000_usb *dev = info->priv;
int i; int i;
struct dpram_blk *pdpram_blk; struct dpram_blk *pdpram_blk;
struct dpram_blk *ptr; struct dpram_blk *ptr;
struct list_head *pos, *q; struct list_head *pos, *q;
struct ft1000_debug_dirs *dir; struct ft1000_debug_dirs *dir;
DEBUG("%s called\n", __func__); DEBUG("%s called\n", __func__);
if (dev->DeviceCreated) { if (dev->DeviceCreated) {
ft1000_flarion_cnt--; ft1000_flarion_cnt--;
list_for_each_safe(pos, q, &dev->nodes.list) { list_for_each_safe(pos, q, &dev->nodes.list) {
dir = list_entry(pos, struct ft1000_debug_dirs, list); dir = list_entry(pos, struct ft1000_debug_dirs, list);
if (dir->int_number == dev->CardNumber) { if (dir->int_number == dev->CardNumber) {
...@@ -257,28 +257,28 @@ void ft1000_destroy_dev(struct net_device *netdev) ...@@ -257,28 +257,28 @@ void ft1000_destroy_dev(struct net_device *netdev)
} }
} }
DEBUG("%s: unregistered device \"%s\"\n", __func__, DEBUG("%s: unregistered device \"%s\"\n", __func__,
dev->DeviceName); dev->DeviceName);
/* Make sure we free any memory reserve for slow Queue */ /* Make sure we free any memory reserve for slow Queue */
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
while (list_empty(&dev->app_info[i].app_sqlist) == 0) { while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list); pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
list_del(&pdpram_blk->list); list_del(&pdpram_blk->list);
ft1000_free_buffer(pdpram_blk, &freercvpool); ft1000_free_buffer(pdpram_blk, &freercvpool);
} }
wake_up_interruptible(&dev->app_info[i].wait_dpram_msg); wake_up_interruptible(&dev->app_info[i].wait_dpram_msg);
} }
/* Remove buffer allocated for receive command data */ /* Remove buffer allocated for receive command data */
if (ft1000_flarion_cnt == 0) { if (ft1000_flarion_cnt == 0) {
while (list_empty(&freercvpool) == 0) { while (list_empty(&freercvpool) == 0) {
ptr = list_entry(freercvpool.next, struct dpram_blk, list); ptr = list_entry(freercvpool.next, struct dpram_blk, list);
list_del(&ptr->list); list_del(&ptr->list);
kfree(ptr->pbuffer); kfree(ptr->pbuffer);
kfree(ptr); kfree(ptr);
} }
} }
dev->DeviceCreated = FALSE; dev->DeviceCreated = FALSE;
} }
...@@ -286,503 +286,503 @@ void ft1000_destroy_dev(struct net_device *netdev) ...@@ -286,503 +286,503 @@ void ft1000_destroy_dev(struct net_device *netdev)
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_open * Function: ft1000_open
* *
* Parameters: * Parameters:
* *
* Description: * Description:
* *
* Notes: * Notes:
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
static int ft1000_open(struct inode *inode, struct file *file) static int ft1000_open(struct inode *inode, struct file *file)
{ {
struct ft1000_info *info; struct ft1000_info *info;
struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private; struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
int i,num; int i, num;
DEBUG("%s called\n", __func__); DEBUG("%s called\n", __func__);
num = (MINOR(inode->i_rdev) & 0xf); num = (MINOR(inode->i_rdev) & 0xf);
DEBUG("ft1000_open: minor number=%d\n", num); DEBUG("ft1000_open: minor number=%d\n", num);
info = file->private_data = netdev_priv(dev->net); info = file->private_data = netdev_priv(dev->net);
DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt); DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt);
/* Check if maximum number of application exceeded */ /* Check if maximum number of application exceeded */
if (dev->appcnt > MAX_NUM_APP) { if (dev->appcnt > MAX_NUM_APP) {
DEBUG("Maximum number of application exceeded\n"); DEBUG("Maximum number of application exceeded\n");
return -EACCES; return -EACCES;
} }
/* Search for available application info block */ /* Search for available application info block */
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if ((dev->app_info[i].fileobject == NULL)) { if ((dev->app_info[i].fileobject == NULL)) {
break; break;
} }
} }
/* Fail due to lack of application info block */ /* Fail due to lack of application info block */
if (i == MAX_NUM_APP) { if (i == MAX_NUM_APP) {
DEBUG("Could not find an application info block\n"); DEBUG("Could not find an application info block\n");
return -EACCES; return -EACCES;
} }
dev->appcnt++; dev->appcnt++;
dev->app_info[i].fileobject = &file->f_owner; dev->app_info[i].fileobject = &file->f_owner;
dev->app_info[i].nTxMsg = 0; dev->app_info[i].nTxMsg = 0;
dev->app_info[i].nRxMsg = 0; dev->app_info[i].nRxMsg = 0;
dev->app_info[i].nTxMsgReject = 0; dev->app_info[i].nTxMsgReject = 0;
dev->app_info[i].nRxMsgMiss = 0; dev->app_info[i].nRxMsgMiss = 0;
nonseekable_open(inode, file); nonseekable_open(inode, file);
return 0; return 0;
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_poll_dev * Function: ft1000_poll_dev
* *
* Parameters: * Parameters:
* *
* Description: * Description:
* *
* Notes: * Notes:
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait) static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
{ {
struct net_device *netdev = file->private_data; struct net_device *netdev = file->private_data;
struct ft1000_info *info = netdev_priv(netdev); struct ft1000_info *info = netdev_priv(netdev);
struct ft1000_usb *dev = info->priv; struct ft1000_usb *dev = info->priv;
int i; int i;
/* DEBUG("ft1000_poll_dev called\n"); */ /* DEBUG("ft1000_poll_dev called\n"); */
if (ft1000_flarion_cnt == 0) { if (ft1000_flarion_cnt == 0) {
DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n"); DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n");
return -EBADF; return -EBADF;
} }
/* Search for matching file object */ /* Search for matching file object */
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if (dev->app_info[i].fileobject == &file->f_owner) { if (dev->app_info[i].fileobject == &file->f_owner) {
/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */ /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */
break; break;
} }
} }
/* Could not find application info block */ /* Could not find application info block */
if (i == MAX_NUM_APP) { if (i == MAX_NUM_APP) {
DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n"); DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
return -EACCES; return -EACCES;
} }
if (list_empty(&dev->app_info[i].app_sqlist) == 0) { if (list_empty(&dev->app_info[i].app_sqlist) == 0) {
DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n"); DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n");
return(POLLIN | POLLRDNORM | POLLPRI); return(POLLIN | POLLRDNORM | POLLPRI);
} }
poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait); poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
/* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */ /* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
return 0; return 0;
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_ioctl * Function: ft1000_ioctl
* *
* Parameters: * Parameters:
* *
* Description: * Description:
* *
* Notes: * Notes:
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
static long ft1000_ioctl(struct file *file, unsigned int command, static long ft1000_ioctl(struct file *file, unsigned int command,
unsigned long argument) unsigned long argument)
{ {
void __user *argp = (void __user *)argument; void __user *argp = (void __user *)argument;
struct ft1000_info *info; struct ft1000_info *info;
struct ft1000_usb *ft1000dev; struct ft1000_usb *ft1000dev;
int result=0; int result = 0;
int cmd; int cmd;
int i; int i;
u16 tempword; u16 tempword;
unsigned long flags; unsigned long flags;
struct timeval tv; struct timeval tv;
struct IOCTL_GET_VER get_ver_data; struct IOCTL_GET_VER get_ver_data;
struct IOCTL_GET_DSP_STAT get_stat_data; struct IOCTL_GET_DSP_STAT get_stat_data;
u8 ConnectionMsg[] = {0x00,0x44,0x10,0x20,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x93,0x64, u8 ConnectionMsg[] = {0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64,
0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00, 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00,
0x00,0x01,0x00,0x00}; 0x00, 0x01, 0x00, 0x00};
unsigned short ledStat=0; unsigned short ledStat = 0;
unsigned short conStat=0; unsigned short conStat = 0;
/* DEBUG("ft1000_ioctl called\n"); */ /* DEBUG("ft1000_ioctl called\n"); */
if (ft1000_flarion_cnt == 0) { if (ft1000_flarion_cnt == 0) {
DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n"); DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n");
return -EBADF; return -EBADF;
} }
/* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */ /* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */
info = file->private_data; info = file->private_data;
ft1000dev = info->priv; ft1000dev = info->priv;
cmd = _IOC_NR(command); cmd = _IOC_NR(command);
/* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */ /* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */
/* process the command */ /* process the command */
switch (cmd) { switch (cmd) {
case IOCTL_REGISTER_CMD: case IOCTL_REGISTER_CMD:
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n"); DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
result = get_user(tempword, (__u16 __user*)argp); result = get_user(tempword, (__u16 __user *)argp);
if (result) { if (result) {
DEBUG("result = %d failed to get_user\n", result); DEBUG("result = %d failed to get_user\n", result);
break; break;
} }
if (tempword == DSPBCMSGID) { if (tempword == DSPBCMSGID) {
/* Search for matching file object */ /* Search for matching file object */
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if (ft1000dev->app_info[i].fileobject == &file->f_owner) { if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
ft1000dev->app_info[i].DspBCMsgFlag = 1; ft1000dev->app_info[i].DspBCMsgFlag = 1;
DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n"); DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
break; break;
} }
} }
} }
break; break;
case IOCTL_GET_VER_CMD: case IOCTL_GET_VER_CMD:
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n"); DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n");
get_ver_data.drv_ver = FT1000_DRV_VER; get_ver_data.drv_ver = FT1000_DRV_VER;
if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) { if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) {
DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n"); DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
result = -EFAULT; result = -EFAULT;
break; break;
} }
DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned int)get_ver_data.drv_ver); DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n", (unsigned int)get_ver_data.drv_ver);
break; break;
case IOCTL_CONNECT: case IOCTL_CONNECT:
/* Connect Message */ /* Connect Message */
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n"); DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n");
ConnectionMsg[79] = 0xfc; ConnectionMsg[79] = 0xfc;
result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
break; break;
case IOCTL_DISCONNECT: case IOCTL_DISCONNECT:
/* Disconnect Message */ /* Disconnect Message */
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n"); DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n");
ConnectionMsg[79] = 0xfd; ConnectionMsg[79] = 0xfd;
result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
break; break;
case IOCTL_GET_DSP_STAT_CMD: case IOCTL_GET_DSP_STAT_CMD:
/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */ /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */
memset(&get_stat_data, 0, sizeof(get_stat_data)); memset(&get_stat_data, 0, sizeof(get_stat_data));
memcpy(get_stat_data.DspVer, info->DspVer, DSPVERSZ); memcpy(get_stat_data.DspVer, info->DspVer, DSPVERSZ);
memcpy(get_stat_data.HwSerNum, info->HwSerNum, HWSERNUMSZ); memcpy(get_stat_data.HwSerNum, info->HwSerNum, HWSERNUMSZ);
memcpy(get_stat_data.Sku, info->Sku, SKUSZ); memcpy(get_stat_data.Sku, info->Sku, SKUSZ);
memcpy(get_stat_data.eui64, info->eui64, EUISZ); memcpy(get_stat_data.eui64, info->eui64, EUISZ);
if (info->ProgConStat != 0xFF) { if (info->ProgConStat != 0xFF) {
ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
get_stat_data.LedStat = ntohs(ledStat); get_stat_data.LedStat = ntohs(ledStat);
DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat); DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat);
ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
get_stat_data.ConStat = ntohs(conStat); get_stat_data.ConStat = ntohs(conStat);
DEBUG("FT1000:ft1000_ioctl: ConStat = 0x%x\n", get_stat_data.ConStat); DEBUG("FT1000:ft1000_ioctl: ConStat = 0x%x\n", get_stat_data.ConStat);
} else { } else {
get_stat_data.ConStat = 0x0f; get_stat_data.ConStat = 0x0f;
} }
get_stat_data.nTxPkts = info->stats.tx_packets; get_stat_data.nTxPkts = info->stats.tx_packets;
get_stat_data.nRxPkts = info->stats.rx_packets; get_stat_data.nRxPkts = info->stats.rx_packets;
get_stat_data.nTxBytes = info->stats.tx_bytes; get_stat_data.nTxBytes = info->stats.tx_bytes;
get_stat_data.nRxBytes = info->stats.rx_bytes; get_stat_data.nRxBytes = info->stats.rx_bytes;
do_gettimeofday(&tv); do_gettimeofday(&tv);
get_stat_data.ConTm = (u32)(tv.tv_sec - info->ConTm); get_stat_data.ConTm = (u32)(tv.tv_sec - info->ConTm);
DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm); DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm);
if (copy_to_user(argp, &get_stat_data, sizeof(get_stat_data))) { if (copy_to_user(argp, &get_stat_data, sizeof(get_stat_data))) {
DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n"); DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
result = -EFAULT; result = -EFAULT;
break; break;
} }
DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n"); DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
break; break;
case IOCTL_SET_DPRAM_CMD: case IOCTL_SET_DPRAM_CMD:
{ {
struct IOCTL_DPRAM_BLK *dpram_data = NULL; struct IOCTL_DPRAM_BLK *dpram_data = NULL;
/* struct IOCTL_DPRAM_COMMAND dpram_command; */ /* struct IOCTL_DPRAM_COMMAND dpram_command; */
u16 qtype; u16 qtype;
u16 msgsz; u16 msgsz;
struct pseudo_hdr *ppseudo_hdr; struct pseudo_hdr *ppseudo_hdr;
u16 *pmsg; u16 *pmsg;
u16 total_len; u16 total_len;
u16 app_index; u16 app_index;
u16 status; u16 status;
/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/ /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
if (ft1000_flarion_cnt == 0) if (ft1000_flarion_cnt == 0)
return -EBADF; return -EBADF;
if (ft1000dev->DrvMsgPend) if (ft1000dev->DrvMsgPend)
return -ENOTTY; return -ENOTTY;
if (ft1000dev->fProvComplete == 0) if (ft1000dev->fProvComplete == 0)
return -EACCES; return -EACCES;
ft1000dev->fAppMsgPend = 1; ft1000dev->fAppMsgPend = 1;
if (info->CardReady) { if (info->CardReady) {
/* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */ /* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */
/* Get the length field to see how many bytes to copy */ /* Get the length field to see how many bytes to copy */
result = get_user(msgsz, (__u16 __user *)argp); result = get_user(msgsz, (__u16 __user *)argp);
if (result) if (result)
break; break;
msgsz = ntohs(msgsz); msgsz = ntohs(msgsz);
/* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */ /* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */
if (msgsz > MAX_CMD_SQSIZE) { if (msgsz > MAX_CMD_SQSIZE) {
DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz); DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz);
result = -EINVAL; result = -EINVAL;
break; break;
} }
result = -ENOMEM;
dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
if (!dpram_data)
break;
if (copy_from_user(dpram_data, argp, msgsz+2)) { result = -ENOMEM;
DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n"); dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
result = -EFAULT; if (!dpram_data)
} else { break;
/* Check if this message came from a registered application */
for (i=0; i<MAX_NUM_APP; i++) { if (copy_from_user(dpram_data, argp, msgsz+2)) {
if (ft1000dev->app_info[i].fileobject == &file->f_owner) { DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
break; result = -EFAULT;
} } else {
} /* Check if this message came from a registered application */
if (i==MAX_NUM_APP) { for (i = 0; i < MAX_NUM_APP; i++) {
DEBUG("FT1000:No matching application fileobject\n"); if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
result = -EINVAL; break;
kfree(dpram_data); }
break; }
} if (i == MAX_NUM_APP) {
app_index = i; DEBUG("FT1000:No matching application fileobject\n");
result = -EINVAL;
/* Check message qtype type which is the lower byte within qos_class */ kfree(dpram_data);
qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff; break;
/* DEBUG("FT1000_ft1000_ioctl: qtype = %d\n", qtype); */ }
if (qtype) { app_index = i;
} else {
/* Put message into Slow Queue */ /* Check message qtype type which is the lower byte within qos_class */
/* Only put a message into the DPRAM if msg doorbell is available */ qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); /* DEBUG("FT1000_ft1000_ioctl: qtype = %d\n", qtype); */
/* DEBUG("FT1000_ft1000_ioctl: READ REGISTER tempword=%x\n", tempword); */ if (qtype) {
if (tempword & FT1000_DB_DPRAM_TX) { } else {
/* Suspend for 2ms and try again due to DSP doorbell busy */ /* Put message into Slow Queue */
mdelay(2); /* Only put a message into the DPRAM if msg doorbell is available */
status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) { /* DEBUG("FT1000_ft1000_ioctl: READ REGISTER tempword=%x\n", tempword); */
/* Suspend for 1ms and try again due to DSP doorbell busy */ if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(1); /* Suspend for 2ms and try again due to DSP doorbell busy */
status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); mdelay(2);
if (tempword & FT1000_DB_DPRAM_TX) { status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) {
if (tempword & FT1000_DB_DPRAM_TX) { /* Suspend for 1ms and try again due to DSP doorbell busy */
/* Suspend for 3ms and try again due to DSP doorbell busy */ mdelay(1);
mdelay(3); status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) {
if (tempword & FT1000_DB_DPRAM_TX) { status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
DEBUG("FT1000:ft1000_ioctl:Doorbell not available\n"); if (tempword & FT1000_DB_DPRAM_TX) {
result = -ENOTTY; /* Suspend for 3ms and try again due to DSP doorbell busy */
kfree(dpram_data); mdelay(3);
break; status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
} if (tempword & FT1000_DB_DPRAM_TX) {
} DEBUG("FT1000:ft1000_ioctl:Doorbell not available\n");
} result = -ENOTTY;
} kfree(dpram_data);
} break;
}
/*DEBUG("FT1000_ft1000_ioctl: finished reading register\n"); */ }
}
/* Make sure we are within the limits of the slow queue memory limitation */ }
if ((msgsz < MAX_CMD_SQSIZE) && (msgsz > PSEUDOSZ)) { }
/* Need to put sequence number plus new checksum for message */
pmsg = (u16 *)&dpram_data->pseudohdr; /*DEBUG("FT1000_ft1000_ioctl: finished reading register\n"); */
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
total_len = msgsz+2; /* Make sure we are within the limits of the slow queue memory limitation */
if (total_len & 0x1) { if ((msgsz < MAX_CMD_SQSIZE) && (msgsz > PSEUDOSZ)) {
total_len++; /* Need to put sequence number plus new checksum for message */
} pmsg = (u16 *)&dpram_data->pseudohdr;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
/* Insert slow queue sequence number */ total_len = msgsz+2;
ppseudo_hdr->seq_num = info->squeseqnum++; if (total_len & 0x1) {
ppseudo_hdr->portsrc = ft1000dev->app_info[app_index].app_id; total_len++;
/* Calculate new checksum */ }
ppseudo_hdr->checksum = *pmsg++;
/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */ /* Insert slow queue sequence number */
for (i=1; i<7; i++) { ppseudo_hdr->seq_num = info->squeseqnum++;
ppseudo_hdr->checksum ^= *pmsg++; ppseudo_hdr->portsrc = ft1000dev->app_info[app_index].app_id;
/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */ /* Calculate new checksum */
} ppseudo_hdr->checksum = *pmsg++;
pmsg++; /* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */
ppseudo_hdr = (struct pseudo_hdr *)pmsg; for (i = 1; i < 7; i++) {
result = card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2); ppseudo_hdr->checksum ^= *pmsg++;
/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */
}
ft1000dev->app_info[app_index].nTxMsg++; pmsg++;
} else { ppseudo_hdr = (struct pseudo_hdr *)pmsg;
result = -EINVAL; result = card_send_command(ft1000dev, (unsigned short *)dpram_data, total_len+2);
}
}
} ft1000dev->app_info[app_index].nTxMsg++;
} else { } else {
DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n"); result = -EINVAL;
result = -EACCES; }
} }
kfree(dpram_data); }
} else {
} DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n");
break; result = -EACCES;
case IOCTL_GET_DPRAM_CMD: }
{ kfree(dpram_data);
}
break;
case IOCTL_GET_DPRAM_CMD:
{
struct dpram_blk *pdpram_blk; struct dpram_blk *pdpram_blk;
struct IOCTL_DPRAM_BLK __user *pioctl_dpram; struct IOCTL_DPRAM_BLK __user *pioctl_dpram;
int msglen; int msglen;
/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM called\n"); */ /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM called\n"); */
if (ft1000_flarion_cnt == 0) if (ft1000_flarion_cnt == 0)
return -EBADF; return -EBADF;
/* Search for matching file object */ /* Search for matching file object */
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if (ft1000dev->app_info[i].fileobject == &file->f_owner) { if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
/*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */ /*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
break; break;
} }
} }
/* Could not find application info block */ /* Could not find application info block */
if (i == MAX_NUM_APP) { if (i == MAX_NUM_APP) {
DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n"); DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
result = -EBADF; result = -EBADF;
break;
}
result = 0;
pioctl_dpram = argp;
if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
/* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */
spin_lock_irqsave(&free_buff_lock, flags);
pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
list_del(&pdpram_blk->list);
ft1000dev->app_info[i].NumOfMsg--;
/* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */
spin_unlock_irqrestore(&free_buff_lock, flags);
msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
result = get_user(msglen, &pioctl_dpram->total_len);
if (result)
break;
msglen = htons(msglen);
/* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
if (copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
result = -EFAULT;
break; break;
} }
result = 0;
pioctl_dpram = argp;
if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
/* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */
spin_lock_irqsave(&free_buff_lock, flags);
pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
list_del(&pdpram_blk->list);
ft1000dev->app_info[i].NumOfMsg--;
/* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */
spin_unlock_irqrestore(&free_buff_lock, flags);
msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
result = get_user(msglen, &pioctl_dpram->total_len);
if (result)
break;
msglen = htons(msglen);
/* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
if (copy_to_user(&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
result = -EFAULT;
break;
}
ft1000_free_buffer(pdpram_blk, &freercvpool); ft1000_free_buffer(pdpram_blk, &freercvpool);
result = msglen; result = msglen;
} }
/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */ /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */
} }
break; break;
default: default:
DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command); DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command);
result = -ENOTTY; result = -ENOTTY;
break; break;
} }
ft1000dev->fAppMsgPend = 0; ft1000dev->fAppMsgPend = 0;
return result; return result;
} }
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Function: ft1000_release * Function: ft1000_release
* *
* Parameters: * Parameters:
* *
* Description: * Description:
* *
* Notes: * Notes:
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
static int ft1000_release(struct inode *inode, struct file *file) static int ft1000_release(struct inode *inode, struct file *file)
{ {
struct ft1000_info *info; struct ft1000_info *info;
struct net_device *dev; struct net_device *dev;
struct ft1000_usb *ft1000dev; struct ft1000_usb *ft1000dev;
int i; int i;
struct dpram_blk *pdpram_blk; struct dpram_blk *pdpram_blk;
DEBUG("ft1000_release called\n"); DEBUG("ft1000_release called\n");
dev = file->private_data; dev = file->private_data;
info = netdev_priv(dev); info = netdev_priv(dev);
ft1000dev = info->priv; ft1000dev = info->priv;
if (ft1000_flarion_cnt == 0) { if (ft1000_flarion_cnt == 0) {
ft1000dev->appcnt--; ft1000dev->appcnt--;
return -EBADF; return -EBADF;
} }
/* Search for matching file object */ /* Search for matching file object */
for (i=0; i<MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if (ft1000dev->app_info[i].fileobject == &file->f_owner) { if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */ /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
break; break;
} }
} }
if (i==MAX_NUM_APP) if (i == MAX_NUM_APP)
return 0; return 0;
while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
DEBUG("Remove and free memory queue up on slow queue\n"); DEBUG("Remove and free memory queue up on slow queue\n");
pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list); pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
list_del(&pdpram_blk->list); list_del(&pdpram_blk->list);
ft1000_free_buffer(pdpram_blk, &freercvpool); ft1000_free_buffer(pdpram_blk, &freercvpool);
} }
/* initialize application information */ /* initialize application information */
ft1000dev->appcnt--; ft1000dev->appcnt--;
DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt); DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt);
ft1000dev->app_info[i].fileobject = NULL; ft1000dev->app_info[i].fileobject = NULL;
return 0; return 0;
} }
/* /*
* CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved. * CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved.
* *
* This file is part of Express Card USB Driver * This file is part of Express Card USB Driver
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -117,17 +117,17 @@ static int check_usb_db(struct ft1000_usb *ft1000dev) ...@@ -117,17 +117,17 @@ static int check_usb_db(struct ft1000_usb *ft1000dev)
while (loopcnt < 10) { while (loopcnt < 10) {
status = ft1000_read_register(ft1000dev, &temp, status = ft1000_read_register(ft1000dev, &temp,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n", DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n",
temp); temp);
if (temp & 0x0080) { if (temp & 0x0080) {
DEBUG("FT1000:Got checkusb doorbell\n"); DEBUG("FT1000:Got checkusb doorbell\n");
status = ft1000_write_register(ft1000dev, 0x0080, status = ft1000_write_register(ft1000dev, 0x0080,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
status = ft1000_write_register(ft1000dev, 0x0100, status = ft1000_write_register(ft1000dev, 0x0100,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
status = ft1000_write_register(ft1000dev, 0x8000, status = ft1000_write_register(ft1000dev, 0x8000,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
break; break;
} }
loopcnt++; loopcnt++;
...@@ -138,7 +138,7 @@ static int check_usb_db(struct ft1000_usb *ft1000dev) ...@@ -138,7 +138,7 @@ static int check_usb_db(struct ft1000_usb *ft1000dev)
loopcnt = 0; loopcnt = 0;
while (loopcnt < 20) { while (loopcnt < 20) {
status = ft1000_read_register(ft1000dev, &temp, status = ft1000_read_register(ft1000dev, &temp,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp); DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp);
if (temp & 0x8000) { if (temp & 0x8000) {
loopcnt++; loopcnt++;
...@@ -164,10 +164,10 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) ...@@ -164,10 +164,10 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value)
while (loopcnt < 100) { while (loopcnt < 100) {
/* Need to clear downloader doorbell if Hartley ASIC */ /* Need to clear downloader doorbell if Hartley ASIC */
status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX, status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (ft1000dev->fcodeldr) { if (ft1000dev->fcodeldr) {
DEBUG(" get_handshake: fcodeldr is %d\n", DEBUG(" get_handshake: fcodeldr is %d\n",
ft1000dev->fcodeldr); ft1000dev->fcodeldr);
ft1000dev->fcodeldr = 0; ft1000dev->fcodeldr = 0;
status = check_usb_db(ft1000dev); status = check_usb_db(ft1000dev);
if (status != 0) { if (status != 0) {
...@@ -175,12 +175,12 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) ...@@ -175,12 +175,12 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value)
break; break;
} }
status = ft1000_write_register(ft1000dev, status = ft1000_write_register(ft1000dev,
FT1000_DB_DNLD_RX, FT1000_DB_DNLD_RX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
} }
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1); DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1);
handshake = ntohs(handshake); handshake = ntohs(handshake);
if (status) if (status)
...@@ -209,12 +209,12 @@ static void put_handshake(struct ft1000_usb *ft1000dev, u16 handshake_value) ...@@ -209,12 +209,12 @@ static void put_handshake(struct ft1000_usb *ft1000dev, u16 handshake_value)
tempword = (u16)(tempx & 0xffff); tempword = (u16)(tempx & 0xffff);
status = ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, status = ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC,
tempword, 0); tempword, 0);
tempword = (u16)(tempx >> 16); tempword = (u16)(tempx >> 16);
status = ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, status = ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC,
tempword, 1); tempword, 1);
status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX, status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
} }
static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value) static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value)
...@@ -230,27 +230,27 @@ static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value) ...@@ -230,27 +230,27 @@ static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value)
while (loopcnt < 100) { while (loopcnt < 100) {
if (ft1000dev->usbboot == 2) { if (ft1000dev->usbboot == 2) {
status = ft1000_read_dpram32(ft1000dev, 0, status = ft1000_read_dpram32(ft1000dev, 0,
(u8 *)&(ft1000dev->tempbuf[0]), 64); (u8 *)&(ft1000dev->tempbuf[0]), 64);
for (temp = 0; temp < 16; temp++) { for (temp = 0; temp < 16; temp++) {
DEBUG("tempbuf %d = 0x%x\n", temp, DEBUG("tempbuf %d = 0x%x\n", temp,
ft1000dev->tempbuf[temp]); ft1000dev->tempbuf[temp]);
} }
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, DWNLD_MAG1_HANDSHAKE_LOC,
(u8 *)&handshake, 1); (u8 *)&handshake, 1);
DEBUG("handshake from read_dpram16 = 0x%x\n", DEBUG("handshake from read_dpram16 = 0x%x\n",
handshake); handshake);
if (ft1000dev->dspalive == ft1000dev->tempbuf[6]) { if (ft1000dev->dspalive == ft1000dev->tempbuf[6]) {
handshake = 0; handshake = 0;
} else { } else {
handshake = ft1000dev->tempbuf[1]; handshake = ft1000dev->tempbuf[1];
ft1000dev->dspalive = ft1000dev->dspalive =
ft1000dev->tempbuf[6]; ft1000dev->tempbuf[6];
} }
} else { } else {
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, DWNLD_MAG1_HANDSHAKE_LOC,
(u8 *)&handshake, 1); (u8 *)&handshake, 1);
} }
loopcnt++; loopcnt++;
...@@ -281,12 +281,12 @@ static u16 get_request_type(struct ft1000_usb *ft1000dev) ...@@ -281,12 +281,12 @@ static u16 get_request_type(struct ft1000_usb *ft1000dev)
if (ft1000dev->bootmode == 1) { if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev, status = fix_ft1000_read_dpram32(ft1000dev,
DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx); DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
tempx = ntohl(tempx); tempx = ntohl(tempx);
} else { } else {
tempx = 0; tempx = 0;
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_TYPE_LOC, (u8 *)&tempword, 1); DWNLD_MAG1_TYPE_LOC, (u8 *)&tempword, 1);
tempx |= (tempword << 16); tempx |= (tempword << 16);
tempx = ntohl(tempx); tempx = ntohl(tempx);
} }
...@@ -304,7 +304,7 @@ static u16 get_request_type_usb(struct ft1000_usb *ft1000dev) ...@@ -304,7 +304,7 @@ static u16 get_request_type_usb(struct ft1000_usb *ft1000dev)
if (ft1000dev->bootmode == 1) { if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev, status = fix_ft1000_read_dpram32(ft1000dev,
DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx); DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
tempx = ntohl(tempx); tempx = ntohl(tempx);
} else { } else {
if (ft1000dev->usbboot == 2) { if (ft1000dev->usbboot == 2) {
...@@ -313,8 +313,8 @@ static u16 get_request_type_usb(struct ft1000_usb *ft1000dev) ...@@ -313,8 +313,8 @@ static u16 get_request_type_usb(struct ft1000_usb *ft1000dev)
} else { } else {
tempx = 0; tempx = 0;
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_TYPE_LOC, DWNLD_MAG1_TYPE_LOC,
(u8 *)&tempword, 1); (u8 *)&tempword, 1);
} }
tempx |= (tempword << 16); tempx |= (tempword << 16);
tempx = ntohl(tempx); tempx = ntohl(tempx);
...@@ -332,14 +332,14 @@ static long get_request_value(struct ft1000_usb *ft1000dev) ...@@ -332,14 +332,14 @@ static long get_request_value(struct ft1000_usb *ft1000dev)
if (ft1000dev->bootmode == 1) { if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev, status = fix_ft1000_read_dpram32(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (u8 *)&value); DWNLD_MAG1_SIZE_LOC, (u8 *)&value);
value = ntohl(value); value = ntohl(value);
} else { } else {
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 0); DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 0);
value = tempword; value = tempword;
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 1); DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 1);
value |= (tempword << 16); value |= (tempword << 16);
value = ntohl(value); value = ntohl(value);
} }
...@@ -369,7 +369,7 @@ static u16 hdr_checksum(struct pseudo_hdr *pHdr) ...@@ -369,7 +369,7 @@ static u16 hdr_checksum(struct pseudo_hdr *pHdr)
chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^
usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); usPtr[4]) ^ usPtr[5]) ^ usPtr[6]);
return chksum; return chksum;
} }
...@@ -387,7 +387,7 @@ static int check_buffers(u16 *buff_w, u16 *buff_r, int len, int offset) ...@@ -387,7 +387,7 @@ static int check_buffers(u16 *buff_w, u16 *buff_r, int len, int offset)
} }
static int write_dpram32_and_check(struct ft1000_usb *ft1000dev, static int write_dpram32_and_check(struct ft1000_usb *ft1000dev,
u16 tempbuffer[], u16 dpram) u16 tempbuffer[], u16 dpram)
{ {
int status; int status;
u16 resultbuffer[64]; u16 resultbuffer[64];
...@@ -395,37 +395,37 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev, ...@@ -395,37 +395,37 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev,
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
status = ft1000_write_dpram32(ft1000dev, dpram, status = ft1000_write_dpram32(ft1000dev, dpram,
(u8 *)&tempbuffer[0], 64); (u8 *)&tempbuffer[0], 64);
if (status == 0) { if (status == 0) {
/* Work around for ASIC bit stuffing problem. */ /* Work around for ASIC bit stuffing problem. */
if ((tempbuffer[31] & 0xfe00) == 0xfe00) { if ((tempbuffer[31] & 0xfe00) == 0xfe00) {
status = ft1000_write_dpram32(ft1000dev, status = ft1000_write_dpram32(ft1000dev,
dpram+12, (u8 *)&tempbuffer[24], dpram+12, (u8 *)&tempbuffer[24],
64); 64);
} }
/* Let's check the data written */ /* Let's check the data written */
status = ft1000_read_dpram32(ft1000dev, dpram, status = ft1000_read_dpram32(ft1000dev, dpram,
(u8 *)&resultbuffer[0], 64); (u8 *)&resultbuffer[0], 64);
if ((tempbuffer[31] & 0xfe00) == 0xfe00) { if ((tempbuffer[31] & 0xfe00) == 0xfe00) {
if (check_buffers(tempbuffer, resultbuffer, 28, if (check_buffers(tempbuffer, resultbuffer, 28,
0)) { 0)) {
DEBUG("FT1000:download:DPRAM write failed 1 during bootloading\n"); DEBUG("FT1000:download:DPRAM write failed 1 during bootloading\n");
usleep_range(9000, 11000); usleep_range(9000, 11000);
break; break;
} }
status = ft1000_read_dpram32(ft1000dev, status = ft1000_read_dpram32(ft1000dev,
dpram+12, dpram+12,
(u8 *)&resultbuffer[0], 64); (u8 *)&resultbuffer[0], 64);
if (check_buffers(tempbuffer, resultbuffer, 16, if (check_buffers(tempbuffer, resultbuffer, 16,
24)) { 24)) {
DEBUG("FT1000:download:DPRAM write failed 2 during bootloading\n"); DEBUG("FT1000:download:DPRAM write failed 2 during bootloading\n");
usleep_range(9000, 11000); usleep_range(9000, 11000);
break; break;
} }
} else { } else {
if (check_buffers(tempbuffer, resultbuffer, 32, if (check_buffers(tempbuffer, resultbuffer, 32,
0)) { 0)) {
DEBUG("FT1000:download:DPRAM write failed 3 during bootloading\n"); DEBUG("FT1000:download:DPRAM write failed 3 during bootloading\n");
usleep_range(9000, 11000); usleep_range(9000, 11000);
break; break;
...@@ -445,7 +445,7 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev, ...@@ -445,7 +445,7 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev,
* long word_length - length of the buffer to be written to DPRAM * long word_length - length of the buffer to be written to DPRAM
*/ */
static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
long word_length) long word_length)
{ {
int status = 0; int status = 0;
u16 dpram; u16 dpram;
...@@ -489,13 +489,13 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, ...@@ -489,13 +489,13 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
if (ft1000dev->bootmode == 0) { if (ft1000dev->bootmode == 0) {
if (dpram >= 0x3F4) if (dpram >= 0x3F4)
status = ft1000_write_dpram32(ft1000dev, dpram, status = ft1000_write_dpram32(ft1000dev, dpram,
(u8 *)&tempbuffer[0], 8); (u8 *)&tempbuffer[0], 8);
else else
status = ft1000_write_dpram32(ft1000dev, dpram, status = ft1000_write_dpram32(ft1000dev, dpram,
(u8 *)&tempbuffer[0], 64); (u8 *)&tempbuffer[0], 64);
} else { } else {
status = write_dpram32_and_check(ft1000dev, tempbuffer, status = write_dpram32_and_check(ft1000dev, tempbuffer,
dpram); dpram);
if (status != 0) { if (status != 0) {
DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]); DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]);
break; break;
...@@ -548,7 +548,7 @@ static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile, ...@@ -548,7 +548,7 @@ static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
} }
static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake, static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake,
u32 *state) u32 *state)
{ {
int status = 0; int status = 0;
...@@ -571,7 +571,7 @@ static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake, ...@@ -571,7 +571,7 @@ static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake,
} }
static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file, static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file,
u8 **c_file, const u8 *endpoint, bool boot_case) u8 **c_file, const u8 *endpoint, bool boot_case)
{ {
long word_length; long word_length;
int status = 0; int status = 0;
...@@ -602,7 +602,7 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file, ...@@ -602,7 +602,7 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file,
ft1000dev->usbboot++; ft1000dev->usbboot++;
if (ft1000dev->usbboot == 1) if (ft1000dev->usbboot == 1)
status |= ft1000_write_dpram16(ft1000dev, status |= ft1000_write_dpram16(ft1000dev,
DWNLD_MAG1_PS_HDR_LOC, 0, 0); DWNLD_MAG1_PS_HDR_LOC, 0, 0);
} }
return status; return status;
} }
...@@ -705,14 +705,14 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -705,14 +705,14 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
break; break;
case REQUEST_CODE_SEGMENT: case REQUEST_CODE_SEGMENT:
status = request_code_segment(ft1000dev, status = request_code_segment(ft1000dev,
&s_file, &c_file, &s_file, &c_file,
(const u8 *)boot_end, (const u8 *)boot_end,
true); true);
break; break;
default: default:
DEBUG DEBUG
("FT1000:download:Download error: Bad request type=%d in BOOT download state.\n", ("FT1000:download:Download error: Bad request type=%d in BOOT download state.\n",
request); request);
status = -1; status = -1;
break; break;
} }
...@@ -724,7 +724,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -724,7 +724,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
HANDSHAKE_RESPONSE); HANDSHAKE_RESPONSE);
} else { } else {
DEBUG DEBUG
("FT1000:download:Download error: Handshake failed\n"); ("FT1000:download:Download error: Handshake failed\n");
status = -1; status = -1;
} }
...@@ -735,56 +735,56 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -735,56 +735,56 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
ft1000dev->bootmode = 0; ft1000dev->bootmode = 0;
if (ft1000dev->usbboot) if (ft1000dev->usbboot)
handshake = handshake =
get_handshake_usb(ft1000dev, get_handshake_usb(ft1000dev,
HANDSHAKE_REQUEST); HANDSHAKE_REQUEST);
else else
handshake = handshake =
get_handshake(ft1000dev, HANDSHAKE_REQUEST); get_handshake(ft1000dev, HANDSHAKE_REQUEST);
if (handshake == HANDSHAKE_REQUEST) { if (handshake == HANDSHAKE_REQUEST) {
/* /*
* Get type associated with the request. * Get type associated with the request.
*/ */
if (ft1000dev->usbboot) if (ft1000dev->usbboot)
request = request =
get_request_type_usb(ft1000dev); get_request_type_usb(ft1000dev);
else else
request = get_request_type(ft1000dev); request = get_request_type(ft1000dev);
switch (request) { switch (request) {
case REQUEST_FILE_CHECKSUM: case REQUEST_FILE_CHECKSUM:
DEBUG DEBUG
("FT1000:download:image_chksum = 0x%8x\n", ("FT1000:download:image_chksum = 0x%8x\n",
image_chksum); image_chksum);
put_request_value(ft1000dev, put_request_value(ft1000dev,
image_chksum); image_chksum);
break; break;
case REQUEST_RUN_ADDRESS: case REQUEST_RUN_ADDRESS:
DEBUG DEBUG
("FT1000:download: REQUEST_RUN_ADDRESS\n"); ("FT1000:download: REQUEST_RUN_ADDRESS\n");
if (correct_version) { if (correct_version) {
DEBUG DEBUG
("FT1000:download:run_address = 0x%8x\n", ("FT1000:download:run_address = 0x%8x\n",
(int)run_address); (int)run_address);
put_request_value(ft1000dev, put_request_value(ft1000dev,
run_address); run_address);
} else { } else {
DEBUG DEBUG
("FT1000:download:Download error: Got Run address request before image offset request.\n"); ("FT1000:download:Download error: Got Run address request before image offset request.\n");
status = -1; status = -1;
break; break;
} }
break; break;
case REQUEST_CODE_LENGTH: case REQUEST_CODE_LENGTH:
DEBUG DEBUG
("FT1000:download:REQUEST_CODE_LENGTH\n"); ("FT1000:download:REQUEST_CODE_LENGTH\n");
if (correct_version) { if (correct_version) {
DEBUG DEBUG
("FT1000:download:run_size = 0x%8x\n", ("FT1000:download:run_size = 0x%8x\n",
(int)run_size); (int)run_size);
put_request_value(ft1000dev, put_request_value(ft1000dev,
run_size); run_size);
} else { } else {
DEBUG DEBUG
("FT1000:download:Download error: Got Size request before image offset request.\n"); ("FT1000:download:Download error: Got Size request before image offset request.\n");
status = -1; status = -1;
break; break;
} }
...@@ -793,47 +793,47 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -793,47 +793,47 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
ft1000dev->usbboot = 3; ft1000dev->usbboot = 3;
/* Reposition ptrs to beginning of provisioning section */ /* Reposition ptrs to beginning of provisioning section */
s_file = s_file =
(u16 *) (pFileStart + (u16 *) (pFileStart +
file_hdr->commands_offset); file_hdr->commands_offset);
c_file = c_file =
(u8 *) (pFileStart + (u8 *) (pFileStart +
file_hdr->commands_offset); file_hdr->commands_offset);
state = STATE_DONE_DWNLD; state = STATE_DONE_DWNLD;
break; break;
case REQUEST_CODE_SEGMENT: case REQUEST_CODE_SEGMENT:
/* DEBUG("FT1000:download: REQUEST_CODE_SEGMENT - CODELOADER\n"); */ /* DEBUG("FT1000:download: REQUEST_CODE_SEGMENT - CODELOADER\n"); */
if (!correct_version) { if (!correct_version) {
DEBUG DEBUG
("FT1000:download:Download error: Got Code Segment request before image offset request.\n"); ("FT1000:download:Download error: Got Code Segment request before image offset request.\n");
status = -1; status = -1;
break; break;
} }
status = request_code_segment(ft1000dev, status = request_code_segment(ft1000dev,
&s_file, &c_file, &s_file, &c_file,
(const u8 *)code_end, (const u8 *)code_end,
false); false);
break; break;
case REQUEST_MAILBOX_DATA: case REQUEST_MAILBOX_DATA:
DEBUG DEBUG
("FT1000:download: REQUEST_MAILBOX_DATA\n"); ("FT1000:download: REQUEST_MAILBOX_DATA\n");
/* Convert length from byte count to word count. Make sure we round up. */ /* Convert length from byte count to word count. Make sure we round up. */
word_length = word_length =
(long)(pft1000info->DSPInfoBlklen + (long)(pft1000info->DSPInfoBlklen +
1) / 2; 1) / 2;
put_request_value(ft1000dev, put_request_value(ft1000dev,
word_length); word_length);
mailbox_data = mailbox_data =
(struct drv_msg *)&(pft1000info-> (struct drv_msg *)&(pft1000info->
DSPInfoBlk[0]); DSPInfoBlk[0]);
/* /*
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
data = (u16 *) &mailbox_data->data[0]; data = (u16 *)&mailbox_data->data[0];
dpram = (u16) DWNLD_MAG1_PS_HDR_LOC; dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
if (word_length & 0x1) if (word_length & 0x1)
word_length++; word_length++;
...@@ -844,18 +844,18 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -844,18 +844,18 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
templong = *data++; templong = *data++;
templong |= (*data++ << 16); templong |= (*data++ << 16);
status = status =
fix_ft1000_write_dpram32 fix_ft1000_write_dpram32
(ft1000dev, dpram++, (ft1000dev, dpram++,
(u8 *) &templong); (u8 *)&templong);
} }
break; break;
case REQUEST_VERSION_INFO: case REQUEST_VERSION_INFO:
DEBUG DEBUG
("FT1000:download:REQUEST_VERSION_INFO\n"); ("FT1000:download:REQUEST_VERSION_INFO\n");
word_length = word_length =
file_hdr->version_data_size; file_hdr->version_data_size;
put_request_value(ft1000dev, put_request_value(ft1000dev,
word_length); word_length);
/* /*
...@@ -863,11 +863,11 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -863,11 +863,11 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
*/ */
s_file = s_file =
(u16 *) (pFileStart + (u16 *) (pFileStart +
file_hdr-> file_hdr->
version_data_offset); version_data_offset);
dpram = (u16) DWNLD_MAG1_PS_HDR_LOC; dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
if (word_length & 0x1) if (word_length & 0x1)
word_length++; word_length++;
...@@ -879,26 +879,26 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -879,26 +879,26 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
temp = ntohs(*s_file++); temp = ntohs(*s_file++);
templong |= (temp << 16); templong |= (temp << 16);
status = status =
fix_ft1000_write_dpram32 fix_ft1000_write_dpram32
(ft1000dev, dpram++, (ft1000dev, dpram++,
(u8 *) &templong); (u8 *)&templong);
} }
break; break;
case REQUEST_CODE_BY_VERSION: case REQUEST_CODE_BY_VERSION:
DEBUG DEBUG
("FT1000:download:REQUEST_CODE_BY_VERSION\n"); ("FT1000:download:REQUEST_CODE_BY_VERSION\n");
correct_version = false; correct_version = false;
requested_version = requested_version =
get_request_value(ft1000dev); get_request_value(ft1000dev);
dsp_img_info = dsp_img_info =
(struct dsp_image_info *)(pFileStart (struct dsp_image_info *)(pFileStart
+ +
sizeof sizeof
(struct (struct
dsp_file_hdr)); dsp_file_hdr));
for (image = 0; for (image = 0;
image < file_hdr->nDspImages; image < file_hdr->nDspImages;
...@@ -908,29 +908,29 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -908,29 +908,29 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
requested_version) { requested_version) {
correct_version = true; correct_version = true;
DEBUG DEBUG
("FT1000:download: correct_version is TRUE\n"); ("FT1000:download: correct_version is TRUE\n");
s_file = s_file =
(u16 *) (pFileStart (u16 *) (pFileStart
+ +
dsp_img_info-> dsp_img_info->
begin_offset); begin_offset);
c_file = c_file =
(u8 *) (pFileStart + (u8 *) (pFileStart +
dsp_img_info-> dsp_img_info->
begin_offset); begin_offset);
code_end = code_end =
(u8 *) (pFileStart + (u8 *) (pFileStart +
dsp_img_info-> dsp_img_info->
end_offset); end_offset);
run_address = run_address =
dsp_img_info-> dsp_img_info->
run_address; run_address;
run_size = run_size =
dsp_img_info-> dsp_img_info->
image_size; image_size;
image_chksum = image_chksum =
(u32) dsp_img_info-> (u32)dsp_img_info->
checksum; checksum;
break; break;
} }
dsp_img_info++; dsp_img_info++;
...@@ -942,8 +942,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -942,8 +942,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
* Error, beyond boot code range. * Error, beyond boot code range.
*/ */
DEBUG DEBUG
("FT1000:download:Download error: Bad Version Request = 0x%x.\n", ("FT1000:download:Download error: Bad Version Request = 0x%x.\n",
(int)requested_version); (int)requested_version);
status = -1; status = -1;
break; break;
} }
...@@ -951,8 +951,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -951,8 +951,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
default: default:
DEBUG DEBUG
("FT1000:download:Download error: Bad request type=%d in CODE download state.\n", ("FT1000:download:Download error: Bad request type=%d in CODE download state.\n",
request); request);
status = -1; status = -1;
break; break;
} }
...@@ -964,7 +964,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -964,7 +964,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
HANDSHAKE_RESPONSE); HANDSHAKE_RESPONSE);
} else { } else {
DEBUG DEBUG
("FT1000:download:Download error: Handshake failed\n"); ("FT1000:download:Download error: Handshake failed\n");
status = -1; status = -1;
} }
...@@ -990,9 +990,9 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -990,9 +990,9 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
/* Get buffer for provisioning data */ /* Get buffer for provisioning data */
pbuffer = pbuffer =
kmalloc((pseudo_header_len + kmalloc((pseudo_header_len +
sizeof(struct pseudo_hdr)), sizeof(struct pseudo_hdr)),
GFP_ATOMIC); GFP_ATOMIC);
if (pbuffer) { if (pbuffer) {
memcpy(pbuffer, (void *)c_file, memcpy(pbuffer, (void *)c_file,
(u32) (pseudo_header_len + (u32) (pseudo_header_len +
...@@ -1000,20 +1000,20 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -1000,20 +1000,20 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
pseudo_hdr))); pseudo_hdr)));
/* link provisioning data */ /* link provisioning data */
pprov_record = pprov_record =
kmalloc(sizeof(struct prov_record), kmalloc(sizeof(struct prov_record),
GFP_ATOMIC); GFP_ATOMIC);
if (pprov_record) { if (pprov_record) {
pprov_record->pprov_data = pprov_record->pprov_data =
pbuffer; pbuffer;
list_add_tail(&pprov_record-> list_add_tail(&pprov_record->
list, list,
&pft1000info-> &pft1000info->
prov_list); prov_list);
/* Move to next entry if available */ /* Move to next entry if available */
c_file = c_file =
(u8 *) ((unsigned long) (u8 *) ((unsigned long)
c_file + c_file +
(u32) ((pseudo_header_len + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr)); (u32) ((pseudo_header_len + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr));
if ((unsigned long)(c_file) - if ((unsigned long)(c_file) -
(unsigned long)(pFileStart) (unsigned long)(pFileStart)
>= >=
...@@ -1032,8 +1032,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -1032,8 +1032,8 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
status = -1; status = -1;
} }
DEBUG DEBUG
("ft1000:download: after STATE_SECTION_PROV, state = %d, status= %d\n", ("ft1000:download: after STATE_SECTION_PROV, state = %d, status= %d\n",
state, status); state, status);
break; break;
case STATE_DONE_PROV: case STATE_DONE_PROV:
...@@ -1050,16 +1050,16 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, ...@@ -1050,16 +1050,16 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
break; break;
/**** /****
// Check if Card is present // Check if Card is present
status = Harley_Read_Register(&temp, FT1000_REG_SUP_IMASK); status = Harley_Read_Register(&temp, FT1000_REG_SUP_IMASK);
if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0x0000) ) { if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0x0000) ) {
break; break;
} }
status = Harley_Read_Register(&temp, FT1000_REG_ASIC_ID); status = Harley_Read_Register(&temp, FT1000_REG_ASIC_ID);
if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0xffff) ) { if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0xffff) ) {
break; break;
} }
****/ ****/
} /* End while */ } /* End while */
......
/* CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved. /* CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved.
* *
* *
* This file is part of Express Card USB Driver * This file is part of Express Card USB Driver
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -35,16 +35,16 @@ static u8 tempbuffer[1600]; ...@@ -35,16 +35,16 @@ static u8 tempbuffer[1600];
#define MAX_RCV_LOOP 100 #define MAX_RCV_LOOP 100
/* send a control message via USB interface synchronously /* send a control message via USB interface synchronously
* Parameters: ft1000_usb - device structure * Parameters: ft1000_usb - device structure
* pipe - usb control message pipe * pipe - usb control message pipe
* request - control request * request - control request
* requesttype - control message request type * requesttype - control message request type
* value - value to be written or 0 * value - value to be written or 0
* index - register index * index - register index
* data - data buffer to hold the read/write values * data - data buffer to hold the read/write values
* size - data size * size - data size
* timeout - control message time out value * timeout - control message time out value
*/ */
static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe,
u8 request, u8 requesttype, u16 value, u16 index, u8 request, u8 requesttype, u16 value, u16 index,
void *data, u16 size, int timeout) void *data, u16 size, int timeout)
...@@ -171,7 +171,7 @@ int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, ...@@ -171,7 +171,7 @@ int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer,
/* write into DPRAM a number of bytes */ /* write into DPRAM a number of bytes */
int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value,
u8 highlow) u8 highlow)
{ {
int ret = 0; int ret = 0;
u8 request; u8 request;
...@@ -287,7 +287,7 @@ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value) ...@@ -287,7 +287,7 @@ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value)
u16 tempword; u16 tempword;
status = ft1000_write_register(ft1000dev, HOST_INTF_BE, status = ft1000_write_register(ft1000dev, HOST_INTF_BE,
FT1000_REG_SUP_CTRL); FT1000_REG_SUP_CTRL);
status = ft1000_read_register(ft1000dev, &tempword, status = ft1000_read_register(ft1000dev, &tempword,
FT1000_REG_SUP_CTRL); FT1000_REG_SUP_CTRL);
...@@ -318,12 +318,12 @@ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value) ...@@ -318,12 +318,12 @@ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value)
} }
/* send a command to ASIC /* send a command to ASIC
* Parameters: ft1000_usb - device structure * Parameters: ft1000_usb - device structure
* ptempbuffer - command buffer * ptempbuffer - command buffer
* size - command buffer size * size - command buffer size
*/ */
int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer,
int size) int size)
{ {
int ret; int ret;
unsigned short temp; unsigned short temp;
...@@ -355,7 +355,7 @@ int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, ...@@ -355,7 +355,7 @@ int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer,
return ret; return ret;
usleep_range(900, 1100); usleep_range(900, 1100);
ret = ft1000_write_register(ft1000dev, FT1000_DB_DPRAM_TX, ret = ft1000_write_register(ft1000dev, FT1000_DB_DPRAM_TX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (ret) if (ret)
return ret; return ret;
usleep_range(900, 1100); usleep_range(900, 1100);
...@@ -399,12 +399,12 @@ int dsp_reload(struct ft1000_usb *ft1000dev) ...@@ -399,12 +399,12 @@ int dsp_reload(struct ft1000_usb *ft1000dev)
msleep(1000); msleep(1000);
status = status =
ft1000_write_register(ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); ft1000_write_register(ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL);
/* Let's check for FEFE */ /* Let's check for FEFE */
status = status =
ft1000_read_dpram32(ft1000dev, FT1000_MAG_DPRAM_FEFE_INDX, ft1000_read_dpram32(ft1000dev, FT1000_MAG_DPRAM_FEFE_INDX,
(u8 *) &templong, 4); (u8 *)&templong, 4);
DEBUG("templong (fefe) = 0x%8x\n", templong); DEBUG("templong (fefe) = 0x%8x\n", templong);
/* call codeloader */ /* call codeloader */
...@@ -465,7 +465,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -465,7 +465,7 @@ static int ft1000_reset_card(struct net_device *dev)
while (list_empty(&info->prov_list) == 0) { while (list_empty(&info->prov_list) == 0) {
DEBUG("ft1000_reset_card:deleting provisioning record\n"); DEBUG("ft1000_reset_card:deleting provisioning record\n");
ptr = ptr =
list_entry(info->prov_list.next, struct prov_record, list); list_entry(info->prov_list.next, struct prov_record, list);
list_del(&ptr->list); list_del(&ptr->list);
kfree(ptr->pprov_data); kfree(ptr->pprov_data);
kfree(ptr); kfree(ptr);
...@@ -484,7 +484,7 @@ static int ft1000_reset_card(struct net_device *dev) ...@@ -484,7 +484,7 @@ static int ft1000_reset_card(struct net_device *dev)
/* Initialize DSP heartbeat area */ /* Initialize DSP heartbeat area */
ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag, ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag,
FT1000_MAG_HI_HO_INDX); FT1000_MAG_HI_HO_INDX);
ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO, (u8 *) &tempword, ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO, (u8 *)&tempword,
FT1000_MAG_HI_HO_INDX); FT1000_MAG_HI_HO_INDX);
DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword); DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword);
...@@ -508,8 +508,8 @@ static void ft1000_usb_transmit_complete(struct urb *urb) ...@@ -508,8 +508,8 @@ static void ft1000_usb_transmit_complete(struct urb *urb)
} }
/* take an ethernet packet and convert it to a Flarion /* take an ethernet packet and convert it to a Flarion
* packet prior to sending it to the ASIC Downlink FIFO. * packet prior to sending it to the ASIC Downlink FIFO.
*/ */
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_info *pInfo = netdev_priv(netdev);
...@@ -545,7 +545,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len) ...@@ -545,7 +545,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len)
hdr.control = 0x00; hdr.control = 0x00;
hdr.checksum = hdr.length ^ hdr.source ^ hdr.destination ^ 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[0], &hdr, sizeof(hdr));
memcpy(&(pFt1000Dev->tx_buf[sizeof(struct pseudo_hdr)]), packet, len); memcpy(&(pFt1000Dev->tx_buf[sizeof(struct pseudo_hdr)]), packet, len);
...@@ -559,7 +559,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len) ...@@ -559,7 +559,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len)
pFt1000Dev->tx_buf, count, pFt1000Dev->tx_buf, count,
ft1000_usb_transmit_complete, (void *)pFt1000Dev); ft1000_usb_transmit_complete, (void *)pFt1000Dev);
t = (u8 *) pFt1000Dev->tx_urb->transfer_buffer; t = (u8 *)pFt1000Dev->tx_urb->transfer_buffer;
ret = usb_submit_urb(pFt1000Dev->tx_urb, GFP_ATOMIC); ret = usb_submit_urb(pFt1000Dev->tx_urb, GFP_ATOMIC);
...@@ -574,9 +574,9 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len) ...@@ -574,9 +574,9 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len)
} }
/* transmit an ethernet packet /* transmit an ethernet packet
* Parameters: skb - socket buffer to be sent * Parameters: skb - socket buffer to be sent
* dev - network device * dev - network device
*/ */
static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ft1000_info *pInfo = netdev_priv(dev); struct ft1000_info *pInfo = netdev_priv(dev);
...@@ -595,10 +595,10 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -595,10 +595,10 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
pipe = pipe =
usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr); usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr);
maxlen = usb_maxpacket(pFt1000Dev->dev, pipe, usb_pipeout(pipe)); maxlen = usb_maxpacket(pFt1000Dev->dev, pipe, usb_pipeout(pipe));
pdata = (u8 *) skb->data; pdata = (u8 *)skb->data;
if (pInfo->mediastate == 0) { if (pInfo->mediastate == 0) {
/* Drop packet is mediastate is down */ /* Drop packet is mediastate is down */
...@@ -814,8 +814,8 @@ int reg_ft1000_netdev(struct ft1000_usb *ft1000dev, ...@@ -814,8 +814,8 @@ int reg_ft1000_netdev(struct ft1000_usb *ft1000dev,
} }
/* take a packet from the FIFO up link and /* take a packet from the FIFO up link and
* convert it into an ethernet packet and deliver it to the IP stack * convert it into an ethernet packet and deliver it to the IP stack
*/ */
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_info *info = urb->context;
...@@ -839,7 +839,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) ...@@ -839,7 +839,7 @@ static int ft1000_copy_up_pkt(struct urb *urb)
len = urb->transfer_buffer_length; len = urb->transfer_buffer_length;
lena = urb->actual_length; lena = urb->actual_length;
chksum = (u16 *) ft1000dev->rx_buf; chksum = (u16 *)ft1000dev->rx_buf;
tempword = *chksum++; tempword = *chksum++;
for (i = 1; i < 7; i++) for (i = 1; i < 7; i++)
...@@ -860,7 +860,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) ...@@ -860,7 +860,7 @@ static int ft1000_copy_up_pkt(struct urb *urb)
return -1; return -1;
} }
pbuffer = (u8 *) skb_put(skb, len + 12); pbuffer = (u8 *)skb_put(skb, len + 12);
/* subtract the number of bytes read already */ /* subtract the number of bytes read already */
ptemp = pbuffer; ptemp = pbuffer;
...@@ -914,7 +914,7 @@ static int ft1000_submit_rx_urb(struct ft1000_info *info) ...@@ -914,7 +914,7 @@ static int ft1000_submit_rx_urb(struct ft1000_info *info)
usb_rcvbulkpipe(pFt1000Dev->dev, usb_rcvbulkpipe(pFt1000Dev->dev,
pFt1000Dev->bulk_in_endpointAddr), pFt1000Dev->bulk_in_endpointAddr),
pFt1000Dev->rx_buf, MAX_BUF_SIZE, pFt1000Dev->rx_buf, MAX_BUF_SIZE,
(usb_complete_t) ft1000_copy_up_pkt, info); (usb_complete_t)ft1000_copy_up_pkt, info);
result = usb_submit_urb(pFt1000Dev->rx_urb, GFP_ATOMIC); result = usb_submit_urb(pFt1000Dev->rx_urb, GFP_ATOMIC);
...@@ -976,10 +976,10 @@ static int ft1000_chkcard(struct ft1000_usb *dev) ...@@ -976,10 +976,10 @@ static int ft1000_chkcard(struct ft1000_usb *dev)
} }
/* read a message from the dpram area. /* read a message from the dpram area.
* Input: * Input:
* dev - network device structure * dev - network device structure
* pbuffer - caller supply address to buffer * pbuffer - caller supply address to buffer
*/ */
static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer, static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer,
int maxsz) int maxsz)
{ {
...@@ -990,46 +990,46 @@ static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer, ...@@ -990,46 +990,46 @@ static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer,
u16 tempword; u16 tempword;
ret = ret =
ft1000_read_dpram16(dev, FT1000_MAG_PH_LEN, (u8 *) &size, ft1000_read_dpram16(dev, FT1000_MAG_PH_LEN, (u8 *)&size,
FT1000_MAG_PH_LEN_INDX); FT1000_MAG_PH_LEN_INDX);
size = ntohs(size) + PSEUDOSZ; size = ntohs(size) + PSEUDOSZ;
if (size > maxsz) { if (size > maxsz) {
DEBUG("FT1000:ft1000_receive_cmd:Invalid command length = %d\n", DEBUG("FT1000:ft1000_receive_cmd:Invalid command length = %d\n",
size); size);
return FALSE; return FALSE;
} }
ppseudohdr = (u16 *) pbuffer; ppseudohdr = (u16 *)pbuffer;
ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE, ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE,
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
ret = ret =
ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
pbuffer++; pbuffer++;
ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE + 1, ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE + 1,
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
for (i = 0; i <= (size >> 2); i++) { for (i = 0; i <= (size >> 2); i++) {
ret = ret =
ft1000_read_register(dev, pbuffer, ft1000_read_register(dev, pbuffer,
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
pbuffer++; pbuffer++;
ret = ret =
ft1000_read_register(dev, pbuffer, ft1000_read_register(dev, pbuffer,
FT1000_REG_MAG_DPDATAH); FT1000_REG_MAG_DPDATAH);
pbuffer++; pbuffer++;
} }
/* copy odd aligned word */ /* copy odd aligned word */
ret = ret =
ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL); ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL);
pbuffer++; pbuffer++;
ret = ret =
ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
pbuffer++; pbuffer++;
if (size & 0x0001) { if (size & 0x0001) {
/* copy odd byte from fifo */ /* copy odd byte from fifo */
ret = ret =
ft1000_read_register(dev, &tempword, ft1000_read_register(dev, &tempword,
FT1000_REG_DPRAM_DATA); FT1000_REG_DPRAM_DATA);
*pbuffer = ntohs(tempword); *pbuffer = ntohs(tempword);
} }
/* Check if pseudo header checksum is good /* Check if pseudo header checksum is good
...@@ -1066,7 +1066,7 @@ static int ft1000_dsp_prov(void *arg) ...@@ -1066,7 +1066,7 @@ static int ft1000_dsp_prov(void *arg)
/* Check if doorbell is available */ /* Check if doorbell is available */
DEBUG("check if doorbell is cleared\n"); DEBUG("check if doorbell is cleared\n");
status = status =
ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
if (status) { if (status) {
DEBUG("ft1000_dsp_prov::ft1000_read_register error\n"); DEBUG("ft1000_dsp_prov::ft1000_read_register error\n");
break; break;
...@@ -1088,13 +1088,13 @@ static int ft1000_dsp_prov(void *arg) ...@@ -1088,13 +1088,13 @@ static int ft1000_dsp_prov(void *arg)
/* Send provisioning data */ /* Send provisioning data */
ptr = ptr =
list_entry(info->prov_list.next, struct prov_record, list_entry(info->prov_list.next, struct prov_record,
list); list);
len = *(u16 *) ptr->pprov_data; len = *(u16 *)ptr->pprov_data;
len = htons(len); len = htons(len);
len += PSEUDOSZ; len += PSEUDOSZ;
pmsg = (u16 *) ptr->pprov_data; pmsg = (u16 *)ptr->pprov_data;
ppseudo_hdr = (struct pseudo_hdr *)pmsg; ppseudo_hdr = (struct pseudo_hdr *)pmsg;
/* Insert slow queue sequence number */ /* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->seq_num = info->squeseqnum++;
...@@ -1109,12 +1109,12 @@ static int ft1000_dsp_prov(void *arg) ...@@ -1109,12 +1109,12 @@ static int ft1000_dsp_prov(void *arg)
memcpy(&TempShortBuf[2], ppseudo_hdr, len); memcpy(&TempShortBuf[2], ppseudo_hdr, len);
status = status =
ft1000_write_dpram32(dev, 0, ft1000_write_dpram32(dev, 0,
(u8 *) &TempShortBuf[0], (u8 *)&TempShortBuf[0],
(unsigned short)(len + 2)); (unsigned short)(len + 2));
status = status =
ft1000_write_register(dev, FT1000_DB_DPRAM_TX, ft1000_write_register(dev, FT1000_DB_DPRAM_TX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
list_del(&ptr->list); list_del(&ptr->list);
kfree(ptr->pprov_data); kfree(ptr->pprov_data);
...@@ -1229,12 +1229,12 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1229,12 +1229,12 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
if (ntohs(pdspinitmsg->length) == if (ntohs(pdspinitmsg->length) ==
(sizeof(struct dsp_init_msg) - 20)) { (sizeof(struct dsp_init_msg) - 20)) {
memcpy(info->ProductMode, pdspinitmsg->ProductMode, memcpy(info->ProductMode, pdspinitmsg->ProductMode,
MODESZ); MODESZ);
memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ); memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ);
memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, memcpy(info->RfCalDate, pdspinitmsg->RfCalDate,
CALDATESZ); CALDATESZ);
DEBUG("RFCalVer = 0x%2x 0x%2x\n", info->RfCalVer[0], DEBUG("RFCalVer = 0x%2x 0x%2x\n", info->RfCalVer[0],
info->RfCalVer[1]); info->RfCalVer[1]);
} }
break; break;
} }
...@@ -1252,7 +1252,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1252,7 +1252,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
} else { } else {
dev->fProvComplete = true; dev->fProvComplete = true;
status = ft1000_write_register(dev, FT1000_DB_HB, status = ft1000_write_register(dev, FT1000_DB_HB,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
DEBUG("FT1000:drivermsg:No more DSP provisioning data in dsp image\n"); DEBUG("FT1000:drivermsg:No more DSP provisioning data in dsp image\n");
} }
DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n"); DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n");
...@@ -1264,7 +1264,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1264,7 +1264,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
tempword = ntohs(pdrvmsg->length); tempword = ntohs(pdrvmsg->length);
info->DSPInfoBlklen = tempword; info->DSPInfoBlklen = tempword;
if (tempword < (MAX_DSP_SESS_REC - 4)) { if (tempword < (MAX_DSP_SESS_REC - 4)) {
pmsg = (u16 *) &pdrvmsg->data[0]; pmsg = (u16 *)&pdrvmsg->data[0];
for (i = 0; i < ((tempword + 1) / 2); i++) { for (i = 0; i < ((tempword + 1) / 2); i++) {
DEBUG("FT1000:drivermsg:dsp info data = 0x%x\n", *pmsg); DEBUG("FT1000:drivermsg:dsp info data = 0x%x\n", *pmsg);
info->DSPInfoBlk[i + 10] = *pmsg++; info->DSPInfoBlk[i + 10] = *pmsg++;
...@@ -1281,27 +1281,27 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1281,27 +1281,27 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
/* allow any outstanding ioctl to finish */ /* allow any outstanding ioctl to finish */
mdelay(10); mdelay(10);
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) { if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(10); mdelay(10);
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) { if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(10); mdelay(10);
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) if (tempword & FT1000_DB_DPRAM_TX)
break; break;
} }
} }
/* Put message into Slow Queue Form Pseudo header */ /* Put message into Slow Queue Form Pseudo header */
pmsg = (u16 *) info->DSPInfoBlk; pmsg = (u16 *)info->DSPInfoBlk;
*pmsg++ = 0; *pmsg++ = 0;
*pmsg++ = htons(info->DSPInfoBlklen + 20 + info->DSPInfoBlklen); *pmsg++ = htons(info->DSPInfoBlklen + 20 + info->DSPInfoBlklen);
ppseudo_hdr = ppseudo_hdr =
(struct pseudo_hdr *)(u16 *) &info->DSPInfoBlk[2]; (struct pseudo_hdr *)(u16 *)&info->DSPInfoBlk[2];
ppseudo_hdr->length = htons(info->DSPInfoBlklen + 4 ppseudo_hdr->length = htons(info->DSPInfoBlklen + 4
+ info->DSPInfoBlklen); + info->DSPInfoBlklen);
ppseudo_hdr->source = 0x10; ppseudo_hdr->source = 0x10;
ppseudo_hdr->destination = 0x20; ppseudo_hdr->destination = 0x20;
ppseudo_hdr->portdest = 0; ppseudo_hdr->portdest = 0;
...@@ -1323,10 +1323,10 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1323,10 +1323,10 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
info->DSPInfoBlk[10] = 0x7200; info->DSPInfoBlk[10] = 0x7200;
info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen); info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen);
status = ft1000_write_dpram32(dev, 0, status = ft1000_write_dpram32(dev, 0,
(u8 *)&info->DSPInfoBlk[0], (u8 *)&info->DSPInfoBlk[0],
(unsigned short)(info->DSPInfoBlklen + 22)); (unsigned short)(info->DSPInfoBlklen + 22));
status = ft1000_write_register(dev, FT1000_DB_DPRAM_TX, status = ft1000_write_register(dev, FT1000_DB_DPRAM_TX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
dev->DrvMsgPend = 0; dev->DrvMsgPend = 0;
break; break;
} }
...@@ -1337,17 +1337,17 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1337,17 +1337,17 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
/* allow any outstanding ioctl to finish */ /* allow any outstanding ioctl to finish */
mdelay(10); mdelay(10);
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) { if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(10); mdelay(10);
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) if (tempword & FT1000_DB_DPRAM_TX)
mdelay(10); mdelay(10);
} }
if ((tempword & FT1000_DB_DPRAM_TX) == 0) { if ((tempword & FT1000_DB_DPRAM_TX) == 0) {
/* Put message into Slow Queue Form Pseudo header */ /* Put message into Slow Queue Form Pseudo header */
pmsg = (u16 *) &tempbuffer[0]; pmsg = (u16 *)&tempbuffer[0];
ppseudo_hdr = (struct pseudo_hdr *)pmsg; ppseudo_hdr = (struct pseudo_hdr *)pmsg;
ppseudo_hdr->length = htons(0x0012); ppseudo_hdr->length = htons(0x0012);
ppseudo_hdr->source = 0x10; ppseudo_hdr->source = 0x10;
...@@ -1368,7 +1368,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1368,7 +1368,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
for (i = 1; i < 7; i++) for (i = 1; i < 7; i++)
ppseudo_hdr->checksum ^= *pmsg++; ppseudo_hdr->checksum ^= *pmsg++;
pmsg = (u16 *) &tempbuffer[16]; pmsg = (u16 *)&tempbuffer[16];
*pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
*pmsg++ = htons(0x000e); *pmsg++ = htons(0x000e);
*pmsg++ = htons(info->DSP_TIME[0]); *pmsg++ = htons(info->DSP_TIME[0]);
...@@ -1384,7 +1384,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) ...@@ -1384,7 +1384,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size)
*pmsg++ = htons(info->DrvErrNum); *pmsg++ = htons(info->DrvErrNum);
status = card_send_command(dev, (unsigned char *)&tempbuffer[0], status = card_send_command(dev, (unsigned char *)&tempbuffer[0],
(u16)(0x0012 + PSEUDOSZ)); (u16)(0x0012 + PSEUDOSZ));
if (status) if (status)
goto out; goto out;
info->DrvErrNum = 0; info->DrvErrNum = 0;
...@@ -1412,9 +1412,9 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev) ...@@ -1412,9 +1412,9 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev)
for (i = 0; i < MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if ((dev->app_info[i].DspBCMsgFlag) if ((dev->app_info[i].DspBCMsgFlag)
&& (dev->app_info[i].fileobject) && (dev->app_info[i].fileobject)
&& (dev->app_info[i].NumOfMsg && (dev->app_info[i].NumOfMsg
< MAX_MSG_LIMIT)) { < MAX_MSG_LIMIT)) {
pdpram_blk = ft1000_get_buffer(&freercvpool); pdpram_blk = ft1000_get_buffer(&freercvpool);
if (pdpram_blk == NULL) { if (pdpram_blk == NULL) {
DEBUG("Out of memory in free receive command pool\n"); DEBUG("Out of memory in free receive command pool\n");
...@@ -1422,18 +1422,18 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev) ...@@ -1422,18 +1422,18 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev)
return -1; return -1;
} }
if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer, if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer,
MAX_CMD_SQSIZE)) { MAX_CMD_SQSIZE)) {
/* Put message into the /* Put message into the
* appropriate application block * appropriate application block
*/ */
dev->app_info[i].nRxMsg++; dev->app_info[i].nRxMsg++;
spin_lock_irqsave(&free_buff_lock, flags); spin_lock_irqsave(&free_buff_lock, flags);
list_add_tail(&pdpram_blk->list, list_add_tail(&pdpram_blk->list,
&dev->app_info[i] .app_sqlist); &dev->app_info[i] .app_sqlist);
dev->app_info[i].NumOfMsg++; dev->app_info[i].NumOfMsg++;
spin_unlock_irqrestore(&free_buff_lock, flags); spin_unlock_irqrestore(&free_buff_lock, flags);
wake_up_interruptible(&dev->app_info[i] wake_up_interruptible(&dev->app_info[i]
.wait_dpram_msg); .wait_dpram_msg);
} else { } else {
dev->app_info[i].nRxMsgMiss++; dev->app_info[i].nRxMsgMiss++;
ft1000_free_buffer(pdpram_blk, &freercvpool); ft1000_free_buffer(pdpram_blk, &freercvpool);
...@@ -1461,7 +1461,7 @@ static int handle_misc_portid(struct ft1000_usb *dev) ...@@ -1461,7 +1461,7 @@ static int handle_misc_portid(struct ft1000_usb *dev)
/* Search for correct application block */ /* Search for correct application block */
for (i = 0; i < MAX_NUM_APP; i++) { for (i = 0; i < MAX_NUM_APP; i++) {
if (dev->app_info[i].app_id == ((struct pseudo_hdr *) if (dev->app_info[i].app_id == ((struct pseudo_hdr *)
pdpram_blk->pbuffer)->portdest) pdpram_blk->pbuffer)->portdest)
break; break;
} }
if (i == MAX_NUM_APP) { if (i == MAX_NUM_APP) {
...@@ -1502,14 +1502,14 @@ int ft1000_poll(void *dev_id) ...@@ -1502,14 +1502,14 @@ int ft1000_poll(void *dev_id)
if (!status) { if (!status) {
if (tempword & FT1000_DB_DPRAM_RX) { if (tempword & FT1000_DB_DPRAM_RX) {
status = ft1000_read_dpram16(dev, status = ft1000_read_dpram16(dev,
0x200, (u8 *)&data, 0); 0x200, (u8 *)&data, 0);
size = ntohs(data) + 16 + 2; size = ntohs(data) + 16 + 2;
if (size % 4) { if (size % 4) {
modulo = 4 - (size % 4); modulo = 4 - (size % 4);
size = size + modulo; size = size + modulo;
} }
status = ft1000_read_dpram16(dev, 0x201, status = ft1000_read_dpram16(dev, 0x201,
(u8 *)&portid, 1); (u8 *)&portid, 1);
portid &= 0xff; portid &= 0xff;
if (size < MAX_CMD_SQSIZE) { if (size < MAX_CMD_SQSIZE) {
switch (portid) { switch (portid) {
...@@ -1529,18 +1529,18 @@ int ft1000_poll(void *dev_id) ...@@ -1529,18 +1529,18 @@ int ft1000_poll(void *dev_id)
} else } else
DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size); DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size);
status = ft1000_write_register(dev, status = ft1000_write_register(dev,
FT1000_DB_DPRAM_RX, FT1000_DB_DPRAM_RX,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
} else if (tempword & FT1000_DSP_ASIC_RESET) { } else if (tempword & FT1000_DSP_ASIC_RESET) {
/* Let's reset the ASIC from the Host side as well */ /* Let's reset the ASIC from the Host side as well */
status = ft1000_write_register(dev, ASIC_RESET_BIT, status = ft1000_write_register(dev, ASIC_RESET_BIT,
FT1000_REG_RESET); FT1000_REG_RESET);
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_RESET); FT1000_REG_RESET);
i = 0; i = 0;
while (tempword & ASIC_RESET_BIT) { while (tempword & ASIC_RESET_BIT) {
status = ft1000_read_register(dev, &tempword, status = ft1000_read_register(dev, &tempword,
FT1000_REG_RESET); FT1000_REG_RESET);
usleep_range(9000, 11000); usleep_range(9000, 11000);
i++; i++;
if (i == 100) if (i == 100)
...@@ -1553,51 +1553,51 @@ int ft1000_poll(void *dev_id) ...@@ -1553,51 +1553,51 @@ int ft1000_poll(void *dev_id)
usleep_range(9000, 11000); usleep_range(9000, 11000);
/* Program WMARK register */ /* Program WMARK register */
status = ft1000_write_register(dev, 0x600, status = ft1000_write_register(dev, 0x600,
FT1000_REG_MAG_WATERMARK); FT1000_REG_MAG_WATERMARK);
/* clear ASIC reset doorbell */ /* clear ASIC reset doorbell */
status = ft1000_write_register(dev, status = ft1000_write_register(dev,
FT1000_DSP_ASIC_RESET, FT1000_DSP_ASIC_RESET,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
usleep_range(9000, 11000); usleep_range(9000, 11000);
} else if (tempword & FT1000_ASIC_RESET_REQ) { } else if (tempword & FT1000_ASIC_RESET_REQ) {
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n"); DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n");
/* clear ASIC reset request from DSP */ /* clear ASIC reset request from DSP */
status = ft1000_write_register(dev, status = ft1000_write_register(dev,
FT1000_ASIC_RESET_REQ, FT1000_ASIC_RESET_REQ,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
status = ft1000_write_register(dev, HOST_INTF_BE, status = ft1000_write_register(dev, HOST_INTF_BE,
FT1000_REG_SUP_CTRL); FT1000_REG_SUP_CTRL);
/* copy dsp session record from Adapter block */ /* copy dsp session record from Adapter block */
status = ft1000_write_dpram32(dev, 0, status = ft1000_write_dpram32(dev, 0,
(u8 *)&info->DSPSess.Rec[0], 1024); (u8 *)&info->DSPSess.Rec[0], 1024);
status = ft1000_write_register(dev, 0x600, status = ft1000_write_register(dev, 0x600,
FT1000_REG_MAG_WATERMARK); FT1000_REG_MAG_WATERMARK);
/* ring doorbell to tell DSP that /* ring doorbell to tell DSP that
* ASIC is out of reset * ASIC is out of reset
* */ * */
status = ft1000_write_register(dev, status = ft1000_write_register(dev,
FT1000_ASIC_RESET_DSP, FT1000_ASIC_RESET_DSP,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
} else if (tempword & FT1000_DB_COND_RESET) { } else if (tempword & FT1000_DB_COND_RESET) {
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n");
if (!dev->fAppMsgPend) { if (!dev->fAppMsgPend) {
/* Reset ASIC and DSP */ /* Reset ASIC and DSP */
status = ft1000_read_dpram16(dev, status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER0, FT1000_MAG_DSP_TIMER0,
(u8 *)&(info->DSP_TIME[0]), (u8 *)&(info->DSP_TIME[0]),
FT1000_MAG_DSP_TIMER0_INDX); FT1000_MAG_DSP_TIMER0_INDX);
status = ft1000_read_dpram16(dev, status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER1, FT1000_MAG_DSP_TIMER1,
(u8 *)&(info->DSP_TIME[1]), (u8 *)&(info->DSP_TIME[1]),
FT1000_MAG_DSP_TIMER1_INDX); FT1000_MAG_DSP_TIMER1_INDX);
status = ft1000_read_dpram16(dev, status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER2, FT1000_MAG_DSP_TIMER2,
(u8 *)&(info->DSP_TIME[2]), (u8 *)&(info->DSP_TIME[2]),
FT1000_MAG_DSP_TIMER2_INDX); FT1000_MAG_DSP_TIMER2_INDX);
status = ft1000_read_dpram16(dev, status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER3, FT1000_MAG_DSP_TIMER3,
(u8 *)&(info->DSP_TIME[3]), (u8 *)&(info->DSP_TIME[3]),
FT1000_MAG_DSP_TIMER3_INDX); FT1000_MAG_DSP_TIMER3_INDX);
info->CardReady = 0; info->CardReady = 0;
info->DrvErrNum = DSP_CONDRESET_INFO; info->DrvErrNum = DSP_CONDRESET_INFO;
DEBUG("ft1000_hw:DSP conditional reset requested\n"); DEBUG("ft1000_hw:DSP conditional reset requested\n");
...@@ -1607,7 +1607,7 @@ int ft1000_poll(void *dev_id) ...@@ -1607,7 +1607,7 @@ int ft1000_poll(void *dev_id)
dev->fCondResetPend = true; dev->fCondResetPend = true;
} }
ft1000_write_register(dev, FT1000_DB_COND_RESET, ft1000_write_register(dev, FT1000_DB_COND_RESET,
FT1000_REG_DOORBELL); FT1000_REG_DOORBELL);
} }
} }
return 0; return 0;
......
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* FT1000 driver for Flarion Flash OFDM NIC Device * FT1000 driver for Flarion Flash OFDM NIC Device
* *
* Copyright (C) 2002 Flarion Technologies, All rights reserved. * Copyright (C) 2002 Flarion Technologies, All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any * Software Foundation; either version 2 of the License, or (at your option) any
* later version. This program is distributed in the hope that it will be useful, * later version. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. You should have received a copy of the GNU General Public * more details. You should have received a copy of the GNU General Public
* License along with this program; if not, write to the * License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - * Free Software Foundation, Inc., 59 Temple Place -
* Suite 330, Boston, MA 02111-1307, USA. * Suite 330, Boston, MA 02111-1307, USA.
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* *
* File: ft1000_ioctl.h * File: ft1000_ioctl.h
* *
* Description: Common structures and defines relating to IOCTL * Description: Common structures and defines relating to IOCTL
* *
* History: * History:
* 11/5/02 Whc Created. * 11/5/02 Whc Created.
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
#ifndef _FT1000IOCTLH_ #ifndef _FT1000IOCTLH_
#define _FT1000IOCTLH_ #define _FT1000IOCTLH_
...@@ -94,8 +94,8 @@ struct IOCTL_DPRAM_COMMAND { ...@@ -94,8 +94,8 @@ struct IOCTL_DPRAM_COMMAND {
} __packed; } __packed;
/* /*
* Custom IOCTL command codes * Custom IOCTL command codes
*/ */
#define FT1000_MAGIC_CODE 'F' #define FT1000_MAGIC_CODE 'F'
#define IOCTL_REGISTER_CMD 0 #define IOCTL_REGISTER_CMD 0
...@@ -106,8 +106,8 @@ struct IOCTL_DPRAM_COMMAND { ...@@ -106,8 +106,8 @@ struct IOCTL_DPRAM_COMMAND {
#define IOCTL_CONNECT 10 #define IOCTL_CONNECT 10
#define IOCTL_DISCONNECT 11 #define IOCTL_DISCONNECT 11
#define IOCTL_FT1000_GET_DSP_STAT _IOR(FT1000_MAGIC_CODE, \ #define IOCTL_FT1000_GET_DSP_STAT _IOR(FT1000_MAGIC_CODE, \
IOCTL_GET_DSP_STAT_CMD, \ IOCTL_GET_DSP_STAT_CMD, \
struct IOCTL_GET_DSP_STAT) struct IOCTL_GET_DSP_STAT)
#define IOCTL_FT1000_GET_VER _IOR(FT1000_MAGIC_CODE, IOCTL_GET_VER_CMD, \ #define IOCTL_FT1000_GET_VER _IOR(FT1000_MAGIC_CODE, IOCTL_GET_VER_CMD, \
struct IOCTL_GET_VER) struct IOCTL_GET_VER)
......
...@@ -109,8 +109,8 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -109,8 +109,8 @@ static int ft1000_probe(struct usb_interface *interface,
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
endpoint = endpoint =
(struct usb_endpoint_descriptor *)&iface_desc-> (struct usb_endpoint_descriptor *)&iface_desc->
endpoint[i].desc; endpoint[i].desc;
DEBUG("endpoint %d\n", i); DEBUG("endpoint %d\n", i);
DEBUG("bEndpointAddress=%x, bmAttributes=%x\n", DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
endpoint->bEndpointAddress, endpoint->bmAttributes); endpoint->bEndpointAddress, endpoint->bmAttributes);
...@@ -118,7 +118,7 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -118,7 +118,7 @@ static int ft1000_probe(struct usb_interface *interface,
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) { USB_ENDPOINT_XFER_BULK)) {
ft1000dev->bulk_in_endpointAddr = ft1000dev->bulk_in_endpointAddr =
endpoint->bEndpointAddress; endpoint->bEndpointAddress;
DEBUG("ft1000_probe: in: %d\n", DEBUG("ft1000_probe: in: %d\n",
endpoint->bEndpointAddress); endpoint->bEndpointAddress);
} }
...@@ -127,7 +127,7 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -127,7 +127,7 @@ static int ft1000_probe(struct usb_interface *interface,
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) { USB_ENDPOINT_XFER_BULK)) {
ft1000dev->bulk_out_endpointAddr = ft1000dev->bulk_out_endpointAddr =
endpoint->bEndpointAddress; endpoint->bEndpointAddress;
DEBUG("ft1000_probe: out: %d\n", DEBUG("ft1000_probe: out: %d\n",
endpoint->bEndpointAddress); endpoint->bEndpointAddress);
} }
...@@ -172,7 +172,7 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -172,7 +172,7 @@ static int ft1000_probe(struct usb_interface *interface,
gPollingfailed = false; gPollingfailed = false;
ft1000dev->pPollThread = ft1000dev->pPollThread =
kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll"); kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
if (IS_ERR(ft1000dev->pPollThread)) { if (IS_ERR(ft1000dev->pPollThread)) {
ret = PTR_ERR(ft1000dev->pPollThread); ret = PTR_ERR(ft1000dev->pPollThread);
...@@ -218,7 +218,7 @@ static void ft1000_disconnect(struct usb_interface *interface) ...@@ -218,7 +218,7 @@ static void ft1000_disconnect(struct usb_interface *interface)
DEBUG("ft1000_disconnect is called\n"); DEBUG("ft1000_disconnect is called\n");
pft1000info = (struct ft1000_info *) usb_get_intfdata(interface); pft1000info = (struct ft1000_info *)usb_get_intfdata(interface);
DEBUG("In disconnect pft1000info=%p\n", pft1000info); DEBUG("In disconnect pft1000info=%p\n", pft1000info);
if (pft1000info) { if (pft1000info) {
...@@ -233,7 +233,7 @@ static void ft1000_disconnect(struct usb_interface *interface) ...@@ -233,7 +233,7 @@ static void ft1000_disconnect(struct usb_interface *interface)
ft1000_destroy_dev(ft1000dev->net); ft1000_destroy_dev(ft1000dev->net);
unregister_netdev(ft1000dev->net); unregister_netdev(ft1000dev->net);
DEBUG DEBUG
("ft1000_disconnect: network device unregistered\n"); ("ft1000_disconnect: network device unregistered\n");
free_netdev(ft1000dev->net); free_netdev(ft1000dev->net);
} }
......
...@@ -137,7 +137,7 @@ extern spinlock_t free_buff_lock; ...@@ -137,7 +137,7 @@ extern spinlock_t free_buff_lock;
int ft1000_create_dev(struct ft1000_usb *dev); int ft1000_create_dev(struct ft1000_usb *dev);
void ft1000_destroy_dev(struct net_device *dev); void ft1000_destroy_dev(struct net_device *dev);
extern int card_send_command(struct ft1000_usb *ft1000dev, extern int card_send_command(struct ft1000_usb *ft1000dev,
void *ptempbuffer, int size); void *ptempbuffer, int size);
struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist); struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist); void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册