diff options
author | Sivasankari <Sivasankari.muthusamy@st.com> | 2019-08-13 11:29:53 +0800 |
---|---|---|
committer | Sivasankari <Sivasankari.muthusamy@st.com> | 2019-09-04 18:07:14 +0800 |
commit | 1546e17155d3a6dadba6ab132a80e41a17960388 (patch) | |
tree | 4ab3a9aa565986ed36f587eb0a6604ec41391230 | |
parent | 13f68731a3778d2ec7abd4b2075d8f452ef87adf (diff) | |
download | fts_touch_s5-1546e17155d3a6dadba6ab132a80e41a17960388.tar.gz |
input: touchscreen: stm: Driver Version 5.2.16.9
Added Support for B5/S5 projects, update in the Dchip id, Change in the DMA chunk size
Added Support for Flash organization change
FW API update for Echo Status event, firmware Event truncated to 4 bytes,
Signed-off-by: Sivasankari <Sivasankari.muthusamy@st.com>
Change-Id: I50909b4966b6190f6fd2549564276902fe3bf131
-rw-r--r-- | fts.h | 4 | ||||
-rw-r--r-- | fts_lib/ftsCore.c | 6 | ||||
-rw-r--r-- | fts_lib/ftsFlash.c | 86 | ||||
-rw-r--r-- | fts_lib/ftsFlash.h | 30 | ||||
-rw-r--r-- | fts_lib/ftsHardware.h | 7 | ||||
-rw-r--r-- | fts_proc.c | 11 |
6 files changed, 126 insertions, 18 deletions
@@ -52,9 +52,9 @@ */ /* **** CODE CONFIGURATION **** */ #define FTS_TS_DRV_NAME "fts" /* driver name */ -#define FTS_TS_DRV_VERSION "5.2.16.8" /* driver version string +#define FTS_TS_DRV_VERSION "5.2.16.9" /* driver version string * */ -#define FTS_TS_DRV_VER 0x05021008 /* driver version u32 format */ +#define FTS_TS_DRV_VER 0x05021009 /* driver version u32 format */ /* #define DEBUG */ /* /< define to print more logs in the kernel log * and better follow the code flow */ diff --git a/fts_lib/ftsCore.c b/fts_lib/ftsCore.c index b8d0af1..81582a9 100644 --- a/fts_lib/ftsCore.c +++ b/fts_lib/ftsCore.c @@ -307,10 +307,10 @@ int checkEcho(u8 *cmd, int size) pr_err("checkEcho: Error Size = %d not valid!\n", size); return ERROR_OP_NOT_ALLOW; } else { - if ((size + 3) > FIFO_EVENT_SIZE) - size = FIFO_EVENT_SIZE - 3; + if ((size + 4) > FIFO_EVENT_SIZE) + size = FIFO_EVENT_SIZE - 4; /* Echo event 0x43 0x01 xx xx xx xx xx fifo_status - * therefore command with more than 5 bytes will be trunked */ + * therefore command with more than 4 bytes will be trunked */ event_to_search[0] = EVT_ID_STATUS_UPDATE; event_to_search[1] = EVT_TYPE_STATUS_ECHO; diff --git a/fts_lib/ftsFlash.c b/fts_lib/ftsFlash.c index 270b9aa..a25e460 100644 --- a/fts_lib/ftsFlash.c +++ b/fts_lib/ftsFlash.c @@ -488,6 +488,43 @@ int parseBinFile(u8 *fw_data, int fw_size, Firmware *fwData, int keep_cx) pr_info("parseBinFile: CX Version = %04X\n", fwData->cx_ver); fwData->data_size = dimension; + index = FLASH_ORG_INFO_INDEX; + fwData->fw_code_size = fw_data[index++]; + fwData->panel_config_size = fw_data[index++]; + fwData->cx_area_size = fw_data[index++]; + fwData->fw_config_size = fw_data[index]; + + pr_info("parseBinFile: Code Pages: %d panel area Pages: %d" + " cx area Pages: %d fw config Pages: %d !\n", + fwData->fw_code_size, fwData->panel_config_size, + fwData->cx_area_size, fwData->fw_config_size); + + if ((fwData->fw_code_size == 0) || + (fwData->panel_config_size == 0) || + (fwData->cx_area_size == 0) || + (fwData->fw_config_size == 0)) { + pr_info("parseBinFile: Using default flash Address\n"); + fwData->code_start_addr = FLASH_ADDR_CODE; + fwData->cx_start_addr = FLASH_ADDR_CX; + fwData->config_start_addr = FLASH_ADDR_CONFIG; + } else { + fwData->code_start_addr = FLASH_ADDR_CODE; + fwData->cx_start_addr = (FLASH_ADDR_CODE + + (((fwData->fw_code_size + + fwData->panel_config_size) * + FLASH_PAGE_SIZE) / 4)); + fwData->config_start_addr = (FLASH_ADDR_CODE + + (((fwData->fw_code_size + + fwData->panel_config_size + + fwData->cx_area_size) * + FLASH_PAGE_SIZE) / 4)); + } + + pr_info("parseBinFile: Code start addr: 0x%08X" + " cx start addr: 0x%08X" + " fw start addr: 0x%08X !\n", + fwData->code_start_addr, fwData->cx_start_addr, + fwData->config_start_addr); pr_info("READ FW DONE %d bytes!\n", fwData->data_size); res = OK; @@ -623,9 +660,15 @@ int flash_full_erase(void) * be deleted * @return OK if success or an error code which specify the type of error */ -int flash_erase_page_by_page(ErasePage keep_cx) +int flash_erase_page_by_page(ErasePage keep_cx, Firmware *fw) { u8 status, i = 0; + + u8 flash_cx_start_page = FLASH_CX_PAGE_START; + u8 flash_cx_end_page = FLASH_CX_PAGE_END; + u8 flash_panel_start_page = FLASH_PANEL_PAGE_START; + u8 flash_panel_end_page = FLASH_PANEL_PAGE_END; + u8 cmd1[6] = { FTS_CMD_HW_REG_W, 0x20, 0x00, 0x00, FLASH_ERASE_CODE0 + 1, 0x00 }; u8 cmd[6] = { FTS_CMD_HW_REG_W, 0x20, 0x00, 0x00, FLASH_ERASE_CODE0, @@ -639,14 +682,39 @@ int flash_erase_page_by_page(ErasePage keep_cx) int buff_len = sizeof(buff); int index = 0; - for (i = FLASH_CX_PAGE_START; i <= FLASH_CX_PAGE_END && keep_cx >= + if ((fw->fw_code_size == 0) || + (fw->panel_config_size == 0) || + (fw->cx_area_size == 0) || (fw->fw_config_size == 0)) { + pr_info(" using default page address!\n"); + } else { + flash_panel_start_page = fw->fw_code_size; + if (fw->panel_config_size > 1) + flash_panel_end_page = flash_panel_start_page + + (fw->panel_config_size - 1); + else + flash_panel_end_page = flash_panel_start_page; + + flash_cx_start_page = flash_panel_end_page + 1; + if (fw->cx_area_size > 1) + flash_cx_end_page = flash_cx_start_page + + (fw->cx_area_size - 1); + else + flash_cx_end_page = flash_cx_start_page; + } + + pr_info(" CX Start page: %d CX end page: %d Panel Start Page: %d" + "Panel End page: %d!\n", flash_cx_start_page, + flash_cx_end_page, flash_panel_start_page, + flash_panel_end_page); + + for (i = flash_cx_start_page; i <= flash_cx_end_page && keep_cx >= SKIP_PANEL_CX_INIT; i++) { pr_info("Skipping erase CX page %d!\n", i); fromIDtoMask(i, mask, 4); } - for (i = FLASH_PANEL_PAGE_START; i <= FLASH_PANEL_PAGE_END && keep_cx >= + for (i = flash_panel_start_page; i <= flash_panel_end_page && keep_cx >= SKIP_PANEL_INIT; i++) { pr_info("Skipping erase Panel Init page %d!\n", i); fromIDtoMask(i, mask, 4); @@ -963,11 +1031,11 @@ start: pr_info(" 6) FLASH ERASE:\n"); if (keep_cx > 0) { if (fw.sec2_size != 0 && force_burn == CRC_CX) - res = flash_erase_page_by_page(SKIP_PANEL_INIT); + res = flash_erase_page_by_page(SKIP_PANEL_INIT, &fw); else - res = flash_erase_page_by_page(SKIP_PANEL_CX_INIT); + res = flash_erase_page_by_page(SKIP_PANEL_CX_INIT, &fw); } else { - res = flash_erase_page_by_page(SKIP_PANEL_INIT); + res = flash_erase_page_by_page(SKIP_PANEL_INIT, &fw); if (fw.sec2_size == 0) pr_err("WARNING!!! Erasing CX memory but no CX in fw file! touch will not work right after fw update!\n"); } @@ -980,7 +1048,7 @@ start: pr_info(" flash erase COMPLETED!\n\n"); pr_info(" 7) LOAD PROGRAM:\n"); - res = fillFlash(FLASH_ADDR_CODE, &fw.data[0], fw.sec0_size); + res = fillFlash(fw.code_start_addr, &fw.data[0], fw.sec0_size); if (res < OK) { pr_err(" load program ERROR %08X\n", ERROR_FLASH_BURN_FAILED); @@ -989,7 +1057,7 @@ start: pr_info(" load program DONE!\n"); pr_info(" 8) LOAD CONFIG:\n"); - res = fillFlash(FLASH_ADDR_CONFIG, &(fw.data[fw.sec0_size]), + res = fillFlash(fw.config_start_addr, &(fw.data[fw.sec0_size]), fw.sec1_size); if (res < OK) { pr_err(" load config ERROR %08X\n", @@ -1000,7 +1068,7 @@ start: if (fw.sec2_size != 0 && (force_burn == CRC_CX || keep_cx <= 0)) { pr_info(" 8.1) LOAD CX:\n"); - res = fillFlash(FLASH_ADDR_CX, + res = fillFlash(fw.cx_start_addr, &(fw.data[fw.sec0_size + fw.sec1_size]), fw.sec2_size); if (res < OK) { diff --git a/fts_lib/ftsFlash.h b/fts_lib/ftsFlash.h index 6bdc99d..2a52c53 100644 --- a/fts_lib/ftsFlash.h +++ b/fts_lib/ftsFlash.h @@ -50,12 +50,25 @@ #define PATH_FILE_FW "ftm5_fw.ftb" /* new FW bin file name */ #endif +#ifdef ALIX +#define FLASH_CHUNK (32 * 1024) /* /< Max number of bytes that + * the + * DMA can burn on flash in + *one shot in FTI */ +#else #define FLASH_CHUNK (64 * 1024) /* /< Max number of bytes that - * the DMA can burn on the flash - * in one shot in FTI */ + * the + * DMA can burn on flash in + *one shot in FTI */ +#endif + #define DMA_CHUNK 32 /* /< Max number of bytes that can be * written in I2C to the DMA */ +#define FLASH_ORG_INFO_INDEX 280 + +#define FLASH_PAGE_SIZE (4 * 1024) //page size of 4KB + /** * Define which kind of erase page by page should be performed */ @@ -87,6 +100,17 @@ typedef struct { u32 sec1_size; /* /< dimension of section 1 (Config) in .ftb file */ u32 sec2_size; /* /< dimension of section 2 (Cx) in .ftb file */ u32 sec3_size; /* /< dimension of section 3 (TBD) in .ftb file */ + u8 fw_code_size; /* /< size of fw code in pages in + .ftb file */ + u8 panel_config_size;/* /< size of panel area in pages in + .ftb file */ + u8 cx_area_size;/* /< size of cx area in pages in + .ftb file */ + u8 fw_config_size;/* /< size of fw config in pages in + .ftb file */ + u32 code_start_addr; /* start addr for fw code */ + u32 cx_start_addr; /* start addr for cx area */ + u32 config_start_addr; /* start addr for config area */ } Firmware; /** @}*/ @@ -99,7 +123,7 @@ int wait_for_flash_ready(u8 type); int hold_m3(void); int flash_erase_unlock(void); int flash_full_erase(void); -int flash_erase_page_by_page(ErasePage keep_cx); +int flash_erase_page_by_page(ErasePage keep_cx, Firmware *fw); int start_flash_dma(void); int fillFlash(u32 address, u8 *data, int size); diff --git a/fts_lib/ftsHardware.h b/fts_lib/ftsHardware.h index 1edfed9..7c94cbc 100644 --- a/fts_lib/ftsHardware.h +++ b/fts_lib/ftsHardware.h @@ -23,8 +23,15 @@ #define FTS_HARDWARE_H /* DIGITAL CHIP INFO */ +#define ALIX + +#ifdef ALIX +#define DCHIP_ID_0 0x36 /* /< LSB chip ID for FTM5 */ +#define DCHIP_ID_1 0x48 /* /< MSB chip ID for FTM5 */ +#else #define DCHIP_ID_0 0x36 /* /< LSB chip ID for FTM5 */ #define DCHIP_ID_1 0x39 /* /< MSB chip ID for FTM5 */ +#endif #define DCHIP_FW_VER_BYTE 2 /* /< number of bytes of the fw * versions */ @@ -1967,13 +1967,22 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, case CMD_FLASHERASEPAGE: if (numberParam == 2) { /* need to pass: keep_cx */ + pr_info("Reading FW File...\n"); + res = readFwFile(info->board->fw_name, &fw, + funcToTest[1]); + if (res < OK) + pr_err("Error reading FW File ERROR" + "%08X\n", res); + else + pr_info("Read FW File Finished!\n"); pr_info("Starting Flashing Page Erase...\n"); - res = flash_erase_page_by_page(cmd[1]); + res = flash_erase_page_by_page(cmd[1], &fw); if (res < OK) pr_err("Error during flash page erase... ERROR %08X\n", res); else pr_info("Flash Page Erase Finished!\n"); + kfree(fw.data); } else { pr_err("Wrong number of parameters!\n"); res = ERROR_OP_NOT_ALLOW; |