Modifications to support building Prism2 for all targets (cs,pci,plx, and usb)
and modifications to support RAM f/w (tertiary) download.
This commit is contained in:
parent
0e9c379724
commit
03b1c2bde4
|
@ -688,7 +688,8 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
|
|||
}
|
||||
}
|
||||
if ( pdaok ) {
|
||||
WLAN_LOG_DEBUG2(2,"PDA Read from 0x%8lx in %s space.\n",
|
||||
WLAN_LOG_DEBUG2(2,
|
||||
"PDA Read from 0x%08lx in %s space.\n",
|
||||
pdaloc[i].cardaddr,
|
||||
pdaloc[i].auxctl == 0 ? "EXTDS" :
|
||||
pdaloc[i].auxctl == 1 ? "NV" :
|
||||
|
|
|
@ -279,11 +279,12 @@ hfa384x_dowrid(
|
|||
ctlx_usercb_t usercb,
|
||||
void *usercb_data);
|
||||
|
||||
#if TODO
|
||||
static int
|
||||
hfa384x_dormem(
|
||||
hfa384x_t *hw,
|
||||
UINT wait,
|
||||
UINT16 page,
|
||||
UINT16 offset,
|
||||
void *data,
|
||||
UINT len,
|
||||
ctlx_usercb_t usercb,
|
||||
|
@ -293,11 +294,12 @@ static int
|
|||
hfa384x_dowmem(
|
||||
hfa384x_t *hw,
|
||||
UINT wait,
|
||||
UINT16 page,
|
||||
UINT16 offset,
|
||||
void *data,
|
||||
UINT len,
|
||||
ctlx_usercb_t usercb,
|
||||
void *usercb_data);
|
||||
#endif
|
||||
|
||||
/*================================================================*/
|
||||
/* Function Definitions */
|
||||
|
@ -851,18 +853,20 @@ return 0;
|
|||
int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr,
|
||||
UINT16 highaddr, UINT16 codelen)
|
||||
{
|
||||
#if 0
|
||||
int result = 0;
|
||||
UINT16 cmd;
|
||||
DBFENTER;
|
||||
cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DOWNLD) |
|
||||
HFA384x_CMD_PROGMODE_SET(mode);
|
||||
result = hfa384x_dl_docmd_wait(hw, cmd, lowaddr, highaddr, codelen);
|
||||
|
||||
result = hfa384x_docmd(hw,
|
||||
DOWAIT,
|
||||
(HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DOWNLD) |
|
||||
HFA384x_CMD_PROGMODE_SET(mode)),
|
||||
lowaddr,
|
||||
highaddr,
|
||||
codelen,
|
||||
NULL, NULL);
|
||||
|
||||
DBFEXIT;
|
||||
return result;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1154,6 +1158,13 @@ hfa384x_docmd(
|
|||
ctlx->outbuf.cmdreq.parm2 = host2hfa384x_16(parm2);
|
||||
hw->lastcmd = host2hfa384x_16(p2cmd);
|
||||
|
||||
WLAN_LOG_DEBUG4(4, "cmdreq: cmd=0x%04x "
|
||||
"parm0=0x%04x parm1=0x%04x parm2=0x%04x\n",
|
||||
p2cmd,
|
||||
parm0,
|
||||
parm1,
|
||||
parm2);
|
||||
|
||||
/* Fill the out packet */
|
||||
FILL_BULK_URB( &(ctlx->outurb), hw->usb,
|
||||
usb_sndbulkpipe(hw->usb, 2),
|
||||
|
@ -1172,10 +1183,18 @@ hfa384x_docmd(
|
|||
switch(ctlx->state) {
|
||||
case HFA384x_USBCTLX_COMPLETE:
|
||||
result = hfa384x2host_16(ctlx->inbuf.cmdresp.status);
|
||||
result &= HFA384x_STATUS_RESULT;
|
||||
|
||||
hw->status = hfa384x2host_16(ctlx->inbuf.cmdresp.status);
|
||||
hw->resp0 = hfa384x2host_16(ctlx->inbuf.cmdresp.resp0);
|
||||
hw->resp1 = hfa384x2host_16(ctlx->inbuf.cmdresp.resp1);
|
||||
hw->resp2 = hfa384x2host_16(ctlx->inbuf.cmdresp.resp2);
|
||||
WLAN_LOG_DEBUG4(4, "cmdresp:status=0x%04x "
|
||||
"resp0=0x%04x resp1=0x%04x resp2=0x%04x\n",
|
||||
hw->status,
|
||||
hw->resp0,
|
||||
hw->resp1,
|
||||
hw->resp2);
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQSUBMIT_FAIL:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQSUBMIT_FAIL\n");
|
||||
|
@ -1271,9 +1290,9 @@ hfa384x_dorrid(
|
|||
ctlx->state = HFA384x_USBCTLX_START;
|
||||
|
||||
/* Initialize the command */
|
||||
ctlx->outbuf.rridreq.type = host2hfa384x_16(HFA384x_USB_RRIDREQ);
|
||||
ctlx->outbuf.rridreq.frmlen = host2hfa384x_16(2);
|
||||
ctlx->outbuf.rridreq.rid = host2hfa384x_16(rid);
|
||||
ctlx->outbuf.rridreq.type = host2hfa384x_16(HFA384x_USB_RRIDREQ);
|
||||
ctlx->outbuf.rridreq.frmlen = host2hfa384x_16(ctlx->outbuf.rridreq.rid);
|
||||
ctlx->outbuf.rridreq.rid = host2hfa384x_16(rid);
|
||||
|
||||
/* Fill the out packet */
|
||||
FILL_BULK_URB( &(ctlx->outurb), hw->usb,
|
||||
|
@ -1396,15 +1415,21 @@ hfa384x_dowrid(
|
|||
ctlx->state = HFA384x_USBCTLX_START;
|
||||
|
||||
/* Initialize the command */
|
||||
ctlx->outbuf.rridreq.type = host2hfa384x_16(HFA384x_USB_WRIDREQ);
|
||||
ctlx->outbuf.rridreq.frmlen = host2hfa384x_16(2+(riddatalen*2));
|
||||
ctlx->outbuf.rridreq.rid = host2hfa384x_16(rid);
|
||||
ctlx->outbuf.wridreq.type = host2hfa384x_16(HFA384x_USB_WRIDREQ);
|
||||
ctlx->outbuf.wridreq.frmlen = host2hfa384x_16(
|
||||
sizeof(ctlx->outbuf.rridreq.rid) +
|
||||
riddatalen);
|
||||
ctlx->outbuf.wridreq.rid = host2hfa384x_16(rid);
|
||||
memcpy(ctlx->outbuf.wridreq.data, riddata, riddatalen);
|
||||
|
||||
/* Fill the out packet */
|
||||
FILL_BULK_URB( &(ctlx->outurb), hw->usb,
|
||||
usb_sndbulkpipe(hw->usb, 2),
|
||||
&(ctlx->outbuf), ROUNDUP64(sizeof(ctlx->outbuf.wridreq)),
|
||||
&(ctlx->outbuf),
|
||||
ROUNDUP64( sizeof(ctlx->outbuf.wridreq.type) +
|
||||
sizeof(ctlx->outbuf.wridreq.frmlen) +
|
||||
sizeof(ctlx->outbuf.wridreq.rid) +
|
||||
riddatalen),
|
||||
hfa384x_usbout_callback, hw->usbcontext);
|
||||
|
||||
/* Submit the CTLX */
|
||||
|
@ -1420,6 +1445,7 @@ hfa384x_dowrid(
|
|||
switch(ctlx->state) {
|
||||
case HFA384x_USBCTLX_COMPLETE:
|
||||
result = hfa384x2host_16(ctlx->inbuf.wridresp.status);
|
||||
result &= HFA384x_STATUS_RESULT;
|
||||
hw->status = hfa384x2host_16(ctlx->inbuf.wridresp.status);
|
||||
hw->resp0 = hfa384x2host_16(ctlx->inbuf.wridresp.resp0);
|
||||
hw->resp1 = hfa384x2host_16(ctlx->inbuf.wridresp.resp1);
|
||||
|
@ -1460,7 +1486,6 @@ done:
|
|||
return result;
|
||||
}
|
||||
|
||||
#if TODO
|
||||
/*----------------------------------------------------------------
|
||||
* hfa384x_dormem
|
||||
*
|
||||
|
@ -1473,9 +1498,10 @@ done:
|
|||
* Arguments:
|
||||
* hw device structure
|
||||
* wait 1=wait for completion, 0=async
|
||||
* rid RID code
|
||||
* riddata Data portion of RID formatted for MAC
|
||||
* riddatalen Length of the data portion in bytes
|
||||
* page MAC address space page
|
||||
* offset MAC address space offset
|
||||
* data Ptr to data buffer to receive read
|
||||
* len Length of the data to read (max == 2048)
|
||||
* usercb user callback for async calls, NULL for wait==1 calls
|
||||
* usercb_data user supplied data pointer for async calls, NULL
|
||||
*
|
||||
|
@ -1496,13 +1522,98 @@ int
|
|||
hfa384x_dormem(
|
||||
hfa384x_t *hw,
|
||||
UINT wait,
|
||||
UINT16 page,
|
||||
UINT16 offset,
|
||||
void *data,
|
||||
UINT len,
|
||||
ctlx_usercb_t usercb,
|
||||
void *usercb_data)
|
||||
{
|
||||
WLAN_LOG_WARNING0(__FUNCTION__": Not currently supported.\n");
|
||||
return -ERESTARTSYS;
|
||||
int result = 0;
|
||||
hfa384x_usbctlx_t *ctlx;
|
||||
|
||||
DBFENTER;
|
||||
ctlx = kmalloc(sizeof(*ctlx), GFP_ATOMIC);
|
||||
if ( ctlx == NULL ) {
|
||||
result = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
memset(ctlx, 0, sizeof(*ctlx));
|
||||
ctlx->state = HFA384x_USBCTLX_START;
|
||||
|
||||
/* Initialize the command */
|
||||
ctlx->outbuf.rmemreq.type = host2hfa384x_16(HFA384x_USB_RMEMREQ);
|
||||
ctlx->outbuf.rmemreq.frmlen = host2hfa384x_16(
|
||||
sizeof(ctlx->outbuf.rmemreq.offset) +
|
||||
sizeof(ctlx->outbuf.rmemreq.page) +
|
||||
len);
|
||||
ctlx->outbuf.rmemreq.offset = host2hfa384x_16(offset);
|
||||
ctlx->outbuf.rmemreq.page = host2hfa384x_16(page);
|
||||
|
||||
WLAN_LOG_DEBUG4(4,
|
||||
"type=0x%04x frmlen=%d offset=0x%04x page=0x%04x\n",
|
||||
ctlx->outbuf.rmemreq.type,
|
||||
ctlx->outbuf.rmemreq.frmlen,
|
||||
ctlx->outbuf.rmemreq.offset,
|
||||
ctlx->outbuf.rmemreq.page);
|
||||
|
||||
WLAN_LOG_DEBUG1(4,"pktsize=%d\n",
|
||||
ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)));
|
||||
|
||||
/* Fill the out packet */
|
||||
FILL_BULK_URB( &(ctlx->outurb), hw->usb,
|
||||
usb_sndbulkpipe(hw->usb, 2),
|
||||
&(ctlx->outbuf), ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)),
|
||||
hfa384x_usbout_callback, hw->usbcontext);
|
||||
|
||||
if ( wait ) {
|
||||
hfa384x_usbctlx_submit_wait(hw, ctlx);
|
||||
} else {
|
||||
hfa384x_usbctlx_submit_async(hw, ctlx, usercb, usercb_data);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* All of the following is skipped for async calls */
|
||||
/* On reawakening, check the ctlx status */
|
||||
switch(ctlx->state) {
|
||||
case HFA384x_USBCTLX_COMPLETE:
|
||||
WLAN_LOG_DEBUG1(4,"rmemresp:len=%d\n",
|
||||
ctlx->inbuf.rmemresp.frmlen);
|
||||
memcpy(data, ctlx->inbuf.rmemresp.data, len);
|
||||
result = 0;
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQSUBMIT_FAIL:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQSUBMIT_FAIL\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQ_TIMEOUT:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQ_TIMEOUT\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQ_FAILED:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQ_FAILED\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
case HFA384x_USBCTLX_RESP_TIMEOUT:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=RESP_TIMEOUT\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
default:
|
||||
/* The ctlx is still running and probably still in the queue
|
||||
* We were probably awakened by a signal. Return an error
|
||||
* and DO NOT free the ctlx. Let the ctlx finish and it will
|
||||
* just be leaked. At least we won't crash that way.
|
||||
* TODO: we need a ctlx_cancel function
|
||||
*/
|
||||
result = -ERESTARTSYS;
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
|
||||
kfree(ctlx);
|
||||
done:
|
||||
DBFEXIT;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1519,8 +1630,10 @@ hfa384x_dormem(
|
|||
* Arguments:
|
||||
* hw device structure
|
||||
* wait 1=wait for completion, 0=async
|
||||
* data ptr to write data
|
||||
* len length of write data
|
||||
* page MAC address space page
|
||||
* offset MAC address space offset
|
||||
* data Ptr to data buffer containing write data
|
||||
* len Length of the data to read (max == 2048)
|
||||
* usercb user callback for async calls, NULL for wait==1 calls
|
||||
* usercb_data user supplied data pointer for async calls, NULL
|
||||
*
|
||||
|
@ -1541,15 +1654,96 @@ int
|
|||
hfa384x_dowmem(
|
||||
hfa384x_t *hw,
|
||||
UINT wait,
|
||||
UINT16 page,
|
||||
UINT16 offset,
|
||||
void *data,
|
||||
UINT len,
|
||||
ctlx_usercb_t usercb,
|
||||
void *usercb_data)
|
||||
{
|
||||
WLAN_LOG_WARNING0(__FUNCTION__": Not currently supported.\n");
|
||||
return -ERESTARTSYS;
|
||||
int result = 0;
|
||||
hfa384x_usbctlx_t *ctlx;
|
||||
|
||||
DBFENTER;
|
||||
ctlx = kmalloc(sizeof(*ctlx), GFP_ATOMIC);
|
||||
if ( ctlx == NULL ) {
|
||||
result = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
memset(ctlx, 0, sizeof(*ctlx));
|
||||
ctlx->state = HFA384x_USBCTLX_START;
|
||||
|
||||
/* Initialize the command */
|
||||
ctlx->outbuf.wmemreq.type = host2hfa384x_16(HFA384x_USB_WMEMREQ);
|
||||
ctlx->outbuf.wmemreq.frmlen = host2hfa384x_16(
|
||||
sizeof(ctlx->outbuf.wmemreq.offset) +
|
||||
sizeof(ctlx->outbuf.wmemreq.page) +
|
||||
len);
|
||||
ctlx->outbuf.wmemreq.offset = host2hfa384x_16(offset);
|
||||
ctlx->outbuf.wmemreq.page = host2hfa384x_16(page);
|
||||
memcpy(ctlx->outbuf.wmemreq.data, data, len);
|
||||
|
||||
/* Fill the out packet */
|
||||
FILL_BULK_URB( &(ctlx->outurb), hw->usb,
|
||||
usb_sndbulkpipe(hw->usb, 2),
|
||||
&(ctlx->outbuf),
|
||||
ROUNDUP64( sizeof(ctlx->outbuf.wmemreq.type) +
|
||||
sizeof(ctlx->outbuf.wmemreq.frmlen) +
|
||||
sizeof(ctlx->outbuf.wmemreq.offset) +
|
||||
sizeof(ctlx->outbuf.wmemreq.page) +
|
||||
len),
|
||||
hfa384x_usbout_callback, hw->usbcontext);
|
||||
|
||||
if ( wait ) {
|
||||
hfa384x_usbctlx_submit_wait(hw, ctlx);
|
||||
} else {
|
||||
hfa384x_usbctlx_submit_async(hw, ctlx, usercb, usercb_data);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* All of the following is skipped for async calls */
|
||||
/* On reawakening, check the ctlx status */
|
||||
switch(ctlx->state) {
|
||||
case HFA384x_USBCTLX_COMPLETE:
|
||||
result = hfa384x2host_16(ctlx->inbuf.wmemresp.status);
|
||||
hw->status = hfa384x2host_16(ctlx->inbuf.wmemresp.status);
|
||||
hw->resp0 = hfa384x2host_16(ctlx->inbuf.wmemresp.resp0);
|
||||
hw->resp1 = hfa384x2host_16(ctlx->inbuf.wmemresp.resp1);
|
||||
hw->resp2 = hfa384x2host_16(ctlx->inbuf.wmemresp.resp2);
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQSUBMIT_FAIL:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQSUBMIT_FAIL\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQ_TIMEOUT:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQ_TIMEOUT\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
case HFA384x_USBCTLX_REQ_FAILED:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=REQ_FAILED\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
case HFA384x_USBCTLX_RESP_TIMEOUT:
|
||||
WLAN_LOG_WARNING0(__FUNCTION__":ctlx failure=RESP_TIMEOUT\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
default:
|
||||
/* The ctlx is still running and probably still in the queue
|
||||
* We were probably awakened by a signal. Return an error
|
||||
* and DO NOT free the ctlx. Let the ctlx finish and it will
|
||||
* just be leaked. At least we won't crash that way.
|
||||
* TODO: we need a ctlx_cancel function
|
||||
*/
|
||||
result = -ERESTARTSYS;
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
|
||||
kfree(ctlx);
|
||||
done:
|
||||
DBFEXIT;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
|
@ -1934,17 +2128,20 @@ int hfa384x_drvr_initialize(hfa384x_t *hw)
|
|||
int i;
|
||||
DBFENTER;
|
||||
|
||||
/* Post the rx urb */
|
||||
FILL_BULK_URB(&hw->rx_urb, hw->usb,
|
||||
usb_rcvbulkpipe(hw->usb, 1),
|
||||
&hw->rxbuff, sizeof(hw->rxbuff),
|
||||
hfa384x_usbin_callback, hw->usbcontext);
|
||||
if (!hw->rxurb_posted) {
|
||||
/* Post the rx urb */
|
||||
FILL_BULK_URB(&hw->rx_urb, hw->usb,
|
||||
usb_rcvbulkpipe(hw->usb, 1),
|
||||
&hw->rxbuff, sizeof(hw->rxbuff),
|
||||
hfa384x_usbin_callback, hw->usbcontext);
|
||||
|
||||
if ((result = usb_submit_urb(&hw->rx_urb))) {
|
||||
WLAN_LOG_ERROR1(__FUNCTION__
|
||||
":Fatal, failed to submit rx_urb. error=%d\n",
|
||||
result);
|
||||
goto failed;
|
||||
if ((result = usb_submit_urb(&hw->rx_urb))) {
|
||||
WLAN_LOG_ERROR1(__FUNCTION__
|
||||
":Fatal, failed to submit rx_urb. error=%d\n",
|
||||
result);
|
||||
goto failed;
|
||||
}
|
||||
hw->rxurb_posted = 1;
|
||||
}
|
||||
|
||||
/* call initialize */
|
||||
|
@ -2280,6 +2477,45 @@ return 0;
|
|||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* hfa384x_drvr_ramdl_disable
|
||||
*
|
||||
* Ends the ram download state.
|
||||
*
|
||||
* Arguments:
|
||||
* hw device structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 success
|
||||
* >0 f/w reported error - f/w status code
|
||||
* <0 driver reported error
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
* Call context:
|
||||
* process
|
||||
----------------------------------------------------------------*/
|
||||
int
|
||||
hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
|
||||
{
|
||||
DBFENTER;
|
||||
/* Check that we're already in the download state */
|
||||
if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
WLAN_LOG_DEBUG0(3,"ramdl_disable()\n");
|
||||
|
||||
/* There isn't much we can do at this point, so I don't */
|
||||
/* bother w/ the return value */
|
||||
hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0);
|
||||
hw->dlstate = HFA384x_DLSTATE_DISABLED;
|
||||
|
||||
DBFEXIT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* hfa384x_drvr_ramdl_enable
|
||||
*
|
||||
|
@ -2304,9 +2540,9 @@ return 0;
|
|||
* Call context:
|
||||
* process
|
||||
----------------------------------------------------------------*/
|
||||
int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
|
||||
int
|
||||
hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
|
||||
{
|
||||
#if 0
|
||||
int result = 0;
|
||||
UINT16 lowaddr;
|
||||
UINT16 hiaddr;
|
||||
|
@ -2315,41 +2551,20 @@ int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
|
|||
/* Check that a port isn't active */
|
||||
for ( i = 0; i < HFA384x_PORTID_MAX; i++) {
|
||||
if ( hw->port_enabled[i] ) {
|
||||
WLAN_LOG_DEBUG0(1,"Can't download with a port enabled.\n");
|
||||
WLAN_LOG_ERROR0(__FUNCTION__
|
||||
": Can't download with a macport enabled.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that we're not already in a download state */
|
||||
if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) {
|
||||
WLAN_LOG_DEBUG0(1,"Download state not disabled.\n");
|
||||
WLAN_LOG_ERROR0(__FUNCTION__
|
||||
": Download state not disabled.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Retrieve the buffer loc&size and timeout */
|
||||
if ( (result = hfa384x_drvr_getconfig(hw, HFA384x_RID_DOWNLOADBUFFER,
|
||||
&(hw->bufinfo), sizeof(hw->bufinfo))) ) {
|
||||
return result;
|
||||
}
|
||||
hw->bufinfo.page = hfa384x2host_16(hw->bufinfo.page);
|
||||
hw->bufinfo.offset = hfa384x2host_16(hw->bufinfo.offset);
|
||||
hw->bufinfo.len = hfa384x2host_16(hw->bufinfo.len);
|
||||
if ( (result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_MAXLOADTIME,
|
||||
&(hw->dltimeout))) ) {
|
||||
return result;
|
||||
}
|
||||
hw->dltimeout = hfa384x2host_16(hw->dltimeout);
|
||||
|
||||
#if 0
|
||||
WLAN_LOG_DEBUG1(1,"ramdl_enable, exeaddr=0x%08x\n", exeaddr);
|
||||
hw->dlstate = HFA384x_DLSTATE_RAMENABLED;
|
||||
#endif
|
||||
|
||||
/* Enable the aux port */
|
||||
if ( (result = hfa384x_cmd_aux_enable(hw)) ) {
|
||||
WLAN_LOG_DEBUG1(1,"Aux enable failed, result=%d.\n", result);
|
||||
return result;
|
||||
}
|
||||
WLAN_LOG_DEBUG1(3,"ramdl_enable, exeaddr=0x%08lx\n", exeaddr);
|
||||
|
||||
/* Call the download(1,addr) function */
|
||||
lowaddr = (UINT16)(exeaddr & 0x0000ffff);
|
||||
|
@ -2357,64 +2572,20 @@ hw->dlstate = HFA384x_DLSTATE_RAMENABLED;
|
|||
|
||||
result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_RAM,
|
||||
lowaddr, hiaddr, 0);
|
||||
|
||||
if ( result == 0) {
|
||||
/* Set the download state */
|
||||
hw->dlstate = HFA384x_DLSTATE_RAMENABLED;
|
||||
} else {
|
||||
WLAN_LOG_DEBUG3(1,"cmd_download(0x%04x, 0x%04x) failed, result=%d.\n",
|
||||
lowaddr,hiaddr, result);
|
||||
/* Disable the aux port */
|
||||
hfa384x_cmd_aux_disable(hw);
|
||||
WLAN_LOG_DEBUG3(1,
|
||||
"cmd_download(0x%04x, 0x%04x) failed, result=%d.\n",
|
||||
lowaddr,
|
||||
hiaddr,
|
||||
result);
|
||||
}
|
||||
|
||||
DBFEXIT;
|
||||
return result;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* hfa384x_drvr_ramdl_disable
|
||||
*
|
||||
* Ends the ram download state.
|
||||
*
|
||||
* Arguments:
|
||||
* hw device structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 success
|
||||
* >0 f/w reported error - f/w status code
|
||||
* <0 driver reported error
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
* Call context:
|
||||
* process
|
||||
----------------------------------------------------------------*/
|
||||
int hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
|
||||
{
|
||||
#if 0
|
||||
DBFENTER;
|
||||
/* Check that we're already in the download state */
|
||||
if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
WLAN_LOG_DEBUG0(1,"ramdl_disable\n");
|
||||
hw->dlstate = HFA384x_DLSTATE_DISABLED;
|
||||
#endif
|
||||
/* There isn't much we can do at this point, so I don't */
|
||||
/* bother w/ the return value */
|
||||
hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0);
|
||||
hw->dlstate = HFA384x_DLSTATE_DISABLED;
|
||||
|
||||
/* Disable the aux port */
|
||||
hfa384x_cmd_aux_disable(hw);
|
||||
|
||||
DBFEXIT;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2422,8 +2593,8 @@ hw->dlstate = HFA384x_DLSTATE_DISABLED;
|
|||
* hfa384x_drvr_ramdl_write
|
||||
*
|
||||
* Performs a RAM download of a chunk of data. First checks to see
|
||||
* that we're in the RAM download state, then uses the aux functions
|
||||
* to 1) copy the data, 2) readback and compare. The download
|
||||
* that we're in the RAM download state, then uses the [read|write]mem USB
|
||||
* commands to 1) copy the data, 2) readback and compare. The download
|
||||
* state is unaffected. When all data has been written using
|
||||
* this function, call drvr_ramdl_disable() to end the download state
|
||||
* and restart the MAC.
|
||||
|
@ -2444,11 +2615,17 @@ hw->dlstate = HFA384x_DLSTATE_DISABLED;
|
|||
* Call context:
|
||||
* process
|
||||
----------------------------------------------------------------*/
|
||||
int hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
|
||||
int
|
||||
hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
|
||||
{
|
||||
#if 0
|
||||
int result = 0;
|
||||
UINT8 *verbuf;
|
||||
int nwrites;
|
||||
UINT8 *data = buf;
|
||||
int i;
|
||||
UINT32 curraddr;
|
||||
UINT16 currpage;
|
||||
UINT16 curroffset;
|
||||
UINT16 currlen;
|
||||
DBFENTER;
|
||||
/* Check that we're in the ram download state */
|
||||
if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
|
||||
|
@ -2456,29 +2633,37 @@ int hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
|
|||
}
|
||||
|
||||
WLAN_LOG_INFO2("Writing %ld bytes to ram @0x%06lx\n", len, daddr);
|
||||
#if 0
|
||||
WLAN_HEX_DUMP(1, "dldata", buf, len);
|
||||
#endif
|
||||
/* Copy the data via the aux port */
|
||||
hfa384x_copy_to_aux(hw, daddr, HFA384x_AUX_CTL_EXTDS, buf, len);
|
||||
|
||||
/* Create a buffer for the verify */
|
||||
verbuf = kmalloc(len, GFP_ATOMIC);
|
||||
if (verbuf == NULL ) return 1;
|
||||
/* How many dowmem calls? */
|
||||
nwrites = len / HFA384x_USB_RWMEM_MAXLEN;
|
||||
nwrites += len % HFA384x_USB_RWMEM_MAXLEN ? 1 : 0;
|
||||
|
||||
/* Read back and compare */
|
||||
hfa384x_copy_from_aux(hw, daddr, HFA384x_AUX_CTL_EXTDS, verbuf, len);
|
||||
/* Do blocking wmem's */
|
||||
for(i=0; i < nwrites; i++) {
|
||||
/* make address args */
|
||||
curraddr = daddr + (i * HFA384x_USB_RWMEM_MAXLEN);
|
||||
currpage = HFA384x_USB_MKPAGE(curraddr);
|
||||
curroffset = HFA384x_USB_MKOFF(curraddr);
|
||||
currlen = len - (i * HFA384x_USB_RWMEM_MAXLEN);
|
||||
if ( currlen > HFA384x_USB_RWMEM_MAXLEN) {
|
||||
currlen = HFA384x_USB_RWMEM_MAXLEN;
|
||||
}
|
||||
|
||||
if ( memcmp(buf, verbuf, len) ) {
|
||||
WLAN_LOG_DEBUG0(1,"ramdl verify failed!\n");
|
||||
result = -EINVAL;
|
||||
/* Do blocking ctlx */
|
||||
result = hfa384x_dowmem( hw, DOWAIT,
|
||||
currpage,
|
||||
curroffset,
|
||||
data + (i*HFA384x_USB_RWMEM_MAXLEN),
|
||||
currlen,
|
||||
NULL, NULL);
|
||||
|
||||
if (result) break;
|
||||
|
||||
/* TODO: We really should have a readback. */
|
||||
}
|
||||
|
||||
kfree_s(verbuf, len);
|
||||
DBFEXIT;
|
||||
return result;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2515,7 +2700,6 @@ WLAN_HEX_DUMP(1, "dldata", buf, len);
|
|||
----------------------------------------------------------------*/
|
||||
int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
|
||||
{
|
||||
#if 0
|
||||
int result = 0;
|
||||
UINT16 *pda = buf;
|
||||
int pdaok = 0;
|
||||
|
@ -2524,29 +2708,44 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
|
|||
int i;
|
||||
UINT16 pdrlen; /* pdr length in bytes, host order */
|
||||
UINT16 pdrcode; /* pdr code, host order */
|
||||
UINT16 currpage;
|
||||
UINT16 curroffset;
|
||||
struct pdaloc {
|
||||
UINT32 cardaddr;
|
||||
UINT16 auxctl;
|
||||
} pdaloc[] =
|
||||
{
|
||||
{ HFA3842_PDA_BASE, HFA384x_AUX_CTL_NV},
|
||||
{ HFA3842_PDA_BASE, HFA384x_AUX_CTL_EXTDS},
|
||||
{ HFA3841_PDA_BASE, HFA384x_AUX_CTL_NV},
|
||||
{ HFA3841_PDA_BASE, HFA384x_AUX_CTL_EXTDS},
|
||||
{ HFA3841_PDA_BOGUS_BASE, HFA384x_AUX_CTL_NV}
|
||||
{ HFA3842_PDA_BASE, 0},
|
||||
{ HFA3841_PDA_BASE, 0},
|
||||
{ HFA3841_PDA_BOGUS_BASE, 0}
|
||||
};
|
||||
|
||||
DBFENTER;
|
||||
/* Check for aux available */
|
||||
result = hfa384x_cmd_aux_enable(hw);
|
||||
if ( result ) {
|
||||
WLAN_LOG_DEBUG1(1,"aux_enable() failed. result=%d\n", result);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/* Read the pda from each known address. */
|
||||
for ( i = 0; i < (sizeof(pdaloc)/sizeof(pdaloc[0])); i++) {
|
||||
hfa384x_copy_from_aux(hw, pdaloc[i].cardaddr, pdaloc[i].auxctl, buf, len);
|
||||
/* Make address */
|
||||
currpage = HFA384x_USB_MKPAGE(pdaloc[i].cardaddr);
|
||||
curroffset = HFA384x_USB_MKOFF(pdaloc[i].cardaddr);
|
||||
|
||||
result = hfa384x_dormem(hw, DOWAIT,
|
||||
currpage,
|
||||
curroffset,
|
||||
buf,
|
||||
len, /* units of bytes */
|
||||
NULL, NULL);
|
||||
|
||||
if (result) {
|
||||
WLAN_LOG_WARNING1(__FUNCTION__
|
||||
": Read from index %d failed, continuing\n",
|
||||
i );
|
||||
if ( i >= (sizeof(pdaloc)/sizeof(pdaloc[0])) ){
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Test for garbage */
|
||||
pdaok = 1; /* intially assume good */
|
||||
morepdrs = 1;
|
||||
|
@ -2577,7 +2776,8 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
|
|||
}
|
||||
}
|
||||
if ( pdaok ) {
|
||||
WLAN_LOG_DEBUG2(2,"PDA Read from 0x%8lx in %s space.\n",
|
||||
WLAN_LOG_DEBUG2(2,
|
||||
"PDA Read from 0x%08lx in %s space.\n",
|
||||
pdaloc[i].cardaddr,
|
||||
pdaloc[i].auxctl == 0 ? "EXTDS" :
|
||||
pdaloc[i].auxctl == 1 ? "NV" :
|
||||
|
@ -2593,12 +2793,8 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
|
|||
WLAN_LOG_DEBUG0(3,"Failure: pda is not okay\n");
|
||||
}
|
||||
|
||||
hfa384x_cmd_aux_disable(hw);
|
||||
failed:
|
||||
DBFEXIT;
|
||||
return result;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3673,8 +3869,17 @@ void hfa384x_usbin_ctlx(wlandevice_t *wlandev, struct urb *urb)
|
|||
ctlx = hw->ctlxq.head;
|
||||
switch ( ctlx->state ) {
|
||||
case HFA384x_USBCTLX_REQ_SUBMITTED:
|
||||
/* Stop the intimer */
|
||||
del_timer(&hw->ctlxq.head->resptimer);
|
||||
|
||||
/* Set the state to CTLX_RESP_RECEIVED */
|
||||
ctlx->state = HFA384x_USBCTLX_RESP_RECEIVED;
|
||||
|
||||
/* Copy the URB and buffer to ctlx */
|
||||
memcpy(&ctlx->inurb, urb, sizeof(*urb));
|
||||
memcpy(&ctlx->inbuf, usbin, sizeof(*usbin));
|
||||
|
||||
/* Let the machine continue running. */
|
||||
break;
|
||||
|
||||
case HFA384x_USBCTLX_REQ_COMPLETE:
|
||||
|
|
|
@ -960,7 +960,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp)
|
|||
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID,
|
||||
bytebuf, HFA384x_RID_CNFOWNSSID_LEN);
|
||||
if ( result ) {
|
||||
WLAN_LOG_ERROR0("Failed to set SSID\n");
|
||||
WLAN_LOG_ERROR1(__FUNCTION__
|
||||
": Failed to set SSID, result=0x%04x\n", result);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
|
|
|
@ -992,7 +992,6 @@ int prism2sta_initmac(wlandevice_t *wlandev)
|
|||
goto failed;
|
||||
}
|
||||
|
||||
#if (WLAN_HOSTIF != WLAN_USB)
|
||||
/* Read the PDA */
|
||||
result = hfa384x_drvr_readpda(hw, priv->pda, HFA384x_PDA_LEN_MAX);
|
||||
|
||||
|
@ -1000,7 +999,6 @@ int prism2sta_initmac(wlandevice_t *wlandev)
|
|||
WLAN_LOG_DEBUG0(2,"drvr_readpda() failed\n");
|
||||
goto failed;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Collect version and compatibility info */
|
||||
/* Some are critical, some are not */
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
#define HFA384x_AUX_CTL_PHY (0x02)
|
||||
#define HFA384x_AUX_CTL_ICSRAM (0x03)
|
||||
|
||||
#define HFA384x_AUX_PAGE_MASK (0x003fff80)
|
||||
#define HFA384x_AUX_PAGE_MASK (0x007fff80)
|
||||
#define HFA384x_AUX_OFF_MASK (0x0000007f)
|
||||
#define HFA384x_AUX_OFF_MAX ((UINT16)0x007f)
|
||||
#define HFA384x_AUX_PAGE_MAX ((UINT16)0xffff)
|
||||
|
@ -1763,6 +1763,10 @@ typedef struct hfa384x_InfFrame
|
|||
/*--------------------------------------------------------------------
|
||||
USB Packet structures and constants.
|
||||
--------------------------------------------------------------------*/
|
||||
|
||||
#define HFA384x_USB_MKOFF(n) ((UINT16)((n)&0x0000ffffUL))
|
||||
#define HFA384x_USB_MKPAGE(n) ((UINT16)((n)>>16))
|
||||
|
||||
/* Should be sent to the ctrlout endpoint */
|
||||
#define HFA384x_USB_ENBULKIN 6
|
||||
|
||||
|
@ -1831,7 +1835,7 @@ typedef struct hfa384x_usb_rmemreq {
|
|||
UINT16 frmlen __WLAN_ATTRIB_PACK__;
|
||||
UINT16 offset __WLAN_ATTRIB_PACK__;
|
||||
UINT16 page __WLAN_ATTRIB_PACK__;
|
||||
UINT8 pad[58] __WLAN_ATTRIB_PACK__;
|
||||
UINT8 pad[56] __WLAN_ATTRIB_PACK__;
|
||||
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemreq_t;
|
||||
|
||||
/*------------------------------------*/
|
||||
|
@ -2270,6 +2274,7 @@ typedef struct hfa384x
|
|||
hfa384x_usbin_t rxbuff;
|
||||
hfa384x_usbout_t txbuff;
|
||||
UINT16 intbuff[4];
|
||||
int rxurb_posted;
|
||||
|
||||
hfa384x_usbctlxq_t ctlxq;
|
||||
|
||||
|
|
Loading…
Reference in New Issue