From 64291860c6d7c335fef77fe851ee9b0a53ec2729 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 12:04:39 +0900 Subject: [PATCH] thor: remove build warnings Remove build warnings in usb thor. Change-Id: I210e0ec1780776d53e74ccb202b14aadc99d96ba Signed-off-by: Seung-Woo Kim --- property/thor_mode.c | 22 ++++++++--- property/usb/cdc_descriptor.c | 4 +- property/usb/drv_cdc.c | 89 +++++++++++++++++++++---------------------- property/usb/usb_hw.c | 3 +- 4 files changed, 63 insertions(+), 55 deletions(-) diff --git a/property/thor_mode.c b/property/thor_mode.c index 6e3a104..4c2a187 100644 --- a/property/thor_mode.c +++ b/property/thor_mode.c @@ -9,6 +9,7 @@ #include "../drivers/mmc/card_sdio.h" #include "thor_mode.h" #include "tizen_misc.h" +#include "calibration_detect.h" #ifdef THOR_DEBUG #define thor_debug(fmt, arg...) printf(fmt, ## arg) @@ -33,6 +34,15 @@ static u32 download_addr = CONFIG_THOR_TRANSFER_BUFFER; struct thor_part_info part_info; static char f_name[F_NAME_BUF_SIZE]; +extern void MMU_DisableIDCM(void); +extern void draw_progress(int per); +extern int32 USB_WriteEx(uint8 *pBuf,uint32 len); +extern int USB_ReadEx(unsigned char *pBuf, int len); +extern void thor_USB_Init(void); +extern int thor_usb_is_connected(void); +extern unsigned int thor_get_part_info(struct thor_part_info *part_info, const char *name); +extern int thor_save_env(char *str); + static void thor_clear_part_info(void) { part_info.offset = 0; @@ -72,7 +82,6 @@ static int download_file_start(void) unsigned int write_ofs = 0; int ret; - int count = 0; int download_done = 0; int usb_pkt_cnt = 0; int per = 0; @@ -81,7 +90,7 @@ static int download_file_start(void) while (!download_done) { dn_addr = download_addr + buffered; - ret = USB_ReadEx((char *) dn_addr, THOR_PACKET_SIZE); + ret = USB_ReadEx((unsigned char *) dn_addr, THOR_PACKET_SIZE); if (ret <= 0) return ret; buffered += ret; @@ -118,7 +127,7 @@ static int download_file_start(void) return -EINVAL; } #endif - ret = Emmc_Write(PARTITION_USER, part_info.offset + write_ofs, count, download_addr); + ret = Emmc_Write(PARTITION_USER, part_info.offset + write_ofs, count, (uint8 *)download_addr); if (!ret) return -EIO; @@ -136,7 +145,6 @@ static int download_file_start(void) static long long int process_rqt_download(const struct rqt_box *rqt) { struct rsp_box *rsp = &rsp_buf; - static long long int left, ret_head; int file_type, ret = 0; memset(rsp, 0, sizeof(struct rsp_box)); @@ -305,9 +313,9 @@ retry: while (1) { if (thor_usb_is_connected()) { ret = USB_ReadEx(thor_rx_data_buf, strlen("THOR")); - if (!strncmp(thor_rx_data_buf, "THOR", strlen("THOR"))) + if (!strncmp((char *)thor_rx_data_buf, "THOR", strlen("THOR"))) { - USB_WriteEx("ROHT", strlen("ROHT")); + USB_WriteEx((uint8 *)"ROHT", strlen("ROHT")); goto retry; } ret = USB_ReadEx(thor_rx_data_buf + strlen("THOR"), sizeof(thor_rx_data_buf) - strlen("THOR")); @@ -347,6 +355,8 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) puts("TIZEN \"THOR\" Downloader\n"); thor_mode(); + + return 0; } U_BOOT_CMD(thordown, 1, 1, do_thor_down, diff --git a/property/usb/cdc_descriptor.c b/property/usb/cdc_descriptor.c index 25db750..bf27148 100644 --- a/property/usb/cdc_descriptor.c +++ b/property/usb/cdc_descriptor.c @@ -1,7 +1,9 @@ #include #include #include +#include #include +#include #define THOR_VENDOR_NUM 0x04E8 #define THOR_PRODUCT_NUM 0x685D @@ -233,8 +235,6 @@ static struct usb_qualifier_descriptor thor_dev_qualifier_desc __align(32) = { .bRESERVED = 0x00, }; -static char thor_device_qualifer_desc_buf[sizeof(struct usb_qualifier_descriptor)] __align(32); - unsigned char g_USB_Other_Speed_ConfigDescr[] __align(32) = { 0x09,0x07,0x43,0x00,0x02,0x01,0x00,0xC0, diff --git a/property/usb/drv_cdc.c b/property/usb/drv_cdc.c index 0b726a7..b18a0d6 100644 --- a/property/usb/drv_cdc.c +++ b/property/usb/drv_cdc.c @@ -44,6 +44,12 @@ int length; int check_usb_reconnected = 0; extern void usb_power_on(void); +extern void usb_power_off(void); +extern unsigned char *thor_get_device_desc(unsigned int speed); +extern unsigned char *thor_get_config_desc(unsigned int speed); +extern unsigned char *thor_get_string_desc(unsigned char index); +extern unsigned char *thor_get_qualifer_desc(void); +extern unsigned char *thor_get_other_speed_config_desc(void); extern void Dcache_InvalRegion(unsigned int addr, unsigned int length); extern void Dcache_CleanRegion(unsigned int addr, unsigned int length); @@ -384,15 +390,10 @@ LOCAL void usb_reset_pipe(uint8 epno) /*****************************************************************************/ PUBLIC void usb_set_feature (void) { - volatile USB_DCFG_U *dcfg_ptr = (volatile USB_DCFG_U *) USB_DCFG; volatile USB_DCTL_U *dctl_ptr = (volatile USB_DCTL_U *) USB_DCTL; - USB_REQUEST_1_U *request1; USB_REQUEST_2_U *request2; - USB_REQUEST_1_U request1_u; USB_REQUEST_2_U request2_u; - request1_u.dwValue = s_setup_packet[0]; request2_u.dwValue = s_setup_packet[1]; - request1= &request1_u; request2= &request2_u; EPI0_config (0x0, 0x1, FALSE, NULL); @@ -786,8 +787,6 @@ static void usb_handler (void) { volatile USB_INTSTS_U *usb_int_ptr = (USB_INTSTS_U *) USB_GINTSTS; volatile USB_INTSTS_U usb_int; - uint32 i=0; - char string[64] ={0,}; usb_int.dwValue = usb_int_ptr->dwValue; // in endpoint interrupt @@ -834,7 +833,6 @@ static int32 USB_ReadEx_Internal(uint8 *pBuf,uint32 len) { volatile USB_DOEPINT_U *doepint_ptr = (USB_DOEPINT_U *) USB_DOEPINT (EP_OUT); volatile USB_DOEPTSIZ_U *doeptsiz_ptr = (USB_DOEPTSIZ_U *) USB_DOEPTSIZ (EP_OUT); - int i; if(recv_length == 0) { @@ -1017,11 +1015,47 @@ LOCAL void usb_core_init (void) // Note: /*****************************************************************************/ +__align(64) unsigned char sprd_thor_setup_buf[512] = {0,}; + +static int s_usb_connected = 0; + +extern int thor_handle(void); + +void sprd_usb_thor_start(void) +{ + g_usb_status = USB_STARTED; + + do { + if (s_usb_connected == 0) { + USB_ReadEx_Internal(sprd_thor_setup_buf, sizeof(sprd_thor_setup_buf)); + + if (g_usb_status == USB_DETACHED_AFTER_USB_MODE_START) + return; + + if (!strncmp((char *)sprd_thor_setup_buf, "THOR", strlen("THOR"))) + { + usb_debug("- thor is connected!\n"); + USB_WriteEx((uint8 *)"ROHT", strlen("ROHT")); + usb_debug("thor Setup Complete\n"); + s_usb_connected = 1; + break; + } else{ + usb_debug("thor_seup error - Not receiving THOR\n"); + s_usb_connected = 0; + } + } + } while(1); + + thor_handle(); + + usb_debug("%s : exit \n", __func__); + return; +} + /* Enter point */ void thor_USB_Init(void) { usb_debug("%s : enter\n", __func__); - unsigned int len = 0; usb_power_on(); usb_core_init(); @@ -1045,10 +1079,6 @@ void USB_DeInit (void) usb_power_off(); } -__align(64) unsigned char sprd_thor_setup_buf[512] = {0,}; - -static int s_usb_connected = 0; - /************************************************ * * Register call back function for v3_protocol. @@ -1064,39 +1094,6 @@ void sprd_usb_cb_register(void) } #endif -extern int thor_handle(void); - -void sprd_usb_thor_start() -{ - g_usb_status = USB_STARTED; - - do { - if (s_usb_connected == 0) { - USB_ReadEx_Internal(sprd_thor_setup_buf, sizeof(sprd_thor_setup_buf)); - - if (g_usb_status == USB_DETACHED_AFTER_USB_MODE_START) - return -1; - - if (!strncmp(sprd_thor_setup_buf, "THOR", strlen("THOR"))) - { - usb_debug("- thor is connected!\n"); - USB_WriteEx("ROHT", strlen("ROHT")); - usb_debug("thor Setup Complete\n"); - s_usb_connected = 1; - break; - } else{ - usb_debug("thor_seup error - Not receiving THOR\n"); - s_usb_connected = 0; - } - } - } while(1); - - thor_handle(); - - usb_debug("%s : exit \n", __func__); - return 0; -} - void disconnect_usb(void) { s_usb_connected = 0; diff --git a/property/usb/usb_hw.c b/property/usb/usb_hw.c index 00bf610..3d948c3 100644 --- a/property/usb/usb_hw.c +++ b/property/usb/usb_hw.c @@ -51,6 +51,7 @@ usb_hw.c #define mdelay(_ms) udelay(_ms*1000) +#if 0 static void ADIConfig(void) { *(volatile uint32 *)GR_GEN0 |= ADI_EB; @@ -101,6 +102,7 @@ static unsigned int ADIAnalogdieRegWrite(unsigned long addr,uint16 data) *(uint32 *) addr = data; return 0; } +#endif static void USBLdoEnable(unsigned char is_usb_lod_enabled) { @@ -129,7 +131,6 @@ static void usb_enable_module(int en) void usb_power_on(void) { printf("%s : enter\n", __func__); - int ret =0; *(volatile uint32 *) USB_PHY_CTRL = 0x4407ae33; -- 2.7.4