staging: ft1000-pcmcia: remove support for v5 firmware

Remove support for v5 firmware images as all known firmware images are v6.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Ondrej Zary 2011-07-01 00:03:57 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель e1328c625c
Коммит e161a440af
1 изменённых файлов: 126 добавлений и 290 удалений

Просмотреть файл

@ -94,18 +94,6 @@ void put_request_value(struct net_device *dev, long lvalue);
u16 hdr_checksum(struct pseudo_hdr *pHdr); u16 hdr_checksum(struct pseudo_hdr *pHdr);
struct dsp_file_hdr { struct dsp_file_hdr {
u32 build_date;
u32 dsp_coff_date;
u32 loader_code_address;
u32 loader_code_size;
u32 loader_code_end;
u32 dsp_code_address;
u32 dsp_code_size;
u32 dsp_code_end;
u32 reserved[8];
} __attribute__ ((packed));
struct dsp_file_hdr_5 {
u32 version_id; // Version ID of this image format. u32 version_id; // Version ID of this image format.
u32 package_id; // Package ID of code release. u32 package_id; // Package ID of code release.
u32 build_date; // Date/time stamp when file was built. u32 build_date; // Date/time stamp when file was built.
@ -126,15 +114,6 @@ struct dsp_image_info {
u32 run_address; // On chip Start address of DSP code. u32 run_address; // On chip Start address of DSP code.
u32 image_size; // Size of image. u32 image_size; // Size of image.
u32 version; // Embedded version # of DSP code. u32 version; // Embedded version # of DSP code.
} __attribute__ ((packed));
struct dsp_image_info_v6 {
u32 coff_date; // Date/time when DSP Coff image was built.
u32 begin_offset; // Offset in file where image begins.
u32 end_offset; // Offset in file where image begins.
u32 run_address; // On chip Start address of DSP code.
u32 image_size; // Size of image.
u32 version; // Embedded version # of DSP code.
unsigned short checksum; // Dsp File checksum unsigned short checksum; // Dsp File checksum
unsigned short pad1; unsigned short pad1;
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -312,20 +291,17 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
{ {
struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev); struct ft1000_info *info = (struct ft1000_info *) netdev_priv(dev);
int Status = SUCCESS; int Status = SUCCESS;
u16 DspWordCnt = 0;
u32 uiState; u32 uiState;
u16 handshake; u16 handshake;
struct pseudo_hdr *pHdr; struct pseudo_hdr *pHdr;
u16 usHdrLength; u16 usHdrLength;
struct dsp_file_hdr *pFileHdr;
long word_length; long word_length;
u16 request; u16 request;
u16 temp; u16 temp;
struct prov_record *pprov_record; struct prov_record *pprov_record;
u8 *pbuffer; u8 *pbuffer;
struct dsp_file_hdr_5 *pFileHdr5; struct dsp_file_hdr *pFileHdr5;
struct dsp_image_info *pDspImageInfo = NULL; struct dsp_image_info *pDspImageInfoV6 = NULL;
struct dsp_image_info_v6 *pDspImageInfoV6 = NULL;
long requested_version; long requested_version;
bool bGoodVersion = 0; bool bGoodVersion = 0;
struct drv_msg *pMailBoxData; struct drv_msg *pMailBoxData;
@ -344,36 +320,22 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
unsigned long templong; unsigned long templong;
unsigned long image_chksum = 0; unsigned long image_chksum = 0;
//
// Get version id of file, at first 4 bytes of file, for newer files.
//
file_version = *(long *)pFileStart; file_version = *(long *)pFileStart;
if (file_version != 6) {
printk(KERN_ERR "ft1000: unsupported firmware version %ld\n", file_version);
Status = FAILURE;
}
uiState = STATE_START_DWNLD; uiState = STATE_START_DWNLD;
pFileHdr = (struct dsp_file_hdr *) pFileStart; pFileHdr5 = (struct dsp_file_hdr *) pFileStart;
pFileHdr5 = (struct dsp_file_hdr_5 *) pFileStart;
switch (file_version) { pUsFile = (u16 *) ((long)pFileStart + pFileHdr5->loader_offset);
case 5: pUcFile = (u8 *) ((long)pFileStart + pFileHdr5->loader_offset);
case 6: pBootEnd = (u8 *) ((long)pFileStart + pFileHdr5->loader_code_end);
pUsFile = loader_code_address = pFileHdr5->loader_code_address;
(u16 *) ((long)pFileStart + pFileHdr5->loader_offset); loader_code_size = pFileHdr5->loader_code_size;
pUcFile = bGoodVersion = false;
(u8 *) ((long)pFileStart + pFileHdr5->loader_offset);
pBootEnd =
(u8 *) ((long)pFileStart + pFileHdr5->loader_code_end);
loader_code_address = pFileHdr5->loader_code_address;
loader_code_size = pFileHdr5->loader_code_size;
bGoodVersion = false;
break;
default:
Status = FAILURE;
break;
}
while ((Status == SUCCESS) && (uiState != STATE_DONE_FILE)) { while ((Status == SUCCESS) && (uiState != STATE_DONE_FILE)) {
@ -431,45 +393,24 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
// Provide mutual exclusive access while reading ASIC registers. // Provide mutual exclusive access while reading ASIC registers.
spin_lock_irqsave(&info->dpram_lock, spin_lock_irqsave(&info->dpram_lock,
flags); flags);
if (file_version == 5) { /*
/* * Position ASIC DPRAM auto-increment pointer.
* Position ASIC DPRAM auto-increment pointer. */
*/ outw(DWNLD_MAG_PS_HDR_LOC,
ft1000_write_reg(dev, dev->base_addr +
FT1000_REG_DPRAM_ADDR, FT1000_REG_DPRAM_ADDR);
DWNLD_PS_HDR_LOC); if (word_length & 0x01)
word_length++;
word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */ for (; word_length > 0; word_length--) { /* In words */
//temp = *pUsFile; templong = *pUsFile++;
//temp = RtlUshortByteSwap(temp); templong |=
ft1000_write_reg(dev, (*pUsFile++ << 16);
FT1000_REG_DPRAM_DATA, pUcFile += 4;
*pUsFile); outl(templong,
pUsFile++;
pUcFile += 2;
DspWordCnt++;
}
} else {
/*
* Position ASIC DPRAM auto-increment pointer.
*/
outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_MAG_DPDATAL);
if (word_length & 0x01) {
word_length++;
}
word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */
templong = *pUsFile++;
templong |=
(*pUsFile++ << 16);
pUcFile += 4;
outl(templong,
dev->base_addr +
FT1000_REG_MAG_DPDATAL);
}
} }
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
@ -519,24 +460,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
break; break;
case REQUEST_DONE_CL: case REQUEST_DONE_CL:
/* Reposition ptrs to beginning of provisioning section */ /* Reposition ptrs to beginning of provisioning section */
switch (file_version) { pUsFile = (u16 *) ((long)pFileStart + pFileHdr5->commands_offset);
case 5: pUcFile = (u8 *) ((long)pFileStart + pFileHdr5->commands_offset);
case 6:
pUsFile =
(u16 *) ((long)pFileStart
+
pFileHdr5->
commands_offset);
pUcFile =
(u8 *) ((long)pFileStart
+
pFileHdr5->
commands_offset);
break;
default:
Status = FAILURE;
break;
}
uiState = STATE_DONE_DWNLD; uiState = STATE_DONE_DWNLD;
break; break;
case REQUEST_CODE_SEGMENT: case REQUEST_CODE_SEGMENT:
@ -557,45 +482,24 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
Status = FAILURE; Status = FAILURE;
break; break;
} }
if (file_version == 5) { /*
/* * Position ASIC DPRAM auto-increment pointer.
* Position ASIC DPRAM auto-increment pointer. */
*/ outw(DWNLD_MAG_PS_HDR_LOC,
ft1000_write_reg(dev, dev->base_addr +
FT1000_REG_DPRAM_ADDR, FT1000_REG_DPRAM_ADDR);
DWNLD_PS_HDR_LOC); if (word_length & 0x01)
word_length++;
word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */ for (; word_length > 0; word_length--) { /* In words */
//temp = *pUsFile; templong = *pUsFile++;
//temp = RtlUshortByteSwap(temp); templong |=
ft1000_write_reg(dev, (*pUsFile++ << 16);
FT1000_REG_DPRAM_DATA, pUcFile += 4;
*pUsFile); outl(templong,
pUsFile++;
pUcFile += 2;
DspWordCnt++;
}
} else {
/*
* Position ASIC DPRAM auto-increment pointer.
*/
outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_MAG_DPDATAL);
if (word_length & 0x01) {
word_length++;
}
word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */
templong = *pUsFile++;
templong |=
(*pUsFile++ << 16);
pUcFile += 4;
outl(templong,
dev->base_addr +
FT1000_REG_MAG_DPDATAL);
}
} }
break; break;
@ -663,45 +567,26 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
// Provide mutual exclusive access while reading ASIC registers. // Provide mutual exclusive access while reading ASIC registers.
spin_lock_irqsave(&info->dpram_lock, spin_lock_irqsave(&info->dpram_lock,
flags); flags);
if (file_version == 5) { /*
/* * Position ASIC DPRAM auto-increment pointer.
* Position ASIC DPRAM auto-increment pointer. */
*/ outw(DWNLD_MAG_PS_HDR_LOC,
ft1000_write_reg(dev, dev->base_addr +
FT1000_REG_DPRAM_ADDR, FT1000_REG_DPRAM_ADDR);
DWNLD_PS_HDR_LOC); if (word_length & 0x01)
word_length++;
word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */ for (; word_length > 0; word_length--) { /* In words */
ft1000_write_reg(dev, templong =
FT1000_REG_DPRAM_DATA, ntohs(*pUsFile++);
*pUsFile temp =
/*temp */ ntohs(*pUsFile++);
); templong |=
pUsFile++; (temp << 16);
} outl(templong,
} else {
/*
* Position ASIC DPRAM auto-increment pointer.
*/
outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_MAG_DPDATAL);
if (word_length & 0x01) {
word_length++;
}
word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */
templong =
ntohs(*pUsFile++);
temp =
ntohs(*pUsFile++);
templong |=
(temp << 16);
outl(templong,
dev->base_addr +
FT1000_REG_MAG_DPDATAL);
}
} }
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
@ -712,117 +597,68 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
bGoodVersion = false; bGoodVersion = false;
requested_version = requested_version =
get_request_value(dev); get_request_value(dev);
if (file_version == 5) { pDspImageInfoV6 =
pDspImageInfo = (struct dsp_image_info *) ((long)
(struct dsp_image_info *) ((long) pFileStart
pFileStart +
+ sizeof
sizeof (struct dsp_file_hdr));
(struct dsp_file_hdr_5)); for (imageN = 0;
for (imageN = 0; imageN <
imageN < pFileHdr5->nDspImages;
pFileHdr5->nDspImages; imageN++) {
imageN++) { temp = (u16)
if (pDspImageInfo-> (pDspImageInfoV6->
version == version);
requested_version) { templong = temp;
bGoodVersion = temp = (u16)
true; (pDspImageInfoV6->
pUsFile = version >> 16);
(u16 templong |=
*) ((long) (temp << 16);
pFileStart if (templong ==
+ requested_version) {
pDspImageInfo-> bGoodVersion =
begin_offset); true;
pUcFile = pUsFile =
(u8 (u16
*) ((long) *) ((long)
pFileStart pFileStart
+ +
pDspImageInfo-> pDspImageInfoV6->
begin_offset); begin_offset);
pCodeEnd = pUcFile =
(u8 (u8
*) ((long) *) ((long)
pFileStart pFileStart
+ +
pDspImageInfo-> pDspImageInfoV6->
end_offset); begin_offset);
run_address = pCodeEnd =
pDspImageInfo-> (u8
run_address; *) ((long)
run_size = pFileStart
pDspImageInfo-> +
image_size; pDspImageInfoV6->
break; end_offset);
} run_address =
pDspImageInfo++; pDspImageInfoV6->
} run_address;
} else { run_size =
pDspImageInfoV6 = pDspImageInfoV6->
(struct dsp_image_info_v6 *) ((long) image_size;
pFileStart image_chksum =
+ (u32)
sizeof pDspImageInfoV6->
(struct dsp_file_hdr_5)); checksum;
for (imageN = 0; DEBUG(0,
imageN < "ft1000_dnld: image_chksum = 0x%8x\n",
pFileHdr5->nDspImages; (unsigned
imageN++) { int)
temp = (u16) image_chksum);
(pDspImageInfoV6-> break;
version);
templong = temp;
temp = (u16)
(pDspImageInfoV6->
version >> 16);
templong |=
(temp << 16);
if (templong ==
requested_version) {
bGoodVersion =
true;
pUsFile =
(u16
*) ((long)
pFileStart
+
pDspImageInfoV6->
begin_offset);
pUcFile =
(u8
*) ((long)
pFileStart
+
pDspImageInfoV6->
begin_offset);
pCodeEnd =
(u8
*) ((long)
pFileStart
+
pDspImageInfoV6->
end_offset);
run_address =
pDspImageInfoV6->
run_address;
run_size =
pDspImageInfoV6->
image_size;
image_chksum =
(u32)
pDspImageInfoV6->
checksum;
DEBUG(0,
"ft1000_dnld: image_chksum = 0x%8x\n",
(unsigned
int)
image_chksum);
break;
}
pDspImageInfoV6++;
} }
pDspImageInfoV6++;
} }
if (!bGoodVersion) { if (!bGoodVersion) {
/* /*