阅读:982回复:0
关于isp1362 suspend的问题,若能解决问题300分相送
本人正在调LINUX下ISP1362的suspend,可是芯片总是不能挂起:(
程序的流程是参照ISP1362的datesheet中的11.2节和12.5.1节写的,不知到有哪位大侠做过,交流一下. suspend的程序如下,有事没事尽管说吧,给点建议,我已经到了山穷水尽的地步了:-) static int isp1362_hal_suspend ( ) { struct isp1362_dev *loc_dev; static volatile unsigned long reg_data=0; printk(\"--<%s>:%s--%s\\n\\n\",__FILE__,__FUNCTION__,__TIME__); /* * Suspend HC * refenced to the 11.2 \"USB traffic generation\" of the ISP1362 datasheet * after it is in Operation mode ,I can set it to suspend mode */ loc_dev = &(isp1362_loc_dev[ISP1362_HC]); /* * Step 1: * Reset the Host controller * This is refereced to isp1362_hal_probe function */ printk(\"HC software reset\\n\"); isp1362_reg_write16(loc_dev, (HC_SW_RESET_REG|0x80), 0x00F6); isp1362_mdelay(100); /* * Step 2: * Doesn\'t need */ /* * Step 3: * enable all the interrupt events * to trigger the hardware interrupt */ printk(\"Now enable all the interrupt events.\\n\"); isp1362_reg_write32(loc_dev, (HC_INT_EN_REG|0x80), 0x800000FD); mdelay(3); isp1362_reg_read32(loc_dev,HC_INT_EN_REG,reg_data); printk(\"read:HC_INT_EN_REG=0x%x\\n\",reg_data); /* * Step 4: * Set the bit GlobalPowerDown (bit 14) to swith off OTG ATX * set up the HC to level triggered and active HIGH interrupt */ isp1362_reg_write16(loc_dev, (HC_HW_CNFG_REG|0x80), 0x402D); mdelay(3); isp1362_reg_read16(loc_dev,HC_HW_CNFG_REG,reg_data); printk(\"read:HC_HW_CNFG_REG=0x%x\\n\",reg_data); /* * Step 5: * set the ISP1362 into the Operation mode */ isp1362_reg_write32(loc_dev, (HC_CONTROL_REG|0x80), 0x0680); mdelay(3); isp1362_reg_read32(loc_dev,HC_CONTROL_REG,reg_data); printk(\"read:HC_CONTROL_REG=0x%x\\n\",reg_data); /* * Since it is in Operation mode * we can write 0x06c0 to the HcControl register,and then * the ISP1362 will enter into the Suspend mode */ isp1362_reg_write32(loc_dev, (HC_CONTROL_REG|0x80), 0x06C0); mdelay(3); isp1362_reg_read32(loc_dev,HC_CONTROL_REG,reg_data); printk(\"read:HC_CONTROL_REG=0x%x\\n\\n\",reg_data); /**************************************************************/ /* * Suspend DC * refence to the 12.5.1 of ISP1362 datasheet */ loc_dev = &(isp1362_loc_dev[ISP1362_DC]); /* * Rest the DC.Assume 10 msec are enough */ printk(\"DC software reset\\n\"); isp1362_command(DC_SW_RESET_REG,loc_dev); isp1362_mdelay(10); /* * Step 1: * set the IESUSP of the DcInterruptEnable register * DC_INT_EN_REG-1:write, * DC_INT_EN_REG :read */ printk(\"Now set the IESUSP of the DcInterruptEnable register.\\n\"); isp1362_reg_write32(loc_dev, (DC_INT_EN_REG - 1), 0x0004); mdelay(3); isp1362_reg_read32(loc_dev,DC_INT_EN_REG,reg_data); printk(\"read:DC_INT_EN_REG=0x%x\\n\",reg_data); /* * Step 2: * Does we need this step???? */ /* * Step 3: * check the current status of the USB bus. */ do { isp1362_reg_read32(loc_dev,DC_INT_REG, reg_data); reg_data &= 0x80; printk(\"--check the current status of the USB bus.\\n\"); printk(\"--read:DC_INT_REG=0x%x\\n\",reg_data); }while (reg_data != 0x0080); /* * Step 4: * clear bit CLKRUN of the DcHardwareConfiguration register * to switch off the internal clocks. * DC_HW_CNFG_REG-1:write * DC_HW_CNFG_REG :read */ isp1362_reg_write16(loc_dev,(DC_HW_CNFG_REG-1),0x0344); mdelay(3); isp1362_reg_read16(loc_dev,DC_HW_CNFG_REG,reg_data); printk(\"read:DC_HW_CNFG_REG=0x%x\\n\",reg_data); /* * Step 4: * Write logic 1 followed by logic 0 of the GOSUSP bit * in DcMode register to activate the \'suspend\' mode. * DC_MODE_REG-1:write * DC_MODE_REG :read */ isp1362_reg_write16(loc_dev,(DC_MODE_REG-1),0xA0); mdelay(3); isp1362_reg_read16(loc_dev,DC_MODE_REG,reg_data); printk(\"read:DC_MODE_REG=0x%x\\n\",reg_data); isp1362_reg_write16(loc_dev,(DC_MODE_REG-1),0x80); mdelay(3); isp1362_reg_read16(loc_dev,DC_MODE_REG,reg_data); printk(\"read:DC_MODE_REG=0x%x\\n\",reg_data); return 0; } /* End of isp1362_hal_suspend */ [编辑 - 7/14/03 by magod] |
|