All pastes #29195 Raw Edit

Something

public text v1 · immutable
#29195 ·published 2005-11-19 06:46 UTC
rendered paste body
int zd1211_ChangeToFlashAble(struct zd1205_private *macp)
{
        u32 tmpvalue;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8))
	const struct firmware *fw_entry;
        char* data;
        unsigned long len;
        char *fw_file;
        int ret;
#endif

        if (!macp->bFlashable)
        {
                int	LoadRet;

                zd_writel(0x01, FW_SOFT_RESET);

                macp->bDisableTx = 1;
                //USB_StopTxEP(macp);

                macp->bAllowAccessRegister = 0;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8))
        	fw_file = ZD_FIRMWARE_IMAGE_WS11UPhm;
        	ret = request_firmware(&fw_entry, fw_file, &macp->usb->dev);
       	 	if (ret) {
         	       printk(KERN_ERR "Failed to load %s firmware file!\n", fw_file);
         	       printk(KERN_ERR "Make sure the hotplug firmware loader is installed.\n");
         	       return ret;
        	}

        	data = fw_entry->data;
        	len = fw_entry->size;
        
        	printk(KERN_ERR "Got firmware %s\n", fw_file);
	        printk(KERN_ERR "length %d\n", len);
	
		ret = zd1211_LoadUSBSpecCode(macp, data, len, cFIRMWARE_START_ADDR, true);
#else
                LoadRet = zd1211_LoadUSBSpecCode(macp, WS11UPhm, sizeof(WS11UPhm), cFIRMWARE_START_ADDR, true);
#endif
                if (LoadRet) {
                        FPRINT("Load WS11UPhm fail");
                        return 1;
                }

                ZD1211DEBUG(0, "Load WS11UPhm Done\n");

                //macp->bAllowAccessRegister = 1;
                macp->bFlashable = 1;

#if fWRITE_WORD_REG || fREAD_MUL_REG
                // Must get this information before any register write
                tmpvalue = zd1211_readl(cADDR_ENTRY_TABLE, FALSE);
                macp->AddrEntryTable = (u16) tmpvalue;
#endif

        }

        return 0;
}
#endif