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

staging: ft1000-pcmcia: remove support for v5 firmware

Remove support for v5 firmware images as all known firmware images are v6.
Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e1328c62
...@@ -94,18 +94,6 @@ void put_request_value(struct net_device *dev, long lvalue); ...@@ -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 { ...@@ -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) ...@@ -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) ...@@ -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) {
case 5:
case 6:
pUsFile =
(u16 *) ((long)pFileStart + pFileHdr5->loader_offset);
pUcFile =
(u8 *) ((long)pFileStart + pFileHdr5->loader_offset);
pBootEnd =
(u8 *) ((long)pFileStart + pFileHdr5->loader_code_end);
pUsFile = (u16 *) ((long)pFileStart + pFileHdr5->loader_offset);
pUcFile = (u8 *) ((long)pFileStart + pFileHdr5->loader_offset);
pBootEnd = (u8 *) ((long)pFileStart + pFileHdr5->loader_code_end);
loader_code_address = pFileHdr5->loader_code_address; loader_code_address = pFileHdr5->loader_code_address;
loader_code_size = pFileHdr5->loader_code_size; loader_code_size = pFileHdr5->loader_code_size;
bGoodVersion = false; bGoodVersion = false;
break;
default:
Status = FAILURE;
break;
}
while ((Status == SUCCESS) && (uiState != STATE_DONE_FILE)) { while ((Status == SUCCESS) && (uiState != STATE_DONE_FILE)) {
...@@ -431,34 +393,14 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -431,34 +393,14 @@ 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.
*/
ft1000_write_reg(dev,
FT1000_REG_DPRAM_ADDR,
DWNLD_PS_HDR_LOC);
for (; word_length > 0; word_length--) { /* In words */
//temp = *pUsFile;
//temp = RtlUshortByteSwap(temp);
ft1000_write_reg(dev,
FT1000_REG_DPRAM_DATA,
*pUsFile);
pUsFile++;
pUcFile += 2;
DspWordCnt++;
}
} else {
/* /*
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) { if (word_length & 0x01)
word_length++; word_length++;
}
word_length = word_length / 2; word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */ for (; word_length > 0; word_length--) { /* In words */
...@@ -470,7 +412,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -470,7 +412,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
}
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
flags); flags);
...@@ -519,24 +460,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -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,34 +482,14 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -557,34 +482,14 @@ 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.
*/
ft1000_write_reg(dev,
FT1000_REG_DPRAM_ADDR,
DWNLD_PS_HDR_LOC);
for (; word_length > 0; word_length--) { /* In words */
//temp = *pUsFile;
//temp = RtlUshortByteSwap(temp);
ft1000_write_reg(dev,
FT1000_REG_DPRAM_DATA,
*pUsFile);
pUsFile++;
pUcFile += 2;
DspWordCnt++;
}
} else {
/* /*
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) { if (word_length & 0x01)
word_length++; word_length++;
}
word_length = word_length / 2; word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */ for (; word_length > 0; word_length--) { /* In words */
...@@ -596,7 +501,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -596,7 +501,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
}
break; break;
case REQUEST_MAILBOX_DATA: case REQUEST_MAILBOX_DATA:
...@@ -663,32 +567,14 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -663,32 +567,14 @@ 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.
*/
ft1000_write_reg(dev,
FT1000_REG_DPRAM_ADDR,
DWNLD_PS_HDR_LOC);
for (; word_length > 0; word_length--) { /* In words */
ft1000_write_reg(dev,
FT1000_REG_DPRAM_DATA,
*pUsFile
/*temp */
);
pUsFile++;
}
} else {
/* /*
* Position ASIC DPRAM auto-increment pointer. * Position ASIC DPRAM auto-increment pointer.
*/ */
outw(DWNLD_MAG_PS_HDR_LOC, outw(DWNLD_MAG_PS_HDR_LOC,
dev->base_addr + dev->base_addr +
FT1000_REG_DPRAM_ADDR); FT1000_REG_DPRAM_ADDR);
if (word_length & 0x01) { if (word_length & 0x01)
word_length++; word_length++;
}
word_length = word_length / 2; word_length = word_length / 2;
for (; word_length > 0; word_length--) { /* In words */ for (; word_length > 0; word_length--) { /* In words */
...@@ -702,7 +588,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -702,7 +588,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
dev->base_addr + dev->base_addr +
FT1000_REG_MAG_DPDATAL); FT1000_REG_MAG_DPDATAL);
} }
}
spin_unlock_irqrestore(&info-> spin_unlock_irqrestore(&info->
dpram_lock, dpram_lock,
flags); flags);
...@@ -712,60 +597,12 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -712,60 +597,12 @@ 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) {
pDspImageInfo =
(struct dsp_image_info *) ((long)
pFileStart
+
sizeof
(struct dsp_file_hdr_5));
for (imageN = 0;
imageN <
pFileHdr5->nDspImages;
imageN++) {
if (pDspImageInfo->
version ==
requested_version) {
bGoodVersion =
true;
pUsFile =
(u16
*) ((long)
pFileStart
+
pDspImageInfo->
begin_offset);
pUcFile =
(u8
*) ((long)
pFileStart
+
pDspImageInfo->
begin_offset);
pCodeEnd =
(u8
*) ((long)
pFileStart
+
pDspImageInfo->
end_offset);
run_address =
pDspImageInfo->
run_address;
run_size =
pDspImageInfo->
image_size;
break;
}
pDspImageInfo++;
}
} else {
pDspImageInfoV6 = pDspImageInfoV6 =
(struct dsp_image_info_v6 *) ((long) (struct dsp_image_info *) ((long)
pFileStart pFileStart
+ +
sizeof sizeof
(struct dsp_file_hdr_5)); (struct dsp_file_hdr));
for (imageN = 0; for (imageN = 0;
imageN < imageN <
pFileHdr5->nDspImages; pFileHdr5->nDspImages;
...@@ -823,7 +660,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength) ...@@ -823,7 +660,6 @@ int card_download(struct net_device *dev, const u8 *pFileStart, u32 FileLength)
} }
pDspImageInfoV6++; pDspImageInfoV6++;
} }
}
if (!bGoodVersion) { if (!bGoodVersion) {
/* /*
* Error, beyond boot code range. * Error, beyond boot code range.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment