staging: ft1000-pcmcia: various fixes
cover staging: ft1000-pcmcia: various fixes
Fix various things in ft1000-pcmcia driver.
Ondrej Zary (28):
staging: ft1000-pcmcia: don't crash on load
staging: ft1000-pcmcia: fix compilation with FT_DEBUG enabled
staging: ft1000-pcmcia: delete ft1000.conf
staging: ft1000-pcmcia: get rid of ft1000_dev.h
staging: ft1000-pcmcia: remove PSEUDO_HDR typedefs
staging: ft1000-pcmcia: remove DRVMSG typedefs
staging: ft1000-pcmcia: remove MEDIAMSG typedefs
staging: ft1000-pcmcia: delete unused TIMEMSG typedefs
staging: ft1000-pcmcia: remove DSPINITMSG typedefs
staging: ft1000-pcmcia: delete unused DSPHIBERNATE typedefs
staging: ft1000-pcmcia: delete unused APP_INFO_BLOCK typedefs
staging: ft1000-pcmcia: remove PROV_RECORD typedefs
staging: ft1000-pcmcia: remove FT1000_INFO typedefs
staging: ft1000-pcmcia: delete unused DPRAM_BLK typedefs
staging: ft1000-pcmcia: delete local_info_t typedef
staging: ft1000-pcmcia: remove firmware download typedefs
staging: ft1000-pcmcia: remove unused fields from struct ft1000_info
staging: ft1000-pcmcia: remove custom defines for standard types
staging: ft1000-pcmcia: remove useless defines from ft1000_cs.c
staging: ft1000-pcmcia: remove useless debugging from ft1000_cs.c
staging: ft1000-pcmcia: remove misleading and template comments from ft1000_cs.c
staging: ft1000-pcmcia: remove unused ft1000_asic_read and ft1000_asic_write functions
staging: ft1000-pcmcia: coding style fixes in ft1000_cs.c
staging: ft1000-pcmcia: remove unused includes from ft1000_cs.c
staging: ft1000-pcmcia: remove useless ft1000_release() function
staging: ft1000-pcmcia: CodingStyle fixes in ft1000.h
staging: ft1000-pcmcia: remove PSEUDOSZ, use sizeof(struct pseudo_hdr) instead
staging: ft1000-pcmcia: remove support for v5 firmware
drivers/staging/ft1000/ft1000-pcmcia/ft1000.conf | 14 - drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 697 +++++++++----------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 190 +----- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h | 66 -- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 561 ++++++---------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 224 +++---- drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 26 +- 7 files changed, 625 insertions(+), 1153 deletions(-)
Signature · 1 line
Ondrej Zary
PATCH 1/28 staging: ft1000-pcmcia: don't crash on load
Don't crash with NULL pointer dereference on load because of empty .name.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +1 -3
@@ -295,9 +295,7 @@ MODULE_DEVICE_TABLE(pcmcia, ft1000_ids);static struct pcmcia_driver ft1000_cs_driver = { .owner =THIS_MODULE , - .drv = { - .name ="ft1000_cs" , - }, + .name ="ft1000_cs" , .probe = ft1000_attach, .remove = ft1000_detach, .id_table = ft1000_ids,
Signature · 1 line
Ondrej Zary
PATCH 2/28 staging: ft1000-pcmcia: fix compilation with FT_DEBUG enabled
In reply to Ondrej ZaryDelete DEBUG statement that prevents compilation with FT_DEBUG enabled.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +0 -2
@@ -266,8 +266,6 @@ static int ft1000_suspend(struct pcmcia_device *link) {struct net_device *dev = ((local_info_t *) link->priv)->dev; -DEBUG (1 ,"ft1000_cs: ft1000_event(0x%06x)\n" , event); -if (link->open)netif_device_detach (dev);return 0 ;
Signature · 1 line
Ondrej Zary
PATCH 3/28 staging: ft1000-pcmcia: delete ft1000.conf
In reply to Ondrej ZaryRemove useless ft1000.conf file.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.conf | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-) delete mode 100644 drivers/staging/ft1000/ft1000-pcmcia/ft1000.conf
drivers/staging/ft1000/ft1000-pcmcia/ft1000.conf deleted +0 -14
@@ -1,14 +0,0 @@ -device "ft1000_cs" - class "network" module "ft1000","ft1000_cs" - -card "flarion FT1000" - manfid 0x02cc, 0x0100 - bind "ft1000_cs" - -card "flarion FT1000" - manfid 0x02cc, 0x1000 - bind "ft1000_cs" - -card "flarion FT1000" - manfid 0x02cc, 0x1300 - bind "ft1000_cs"
Signature · 1 line
Ondrej Zary
PATCH 4/28 staging: ft1000-pcmcia: get rid of ft1000_dev.h
In reply to Ondrej ZaryShorten ft1000_read_reg() to single line and move it to ft1000.h along with ft1000_write_reg() and delete ft1000_dev.h
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 10 +++ drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h | 66 -------------------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 1 - drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 1 - 4 files changed, 10 insertions(+), 68 deletions(-) delete mode 100644 drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +10 -0
@@ -406,4 +406,14 @@ extern u16 ft1000_read_dpram_mag_16 (struct net_device *dev, int offset, int Indextern u32 ft1000_read_dpram_mag_32 (struct net_device *dev,int offset);void ft1000_write_dpram_mag_32 (struct net_device *dev,int offset,u32 value); +/* Read the value of a given ASIC register. */ +static inline u16 ft1000_read_reg (struct net_device *dev,u16 offset) { +return inw (dev->base_addr + offset); +} + +/* Set the value of a given ASIC register. */ +static inline void ft1000_write_reg (struct net_device *dev,u16 offset,u16 value) { +outw (value, dev->base_addr + offset); +} +#endif // _FT1000H_
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h deleted +0 -66
66 lines not on this page · raw message
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +0 -1
@@ -34,7 +34,6 @@#include <asm/uaccess.h> #include <linux/vmalloc.h> -#include "ft1000_dev.h" #include "ft1000.h" #include "boot.h"
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +0 -1
@@ -54,7 +54,6 @@#endif #include <linux/delay.h> -#include "ft1000_dev.h" #include "ft1000.h" int card_download (struct net_device *dev,const u8 *pFileStart,UINT FileLength);
Signature · 1 line
Ondrej Zary
PATCH 5/28 staging: ft1000-pcmcia: remove PSEUDO_HDR typedefs
In reply to Ondrej ZaryRemove PSEUDO_HDR typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 14 +++++++------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 16 ++++++++-------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +7 -7
@@ -42,7 +42,7 @@#define CALDATESZ 6// Pseudo Header structure -typedef struct _PSEUDO_HDR +struct pseudo_hdr {unsigned short length;// length of msg body unsigned char source;// hardware source id
@@ -65,7 +65,7 @@ typedef struct _PSEUDO_HDRunsigned char rsvd2;unsigned short qos_class;// not used unsigned short checksum;// pseudo header checksum -} __attribute__ ((packed)) PSEUDO_HDR, *PPSEUDO_HDR; +} __attribute__ ((packed));// Definitions to maintain compatibility between other platforms #define UCHAR u8
@@ -286,14 +286,14 @@ typedef struct _PSEUDO_HDR#define MAXIMUM_ASIC_HB_CNT 15typedef struct _DRVMSG { -PSEUDO_HDR pseudo; +struct pseudo_hdr pseudo;u16 type;u16 length;u8 data[0 ]; } __attribute__ ((packed))DRVMSG , *PDRVMSG ; typedef struct _MEDIAMSG { - PSEUDO_HDR pseudo; + struct pseudo_hdr pseudo; u16 type; u16 length; u16 state;
@@ -305,14 +305,14 @@ typedef struct _MEDIAMSG { } __attribute__ ((packed)) MEDIAMSG, *PMEDIAMSG;typedef struct _TIMEMSG { -PSEUDO_HDR pseudo; +struct pseudo_hdr pseudo;u16 type;u16 length;u8 timeval[8 ]; } __attribute__ ((packed))TIMEMSG , *PTIMEMSG ; typedef struct _DSPINITMSG { - PSEUDO_HDR pseudo; + struct pseudo_hdr pseudo; u16 type; u16 length; u8 DspVer[DSPVERSZ]; // DSP version number
@@ -325,7 +325,7 @@ typedef struct _DSPINITMSG { } __attribute__ ((packed)) DSPINITMSG, *PDSPINITMSG; typedef struct _DSPHIBERNATE { - PSEUDO_HDR pseudo; + struct pseudo_hdr pseudo; u16 type; u16 length; u32 timeout;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +8 -8
@@ -91,7 +91,7 @@ void put_handshake(struct net_device *dev, USHORT handshake_value);USHORT get_request_type (struct net_device *dev);long get_request_value (struct net_device *dev);void put_request_value (struct net_device *dev,long lvalue); -USHORT hdr_checksum (PPSEUDO_HDR pHdr); +USHORT hdr_checksum (struct pseudo_hdr *pHdr); typedef struct _DSP_FILE_HDR { u32 build_date;
@@ -297,7 +297,7 @@ void put_request_value(struct net_device *dev, long lvalue) } -USHORT hdr_checksum (PPSEUDO_HDR pHdr) +USHORT hdr_checksum (struct pseudo_hdr *pHdr) {USHORT *usPtr = (USHORT *) pHdr;USHORT chksum;
@@ -315,7 +315,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)USHORT DspWordCnt =0 ;UINT uiState;USHORT handshake; -PPSEUDO_HDR pHdr; +struct pseudo_hdr *pHdr;USHORT usHdrLength;PDSP_FILE_HDR pFileHdr;long word_length;
@@ -851,7 +851,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)break ; } - pHdr = (PPSEUDO_HDR ) pUsFile; + pHdr = (struct pseudo_hdr *) pUsFile; if (pHdr->portdest == 0x80 /* DspOAM */ && (pHdr->portsrc == 0x00 /* Driver */
@@ -871,7 +871,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)case STATE_SECTION_PROV : - pHdr = (PPSEUDO_HDR ) pUcFile; + pHdr = (struct pseudo_hdr *) pUcFile;if (pHdr->checksum ==hdr_checksum (pHdr)) {if (pHdr->portdest !=0x80 /* Dsp OAM */ ) {
@@ -882,12 +882,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)// Get buffer for provisioning data pbuffer = -kmalloc ((usHdrLength +sizeof (PSEUDO_HDR )), +kmalloc ((usHdrLength +sizeof (struct pseudo_hdr )),GFP_ATOMIC );if (pbuffer) {memcpy (pbuffer, (void *)pUcFile, (UINT ) (usHdrLength + -sizeof (PSEUDO_HDR ))); +sizeof (struct pseudo_hdr )));// link provisioning data pprov_record = kmalloc(sizeof(PROV_RECORD),
@@ -901,7 +901,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)// Move to next entry if available pUcFile = (UCHAR *) ((unsigned long ) pUcFile + - (unsigned long ) ((usHdrLength +1 ) &0xFFFFFFFE ) +sizeof (PSEUDO_HDR )); + (unsigned long ) ((usHdrLength +1 ) &0xFFFFFFFE ) +sizeof (struct pseudo_hdr ));if ((unsigned long ) (pUcFile) - (unsigned long ) (pFileStart) >= (unsigned long ) FileLength) {
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +7 -7
@@ -1021,7 +1021,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)u16 len;u16 i;PPROV_RECORD ptr; -PPSEUDO_HDR ppseudo_hdr; +struct pseudo_hdr *ppseudo_hdr;PUSHORT pmsg;struct timeval tv;union {
@@ -1066,7 +1066,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) len =htons (len); pmsg = (PUSHORT ) ptr->pprov_data; - ppseudo_hdr = (PPSEUDO_HDR ) pmsg; + ppseudo_hdr = (struct pseudo_hdr *) pmsg;// Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->portsrc =0 ;
@@ -1185,7 +1185,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)// Put message into Slow Queue // Form Pseudo header pmsg = (PUSHORT ) info->DSPInfoBlk; - ppseudo_hdr = (PPSEUDO_HDR ) pmsg; + ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr->length =htons (info->DSPInfoBlklen +4 ); ppseudo_hdr->source =0x10 ;
@@ -1234,7 +1234,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)// Put message into Slow Queue // Form Pseudo header pmsg = (PUSHORT ) & tempbuffer[0 ]; - ppseudo_hdr = (PPSEUDO_HDR ) pmsg; + ppseudo_hdr = (struct pseudo_hdr *) pmsg; ppseudo_hdr->length =htons (0x0012 ); ppseudo_hdr->source =0x10 ; ppseudo_hdr->destination =0x20 ;
@@ -1788,9 +1788,9 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) {FT1000_INFO *info =netdev_priv (dev);union { -PSEUDO_HDR blk; -u16 buff[sizeof (PSEUDO_HDR ) >>1 ]; -u8 buffc[sizeof (PSEUDO_HDR )]; +struct pseudo_hdr blk; +u16 buff[sizeof (struct pseudo_hdr ) >>1 ]; +u8 buffc[sizeof (struct pseudo_hdr )]; } pseudo;int i;u32 *plong;
Signature · 1 line
Ondrej Zary
PATCH 6/28 staging: ft1000-pcmcia: remove DRVMSG typedefs
In reply to Ondrej ZaryRemove DRVMSG typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +2 -2
@@ -285,12 +285,12 @@ struct pseudo_hdr#define MAXIMUM_ASIC_HB_CNT 15 -typedef struct _DRVMSG { +struct drv_msg {struct pseudo_hdr pseudo;u16 type;u16 length;u8 data[0 ]; -} __attribute__ ((packed))DRVMSG , *PDRVMSG ; +} __attribute__ ((packed)); typedef struct _MEDIAMSG { struct pseudo_hdr pseudo;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +2 -2
@@ -328,7 +328,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)PDSP_IMAGE_INFO_V6 pDspImageInfoV6 =NULL ;long requested_version;BOOLEAN bGoodVersion =0 ; -PDRVMSG pMailBoxData; +struct drv_msg *pMailBoxData;USHORT *pUsData =NULL ;USHORT *pUsFile =NULL ;UCHAR *pUcFile =NULL ;
@@ -605,7 +605,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength) (long )(info->DSPInfoBlklen +1 ) /2 ;put_request_value (dev, word_length); pMailBoxData = - (PDRVMSG ) & info->DSPInfoBlk[0 ]; + (struct drv_msg *) & info->DSPInfoBlk[0 ]; pUsData = (USHORT *) & pMailBoxData->data[0 ];// Provide mutual exclusive access while reading ASIC registers.
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +2 -2
@@ -1017,7 +1017,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)u16 tempword;PMEDIAMSG pmediamsg;PDSPINITMSG pdspinitmsg; -PDRVMSG pdrvmsg; +struct drv_msg *pdrvmsg;u16 len;u16 i;PPROV_RECORD ptr;
@@ -1038,7 +1038,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)if (ft1000_receive_cmd (dev, &cmdbuffer[0 ],MAX_CMD_SQSIZE , &tempword) ) {// Get the message type which is total_len + PSEUDO header + msgtype + message body - pdrvmsg = (PDRVMSG ) & cmdbuffer[0 ]; + pdrvmsg = (struct drv_msg *) & cmdbuffer[0 ]; msgtype =ntohs (pdrvmsg->type);DEBUG (1 ,"Command message type = 0x%x\n" , msgtype);switch (msgtype) {
Signature · 1 line
Ondrej Zary
PATCH 7/28 staging: ft1000-pcmcia: remove MEDIAMSG typedefs
In reply to Ondrej ZaryRemove MEDIAMSG typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +2 -2
@@ -292,7 +292,7 @@ struct drv_msg {u8 data[0 ]; } __attribute__ ((packed)); -typedef struct _MEDIAMSG { +struct media_msg {struct pseudo_hdr pseudo;u16 type;u16 length;
@@ -302,7 +302,7 @@ typedef struct _MEDIAMSG {u32 gateway;u32 dns_1;u32 dns_2; -} __attribute__ ((packed)) MEDIAMSG, *PMEDIAMSG; +} __attribute__ ((packed)); typedef struct _TIMEMSG { struct pseudo_hdr pseudo;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +2 -2
@@ -1015,7 +1015,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)FT1000_INFO *info =netdev_priv (dev);u16 msgtype;u16 tempword; -PMEDIAMSG pmediamsg; +struct media_msg *pmediamsg;PDSPINITMSG pdspinitmsg;struct drv_msg *pdrvmsg;u16 len;
@@ -1090,7 +1090,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) info->CardReady =1 ;break ;case MEDIA_STATE : - pmediamsg = (PMEDIAMSG ) & cmdbuffer[0 ]; + pmediamsg = (struct media_msg *) & cmdbuffer[0 ];if (info->ProgConStat !=0xFF ) {if (pmediamsg->state) {DEBUG (1 ,"Media is up\n" );
Signature · 1 line
Ondrej Zary
PATCH 8/28 staging: ft1000-pcmcia: delete unused TIMEMSG typedefs
In reply to Ondrej ZaryDelete unused TIMEMSG typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -7
@@ -304,13 +304,6 @@ struct media_msg {u32 dns_2; } __attribute__ ((packed)); -typedef struct _TIMEMSG { -struct pseudo_hdr pseudo; -u16 type; -u16 length; -u8 timeval[8 ]; -} __attribute__ ((packed))TIMEMSG , *PTIMEMSG ; - typedef struct _DSPINITMSG { struct pseudo_hdr pseudo; u16 type;
Signature · 1 line
Ondrej Zary
PATCH 9/28 staging: ft1000-pcmcia: remove DSPINITMSG typedefs
In reply to Ondrej ZaryRemove DSPINITMSG typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +2 -2
@@ -304,7 +304,7 @@ struct media_msg {u32 dns_2; } __attribute__ ((packed)); -typedef struct _DSPINITMSG { +struct dsp_init_msg {struct pseudo_hdr pseudo;u16 type;u16 length;
@@ -315,7 +315,7 @@ typedef struct _DSPINITMSG {u8 ProductMode[MODESZ ];// Product Mode (Market/Production) u8 RfCalVer[CALVERSZ ];// Rf Calibration version u8 RfCalDate[CALDATESZ ];// Rf Calibration date -} __attribute__ ((packed)) DSPINITMSG, *PDSPINITMSG; +} __attribute__ ((packed)); typedef struct _DSPHIBERNATE { struct pseudo_hdr pseudo;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +3 -3
@@ -1016,7 +1016,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)u16 msgtype;u16 tempword;struct media_msg *pmediamsg; -PDSPINITMSG pdspinitmsg; +struct dsp_init_msg *pdspinitmsg;struct drv_msg *pdrvmsg;u16 len;u16 i;
@@ -1122,7 +1122,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) }break ;case DSP_INIT_MSG : - pdspinitmsg = (PDSPINITMSG ) & cmdbuffer[0 ]; + pdspinitmsg = (struct dsp_init_msg *) & cmdbuffer[0 ];memcpy (info->DspVer, pdspinitmsg->DspVer,DSPVERSZ ); DEBUG(1, "DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", info->DspVer[0], info->DspVer[1], info->DspVer[2],
@@ -1139,7 +1139,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) dev->dev_addr[5 ] = info->eui64[7 ];if (ntohs (pdspinitmsg->length) == - (sizeof (DSPINITMSG ) -20 )) { + (sizeof (struct dsp_init_msg ) -20 )) {memcpy (info->ProductMode, pdspinitmsg->ProductMode,MODESZ ); memcpy(info->RfCalVer, pdspinitmsg->RfCalVer,
Signature · 1 line
Ondrej Zary
PATCH 10/28 staging: ft1000-pcmcia: delete unused DSPHIBERNATE typedefs
In reply to Ondrej ZaryDelete unused DSPHIBERNATE typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -8
@@ -317,14 +317,6 @@ struct dsp_init_msg {u8 RfCalDate[CALDATESZ ];// Rf Calibration date } __attribute__ ((packed)); -typedef struct _DSPHIBERNATE { -struct pseudo_hdr pseudo; -u16 type; -u16 length; -u32 timeout; -u16 sess_info[0 ]; -}DSPHIBERNATE , *PDSPHIBERNATE ; - typedef struct _APP_INFO_BLOCK { u32 fileobject; // Application's file object
Signature · 1 line
Ondrej Zary
PATCH 11/28 staging: ft1000-pcmcia: delete unused APP_INFO_BLOCK typedefs
In reply to Ondrej ZaryDelete unused APP_INFO_BLOCK typedefs and associated variables.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -10
@@ -281,8 +281,6 @@ struct pseudo_hdr#define TRUE 0x1#define FALSE 0x0 -#define MAX_NUM_APP 6 -#define MAXIMUM_ASIC_HB_CNT 15struct drv_msg {
@@ -317,12 +315,6 @@ struct dsp_init_msg {u8 RfCalDate[CALDATESZ ];// Rf Calibration date } __attribute__ ((packed)); -typedef struct _APP_INFO_BLOCK -{ -u32 fileobject;// Application's file object -u16 app_id;// Application id -}APP_INFO_BLOCK , *PAPP_INFO_BLOCK ; - typedef struct _PROV_RECORD { struct list_head list; u8 *pprov_data;
@@ -365,8 +357,6 @@ typedef struct _FT1000_INFO {u8 RfCalDate[CALDATESZ ];u16 DSP_TIME [4 ];struct list_head prov_list; -int appcnt; -APP_INFO_BLOCK app_info[MAX_NUM_APP ];u16 DSPInfoBlklen;u16 DrvMsgPend;int (*ft1000_reset)(void *);
Signature · 1 line
Ondrej Zary
PATCH 12/28 staging: ft1000-pcmcia: remove PROV_RECORD typedefs
In reply to Ondrej ZaryRemove PROV_RECORD typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +2 -2
@@ -315,10 +315,10 @@ struct dsp_init_msg {u8 RfCalDate[CALDATESZ ];// Rf Calibration date } __attribute__ ((packed)); -typedef struct _PROV_RECORD { +struct prov_record {struct list_head list;u8 *pprov_data; -}PROV_RECORD , *PPROV_RECORD ; +}; typedef struct _FT1000_INFO { struct net_device_stats stats;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +2 -2
@@ -321,7 +321,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)long word_length;USHORT request;USHORT temp; -PPROV_RECORD pprov_record; +struct prov_record *pprov_record;PUCHAR pbuffer;PDSP_FILE_HDR_5 pFileHdr5;PDSP_IMAGE_INFO pDspImageInfo =NULL ;
@@ -890,7 +890,7 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength) sizeof(struct pseudo_hdr)));// link provisioning data pprov_record = -kmalloc (sizeof (PROV_RECORD ), +kmalloc (sizeof (struct prov_record ),GFP_ATOMIC );if (pprov_record) { pprov_record->pprov_data =
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +6 -6
@@ -421,7 +421,7 @@ static int ft1000_reset_card(struct net_device *dev)u16 tempword;int i;unsigned long flags; -PPROV_RECORD ptr; +struct prov_record *ptr;DEBUG (1 ,"ft1000_hw:ft1000_reset_card called.....\n" );
@@ -436,7 +436,7 @@ static int ft1000_reset_card(struct net_device *dev)while (list_empty (&info->prov_list) ==0 ) {DEBUG (0 ,"ft1000_hw:ft1000_reset_card:deleting provisioning record\n" ); - ptr =list_entry (info->prov_list.next,PROV_RECORD , list); + ptr = list_entry(info->prov_list.next, struct prov_record, list);list_del (&ptr->list);kfree (ptr->pprov_data);kfree (ptr);
@@ -1020,7 +1020,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)struct drv_msg *pdrvmsg;u16 len;u16 i; -PPROV_RECORD ptr; +struct prov_record *ptr;struct pseudo_hdr *ppseudo_hdr;PUSHORT pmsg;struct timeval tv;
@@ -1061,7 +1061,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) } ptr =list_entry (info->prov_list.next, -PROV_RECORD , list); + struct prov_record, list); len = *(u16 *) ptr->pprov_data; len =htons (len);
@@ -2095,7 +2095,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)void stop_ft1000_card (struct net_device *dev) {FT1000_INFO *info =netdev_priv (dev); -PPROV_RECORD ptr; +struct prov_record *ptr;// int cnt; DEBUG (0 ,"ft1000_hw: stop_ft1000_card()\n" );
@@ -2107,7 +2107,7 @@ void stop_ft1000_card(struct net_device *dev)// Make sure we free any memory reserve for provisioning while (list_empty (&info->prov_list) ==0 ) { - ptr =list_entry (info->prov_list.next,PROV_RECORD , list); + ptr = list_entry(info->prov_list.next, struct prov_record, list);list_del (&ptr->list);kfree (ptr->pprov_data);kfree (ptr);
Signature · 1 line
Ondrej Zary
PATCH 13/28 staging: ft1000-pcmcia: remove FT1000_INFO typedefs
In reply to Ondrej ZaryRemove FT1000_INFO typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 4 +- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 14 +++--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 58 ++++++++++---------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 8 ++-- 4 files changed, 42 insertions(+), 42 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +2 -2
@@ -320,7 +320,7 @@ struct prov_record {u8 *pprov_data; }; -typedef struct _FT1000_INFO { +struct ft1000_info {struct net_device_stats stats;u16 DrvErrNum;u16 AsicID;
@@ -368,7 +368,7 @@ typedef struct _FT1000_INFO { } DSPSess;struct proc_dir_entry *proc_ft1000;char netdevname[IFNAMSIZ ]; -}FT1000_INFO , *PFT1000_INFO ; +}; typedef struct _DPRAM_BLK { struct list_head list;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +7 -7
@@ -141,7 +141,7 @@ typedef struct _DSP_IMAGE_INFO_V6 {void card_bootload (struct net_device *dev) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);unsigned long flags;PULONG pdata;UINT size;
@@ -173,7 +173,7 @@ void card_bootload(struct net_device *dev)USHORT get_handshake (struct net_device *dev,USHORT expected_value) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);USHORT handshake;ULONG tempx;int loopcnt;
@@ -208,7 +208,7 @@ USHORT get_handshake(struct net_device *dev, USHORT expected_value)void put_handshake (struct net_device *dev,USHORT handshake_value) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);ULONG tempx;if (info->AsicID ==ELECTRABUZZ_ID ) {
@@ -224,7 +224,7 @@ void put_handshake(struct net_device *dev, USHORT handshake_value)USHORT get_request_type (struct net_device *dev) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);USHORT request_type;ULONG tempx;
@@ -243,7 +243,7 @@ USHORT get_request_type(struct net_device *dev)long get_request_value (struct net_device *dev) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);long value;USHORT w_val;
@@ -272,7 +272,7 @@ long get_request_value(struct net_device *dev)void put_request_value (struct net_device *dev,long lvalue) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);USHORT size;ULONG tempx;
@@ -310,7 +310,7 @@ USHORT hdr_checksum(struct pseudo_hdr *pHdr)int card_download (struct net_device *dev,const u8 *pFileStart,UINT FileLength) { -FT1000_INFO *info = (PFT1000_INFO )netdev_priv (dev); +struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);int Status =SUCCESS ;USHORT DspWordCnt =0 ;UINT uiState;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +29 -29
232 lines not on this page · raw message
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +4 -4
@@ -53,7 +53,7 @@ int ft1000ReadProc(char *page, char **start, off_t off,struct net_device *dev;int len;int i; -FT1000_INFO *info; +struct ft1000_info *info;char *status[] = {"Idle (Disconnect)" ,"Searching" ,"Active (Connected)" ,"Waiting for L2" ,"Sleep" ,"No Coverage" ,"" ,""
@@ -172,7 +172,7 @@ static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) {struct net_device *dev = ptr; -FT1000_INFO *info; +struct ft1000_info *info; info =netdev_priv (dev);
@@ -193,7 +193,7 @@ static struct notifier_block ft1000_netdev_notifier = {void ft1000InitProc (struct net_device *dev) { -FT1000_INFO *info; +struct ft1000_info *info; info =netdev_priv (dev);
@@ -206,7 +206,7 @@ void ft1000InitProc(struct net_device *dev)void ft1000CleanupProc (struct net_device *dev) { -FT1000_INFO *info; +struct ft1000_info *info; info =netdev_priv (dev);
Signature · 1 line
Ondrej Zary
PATCH 14/28 staging: ft1000-pcmcia: delete unused DPRAM_BLK typedefs
In reply to Ondrej ZaryDelete unused DPRAM_BLK typedefs.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -5
@@ -370,11 +370,6 @@ struct ft1000_info {char netdevname[IFNAMSIZ ]; }; -typedef struct _DPRAM_BLK { -struct list_head list; -u16 *pbuffer; -} __attribute__ ((packed))DPRAM_BLK , *PDPRAM_BLK ; -extern u16 ft1000_read_dpram (struct net_device *dev,int offset);extern void card_bootload (struct net_device *dev);extern u16 ft1000_read_dpram_mag_16 (struct net_device *dev,int offset,int Index);
Signature · 1 line
Ondrej Zary
PATCH 15/28 staging: ft1000-pcmcia: delete local_info_t typedef
In reply to Ondrej ZaryDelete local_info_t typedef along with the struct as its "link" member was not used. Use link->priv to store net_device directly.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 29 ++++------------------ 1 files changed, 5 insertions(+), 24 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +5 -24
@@ -93,11 +93,6 @@ static void ft1000_release(struct pcmcia_device *link);static void ft1000_detach (struct pcmcia_device *link);static int ft1000_attach (struct pcmcia_device *link); -typedef struct local_info_t { -struct pcmcia_device *link; -struct net_device *dev; -}local_info_t ; -#define MAX_ASIC_RESET_CNT 10#define COR_DEFAULT 0x55
@@ -115,20 +110,9 @@ static void ft1000_reset(struct pcmcia_device * link)static int ft1000_attach (struct pcmcia_device *link) { - -local_info_t *local; -DEBUG (0 ,"ft1000_cs: ft1000_attach()\n" ); - local =kzalloc (sizeof (local_info_t),GFP_KERNEL ); -if (!local) { -return -ENOMEM ; - } - local->link = link; - - link->priv = local; - local->dev =NULL ; - + link->priv =NULL ; link->config_flags |=CONF_ENABLE_IRQ |CONF_AUTO_SET_IO ;return ft1000_config (link);
@@ -146,7 +130,7 @@ static int ft1000_attach(struct pcmcia_device *link)static void ft1000_detach (struct pcmcia_device *link) { -struct net_device *dev = ((local_info_t *) link->priv)->dev; +struct net_device *dev = link->priv;DEBUG (0 ,"ft1000_cs: ft1000_detach(0x%p)\n" , link);
@@ -161,7 +145,6 @@ static void ft1000_detach(struct pcmcia_device *link)pcmcia_disable_device (link); -/* This points to the parent local_info_t struct */ free_netdev (dev); }/* ft1000_detach */
@@ -205,9 +188,8 @@ static int ft1000_config(struct pcmcia_device *link) goto failed; } - ((local_info_t *) link->priv)->dev =init_ft1000_card (link, - &ft1000_reset); -if (((local_info_t *) link->priv)->dev ==NULL ) { + link->priv =init_ft1000_card (link, &ft1000_reset); +if (link->priv ==NULL ) {printk (KERN_INFO "ft1000: Could not register as network device\n" ); goto failed; }
@@ -244,7 +226,6 @@ static void ft1000_release(struct pcmcia_device * link)In a normal driver, additional code may be needed to release other kernel data structures associated with this device. */ -kfree ((local_info_t *) link->priv);/* Don't bother checking to see if these succeed or not */ pcmcia_disable_device (link);
@@ -264,7 +245,7 @@ static void ft1000_release(struct pcmcia_device * link)static int ft1000_suspend (struct pcmcia_device *link) { -struct net_device *dev = ((local_info_t *) link->priv)->dev; +struct net_device *dev = link->priv;if (link->open)netif_device_detach (dev);
Signature · 1 line
Ondrej Zary
PATCH 16/28 staging: ft1000-pcmcia: remove firmware download typedefs
In reply to Ondrej ZaryRemove firmware download typedefs:DFP_FILE_HDR, DSP_FILE_HDR_5, DSP_IMAGE_INFO, DSP_IMAGE_INFO_V6
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 36 ++++++++++---------- 1 files changed, 18 insertions(+), 18 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +18 -18
@@ -93,7 +93,7 @@ long get_request_value(struct net_device *dev);void put_request_value (struct net_device *dev,long lvalue);USHORT hdr_checksum (struct pseudo_hdr *pHdr); -typedef struct _DSP_FILE_HDR { +struct dsp_file_hdr {u32 build_date;u32 dsp_coff_date;u32 loader_code_address;
@@ -103,9 +103,9 @@ typedef struct _DSP_FILE_HDR {u32 dsp_code_size;u32 dsp_code_end;u32 reserved[8 ]; -} __attribute__ ((packed)) DSP_FILE_HDR, *PDSP_FILE_HDR; +} __attribute__ ((packed)); -typedef struct _DSP_FILE_HDR_5 { +struct dsp_file_hdr_5 {u32 version_id;// Version ID of this image format. u32 package_id;// Package ID of code release. u32 build_date;// Date/time stamp when file was built.
@@ -117,18 +117,18 @@ typedef struct _DSP_FILE_HDR_5 {u32 version_data_offset;// Offset were scrambled version data begins. u32 version_data_size;// Size, in words, of scrambled version data. u32 nDspImages;// Number of DSP images in file. -} __attribute__ ((packed)) DSP_FILE_HDR_5, *PDSP_FILE_HDR_5; +} __attribute__ ((packed)); -typedef struct _DSP_IMAGE_INFO { +struct dsp_image_info {u32 coff_date;// Date/time when DSP Coff image was built. u32 begin_offset;// Offset in file where image begins. u32 end_offset;// Offset in file where image begins. u32 run_address;// On chip Start address of DSP code. u32 image_size;// Size of image. u32 version;// Embedded version # of DSP code. -} __attribute__ ((packed))DSP_IMAGE_INFO , *PDSP_IMAGE_INFO ; +} __attribute__ ((packed)); -typedef struct _DSP_IMAGE_INFO_V6 { +struct dsp_image_info_v6 {u32 coff_date;// Date/time when DSP Coff image was built. u32 begin_offset;// Offset in file where image begins. u32 end_offset;// Offset in file where image begins.
@@ -137,7 +137,7 @@ typedef struct _DSP_IMAGE_INFO_V6 {u32 version;// Embedded version # of DSP code. unsigned short checksum;// Dsp File checksum unsigned short pad1; -} __attribute__ ((packed)) DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6; +} __attribute__ ((packed));void card_bootload (struct net_device *dev) {
@@ -317,15 +317,15 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)USHORT handshake;struct pseudo_hdr *pHdr;USHORT usHdrLength; -PDSP_FILE_HDR pFileHdr; +struct dsp_file_hdr *pFileHdr;long word_length;USHORT request;USHORT temp;struct prov_record *pprov_record;PUCHAR pbuffer; -PDSP_FILE_HDR_5 pFileHdr5; -PDSP_IMAGE_INFO pDspImageInfo =NULL ; -PDSP_IMAGE_INFO_V6 pDspImageInfoV6 =NULL ; +struct dsp_file_hdr_5 *pFileHdr5; +struct dsp_image_info *pDspImageInfo =NULL ; +struct dsp_image_info_v6 *pDspImageInfoV6 =NULL ;long requested_version;BOOLEAN bGoodVersion =0 ;struct drv_msg *pMailBoxData;
@@ -351,8 +351,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength) uiState =STATE_START_DWNLD ; - pFileHdr = (PDSP_FILE_HDR ) pFileStart; - pFileHdr5 = (PDSP_FILE_HDR_5 ) pFileStart; + pFileHdr = (struct dsp_file_hdr *) pFileStart; + pFileHdr5 = (struct dsp_file_hdr_5 *) pFileStart;switch (file_version) {case 5 :
@@ -714,11 +714,11 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)get_request_value (dev);if (file_version ==5 ) { pDspImageInfo = - (PDSP_IMAGE_INFO ) ((long ) + (struct dsp_image_info *) ((long ) pFileStart +sizeof - (DSP_FILE_HDR_5 )); + (struct dsp_file_hdr_5 )); for (imageN = 0; imageN < pFileHdr5->nDspImages;
@@ -761,11 +761,11 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength) } }else { pDspImageInfoV6 = - (PDSP_IMAGE_INFO_V6 ) ((long ) + (struct dsp_image_info_v6 *) ((long ) pFileStart +sizeof - (DSP_FILE_HDR_5 )); + (struct dsp_file_hdr_5 )); for (imageN = 0; imageN < pFileHdr5->nDspImages;
Signature · 1 line
Ondrej Zary
PATCH 17/28 staging: ft1000-pcmcia: remove unused fields from struct ft1000_info
In reply to Ondrej ZaryRemove 13 unused fields from struct ft1000_info.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 13 ------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 35 ++++---------------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 18 ++++------ 3 files changed, 15 insertions(+), 51 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -13
@@ -324,25 +324,13 @@ struct ft1000_info {struct net_device_stats stats;u16 DrvErrNum;u16 AsicID; -int ASICResetNum; -int DspAsicReset;int PktIntfErr; -int DSPResetNum; -int NumIOCTLBufs; -int IOCTLBufLvl; -int DeviceCreated;int CardReady; -int DspHibernateFlag; -int DSPReady; -u8 DeviceName[15 ]; -int DeviceMajor;int registered;int mediastate;u16 packetseqnum;u8 squeseqnum;// sequence number on slow queue spinlock_t dpram_lock; -u16 CurrentInterruptEnableMask; -int InterruptsEnabled;u16 fifo_cnt;u8 DspVer[DSPVERSZ ];// DSP version number u8 HwSerNum[HWSERNUMSZ ];// Hardware Serial Number
@@ -358,7 +346,6 @@ struct ft1000_info {u16 DSP_TIME [4 ];struct list_head prov_list;u16 DSPInfoBlklen; -u16 DrvMsgPend;int (*ft1000_reset)(void *);void *link;u16 DSPInfoBlk[MAX_DSP_SESS_REC ];
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +7 -28
@@ -323,17 +323,14 @@ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value)//--------------------------------------------------------------------------- static void ft1000_enable_interrupts (struct net_device *dev) { -struct ft1000_info *info =netdev_priv (dev);u16 tempword;DEBUG (1 ,"ft1000_hw:ft1000_enable_interrupts()\n" ); -ft1000_write_reg (dev,FT1000_REG_SUP_IMASK , - info->CurrentInterruptEnableMask); +ft1000_write_reg (dev,FT1000_REG_SUP_IMASK ,ISR_DEFAULT_MASK ); tempword =ft1000_read_reg (dev,FT1000_REG_SUP_IMASK );DEBUG (1 ,"ft1000_hw:ft1000_enable_interrupts:current interrupt enable mask = 0x%x\n" , tempword); - info->InterruptsEnabled = TRUE; }//---------------------------------------------------------------------------
@@ -348,7 +345,6 @@ static void ft1000_enable_interrupts(struct net_device *dev)//--------------------------------------------------------------------------- static void ft1000_disable_interrupts (struct net_device *dev) { -struct ft1000_info *info =netdev_priv (dev);u16 tempword;DEBUG (1 ,"ft1000_hw: ft1000_disable_interrupts()\n" );
@@ -357,7 +353,6 @@ static void ft1000_disable_interrupts(struct net_device *dev)DEBUG (1 ,"ft1000_hw:ft1000_disable_interrupts:current interrupt enable mask = 0x%x\n" , tempword); - info->InterruptsEnabled = FALSE; }//---------------------------------------------------------------------------
@@ -379,7 +374,6 @@ static void ft1000_reset_asic(struct net_device *dev)DEBUG (1 ,"ft1000_hw:ft1000_reset_asic called\n" ); (*info->ft1000_reset) (info->link); - info->ASICResetNum++;// Let's use the register provided by the Magnemite ASIC to reset the // ASIC and DSP.
@@ -456,14 +450,12 @@ static int ft1000_reset_card(struct net_device *dev)if (ft1000_card_present ==1 ) {spin_lock_irqsave (&info->dpram_lock, flags);if (info->AsicID ==ELECTRABUZZ_ID ) { -if (info->DspHibernateFlag ==0 ) { -ft1000_write_reg (dev,FT1000_REG_DPRAM_ADDR , -FT1000_DPRAM_RX_BASE ); -for (i =0 ; i <MAX_DSP_SESS_REC ; i++) { - info->DSPSess.Rec[i] = -ft1000_read_reg (dev, -FT1000_REG_DPRAM_DATA ); - } +ft1000_write_reg (dev,FT1000_REG_DPRAM_ADDR , +FT1000_DPRAM_RX_BASE ); +for (i =0 ; i <MAX_DSP_SESS_REC ; i++) { + info->DSPSess.Rec[i] = +ft1000_read_reg (dev, +FT1000_REG_DPRAM_DATA ); } }else { ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR,
@@ -481,8 +473,6 @@ static int ft1000_reset_card(struct net_device *dev)//reset ASIC ft1000_reset_asic (dev); - info->DSPResetNum++; -DEBUG (1 ,"ft1000_hw:ft1000_reset_card:downloading dsp image\n" );if (info->AsicID ==MAGNEMITE_ID ) {
@@ -1168,7 +1158,6 @@ void ft1000_proc_drvmsg(struct net_device *dev)case DSP_GET_INFO :DEBUG (1 ,"FT1000:drivermsg:Got DSP_GET_INFO\n" );// copy dsp info block to dsp - info->DrvMsgPend =1 ;// allow any outstanding ioctl to finish mdelay (10 ); tempword =ft1000_read_reg (dev,FT1000_REG_DOORBELL );
@@ -1211,13 +1200,11 @@ void ft1000_proc_drvmsg(struct net_device *dev)htons (info->DSPInfoBlklen);ft1000_send_cmd (dev, (PUSHORT )info->DSPInfoBlk, (USHORT )(info->DSPInfoBlklen+4 ),0 ); } - info->DrvMsgPend =0 ;break ;case GET_DRV_ERR_RPT_MSG :DEBUG (1 ,"FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n" );// copy driver error message to dsp - info->DrvMsgPend =1 ;// allow any outstanding ioctl to finish mdelay (10 ); tempword =ft1000_read_reg (dev,FT1000_REG_DOORBELL );
@@ -1272,7 +1259,6 @@ void ft1000_proc_drvmsg(struct net_device *dev)ft1000_send_cmd (dev, (PUSHORT )&tempbuffer[0 ], (USHORT )(0x0012 ),0 ); info->DrvErrNum =0 ; } - info->DrvMsgPend =0 ;break ;default :
@@ -1339,13 +1325,11 @@ int ft1000_parse_dpram_msg(struct net_device *dev)ft1000_write_reg (dev,FT1000_REG_SUP_CTRL ,HOST_INTF_BE ); } - info->DspAsicReset =0 ; }if (doorbell &FT1000_DSP_ASIC_RESET ) {DEBUG (0 ,"FT1000:ft1000_parse_dpram_msg: Got a dsp ASIC reset message\n" ); - info->DspAsicReset =1 ;ft1000_write_reg (dev,FT1000_REG_DOORBELL ,FT1000_DSP_ASIC_RESET );udelay (200 );
@@ -2198,16 +2182,11 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,spin_lock_init (&info->dpram_lock); info->DrvErrNum =0 ; - info->ASICResetNum =0 ; info->registered =1 ; info->link = link; info->ft1000_reset = ft1000_reset; info->mediastate =0 ; info->fifo_cnt =0 ; - info->DeviceCreated = FALSE; - info->DeviceMajor =0 ; - info->CurrentInterruptEnableMask =ISR_DEFAULT_MASK ; - info->InterruptsEnabled = FALSE; info->CardReady =0 ; info->DSP_TIME[0 ] =0 ; info->DSP_TIME[1 ] =0 ;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +8 -10
@@ -75,16 +75,14 @@ int ft1000ReadProc(char *page, char **start, off_t off,/* Wrap-around */ if (info->AsicID ==ELECTRABUZZ_ID ) { -if (info->DspHibernateFlag ==0 ) { -if (info->ProgConStat !=0xFF ) { - info->LedStat = -ft1000_read_dpram (dev,FT1000_DSP_LED ); - info->ConStat = -ft1000_read_dpram (dev, -FT1000_DSP_CON_STATE ); - }else { - info->ConStat =0xf ; - } +if (info->ProgConStat !=0xFF ) { + info->LedStat = +ft1000_read_dpram (dev,FT1000_DSP_LED ); + info->ConStat = +ft1000_read_dpram (dev, +FT1000_DSP_CON_STATE ); + }else { + info->ConStat =0xf ; } }else {if (info->ProgConStat !=0xFF ) {
Signature · 1 line
Ondrej Zary
PATCH 18/28 staging: ft1000-pcmcia: remove custom defines for standard types
In reply to Ondrej ZaryRemove custom defines for standard types (u8, u16, u32...)
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 13 -- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 132 ++++++++++---------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 52 ++++---- 3 files changed, 92 insertions(+), 105 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -13
@@ -67,17 +67,6 @@ struct pseudo_hdrunsigned short checksum;// pseudo header checksum } __attribute__ ((packed)); -// Definitions to maintain compatibility between other platforms -#define UCHAR u8 -#define USHORT u16 -#define ULONG u32 -#define BOOLEAN u8 -#define PULONG u32 * -#define PUSHORT u16 * -#define PUCHAR u8 * -#define PCHAR u8 * -#define UINT u32 -#define ELECTRABUZZ_ID 0 // ASIC ID for Electrabuzz#define MAGNEMITE_ID 0x1a01 // ASIC ID for Magnemite
@@ -278,8 +267,6 @@ struct pseudo_hdr#define SUCCESS 0x00#define FAILURE 0x01 -#define TRUE 0x1 -#define FALSE 0x0#define MAXIMUM_ASIC_HB_CNT 15
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +66 -66
346 lines not on this page · raw message
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +26 -26
186 lines not on this page · raw message
Signature · 1 line
Ondrej Zary
PATCH 19/28 staging: ft1000-pcmcia: remove useless defines from ft1000_cs.c
In reply to Ondrej ZaryRemove unused defines from ft1000_cs.c
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +0 -7
@@ -50,10 +50,6 @@/*====================================================================*/ -/* Module parameters */ - -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") -MODULE_AUTHOR ("Wai Chan" );MODULE_DESCRIPTION ("FT1000 PCMCIA driver" );MODULE_LICENSE ("GPL" );
@@ -93,9 +89,6 @@ static void ft1000_release(struct pcmcia_device *link);static void ft1000_detach (struct pcmcia_device *link);static int ft1000_attach (struct pcmcia_device *link); -#define MAX_ASIC_RESET_CNT 10 -#define COR_DEFAULT 0x55 -/*====================================================================*/ static void ft1000_reset (struct pcmcia_device * link)
Signature · 1 line
Ondrej Zary
PATCH 20/28 staging: ft1000-pcmcia: remove useless debugging from ft1000_cs.c
In reply to Ondrej ZaryRemove useless debugging from ft1000_cs.c
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +0 -18
@@ -65,11 +65,6 @@ MODULE_LICENSE("GPL");left out. If you compile with PCMCIA_DEBUG=0, the debug code will be present but disabled. */ -#ifdef FT_DEBUG -#define DEBUG(n, args...) printk(KERN_DEBUG args) -#else -#define DEBUG(n, args...) -#endif /*====================================================================*/
@@ -103,8 +98,6 @@ static void ft1000_reset(struct pcmcia_device * link)static int ft1000_attach (struct pcmcia_device *link) { -DEBUG (0 ,"ft1000_cs: ft1000_attach()\n" ); - link->priv =NULL ; link->config_flags |=CONF_ENABLE_IRQ |CONF_AUTO_SET_IO ;
@@ -125,13 +118,6 @@ static void ft1000_detach(struct pcmcia_device *link) {struct net_device *dev = link->priv; -DEBUG (0 ,"ft1000_cs: ft1000_detach(0x%p)\n" , link); - -if (link ==NULL ) { -DEBUG (0 ,"ft1000_cs:ft1000_detach: Got a NULL pointer\n" ); -return ; - } -if (dev) {stop_ft1000_card (dev); }
@@ -207,8 +193,6 @@ failed:static void ft1000_release (struct pcmcia_device * link) { -DEBUG (0 ,"ft1000_cs: ft1000_release(0x%p)\n" , link); -/* If the device is currently in use, we won't release until it is actually closed, because until then, we can't be sure that
@@ -277,13 +261,11 @@ static struct pcmcia_driver ft1000_cs_driver = {static int __init init_ft1000_cs (void ) { -DEBUG (0 ,"ft1000_cs: loading\n" );return pcmcia_register_driver (&ft1000_cs_driver); } static void __exit exit_ft1000_cs(void) { -DEBUG (0 ,"ft1000_cs: unloading\n" );pcmcia_unregister_driver (&ft1000_cs_driver); }
Signature · 1 line
Ondrej Zary
PATCH 21/28 staging: ft1000-pcmcia: remove misleading and template comments from ft1000_cs.c
In reply to Ondrej ZaryRemove misleading, useless and template comments from ft1000_cs.c
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 78 ++-------------------- 1 files changed, 5 insertions(+), 73 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +5 -73
@@ -54,18 +54,6 @@ MODULE_AUTHOR("Wai Chan");MODULE_DESCRIPTION ("FT1000 PCMCIA driver" );MODULE_LICENSE ("GPL" ); -/* Newer, simpler way of listing specific interrupts */ - -/* The old way: bit map of interrupts to choose from */ -/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ - -/* -All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If -you do not define PCMCIA_DEBUG at all, all the debug code will be -left out. If you compile with PCMCIA_DEBUG=0, the debug code will -be present but disabled. -*/ -/*====================================================================*/ struct net_device *init_ft1000_card(struct pcmcia_device *link,
@@ -74,13 +62,6 @@ void stop_ft1000_card(struct net_device *);static int ft1000_config (struct pcmcia_device *link);static void ft1000_release (struct pcmcia_device *link); - -/* -The attach() and detach() entry points are used to create and destroy -"instances" of the driver, where each instance represents everything -needed to manage one actual PCMCIA card. -*/ -static void ft1000_detach (struct pcmcia_device *link);static int ft1000_attach (struct pcmcia_device *link);
@@ -91,11 +72,6 @@ static void ft1000_reset(struct pcmcia_device * link)pcmcia_reset_card (link->socket); } -/*====================================================================== - - -======================================================================*/ -static int ft1000_attach (struct pcmcia_device *link) { link->priv =NULL ;
@@ -103,16 +79,7 @@ static int ft1000_attach(struct pcmcia_device *link)return ft1000_config (link); -}/* ft1000_attach */ - -/*====================================================================== - -This deletes a driver "instance". The device is de-registered -with Card Services. If it has been released, all local data -structures are freed. Otherwise, the structures will be freed -when the device is released. - -======================================================================*/ +}static void ft1000_detach (struct pcmcia_device *link) {
@@ -126,18 +93,12 @@ static void ft1000_detach(struct pcmcia_device *link)free_netdev (dev); -}/* ft1000_detach */ - -/*====================================================================== - -Check if the io window is configured +} -======================================================================*/ int ft1000_confcheck (struct pcmcia_device *link,void *priv_data) { -return pcmcia_request_io (link); -}/* ft1000_confcheck */ +}/*======================================================================
@@ -180,7 +141,7 @@ failed:ft1000_release (link);return -ENODEV ; -}/* ft1000_config */ +}/*======================================================================
@@ -192,33 +153,8 @@ failed:static void ft1000_release (struct pcmcia_device * link) { - -/* -If the device is currently in use, we won't release until it -is actually closed, because until then, we can't be sure that -no one will try to access the device or its data structures. -*/ - -/* -In a normal driver, additional code may be needed to release -other kernel data structures associated with this device. -*/ -/* Don't bother checking to see if these succeed or not */ -pcmcia_disable_device (link); -}/* ft1000_release */ - -/*====================================================================== - -The card status event handler. Mostly, this schedules other -stuff to run after an event is received. - -When a CARD_REMOVAL event is received, we immediately set a -private flag to block future accesses to this device. All the -functions that actually access the device should check this flag -to make sure the card is still present. - -======================================================================*/ +}static int ft1000_suspend (struct pcmcia_device *link) {
@@ -231,13 +167,9 @@ static int ft1000_suspend(struct pcmcia_device *link)static int ft1000_resume (struct pcmcia_device *link) { -/* struct net_device *dev = link->priv; -*/ return 0 ; } - -/*====================================================================*/ static const struct pcmcia_device_id ft1000_ids[] = {
Signature · 1 line
Ondrej Zary
PATCH 22/28 staging: ft1000-pcmcia: remove unused ft1000_asic_read and ft1000_asic_write functions
In reply to Ondrej ZaryFunctions ft1000_asic_read() and ft1000_asic_write() are unused. Remove them.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 34 ---------------------- 1 files changed, 0 insertions(+), 34 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +0 -34
@@ -88,40 +88,6 @@ MODULE_SUPPORTED_DEVICE("FT1000");//--------------------------------------------------------------------------- // -// Function: ft1000_asic_read -// Description: This function will retrieve the value of a specific ASIC -// register. -// Input: -// dev - network device structure -// offset - ASIC register to read -// Output: -// value - value of ASIC register -// -//--------------------------------------------------------------------------- -inline u16 ft1000_asic_read (struct net_device *dev,u16 offset) -{ -return (ft1000_read_reg (dev, offset)); -} - -//--------------------------------------------------------------------------- -// -// Function: ft1000_asic_write -// Description: This function will set the value of a specific ASIC -// register. -// Input: -// dev - network device structure -// value - value to set ASIC register -// Output: -// none -// -//--------------------------------------------------------------------------- -inline void ft1000_asic_write (struct net_device *dev,u16 offset,u16 value) -{ -ft1000_write_reg (dev, offset, value); -} - -//--------------------------------------------------------------------------- -// // Function: ft1000_read_fifo_len // Description: This function will read the ASIC Uplink FIFO status register // which will return the number of bytes remaining in the Uplink FIFO.
Signature · 1 line
Ondrej Zary
PATCH 23/28 staging: ft1000-pcmcia: coding style fixes in ft1000_cs.c
In reply to Ondrej ZaryMinor coding style fixes in ft1000_cs.c
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 29 +++++++++------------- 1 files changed, 12 insertions(+), 17 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +12 -17
@@ -63,11 +63,11 @@ void stop_ft1000_card(struct net_device *);static int ft1000_config (struct pcmcia_device *link);static void ft1000_release (struct pcmcia_device *link);static void ft1000_detach (struct pcmcia_device *link); -static int ft1000_attach (struct pcmcia_device *link); +static int ft1000_attach (struct pcmcia_device *link);/*====================================================================*/ -static void ft1000_reset (struct pcmcia_device * link) +static void ft1000_reset (struct pcmcia_device *link) {pcmcia_reset_card (link->socket); }
@@ -78,21 +78,17 @@ static int ft1000_attach(struct pcmcia_device *link) link->config_flags |=CONF_ENABLE_IRQ |CONF_AUTO_SET_IO ;return ft1000_config (link); - }static void ft1000_detach (struct pcmcia_device *link) {struct net_device *dev = link->priv; -if (dev) { +if (dev)stop_ft1000_card (dev); - }pcmcia_disable_device (link); -free_netdev (dev); - }int ft1000_confcheck (struct pcmcia_device *link,void *priv_data)
@@ -110,7 +106,7 @@ int ft1000_confcheck(struct pcmcia_device *link, void *priv_data)static int ft1000_config (struct pcmcia_device *link) { -int ret; +int ret;dev_dbg (&link->dev,"ft1000_cs: ft1000_config(0x%p)\n" , link);
@@ -129,7 +125,7 @@ static int ft1000_config(struct pcmcia_device *link) } link->priv =init_ft1000_card (link, &ft1000_reset); -if (link->priv ==NULL ) { +if (!link->priv) {printk (KERN_INFO "ft1000: Could not register as network device\n" ); goto failed; }
@@ -140,7 +136,6 @@ static int ft1000_config(struct pcmcia_device *link) failed:ft1000_release (link);return -ENODEV ; - }/*======================================================================
@@ -151,7 +146,7 @@ failed:======================================================================*/ -static void ft1000_release (struct pcmcia_device * link) +static void ft1000_release (struct pcmcia_device *link) {pcmcia_disable_device (link); }
@@ -182,13 +177,13 @@ static const struct pcmcia_device_id ft1000_ids[] = {MODULE_DEVICE_TABLE (pcmcia, ft1000_ids);static struct pcmcia_driver ft1000_cs_driver = { - .owner =THIS_MODULE , - .name ="ft1000_cs" , - .probe = ft1000_attach, - .remove = ft1000_detach, + .owner =THIS_MODULE , + .name ="ft1000_cs" , + .probe = ft1000_attach, + .remove = ft1000_detach, .id_table = ft1000_ids, - .suspend = ft1000_suspend, - .resume = ft1000_resume, + .suspend = ft1000_suspend, + .resume = ft1000_resume, };static int __init init_ft1000_cs (void )
Signature · 1 line
Ondrej Zary
PATCH 24/28 staging: ft1000-pcmcia: remove unused includes from ft1000_cs.c
In reply to Ondrej ZaryRemove unused includes from ft1000_cs.c
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 15 --------------- 1 files changed, 0 insertions(+), 15 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +0 -15
@@ -29,25 +29,10 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> -#include <linux/ptrace.h> -#include <linux/slab.h> -#include <linux/string.h> -#include <linux/timer.h> -#include <linux/ioport.h> -#include <linux/delay.h> -#include <linux/netdevice.h> -#include <linux/etherdevice.h> -#include <pcmcia/cistpl.h> -#include <pcmcia/cisreg.h> #include <pcmcia/ds.h> -#include <asm/io.h> -#include <asm/system.h> -#include <asm/byteorder.h> -#include <asm/uaccess.h> -/*====================================================================*/ MODULE_AUTHOR ("Wai Chan" );
Signature · 1 line
Ondrej Zary
PATCH 25/28 staging: ft1000-pcmcia: remove useless ft1000_release() function
In reply to Ondrej ZaryRemove useless ft1000_release() function.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 16 +--------------- 1 files changed, 1 insertions(+), 15 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +1 -15
@@ -46,7 +46,6 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link,void stop_ft1000_card (struct net_device *);static int ft1000_config (struct pcmcia_device *link); -static void ft1000_release (struct pcmcia_device *link);static void ft1000_detach (struct pcmcia_device *link);static int ft1000_attach (struct pcmcia_device *link);
@@ -119,23 +118,10 @@ static int ft1000_config(struct pcmcia_device *link)return 0 ; failed: -ft1000_release (link); +pcmcia_disable_device (link);return -ENODEV ; } -/*====================================================================== - -After a card is removed, ft1000_release() will unregister the -device, and release the PCMCIA configuration. If the device is -still open, this will be postponed until it is closed. - -======================================================================*/ - -static void ft1000_release (struct pcmcia_device *link) -{ -pcmcia_disable_device (link); -} -static int ft1000_suspend (struct pcmcia_device *link) {struct net_device *dev = link->priv;
Signature · 1 line
Ondrej Zary
PATCH 26/28 staging: ft1000-pcmcia: CodingStyle fixes in ft1000.h
In reply to Ondrej ZaryMajor CodingStyle fixes in ft1000.h
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 621 ++++++++++++------------- 1 files changed, 297 insertions(+), 324 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +297 -324
@@ -1,281 +1,252 @@ -//--------------------------------------------------------------------------- -// FT1000 driver for Flarion Flash OFDM NIC Device -// -// Copyright (C) 2002 Flarion Technologies, All rights reserved. -// -// 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 -// 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, -// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// 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 -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - -// Suite 330, Boston, MA 02111-1307, USA. -//--------------------------------------------------------------------------- -// -// File: ft1000.h -// -// Description: Common structures and defines -// -// History: -// 8/29/02 Whc Ported to Linux. -// 7/19/04 Whc Drop packet and cmd msg with pseudo header -// checksum -// 10/27/04 Whc Added dynamic downloading of test image. -// 01/11/04 Whc Added support for Magnemite ASIC -// -//--------------------------------------------------------------------------- +/*--------------------------------------------------------------------------- +FT1000 driver for Flarion Flash OFDM NIC Device + +Copyright (C) 2002 Flarion Technologies, All rights reserved. + +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 +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, +but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +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 +License along with this program; if not, write to the +Free Software Foundation, Inc., 59 Temple Place - +Suite 330, Boston, MA 02111-1307, USA. +--------------------------------------------------------------------------- +Description: Common structures and defines +---------------------------------------------------------------------------*/ #ifndef _FT1000H_ #define _FT1000H_ - -#define FT1000_DRV_VER 0x01010300 - -#define DSPVERSZ 4 -#define HWSERNUMSZ 16 -#define SKUSZ 20 -#define EUISZ 8 -#define MODESZ 2 -#define CALVERSZ 2 -#define CALDATESZ 6 - -// Pseudo Header structure -struct pseudo_hdr -{ - unsigned short length; // length of msg body - unsigned char source; // hardware source id - // Host = 0x10 - // Dsp = 0x20 - unsigned char destination; // hardware destination id (refer to source) - unsigned char portdest; // software destination port id - // Host = 0x00 - // Applicaton Broadcast = 0x10 - // Network Stack = 0x20 - // Dsp OAM = 0x80 - // Dsp Airlink = 0x90 - // Dsp Loader = 0xa0 - // Dsp MIP = 0xb0 - unsigned char portsrc; // software source port id (refer to portdest) - unsigned short sh_str_id; // not used - unsigned char control; // not used - unsigned char rsvd1; - unsigned char seq_num; // message sequence number - unsigned char rsvd2; - unsigned short qos_class; // not used - unsigned short checksum; // pseudo header checksum -} __attribute__ ((packed)); - -#define ELECTRABUZZ_ID 0 // ASIC ID for Electrabuzz -#define MAGNEMITE_ID 0x1a01 // ASIC ID for Magnemite - -// MEMORY MAP common to both ELECTRABUZZ and MAGNEMITE -#define FT1000_REG_DPRAM_ADDR 0x000E // DPADR - Dual Port Ram Indirect Address Register -#define FT1000_REG_SUP_CTRL 0x0020 // HCTR - Host Control Register -#define FT1000_REG_SUP_STAT 0x0022 // HSTAT - Host Status Register -#define FT1000_REG_RESET 0x0024 // HCTR - Host Control Register -#define FT1000_REG_SUP_ISR 0x0026 // HISR - Host Interrupt Status Register -#define FT1000_REG_SUP_IMASK 0x0028 // HIMASK - Host Interrupt Mask -#define FT1000_REG_DOORBELL 0x002a // DBELL - Door Bell Register -#define FT1000_REG_ASIC_ID 0x002e // ASICID - ASIC Identification Number - // (Electrabuzz=0 Magnemite=0x1A01) - -// MEMORY MAP FOR ELECTRABUZZ ASIC - -#define FT1000_REG_UFIFO_STAT 0x0000 // UFSR - Uplink FIFO status register -#define FT1000_REG_UFIFO_BEG 0x0002 // UFBR - Uplink FIFO beginning register -#define FT1000_REG_UFIFO_MID 0x0004 // UFMR - Uplink FIFO middle register -#define FT1000_REG_UFIFO_END 0x0006 // UFER - Uplink FIFO end register -#define FT1000_REG_DFIFO_STAT 0x0008 // DFSR - Downlink FIFO status register -#define FT1000_REG_DFIFO 0x000A // DFR - Downlink FIFO Register -#define FT1000_REG_DPRAM_DATA 0x000C // DPRAM - Dual Port Indirect Data Register -#define FT1000_REG_WATERMARK 0x0010 // WMARK - Watermark Register - -// MEMORY MAP FOR MAGNEMITE -#define FT1000_REG_MAG_UFDR 0x0000 // UFDR - Uplink FIFO Data Register (32-bits) -#define FT1000_REG_MAG_UFDRL 0x0000 // UFDRL - Uplink FIFO Data Register low-word (16-bits) -#define FT1000_REG_MAG_UFDRH 0x0002 // UFDRH - Uplink FIFO Data Register high-word (16-bits) -#define FT1000_REG_MAG_UFER 0x0004 // UFER - Uplink FIFO End Register -#define FT1000_REG_MAG_UFSR 0x0006 // UFSR - Uplink FIFO Status Register -#define FT1000_REG_MAG_DFR 0x0008 // DFR - Downlink FIFO Register (32-bits) -#define FT1000_REG_MAG_DFRL 0x0008 // DFRL - Downlink FIFO Register low-word (16-bits) -#define FT1000_REG_MAG_DFRH 0x000a // DFRH - Downlink FIFO Register high-word (16-bits) -#define FT1000_REG_MAG_DFSR 0x000c // DFSR - Downlink FIFO Status Register -#define FT1000_REG_MAG_DPDATA 0x0010 // DPDATA - Dual Port RAM Indirect Data Register (32-bits) -#define FT1000_REG_MAG_DPDATAL 0x0010 // DPDATAL - Dual Port RAM Indirect Data Register low-word (16-bits) -#define FT1000_REG_MAG_DPDATAH 0x0012 // DPDATAH - Dual Port RAM Indirect Data Register high-word (16-bits) -#define FT1000_REG_MAG_WATERMARK 0x002c // WMARK - Watermark Register - -// Reserved Dual Port RAM offsets for Electrabuzz -#define FT1000_DPRAM_TX_BASE 0x0002 // Host to PC Card Messaging Area -#define FT1000_DPRAM_RX_BASE 0x0800 // PC Card to Host Messaging Area -#define FT1000_FIFO_LEN 0x7FC // total length for DSP FIFO tracking -#define FT1000_HI_HO 0x7FE // heartbeat with HI/HO -#define FT1000_DSP_STATUS 0xFFE // dsp status - non-zero is a request to reset dsp -#define FT1000_DSP_LED 0xFFA // dsp led status for PAD device -#define FT1000_DSP_CON_STATE 0xFF8 // DSP Connection Status Info -#define FT1000_DPRAM_FEFE 0x002 // location for dsp ready indicator -#define FT1000_DSP_TIMER0 0x1FF0 // Timer Field from Basestation -#define FT1000_DSP_TIMER1 0x1FF2 // Timer Field from Basestation -#define FT1000_DSP_TIMER2 0x1FF4 // Timer Field from Basestation -#define FT1000_DSP_TIMER3 0x1FF6 // Timer Field from Basestation - -// Reserved Dual Port RAM offsets for Magnemite -#define FT1000_DPRAM_MAG_TX_BASE 0x0000 // Host to PC Card Messaging Area -#define FT1000_DPRAM_MAG_RX_BASE 0x0200 // PC Card to Host Messaging Area -#define FT1000_MAG_FIFO_LEN 0x1FF // total length for DSP FIFO tracking -#define FT1000_MAG_FIFO_LEN_INDX 0x1 // low-word index -#define FT1000_MAG_HI_HO 0x1FF // heartbeat with HI/HO -#define FT1000_MAG_HI_HO_INDX 0x0 // high-word index -#define FT1000_MAG_DSP_LED 0x3FE // dsp led status for PAD device -#define FT1000_MAG_DSP_LED_INDX 0x0 // dsp led status for PAD device - -#define FT1000_MAG_DSP_CON_STATE 0x3FE // DSP Connection Status Info -#define FT1000_MAG_DSP_CON_STATE_INDX 0x1 // DSP Connection Status Info - -#define FT1000_MAG_DPRAM_FEFE 0x000 // location for dsp ready indicator -#define FT1000_MAG_DPRAM_FEFE_INDX 0x0 // location for dsp ready indicator - -#define FT1000_MAG_DSP_TIMER0 0x3FC // Timer Field from Basestation -#define FT1000_MAG_DSP_TIMER0_INDX 0x1 - -#define FT1000_MAG_DSP_TIMER1 0x3FC // Timer Field from Basestation -#define FT1000_MAG_DSP_TIMER1_INDX 0x0 - -#define FT1000_MAG_DSP_TIMER2 0x3FD // Timer Field from Basestation -#define FT1000_MAG_DSP_TIMER2_INDX 0x1 - -#define FT1000_MAG_DSP_TIMER3 0x3FD // Timer Field from Basestation -#define FT1000_MAG_DSP_TIMER3_INDX 0x0 - -#define FT1000_MAG_TOTAL_LEN 0x200 -#define FT1000_MAG_TOTAL_LEN_INDX 0x1 - -#define FT1000_MAG_PH_LEN 0x200 -#define FT1000_MAG_PH_LEN_INDX 0x0 - -#define FT1000_MAG_PORT_ID 0x201 -#define FT1000_MAG_PORT_ID_INDX 0x0 - -#define HOST_INTF_LE 0x0 // Host interface little endian mode -#define HOST_INTF_BE 0x1 // Host interface big endian mode - -// PC Card to Host Doorbell assignments -#define FT1000_DB_DPRAM_RX 0x0001 // this value indicates that DSP has - // data for host in DPRAM -#define FT1000_ASIC_RESET_REQ 0x0004 // DSP requesting host to reset the ASIC -#define FT1000_DSP_ASIC_RESET 0x0008 // DSP indicating host that it will reset the ASIC -#define FT1000_DB_COND_RESET 0x0010 // DSP request for a card reset. - -// Host to PC Card Doorbell assignments -#define FT1000_DB_DPRAM_TX 0x0100 // this value indicates that host has - // data for DSP in DPRAM. -#define FT1000_ASIC_RESET_DSP 0x0400 // Responds to FT1000_ASIC_RESET_REQ -#define FT1000_DB_HB 0x1000 // Indicates that supervisor - // has a heartbeat message for DSP. - -#define FT1000_DPRAM_BASE 0x0000 // Dual Port RAM starting offset - -#define hi 0x6869 // PC Card heartbeat values -#define ho 0x686f // PC Card heartbeat values - -// Magnemite specific defines -#define hi_mag 0x6968 // Byte swap hi to avoid additional system call -#define ho_mag 0x6f68 // Byte swap ho to avoid additional system call - -// -// Bit field definitions for Host Interrupt Status Register -// -// Indicate the cause of an interrupt. -// -#define ISR_EMPTY 0x00 // no bits set -#define ISR_DOORBELL_ACK 0x01 // Doorbell acknowledge from DSP -#define ISR_DOORBELL_PEND 0x02 // Doorbell pending from DSP -#define ISR_RCV 0x04 // Packet available in Downlink FIFO -#define ISR_WATERMARK 0x08 // Watermark requirements satisfied - -// Bit field definition for Host Interrupt Mask -#define ISR_MASK_NONE 0x0000 // no bits set -#define ISR_MASK_DOORBELL_ACK 0x0001 // Doorbell acknowledge mask -#define ISR_MASK_DOORBELL_PEND 0x0002 // Doorbell pending mask -#define ISR_MASK_RCV 0x0004 // Downlink Packet available mask -#define ISR_MASK_WATERMARK 0x0008 // Watermark interrupt mask -#define ISR_MASK_ALL 0xffff // Mask all interrupts - -// Bit field definition for Host Control Register -#define DSP_RESET_BIT 0x0001 // Bit field to control dsp reset state - // (0 = out of reset 1 = reset) -#define ASIC_RESET_BIT 0x0002 // Bit field to control ASIC reset state - // (0 = out of reset 1 = reset) - -// Default interrupt mask (Enable Doorbell pending and Packet available interrupts) -#define ISR_DEFAULT_MASK 0x7ff9 - -// Application specific IDs -#define DSPID 0x20 -#define HOSTID 0x10 -#define DSPAIRID 0x90 -#define DRIVERID 0x00 -#define NETWORKID 0x20 - -// Size of DPRAM Message -#define MAX_CMD_SQSIZE 1780 - -#define ENET_MAX_SIZE 1514 -#define ENET_HEADER_SIZE 14 - -#define SLOWQ_TYPE 0 -#define FASTQ_TYPE 1 - -#define MAX_DSP_SESS_REC 1024 - -#define DSP_QID_OFFSET 4 -#define PSEUDOSZ 16 -#define PSEUDOSZWRD 8 - -// Maximum number of occurrence of pseudo header errors before resetting PC Card. -#define MAX_PH_ERR 300 - -// Driver message types -#define MEDIA_STATE 0x0010 -#define TIME_UPDATE 0x0020 -#define DSP_PROVISION 0x0030 -#define DSP_INIT_MSG 0x0050 -#define DSP_HIBERNATE 0x0060 - -#define DSP_STORE_INFO 0x0070 -#define DSP_GET_INFO 0x0071 -#define GET_DRV_ERR_RPT_MSG 0x0073 -#define RSP_DRV_ERR_RPT_MSG 0x0074 - -// Driver Error Messages for DSP -#define DSP_HB_INFO 0x7ef0 -#define DSP_FIFO_INFO 0x7ef1 -#define DSP_CONDRESET_INFO 0x7ef2 -#define DSP_CMDLEN_INFO 0x7ef3 -#define DSP_CMDPHCKSUM_INFO 0x7ef4 -#define DSP_PKTPHCKSUM_INFO 0x7ef5 -#define DSP_PKTLEN_INFO 0x7ef6 -#define DSP_USER_RESET 0x7ef7 -#define FIFO_FLUSH_MAXLIMIT 0x7ef8 -#define FIFO_FLUSH_BADCNT 0x7ef9 -#define FIFO_ZERO_LEN 0x7efa - -#define HOST_QID_OFFSET 5 -#define QTYPE_OFFSET 13 - -#define SUCCESS 0x00 -#define FAILURE 0x01 - -#define MAXIMUM_ASIC_HB_CNT 15 +#define FT1000_DRV_VER 0x01010300 + +#define DSPVERSZ 4 +#define HWSERNUMSZ 16 +#define SKUSZ 20 +#define EUISZ 8 +#define MODESZ 2 +#define CALVERSZ 2 +#define CALDATESZ 6 + +/* Pseudo Header structure */ +struct pseudo_hdr { + unsigned short length; /* length of msg body */ + unsigned char source; /* hardware source id */ + /* Host = 0x10 */ + /* Dsp = 0x20 */ + unsigned char destination; /* hardware destination id (refer to source) */ + unsigned char portdest; /* software destination port id */ + /* Host = 0x00 */ + /* Applicaton Broadcast = 0x10 */ + /* Network Stack = 0x20 */ + /* Dsp OAM = 0x80 */ + /* Dsp Airlink = 0x90 */ + /* Dsp Loader = 0xa0 */ + /* Dsp MIP = 0xb0 */ + unsigned char portsrc; /* software source port id (refer to portdest) */ + unsigned short sh_str_id; /* not used */ + unsigned char control; /* not used */ + unsigned char rsvd1; + unsigned char seq_num; /* message sequence number */ + unsigned char rsvd2; + unsigned short qos_class; /* not used */ + unsigned short checksum; /* pseudo header checksum */ +} __packed; + +#define ELECTRABUZZ_ID 0 /* ASIC ID for Electrabuzz */ +#define MAGNEMITE_ID 0x1a01 /* ASIC ID for Magnemite */ + +/* MEMORY MAP common to both ELECTRABUZZ and MAGNEMITE */ +#define FT1000_REG_DPRAM_ADDR 0x000E /* DPADR - Dual Port Ram Indirect Address Register */ +#define FT1000_REG_SUP_CTRL 0x0020 /* HCTR - Host Control Register */ +#define FT1000_REG_SUP_STAT 0x0022 /* HSTAT - Host Status Register */ +#define FT1000_REG_RESET 0x0024 /* HCTR - Host Control Register */ +#define FT1000_REG_SUP_ISR 0x0026 /* HISR - Host Interrupt Status Register */ +#define FT1000_REG_SUP_IMASK 0x0028 /* HIMASK - Host Interrupt Mask */ +#define FT1000_REG_DOORBELL 0x002a /* DBELL - Door Bell Register */ +#define FT1000_REG_ASIC_ID 0x002e /* ASICID - ASIC Identification Number */ + +/* MEMORY MAP FOR ELECTRABUZZ ASIC */ +#define FT1000_REG_UFIFO_STAT 0x0000 /* UFSR - Uplink FIFO status register */ +#define FT1000_REG_UFIFO_BEG 0x0002 /* UFBR - Uplink FIFO beginning register */ +#define FT1000_REG_UFIFO_MID 0x0004 /* UFMR - Uplink FIFO middle register */ +#define FT1000_REG_UFIFO_END 0x0006 /* UFER - Uplink FIFO end register */ +#define FT1000_REG_DFIFO_STAT 0x0008 /* DFSR - Downlink FIFO status register */ +#define FT1000_REG_DFIFO 0x000A /* DFR - Downlink FIFO Register */ +#define FT1000_REG_DPRAM_DATA 0x000C /* DPRAM - Dual Port Indirect Data Register */ +#define FT1000_REG_WATERMARK 0x0010 /* WMARK - Watermark Register */ + +/* MEMORY MAP FOR MAGNEMITE */ +#define FT1000_REG_MAG_UFDR 0x0000 /* UFDR - Uplink FIFO Data Register (32-bits) */ +#define FT1000_REG_MAG_UFDRL 0x0000 /* UFDRL - Uplink FIFO Data Register low-word (16-bits) */ +#define FT1000_REG_MAG_UFDRH 0x0002 /* UFDRH - Uplink FIFO Data Register high-word (16-bits) */ +#define FT1000_REG_MAG_UFER 0x0004 /* UFER - Uplink FIFO End Register */ +#define FT1000_REG_MAG_UFSR 0x0006 /* UFSR - Uplink FIFO Status Register */ +#define FT1000_REG_MAG_DFR 0x0008 /* DFR - Downlink FIFO Register (32-bits) */ +#define FT1000_REG_MAG_DFRL 0x0008 /* DFRL - Downlink FIFO Register low-word (16-bits) */ +#define FT1000_REG_MAG_DFRH 0x000a /* DFRH - Downlink FIFO Register high-word (16-bits) */ +#define FT1000_REG_MAG_DFSR 0x000c /* DFSR - Downlink FIFO Status Register */ +#define FT1000_REG_MAG_DPDATA 0x0010 /* DPDATA - Dual Port RAM Indirect Data Register (32-bits) */ +#define FT1000_REG_MAG_DPDATAL 0x0010 /* DPDATAL - Dual Port RAM Indirect Data Register low-word (16-bits) */ +#define FT1000_REG_MAG_DPDATAH 0x0012 /* DPDATAH - Dual Port RAM Indirect Data Register high-word (16-bits) */ +#define FT1000_REG_MAG_WATERMARK 0x002c /* WMARK - Watermark Register */ + +/* Reserved Dual Port RAM offsets for Electrabuzz */ +#define FT1000_DPRAM_TX_BASE 0x0002 /* Host to PC Card Messaging Area */ +#define FT1000_DPRAM_RX_BASE 0x0800 /* PC Card to Host Messaging Area */ +#define FT1000_FIFO_LEN 0x07FC /* total length for DSP FIFO tracking */ +#define FT1000_HI_HO 0x07FE /* heartbeat with HI/HO */ +#define FT1000_DSP_STATUS 0x0FFE /* dsp status - non-zero is a request to reset dsp */ +#define FT1000_DSP_LED 0x0FFA /* dsp led status for PAD device */ +#define FT1000_DSP_CON_STATE 0x0FF8 /* DSP Connection Status Info */ +#define FT1000_DPRAM_FEFE 0x0002 /* location for dsp ready indicator */ +#define FT1000_DSP_TIMER0 0x1FF0 /* Timer Field from Basestation */ +#define FT1000_DSP_TIMER1 0x1FF2 /* Timer Field from Basestation */ +#define FT1000_DSP_TIMER2 0x1FF4 /* Timer Field from Basestation */ +#define FT1000_DSP_TIMER3 0x1FF6 /* Timer Field from Basestation */ + +/* Reserved Dual Port RAM offsets for Magnemite */ +#define FT1000_DPRAM_MAG_TX_BASE 0x0000 /* Host to PC Card Messaging Area */ +#define FT1000_DPRAM_MAG_RX_BASE 0x0200 /* PC Card to Host Messaging Area */ + +#define FT1000_MAG_FIFO_LEN 0x1FF /* total length for DSP FIFO tracking */ +#define FT1000_MAG_FIFO_LEN_INDX 0x1 /* low-word index */ +#define FT1000_MAG_HI_HO 0x1FF /* heartbeat with HI/HO */ +#define FT1000_MAG_HI_HO_INDX 0x0 /* high-word index */ +#define FT1000_MAG_DSP_LED 0x3FE /* dsp led status for PAD device */ +#define FT1000_MAG_DSP_LED_INDX 0x0 /* dsp led status for PAD device */ +#define FT1000_MAG_DSP_CON_STATE 0x3FE /* DSP Connection Status Info */ +#define FT1000_MAG_DSP_CON_STATE_INDX 0x1 /* DSP Connection Status Info */ +#define FT1000_MAG_DPRAM_FEFE 0x000 /* location for dsp ready indicator */ +#define FT1000_MAG_DPRAM_FEFE_INDX 0x0 /* location for dsp ready indicator */ +#define FT1000_MAG_DSP_TIMER0 0x3FC /* Timer Field from Basestation */ +#define FT1000_MAG_DSP_TIMER0_INDX 0x1 +#define FT1000_MAG_DSP_TIMER1 0x3FC /* Timer Field from Basestation */ +#define FT1000_MAG_DSP_TIMER1_INDX 0x0 +#define FT1000_MAG_DSP_TIMER2 0x3FD /* Timer Field from Basestation */ +#define FT1000_MAG_DSP_TIMER2_INDX 0x1 +#define FT1000_MAG_DSP_TIMER3 0x3FD /* Timer Field from Basestation */ +#define FT1000_MAG_DSP_TIMER3_INDX 0x0 +#define FT1000_MAG_TOTAL_LEN 0x200 +#define FT1000_MAG_TOTAL_LEN_INDX 0x1 +#define FT1000_MAG_PH_LEN 0x200 +#define FT1000_MAG_PH_LEN_INDX 0x0 +#define FT1000_MAG_PORT_ID 0x201 +#define FT1000_MAG_PORT_ID_INDX 0x0 + +#define HOST_INTF_LE 0x0 /* Host interface little endian mode */ +#define HOST_INTF_BE 0x1 /* Host interface big endian mode */ + +/* PC Card to Host Doorbell assignments */ +#define FT1000_DB_DPRAM_RX 0x0001 /* this value indicates that DSP has data for host in DPRAM */ +#define FT1000_ASIC_RESET_REQ 0x0004 /* DSP requesting host to reset the ASIC */ +#define FT1000_DSP_ASIC_RESET 0x0008 /* DSP indicating host that it will reset the ASIC */ +#define FT1000_DB_COND_RESET 0x0010 /* DSP request for a card reset. */ + +/* Host to PC Card Doorbell assignments */ +#define FT1000_DB_DPRAM_TX 0x0100 /* this value indicates that host has data for DSP in DPRAM. */ +#define FT1000_ASIC_RESET_DSP 0x0400 /* Responds to FT1000_ASIC_RESET_REQ */ +#define FT1000_DB_HB 0x1000 /* Indicates that supervisor has a heartbeat message for DSP. */ + +#define FT1000_DPRAM_BASE 0x0000 /* Dual Port RAM starting offset */ + +#define hi 0x6869 /* PC Card heartbeat values */ +#define ho 0x686f /* PC Card heartbeat values */ + +/* Magnemite specific defines */ +#define hi_mag 0x6968 /* Byte swap hi to avoid additional system call */ +#define ho_mag 0x6f68 /* Byte swap ho to avoid additional system call */ + +/* Bit field definitions for Host Interrupt Status Register */ +/* Indicate the cause of an interrupt. */ +#define ISR_EMPTY 0x00 /* no bits set */ +#define ISR_DOORBELL_ACK 0x01 /* Doorbell acknowledge from DSP */ +#define ISR_DOORBELL_PEND 0x02 /* Doorbell pending from DSP */ +#define ISR_RCV 0x04 /* Packet available in Downlink FIFO */ +#define ISR_WATERMARK 0x08 /* Watermark requirements satisfied */ + +/* Bit field definition for Host Interrupt Mask */ +#define ISR_MASK_NONE 0x0000 /* no bits set */ +#define ISR_MASK_DOORBELL_ACK 0x0001 /* Doorbell acknowledge mask */ +#define ISR_MASK_DOORBELL_PEND 0x0002 /* Doorbell pending mask */ +#define ISR_MASK_RCV 0x0004 /* Downlink Packet available mask */ +#define ISR_MASK_WATERMARK 0x0008 /* Watermark interrupt mask */ +#define ISR_MASK_ALL 0xffff /* Mask all interrupts */ + +/* Bit field definition for Host Control Register */ +#define DSP_RESET_BIT 0x0001 /* Bit field to control dsp reset state */ + /* (0 = out of reset 1 = reset) */ +#define ASIC_RESET_BIT 0x0002 /* Bit field to control ASIC reset state */ + /* (0 = out of reset 1 = reset) */ + +/* Default interrupt mask (Enable Doorbell pending and Packet available interrupts) */ +#define ISR_DEFAULT_MASK 0x7ff9 + +/* Application specific IDs */ +#define DSPID 0x20 +#define HOSTID 0x10 +#define DSPAIRID 0x90 +#define DRIVERID 0x00 +#define NETWORKID 0x20 + +/* Size of DPRAM Message */ +#define MAX_CMD_SQSIZE 1780 + +#define ENET_MAX_SIZE 1514 +#define ENET_HEADER_SIZE 14 + +#define SLOWQ_TYPE 0 +#define FASTQ_TYPE 1 + +#define MAX_DSP_SESS_REC 1024 + +#define DSP_QID_OFFSET 4 +#define PSEUDOSZ 16 +#define PSEUDOSZWRD 8 + +/* Maximum number of occurrence of pseudo header errors before resetting PC Card. */ +#define MAX_PH_ERR 300 + +/* Driver message types */ +#define MEDIA_STATE 0x0010 +#define TIME_UPDATE 0x0020 +#define DSP_PROVISION 0x0030 +#define DSP_INIT_MSG 0x0050 +#define DSP_HIBERNATE 0x0060 + +#define DSP_STORE_INFO 0x0070 +#define DSP_GET_INFO 0x0071 +#define GET_DRV_ERR_RPT_MSG 0x0073 +#define RSP_DRV_ERR_RPT_MSG 0x0074 + +/* Driver Error Messages for DSP */ +#define DSP_HB_INFO 0x7ef0 +#define DSP_FIFO_INFO 0x7ef1 +#define DSP_CONDRESET_INFO 0x7ef2 +#define DSP_CMDLEN_INFO 0x7ef3 +#define DSP_CMDPHCKSUM_INFO 0x7ef4 +#define DSP_PKTPHCKSUM_INFO 0x7ef5 +#define DSP_PKTLEN_INFO 0x7ef6 +#define DSP_USER_RESET 0x7ef7 +#define FIFO_FLUSH_MAXLIMIT 0x7ef8 +#define FIFO_FLUSH_BADCNT 0x7ef9 +#define FIFO_ZERO_LEN 0x7efa + +#define HOST_QID_OFFSET 5 +#define QTYPE_OFFSET 13 + +#define SUCCESS 0x00 +#define FAILURE 0x01 + +#define MAXIMUM_ASIC_HB_CNT 15 struct drv_msg { struct pseudo_hdr pseudo; u16 type; u16 length; u8 data[0]; -} __attribute__ ((packed)); +} __packed; struct media_msg { struct pseudo_hdr pseudo;
@@ -283,81 +254,83 @@ struct media_msg {u16 length;u16 state;u32 ip_addr; -u32 net_mask; +u32 net_mask;u32 gateway;u32 dns_1;u32 dns_2; -} __attribute__ ((packed)); +} __packed;struct dsp_init_msg { -struct pseudo_hdr pseudo; -u16 type; -u16 length; -u8 DspVer[DSPVERSZ ];// DSP version number -u8 HwSerNum[HWSERNUMSZ ];// Hardware Serial Number -u8 Sku[SKUSZ ];// SKU -u8 eui64[EUISZ ];// EUI64 -u8 ProductMode[MODESZ ];// Product Mode (Market/Production) -u8 RfCalVer[CALVERSZ ];// Rf Calibration version -u8 RfCalDate[CALDATESZ ];// Rf Calibration date -} __attribute__ ((packed)); +struct pseudo_hdr pseudo; +u16 type; +u16 length; +u8 DspVer[DSPVERSZ ];/* DSP version number */ +u8 HwSerNum[HWSERNUMSZ ];/* Hardware Serial Number */ +u8 Sku[SKUSZ ];/* SKU */ +u8 eui64[EUISZ ];/* EUI64 */ +u8 ProductMode[MODESZ ];/* Product Mode (Market/Production) */ +u8 RfCalVer[CALVERSZ ];/* Rf Calibration version */ +u8 RfCalDate[CALDATESZ ];/* Rf Calibration date */ +} __packed;struct prov_record { -struct list_head list; -u8 *pprov_data; +struct list_head list; +u8 *pprov_data; };struct ft1000_info { -struct net_device_stats stats; -u16 DrvErrNum; -u16 AsicID; -int PktIntfErr; -int CardReady; -int registered; -int mediastate; -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; +struct net_device_stats stats; +u16 DrvErrNum; +u16 AsicID; +int PktIntfErr; +int CardReady; +int registered; +int mediastate; +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; -u16 DSPInfoBlk[MAX_DSP_SESS_REC ]; -union { -u16 Rec[MAX_DSP_SESS_REC ]; -u32 MagRec[MAX_DSP_SESS_REC /2 ]; - } DSPSess; +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 ]; }; -extern u16 ft1000_read_dpram (struct net_device *dev,int offset); +extern u16 ft1000_read_dpram (struct net_device *dev,int offset);extern void card_bootload (struct net_device *dev); -extern u16 ft1000_read_dpram_mag_16 (struct net_device *dev,int offset,int Index); -extern u32 ft1000_read_dpram_mag_32 (struct net_device *dev,int offset); -void ft1000_write_dpram_mag_32 (struct net_device *dev,int offset,u32 value); +extern u16 ft1000_read_dpram_mag_16 (struct net_device *dev,int offset,int Index); +extern u32 ft1000_read_dpram_mag_32 (struct net_device *dev,int offset); +void ft1000_write_dpram_mag_32 (struct net_device *dev,int offset,u32 value);/* Read the value of a given ASIC register. */ -static inline u16 ft1000_read_reg (struct net_device *dev,u16 offset) { -return inw (dev->base_addr + offset); +static inline u16 ft1000_read_reg (struct net_device *dev,u16 offset) +{ +return inw (dev->base_addr + offset); }/* Set the value of a given ASIC register. */ -static inline void ft1000_write_reg (struct net_device *dev,u16 offset,u16 value) { -outw (value, dev->base_addr + offset); +static inline void ft1000_write_reg (struct net_device *dev,u16 offset,u16 value) +{ +outw (value, dev->base_addr + offset); } -#endif // _FT1000H_ +#endif
Signature · 1 line
Ondrej Zary
PATCH 27/28 staging: ft1000-pcmcia: remove PSEUDOSZ, use sizeof(struct pseudo_hdr) instead
In reply to Ondrej ZaryPSEUDOSZ seems to define struct pseudo_hdr size. Remove it and use sizeof(struct pseudo_hdr) directly.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 2 -- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +0 -2
@@ -202,8 +202,6 @@ struct pseudo_hdr {#define MAX_DSP_SESS_REC 1024#define DSP_QID_OFFSET 4 -#define PSEUDOSZ 16 -#define PSEUDOSZWRD 8/* Maximum number of occurrence of pseudo header errors before resetting PC Card. */ #define MAX_PH_ERR 300
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +4 -4
@@ -795,7 +795,7 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qtu16 tempword;unsigned long flags; - size +=PSEUDOSZ ; + size +=sizeof (struct pseudo_hdr );// check for odd byte and increment to 16-bit word align value if ((size &0x0001 )) { size++;
@@ -883,12 +883,12 @@ bool ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16 *punsigned long flags;if (info->AsicID ==ELECTRABUZZ_ID ) { - size = (ft1000_read_dpram (dev, *pnxtph) ) +PSEUDOSZ ; + size = (ft1000_read_dpram (dev, *pnxtph) ) +sizeof (struct pseudo_hdr ); }else { size =ntohs (ft1000_read_dpram_mag_16 (dev,FT1000_MAG_PH_LEN , -FT1000_MAG_PH_LEN_INDX )) +PSEUDOSZ ; +FT1000_MAG_PH_LEN_INDX )) +sizeof (struct pseudo_hdr ); }if (size > maxsz) { DEBUG(1,
@@ -1317,7 +1317,7 @@ int ft1000_parse_dpram_msg(struct net_device *dev) }DEBUG (1 ,"FT1000:ft1000_parse_dpram_msg:total length = %d\n" , total_len); -if ((total_len <MAX_CMD_SQSIZE ) && (total_len >PSEUDOSZ )) { +if ((total_len <MAX_CMD_SQSIZE ) && (total_len >sizeof (struct pseudo_hdr ))) { total_len += nxtph; cnt =0 ;// ft1000_read_reg will return a value that needs to be byteswap
Signature · 1 line
Ondrej Zary
PATCH 28/28 staging: ft1000-pcmcia: remove support for v5 firmware
In reply to Ondrej ZaryRemove support for v5 firmware images as all known firmware images are v6.
--- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 422 ++++++-------------- 1 files changed, 129 insertions(+), 293 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +129 -293
@@ -94,18 +94,6 @@ void put_request_value(struct net_device *dev, long lvalue);u16 hdr_checksum (struct pseudo_hdr *pHdr);struct dsp_file_hdr { -u32 build_date; -u32 dsp_coff_date; -u32 loader_code_address; -u32 loader_code_size; -u32 loader_code_end; -u32 dsp_code_address; -u32 dsp_code_size; -u32 dsp_code_end; -u32 reserved[8 ]; -} __attribute__ ((packed)); - -struct dsp_file_hdr_5 {u32 version_id;// Version ID of this image format. u32 package_id;// Package ID of code release. u32 build_date;// Date/time stamp when file was built.
@@ -126,15 +114,6 @@ struct dsp_image_info {u32 run_address;// On chip Start address of DSP code. u32 image_size;// Size of image. u32 version;// Embedded version # of DSP code. -} __attribute__ ((packed)); - -struct dsp_image_info_v6 { -u32 coff_date;// Date/time when DSP Coff image was built. -u32 begin_offset;// Offset in file where image begins. -u32 end_offset;// Offset in file where image begins. -u32 run_address;// On chip Start address of DSP code. -u32 image_size;// Size of image. -u32 version;// Embedded version # of DSP code. unsigned short checksum;// Dsp File checksum unsigned short pad1; } __attribute__ ((packed));
@@ -312,20 +291,17 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) {struct ft1000_info *info = (struct ft1000_info *)netdev_priv (dev);int Status =SUCCESS ; -u16 DspWordCnt =0 ;u32 uiState;u16 handshake;struct pseudo_hdr *pHdr;u16 usHdrLength; -struct dsp_file_hdr *pFileHdr;long word_length;u16 request;u16 temp;struct prov_record *pprov_record;u8 *pbuffer; -struct dsp_file_hdr_5 *pFileHdr5; -struct dsp_image_info *pDspImageInfo =NULL ; -struct dsp_image_info_v6 *pDspImageInfoV6 =NULL ; +struct dsp_file_hdr *pFileHdr5; +struct dsp_image_info *pDspImageInfoV6 =NULL ;long requested_version;bool bGoodVersion =0 ;struct drv_msg *pMailBoxData;
@@ -344,36 +320,22 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)unsigned long templong;unsigned long image_chksum =0 ; -// -// Get version id of file, at first 4 bytes of file, for newer files. -// file_version = *(long *)pFileStart; +if (file_version !=6 ) { +printk (KERN_ERR "ft1000: unsupported firmware version %ld\n" , file_version); + Status =FAILURE ; + } uiState =STATE_START_DWNLD ; - pFileHdr = (struct dsp_file_hdr *) pFileStart; - pFileHdr5 = (struct dsp_file_hdr_5 *) pFileStart; - -switch (file_version) { -case 5 : -case 6 : - pUsFile = - (u16 *) ((long )pFileStart + pFileHdr5->loader_offset); - pUcFile = - (u8 *) ((long )pFileStart + pFileHdr5->loader_offset); - - pBootEnd = - (u8 *) ((long )pFileStart + pFileHdr5->loader_code_end); + pFileHdr5 = (struct dsp_file_hdr *) pFileStart; - loader_code_address = pFileHdr5->loader_code_address; - loader_code_size = pFileHdr5->loader_code_size; - bGoodVersion = false; -break ; - -default : - Status =FAILURE ; -break ; - } + pUsFile = (u16 *) ((long )pFileStart + pFileHdr5->loader_offset); + pUcFile = (u8 *) ((long )pFileStart + pFileHdr5->loader_offset); + pBootEnd = (u8 *) ((long )pFileStart + pFileHdr5->loader_code_end); + loader_code_address = pFileHdr5->loader_code_address; + loader_code_size = pFileHdr5->loader_code_size; + bGoodVersion = false;while ((Status ==SUCCESS ) && (uiState !=STATE_DONE_FILE )) {
@@ -431,45 +393,24 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)// Provide mutual exclusive access while reading ASIC registers. spin_lock_irqsave (&info->dpram_lock, flags); -if (file_version ==5 ) { -/* -* Position ASIC DPRAM auto-increment pointer. -*/ -ft1000_write_reg (dev, -FT1000_REG_DPRAM_ADDR , -DWNLD_PS_HDR_LOC ); - -for (; word_length >0 ; word_length--) {/* In words */ -//temp = *pUsFile; -//temp = RtlUshortByteSwap(temp); -ft1000_write_reg (dev, -FT1000_REG_DPRAM_DATA , - *pUsFile); - pUsFile++; - pUcFile +=2 ; - DspWordCnt++; - } - }else { -/* -* Position ASIC DPRAM auto-increment pointer. -*/ -outw (DWNLD_MAG_PS_HDR_LOC , +/* +* Position ASIC DPRAM auto-increment pointer. +*/ +outw (DWNLD_MAG_PS_HDR_LOC , + dev->base_addr + +FT1000_REG_DPRAM_ADDR ); +if (word_length &0x01 ) + word_length++; + word_length = word_length /2 ; + +for (; word_length >0 ; word_length--) {/* In words */ + templong = *pUsFile++; + templong |= + (*pUsFile++ <<16 ); + pUcFile +=4 ; +outl (templong, dev->base_addr + -FT1000_REG_DPRAM_ADDR ); -if (word_length &0x01 ) { - word_length++; - } - word_length = word_length /2 ; - -for (; word_length >0 ; word_length--) {/* In words */ - templong = *pUsFile++; - templong |= - (*pUsFile++ <<16 ); - pUcFile +=4 ; -outl (templong, - dev->base_addr + -FT1000_REG_MAG_DPDATAL ); - } +FT1000_REG_MAG_DPDATAL ); } spin_unlock_irqrestore(&info-> dpram_lock,
@@ -519,24 +460,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)break ;case REQUEST_DONE_CL :/* Reposition ptrs to beginning of provisioning section */ -switch (file_version) { -case 5 : -case 6 : - pUsFile = - (u16 *) ((long )pFileStart - + - pFileHdr5-> - commands_offset); - pUcFile = - (u8 *) ((long )pFileStart - + - pFileHdr5-> - commands_offset); -break ; -default : - Status =FAILURE ; -break ; - } + pUsFile = (u16 *) ((long )pFileStart + pFileHdr5->commands_offset); + pUcFile = (u8 *) ((long )pFileStart + pFileHdr5->commands_offset); uiState =STATE_DONE_DWNLD ;break ;case REQUEST_CODE_SEGMENT :
@@ -557,45 +482,24 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) Status =FAILURE ;break ; } -if (file_version ==5 ) { -/* -* Position ASIC DPRAM auto-increment pointer. -*/ -ft1000_write_reg (dev, -FT1000_REG_DPRAM_ADDR , -DWNLD_PS_HDR_LOC ); - -for (; word_length >0 ; word_length--) {/* In words */ -//temp = *pUsFile; -//temp = RtlUshortByteSwap(temp); -ft1000_write_reg (dev, -FT1000_REG_DPRAM_DATA , - *pUsFile); - pUsFile++; - pUcFile +=2 ; - DspWordCnt++; - } - }else { -/* -* Position ASIC DPRAM auto-increment pointer. -*/ -outw (DWNLD_MAG_PS_HDR_LOC , +/* +* Position ASIC DPRAM auto-increment pointer. +*/ +outw (DWNLD_MAG_PS_HDR_LOC , + dev->base_addr + +FT1000_REG_DPRAM_ADDR ); +if (word_length &0x01 ) + word_length++; + word_length = word_length /2 ; + +for (; word_length >0 ; word_length--) {/* In words */ + templong = *pUsFile++; + templong |= + (*pUsFile++ <<16 ); + pUcFile +=4 ; +outl (templong, dev->base_addr + -FT1000_REG_DPRAM_ADDR ); -if (word_length &0x01 ) { - word_length++; - } - word_length = word_length /2 ; - -for (; word_length >0 ; word_length--) {/* In words */ - templong = *pUsFile++; - templong |= - (*pUsFile++ <<16 ); - pUcFile +=4 ; -outl (templong, - dev->base_addr + -FT1000_REG_MAG_DPDATAL ); - } +FT1000_REG_MAG_DPDATAL ); }break ;
@@ -663,45 +567,26 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)// Provide mutual exclusive access while reading ASIC registers. spin_lock_irqsave (&info->dpram_lock, flags); -if (file_version ==5 ) { -/* -* Position ASIC DPRAM auto-increment pointer. -*/ -ft1000_write_reg (dev, -FT1000_REG_DPRAM_ADDR , -DWNLD_PS_HDR_LOC ); - -for (; word_length >0 ; word_length--) {/* In words */ -ft1000_write_reg (dev, -FT1000_REG_DPRAM_DATA , - *pUsFile -/*temp */ - ); - pUsFile++; - } - }else { -/* -* Position ASIC DPRAM auto-increment pointer. -*/ -outw (DWNLD_MAG_PS_HDR_LOC , +/* +* Position ASIC DPRAM auto-increment pointer. +*/ +outw (DWNLD_MAG_PS_HDR_LOC , + dev->base_addr + +FT1000_REG_DPRAM_ADDR ); +if (word_length &0x01 ) + word_length++; + word_length = word_length /2 ; + +for (; word_length >0 ; word_length--) {/* In words */ + templong = +ntohs (*pUsFile++); + temp = +ntohs (*pUsFile++); + templong |= + (temp <<16 ); +outl (templong, dev->base_addr + -FT1000_REG_DPRAM_ADDR ); -if (word_length &0x01 ) { - word_length++; - } - word_length = word_length /2 ; - -for (; word_length >0 ; word_length--) {/* In words */ - templong = -ntohs (*pUsFile++); - temp = -ntohs (*pUsFile++); - templong |= - (temp <<16 ); -outl (templong, - dev->base_addr + -FT1000_REG_MAG_DPDATAL ); - } +FT1000_REG_MAG_DPDATAL ); } spin_unlock_irqrestore(&info-> dpram_lock,
@@ -712,117 +597,68 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) bGoodVersion = false; requested_version =get_request_value (dev); -if (file_version ==5 ) { - pDspImageInfo = - (struct dsp_image_info *) ((long ) - pFileStart - + -sizeof - (struct dsp_file_hdr_5 )); -for (imageN =0 ; - imageN < - pFileHdr5->nDspImages; - imageN++) { -if (pDspImageInfo-> - version == - requested_version) { - bGoodVersion = - true; - pUsFile = - (u16 - *) ((long ) - pFileStart - + - pDspImageInfo-> - begin_offset); - pUcFile = - (u8 - *) ((long ) - pFileStart - + - pDspImageInfo-> - begin_offset); - pCodeEnd = - (u8 - *) ((long ) - pFileStart - + - pDspImageInfo-> - end_offset); - run_address = - pDspImageInfo-> - run_address; - run_size = - pDspImageInfo-> - image_size; -break ; - } - pDspImageInfo++; - } - }else { - pDspImageInfoV6 = - (struct dsp_image_info_v6 *) ((long ) - pFileStart - + -sizeof - (struct dsp_file_hdr_5 )); -for (imageN =0 ; - imageN < - pFileHdr5->nDspImages; - imageN++) { - temp = (u16) - (pDspImageInfoV6-> - version); - templong = temp; - temp = (u16) - (pDspImageInfoV6-> - version >>16 ); - templong |= - (temp <<16 ); -if (templong == - requested_version) { - bGoodVersion = - true; - pUsFile = - (u16 - *) ((long ) - pFileStart - + - pDspImageInfoV6-> - begin_offset); - pUcFile = - (u8 - *) ((long ) - pFileStart - + - pDspImageInfoV6-> - begin_offset); - pCodeEnd = - (u8 - *) ((long ) - pFileStart - + - pDspImageInfoV6-> - end_offset); - run_address = - pDspImageInfoV6-> - run_address; - run_size = - pDspImageInfoV6-> - image_size; - image_chksum = - (u32 ) - pDspImageInfoV6-> - checksum; -DEBUG (0 , -"ft1000_dnld: image_chksum = 0x%8x\n" , - (unsigned -int ) - image_chksum); -break ; - } - pDspImageInfoV6++; + pDspImageInfoV6 = + (struct dsp_image_info *) ((long ) + pFileStart + + +sizeof + (struct dsp_file_hdr )); +for (imageN =0 ; + imageN < + pFileHdr5->nDspImages; + imageN++) { + temp = (u16) + (pDspImageInfoV6-> + version); + templong = temp; + temp = (u16) + (pDspImageInfoV6-> + version >>16 ); + templong |= + (temp <<16 ); +if (templong == + requested_version) { + bGoodVersion = + true; + pUsFile = + (u16 + *) ((long ) + pFileStart + + + pDspImageInfoV6-> + begin_offset); + pUcFile = + (u8 + *) ((long ) + pFileStart + + + pDspImageInfoV6-> + begin_offset); + pCodeEnd = + (u8 + *) ((long ) + pFileStart + + + pDspImageInfoV6-> + end_offset); + run_address = + pDspImageInfoV6-> + run_address; + run_size = + pDspImageInfoV6-> + image_size; + image_chksum = + (u32 ) + pDspImageInfoV6-> + checksum; +DEBUG (0 , +"ft1000_dnld: image_chksum = 0x%8x\n" , + (unsigned +int ) + image_chksum); +break ; } + pDspImageInfoV6++; }if (!bGoodVersion) {/*
Signature · 1 line
Ondrej Zary
Quoted 1 line · Ondrej Zary
Fix various things in ft1000-pcmcia driver.
I think I've applied all of the outstanding patches from you for this driver. If I've missed anything, please resend them.
thanks,
greg k-h