summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2012-12-02 12:30:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-07 12:33:45 -0800
commit3aa2303a20e3aac5a8445777b665a433d60c2786 (patch)
tree0a9762e0ac2f1c77fb477001a1739126935a375f /drivers/staging/ft1000/ft1000-usb/ft1000_download.c
parent8d915d8c9b8c49ab4725e3d9a6d7b5a8b50751e7 (diff)
downloadop-kernel-dev-3aa2303a20e3aac5a8445777b665a433d60c2786.zip
op-kernel-dev-3aa2303a20e3aac5a8445777b665a433d60c2786.tar.gz
staging: ft1000: unify struct ft1000_info between USB and PCMCIA drivers
Unify struct ft1000_info between ft1000-usb and ft1000-pcmcia and move it to common ft1000.h. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Tested-by: Marek Belisko <marek.belisko@open-nandra.com> Review-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ft1000/ft1000-usb/ft1000_download.c')
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_download.c70
1 files changed, 32 insertions, 38 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 1972b72..cc00e94 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -188,7 +188,6 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value)
u16 handshake;
int loopcnt;
u32 status = 0;
- struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
loopcnt = 0;
@@ -196,10 +195,10 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value)
/* Need to clear downloader doorbell if Hartley ASIC */
status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX,
FT1000_REG_DOORBELL);
- if (pft1000info->fcodeldr) {
+ if (ft1000dev->fcodeldr) {
DEBUG(" get_handshake: fcodeldr is %d\n",
- pft1000info->fcodeldr);
- pft1000info->fcodeldr = 0;
+ ft1000dev->fcodeldr);
+ ft1000dev->fcodeldr = 0;
status = check_usb_db(ft1000dev);
if (status != STATUS_SUCCESS) {
DEBUG("get_handshake: check_usb_db failed\n");
@@ -270,29 +269,28 @@ static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value
u16 temp;
u32 status = 0;
- struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
loopcnt = 0;
handshake = 0;
while (loopcnt < 100) {
- if (pft1000info->usbboot == 2) {
+ if (ft1000dev->usbboot == 2) {
status = ft1000_read_dpram32(ft1000dev, 0,
- (u8 *)&(pft1000info->tempbuf[0]), 64);
+ (u8 *)&(ft1000dev->tempbuf[0]), 64);
for (temp = 0; temp < 16; temp++) {
DEBUG("tempbuf %d = 0x%x\n", temp,
- pft1000info->tempbuf[temp]);
+ ft1000dev->tempbuf[temp]);
}
status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC,
(u8 *)&handshake, 1);
DEBUG("handshake from read_dpram16 = 0x%x\n",
handshake);
- if (pft1000info->dspalive == pft1000info->tempbuf[6]) {
+ if (ft1000dev->dspalive == ft1000dev->tempbuf[6]) {
handshake = 0;
} else {
- handshake = pft1000info->tempbuf[1];
- pft1000info->dspalive =
- pft1000info->tempbuf[6];
+ handshake = ft1000dev->tempbuf[1];
+ ft1000dev->dspalive =
+ ft1000dev->tempbuf[6];
}
} else {
status = ft1000_read_dpram16(ft1000dev,
@@ -336,9 +334,8 @@ static u16 get_request_type(struct ft1000_device *ft1000dev)
u32 status;
u16 tempword;
u32 tempx;
- struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
- if (pft1000info->bootmode == 1) {
+ if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev,
DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
tempx = ntohl(tempx);
@@ -360,16 +357,15 @@ static u16 get_request_type_usb(struct ft1000_device *ft1000dev)
u32 status;
u16 tempword;
u32 tempx;
- struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
- if (pft1000info->bootmode == 1) {
+ if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev,
DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
tempx = ntohl(tempx);
} else {
- if (pft1000info->usbboot == 2) {
- tempx = pft1000info->tempbuf[2];
- tempword = pft1000info->tempbuf[3];
+ if (ft1000dev->usbboot == 2) {
+ tempx = ft1000dev->tempbuf[2];
+ tempword = ft1000dev->tempbuf[3];
} else {
tempx = 0;
status = ft1000_read_dpram16(ft1000dev,
@@ -401,9 +397,8 @@ static long get_request_value(struct ft1000_device *ft1000dev)
u32 value;
u16 tempword;
u32 status;
- struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
- if (pft1000info->bootmode == 1) {
+ if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (u8 *)&value);
value = ntohl(value);
@@ -507,7 +502,6 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi
u16 tempword;
u16 tempbuffer[64];
u16 resultbuffer[64];
- struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
//DEBUG("FT1000:download:start word_length = %d\n",(int)word_length);
dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
@@ -548,7 +542,7 @@ static u32 write_blk (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **pUcFi
//DEBUG("write_blk: loopcnt is %d\n", loopcnt);
//DEBUG("write_blk: bootmode = %d\n", bootmode);
//DEBUG("write_blk: dpram = %x\n", dpram);
- if (pft1000info->bootmode == 0)
+ if (ft1000dev->bootmode == 0)
{
if (dpram >= 0x3F4)
Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 8);
@@ -718,9 +712,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
DEBUG("Entered scram_dnldr...\n");
- pft1000info->fcodeldr = 0;
- pft1000info->usbboot = 0;
- pft1000info->dspalive = 0xffff;
+ ft1000dev->fcodeldr = 0;
+ ft1000dev->usbboot = 0;
+ ft1000dev->dspalive = 0xffff;
//
// Get version id of file, at first 4 bytes of file, for newer files.
@@ -745,7 +739,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
switch (state) {
case STATE_START_DWNLD:
DEBUG("FT1000:STATE_START_DWNLD\n");
- if (pft1000info->usbboot)
+ if (ft1000dev->usbboot)
handshake =
get_handshake_usb(ft1000dev,
HANDSHAKE_DSP_BL_READY);
@@ -771,7 +765,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
case STATE_BOOT_DWNLD:
DEBUG("FT1000:STATE_BOOT_DWNLD\n");
- pft1000info->bootmode = 1;
+ ft1000dev->bootmode = 1;
handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST);
if (handshake == HANDSHAKE_REQUEST) {
/*
@@ -797,7 +791,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
//DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file);
//DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file);
state = STATE_CODE_DWNLD;
- pft1000info->fcodeldr = 1;
+ ft1000dev->fcodeldr = 1;
break;
case REQUEST_CODE_SEGMENT:
//DEBUG("FT1000:REQUEST_CODE_SEGMENT\n");
@@ -842,7 +836,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
status = STATUS_FAILURE;
break;
}
- if (pft1000info->usbboot)
+ if (ft1000dev->usbboot)
put_handshake_usb(ft1000dev,
HANDSHAKE_RESPONSE);
else
@@ -858,8 +852,8 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
case STATE_CODE_DWNLD:
//DEBUG("FT1000:STATE_CODE_DWNLD\n");
- pft1000info->bootmode = 0;
- if (pft1000info->usbboot)
+ ft1000dev->bootmode = 0;
+ if (ft1000dev->usbboot)
handshake =
get_handshake_usb(ft1000dev,
HANDSHAKE_REQUEST);
@@ -870,7 +864,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
/*
* Get type associated with the request.
*/
- if (pft1000info->usbboot)
+ if (ft1000dev->usbboot)
request =
get_request_type_usb(ft1000dev);
else
@@ -916,7 +910,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
}
break;
case REQUEST_DONE_CL:
- pft1000info->usbboot = 3;
+ ft1000dev->usbboot = 3;
/* Reposition ptrs to beginning of provisioning section */
s_file =
(u16 *) (pFileStart +
@@ -965,9 +959,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
write_blk_fifo(ft1000dev, &s_file,
&c_file, word_length);
- if (pft1000info->usbboot == 0)
- pft1000info->usbboot++;
- if (pft1000info->usbboot == 1) {
+ if (ft1000dev->usbboot == 0)
+ ft1000dev->usbboot++;
+ if (ft1000dev->usbboot == 1) {
tempword = 0;
ft1000_write_dpram16(ft1000dev,
DWNLD_MAG1_PS_HDR_LOC,
@@ -1117,7 +1111,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
status = STATUS_FAILURE;
break;
}
- if (pft1000info->usbboot)
+ if (ft1000dev->usbboot)
put_handshake_usb(ft1000dev,
HANDSHAKE_RESPONSE);
else
OpenPOWER on IntegriCloud