int firm_update( void ) { int ret_val =0; printk(KERN_INFO "[TSP] %s, %d\n", __func__, __LINE__); printk("[TSP] disable_irq : %d\n", __LINE__ ); disable_irq(ts_global->client->irq); #ifdef TOUCH_VERIFY_WITH_TIMER if(board_hw_revision >= 0x3) { cancel_delayed_work_sync(&ts_global->work_check_ic); } #endif // TEST printk("[TSP] TMO %s:%d, ver SW=%x, HW=%x\n", __func__,__LINE__, SW_ver, HW_ver ); // gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); if(board_hw_revision == 0x3) { printk(KERN_INFO "[TSP] %s, %d cypress_update blocked, HW ver=%d\n", __func__, __LINE__, HW_ver); firmware_ret_val = cypress_update( 3 ); //temporary firmware update } else if(board_hw_revision >= 0x4) { printk(KERN_INFO "[TSP] %s, %d cypress_update blocked, HW ver=%d\n", __func__, __LINE__, HW_ver); firmware_ret_val = cypress_update( 4 ); //temporary firmware update } else { printk(KERN_INFO "[TSP] %s, %d cypress_update blocked, HW ver=%d\n", __func__, __LINE__, HW_ver); firmware_ret_val = cypress_update( 1 ); //temporary firmware update } msleep(1000); if( firmware_ret_val ) { printk(KERN_INFO "[TSP] %s success, %d\n", __func__, __LINE__); } else { printk(KERN_INFO "[TSP] %s fail, %d\n", __func__, __LINE__); ret_val = -1; } // gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); printk("[TSP] enable_irq : %d\n", __LINE__ ); enable_irq(ts_global->client->irq); #ifdef TOUCH_VERIFY_WITH_TIMER if(board_hw_revision >= 0x3) { schedule_delayed_work(&ts_global->work_check_ic, CHECK_TIME ); } #endif return ret_val; }
int firm_update( void ) { printk(KERN_INFO "[TSP] %s:%d, ver SW=%d, HW=%x\n", __func__, __LINE__, SW_ver, HW_ver); printk("[TSP] disable_irq : %d\n", __LINE__ ); disable_irq(ts_global->client->irq); cancel_delayed_work_sync(&ts_global->work_check_ic); //gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); firmware_ret_val = cypress_update( ((HW_ver+1)/10)+1 ); msleep(1000); if( firmware_ret_val ) printk(KERN_INFO "[TSP] %s success, %d\n", __func__, __LINE__); else printk(KERN_INFO "[TSP] %s fail, %d\n", __func__, __LINE__); //gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); printk("[TSP] enable_irq : %d\n", __LINE__ ); enable_irq(ts_global->client->irq); schedule_delayed_work(&ts_global->work_check_ic, CHECK_TIME ); return 0; }
int firm_update( void ) { printk(KERN_INFO "[TSP] %s, %d\n", __func__, __LINE__); printk("[TSP] disable_irq : %d\n", __LINE__ ); disable_irq(ts_global->client->irq); // TEST gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); if( HW_ver==1 || HW_ver==2 ) firmware_ret_val = cypress_update( HW_ver ); else { printk(KERN_INFO "[TSP] %s, %d cypress_update blocked, HW ver=%d\n", __func__, __LINE__, HW_ver); firmware_ret_val = 0; // Fail } if( firmware_ret_val ) printk(KERN_INFO "[TSP] %s success, %d\n", __func__, __LINE__); else printk(KERN_INFO "[TSP] %s fail, %d\n", __func__, __LINE__); gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); printk("[TSP] enable_irq : %d\n", __LINE__ ); enable_irq(ts_global->client->irq); return 0; }
int firm_update( void ) { uint8_t update_num; printk(KERN_INFO "[TSP] %s, %d\n", __func__, __LINE__); printk("[TSP] disable_irq : %d\n", __LINE__ ); disable_irq(ts_global->client->irq); local_irq_disable(); for(update_num = 1; update_num <= 10 ; update_num++) { sv_tch_firmware_update = cypress_update(HW_ver); if(sv_tch_firmware_update == TST200_RET_SUCCESS) { firmware_ret_val = 1; //SUCCESS printk( "[TSP] %s, %d : TST200 firmware update SUCCESS !!\n", __func__, __LINE__); break; } else { printk( "[TSP] %s, %d : TST200 firmware update RETRY !!\n", __func__, __LINE__); if(update_num == 10) { firmware_ret_val = 0; //FAIL printk( "[TSP] %s, %d : TST200 firmware update FAIL !!\n", __func__, __LINE__); } //OemSysHWReset(); /// xassert(0, sv_tch_firmware_update); } } #if 0 // TEST if( HW_ver==1 || HW_ver==2 ) //firmware_ret_val = cypress_update( HW_ver ); firmware_ret_val = 0; else { printk(KERN_INFO "[TSP] %s, %d cypress_update blocked, HW ver=%d\n", __func__, __LINE__, HW_ver); firmware_ret_val = 0; // Fail } if( firmware_ret_val ) printk(KERN_INFO "[TSP] %s success, %d\n", __func__, __LINE__); else printk(KERN_INFO "[TSP] %s fail, %d\n", __func__, __LINE__); #endif local_irq_enable(); printk("[TSP] enable_irq : %d\n", __LINE__ ); enable_irq(ts_global->client->irq); return 0; }
int main(int argc, char* argv[]) { int fd, ret; int readSize = 0; if (argc != 2) { printf("ex) TouchUpdater psoc.bin\n"); exit(1); } fd = open(argv[1], O_RDONLY); if (fd <= 0) { printf("Can't find %s\n", argv[1]); close(fd); exit(1); } pSocData = malloc(sizeof(char)*PSOCLENGTH); readSize = read(fd, pSocData, PSOCLENGTH); if(readSize != PSOCLENGTH) { printf("pSoc Read Fail\n"); close(fd); exit(1); } touch_fd = open("/dev/cypress_ts", O_RDONLY|O_NONBLOCK); if (touch_fd < 0) { printf("Device Open Error!\n"); exit(1); } //ret = ioctl(touch_fd, 0, NULL); printf("read to program psoc\n"); cypress_update(); return 0; }