Commit 3aa2303a authored by Ondrej Zary's avatar Ondrej Zary Committed by Greg Kroah-Hartman

staging: ft1000: unify struct ft1000_info between USB and PCMCIA drivers

Unify struct ft1000_info between ft1000-usb and ft1000-pcmcia and move it to
common ft1000.h.
Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Tested-by: default avatarMarek Belisko <marek.belisko@open-nandra.com>
Review-by: default avatarMarek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8d915d8c
...@@ -31,41 +31,10 @@ ...@@ -31,41 +31,10 @@
#define SUCCESS 0x00 #define SUCCESS 0x00
#define FAILURE 0x01 #define FAILURE 0x01
struct ft1000_info { struct ft1000_pcmcia {
struct net_device_stats stats;
u16 DrvErrNum;
u16 AsicID;
int PktIntfErr; int PktIntfErr;
int CardReady;
int registered;
int mediastate;
u16 packetseqnum; u16 packetseqnum;
u8 squeseqnum; /* sequence number on slow queue */
spinlock_t dpram_lock;
u16 fifo_cnt;
u8 DspVer[DSPVERSZ]; /* DSP version number */
u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
u8 Sku[SKUSZ]; /* SKU */
u8 eui64[EUISZ]; /* EUI64 */
time_t ConTm; /* Connection Time */
u16 LedStat;
u16 ConStat;
u16 ProgConStat;
u8 ProductMode[MODESZ];
u8 RfCalVer[CALVERSZ];
u8 RfCalDate[CALDATESZ];
u16 DSP_TIME[4];
struct list_head prov_list;
u16 DSPInfoBlklen;
int (*ft1000_reset)(void *);
void *link; void *link;
u16 DSPInfoBlk[MAX_DSP_SESS_REC];
union {
u16 Rec[MAX_DSP_SESS_REC];
u32 MagRec[MAX_DSP_SESS_REC/2];
} DSPSess;
struct proc_dir_entry *proc_ft1000;
char netdevname[IFNAMSIZ];
}; };
struct pcmcia_device; struct pcmcia_device;
......
...@@ -328,11 +328,12 @@ static void ft1000_disable_interrupts(struct net_device *dev) ...@@ -328,11 +328,12 @@ static void ft1000_disable_interrupts(struct net_device *dev)
static void ft1000_reset_asic(struct net_device *dev) static void ft1000_reset_asic(struct net_device *dev)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
struct ft1000_pcmcia *pcmcia = info->priv;
u16 tempword; u16 tempword;
DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n"); DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n");
(*info->ft1000_reset) (info->link); (*info->ft1000_reset) (pcmcia->link);
// Let's use the register provided by the Magnemite ASIC to reset the // Let's use the register provided by the Magnemite ASIC to reset the
// ASIC and DSP. // ASIC and DSP.
...@@ -1397,12 +1398,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) ...@@ -1397,12 +1398,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev)
static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
struct ft1000_pcmcia *pcmcia = info->priv;
u16 i; u16 i;
u32 templong; u32 templong;
u16 tempword; u16 tempword;
DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n"); DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n");
if (info->PktIntfErr > MAX_PH_ERR) { if (pcmcia->PktIntfErr > MAX_PH_ERR) {
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);
...@@ -1491,7 +1493,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1491,7 +1493,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
FIFO_FLUSH_BADCNT; FIFO_FLUSH_BADCNT;
} else { } else {
// Let's assume that we really flush the FIFO // Let's assume that we really flush the FIFO
info->PktIntfErr++; pcmcia->PktIntfErr++;
return; return;
} }
} else { } else {
...@@ -1522,7 +1524,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) ...@@ -1522,7 +1524,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword); DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword);
} }
if (DrvErrNum) { if (DrvErrNum) {
info->PktIntfErr++; pcmcia->PktIntfErr++;
} }
} }
} }
...@@ -1731,6 +1733,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) ...@@ -1731,6 +1733,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
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)
{ {
struct ft1000_info *info = netdev_priv(dev); struct ft1000_info *info = netdev_priv(dev);
struct ft1000_pcmcia *pcmcia = info->priv;
union { union {
struct pseudo_hdr blk; struct pseudo_hdr blk;
u16 buff[sizeof(struct pseudo_hdr) >> 1]; u16 buff[sizeof(struct pseudo_hdr) >> 1];
...@@ -1780,7 +1783,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ...@@ -1780,7 +1783,7 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
pseudo.blk.control = 0; pseudo.blk.control = 0;
pseudo.blk.rsvd1 = 0; pseudo.blk.rsvd1 = 0;
pseudo.blk.seq_num = 0; pseudo.blk.seq_num = 0;
pseudo.blk.rsvd2 = info->packetseqnum++; pseudo.blk.rsvd2 = pcmcia->packetseqnum++;
pseudo.blk.qos_class = 0; pseudo.blk.qos_class = 0;
/* Calculate pseudo header checksum */ /* Calculate pseudo header checksum */
pseudo.blk.checksum = pseudo.buff[0]; pseudo.blk.checksum = pseudo.buff[0];
...@@ -2058,6 +2061,8 @@ void stop_ft1000_card(struct net_device *dev) ...@@ -2058,6 +2061,8 @@ void stop_ft1000_card(struct net_device *dev)
kfree(ptr); kfree(ptr);
} }
kfree(info->priv);
if (info->registered) { if (info->registered) {
unregister_netdev(dev); unregister_netdev(dev);
info->registered = 0; info->registered = 0;
...@@ -2100,6 +2105,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2100,6 +2105,7 @@ 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 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
...@@ -2141,10 +2147,13 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, ...@@ -2141,10 +2147,13 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,
memset(&info->stats, 0, sizeof(struct net_device_stats)); memset(&info->stats, 0, sizeof(struct net_device_stats));
info->priv = kzalloc(sizeof(struct ft1000_pcmcia), GFP_KERNEL);
pcmcia = info->priv;
pcmcia->link = link;
spin_lock_init(&info->dpram_lock); spin_lock_init(&info->dpram_lock);
info->DrvErrNum = 0; info->DrvErrNum = 0;
info->registered = 1; info->registered = 1;
info->link = link;
info->ft1000_reset = ft1000_reset; info->ft1000_reset = ft1000_reset;
info->mediastate = 0; info->mediastate = 0;
info->fifo_cnt = 0; info->fifo_cnt = 0;
......
...@@ -175,8 +175,8 @@ static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, ...@@ -175,8 +175,8 @@ static int ft1000NotifyProc(struct notifier_block *this, unsigned long event,
switch (event) { switch (event) {
case NETDEV_CHANGENAME: case NETDEV_CHANGENAME:
remove_proc_entry(info->netdevname, info->proc_ft1000); remove_proc_entry(info->netdevname, info->ft1000_proc_dir);
create_proc_read_entry(dev->name, 0644, info->proc_ft1000, create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir,
ft1000ReadProc, dev); ft1000ReadProc, dev);
snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name);
break; break;
...@@ -194,8 +194,8 @@ void ft1000InitProc(struct net_device *dev) ...@@ -194,8 +194,8 @@ void ft1000InitProc(struct net_device *dev)
info = netdev_priv(dev); info = netdev_priv(dev);
info->proc_ft1000 = proc_mkdir(FT1000_PROC, init_net.proc_net); info->ft1000_proc_dir = proc_mkdir(FT1000_PROC, init_net.proc_net);
create_proc_read_entry(dev->name, 0644, info->proc_ft1000, create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir,
ft1000ReadProc, dev); ft1000ReadProc, dev);
snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name);
register_netdevice_notifier(&ft1000_netdev_notifier); register_netdevice_notifier(&ft1000_netdev_notifier);
...@@ -207,7 +207,7 @@ void ft1000CleanupProc(struct net_device *dev) ...@@ -207,7 +207,7 @@ void ft1000CleanupProc(struct net_device *dev)
info = netdev_priv(dev); info = netdev_priv(dev);
remove_proc_entry(dev->name, info->proc_ft1000); remove_proc_entry(dev->name, info->ft1000_proc_dir);
remove_proc_entry(FT1000_PROC, init_net.proc_net); remove_proc_entry(FT1000_PROC, init_net.proc_net);
unregister_netdevice_notifier(&ft1000_netdev_notifier); unregister_netdevice_notifier(&ft1000_netdev_notifier);
} }
...@@ -188,7 +188,6 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) ...@@ -188,7 +188,6 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value)
u16 handshake; u16 handshake;
int loopcnt; int loopcnt;
u32 status = 0; u32 status = 0;
struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
loopcnt = 0; loopcnt = 0;
...@@ -196,10 +195,10 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) ...@@ -196,10 +195,10 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value)
/* 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 (pft1000info->fcodeldr) { if (ft1000dev->fcodeldr) {
DEBUG(" get_handshake: fcodeldr is %d\n", DEBUG(" get_handshake: fcodeldr is %d\n",
pft1000info->fcodeldr); ft1000dev->fcodeldr);
pft1000info->fcodeldr = 0; ft1000dev->fcodeldr = 0;
status = check_usb_db(ft1000dev); status = check_usb_db(ft1000dev);
if (status != STATUS_SUCCESS) { if (status != STATUS_SUCCESS) {
DEBUG("get_handshake: check_usb_db failed\n"); DEBUG("get_handshake: check_usb_db failed\n");
...@@ -270,29 +269,28 @@ static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value ...@@ -270,29 +269,28 @@ static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value
u16 temp; u16 temp;
u32 status = 0; u32 status = 0;
struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
loopcnt = 0; loopcnt = 0;
handshake = 0; handshake = 0;
while (loopcnt < 100) { while (loopcnt < 100) {
if (pft1000info->usbboot == 2) { if (ft1000dev->usbboot == 2) {
status = ft1000_read_dpram32(ft1000dev, 0, status = ft1000_read_dpram32(ft1000dev, 0,
(u8 *)&(pft1000info->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,
pft1000info->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 (pft1000info->dspalive == pft1000info->tempbuf[6]) { if (ft1000dev->dspalive == ft1000dev->tempbuf[6]) {
handshake = 0; handshake = 0;
} else { } else {
handshake = pft1000info->tempbuf[1]; handshake = ft1000dev->tempbuf[1];
pft1000info->dspalive = ft1000dev->dspalive =
pft1000info->tempbuf[6]; ft1000dev->tempbuf[6];
} }
} else { } else {
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
...@@ -336,9 +334,8 @@ static u16 get_request_type(struct ft1000_device *ft1000dev) ...@@ -336,9 +334,8 @@ static u16 get_request_type(struct ft1000_device *ft1000dev)
u32 status; u32 status;
u16 tempword; u16 tempword;
u32 tempx; u32 tempx;
struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
if (pft1000info->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);
...@@ -360,16 +357,15 @@ static u16 get_request_type_usb(struct ft1000_device *ft1000dev) ...@@ -360,16 +357,15 @@ static u16 get_request_type_usb(struct ft1000_device *ft1000dev)
u32 status; u32 status;
u16 tempword; u16 tempword;
u32 tempx; u32 tempx;
struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
if (pft1000info->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 (pft1000info->usbboot == 2) { if (ft1000dev->usbboot == 2) {
tempx = pft1000info->tempbuf[2]; tempx = ft1000dev->tempbuf[2];
tempword = pft1000info->tempbuf[3]; tempword = ft1000dev->tempbuf[3];
} else { } else {
tempx = 0; tempx = 0;
status = ft1000_read_dpram16(ft1000dev, status = ft1000_read_dpram16(ft1000dev,
...@@ -401,9 +397,8 @@ static long get_request_value(struct ft1000_device *ft1000dev) ...@@ -401,9 +397,8 @@ static long get_request_value(struct ft1000_device *ft1000dev)
u32 value; u32 value;
u16 tempword; u16 tempword;
u32 status; u32 status;
struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
if (pft1000info->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);
...@@ -507,7 +502,6 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi ...@@ -507,7 +502,6 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi
u16 tempword; u16 tempword;
u16 tempbuffer[64]; u16 tempbuffer[64];
u16 resultbuffer[64]; u16 resultbuffer[64];
struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
//DEBUG("FT1000:download:start word_length = %d\n",(int)word_length); //DEBUG("FT1000:download:start word_length = %d\n",(int)word_length);
dpram = (u16)DWNLD_MAG1_PS_HDR_LOC; dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
...@@ -548,7 +542,7 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi ...@@ -548,7 +542,7 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi
//DEBUG("write_blk: loopcnt is %d\n", loopcnt); //DEBUG("write_blk: loopcnt is %d\n", loopcnt);
//DEBUG("write_blk: bootmode = %d\n", bootmode); //DEBUG("write_blk: bootmode = %d\n", bootmode);
//DEBUG("write_blk: dpram = %x\n", dpram); //DEBUG("write_blk: dpram = %x\n", dpram);
if (pft1000info->bootmode == 0) if (ft1000dev->bootmode == 0)
{ {
if (dpram >= 0x3F4) if (dpram >= 0x3F4)
Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 8); Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 8);
...@@ -718,9 +712,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -718,9 +712,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
DEBUG("Entered scram_dnldr...\n"); DEBUG("Entered scram_dnldr...\n");
pft1000info->fcodeldr = 0; ft1000dev->fcodeldr = 0;
pft1000info->usbboot = 0; ft1000dev->usbboot = 0;
pft1000info->dspalive = 0xffff; ft1000dev->dspalive = 0xffff;
// //
// Get version id of file, at first 4 bytes of file, for newer files. // Get version id of file, at first 4 bytes of file, for newer files.
...@@ -745,7 +739,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -745,7 +739,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
switch (state) { switch (state) {
case STATE_START_DWNLD: case STATE_START_DWNLD:
DEBUG("FT1000:STATE_START_DWNLD\n"); DEBUG("FT1000:STATE_START_DWNLD\n");
if (pft1000info->usbboot) if (ft1000dev->usbboot)
handshake = handshake =
get_handshake_usb(ft1000dev, get_handshake_usb(ft1000dev,
HANDSHAKE_DSP_BL_READY); HANDSHAKE_DSP_BL_READY);
...@@ -771,7 +765,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -771,7 +765,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
case STATE_BOOT_DWNLD: case STATE_BOOT_DWNLD:
DEBUG("FT1000:STATE_BOOT_DWNLD\n"); DEBUG("FT1000:STATE_BOOT_DWNLD\n");
pft1000info->bootmode = 1; ft1000dev->bootmode = 1;
handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST); handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST);
if (handshake == HANDSHAKE_REQUEST) { if (handshake == HANDSHAKE_REQUEST) {
/* /*
...@@ -797,7 +791,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -797,7 +791,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
//DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file); //DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file);
//DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file); //DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file);
state = STATE_CODE_DWNLD; state = STATE_CODE_DWNLD;
pft1000info->fcodeldr = 1; ft1000dev->fcodeldr = 1;
break; break;
case REQUEST_CODE_SEGMENT: case REQUEST_CODE_SEGMENT:
//DEBUG("FT1000:REQUEST_CODE_SEGMENT\n"); //DEBUG("FT1000:REQUEST_CODE_SEGMENT\n");
...@@ -842,7 +836,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -842,7 +836,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
status = STATUS_FAILURE; status = STATUS_FAILURE;
break; break;
} }
if (pft1000info->usbboot) if (ft1000dev->usbboot)
put_handshake_usb(ft1000dev, put_handshake_usb(ft1000dev,
HANDSHAKE_RESPONSE); HANDSHAKE_RESPONSE);
else else
...@@ -858,8 +852,8 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -858,8 +852,8 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
case STATE_CODE_DWNLD: case STATE_CODE_DWNLD:
//DEBUG("FT1000:STATE_CODE_DWNLD\n"); //DEBUG("FT1000:STATE_CODE_DWNLD\n");
pft1000info->bootmode = 0; ft1000dev->bootmode = 0;
if (pft1000info->usbboot) if (ft1000dev->usbboot)
handshake = handshake =
get_handshake_usb(ft1000dev, get_handshake_usb(ft1000dev,
HANDSHAKE_REQUEST); HANDSHAKE_REQUEST);
...@@ -870,7 +864,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -870,7 +864,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
/* /*
* Get type associated with the request. * Get type associated with the request.
*/ */
if (pft1000info->usbboot) if (ft1000dev->usbboot)
request = request =
get_request_type_usb(ft1000dev); get_request_type_usb(ft1000dev);
else else
...@@ -916,7 +910,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -916,7 +910,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
} }
break; break;
case REQUEST_DONE_CL: case REQUEST_DONE_CL:
pft1000info->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 +
...@@ -965,9 +959,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -965,9 +959,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
write_blk_fifo(ft1000dev, &s_file, write_blk_fifo(ft1000dev, &s_file,
&c_file, word_length); &c_file, word_length);
if (pft1000info->usbboot == 0) if (ft1000dev->usbboot == 0)
pft1000info->usbboot++; ft1000dev->usbboot++;
if (pft1000info->usbboot == 1) { if (ft1000dev->usbboot == 1) {
tempword = 0; tempword = 0;
ft1000_write_dpram16(ft1000dev, ft1000_write_dpram16(ft1000dev,
DWNLD_MAG1_PS_HDR_LOC, DWNLD_MAG1_PS_HDR_LOC,
...@@ -1117,7 +1111,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ...@@ -1117,7 +1111,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
status = STATUS_FAILURE; status = STATUS_FAILURE;
break; break;
} }
if (pft1000info->usbboot) if (ft1000dev->usbboot)
put_handshake_usb(ft1000dev, put_handshake_usb(ft1000dev,
HANDSHAKE_RESPONSE); HANDSHAKE_RESPONSE);
else else
......
...@@ -94,11 +94,11 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, ...@@ -94,11 +94,11 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof,
if (info->ProgConStat != 0xFF) { if (info->ProgConStat != 0xFF) {
ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_LED, ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_LED,
(u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
info->LedStat = ntohs(ledStat); info->LedStat = ntohs(ledStat);
ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE, ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_CON_STATE,
(u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
info->ConStat = ntohs(conStat); info->ConStat = ntohs(conStat);
do_gettimeofday(&tv); do_gettimeofday(&tv);
......
...@@ -171,11 +171,11 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -171,11 +171,11 @@ static int ft1000_probe(struct usb_interface *interface,
} }
gPollingfailed = FALSE; gPollingfailed = FALSE;
pft1000info->pPollThread = ft1000dev->pPollThread =
kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll"); kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
if (IS_ERR(pft1000info->pPollThread)) { if (IS_ERR(ft1000dev->pPollThread)) {
ret = PTR_ERR(pft1000info->pPollThread); ret = PTR_ERR(ft1000dev->pPollThread);
goto err_load; goto err_load;
} }
...@@ -200,7 +200,7 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -200,7 +200,7 @@ static int ft1000_probe(struct usb_interface *interface,
if (ret) if (ret)
goto err_proc; goto err_proc;
pft1000info->NetDevRegDone = 1; ft1000dev->NetDevRegDone = 1;
return 0; return 0;
...@@ -208,7 +208,7 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -208,7 +208,7 @@ static int ft1000_probe(struct usb_interface *interface,
unregister_netdev(ft1000dev->net); unregister_netdev(ft1000dev->net);
free_netdev(ft1000dev->net); free_netdev(ft1000dev->net);
err_thread: err_thread:
kthread_stop(pft1000info->pPollThread); kthread_stop(ft1000dev->pPollThread);
err_load: err_load:
kfree(pFileStart); kfree(pFileStart);
err_fw: err_fw:
...@@ -219,6 +219,7 @@ static int ft1000_probe(struct usb_interface *interface, ...@@ -219,6 +219,7 @@ static int ft1000_probe(struct usb_interface *interface,
static void ft1000_disconnect(struct usb_interface *interface) static void ft1000_disconnect(struct usb_interface *interface)
{ {
struct ft1000_info *pft1000info; struct ft1000_info *pft1000info;
struct ft1000_device *ft1000dev;
DEBUG("ft1000_disconnect is called\n"); DEBUG("ft1000_disconnect is called\n");
...@@ -226,28 +227,29 @@ static void ft1000_disconnect(struct usb_interface *interface) ...@@ -226,28 +227,29 @@ static void ft1000_disconnect(struct usb_interface *interface)
DEBUG("In disconnect pft1000info=%p\n", pft1000info); DEBUG("In disconnect pft1000info=%p\n", pft1000info);
if (pft1000info) { if (pft1000info) {
ft1000dev = pft1000info->priv;
ft1000_cleanup_proc(pft1000info); ft1000_cleanup_proc(pft1000info);
if (pft1000info->pPollThread) if (ft1000dev->pPollThread)
kthread_stop(pft1000info->pPollThread); kthread_stop(ft1000dev->pPollThread);
DEBUG("ft1000_disconnect: threads are terminated\n"); DEBUG("ft1000_disconnect: threads are terminated\n");
if (pft1000info->pFt1000Dev->net) { if (ft1000dev->net) {
DEBUG("ft1000_disconnect: destroy char driver\n"); DEBUG("ft1000_disconnect: destroy char driver\n");
ft1000_destroy_dev(pft1000info->pFt1000Dev->net); ft1000_destroy_dev(ft1000dev->net);
unregister_netdev(pft1000info->pFt1000Dev->net); unregister_netdev(ft1000dev->net);
DEBUG DEBUG
("ft1000_disconnect: network device unregistered\n"); ("ft1000_disconnect: network device unregistered\n");
free_netdev(pft1000info->pFt1000Dev->net); free_netdev(ft1000dev->net);
} }
usb_free_urb(pft1000info->pFt1000Dev->rx_urb); usb_free_urb(ft1000dev->rx_urb);
usb_free_urb(pft1000info->pFt1000Dev->tx_urb); usb_free_urb(ft1000dev->tx_urb);
DEBUG("ft1000_disconnect: urb freed\n"); DEBUG("ft1000_disconnect: urb freed\n");
kfree(pft1000info->pFt1000Dev); kfree(ft1000dev);
} }
kfree(pFileStart); kfree(pFileStart);
......
...@@ -55,6 +55,13 @@ struct app_info_block { ...@@ -55,6 +55,13 @@ struct app_info_block {
#define MAX_BUF_SIZE 4096 #define MAX_BUF_SIZE 4096
struct ft1000_debug_dirs {
struct list_head list;
struct dentry *dent;
struct dentry *file;
int int_number;
};
struct ft1000_device { struct ft1000_device {
struct usb_device *dev; struct usb_device *dev;
struct net_device *net; struct net_device *net;
...@@ -69,71 +76,26 @@ struct ft1000_device { ...@@ -69,71 +76,26 @@ struct ft1000_device {
u8 bulk_in_endpointAddr; u8 bulk_in_endpointAddr;
u8 bulk_out_endpointAddr; u8 bulk_out_endpointAddr;
} __packed;
struct ft1000_debug_dirs {
struct list_head list;
struct dentry *dent;
struct dentry *file;
int int_number;
};
struct ft1000_info {
struct ft1000_device *pFt1000Dev;
struct net_device_stats stats;
struct task_struct *pPollThread; struct task_struct *pPollThread;
unsigned char fcodeldr; unsigned char fcodeldr;
unsigned char bootmode; unsigned char bootmode;
unsigned char usbboot; unsigned char usbboot;
unsigned short dspalive; unsigned short dspalive;
u16 ASIC_ID;
bool fProvComplete; bool fProvComplete;
bool fCondResetPend; bool fCondResetPend;
bool fAppMsgPend; bool fAppMsgPend;
u16 DrvErrNum;
u16 AsicID;
int DspAsicReset;
int DeviceCreated; int DeviceCreated;
int CardReady;
int NetDevRegDone; int NetDevRegDone;
u8 CardNumber; u8 CardNumber;
u8 DeviceName[15]; u8 DeviceName[15];
struct ft1000_debug_dirs nodes; struct ft1000_debug_dirs nodes;
int registered;
int mediastate;
u8 squeseqnum; /* sequence number on slow queue */
spinlock_t dpram_lock;
spinlock_t fifo_lock; spinlock_t fifo_lock;
u16 fifo_cnt;
u8 DspVer[DSPVERSZ]; /* DSP version number */
u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
u8 Sku[SKUSZ]; /* SKU */
u8 eui64[EUISZ]; /* EUI64 */
time_t ConTm; /* Connection Time */
u8 ProductMode[MODESZ];
u8 RfCalVer[CALVERSZ];
u8 RfCalDate[CALDATESZ];
u16 DSP_TIME[4];
u16 LedStat;
u16 ConStat;
u16 ProgConStat;
struct list_head prov_list;
int appcnt; int appcnt;
struct app_info_block app_info[MAX_NUM_APP]; struct app_info_block app_info[MAX_NUM_APP];
u16 DSPInfoBlklen;
u16 DrvMsgPend; u16 DrvMsgPend;
int (*ft1000_reset)(struct net_device *dev);
u16 DSPInfoBlk[MAX_DSP_SESS_REC];
union {
u16 Rec[MAX_DSP_SESS_REC];
u32 MagRec[MAX_DSP_SESS_REC/2];
} DSPSess;
unsigned short tempbuf[32]; unsigned short tempbuf[32];
char netdevname[IFNAMSIZ]; } __packed;
struct proc_dir_entry *ft1000_proc_dir;
};
struct dpram_blk { struct dpram_blk {
......
...@@ -250,3 +250,38 @@ struct prov_record { ...@@ -250,3 +250,38 @@ struct prov_record {
struct list_head list; struct list_head list;
u8 *pprov_data; u8 *pprov_data;
}; };
struct ft1000_info {
void *priv;
struct net_device_stats stats;
u16 DrvErrNum;
u16 AsicID;
int CardReady;
int registered;
int mediastate;
u8 squeseqnum; /* sequence number on slow queue */
spinlock_t dpram_lock;
u16 fifo_cnt;
u8 DspVer[DSPVERSZ]; /* DSP version number */
u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
u8 Sku[SKUSZ]; /* SKU */
u8 eui64[EUISZ]; /* EUI64 */
time_t ConTm; /* Connection Time */
u8 ProductMode[MODESZ];
u8 RfCalVer[CALVERSZ];
u8 RfCalDate[CALDATESZ];
u16 DSP_TIME[4];
u16 LedStat;
u16 ConStat;
u16 ProgConStat;
struct list_head prov_list;
u16 DSPInfoBlklen;
int (*ft1000_reset)(void *);
u16 DSPInfoBlk[MAX_DSP_SESS_REC];
union {
u16 Rec[MAX_DSP_SESS_REC];
u32 MagRec[MAX_DSP_SESS_REC/2];
} DSPSess;
struct proc_dir_entry *ft1000_proc_dir;
char netdevname[IFNAMSIZ];
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment