Signed-off-by: Marek Belisko <marek.belisko@xxxxxxxxx> --- drivers/staging/ft1000/ft1000-pcmcia/boot.h | 195 ++---- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 346 +++++----- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 61 +- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h | 16 +- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 269 ++++----- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 675 ++++++++++---------- drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 34 +- 7 files changed, 756 insertions(+), 840 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/boot.h b/drivers/staging/ft1000/ft1000-pcmcia/boot.h index 1fc4ac1..9deacbd 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/boot.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/boot.h @@ -27,132 +27,75 @@ #define _BOOTH_ // Official bootloader -unsigned char bootimage [] = { -0x00,0x00,0x01,0x5E,0x00,0x00 -,0x00,0x00,0x00,0x00,0x02,0xD7 -,0x00,0x00,0x01,0x5E,0x46,0xB3 -,0xE6,0x02,0x00,0x98,0xE6,0x8C -,0x00,0x98,0xFB,0x92,0xFF,0xFF -,0x98,0xFB,0x94,0xFF,0xFF,0x98 -,0xFB,0x06,0x08,0x00,0x98,0xFB -,0x96,0x84,0x00,0x98,0xFB,0x08 -,0x1C,0x00,0x98,0xFB,0x51,0x25 -,0x10,0x1C,0x00,0xE6,0x51,0x01 -,0x07,0xFD,0x4C,0xFF,0x20,0xF5 -,0x51,0x02,0x20,0x08,0x00,0x4C -,0xFF,0x20,0x3C,0x00,0xC0,0x64 -,0x98,0xC0,0x66,0x98,0xC0,0x68 -,0x98,0xC0,0x6A,0x98,0xC0,0x6C -,0x98,0x90,0x08,0x90,0x09,0x90 -,0x0A,0x90,0x0B,0x90,0x0C,0x90 -,0x0D,0x90,0x0E,0x90,0x0F,0x90 -,0x04,0x90,0x06,0xFB,0x51,0x22 -,0x16,0x08,0x03,0xFB,0x51,0x52 -,0x16,0x08,0x04,0xFB,0x51,0x24 -,0x2B,0x08,0x06,0xFB,0x51,0x54 -,0x2B,0x08,0x07,0xFB,0x51,0x24 -,0x2B,0x08,0x09,0xFB,0x51,0x54 -,0x2B,0x08,0x0A,0xFB,0x51,0x12 -,0x16,0x08,0x0C,0xFB,0x51,0x52 -,0x16,0x08,0x0D,0x78,0x00,0x00 -,0x00,0x16,0x00,0x00,0xEC,0x31 -,0xAE,0x00,0x00,0x81,0x4C,0x0F -,0xE6,0x43,0xFF,0xEC,0x31,0x4E -,0x00,0x00,0x91,0xEC,0x31,0xAE -,0x00,0x00,0x91,0x4C,0x0F,0xE6 -,0x43,0xFF,0xEC,0x31,0x5E,0x00 -,0x00,0xA1,0xEB,0x31,0x08,0x00 -,0x00,0xA6,0xEB,0x31,0x08,0x00 -,0x00,0xAC,0x3C,0x00,0xEB,0x31 -,0x08,0x00,0x00,0xA8,0x76,0xFE -,0xFE,0x08,0xEB,0x31,0x08,0x20 -,0x00,0x00,0x76,0xFF,0xFF,0x18 -,0xED,0x31,0x08,0x20,0x00,0x00 -,0x26,0x10,0x04,0x10,0xF5,0x3C -,0x01,0x3C,0x00,0x08,0x01,0x12 -,0x3C,0x11,0x3C,0x00,0x08,0x01 -,0x0B,0x08,0x00,0x6D,0xEC,0x31 -,0xAE,0x20,0x00,0x06,0xED,0x4D -,0x08,0x00,0x00,0x67,0x80,0x6F -,0x00,0x01,0x0B,0x6F,0x00,0x02 -,0x2E,0x76,0xEE,0x01,0x48,0x06 -,0x01,0x39,0xED,0x4D,0x18,0x00 -,0x02,0xED,0x4D,0x08,0x00,0x04 -,0x14,0x06,0xA4,0xED,0x31,0x22 -,0x00,0x00,0xAC,0x76,0xEE,0x07 -,0x48,0x6D,0x22,0x01,0x1E,0x08 -,0x01,0x58,0xEB,0x31,0x08,0x00 -,0x00,0xAC,0x06,0xFF,0xBA,0x3C -,0x00,0xEB,0x31,0x08,0x20,0x00 -,0x04,0x3C,0x30,0xEB,0x31,0x08 -,0x20,0x00,0x02,0x3C,0x10,0xEB -,0x31,0x08,0x20,0x00,0x00,0xED -,0x31,0x08,0x20,0x00,0x00,0x04 -,0x10,0xF7,0xED,0x31,0x08,0x00 -,0x00,0xA2,0x91,0x00,0x9C,0x3C -,0x80,0xEB,0x31,0x08,0x20,0x00 -,0x04,0x3C,0x20,0xEB,0x31,0x08 -,0x20,0x00,0x02,0x3C,0x10,0xEB -,0x31,0x08,0x20,0x00,0x00,0xED -,0x31,0x08,0x20,0x00,0x00,0x04 -,0x10,0xF7,0xED,0x31,0x08,0x20 -,0x00,0x04,0x42,0x10,0x90,0x08 -,0xEC,0x31,0xAE,0x20,0x00,0x06 -,0xA4,0x41,0x08,0x00,0xB6,0xED -,0x41,0x28,0x7D,0xFF,0xFF,0x22 -,0xB3,0x40,0x98,0x2A,0x32,0xEB -,0x41,0x28,0xB4,0x43,0xFC,0x05 -,0xFF,0xE6,0xA0,0x31,0x20,0x00 -,0x06,0xEB,0x31,0x08,0x20,0x00 -,0x04,0x3C,0x20,0xEB,0x31,0x08 -,0x20,0x00,0x02,0x3C,0x10,0xEB -,0x31,0x08,0x20,0x00,0x00,0xED -,0x31,0x08,0x20,0x00,0x00,0x04 -,0x10,0xF7,0xED,0x31,0x08,0x20 -,0x00,0x04,0x42,0x10,0x90,0x08 -,0xEC,0x31,0xAE,0x20,0x00,0x06 -,0xA4,0x41,0x08,0x00,0x68,0xED -,0x41,0x28,0x7D,0xFF,0xFF,0x22 -,0xB3,0x40,0x98,0x2A,0x32,0xEB -,0x41,0x28,0xB4,0x43,0xFC,0x05 -,0xFF,0xE6,0x48,0x04,0xEB,0x31 -,0x08,0x20,0x00,0x04,0xEB,0x31 -,0x18,0x20,0x00,0x02,0x3C,0x11 -,0xEB,0x31,0x18,0x20,0x00,0x00 -,0xED,0x31,0x08,0x20,0x00,0x00 -,0x04,0x10,0xF7,0xED,0x31,0x08 -,0x20,0x00,0x02,0x66,0x00,0x6F -,0x00,0x01,0x16,0x76,0xEE,0x06 -,0x48,0x4A,0x1E,0x48,0x04,0xED -,0x31,0x08,0x20,0x00,0x04,0xEB -,0x31,0x08,0x00,0x00,0xA4,0x48 -,0x04,0xED,0x31,0x08,0x20,0x00 -,0x04,0xEB,0x31,0x08,0x00,0x00 -,0xA2,0x48,0x04,0x20,0x20,0x4A -,0x7C,0x46,0x82,0x50,0x05,0x50 -,0x15,0xB5,0x1E,0x98,0xED,0x31 -,0x08,0x00,0x00,0xA8,0x10,0x47 -,0x3B,0x2C,0x01,0xDB,0x40,0x11 -,0x98,0xC1,0x1E,0x98,0x10,0x07 -,0x30,0xF9,0x40,0x07,0x18,0x98 -,0x2A,0x10,0xEB,0x31,0x08,0x00 -,0x00,0xA8,0xA4,0x1E,0x98,0xBB -,0x1E,0x98,0x50,0x14,0x50,0x04 -,0x46,0x83,0x48,0x04,0x02,0x01 -,0x00,0x50,0x05,0x50,0x15,0x10 -,0x87,0x3F,0x90,0x2B,0x18,0x01 -,0x00,0xC0,0x31,0x00,0x00,0xAE -,0xDF,0x41,0x00,0x08,0x00,0x1A -,0x42,0x11,0x67,0x01,0xDF,0x41 -,0x02,0x08,0x00,0x10,0x42,0x11 -,0x62,0x01,0xB4,0x43,0x4A,0x68 -,0x50,0x14,0x50,0x04,0x24,0x10 -,0x48,0x04,0xF2,0x31,0x00,0x01 -,0x00,0x00,0xAE,0xF6,0x31,0x00 -,0x01,0x00,0x00,0xAE,0x62,0xE4 -,0xE5,0x61,0x04,0x48,0x04,0xE5 -,0x63,0x05,0x48,0x04,0x20,0x20 -,0x00,0x00,0x00,0x00 +unsigned char bootimage[] = { + 0x00, 0x00, 0x01, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD7, + 0x00, 0x00, 0x01, 0x5E, 0x46, 0xB3, 0xE6, 0x02, 0x00, 0x98, 0xE6, + 0x8C, 0x00, 0x98, 0xFB, 0x92, 0xFF, 0xFF, 0x98, 0xFB, 0x94, 0xFF, + 0xFF, 0x98, 0xFB, 0x06, 0x08, 0x00, 0x98, 0xFB, 0x96, 0x84, 0x00, + 0x98, 0xFB, 0x08, 0x1C, 0x00, 0x98, 0xFB, 0x51, 0x25, 0x10, 0x1C, + 0x00, 0xE6, 0x51, 0x01, 0x07, 0xFD, 0x4C, 0xFF, 0x20, 0xF5, 0x51, + 0x02, 0x20, 0x08, 0x00, 0x4C, 0xFF, 0x20, 0x3C, 0x00, 0xC0, 0x64, + 0x98, 0xC0, 0x66, 0x98, 0xC0, 0x68, 0x98, 0xC0, 0x6A, 0x98, 0xC0, + 0x6C, 0x98, 0x90, 0x08, 0x90, 0x09, 0x90, 0x0A, 0x90, 0x0B, 0x90, + 0x0C, 0x90, 0x0D, 0x90, 0x0E, 0x90, 0x0F, 0x90, 0x04, 0x90, 0x06, + 0xFB, 0x51, 0x22, 0x16, 0x08, 0x03, 0xFB, 0x51, 0x52, 0x16, 0x08, + 0x04, 0xFB, 0x51, 0x24, 0x2B, 0x08, 0x06, 0xFB, 0x51, 0x54, 0x2B, + 0x08, 0x07, 0xFB, 0x51, 0x24, 0x2B, 0x08, 0x09, 0xFB, 0x51, 0x54, + 0x2B, 0x08, 0x0A, 0xFB, 0x51, 0x12, 0x16, 0x08, 0x0C, 0xFB, 0x51, + 0x52, 0x16, 0x08, 0x0D, 0x78, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, + 0xEC, 0x31, 0xAE, 0x00, 0x00, 0x81, 0x4C, 0x0F, 0xE6, 0x43, 0xFF, + 0xEC, 0x31, 0x4E, 0x00, 0x00, 0x91, 0xEC, 0x31, 0xAE, 0x00, 0x00, + 0x91, 0x4C, 0x0F, 0xE6, 0x43, 0xFF, 0xEC, 0x31, 0x5E, 0x00, 0x00, + 0xA1, 0xEB, 0x31, 0x08, 0x00, 0x00, 0xA6, 0xEB, 0x31, 0x08, 0x00, + 0x00, 0xAC, 0x3C, 0x00, 0xEB, 0x31, 0x08, 0x00, 0x00, 0xA8, 0x76, + 0xFE, 0xFE, 0x08, 0xEB, 0x31, 0x08, 0x20, 0x00, 0x00, 0x76, 0xFF, + 0xFF, 0x18, 0xED, 0x31, 0x08, 0x20, 0x00, 0x00, 0x26, 0x10, 0x04, + 0x10, 0xF5, 0x3C, 0x01, 0x3C, 0x00, 0x08, 0x01, 0x12, 0x3C, 0x11, + 0x3C, 0x00, 0x08, 0x01, 0x0B, 0x08, 0x00, 0x6D, 0xEC, 0x31, 0xAE, + 0x20, 0x00, 0x06, 0xED, 0x4D, 0x08, 0x00, 0x00, 0x67, 0x80, 0x6F, + 0x00, 0x01, 0x0B, 0x6F, 0x00, 0x02, 0x2E, 0x76, 0xEE, 0x01, 0x48, + 0x06, 0x01, 0x39, 0xED, 0x4D, 0x18, 0x00, 0x02, 0xED, 0x4D, 0x08, + 0x00, 0x04, 0x14, 0x06, 0xA4, 0xED, 0x31, 0x22, 0x00, 0x00, 0xAC, + 0x76, 0xEE, 0x07, 0x48, 0x6D, 0x22, 0x01, 0x1E, 0x08, 0x01, 0x58, + 0xEB, 0x31, 0x08, 0x00, 0x00, 0xAC, 0x06, 0xFF, 0xBA, 0x3C, 0x00, + 0xEB, 0x31, 0x08, 0x20, 0x00, 0x04, 0x3C, 0x30, 0xEB, 0x31, 0x08, + 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB, 0x31, 0x08, 0x20, 0x00, 0x00, + 0xED, 0x31, 0x08, 0x20, 0x00, 0x00, 0x04, 0x10, 0xF7, 0xED, 0x31, + 0x08, 0x00, 0x00, 0xA2, 0x91, 0x00, 0x9C, 0x3C, 0x80, 0xEB, 0x31, + 0x08, 0x20, 0x00, 0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08, 0x20, 0x00, + 0x02, 0x3C, 0x10, 0xEB, 0x31, 0x08, 0x20, 0x00, 0x00, 0xED, 0x31, + 0x08, 0x20, 0x00, 0x00, 0x04, 0x10, 0xF7, 0xED, 0x31, 0x08, 0x20, + 0x00, 0x04, 0x42, 0x10, 0x90, 0x08, 0xEC, 0x31, 0xAE, 0x20, 0x00, + 0x06, 0xA4, 0x41, 0x08, 0x00, 0xB6, 0xED, 0x41, 0x28, 0x7D, 0xFF, + 0xFF, 0x22, 0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB, 0x41, 0x28, 0xB4, + 0x43, 0xFC, 0x05, 0xFF, 0xE6, 0xA0, 0x31, 0x20, 0x00, 0x06, 0xEB, + 0x31, 0x08, 0x20, 0x00, 0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08, 0x20, + 0x00, 0x02, 0x3C, 0x10, 0xEB, 0x31, 0x08, 0x20, 0x00, 0x00, 0xED, + 0x31, 0x08, 0x20, 0x00, 0x00, 0x04, 0x10, 0xF7, 0xED, 0x31, 0x08, + 0x20, 0x00, 0x04, 0x42, 0x10, 0x90, 0x08, 0xEC, 0x31, 0xAE, 0x20, + 0x00, 0x06, 0xA4, 0x41, 0x08, 0x00, 0x68, 0xED, 0x41, 0x28, 0x7D, + 0xFF, 0xFF, 0x22, 0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB, 0x41, 0x28, + 0xB4, 0x43, 0xFC, 0x05, 0xFF, 0xE6, 0x48, 0x04, 0xEB, 0x31, 0x08, + 0x20, 0x00, 0x04, 0xEB, 0x31, 0x18, 0x20, 0x00, 0x02, 0x3C, 0x11, + 0xEB, 0x31, 0x18, 0x20, 0x00, 0x00, 0xED, 0x31, 0x08, 0x20, 0x00, + 0x00, 0x04, 0x10, 0xF7, 0xED, 0x31, 0x08, 0x20, 0x00, 0x02, 0x66, + 0x00, 0x6F, 0x00, 0x01, 0x16, 0x76, 0xEE, 0x06, 0x48, 0x4A, 0x1E, + 0x48, 0x04, 0xED, 0x31, 0x08, 0x20, 0x00, 0x04, 0xEB, 0x31, 0x08, + 0x00, 0x00, 0xA4, 0x48, 0x04, 0xED, 0x31, 0x08, 0x20, 0x00, 0x04, + 0xEB, 0x31, 0x08, 0x00, 0x00, 0xA2, 0x48, 0x04, 0x20, 0x20, 0x4A, + 0x7C, 0x46, 0x82, 0x50, 0x05, 0x50, 0x15, 0xB5, 0x1E, 0x98, 0xED, + 0x31, 0x08, 0x00, 0x00, 0xA8, 0x10, 0x47, 0x3B, 0x2C, 0x01, 0xDB, + 0x40, 0x11, 0x98, 0xC1, 0x1E, 0x98, 0x10, 0x07, 0x30, 0xF9, 0x40, + 0x07, 0x18, 0x98, 0x2A, 0x10, 0xEB, 0x31, 0x08, 0x00, 0x00, 0xA8, + 0xA4, 0x1E, 0x98, 0xBB, 0x1E, 0x98, 0x50, 0x14, 0x50, 0x04, 0x46, + 0x83, 0x48, 0x04, 0x02, 0x01, 0x00, 0x50, 0x05, 0x50, 0x15, 0x10, + 0x87, 0x3F, 0x90, 0x2B, 0x18, 0x01, 0x00, 0xC0, 0x31, 0x00, 0x00, + 0xAE, 0xDF, 0x41, 0x00, 0x08, 0x00, 0x1A, 0x42, 0x11, 0x67, 0x01, + 0xDF, 0x41, 0x02, 0x08, 0x00, 0x10, 0x42, 0x11, 0x62, 0x01, 0xB4, + 0x43, 0x4A, 0x68, 0x50, 0x14, 0x50, 0x04, 0x24, 0x10, 0x48, 0x04, + 0xF2, 0x31, 0x00, 0x01, 0x00, 0x00, 0xAE, 0xF6, 0x31, 0x00, 0x01, + 0x00, 0x00, 0xAE, 0x62, 0xE4, 0xE5, 0x61, 0x04, 0x48, 0x04, 0xE5, + 0x63, 0x05, 0x48, 0x04, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00 }; #endif diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index 61e1cfc..718d197 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -30,7 +30,6 @@ #ifndef _FT1000H_ #define _FT1000H_ - #define FT1000_DRV_VER 0x01010300 #define DSPVERSZ 4 @@ -42,29 +41,28 @@ #define CALDATESZ 6 // Pseudo Header structure -typedef 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 +typedef 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)) PSEUDO_HDR, *PPSEUDO_HDR; // Definitions to maintain compatibility between other platforms @@ -78,8 +76,8 @@ typedef struct _PSEUDO_HDR #define PCHAR u8 * #define UINT u32 -#define ELECTRABUZZ_ID 0 // ASIC ID for Electrabuzz -#define MAGNEMITE_ID 0x1a01 // ASIC ID for Magnemite +#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 @@ -89,75 +87,75 @@ typedef struct _PSEUDO_HDR #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) +#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_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_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 +#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_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 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 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 0x3FD // Timer Field from Basestation #define FT1000_MAG_DSP_TIMER3_INDX 0x0 #define FT1000_MAG_TOTAL_LEN 0x200 @@ -169,56 +167,56 @@ typedef struct _PSEUDO_HDR #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 +#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. + // 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. + // 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 +#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 +#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 +#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 +#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) +#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 @@ -289,7 +287,7 @@ typedef struct _DRVMSG { PSEUDO_HDR pseudo; u16 type; u16 length; - u8 data[0]; + u8 data[0]; } __attribute__ ((packed)) DRVMSG, *PDRVMSG; typedef struct _MEDIAMSG { @@ -298,7 +296,7 @@ typedef struct _MEDIAMSG { u16 length; u16 state; u32 ip_addr; - u32 net_mask; + u32 net_mask; u32 gateway; u32 dns_1; u32 dns_2; @@ -308,20 +306,20 @@ typedef struct _TIMEMSG { PSEUDO_HDR pseudo; u16 type; u16 length; - u8 timeval[8]; + u8 timeval[8]; } __attribute__ ((packed)) TIMEMSG, *PTIMEMSG; typedef struct _DSPINITMSG { - 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 + 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)) DSPINITMSG, *PDSPINITMSG; typedef struct _DSPHIBERNATE { @@ -329,81 +327,81 @@ typedef struct _DSPHIBERNATE { u16 type; u16 length; u32 timeout; - u16 sess_info[0]; + u16 sess_info[0]; } DSPHIBERNATE, *PDSPHIBERNATE; -typedef struct _APP_INFO_BLOCK -{ - u32 fileobject; // Application's file object - u16 app_id; // Application id +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; + struct list_head list; + u8 *pprov_data; } PROV_RECORD, *PPROV_RECORD; typedef 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 - 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; - int appcnt; - APP_INFO_BLOCK app_info[MAX_NUM_APP]; - u16 DSPInfoBlklen; - u16 DrvMsgPend; - 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; + 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 + 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; + int appcnt; + APP_INFO_BLOCK app_info[MAX_NUM_APP]; + u16 DSPInfoBlklen; + u16 DrvMsgPend; + 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; struct proc_dir_entry *proc_ft1000; char netdevname[IFNAMSIZ]; } FT1000_INFO, *PFT1000_INFO; typedef struct _DPRAM_BLK { - struct list_head list; - u16 *pbuffer; + struct list_head list; + u16 *pbuffer; } __attribute__ ((packed)) DPRAM_BLK, *PDPRAM_BLK; -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); #endif // _FT1000H_ diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c index 2163eae..07a68fc 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c @@ -39,7 +39,7 @@ #include <linux/netdevice.h> #include <linux/etherdevice.h> -//#include <pcmcia/version.h> // Slavius 21.10.2009 removed from kernel +//#include <pcmcia/version.h> // Slavius 21.10.2009 removed from kernel #include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> @@ -51,7 +51,7 @@ #include <asm/byteorder.h> #include <asm/uaccess.h> -#include "ft1000_cs.h" // Slavius 21.10.2009 because CS_SUCCESS constant is missing due to removed pcmcia/version.h +#include "ft1000_cs.h" // Slavius 21.10.2009 because CS_SUCCESS constant is missing due to removed pcmcia/version.h /*====================================================================*/ @@ -83,8 +83,9 @@ MODULE_LICENSE("GPL"); /*====================================================================*/ struct net_device *init_ft1000_card(int, int, unsigned char *, - void *ft1000_reset, struct pcmcia_device * link, - struct device *fdev); + void *ft1000_reset, + struct pcmcia_device *link, + struct device *fdev); void stop_ft1000_card(struct net_device *); static int ft1000_config(struct pcmcia_device *link); @@ -97,7 +98,7 @@ 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); typedef struct local_info_t { struct pcmcia_device *link; @@ -109,7 +110,7 @@ typedef struct local_info_t { /*====================================================================*/ -static void ft1000_reset(struct pcmcia_device * link) +static void ft1000_reset(struct pcmcia_device *link) { conf_reg_t reg; @@ -182,7 +183,6 @@ static int get_tuple_next(struct pcmcia_device *link, tuple_t * tuple, /*====================================================================== - ======================================================================*/ static int ft1000_attach(struct pcmcia_device *link) @@ -227,7 +227,7 @@ static void ft1000_detach(struct pcmcia_device *link) DEBUG(0, "ft1000_cs: ft1000_detach(0x%p)\n", link); if (link == NULL) { - DEBUG(0,"ft1000_cs:ft1000_detach: Got a NULL pointer\n"); + DEBUG(0, "ft1000_cs:ft1000_detach: Got a NULL pointer\n"); return; } @@ -256,7 +256,7 @@ static void ft1000_detach(struct pcmcia_device *link) #define CFG_CHECK(fn, ret) \ last_fn = (fn); if ((last_ret = (ret)) != 0) goto next_entry -static int ft1000_config(struct pcmcia_device * link) +static int ft1000_config(struct pcmcia_device *link) { tuple_t tuple; cisparse_t parse; @@ -273,16 +273,16 @@ static int ft1000_config(struct pcmcia_device * link) This reads the card's CONFIG tuple to find its configuration registers. */ -// tuple.DesiredTuple = CISTPL_CONFIG; -// tuple.Attributes = 0; +// tuple.DesiredTuple = CISTPL_CONFIG; +// tuple.Attributes = 0; tuple.TupleData = buf; tuple.TupleDataMax = sizeof(buf); tuple.TupleOffset = 0; -// CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); -// CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); -// CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); -// link->conf.ConfigBase = parse.config.base; -// link->conf.Present = parse.config.rmask[0]; +// CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); +// CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); +// CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); +// link->conf.ConfigBase = parse.config.base; +// link->conf.Present = parse.config.rmask[0]; /* In this loop, we scan the CIS for configuration table entries, @@ -302,8 +302,7 @@ static int ft1000_config(struct pcmcia_device * link) while (1) { cfg = &(parse.cftable_entry); CFG_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); - CFG_CHECK(ParseTuple, - pcmcia_parse_tuple(&tuple, &parse)); // Slavius 21.10.2009 removed unused link parameter + CFG_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); // Slavius 21.10.2009 removed unused link parameter if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; @@ -342,7 +341,7 @@ static int ft1000_config(struct pcmcia_device * link) break; - next_entry: +next_entry: last_ret = pcmcia_get_next_tuple(link, &tuple); } if (last_ret != CS_SUCCESS) { @@ -355,7 +354,7 @@ static int ft1000_config(struct pcmcia_device * link) handler to the interrupt, unless the 'Handler' member of the irq structure is initialized. */ - CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); + CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); /* This actually configures the PCMCIA socket -- setting up @@ -389,9 +388,9 @@ static int ft1000_config(struct pcmcia_device * link) } ((local_info_t *) link->priv)->dev = - init_ft1000_card(link->irq.AssignedIRQ, link->io.BasePort1, - &mac_address[0], ft1000_reset, link, - &handle_to_dev(link)); + init_ft1000_card(link->irq.AssignedIRQ, link->io.BasePort1, + &mac_address[0], ft1000_reset, link, + &handle_to_dev(link)); /* At this point, the dev_node_t structure(s) need to be @@ -418,7 +417,7 @@ failed: ======================================================================*/ -static void ft1000_release(struct pcmcia_device * link) +static void ft1000_release(struct pcmcia_device *link) { DEBUG(0, "ft1000_cs: ft1000_release(0x%p)\n", link); @@ -439,7 +438,7 @@ static void ft1000_release(struct pcmcia_device * link) /* Don't bother checking to see if these succeed or not */ - pcmcia_disable_device(link); + pcmcia_disable_device(link); } /* ft1000_release */ /*====================================================================== @@ -472,8 +471,6 @@ static int ft1000_resume(struct pcmcia_device *link) return 0; } - - /*====================================================================*/ static struct pcmcia_device_id ft1000_ids[] = { @@ -490,11 +487,11 @@ static struct pcmcia_driver ft1000_cs_driver = { .drv = { .name = "ft1000_cs", }, - .probe = ft1000_attach, - .remove = ft1000_detach, - .id_table = ft1000_ids, - .suspend = ft1000_suspend, - .resume = ft1000_resume, + .probe = ft1000_attach, + .remove = ft1000_detach, + .id_table = ft1000_ids, + .suspend = ft1000_suspend, + .resume = ft1000_resume, }; static int __init init_ft1000_cs(void) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h index 4a89bd1..d5e0400 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h @@ -38,12 +38,13 @@ // data - ASIC register value // //--------------------------------------------------------------------------- -static inline u16 ft1000_read_reg (struct net_device *dev, u16 offset) { - u16 data = 0; +static inline u16 ft1000_read_reg(struct net_device *dev, u16 offset) +{ + u16 data = 0; - data = inw(dev->base_addr + offset); + data = inw(dev->base_addr + offset); - return (data); + return (data); } //--------------------------------------------------------------------------- @@ -58,9 +59,10 @@ static inline u16 ft1000_read_reg (struct net_device *dev, u16 offset) { // None. // //--------------------------------------------------------------------------- -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 // _FT1000_DEVH_ - diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c index 0bf398d..318bde1 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c @@ -189,13 +189,13 @@ USHORT get_handshake(struct net_device *dev, USHORT expected_value) handshake = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); } else { tempx = - ntohl(ft1000_read_dpram_mag_32 + ntohl(ft1000_read_dpram_mag_32 (dev, DWNLD_MAG_HANDSHAKE_LOC)); handshake = (USHORT) tempx; } if ((handshake == expected_value) - || (handshake == HANDSHAKE_RESET_VALUE)) { + || (handshake == HANDSHAKE_RESET_VALUE)) { return handshake; } else { loopcnt++; @@ -305,7 +305,7 @@ USHORT hdr_checksum(PPSEUDO_HDR pHdr) USHORT chksum; chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ - usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); + usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); return chksum; } @@ -360,12 +360,12 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) case 5: case 6: pUsFile = - (USHORT *) ((long)pFileStart + pFileHdr5->loader_offset); + (USHORT *) ((long)pFileStart + pFileHdr5->loader_offset); pUcFile = - (UCHAR *) ((long)pFileStart + pFileHdr5->loader_offset); + (UCHAR *) ((long)pFileStart + pFileHdr5->loader_offset); pBootEnd = - (UCHAR *) ((long)pFileStart + pFileHdr5->loader_code_end); + (UCHAR *) ((long)pFileStart + pFileHdr5->loader_code_end); loader_code_address = pFileHdr5->loader_code_address; loader_code_size = pFileHdr5->loader_code_size; @@ -423,7 +423,7 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) break; } if ((word_length * 2 + (long)pUcFile) > - (long)pBootEnd) { + (long)pBootEnd) { /* * Error, beyond boot code range. */ @@ -456,8 +456,8 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) { word_length++; } @@ -466,16 +466,15 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) for (; word_length > 0; word_length--) { /* In words */ templong = *pUsFile++; templong |= - (*pUsFile++ << 16); + (*pUsFile++ << 16); pUcFile += 4; outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } } - spin_unlock_irqrestore(&info-> - dpram_lock, - flags); + spin_unlock_irqrestore + (&info->dpram_lock, flags); break; default: Status = FAILURE; @@ -498,7 +497,7 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) switch (request) { case REQUEST_FILE_CHECKSUM: DEBUG(0, - "ft1000_dnld: REQUEST_FOR_CHECKSUM\n"); + "ft1000_dnld: REQUEST_FOR_CHECKSUM\n"); put_request_value(dev, image_chksum); break; case REQUEST_RUN_ADDRESS: @@ -525,15 +524,13 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) case 5: case 6: pUsFile = - (USHORT *) ((long)pFileStart + (USHORT *) ((long)pFileStart + - pFileHdr5-> - commands_offset); + pFileHdr5->commands_offset); pUcFile = - (UCHAR *) ((long)pFileStart - + - pFileHdr5-> - commands_offset); + (UCHAR *) ((long)pFileStart + + + pFileHdr5->commands_offset); break; default: Status = FAILURE; @@ -552,7 +549,7 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) break; } if ((word_length * 2 + (long)pUcFile) > - (long)pCodeEnd) { + (long)pCodeEnd) { /* * Error, beyond boot code range. */ @@ -582,8 +579,8 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) { word_length++; } @@ -592,11 +589,11 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) for (; word_length > 0; word_length--) { /* In words */ templong = *pUsFile++; templong |= - (*pUsFile++ << 16); + (*pUsFile++ << 16); pUcFile += 4; outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } } break; @@ -604,12 +601,12 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) case REQUEST_MAILBOX_DATA: // Convert length from byte count to word count. Make sure we round up. word_length = - (long)(info->DSPInfoBlklen + 1) / 2; + (long)(info->DSPInfoBlklen + 1) / 2; put_request_value(dev, word_length); pMailBoxData = - (PDRVMSG) & info->DSPInfoBlk[0]; + (PDRVMSG) & info->DSPInfoBlk[0]; pUsData = - (USHORT *) & pMailBoxData->data[0]; + (USHORT *) & pMailBoxData->data[0]; // Provide mutual exclusive access while reading ASIC registers. spin_lock_irqsave(&info->dpram_lock, flags); @@ -633,8 +630,8 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) { word_length++; } @@ -643,25 +640,23 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) for (; word_length > 0; word_length--) { /* In words */ templong = *pUsData++; templong |= - (*pUsData++ << 16); + (*pUsData++ << 16); outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } } - spin_unlock_irqrestore(&info-> - dpram_lock, - flags); + spin_unlock_irqrestore + (&info->dpram_lock, flags); break; case REQUEST_VERSION_INFO: word_length = - pFileHdr5->version_data_size; + pFileHdr5->version_data_size; put_request_value(dev, word_length); pUsFile = - (USHORT *) ((long)pFileStart + - pFileHdr5-> - version_data_offset); + (USHORT *) ((long)pFileStart + + pFileHdr5->version_data_offset); // Provide mutual exclusive access while reading ASIC registers. spin_lock_irqsave(&info->dpram_lock, flags); @@ -678,7 +673,7 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) FT1000_REG_DPRAM_DATA, *pUsFile /*temp */ - ); + ); pUsFile++; } } else { @@ -686,8 +681,8 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) * Position ASIC DPRAM auto-increment pointer. */ outw(DWNLD_MAG_PS_HDR_LOC, - dev->base_addr + - FT1000_REG_DPRAM_ADDR); + dev->base_addr + + FT1000_REG_DPRAM_ADDR); if (word_length & 0x01) { word_length++; } @@ -695,132 +690,98 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) for (; word_length > 0; word_length--) { /* In words */ templong = - ntohs(*pUsFile++); + ntohs(*pUsFile++); temp = - ntohs(*pUsFile++); + ntohs(*pUsFile++); templong |= - (temp << 16); + (temp << 16); outl(templong, - dev->base_addr + - FT1000_REG_MAG_DPDATAL); + dev->base_addr + + FT1000_REG_MAG_DPDATAL); } } - spin_unlock_irqrestore(&info-> - dpram_lock, - flags); + spin_unlock_irqrestore + (&info->dpram_lock, flags); break; case REQUEST_CODE_BY_VERSION: bGoodVersion = FALSE; requested_version = - get_request_value(dev); + get_request_value(dev); if (file_version == 5) { pDspImageInfo = - (PDSP_IMAGE_INFO) ((long) - pFileStart - + - sizeof - (DSP_FILE_HDR_5)); + (PDSP_IMAGE_INFO) ((long) + pFileStart + sizeof(DSP_FILE_HDR_5)); for (imageN = 0; - imageN < - pFileHdr5->nDspImages; - imageN++) { - if (pDspImageInfo-> - version == - requested_version) { + imageN < + pFileHdr5->nDspImages; + imageN++) { + if (pDspImageInfo->version == requested_version) { bGoodVersion = - TRUE; + TRUE; pUsFile = - (USHORT - *) ((long) - pFileStart - + - pDspImageInfo-> - begin_offset); + (USHORT + *) ((long) + pFileStart + pDspImageInfo->begin_offset); pUcFile = - (UCHAR - *) ((long) - pFileStart - + - pDspImageInfo-> - begin_offset); + (UCHAR + *) ((long) + pFileStart + pDspImageInfo->begin_offset); pCodeEnd = - (UCHAR - *) ((long) - pFileStart - + - pDspImageInfo-> - end_offset); + (UCHAR + *) ((long) + pFileStart + pDspImageInfo->end_offset); run_address = - pDspImageInfo-> - run_address; + pDspImageInfo->run_address; run_size = - pDspImageInfo-> - image_size; + pDspImageInfo->image_size; break; } pDspImageInfo++; } } else { pDspImageInfoV6 = - (PDSP_IMAGE_INFO_V6) ((long) - pFileStart - + - sizeof - (DSP_FILE_HDR_5)); + (PDSP_IMAGE_INFO_V6) ((long) + pFileStart + sizeof(DSP_FILE_HDR_5)); for (imageN = 0; - imageN < - pFileHdr5->nDspImages; - imageN++) { + imageN < + pFileHdr5->nDspImages; + imageN++) { temp = (USHORT) - (pDspImageInfoV6-> - version); + (pDspImageInfoV6->version); templong = temp; temp = (USHORT) - (pDspImageInfoV6-> - version >> 16); + (pDspImageInfoV6->version >> 16); templong |= - (temp << 16); + (temp << 16); if (templong == - requested_version) { + requested_version) { bGoodVersion = - TRUE; + TRUE; pUsFile = - (USHORT - *) ((long) - pFileStart - + - pDspImageInfoV6-> - begin_offset); + (USHORT + *) ((long) + pFileStart + pDspImageInfoV6->begin_offset); pUcFile = - (UCHAR - *) ((long) - pFileStart - + - pDspImageInfoV6-> - begin_offset); + (UCHAR + *) ((long) + pFileStart + pDspImageInfoV6->begin_offset); pCodeEnd = - (UCHAR - *) ((long) - pFileStart - + - pDspImageInfoV6-> - end_offset); + (UCHAR + *) ((long) + pFileStart + pDspImageInfoV6->end_offset); run_address = - pDspImageInfoV6-> - run_address; + pDspImageInfoV6->run_address; run_size = - pDspImageInfoV6-> - image_size; + pDspImageInfoV6->image_size; image_chksum = - (ULONG) - pDspImageInfoV6-> - checksum; + (ULONG) + pDspImageInfoV6->checksum; DEBUG(0, - "ft1000_dnld: image_chksum = 0x%8x\n", - (unsigned - int) - image_chksum); + "ft1000_dnld: image_chksum = 0x%8x\n", + (unsigned + int) + image_chksum); break; } pDspImageInfoV6++; @@ -848,7 +809,7 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) case STATE_DONE_DWNLD: if (((UINT) (pUcFile) - (UINT) pFileStart) >= - (UINT) FileLength) { + (UINT) FileLength) { uiState = STATE_DONE_FILE; break; } @@ -856,16 +817,16 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) pHdr = (PPSEUDO_HDR) pUsFile; if (pHdr->portdest == 0x80 /* DspOAM */ - && (pHdr->portsrc == 0x00 /* Driver */ + && (pHdr->portsrc == 0x00 /* Driver */ || pHdr->portsrc == 0x10 /* FMM */ )) { uiState = STATE_SECTION_PROV; } else { DEBUG(1, - "FT1000:download:Download error: Bad Port IDs in Pseudo Record\n"); + "FT1000:download:Download error: Bad Port IDs in Pseudo Record\n"); DEBUG(1, "\t Port Source = 0x%2.2x\n", - pHdr->portsrc); + pHdr->portsrc); DEBUG(1, "\t Port Destination = 0x%2.2x\n", - pHdr->portdest); + pHdr->portdest); Status = FAILURE; } @@ -884,31 +845,31 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) // Get buffer for provisioning data pbuffer = - kmalloc((usHdrLength + sizeof(PSEUDO_HDR)), - GFP_ATOMIC); + kmalloc((usHdrLength + sizeof(PSEUDO_HDR)), + GFP_ATOMIC); if (pbuffer) { memcpy(pbuffer, (void *)pUcFile, - (UINT) (usHdrLength + - sizeof(PSEUDO_HDR))); + (UINT) (usHdrLength + + sizeof(PSEUDO_HDR))); // link provisioning data pprov_record = - kmalloc(sizeof(PROV_RECORD), - GFP_ATOMIC); + kmalloc(sizeof(PROV_RECORD), + GFP_ATOMIC); if (pprov_record) { pprov_record->pprov_data = - pbuffer; - list_add_tail(&pprov_record-> - list, - &info->prov_list); + pbuffer; + list_add_tail + (&pprov_record->list, + &info->prov_list); // Move to next entry if available pUcFile = - (UCHAR *) ((UINT) pUcFile + - (UINT) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR)); + (UCHAR *) ((UINT) pUcFile + + (UINT) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR)); if ((UINT) (pUcFile) - - (UINT) (pFileStart) >= - (UINT) FileLength) { + (UINT) (pFileStart) >= + (UINT) FileLength) { uiState = - STATE_DONE_FILE; + STATE_DONE_FILE; } } else { kfree(pbuffer); diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index a6ba84c..5f18b66 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -62,7 +62,7 @@ const struct firmware *fw_entry; static void ft1000_hbchk(u_long data); static struct timer_list poll_timer = { - function:ft1000_hbchk +function:ft1000_hbchk }; static u16 cmdbuffer[1024]; @@ -182,7 +182,7 @@ u16 ft1000_read_dpram(struct net_device * dev, int offset) // //--------------------------------------------------------------------------- static inline void ft1000_write_dpram(struct net_device *dev, - int offset, u16 value) + int offset, u16 value) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev); unsigned long flags; @@ -240,7 +240,7 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index) // //--------------------------------------------------------------------------- static inline void ft1000_write_dpram_mag_16(struct net_device *dev, - int offset, u16 value, int Index) + int offset, u16 value, int Index) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev); unsigned long flags; @@ -328,8 +328,8 @@ static void ft1000_enable_interrupts(struct net_device *dev) info->CurrentInterruptEnableMask); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); DEBUG(1, - "ft1000_hw:ft1000_enable_interrupts:current interrupt enable mask = 0x%x\n", - tempword); + "ft1000_hw:ft1000_enable_interrupts:current interrupt enable mask = 0x%x\n", + tempword); info->InterruptsEnabled = TRUE; } @@ -352,8 +352,8 @@ static void ft1000_disable_interrupts(struct net_device *dev) ft1000_write_reg(dev, FT1000_REG_SUP_IMASK, ISR_MASK_ALL); tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); DEBUG(1, - "ft1000_hw:ft1000_disable_interrupts:current interrupt enable mask = 0x%x\n", - tempword); + "ft1000_hw:ft1000_disable_interrupts:current interrupt enable mask = 0x%x\n", + tempword); info->InterruptsEnabled = FALSE; } @@ -427,12 +427,12 @@ static int ft1000_reset_card(struct net_device *dev) info->squeseqnum = 0; ft1000_disable_interrupts(dev); -// del_timer(&poll_timer); +// del_timer(&poll_timer); // Make sure we free any memory reserve for provisioning while (list_empty(&info->prov_list) == 0) { DEBUG(0, - "ft1000_hw:ft1000_reset_card:deleting provisioning record\n"); + "ft1000_hw:ft1000_reset_card:deleting provisioning record\n"); ptr = list_entry(info->prov_list.next, PROV_RECORD, list); list_del(&ptr->list); kfree(ptr->pprov_data); @@ -444,7 +444,7 @@ static int ft1000_reset_card(struct net_device *dev) ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); } else { DEBUG(1, - "ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n"); + "ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n"); ft1000_write_reg(dev, FT1000_REG_RESET, (DSP_RESET_BIT | ASIC_RESET_BIT)); } @@ -458,8 +458,8 @@ static int ft1000_reset_card(struct net_device *dev) 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_read_reg(dev, + FT1000_REG_DPRAM_DATA); } } } else { @@ -467,7 +467,7 @@ static int ft1000_reset_card(struct net_device *dev) FT1000_DPRAM_MAG_RX_BASE); for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) { info->DSPSess.MagRec[i] = - inl(dev->base_addr + FT1000_REG_MAG_DPDATA); + inl(dev->base_addr + FT1000_REG_MAG_DPDATA); } } spin_unlock_irqrestore(&info->dpram_lock, flags); @@ -485,7 +485,7 @@ static int ft1000_reset_card(struct net_device *dev) if (info->AsicID == MAGNEMITE_ID) { // Put dsp in reset and take ASIC out of reset DEBUG(0, - "ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n"); + "ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n"); ft1000_write_reg(dev, FT1000_REG_RESET, DSP_RESET_BIT); // Setting MAGNEMITE ASIC to big endian mode @@ -502,8 +502,8 @@ static int ft1000_reset_card(struct net_device *dev) // Wait for 0xfefe indicating dsp ready before starting download for (i = 0; i < 50; i++) { tempword = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE, - FT1000_MAG_DPRAM_FEFE_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE, + FT1000_MAG_DPRAM_FEFE_INDX); if (tempword == 0xfefe) { break; } @@ -512,7 +512,7 @@ static int ft1000_reset_card(struct net_device *dev) if (i == 50) { DEBUG(0, - "ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n"); + "ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n"); return FALSE; } @@ -540,25 +540,25 @@ static int ft1000_reset_card(struct net_device *dev) ft1000_write_dpram(dev, FT1000_HI_HO, ho); tempword = ft1000_read_dpram(dev, FT1000_HI_HO); DEBUG(1, "ft1000_hw:ft1000_reset_asic:hi_ho value = 0x%x\n", - tempword); + tempword); } else { // Initialize DSP heartbeat area to ho ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, ho_mag, FT1000_MAG_HI_HO_INDX); tempword = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, - FT1000_MAG_HI_HO_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX); DEBUG(1, "ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", - tempword); + tempword); } info->CardReady = 1; ft1000_enable_interrupts(dev); /* Schedule heartbeat process to run every 2 seconds */ -// poll_timer.expires = jiffies + (2*HZ); -// poll_timer.data = (u_long)dev; -// add_timer(&poll_timer); +// poll_timer.expires = jiffies + (2*HZ); +// poll_timer.data = (u_long)dev; +// add_timer(&poll_timer); return TRUE; @@ -585,7 +585,7 @@ static int ft1000_chkcard(struct net_device *dev) tempword = ft1000_read_reg(dev, FT1000_REG_SUP_IMASK); if (tempword == 0) { DEBUG(1, - "ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); + "ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); return FALSE; } // The system will return the value of 0xffff for the version register @@ -593,13 +593,12 @@ static int ft1000_chkcard(struct net_device *dev) tempword = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); if (tempword == 0xffff) { DEBUG(1, - "ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); + "ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); return FALSE; } return TRUE; } - //--------------------------------------------------------------------------- // // Function: ft1000_hbchk @@ -626,61 +625,63 @@ static void ft1000_hbchk(u_long data) tempword = ft1000_read_dpram(dev, FT1000_HI_HO); } else { tempword = - ntohs(ft1000_read_dpram_mag_16 + ntohs(ft1000_read_dpram_mag_16 (dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); } DEBUG(1, "ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n", - tempword); + tempword); // Let's perform another check if ho is not detected if (tempword != ho) { if (info->AsicID == ELECTRABUZZ_ID) { tempword = ft1000_read_dpram(dev, FT1000_HI_HO); - } - else { - tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); + } else { + tempword = + ntohs(ft1000_read_dpram_mag_16 + (dev, FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX)); } } if (tempword != ho) { printk(KERN_INFO - "ft1000: heartbeat failed - no ho detected\n"); + "ft1000: heartbeat failed - no ho detected\n"); if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); + ft1000_read_dpram(dev, FT1000_DSP_TIMER0); info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); + ft1000_read_dpram(dev, FT1000_DSP_TIMER1); info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); + ft1000_read_dpram(dev, FT1000_DSP_TIMER2); info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); + ft1000_read_dpram(dev, FT1000_DSP_TIMER3); } else { info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { printk(KERN_INFO - "ft1000: Hardware Failure Detected - PC Card disabled\n"); + "ft1000: Hardware Failure Detected - PC Card disabled\n"); info->ProgConStat = 0xff; return; } /* Schedule this module to run every 2 seconds */ - poll_timer.expires = jiffies + (2*HZ); - poll_timer.data = (u_long)dev; + poll_timer.expires = jiffies + (2 * HZ); + poll_timer.data = (u_long) dev; add_timer(&poll_timer); return; } @@ -692,44 +693,44 @@ static void ft1000_hbchk(u_long data) } if (tempword & FT1000_DB_HB) { printk(KERN_INFO - "ft1000: heartbeat doorbell not clear by firmware\n"); + "ft1000: heartbeat doorbell not clear by firmware\n"); if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); + ft1000_read_dpram(dev, FT1000_DSP_TIMER0); info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); + ft1000_read_dpram(dev, FT1000_DSP_TIMER1); info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); + ft1000_read_dpram(dev, FT1000_DSP_TIMER2); info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); + ft1000_read_dpram(dev, FT1000_DSP_TIMER3); } else { info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { printk(KERN_INFO - "ft1000: Hardware Failure Detected - PC Card disabled\n"); + "ft1000: Hardware Failure Detected - PC Card disabled\n"); info->ProgConStat = 0xff; return; } /* Schedule this module to run every 2 seconds */ - poll_timer.expires = jiffies + (2*HZ); - poll_timer.data = (u_long)dev; + poll_timer.expires = jiffies + (2 * HZ); + poll_timer.data = (u_long) dev; add_timer(&poll_timer); return; } @@ -746,68 +747,71 @@ static void ft1000_hbchk(u_long data) tempword = ft1000_read_dpram(dev, FT1000_HI_HO); } else { tempword = - ntohs(ft1000_read_dpram_mag_16 + ntohs(ft1000_read_dpram_mag_16 (dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); } - // Let's write hi again if fail + // Let's write hi again if fail if (tempword != hi) { if (info->AsicID == ELECTRABUZZ_ID) { ft1000_write_dpram(dev, FT1000_HI_HO, hi); - } - else { - ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, hi_mag, FT1000_MAG_HI_HO_INDX); + } else { + ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, + hi_mag, + FT1000_MAG_HI_HO_INDX); } if (info->AsicID == ELECTRABUZZ_ID) { tempword = ft1000_read_dpram(dev, FT1000_HI_HO); - } - else { - tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); + } else { + tempword = + ntohs(ft1000_read_dpram_mag_16 + (dev, FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX)); } } if (tempword != hi) { printk(KERN_INFO - "ft1000: heartbeat failed - cannot write hi into DPRAM\n"); + "ft1000: heartbeat failed - cannot write hi into DPRAM\n"); if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); + ft1000_read_dpram(dev, FT1000_DSP_TIMER0); info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); + ft1000_read_dpram(dev, FT1000_DSP_TIMER1); info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); + ft1000_read_dpram(dev, FT1000_DSP_TIMER2); info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); + ft1000_read_dpram(dev, FT1000_DSP_TIMER3); } else { info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { printk(KERN_INFO - "ft1000: Hardware Failure Detected - PC Card disabled\n"); + "ft1000: Hardware Failure Detected - PC Card disabled\n"); info->ProgConStat = 0xff; return; } /* Schedule this module to run every 2 seconds */ - poll_timer.expires = jiffies + (2*HZ); - poll_timer.data = (u_long)dev; + poll_timer.expires = jiffies + (2 * HZ); + poll_timer.data = (u_long) dev; add_timer(&poll_timer); return; } @@ -829,7 +833,8 @@ static void ft1000_hbchk(u_long data) // Output: // //--------------------------------------------------------------------------- -void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qtype) +void ft1000_send_cmd(struct net_device *dev, u16 * ptempbuffer, int size, + u16 qtype) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev); int i; @@ -847,18 +852,18 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qt // All messages are in the form total_len + pseudo header + message body spin_lock_irqsave(&info->dpram_lock, flags); - // Make sure SLOWQ doorbell is clear - tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - i=0; - while (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - i++; - if (i==10) { - spin_unlock_irqrestore(&info->dpram_lock, flags); - return; - } - tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - } + // Make sure SLOWQ doorbell is clear + tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); + i = 0; + while (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + i++; + if (i == 10) { + spin_unlock_irqrestore(&info->dpram_lock, flags); + return; + } + tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); + } if (info->AsicID == ELECTRABUZZ_ID) { ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, @@ -868,7 +873,7 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qt // Write pseudo header and messgae body for (i = 0; i < (size >> 1); i++) { DEBUG(1, "FT1000:ft1000_send_cmd:data %d = 0x%x\n", i, - *ptempbuffer); + *ptempbuffer); tempword = htons(*ptempbuffer++); ft1000_write_reg(dev, FT1000_REG_DPRAM_DATA, tempword); } @@ -882,13 +887,13 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qt FT1000_DPRAM_MAG_TX_BASE + 1); for (i = 0; i < (size >> 2); i++) { DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", - *ptempbuffer); + *ptempbuffer); outw(*ptempbuffer++, - dev->base_addr + FT1000_REG_MAG_DPDATAL); + dev->base_addr + FT1000_REG_MAG_DPDATAL); DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", - *ptempbuffer); + *ptempbuffer); outw(*ptempbuffer++, - dev->base_addr + FT1000_REG_MAG_DPDATAH); + dev->base_addr + FT1000_REG_MAG_DPDATAH); } DEBUG(1, "FT1000:ft1000_send_cmd:data = 0x%x\n", *ptempbuffer); outw(*ptempbuffer++, dev->base_addr + FT1000_REG_MAG_DPDATAL); @@ -914,7 +919,8 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qt // = 1 (successful) // //--------------------------------------------------------------------------- -BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16 *pnxtph) +BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, + u16 * pnxtph) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev); u16 size; @@ -924,17 +930,17 @@ BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16 unsigned long flags; if (info->AsicID == ELECTRABUZZ_ID) { - size = ( ft1000_read_dpram(dev, *pnxtph) ) + PSEUDOSZ; + size = (ft1000_read_dpram(dev, *pnxtph)) + PSEUDOSZ; } else { size = - ntohs(ft1000_read_dpram_mag_16 + ntohs(ft1000_read_dpram_mag_16 (dev, FT1000_MAG_PH_LEN, FT1000_MAG_PH_LEN_INDX)) + PSEUDOSZ; } if (size > maxsz) { DEBUG(1, - "FT1000:ft1000_receive_cmd:Invalid command length = %d\n", - size); + "FT1000:ft1000_receive_cmd:Invalid command length = %d\n", + size); return FALSE; } else { ppseudohdr = (u16 *) pbuffer; @@ -944,7 +950,7 @@ BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16 FT1000_DPRAM_RX_BASE + 2); for (i = 0; i <= (size >> 1); i++) { tempword = - ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); + ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); *pbuffer++ = ntohs(tempword); } } else { @@ -957,11 +963,11 @@ BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16 FT1000_DPRAM_MAG_RX_BASE + 1); for (i = 0; i <= (size >> 2); i++) { *pbuffer = - inw(dev->base_addr + + inw(dev->base_addr + FT1000_REG_MAG_DPDATAL); pbuffer++; *pbuffer = - inw(dev->base_addr + + inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); pbuffer++; } @@ -988,7 +994,7 @@ BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16 } if ((tempword != *ppseudohdr)) { DEBUG(1, - "FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n"); + "FT1000:ft1000_receive_cmd:Pseudo header checksum mismatch\n"); // Drop this message return FALSE; } @@ -1026,13 +1032,12 @@ void ft1000_proc_drvmsg(struct net_device *dev) u16 wrd; } convert; - if (info->AsicID == ELECTRABUZZ_ID) { - tempword = FT1000_DPRAM_RX_BASE+2; - } - else { - tempword = FT1000_DPRAM_MAG_RX_BASE; - } - if ( ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword) ) { + if (info->AsicID == ELECTRABUZZ_ID) { + tempword = FT1000_DPRAM_RX_BASE + 2; + } else { + tempword = FT1000_DPRAM_MAG_RX_BASE; + } + if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) { // Get the message type which is total_len + PSEUDO header + msgtype + message body pdrvmsg = (PDRVMSG) & cmdbuffer[0]; @@ -1041,13 +1046,13 @@ void ft1000_proc_drvmsg(struct net_device *dev) switch (msgtype) { case DSP_PROVISION: DEBUG(0, - "Got a provisioning request message from DSP\n"); + "Got a provisioning request message from DSP\n"); mdelay(25); while (list_empty(&info->prov_list) == 0) { DEBUG(0, "Sending a provisioning message\n"); // Make sure SLOWQ doorbell is clear tempword = - ft1000_read_reg(dev, FT1000_REG_DOORBELL); + ft1000_read_reg(dev, FT1000_REG_DOORBELL); i = 0; while (tempword & FT1000_DB_DPRAM_TX) { mdelay(5); @@ -1057,8 +1062,8 @@ void ft1000_proc_drvmsg(struct net_device *dev) } } ptr = - list_entry(info->prov_list.next, - PROV_RECORD, list); + list_entry(info->prov_list.next, + PROV_RECORD, list); len = *(u16 *) ptr->pprov_data; len = htons(len); @@ -1070,14 +1075,15 @@ void ft1000_proc_drvmsg(struct net_device *dev) // Calculate new checksum ppseudo_hdr->checksum = *pmsg++; DEBUG(1, "checksum = 0x%x\n", - ppseudo_hdr->checksum); + ppseudo_hdr->checksum); for (i = 1; i < 7; i++) { ppseudo_hdr->checksum ^= *pmsg++; DEBUG(1, "checksum = 0x%x\n", - ppseudo_hdr->checksum); + ppseudo_hdr->checksum); } - ft1000_send_cmd (dev, (u16 *)ptr->pprov_data, len, SLOWQ_TYPE); + ft1000_send_cmd(dev, (u16 *) ptr->pprov_data, + len, SLOWQ_TYPE); list_del(&ptr->list); kfree(ptr->pprov_data); kfree(ptr); @@ -1089,14 +1095,23 @@ void ft1000_proc_drvmsg(struct net_device *dev) case MEDIA_STATE: pmediamsg = (PMEDIAMSG) & cmdbuffer[0]; if (info->ProgConStat != 0xFF) { - if (pmediamsg->state) { - DEBUG(1, "Media is up\n"); - if (info->mediastate == 0) { - netif_carrier_on(dev); - netif_wake_queue(dev); - info->mediastate = 1; - do_gettimeofday(&tv); - info->ConTm = tv.tv_sec; + if (pmediamsg->state) { + DEBUG(1, "Media is up\n"); + if (info->mediastate == 0) { + netif_carrier_on(dev); + netif_wake_queue(dev); + info->mediastate = 1; + do_gettimeofday(&tv); + info->ConTm = tv.tv_sec; + } + } else { + DEBUG(1, "Media is down\n"); + if (info->mediastate == 1) { + info->mediastate = 0; + netif_carrier_off(dev); + netif_stop_queue(dev); + info->ConTm = 0; + } } } else { DEBUG(1, "Media is down\n"); @@ -1107,25 +1122,15 @@ void ft1000_proc_drvmsg(struct net_device *dev) info->ConTm = 0; } } - } - else { - DEBUG(1,"Media is down\n"); - if (info->mediastate == 1) { - info->mediastate = 0; - netif_carrier_off(dev); - netif_stop_queue(dev); - info->ConTm = 0; - } - } break; case DSP_INIT_MSG: pdspinitmsg = (PDSPINITMSG) & 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], - info->DspVer[3]); + info->DspVer[0], info->DspVer[1], info->DspVer[2], + info->DspVer[3]); memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, - HWSERNUMSZ); + HWSERNUMSZ); memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); dev->dev_addr[0] = info->eui64[0]; @@ -1136,18 +1141,18 @@ void ft1000_proc_drvmsg(struct net_device *dev) dev->dev_addr[5] = info->eui64[7]; if (ntohs(pdspinitmsg->length) == - (sizeof(DSPINITMSG) - 20)) { + (sizeof(DSPINITMSG) - 20)) { memcpy(info->ProductMode, - pdspinitmsg->ProductMode, MODESZ); + pdspinitmsg->ProductMode, MODESZ); memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, - CALVERSZ); + CALVERSZ); memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, - CALDATESZ); + CALDATESZ); DEBUG(1, "RFCalVer = 0x%2x 0x%2x\n", - info->RfCalVer[0], info->RfCalVer[1]); + info->RfCalVer[0], info->RfCalVer[1]); } - break ; + break; case DSP_STORE_INFO: DEBUG(1, "FT1000:drivermsg:Got DSP_STORE_INFO\n"); tempword = ntohs(pdrvmsg->length); @@ -1156,8 +1161,8 @@ void ft1000_proc_drvmsg(struct net_device *dev) pmsg = (PUSHORT) & pdrvmsg->data[0]; for (i = 0; i < ((tempword + 1) / 2); i++) { DEBUG(1, - "FT1000:drivermsg:dsp info data = 0x%x\n", - *pmsg); + "FT1000:drivermsg:dsp info data = 0x%x\n", + *pmsg); info->DSPInfoBlk[i + 10] = *pmsg++; } } @@ -1172,7 +1177,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); tempword = - ft1000_read_reg(dev, FT1000_REG_DOORBELL); + ft1000_read_reg(dev, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); } @@ -1184,7 +1189,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) pmsg = (PUSHORT) info->DSPInfoBlk; ppseudo_hdr = (PPSEUDO_HDR) pmsg; ppseudo_hdr->length = - htons(info->DSPInfoBlklen + 4); + htons(info->DSPInfoBlklen + 4); ppseudo_hdr->source = 0x10; ppseudo_hdr->destination = 0x20; ppseudo_hdr->portdest = 0; @@ -1205,8 +1210,10 @@ void ft1000_proc_drvmsg(struct net_device *dev) } info->DSPInfoBlk[8] = 0x7200; info->DSPInfoBlk[9] = - htons(info->DSPInfoBlklen); - ft1000_send_cmd (dev, (PUSHORT)info->DSPInfoBlk, (USHORT)(info->DSPInfoBlklen+4), 0); + htons(info->DSPInfoBlklen); + ft1000_send_cmd(dev, (PUSHORT) info->DSPInfoBlk, + (USHORT) (info->DSPInfoBlklen + + 4), 0); } info->DrvMsgPend = 0; @@ -1221,7 +1228,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); tempword = - ft1000_read_reg(dev, FT1000_REG_DOORBELL); + ft1000_read_reg(dev, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); } @@ -1247,10 +1254,10 @@ void ft1000_proc_drvmsg(struct net_device *dev) // Insert application id ppseudo_hdr->portsrc = 0; // Calculate new checksum - ppseudo_hdr->checksum = *pmsg++; - for (i=1; i<7; i++) { - ppseudo_hdr->checksum ^= *pmsg++; - } + ppseudo_hdr->checksum = *pmsg++; + for (i = 1; i < 7; i++) { + ppseudo_hdr->checksum ^= *pmsg++; + } pmsg = (PUSHORT) & tempbuffer[16]; *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); *pmsg++ = htons(0x000e); @@ -1266,7 +1273,8 @@ void ft1000_proc_drvmsg(struct net_device *dev) *pmsg++ = convert.wrd; *pmsg++ = htons(info->DrvErrNum); - ft1000_send_cmd (dev, (PUSHORT)&tempbuffer[0], (USHORT)(0x0012), 0); + ft1000_send_cmd(dev, (PUSHORT) & tempbuffer[0], + (USHORT) (0x0012), 0); info->DrvErrNum = 0; } info->DrvMsgPend = 0; @@ -1319,7 +1327,7 @@ int ft1000_parse_dpram_msg(struct net_device *dev) FT1000_DPRAM_MAG_RX_BASE); for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) { outl(info->DSPSess.MagRec[i], - dev->base_addr + FT1000_REG_MAG_DPDATA); + dev->base_addr + FT1000_REG_MAG_DPDATA); } } spin_unlock_irqrestore(&info->dpram_lock, flags); @@ -1341,7 +1349,7 @@ int ft1000_parse_dpram_msg(struct net_device *dev) if (doorbell & FT1000_DSP_ASIC_RESET) { DEBUG(0, - "FT1000:ft1000_parse_dpram_msg: Got a dsp ASIC reset message\n"); + "FT1000:ft1000_parse_dpram_msg: Got a dsp ASIC reset message\n"); info->DspAsicReset = 1; ft1000_write_reg(dev, FT1000_REG_DOORBELL, FT1000_DSP_ASIC_RESET); @@ -1351,35 +1359,35 @@ int ft1000_parse_dpram_msg(struct net_device *dev) if (doorbell & FT1000_DB_DPRAM_RX) { DEBUG(1, - "FT1000:ft1000_parse_dpram_msg: Got a slow queue message\n"); + "FT1000:ft1000_parse_dpram_msg: Got a slow queue message\n"); nxtph = FT1000_DPRAM_RX_BASE + 2; if (info->AsicID == ELECTRABUZZ_ID) { total_len = - ft1000_read_dpram(dev, FT1000_DPRAM_RX_BASE); + ft1000_read_dpram(dev, FT1000_DPRAM_RX_BASE); } else { total_len = - ntohs(ft1000_read_dpram_mag_16 + ntohs(ft1000_read_dpram_mag_16 (dev, FT1000_MAG_TOTAL_LEN, FT1000_MAG_TOTAL_LEN_INDX)); } DEBUG(1, "FT1000:ft1000_parse_dpram_msg:total length = %d\n", - total_len); + total_len); if ((total_len < MAX_CMD_SQSIZE) && (total_len > PSEUDOSZ)) { - total_len += nxtph; - cnt = 0; - // ft1000_read_reg will return a value that needs to be byteswap - // in order to get DSP_QID_OFFSET. + total_len += nxtph; + cnt = 0; + // ft1000_read_reg will return a value that needs to be byteswap + // in order to get DSP_QID_OFFSET. if (info->AsicID == ELECTRABUZZ_ID) { portid = - (ft1000_read_dpram - (dev, - DSP_QID_OFFSET + FT1000_DPRAM_RX_BASE + - 2) >> 8) & 0xff; + (ft1000_read_dpram + (dev, + DSP_QID_OFFSET + FT1000_DPRAM_RX_BASE + + 2) >> 8) & 0xff; } else { portid = - (ft1000_read_dpram_mag_16 - (dev, FT1000_MAG_PORT_ID, - FT1000_MAG_PORT_ID_INDX) & 0xff); + (ft1000_read_dpram_mag_16 + (dev, FT1000_MAG_PORT_ID, + FT1000_MAG_PORT_ID_INDX) & 0xff); } DEBUG(1, "DSP_QID = 0x%x\n", portid); @@ -1395,26 +1403,26 @@ int ft1000_parse_dpram_msg(struct net_device *dev) // Reset ASIC and DSP if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); + ft1000_read_dpram(dev, FT1000_DSP_TIMER0); info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); + ft1000_read_dpram(dev, FT1000_DSP_TIMER1); info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); + ft1000_read_dpram(dev, FT1000_DSP_TIMER2); info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); + ft1000_read_dpram(dev, FT1000_DSP_TIMER3); } else { info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } info->DrvErrNum = DSP_CONDRESET_INFO; DEBUG(1, "ft1000_hw:DSP conditional reset requested\n"); @@ -1424,7 +1432,7 @@ int ft1000_parse_dpram_msg(struct net_device *dev) } // let's clear any unexpected doorbells from DSP doorbell = - doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ | + doorbell & ~(FT1000_DB_DPRAM_RX | FT1000_ASIC_RESET_REQ | FT1000_DB_COND_RESET | 0xff00); if (doorbell) { DEBUG(1, "Clearing unexpected doorbell = 0x%x\n", doorbell); @@ -1458,26 +1466,26 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) if (info->PktIntfErr > MAX_PH_ERR) { if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); + ft1000_read_dpram(dev, FT1000_DSP_TIMER0); info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); + ft1000_read_dpram(dev, FT1000_DSP_TIMER1); info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); + ft1000_read_dpram(dev, FT1000_DSP_TIMER2); info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); + ft1000_read_dpram(dev, FT1000_DSP_TIMER3); } else { info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } info->DrvErrNum = DrvErrNum; ft1000_reset_card(dev); @@ -1488,14 +1496,14 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) do { if (info->AsicID == ELECTRABUZZ_ID) { tempword = - ft1000_read_reg(dev, FT1000_REG_DFIFO); + ft1000_read_reg(dev, FT1000_REG_DFIFO); tempword = - ft1000_read_reg(dev, FT1000_REG_DFIFO_STAT); + ft1000_read_reg(dev, FT1000_REG_DFIFO_STAT); } else { templong = - inl(dev->base_addr + FT1000_REG_MAG_DFR); + inl(dev->base_addr + FT1000_REG_MAG_DFR); tempword = - inw(dev->base_addr + FT1000_REG_MAG_DFSR); + inw(dev->base_addr + FT1000_REG_MAG_DFSR); } i++; // This should never happen unless the ASIC is broken. @@ -1503,45 +1511,45 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) if ((i > 2048) || (tempword == 0)) { if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER0); + ft1000_read_dpram(dev, + FT1000_DSP_TIMER0); info->DSP_TIME[1] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER1); + ft1000_read_dpram(dev, + FT1000_DSP_TIMER1); info->DSP_TIME[2] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER2); + ft1000_read_dpram(dev, + FT1000_DSP_TIMER2); info->DSP_TIME[3] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER3); + ft1000_read_dpram(dev, + FT1000_DSP_TIMER3); } else { info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } if (tempword == 0) { // Let's check if ASIC reads are still ok by reading the Mask register // which is never zero at this point of the code. tempword = - inw(dev->base_addr + + inw(dev->base_addr + FT1000_REG_SUP_IMASK); if (tempword == 0) { // This indicates that we can not communicate with the ASIC info->DrvErrNum = - FIFO_FLUSH_BADCNT; + FIFO_FLUSH_BADCNT; } else { // Let's assume that we really flush the FIFO info->PktIntfErr++; @@ -1683,7 +1691,7 @@ int ft1000_copy_up_pkt(struct net_device *dev) if (chksum != tempword) { DEBUG(0, "Packet checksum mismatch 0x%x 0x%x\n", chksum, - tempword); + tempword); ft1000_flush_fifo(dev, DSP_PKTPHCKSUM_INFO); info->stats.rx_errors++; return FAILURE; @@ -1786,7 +1794,8 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) PSEUDO_HDR blk; u16 buff[sizeof(PSEUDO_HDR) >> 1]; u8 buffc[sizeof(PSEUDO_HDR)]; - } pseudo; + } + pseudo; int i; u32 *plong; @@ -1812,7 +1821,7 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) } if (len > ft1000_read_fifo_len(dev)) { DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n"); + "ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n"); info->stats.tx_errors++; return SUCCESS; } @@ -1844,38 +1853,38 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) // copy first word to UFIFO_BEG reg ft1000_write_reg(dev, FT1000_REG_UFIFO_BEG, pseudo.buff[0]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 0 BEG = 0x%04x\n", - pseudo.buff[0]); + pseudo.buff[0]); // copy subsequent words to UFIFO_MID reg ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[1]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 1 MID = 0x%04x\n", - pseudo.buff[1]); + pseudo.buff[1]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[2]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 2 MID = 0x%04x\n", - pseudo.buff[2]); + pseudo.buff[2]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[3]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 3 MID = 0x%04x\n", - pseudo.buff[3]); + pseudo.buff[3]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[4]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 4 MID = 0x%04x\n", - pseudo.buff[4]); + pseudo.buff[4]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[5]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 5 MID = 0x%04x\n", - pseudo.buff[5]); + pseudo.buff[5]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[6]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 6 MID = 0x%04x\n", - pseudo.buff[6]); + pseudo.buff[6]); ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[7]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 7 MID = 0x%04x\n", - pseudo.buff[7]); + pseudo.buff[7]); // Write PPP type + IP Packet into Downlink FIFO for (i = 0; i < (len >> 1) - 1; i++) { ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, htons(*packet)); DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", - i + 8, htons(*packet)); + "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", + i + 8, htons(*packet)); packet++; } @@ -1884,38 +1893,38 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, htons(*packet)); DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data MID = 0x%04x\n", - htons(*packet)); + "ft1000_hw:ft1000_copy_down_pkt:data MID = 0x%04x\n", + htons(*packet)); packet++; ft1000_write_reg(dev, FT1000_REG_UFIFO_END, htons(*packet)); DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", - i + 8, htons(*packet)); + "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", + i + 8, htons(*packet)); } else { ft1000_write_reg(dev, FT1000_REG_UFIFO_END, htons(*packet)); DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", - i + 8, htons(*packet)); + "ft1000_hw:ft1000_copy_down_pkt:data %d MID = 0x%04x\n", + i + 8, htons(*packet)); } } else { outl(*(u32 *) & pseudo.buff[0], - dev->base_addr + FT1000_REG_MAG_UFDR); + dev->base_addr + FT1000_REG_MAG_UFDR); DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[0]); + *(u32 *) & pseudo.buff[0]); outl(*(u32 *) & pseudo.buff[2], - dev->base_addr + FT1000_REG_MAG_UFDR); + dev->base_addr + FT1000_REG_MAG_UFDR); DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[2]); + *(u32 *) & pseudo.buff[2]); outl(*(u32 *) & pseudo.buff[4], - dev->base_addr + FT1000_REG_MAG_UFDR); + dev->base_addr + FT1000_REG_MAG_UFDR); DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[4]); + *(u32 *) & pseudo.buff[4]); outl(*(u32 *) & pseudo.buff[6], - dev->base_addr + FT1000_REG_MAG_UFDR); + dev->base_addr + FT1000_REG_MAG_UFDR); DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n", - *(u32 *) & pseudo.buff[6]); + *(u32 *) & pseudo.buff[6]); plong = (u32 *) packet; // Write PPP type + IP Packet into Downlink FIFO @@ -1926,8 +1935,8 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) // Check for odd alignment if (len & 0x0003) { DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n", - *plong); + "ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n", + *plong); outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); } outl(1, dev->base_addr + FT1000_REG_MAG_UFER); @@ -1997,7 +2006,7 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) } DEBUG(1, "ft1000_hw: ft1000_start_xmit:length of packet = %d\n", - skb->len); + skb->len); pdata = (u8 *) skb->data; @@ -2010,11 +2019,11 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) if ((skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE)) { /* Drop packet which has invalid size */ DEBUG(1, - "ft1000_hw:ft1000_copy_down_pkt:invalid ethernet length\n"); + "ft1000_hw:ft1000_copy_down_pkt:invalid ethernet length\n"); return SUCCESS; } ft1000_copy_down_pkt(dev, (u16 *) (pdata + ENET_HEADER_SIZE - 2), - skb->len - ENET_HEADER_SIZE + 2); + skb->len - ENET_HEADER_SIZE + 2); dev_kfree_skb(skb); @@ -2046,43 +2055,48 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) // Read interrupt type inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - // Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type - while (inttype) { - if (inttype & ISR_DOORBELL_PEND) { - ft1000_parse_dpram_msg(dev); - } + // Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type + while (inttype) { + if (inttype & ISR_DOORBELL_PEND) { + ft1000_parse_dpram_msg(dev); + } - if (inttype & ISR_RCV) { - DEBUG(1, "Data in FIFO\n"); + if (inttype & ISR_RCV) { + DEBUG(1, "Data in FIFO\n"); - cnt = 0; - do { - // Check if we have packets in the Downlink FIFO - if (info->AsicID == ELECTRABUZZ_ID) { - tempword = - ft1000_read_reg(dev, FT1000_REG_DFIFO_STAT); - } else { - tempword = - ft1000_read_reg(dev, FT1000_REG_MAG_DFSR); - } - if (tempword & 0x1f) { - ft1000_copy_up_pkt(dev); - } else { - break; - } - cnt++; - } while (cnt < MAX_RCV_LOOP); + cnt = 0; + do { + // Check if we have packets in the Downlink FIFO + if (info->AsicID == ELECTRABUZZ_ID) { + tempword = + ft1000_read_reg(dev, + FT1000_REG_DFIFO_STAT); + } else { + tempword = + ft1000_read_reg(dev, + FT1000_REG_MAG_DFSR); + } + if (tempword & 0x1f) { + ft1000_copy_up_pkt(dev); + } else { + break; + } + cnt++; + } while (cnt < MAX_RCV_LOOP); + } + // clear interrupts + tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); + DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", + tempword); + ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); + + // Read interrupt type + inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); + DEBUG(1, + "ft1000_hw: interrupt status register after clear = 0x%x\n", + inttype); } - // clear interrupts - tempword = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - DEBUG(1, "ft1000_hw: interrupt status register = 0x%x\n", tempword); - ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword); - - // Read interrupt type - inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR); - DEBUG(1,"ft1000_hw: interrupt status register after clear = 0x%x\n",inttype); - } ft1000_enable_interrupts(dev); return IRQ_HANDLED; } @@ -2091,7 +2105,7 @@ void stop_ft1000_card(struct net_device *dev) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev); PPROV_RECORD ptr; -// int cnt; +// int cnt; DEBUG(0, "ft1000_hw: stop_ft1000_card()\n"); @@ -2114,7 +2128,7 @@ void stop_ft1000_card(struct net_device *dev) } free_irq(dev->irq, dev); - release_region(dev->base_addr,256); + release_region(dev->base_addr, 256); release_firmware(fw_entry); flarion_ft1000_cnt--; ft1000CleanupProc(dev); @@ -2122,7 +2136,7 @@ void stop_ft1000_card(struct net_device *dev) } static void ft1000_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) + struct ethtool_drvinfo *info) { FT1000_INFO *ft_info; ft_info = (FT1000_INFO *) netdev_priv(dev); @@ -2147,14 +2161,14 @@ static const struct ethtool_ops ops = { }; struct net_device *init_ft1000_card(unsigned short irq, int port, - unsigned char *mac_addr, void *ft1000_reset, - void *link, struct device *fdev) + unsigned char *mac_addr, void *ft1000_reset, + void *link, struct device *fdev) { FT1000_INFO *info; struct net_device *dev; int i; - static const struct net_device_ops ft1000ops = // Slavius 21.10.2009 due to kernel changes + static const struct net_device_ops ft1000ops = // Slavius 21.10.2009 due to kernel changes { .ndo_open = &ft1000_open, .ndo_stop = &ft1000_close, @@ -2172,7 +2186,7 @@ struct net_device *init_ft1000_card(unsigned short irq, int port, flarion_ft1000_cnt--; printk(KERN_INFO - "ft1000: This driver can not support more than one instance\n"); + "ft1000: This driver can not support more than one instance\n"); return NULL; } @@ -2216,12 +2230,12 @@ struct net_device *init_ft1000_card(unsigned short irq, int port, info->squeseqnum = 0; -// dev->hard_start_xmit = &ft1000_start_xmit; -// dev->get_stats = &ft1000_stats; -// dev->open = &ft1000_open; -// dev->stop = &ft1000_close; +// dev->hard_start_xmit = &ft1000_start_xmit; +// dev->get_stats = &ft1000_stats; +// dev->open = &ft1000_open; +// dev->stop = &ft1000_close; - dev->netdev_ops = &ft1000ops; // Slavius 21.10.2009 due to kernel changes + dev->netdev_ops = &ft1000ops; // Slavius 21.10.2009 due to kernel changes DEBUG(0, "device name = %s\n", dev->name); @@ -2234,7 +2248,8 @@ struct net_device *init_ft1000_card(unsigned short irq, int port, dev->irq = irq; dev->base_addr = port; - if (request_irq(dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name, dev)) { + if (request_irq + (dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name, dev)) { printk(KERN_ERR "ft1000: Could not request_irq\n"); kfree(dev); return (NULL); @@ -2274,10 +2289,10 @@ struct net_device *init_ft1000_card(unsigned short irq, int port, ft1000_card_present = 1; SET_ETHTOOL_OPS(dev, &ops); printk(KERN_INFO - "ft1000: %s: addr 0x%04lx irq %d, MAC addr %02x:%02x:%02x:%02x:%02x:%02x\n", - dev->name, dev->base_addr, dev->irq, dev->dev_addr[0], - dev->dev_addr[1], dev->dev_addr[2], dev->dev_addr[3], - dev->dev_addr[4], dev->dev_addr[5]); + "ft1000: %s: addr 0x%04lx irq %d, MAC addr %02x:%02x:%02x:%02x:%02x:%02x\n", + dev->name, dev->base_addr, dev->irq, dev->dev_addr[0], + dev->dev_addr[1], dev->dev_addr[2], dev->dev_addr[3], + dev->dev_addr[4], dev->dev_addr[5]); return dev; } diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index b45de9b..6489969 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c @@ -55,7 +55,7 @@ int ft1000ReadProc(char *page, char **start, off_t off, int i; FT1000_INFO *info; char *status[] = - { "Idle (Disconnect)", "Searching", "Active (Connected)", + { "Idle (Disconnect)", "Searching", "Active (Connected)", "Waiting for L2", "Sleep", "No Coverage", "", "" }; char *signal[] = { "", "*", "**", "***", "****" }; @@ -78,10 +78,10 @@ int ft1000ReadProc(char *page, char **start, off_t off, if (info->DspHibernateFlag == 0) { if (info->ProgConStat != 0xFF) { info->LedStat = - ft1000_read_dpram(dev, FT1000_DSP_LED); + ft1000_read_dpram(dev, FT1000_DSP_LED); info->ConStat = - ft1000_read_dpram(dev, - FT1000_DSP_CON_STATE); + ft1000_read_dpram(dev, + FT1000_DSP_CON_STATE); } else { info->ConStat = 0xf; } @@ -89,11 +89,11 @@ int ft1000ReadProc(char *page, char **start, off_t off, } else { if (info->ProgConStat != 0xFF) { info->LedStat = - ntohs(ft1000_read_dpram_mag_16 + ntohs(ft1000_read_dpram_mag_16 (dev, FT1000_MAG_DSP_LED, FT1000_MAG_DSP_LED_INDX)); info->ConStat = - ntohs(ft1000_read_dpram_mag_16 + ntohs(ft1000_read_dpram_mag_16 (dev, FT1000_MAG_DSP_CON_STATE, FT1000_MAG_DSP_CON_STATE_INDX)); } else { @@ -141,24 +141,24 @@ int ft1000ReadProc(char *page, char **start, off_t off, delta = (tv.tv_sec - info->ConTm); len = 0; PUTM_TO_PAGE(len, page, "Connection Time: %02ld:%02ld:%02ld\n", - ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); + ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); PUTM_TO_PAGE(len, page, "Connection Time[s]: %ld\n", delta); PUTM_TO_PAGE(len, page, "Asic ID: %s\n", - (info->AsicID) == - ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); + (info->AsicID) == + ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); PUTX_TO_PAGE(len, page, "SKU: ", SKUSZ, info->Sku); PUTX_TO_PAGE(len, page, "EUI64: ", EUISZ, info->eui64); PUTD_TO_PAGE(len, page, "DSP version number: ", DSPVERSZ, info->DspVer); PUTX_TO_PAGE(len, page, "Hardware Serial Number: ", HWSERNUMSZ, - info->HwSerNum); + info->HwSerNum); PUTX_TO_PAGE(len, page, "Caliberation Version: ", CALVERSZ, - info->RfCalVer); + info->RfCalVer); PUTD_TO_PAGE(len, page, "Caliberation Date: ", CALDATESZ, - info->RfCalDate); + info->RfCalDate); PUTM_TO_PAGE(len, page, "Media State: %s\n", - (info->mediastate) ? "link" : "no link"); + (info->mediastate) ? "link" : "no link"); PUTM_TO_PAGE(len, page, "Connection Status: %s\n", - status[((info->ConStat) & 0x7)]); + status[((info->ConStat) & 0x7)]); PUTM_TO_PAGE(len, page, "RX packets: %ld\n", info->stats.rx_packets); PUTM_TO_PAGE(len, page, "TX packets: %ld\n", info->stats.tx_packets); PUTM_TO_PAGE(len, page, "RX bytes: %ld\n", info->stats.rx_bytes); @@ -169,7 +169,7 @@ int ft1000ReadProc(char *page, char **start, off_t off, } static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, - void *ptr) + void *ptr) { struct net_device *dev = ptr; FT1000_INFO *info; @@ -180,7 +180,7 @@ static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, case NETDEV_CHANGENAME: remove_proc_entry(info->netdevname, info->proc_ft1000); create_proc_read_entry(dev->name, 0644, info->proc_ft1000, - ft1000ReadProc, dev); + ft1000ReadProc, dev); snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); break; } @@ -199,7 +199,7 @@ void ft1000InitProc(struct net_device *dev) info->proc_ft1000 = proc_mkdir(FT1000_PROC, init_net.proc_net); create_proc_read_entry(dev->name, 0644, info->proc_ft1000, - ft1000ReadProc, dev); + ft1000ReadProc, dev); snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); register_netdevice_notifier(&ft1000_netdev_notifier); } -- 1.7.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel