From 64291860c6d7c335fef77fe851ee9b0a53ec2729 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 12:04:39 +0900 Subject: [PATCH 01/16] 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 From b8391de6395382eeca6059bd79828a9ff3aa2a0a Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 11:34:46 +0900 Subject: [PATCH 02/16] i2c: sprd: remove build warnings Remove build warnings in sprd i2c. Change-Id: I377ebe847191dac9aab922e1e9b36c0840bd8b0e Signed-off-by: Seung-Woo Kim --- drivers/i2c/i2c_hal.c | 2 +- drivers/i2c/sprd_i2c.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/i2c_hal.c b/drivers/i2c/i2c_hal.c index 9119ceb..d3b3f0e 100644 --- a/drivers/i2c/i2c_hal.c +++ b/drivers/i2c/i2c_hal.c @@ -139,12 +139,12 @@ LOCAL uint32 I2C_Bus_Init (uint32 logic_id, uint32 freq, uint32 port_id) *********************************************************************************************************/ LOCAL uint32 I2C_Bus_Exit (uint32 bus_id) { - uint32 status_val = 0; __i2c_bus[bus_id].reference = 0; /* if (NULL != __i2c_bus[bus_id].mutex) { + uint32 status_val = 0; status_val = SCI_DeleteMutex (__i2c_bus[bus_id].mutex); //SCI_PASSERT((0 != status_val),("I2C delete MUTEX fail!")); __i2c_bus[bus_id].mutex = NULL; diff --git a/drivers/i2c/sprd_i2c.c b/drivers/i2c/sprd_i2c.c index 66ad72b..3bb2be8 100644 --- a/drivers/i2c/sprd_i2c.c +++ b/drivers/i2c/sprd_i2c.c @@ -280,7 +280,7 @@ PUBLIC ERR_I2C_E I2C_Init(uint32 freq) // Note: // None /*********************************************************************/ -PUBLIC uint32 I2C_GetSCLclk() +PUBLIC uint32 I2C_GetSCLclk(void) { uint32 APB_clk,i2c_dvd,freq; @@ -467,7 +467,6 @@ PUBLIC ERR_I2C_E I2C_ReadCmd(uint8 addr,uint8 *pCmd, BOOLEAN ack_en) volatile uint32 timetick = 0; PUBLIC ERR_I2C_E I2C_WriteCmdArr(uint8 addr, uint8 *pCmd, uint32 len, BOOLEAN ack_en) { - volatile uint32 curtime = 0; volatile uint32 i = 0; volatile uint32 cmd = 0; volatile I2C_CTL_REG_T * ptr = (volatile I2C_CTL_REG_T *)I2C_BASE; -- 2.7.4 From 4c551435727c66843b60bf3cc17e2e9bb54dcfe2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 5 Mar 2012 13:47:00 +0000 Subject: [PATCH 03/16] usb: replace wait_ms() with mdelay() Common code has a mdelay() func, so use that instead of the usb-specific wait_ms() func. This also fixes the build errors: ohci-hcd.c: In function 'submit_common_msg': /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1519:9: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1816:10: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1827:10: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1844:10: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1563:11: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1583:9: sorry, unimplemented: called from here make[1]: *** [ohci-hcd.o] Error 1 Signed-off-by: Mike Frysinger Acked-by: Marek Vasut [sw0312.kim: backport the commit 5b84dd67cfd8 from mainline u-boot to fix build warning - patch of common/usb_hub.c is applied to common/usb.c because it was not divided in v2010.12] Signed-off-by: Seung-Woo Kim Change-Id: Ic383ed6d4d0531e965d7797c5ad0eb3c5145d3c4 --- arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c | 28 ++++++++++++++-------------- arch/arm/cpu/pxa/usb.c | 2 +- arch/mips/cpu/au1x00_usb_ohci.c | 28 ++++++++++++++-------------- arch/powerpc/cpu/mpc5xxx/usb_ohci.c | 6 +++--- arch/powerpc/cpu/ppc4xx/usb_ohci.c | 6 +++--- arch/sparc/cpu/leon3/usb_uhci.c | 8 ++++---- board/mcc200/auto_update.c | 4 ++-- board/mpl/common/usb_uhci.c | 8 ++++---- board/renesas/sh7785lcr/selfcheck.c | 10 ++-------- common/usb.c | 26 ++++++++------------------ common/usb_storage.c | 16 ++++++++-------- drivers/usb/host/ehci-hcd.c | 4 ++-- drivers/usb/host/isp116x-hcd.c | 12 ++++++------ drivers/usb/host/ohci-hcd.c | 28 ++++++++++++++-------------- drivers/usb/host/r8a66597-hcd.c | 14 +++++++------- include/usb.h | 1 - 16 files changed, 92 insertions(+), 109 deletions(-) diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c index ccc9738..0e47c99 100644 --- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c @@ -1054,7 +1054,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (usb_pipeint(pipe)) { info("Root-Hub submit IRQ: NOT implemented"); @@ -1257,7 +1257,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, #ifdef DEBUG ohci_dump_roothub(&gohci, 1); #else - wait_ms(1); + mdelay(1); #endif len = min_t(int, len, leni); @@ -1272,7 +1272,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)", 0 /*usb_pipein(pipe) */); #else - wait_ms(1); + mdelay(1); #endif return stat; @@ -1299,7 +1299,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (!maxsize) { err("submit_common_message: pipesize for pipe %lx is zero", @@ -1313,7 +1313,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, return -1; } - wait_ms(10); + mdelay(10); /* ohci_dump_status(&gohci); */ /* allow more time for a BULK device to react - some are slow */ @@ -1348,7 +1348,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, } if (--timeout) { - wait_ms(1); + mdelay(1); if (!urb_finished) dbg("\%"); @@ -1393,7 +1393,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif /* free TDs in urb_priv */ @@ -1420,7 +1420,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (!maxsize) { err("submit_control_message: pipesize for pipe %lx is zero", @@ -1460,7 +1460,7 @@ static int hc_reset(struct ohci *ohci) writel(OHCI_OCR, &ohci->regs->cmdstatus); info("USB HC TakeOver from SMM"); while (readl(&ohci->regs->control) & OHCI_CTRL_IR) { - wait_ms(10); + mdelay(10); if (--smm_timeout == 0) { err("USB HC TakeOver failed!"); return -1; @@ -1598,7 +1598,7 @@ static int hc_interrupt(void) #ifdef DEBUG ohci_dump(ohci, 1); #else - wait_ms(1); + mdelay(1); #endif /* FIXME: be optimistic, hope that bug won't repeat often. */ /* Make some non-interrupt context restart the controller. */ @@ -1609,7 +1609,7 @@ static int hc_interrupt(void) } if (ints & OHCI_INTR_WDH) { - wait_ms(1); + mdelay(1); writel(OHCI_INTR_WDH, ®s->intrdisable); stat = dl_done_list(&gohci, dl_reverse_done_list(&gohci)); @@ -1625,7 +1625,7 @@ static int hc_interrupt(void) /* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */ if (ints & OHCI_INTR_SF) { unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1; - wait_ms(1); + mdelay(1); writel(OHCI_INTR_SF, ®s->intrdisable); if (ohci->ed_rm_list[frame] != NULL) writel(OHCI_INTR_SF, ®s->intrenable); @@ -1716,7 +1716,7 @@ int usb_lowlevel_init(void) /* FIXME this is a second HC reset; why?? */ gohci.hc_control = OHCI_USB_RESET; writel(gohci.hc_control, &gohci.regs->control); - wait_ms(10); + mdelay(10); if (hc_start(&gohci) < 0) { err("can't start usb-%s", gohci.slot_name); @@ -1728,7 +1728,7 @@ int usb_lowlevel_init(void) #ifdef DEBUG ohci_dump(&gohci, 1); #else - wait_ms(1); + mdelay(1); #endif ohci_inited = 1; urb_finished = 1; diff --git a/arch/arm/cpu/pxa/usb.c b/arch/arm/cpu/pxa/usb.c index 0311d5e..3cf6adb 100644 --- a/arch/arm/cpu/pxa/usb.c +++ b/arch/arm/cpu/pxa/usb.c @@ -48,7 +48,7 @@ int usb_cpu_init(void) #endif writel(readl(UHCHR) | UHCHR_FHR, UHCHR); - wait_ms(11); + mdelay(11); writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR); writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR); diff --git a/arch/mips/cpu/au1x00_usb_ohci.c b/arch/mips/cpu/au1x00_usb_ohci.c index 0bc2305..841a8d8 100644 --- a/arch/mips/cpu/au1x00_usb_ohci.c +++ b/arch/mips/cpu/au1x00_usb_ohci.c @@ -1012,7 +1012,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, urb_priv.actual_length = 0; pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (usb_pipeint(pipe)) { info("Root-Hub submit IRQ: NOT implemented"); @@ -1189,7 +1189,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe)); #ifdef DEBUG ohci_dump_roothub (&gohci, 1); #else - wait_ms(1); + mdelay(1); #endif len = min_t(int, len, leni); @@ -1203,7 +1203,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe)); urb_priv.actual_length = transfer_len; pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/); #else - wait_ms(1); + mdelay(1); #endif return stat; @@ -1230,7 +1230,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, urb_priv.actual_length = 0; pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (!maxsize) { err("submit_common_message: pipesize for pipe %lx is zero", @@ -1243,7 +1243,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, return -1; } - wait_ms(10); + mdelay(10); /* ohci_dump_status(&gohci); */ /* allow more time for a BULK device to react - some are slow */ @@ -1267,7 +1267,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, break; } if (--timeout) { - udelay(250); /* wait_ms(1); */ + udelay(250); /* mdelay(1); */ } else { err("CTL:TIMEOUT "); stat = USB_ST_CRC_ERR; @@ -1302,7 +1302,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, #ifdef DEBUG pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif /* free TDs in urb_priv */ @@ -1328,7 +1328,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, urb_priv.actual_length = 0; pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (!maxsize) { err("submit_control_message: pipesize for pipe %lx is zero", @@ -1367,7 +1367,7 @@ static int hc_reset (ohci_t *ohci) writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */ info("USB HC TakeOver from SMM"); while (readl (&ohci->regs->control) & OHCI_CTRL_IR) { - wait_ms (10); + mdelay (10); if (--smm_timeout == 0) { err("USB HC TakeOver failed!"); return -1; @@ -1491,7 +1491,7 @@ hc_interrupt (void) #ifdef DEBUG ohci_dump (ohci, 1); #else - wait_ms(1); + mdelay(1); #endif /* FIXME: be optimistic, hope that bug won't repeat often. */ /* Make some non-interrupt context restart the controller. */ @@ -1502,7 +1502,7 @@ hc_interrupt (void) } if (ints & OHCI_INTR_WDH) { - wait_ms(1); + mdelay(1); writel (OHCI_INTR_WDH, ®s->intrdisable); stat = dl_done_list (&gohci, dl_reverse_done_list (&gohci)); writel (OHCI_INTR_WDH, ®s->intrenable); @@ -1517,7 +1517,7 @@ hc_interrupt (void) /* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */ if (ints & OHCI_INTR_SF) { unsigned int frame = m16_swap (ohci->hcca->frame_no) & 1; - wait_ms(1); + mdelay(1); writel (OHCI_INTR_SF, ®s->intrdisable); if (ohci->ed_rm_list[frame] != NULL) writel (OHCI_INTR_SF, ®s->intrenable); @@ -1687,7 +1687,7 @@ int usb_lowlevel_init(void) /* FIXME this is a second HC reset; why?? */ writel (gohci.hc_control = OHCI_USB_RESET, &gohci.regs->control); - wait_ms (10); + mdelay (10); if (hc_start (&gohci) < 0) goto errout; @@ -1695,7 +1695,7 @@ int usb_lowlevel_init(void) #ifdef DEBUG ohci_dump (&gohci, 1); #else - wait_ms(1); + mdelay(1); #endif ohci_inited = 1; return 0; diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c index 7976e4d..e6aa06f 100644 --- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c +++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c @@ -1270,7 +1270,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, } if (--timeout) { - wait_ms(1); + mdelay(1); if (!urb_finished) dbg("\%"); @@ -1373,7 +1373,7 @@ static int hc_reset (ohci_t *ohci) writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */ info("USB HC TakeOver from SMM"); while (readl (&ohci->regs->control) & OHCI_CTRL_IR) { - wait_ms (10); + mdelay (10); if (--smm_timeout == 0) { err("USB HC TakeOver failed!"); return -1; @@ -1531,7 +1531,7 @@ hc_interrupt (void) /* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */ if (ints & OHCI_INTR_SF) { unsigned int frame = ohci_cpu_to_le16 (ohci->hcca->frame_no) & 1; - wait_ms(1); + mdelay(1); writel (OHCI_INTR_SF, ®s->intrdisable); if (ohci->ed_rm_list[frame] != NULL) writel (OHCI_INTR_SF, ®s->intrenable); diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c b/arch/powerpc/cpu/ppc4xx/usb_ohci.c index a9edacd..a90ee7c 100644 --- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c +++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c @@ -1277,7 +1277,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, } if (--timeout) { - wait_ms(1); + mdelay(1); if (!urb_finished) dbg("\%"); @@ -1380,7 +1380,7 @@ static int hc_reset (ohci_t *ohci) writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */ info("USB HC TakeOver from SMM"); while (readl (&ohci->regs->control) & OHCI_CTRL_IR) { - wait_ms (10); + mdelay (10); if (--smm_timeout == 0) { err("USB HC TakeOver failed!"); return -1; @@ -1538,7 +1538,7 @@ hc_interrupt (void) /* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */ if (ints & OHCI_INTR_SF) { unsigned int frame = ohci_cpu_to_le16 (ohci->hcca->frame_no) & 1; - wait_ms(1); + mdelay(1); writel (OHCI_INTR_SF, ®s->intrdisable); if (ohci->ed_rm_list[frame] != NULL) writel (OHCI_INTR_SF, ®s->intrenable); diff --git a/arch/sparc/cpu/leon3/usb_uhci.c b/arch/sparc/cpu/leon3/usb_uhci.c index 8f99e1d..0b88f7b 100644 --- a/arch/sparc/cpu/leon3/usb_uhci.c +++ b/arch/sparc/cpu/leon3/usb_uhci.c @@ -515,9 +515,9 @@ void reset_hc(void) out16r(usb_base_addr + USBCMD, USBCMD_GRESET | USBCMD_RS); /* Turn off all interrupts */ out16r(usb_base_addr + USBINTR, 0); - wait_ms(50); + mdelay(50); out16r(usb_base_addr + USBCMD, 0); - wait_ms(10); + mdelay(10); } void start_hc(void) @@ -1044,7 +1044,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer, status = (status & 0xfff5) | USBPORTSC_PR; out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1), status); - wait_ms(10); + mdelay(10); status = (status & 0xfff5) & ~USBPORTSC_PR; out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1), status); @@ -1052,7 +1052,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer, status = (status & 0xfff5) | USBPORTSC_PE; out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1), status); - wait_ms(10); + mdelay(10); status = (status & 0xfff5) | 0xa; out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1), status); diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c index 49213d0..11a4ccd 100644 --- a/board/mcc200/auto_update.c +++ b/board/mcc200/auto_update.c @@ -284,7 +284,7 @@ int au_do_update(int idx, long sz) */ debug ("flash_sect_erase(%lx, %lx);\n", start, end); flash_sect_erase(start, end); - wait_ms(100); + mdelay(100); #ifdef CONFIG_PROGRESSBAR show_progress(end - start, totsize); #endif @@ -352,7 +352,7 @@ int do_auto_update(void) * Read keypad status */ i2c_read(I2C_PSOC_KEYPAD_ADDR, 0, 0, keypad_status1, 2); - wait_ms(500); + mdelay(500); i2c_read(I2C_PSOC_KEYPAD_ADDR, 0, 0, keypad_status2, 2); /* diff --git a/board/mpl/common/usb_uhci.c b/board/mpl/common/usb_uhci.c index a009437..6e559f3 100644 --- a/board/mpl/common/usb_uhci.c +++ b/board/mpl/common/usb_uhci.c @@ -435,9 +435,9 @@ void reset_hc(void) out16r( usb_base_addr + USBCMD,USBCMD_GRESET | USBCMD_RS); /* Turn off all interrupts */ out16r(usb_base_addr + USBINTR,0); - wait_ms(50); + mdelay(50); out16r( usb_base_addr + USBCMD,0); - wait_ms(10); + mdelay(10); } void start_hc(void) @@ -926,13 +926,13 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer, status = in16r(usb_base_addr+USBPORTSC1+2*(wIndex-1)); status = (status & 0xfff5) | USBPORTSC_PR; out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status); - wait_ms(10); + mdelay(10); status = (status & 0xfff5) & ~USBPORTSC_PR; out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status); udelay(10); status = (status & 0xfff5) | USBPORTSC_PE; out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status); - wait_ms(10); + mdelay(10); status = (status & 0xfff5) | 0xa; out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status); len=0; diff --git a/board/renesas/sh7785lcr/selfcheck.c b/board/renesas/sh7785lcr/selfcheck.c index 6d92c83..2cd2ad0 100644 --- a/board/renesas/sh7785lcr/selfcheck.c +++ b/board/renesas/sh7785lcr/selfcheck.c @@ -33,12 +33,6 @@ #define SM107_DEVICEID (0x13e00060 + NOCACHE_OFFSET) -static void wait_ms(unsigned long time) -{ - while (time--) - udelay(1000); -} - static void test_pld(void) { printf("PLD version = %04x\n", readb(PLD_VERSR)); @@ -53,10 +47,10 @@ static void test_led(void) { printf("turn on LEDs 3, 5, 7, 9\n"); writeb(0x55, PLD_LEDCR); - wait_ms(2000); + mdelay(2000); printf("turn on LEDs 4, 6, 8, 10\n"); writeb(0xaa, PLD_LEDCR); - wait_ms(2000); + mdelay(2000); writeb(0x00, PLD_LEDCR); } diff --git a/common/usb.c b/common/usb.c index 10e23de..5919e2d 100644 --- a/common/usb.c +++ b/common/usb.c @@ -83,16 +83,6 @@ void usb_hub_reset(void); static int hub_port_reset(struct usb_device *dev, int port, unsigned short *portstat); -/*********************************************************************** - * wait_ms - */ - -inline void wait_ms(unsigned long ms) -{ - while (ms-- > 0) - udelay(1000); -} - /*************************************************************************** * Init USB Device */ @@ -205,7 +195,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, while (timeout--) { if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC)) break; - wait_ms(1); + mdelay(1); } if (dev->status) return -1; @@ -229,7 +219,7 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, while (timeout--) { if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC)) break; - wait_ms(1); + mdelay(1); } *actual_length = dev->act_len; if (dev->status == 0) @@ -876,7 +866,7 @@ int usb_new_device(struct usb_device *dev) return 1; } - wait_ms(10); /* Let the SET_ADDRESS settle */ + mdelay(10); /* Let the SET_ADDRESS settle */ tmp = sizeof(dev->descriptor); @@ -1027,7 +1017,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub) for (i = 0; i < dev->maxchild; i++) { usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status); - wait_ms(hub->desc.bPwrOn2PwrGood * 2); + mdelay(hub->desc.bPwrOn2PwrGood * 2); } } @@ -1068,7 +1058,7 @@ static int hub_port_reset(struct usb_device *dev, int port, for (tries = 0; tries < MAX_TRIES; tries++) { usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET); - wait_ms(200); + mdelay(200); if (usb_get_port_status(dev, port + 1, &portsts) < 0) { USB_HUB_PRINTF("get_port_status failed status %lX\n", @@ -1095,7 +1085,7 @@ static int hub_port_reset(struct usb_device *dev, int port, if (portstatus & USB_PORT_STAT_ENABLE) break; - wait_ms(200); + mdelay(200); } if (tries == MAX_TRIES) { @@ -1139,7 +1129,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port) if (!(portstatus & USB_PORT_STAT_CONNECTION)) return; } - wait_ms(200); + mdelay(200); /* Reset the port */ if (hub_port_reset(dev, port, &portstatus) < 0) { @@ -1147,7 +1137,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port) return; } - wait_ms(200); + mdelay(200); /* Allocate a new device struct for it */ usb = usb_alloc_new_device(); diff --git a/common/usb_storage.c b/common/usb_storage.c index 1e6cd6a..67bbe1c 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -435,19 +435,19 @@ static int usb_stor_BBB_reset(struct us_data *us) } /* long wait for reset */ - wait_ms(150); + mdelay(150); USB_STOR_PRINTF("BBB_reset result %d: status %X reset\n", result, us->pusb_dev->status); pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in); result = usb_clear_halt(us->pusb_dev, pipe); /* long wait for reset */ - wait_ms(150); + mdelay(150); USB_STOR_PRINTF("BBB_reset result %d: status %X clearing IN endpoint\n", result, us->pusb_dev->status); /* long wait for reset */ pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out); result = usb_clear_halt(us->pusb_dev, pipe); - wait_ms(150); + mdelay(150); USB_STOR_PRINTF("BBB_reset result %d: status %X" " clearing OUT endpoint\n", result, us->pusb_dev->status); @@ -475,7 +475,7 @@ static int usb_stor_CB_reset(struct us_data *us) USB_CNTL_TIMEOUT * 5); /* long wait for reset */ - wait_ms(1500); + mdelay(1500); USB_STOR_PRINTF("CB_reset result %d: status %X" " clearing endpoint halt\n", result, us->pusb_dev->status); @@ -618,7 +618,7 @@ int usb_stor_CBI_get_status(ccb *srb, struct us_data *us) while (timeout--) { if ((volatile int *) us->ip_wanted == 0) break; - wait_ms(10); + mdelay(10); } if (us->ip_wanted) { printf(" Did not get interrupt on CBI\n"); @@ -689,7 +689,7 @@ int usb_stor_BBB_transport(ccb *srb, struct us_data *us) usb_stor_BBB_reset(us); return USB_STOR_TRANSPORT_FAILED; } - wait_ms(5); + mdelay(5); pipein = usb_rcvbulkpipe(us->pusb_dev, us->ep_in); pipeout = usb_sndbulkpipe(us->pusb_dev, us->ep_out); /* DATA phase + error handling */ @@ -881,7 +881,7 @@ do_retry: srb->sense_buf[12], srb->sense_buf[13]); return USB_STOR_TRANSPORT_FAILED; } else { - wait_ms(100); + mdelay(100); goto do_retry; } break; @@ -957,7 +957,7 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss) if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) return 0; usb_request_sense(srb, ss); - wait_ms(100); + mdelay(100); } while (retries--); return -1; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6eb38a4..644febc 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -761,7 +761,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, goto unknown; } - wait_ms(1); + mdelay(1); len = min3(srclen, le16_to_cpu(req->length), length); if (srcptr != NULL && len > 0) memcpy(buffer, srcptr, len); @@ -842,7 +842,7 @@ int usb_lowlevel_init(void) ehci_writel(&hcor->or_configflag, cmd); /* unblock posted write */ cmd = ehci_readl(&hcor->or_usbcmd); - wait_ms(5); + mdelay(5); reg = HC_VERSION(ehci_readl(&hccr->cr_capbase)); printf("USB EHCI %x.%02x\n", reg >> 8, reg & 0xff); diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index abdcbb4..5ef34c3 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c @@ -578,7 +578,7 @@ static int isp116x_interrupt(struct isp116x *isp116x) /* When root hub or any of its ports is going to come out of suspend, it may take more than 10ms for status bits to stabilize. */ - wait_ms(20); + mdelay(20); } if (intstat & HCINT_SO) { @@ -679,7 +679,7 @@ retry_same: /* Pack data into FIFO ram */ pack_fifo(isp116x, dev, pipe, ptd, 1, buffer, len); #ifdef EXTRA_DELAY - wait_ms(EXTRA_DELAY); + mdelay(EXTRA_DELAY); #endif /* Start the data transfer */ @@ -983,11 +983,11 @@ static int isp116x_submit_rh_msg(struct usb_device *dev, unsigned long pipe, HCRHPORT1 + wIndex - 1); if (!(tmp & RH_PS_PRS)) break; - wait_ms(1); + mdelay(1); } isp116x_write_reg32(isp116x, HCRHPORT1 + wIndex - 1, RH_PS_PRS); - wait_ms(10); + mdelay(10); len = 0; break; @@ -1251,7 +1251,7 @@ static int isp116x_sw_reset(struct isp116x *isp116x) isp116x_write_reg32(isp116x, HCCMDSTAT, HCCMDSTAT_HCR); while (--retries) { /* It usually resets within 1 ms */ - wait_ms(1); + mdelay(1); if (!(isp116x_read_reg32(isp116x, HCCMDSTAT) & HCCMDSTAT_HCR)) break; } @@ -1278,7 +1278,7 @@ static int isp116x_reset(struct isp116x *isp116x) clkrdy = isp116x_read_reg16(isp116x, HCuPINT) & HCuPINT_CLKRDY; if (clkrdy) break; - wait_ms(1); + mdelay(1); } if (!clkrdy) { ERR("clock not ready after %dms", timeout); diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index d246978..761a529 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1273,7 +1273,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, pkt_print(NULL, dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (usb_pipeint(pipe)) { info("Root-Hub submit IRQ: NOT implemented"); @@ -1354,7 +1354,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, OK(0); case (RH_PORT_POWER): WR_RH_PORTSTAT(RH_PS_PPS); - wait_ms(100); + mdelay(100); OK(0); case (RH_PORT_ENABLE): /* BUG IN HUP CODE *********/ if (RD_RH_PORTSTAT & RH_PS_CCS) @@ -1455,7 +1455,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, #ifdef DEBUG ohci_dump_roothub(&gohci, 1); #else - wait_ms(1); + mdelay(1); #endif len = min_t(int, len, leni); @@ -1468,7 +1468,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, pkt_print(NULL, dev, pipe, buffer, transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/); #else - wait_ms(1); + mdelay(1); #endif return stat; @@ -1506,7 +1506,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, pkt_print(urb, dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (!maxsize) { err("submit_common_message: pipesize for pipe %lx is zero", @@ -1520,7 +1520,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, } #if 0 - wait_ms(10); + mdelay(10); /* ohci_dump_status(&gohci); */ #endif @@ -1555,7 +1555,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, } if (--timeout) { - wait_ms(1); + mdelay(1); if (!urb->finished) dbg("*"); @@ -1575,7 +1575,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, pkt_print(urb, dev, pipe, buffer, transfer_len, setup, "RET(ctlr)", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif /* free TDs in urb_priv */ @@ -1602,7 +1602,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, pkt_print(NULL, dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe)); #else - wait_ms(1); + mdelay(1); #endif if (!maxsize) { err("submit_control_message: pipesize for pipe %lx is zero", @@ -1672,7 +1672,7 @@ static int hc_reset(ohci_t *ohci) ohci_writel(OHCI_OCR, &ohci->regs->cmdstatus); info("USB HC TakeOver from SMM"); while (ohci_readl(&ohci->regs->control) & OHCI_CTRL_IR) { - wait_ms(10); + mdelay(10); if (--smm_timeout == 0) { err("USB HC TakeOver failed!"); return -1; @@ -1815,7 +1815,7 @@ static int hc_interrupt(void) #ifdef DEBUG ohci_dump(ohci, 1); #else - wait_ms(1); + mdelay(1); #endif /* FIXME: be optimistic, hope that bug won't repeat often. */ /* Make some non-interrupt context restart the controller. */ @@ -1826,7 +1826,7 @@ static int hc_interrupt(void) } if (ints & OHCI_INTR_WDH) { - wait_ms(1); + mdelay(1); ohci_writel(OHCI_INTR_WDH, ®s->intrdisable); (void)ohci_readl(®s->intrdisable); /* flush */ stat = dl_done_list(&gohci); @@ -1843,7 +1843,7 @@ static int hc_interrupt(void) /* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */ if (ints & OHCI_INTR_SF) { unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1; - wait_ms(1); + mdelay(1); ohci_writel(OHCI_INTR_SF, ®s->intrdisable); if (ohci->ed_rm_list[frame] != NULL) ohci_writel(OHCI_INTR_SF, ®s->intrenable); @@ -1975,7 +1975,7 @@ int usb_lowlevel_init(void) #ifdef DEBUG ohci_dump(&gohci, 1); #else - wait_ms(1); + mdelay(1); #endif ohci_inited = 1; return 0; diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index db611b6..9e0cb7d 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -497,7 +497,7 @@ static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port) old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port) & LNST); while (count > 0) { - wait_ms(R8A66597_RH_POLL_TIME); + mdelay(R8A66597_RH_POLL_TIME); syssts = r8a66597_read(r8a66597, get_syssts_reg(port) & LNST); if (syssts == old_syssts) { @@ -511,11 +511,11 @@ static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port) static void r8a66597_bus_reset(struct r8a66597 *r8a66597, int port) { - wait_ms(10); + mdelay(10); r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, get_dvstctr_reg(port)); - wait_ms(50); + mdelay(50); r8a66597_mdfy(r8a66597, UACT, USBRST | UACT, get_dvstctr_reg(port)); - wait_ms(50); + mdelay(50); } static int check_usb_device_connecting(struct r8a66597 *r8a66597) @@ -823,7 +823,7 @@ static int r8a66597_submit_rh_msg(struct usb_device *dev, unsigned long pipe, stat = USB_ST_STALLED; } - wait_ms(1); + mdelay(1); len = min_t(int, len, leni); @@ -924,7 +924,7 @@ int usb_lowlevel_init(void) r8a66597->reg = CONFIG_R8A66597_BASE_ADDR; disable_controller(r8a66597); - wait_ms(100); + mdelay(100); enable_controller(r8a66597); r8a66597_port_power(r8a66597, 0 , 1); @@ -932,7 +932,7 @@ int usb_lowlevel_init(void) /* check usb device */ check_usb_device_connecting(r8a66597); - wait_ms(50); + mdelay(50); return 0; } diff --git a/include/usb.h b/include/usb.h index 9d685eb..0da0d63 100644 --- a/include/usb.h +++ b/include/usb.h @@ -187,7 +187,6 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval); void usb_disable_asynch(int disable); int usb_maxpacket(struct usb_device *dev, unsigned long pipe); -inline void wait_ms(unsigned long ms); int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer, int cfgno); int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, -- 2.7.4 From ff2cab7d1dfb13f967dbfde53608fdf1ec90e7f7 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 12:44:19 +0900 Subject: [PATCH 04/16] power: battery: sprd: remove build warnings Remove build warnings from sprd battery. Change-Id: I5b30f1d1f35748da2b02e2e6cacad054cd0547c2 Signed-off-by: Seung-Woo Kim --- drivers/power/sprd_battery.c | 4 ++-- property/vbat_check.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/power/sprd_battery.c b/drivers/power/sprd_battery.c index 884d527..ed58a4f 100644 --- a/drivers/power/sprd_battery.c +++ b/drivers/power/sprd_battery.c @@ -229,11 +229,11 @@ static uint32_t sprdfgu_poweron_type_read(void) #define mdelay(_ms) udelay(_ms*1000) unsigned int fgu_vol, fgu_cur; -unsigned int get_fgu_vol() { +unsigned int get_fgu_vol(void) { return fgu_vol; } -unsigned int get_fgu_cur() { +unsigned int get_fgu_cur(void) { return fgu_cur; } diff --git a/property/vbat_check.c b/property/vbat_check.c index 603efdf..0741ff4 100644 --- a/property/vbat_check.c +++ b/property/vbat_check.c @@ -4,6 +4,7 @@ unsigned int get_bat_low_level(void); unsigned int get_bat_low_level_chg(void); int charger_connected(void); +extern uint16_t sprdbat_auxadc2vbatvol(uint16_t adcvalue); #define _BUF_SIZE 10 uint32_t vbat_buf[_BUF_SIZE]; -- 2.7.4 From 9d368f1533bc5e6a8e18fe59287b20a7ccb82c8a Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 12:58:19 +0900 Subject: [PATCH 05/16] lcd: remove build warnings Remove build warnings in logo display. Change-Id: I021aa282bfb1c55ec909703f99b42f9b2dafede4 Signed-off-by: Seung-Woo Kim --- common/lcd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index 134004f..7396eaf 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -94,6 +94,7 @@ static int lcd_getbgcolor (void); void lcd_setfgcolor (int color); static void lcd_setbgcolor (int color); +extern void lcd_display(void); char lcd_is_enabled = 0; @@ -510,7 +511,6 @@ static int lcd_getbgcolor (void) void _draw_image(int x, int y, int width, int height, unsigned short *palette, unsigned short *bitmap, unsigned int *num_bitmap, unsigned int num_elem, int clear) { unsigned long i, j, k, num_pre_pixels, num_post_pixels; - unsigned int tmp; u16 col16; ushort *fb16; @@ -605,10 +605,9 @@ void bitmap_plot (int x, int y, int mode) #else ushort *cmap; #endif - ushort i, j; + ushort i; uchar *bmap; uchar *fb; - ushort *fb16; #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS struct pxafb_info *fbi = &panel_info.pxa; #elif defined(CONFIG_MPC823) -- 2.7.4 From 1e8ad9c0cde15c9af2a14f4aab6b6b844fdecd4f Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 15:38:58 +0900 Subject: [PATCH 06/16] gpio: remove build warnings caused by sprd bsp Remove build warnings caused by sprd bsp. Change-Id: I0c64253caec188267a13dc9e24cbfd489085d746 Signed-off-by: Seung-Woo Kim --- include/asm-generic/gpio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 3d22357..70d481d 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -28,12 +28,13 @@ * platform data and other tables. */ -static bool gpio_is_valid(int number) +static inline bool gpio_is_valid(int number) { return number >= 0 && number < ARCH_NR_GPIOS; } struct gpio; +struct seq_file; /** * struct gpio_chip - abstract a GPIO controller -- 2.7.4 From 8b2c912b69f1719e86c53fd9efaf42515666e3d8 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 15:46:56 +0900 Subject: [PATCH 07/16] usb: gadget: remove build warnings Remove build warnings. Change-Id: I528624a8700aaa9dc37860309e80156c74e81f5a Signed-off-by: Seung-Woo Kim --- drivers/usb/gadget/f_acm.c | 14 +++++++------- drivers/usb/gadget/f_obex.c | 11 +++++------ drivers/usb/gadget/f_serial.c | 3 +-- drivers/usb/gadget/u_serial.c | 38 +++++++++++++++++++++----------------- property/calibration_mode.c | 2 +- 5 files changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index 92c5f66..0dc0499 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -267,17 +267,18 @@ static void acm_complete_set_line_coding(struct usb_ep *ep, struct usb_request *req) { struct f_acm *acm = ep->driver_data; - struct usb_composite_dev *cdev = acm->port.func.config->cdev; if (req->status != 0) { - DBG(cdev, "acm ttyGS%d completion, err %d\n", + DBG(acm->port.func.config->cdev, + "acm ttyGS%d completion, err %d\n", acm->port_num, req->status); return; } /* normal completion */ if (req->actual != sizeof(acm->port_line_coding)) { - DBG(cdev, "acm ttyGS%d short resp, len %d\n", + DBG(acm->port.func.config->cdev, + "acm ttyGS%d short resp, len %d\n", acm->port_num, req->actual); usb_ep_set_halt(ep); } else { @@ -418,9 +419,8 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) static void acm_disable(struct usb_function *f) { struct f_acm *acm = func_to_acm(f); - struct usb_composite_dev *cdev = f->config->cdev; - DBG(cdev, "acm ttyGS%d deactivated\n", acm->port_num); + DBG(f->config->cdev, "acm ttyGS%d deactivated\n", acm->port_num); gserial_disconnect(&acm->port); usb_ep_disable(acm->notify); acm->notify->driver_data = NULL; @@ -485,12 +485,12 @@ static int acm_cdc_notify(struct f_acm *acm, u8 type, u16 value, static int acm_notify_serial_state(struct f_acm *acm) { - struct usb_composite_dev *cdev = acm->port.func.config->cdev; int status; spin_lock(&acm->lock); if (acm->notify_req) { - DBG(cdev, "acm ttyGS%d serial state %04x\n", + DBG(acm->port.func.config->cdev, + "acm ttyGS%d serial state %04x\n", acm->port_num, acm->serial_state); status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE, 0, &acm->serial_state, sizeof(acm->serial_state)); diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c index eed4a0d..e7214be 100644 --- a/drivers/usb/gadget/f_obex.c +++ b/drivers/usb/gadget/f_obex.c @@ -263,9 +263,8 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) static void obex_disable(struct usb_function *f) { struct f_obex *obex = func_to_obex(f); - struct usb_composite_dev *cdev = f->config->cdev; - DBG(cdev, "obex ttyGS%d disable\n", obex->port_num); + DBG(f->config->cdev, "obex ttyGS%d disable\n", obex->port_num); gserial_disconnect(&obex->port); } @@ -274,7 +273,6 @@ static void obex_disable(struct usb_function *f) static void obex_connect(struct gserial *g) { struct f_obex *obex = port_to_obex(g); - struct usb_composite_dev *cdev = g->func.config->cdev; int status; if (!obex->can_activate) @@ -282,14 +280,14 @@ static void obex_connect(struct gserial *g) status = usb_function_activate(&g->func); if (status) - DBG(cdev, "obex ttyGS%d function activate --> %d\n", + DBG(g->func.config->cdev, + "obex ttyGS%d function activate --> %d\n", obex->port_num, status); } static void obex_disconnect(struct gserial *g) { struct f_obex *obex = port_to_obex(g); - struct usb_composite_dev *cdev = g->func.config->cdev; int status; if (!obex->can_activate) @@ -297,7 +295,8 @@ static void obex_disconnect(struct gserial *g) status = usb_function_deactivate(&g->func); if (status) - DBG(cdev, "obex ttyGS%d function deactivate --> %d\n", + DBG(g->func.config->cdev, + "obex ttyGS%d function deactivate --> %d\n", obex->port_num, status); } diff --git a/drivers/usb/gadget/f_serial.c b/drivers/usb/gadget/f_serial.c index e7c6dd6..dafde21 100644 --- a/drivers/usb/gadget/f_serial.c +++ b/drivers/usb/gadget/f_serial.c @@ -196,9 +196,8 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt) static void gser_disable(struct usb_function *f) { struct f_gser *gser = func_to_gser(f); - struct usb_composite_dev *cdev = f->config->cdev; - DBG(cdev, "generic ttyGS%d deactivated\n", gser->port_num); + DBG(f->config->cdev, "generic ttyGS%d deactivated\n", gser->port_num); usb_port_open = false; gserial_disconnect(&gser->port); } diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 82b71db..9e1d73b 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c @@ -35,6 +35,10 @@ #define pr_warning(fmt, args...) printf(fmt, ##args) #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + /* * This component encapsulates the TTY layer glue needed to provide basic * "serial port" functionality through the USB gadget stack. Each such @@ -366,7 +370,6 @@ __acquires(&port->port_lock) struct list_head *pool = &port->write_pool; struct usb_ep *in = NULL; int status = 0; - bool do_tty_wake = false; if (!port->port_usb){ return status; @@ -386,7 +389,6 @@ __acquires(&port->port_lock) wake_up_interruptible(&port->drain_wait); break; } - do_tty_wake = true; req->length = len; list_del(&req->list); @@ -422,8 +424,6 @@ __acquires(&port->port_lock) } } - //if (do_tty_wake && port->port_tty) - // tty_wakeup(port->port_tty); return status; } @@ -734,7 +734,7 @@ exit: //buf: the buf address where data put //*count: read length wanted, when return store actually read count //return: weather read really done -int gs_read(const unsigned char *buf, int *count) +int gs_read(unsigned char *buf, int *count) { struct gs_port *port = ports[vcom_port].port; struct list_head *queue = &port->read_queue; @@ -785,7 +785,7 @@ int gs_read(const unsigned char *buf, int *count) } port->n_read = 0; } -recycle: + list_move(&req->list, &port->read_pool); port->read_started--; } @@ -805,7 +805,7 @@ int gs_write(const unsigned char *buf, int count) { struct gs_port *port = ports[vcom_port].port; if (count) - count = gs_buf_put(&port->port_write_buf, buf, count); + count = gs_buf_put(&port->port_write_buf, (const char *)buf, count); /* treat count == 0 as flush_chars() */ if (port->port_usb) usb_trans_status = gs_start_tx(port); @@ -1188,7 +1188,7 @@ exit: static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct gs_port *port = tty->driver_data; - unsigned long flags; + __maybe_unused unsigned long flags; int status; pr_vdebug("gs_write: ttyGS%d (%p) writing %d bytes\n", @@ -1196,7 +1196,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count) spin_lock_irqsave(&port->port_lock, flags); if (count) - count = gs_buf_put(&port->port_write_buf, buf, count); + count = gs_buf_put(&port->port_write_buf, (const char *)buf, count); /* treat count == 0 as flush_chars() */ if (port->port_usb) status = gs_start_tx(port); @@ -1208,7 +1208,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count) static int gs_put_char(struct tty_struct *tty, unsigned char ch) { struct gs_port *port = tty->driver_data; - unsigned long flags; + __maybe_unused unsigned long flags; int status; pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %p\n", @@ -1224,7 +1224,7 @@ static int gs_put_char(struct tty_struct *tty, unsigned char ch) static void gs_flush_chars(struct tty_struct *tty) { struct gs_port *port = tty->driver_data; - unsigned long flags; + __maybe_unused unsigned long flags; pr_vdebug("gs_flush_chars: (%d,%p)\n", port->port_num, tty); @@ -1237,7 +1237,7 @@ static void gs_flush_chars(struct tty_struct *tty) static int gs_write_room(struct tty_struct *tty) { struct gs_port *port = tty->driver_data; - unsigned long flags; + __maybe_unused unsigned long flags; int room = 0; spin_lock_irqsave(&port->port_lock, flags); @@ -1254,7 +1254,7 @@ static int gs_write_room(struct tty_struct *tty) static int gs_chars_in_buffer(struct tty_struct *tty) { struct gs_port *port = tty->driver_data; - unsigned long flags; + __maybe_unused unsigned long flags; int chars = 0; spin_lock_irqsave(&port->port_lock, flags); @@ -1271,7 +1271,7 @@ static int gs_chars_in_buffer(struct tty_struct *tty) static void gs_unthrottle(struct tty_struct *tty) { struct gs_port *port = tty->driver_data; - unsigned long flags; + __maybe_unused unsigned long flags; spin_lock_irqsave(&port->port_lock, flags); if (port->port_usb) { @@ -1453,6 +1453,7 @@ fail: return status; } +#if 0 static int gs_closed(struct gs_port *port) { int cond; @@ -1462,6 +1463,7 @@ static int gs_closed(struct gs_port *port) spin_unlock_irq(&port->port_lock); return cond; } +#endif /** * gserial_cleanup - remove TTY-over-USB driver and devices @@ -1497,8 +1499,10 @@ void gserial_cleanup(void) // tasklet_kill(&port->push); +#if 0 /* wait for old opens to finish */ -// wait_event(port->close_wait, gs_closed(port)); + wait_event(port->close_wait, gs_closed(port)); +#endif //WARN_ON(port->port_usb != NULL); @@ -1537,7 +1541,7 @@ void gserial_cleanup(void) int gserial_connect(struct gserial *gser, u8 port_num) { struct gs_port *port; - unsigned long flags; + __maybe_unused unsigned long flags; int status; #if 0 if (!gs_tty_driver || port_num >= n_ports) @@ -1611,7 +1615,7 @@ fail_out: void gserial_disconnect(struct gserial *gser) { struct gs_port *port = gser->ioport; - unsigned long flags; + __maybe_unused unsigned long flags; if (!port) return; diff --git a/property/calibration_mode.c b/property/calibration_mode.c index b211856..0f548f0 100644 --- a/property/calibration_mode.c +++ b/property/calibration_mode.c @@ -57,7 +57,7 @@ extern int gpio_get_value(int PinNo); extern int gs_open(void); extern int spi_channel_init(unsigned long phy_id); extern int usb_is_trans_done(int direct); -extern int gs_read(const unsigned char *buf, int *count); +extern int gs_read(unsigned char *buf, int *count); extern int gs_write(const unsigned char *buf, int count); extern void usb_wait_trans_done(int direct); extern void gs_reset_usb_param(void); -- 2.7.4 From 70b155535ec40e8a653b8afd7866edb181e7899e Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 12:45:52 +0900 Subject: [PATCH 08/16] ARM: sc8830: fdl: remove build warnings Remove build warnings. Change-Id: I6137ee6a831317a9c300c223cc94ff87931c2a64 Signed-off-by: Seung-Woo Kim --- arch/arm/include/asm/arch-sc8830/fdl_channel.h | 6 +++--- drivers/serial/serial_sc8800x.c | 2 +- nand_fdl/common/src/dl_engine.c | 2 +- nand_fdl/common/src/drv_usb.c | 5 ++++- nand_fdl/common/src/fdl_channel.c | 3 +-- nand_fdl/common/src/fdl_crc.c | 3 ++- nand_fdl/common/src/fdl_stdio.c | 4 +--- nand_fdl/common/src/packet.c | 7 ++++--- nand_fdl/common/src/usb_boot.c | 5 +++-- nand_fdl/common/src/virtual_com.c | 4 ++-- 10 files changed, 22 insertions(+), 19 deletions(-) diff --git a/arch/arm/include/asm/arch-sc8830/fdl_channel.h b/arch/arm/include/asm/arch-sc8830/fdl_channel.h index 8ff753b..5f8ed48 100644 --- a/arch/arm/include/asm/arch-sc8830/fdl_channel.h +++ b/arch/arm/include/asm/arch-sc8830/fdl_channel.h @@ -5,7 +5,7 @@ typedef struct FDL_ChannelHandler { int (*Open) (struct FDL_ChannelHandler *channel, unsigned int baudrate); - int (*Read) (struct FDL_ChannelHandler *channel, const unsigned char *buf, unsigned int len); + int (*Read) (struct FDL_ChannelHandler *channel, unsigned char *buf, unsigned int len); char (*GetChar) (struct FDL_ChannelHandler *channel); int (*GetSingleChar) (struct FDL_ChannelHandler *channel); int (*Write) (struct FDL_ChannelHandler *channel, const unsigned char *buf, unsigned int len); @@ -15,6 +15,6 @@ typedef struct FDL_ChannelHandler void *priv; } FDL_ChannelHandler_T; -struct FDL_ChannelHandler *FDL_ChannelGet(); +struct FDL_ChannelHandler *FDL_ChannelGet(void); -#endif \ No newline at end of file +#endif diff --git a/drivers/serial/serial_sc8800x.c b/drivers/serial/serial_sc8800x.c index b442127..3624ceb 100644 --- a/drivers/serial/serial_sc8800x.c +++ b/drivers/serial/serial_sc8800x.c @@ -149,7 +149,7 @@ LOCAL int SIO_Open (struct FDL_ChannelHandler *channel, unsigned int baudrate) return 0; } -LOCAL int SIO_Read (struct FDL_ChannelHandler *channel, const unsigned char *buf, unsigned int len) +LOCAL int SIO_Read (struct FDL_ChannelHandler *channel, unsigned char *buf, unsigned int len) { #ifndef CONFIG_NAND_SPL unsigned char *pstart = (unsigned char *) buf; diff --git a/nand_fdl/common/src/dl_engine.c b/nand_fdl/common/src/dl_engine.c index 823e9b6..b80eaef 100644 --- a/nand_fdl/common/src/dl_engine.c +++ b/nand_fdl/common/src/dl_engine.c @@ -16,7 +16,7 @@ typedef struct _CMDPROC_TAB void *arg; } CMDPROC_TAB, *PCMDPROC_TAB; -CMDPROC_TAB g_proctab[BSL_CMD_TYPE_MAX - BSL_CMD_TYPE_MIN] = {0, 0}; +CMDPROC_TAB g_proctab[BSL_CMD_TYPE_MAX - BSL_CMD_TYPE_MIN] = {{0, 0}}; #define IS_VALID_CMD(cmd) ((cmd >= BSL_CMD_TYPE_MIN) && (cmd < BSL_CMD_TYPE_MAX)) #define CMD_IND(cmd) ((cmd) - BSL_CMD_TYPE_MIN) diff --git a/nand_fdl/common/src/drv_usb.c b/nand_fdl/common/src/drv_usb.c index e4cc460..cea7167 100644 --- a/nand_fdl/common/src/drv_usb.c +++ b/nand_fdl/common/src/drv_usb.c @@ -21,6 +21,9 @@ PUBLIC void Dcache_InvalRegion(unsigned int addr, unsigned int length); PUBLIC void Dcache_CleanRegion(unsigned int addr, unsigned int length); +extern uint8 *UCOM_Get_DevDesc(void); +extern uint8 *UCOM_Get_CfgDesc(void); + static __inline void usb_handler (void); /**---------------------------------------------------------------------------* ** Compiler Flag * @@ -698,7 +701,7 @@ int VCOM_GetSingleChar (void) return (int)usb_out_endpoint_buf[nIndex][readIndex++]; } -int VCOM_Read(const unsigned char* buf, unsigned int len) +int VCOM_Read(unsigned char* buf, unsigned int len) { unsigned char *src, *dest = buf; unsigned escape_flag = 0; diff --git a/nand_fdl/common/src/fdl_channel.c b/nand_fdl/common/src/fdl_channel.c index 4d2b765..4d3b077 100644 --- a/nand_fdl/common/src/fdl_channel.c +++ b/nand_fdl/common/src/fdl_channel.c @@ -16,10 +16,9 @@ extern uint32 FDL_GetBootMode (void); // Author: junqiang.wang // Note: /******************************************************************************/ -PUBLIC struct FDL_ChannelHandler *FDL_ChannelGet() +PUBLIC struct FDL_ChannelHandler *FDL_ChannelGet(void) { uint32 bootMode = 0; - char ch; struct FDL_ChannelHandler *channel; bootMode = FDL_GetBootMode(); diff --git a/nand_fdl/common/src/fdl_crc.c b/nand_fdl/common/src/fdl_crc.c index fa8ed36..4dffe3b 100644 --- a/nand_fdl/common/src/fdl_crc.c +++ b/nand_fdl/common/src/fdl_crc.c @@ -11,6 +11,7 @@ extern "C" /////////////////////////////////////////////////////////////////// //CRC Table /////////////////////////////////////////////////////////////////// +#if 0 /** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */ static uint16 const crc16_table[256] = { @@ -47,7 +48,7 @@ static uint16 const crc16_table[256] = 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 }; - +#endif /*********************************************************************/ unsigned int crc_16_l_calc (char *buf_ptr,unsigned int len) diff --git a/nand_fdl/common/src/fdl_stdio.c b/nand_fdl/common/src/fdl_stdio.c index 7715a96..ed77845 100644 --- a/nand_fdl/common/src/fdl_stdio.c +++ b/nand_fdl/common/src/fdl_stdio.c @@ -3,12 +3,10 @@ void *FDL_memcpy (void *dst, const void *src, unsigned int count) { void *ret = dst; +#if ((defined(SC8800S_LITTLE_ENDIAN) && defined(_BIG_ENDIAN))) || (defined(FDL_ENDIAN_SWITCH))//temp for data swap in fdl1 unsigned int *tmp_dst = (unsigned int *) dst; - unsigned int word_num, i; unsigned int value; - -#if ((defined(SC8800S_LITTLE_ENDIAN) && defined(_BIG_ENDIAN))) || (defined(FDL_ENDIAN_SWITCH))//temp for data swap in fdl1 count = count / 4; while (count-->0) diff --git a/nand_fdl/common/src/packet.c b/nand_fdl/common/src/packet.c index 510c553..e024fd9 100644 --- a/nand_fdl/common/src/packet.c +++ b/nand_fdl/common/src/packet.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -11,7 +12,7 @@ extern void FDL_SendAckPacket (cmd_pkt_type pkt_type); - +extern uint32 FDL_GetBootMode (void); struct FDL_ChannelHandler *gFdlUsedChannel; @@ -180,7 +181,7 @@ end: packet_ptr->pkt_state = PKT_RECV; //check the packet. CRC should be 0 #ifndef CONFIG_FRMCHECK - crc = crc_16_l_calc((unsigned short *)&packet_ptr->packet_body, packet_ptr->data_size); + crc = crc_16_l_calc((char *)&packet_ptr->packet_body, packet_ptr->data_size); #else crc = frm_chk((unsigned short *)&packet_ptr->packet_body, packet_ptr->data_size); #endif @@ -274,7 +275,7 @@ uint32 FDL_DataProcess (PACKET_T *packet_ptr_src, PACKET_T *packet_ptr_dest) /*src CRC calculation*/ #ifndef CONFIG_FRMCHECK - crc = crc_16_l_calc ( (const unsigned short *) (& (packet_ptr_src->packet_body)), size + PACKET_HEADER_SIZE); + crc = crc_16_l_calc ( (char *) (& (packet_ptr_src->packet_body)), size + PACKET_HEADER_SIZE); #else crc = frm_chk ( (const unsigned short *) (& (packet_ptr_src->packet_body)), size + PACKET_HEADER_SIZE); diff --git a/nand_fdl/common/src/usb_boot.c b/nand_fdl/common/src/usb_boot.c index 13b9cbd..b8e029d 100644 --- a/nand_fdl/common/src/usb_boot.c +++ b/nand_fdl/common/src/usb_boot.c @@ -59,6 +59,7 @@ extern "C" LOCAL __align(32) uint8 s_usb_snd_buff[USB_BUFF_SIZE]; /*--------------------------- Global Data -----------------------------------*/ /*--------------------------- External Data ---------------------------------*/ +extern void usb_core_init (void); /*----------------------------------------------------------------------------* ** Local Function Prototype * **---------------------------------------------------------------------------*/ @@ -150,13 +151,13 @@ void usb_write (unsigned char *write_buf,unsigned int write_len) } extern char VCOM_GetChar (void); extern int VCOM_GetSingleChar (void); -extern int VCOM_Read(const unsigned char *buf, unsigned int len); +extern int VCOM_Read(unsigned char *buf, unsigned int len); static int FDL_UsbOpen (struct FDL_ChannelHandler *channel, unsigned int baudrate) { return 0; } -static int FDL_UsbRead (struct FDL_ChannelHandler *channel, const unsigned char *buf, unsigned int len) +static int FDL_UsbRead (struct FDL_ChannelHandler *channel, unsigned char *buf, unsigned int len) { return VCOM_Read(buf, len); } diff --git a/nand_fdl/common/src/virtual_com.c b/nand_fdl/common/src/virtual_com.c index b3381db..fae5758 100644 --- a/nand_fdl/common/src/virtual_com.c +++ b/nand_fdl/common/src/virtual_com.c @@ -52,7 +52,7 @@ __align (4) const uint8 ConfigDescrSerial_64[] = // Author: Daniel.Ding // Note: /*****************************************************************************/ -uint8 *UCOM_Get_DevDesc() +uint8 *UCOM_Get_DevDesc(void) { return (uint8 *) DeviceDescrSerial; } @@ -63,7 +63,7 @@ uint8 *UCOM_Get_DevDesc() // Note: /*****************************************************************************/ -uint8 *UCOM_Get_CfgDesc() +uint8 *UCOM_Get_CfgDesc(void) { return (uint8 *) ConfigDescrSerial_64; } -- 2.7.4 From 40c2b5fcf55344975451910532b7da9005750253 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 12:43:38 +0900 Subject: [PATCH 09/16] mmc: sprd: remove build warnings Remove build warnings from sprd mmc driver. Change-Id: I18bea9d21c45d814bb71ada654dad4549c059d7e Signed-off-by: Seung-Woo Kim --- drivers/mmc/card_sdio.c | 42 ++++++++++++++++++++---------------------- drivers/mmc/card_sdio.h | 4 +++- drivers/mmc/mmc.c | 8 +++----- drivers/mmc/mv_sdhci.c | 8 ++++---- drivers/mmc/sdhci.c | 5 +++++ drivers/mmc/sdhost_phy.c | 24 +++++++++++++++++------- drivers/mmc/sdio_card_pal.c | 10 +++++----- 7 files changed, 57 insertions(+), 44 deletions(-) diff --git a/drivers/mmc/card_sdio.c b/drivers/mmc/card_sdio.c index cfd86c3..b946774 100644 --- a/drivers/mmc/card_sdio.c +++ b/drivers/mmc/card_sdio.c @@ -17,6 +17,8 @@ ** Dependencies * **---------------------------------------------------------------------------*/ +#include +#include #include "asm/arch/sci_types.h" #include "asm/arch/os_api.h" #include "card_sdio.h" @@ -24,6 +26,13 @@ #ifdef MBBMS_SUPPORT #include "sdua_config.h" #endif +#if defined(CONFIG_SC8830) +#include +#endif + +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif #define CARD_SDIO_HIGHSPEED_SUPPORT @@ -363,11 +372,13 @@ LOCAL CARD_PORT_T cardPort[CARD_SDIO_SLOT_MAX] = {0}; extern int LDO_Init(void); extern void SDIO_Card_Pal_SetType(SDIO_CARD_PAL_HANDLE handle, SDIO_CARD_PAL_TYPE_E sdio_type); +extern int sprd_gpio_request(struct gpio_chip *chip, unsigned offset); +extern int sprd_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value); //----------------------------------------------------------------------------------- // To judge whether the handle is valid //----------------------------------------------------------------------------------- -LOCAL BOOLEAN _IsCardHandleValid(CARD_SDIO_HANDLE cardHandle) +LOCAL BOOLEAN __maybe_unused _IsCardHandleValid(CARD_SDIO_HANDLE cardHandle) { uint32 i; @@ -454,7 +465,7 @@ PUBLIC void CARD_SDIO_PwrCtl(CARD_SDIO_HANDLE cardHandle,BOOLEAN switchCtl) //----------------------------------------------------------------------------------- // Analyze SD CID buffer //----------------------------------------------------------------------------------- -LOCAL void _SD_CID_Analyze(uint8* CIDbuf,CARD_SD_CID_T *CID) +LOCAL void __maybe_unused _SD_CID_Analyze(uint8* CIDbuf,CARD_SD_CID_T *CID) { uint16 tmp16; uint32 tmp32; @@ -1391,7 +1402,6 @@ LOCAL BOOLEAN MMC_SWITCH(CARD_SDIO_HANDLE cardHandle, uint8 index, uint8 value) BOOLEAN CARD_SDIO_Select_CurPartition(CARD_SDIO_HANDLE cardHandle, CARD_EMMC_PARTITION_TPYE cardPartiton) { uint8 rspBuf[16]; - uint16 RCA = cardHandle->RCA; uint32 argument = 0; argument = CMD6_ACCESS_MODE_WRITE_BYTE | ( EXT_CSD_PARTITION_CFG_INDEX<RCA; uint32 argument = 0; argument = CMD6_ACCESS_MODE_WRITE_BYTE | ( EXT_CSD_BUS_WIDTH_INDEX<currentVal = ((resBuf[0]<<8)|(resBuf[1])); cmdStatus->grp6Supported = ((resBuf[2]<<8)|(resBuf[3])); @@ -1642,10 +1651,6 @@ PUBLIC BOOLEAN CARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE s CARD_CSD_T CSD; CARD_BUS_WIDTH_E busWidth = CARD_WIDTH_1_BIT; uint16 RCA; - BOOLEAN vertion_flag; //TRUE: SD2.0 FALSE: SD1.x - SDIO_CARD_PAL_ERROR_E errCode; - - uint8 extcsd_Part_Config; CARD_SDIO_ASSERT(TRUE == _IsCardHandleValid(cardHandle)); /*assert verified*/ @@ -1739,7 +1744,6 @@ PUBLIC BOOLEAN CARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE s { cardHandle->Capacity = (((uint32)s_extcsdbuf[215])<<24)+ (((uint32)s_extcsdbuf[214])<<16)+ (((uint32)s_extcsdbuf[213])<<8)+ ((uint32)s_extcsdbuf[212]); //unit is 512 byte } - extcsd_Part_Config = s_extcsdbuf[179]; cardHandle->Rpmb_Capacity = s_extcsdbuf[168]*256; //128/512 ==256 ,unit is 512 byte if(SDIO_CARD_PAL_ERR_NONE != SDIO_Card_Pal_SendCmd(cardHandle->sdioPalHd,CARD_CMD13_SEND_STATUS, 1<<16,NULL,rspBuf)) { @@ -1753,7 +1757,6 @@ PUBLIC BOOLEAN CARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE s return FALSE; } CARD_SDIO_ReadExtCSD(cardHandle); - extcsd_Part_Config = s_extcsdbuf[179]; cardHandle->Boot1_Capacity = s_extcsdbuf[226]*256; //128/512 ==256 ,unit is 512 byte if(SDIO_CARD_PAL_ERR_NONE != SDIO_Card_Pal_SendCmd(cardHandle->sdioPalHd,CARD_CMD13_SEND_STATUS, 1<<16,NULL,rspBuf)) { @@ -1767,7 +1770,6 @@ PUBLIC BOOLEAN CARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE s return FALSE; } CARD_SDIO_ReadExtCSD(cardHandle); - extcsd_Part_Config = s_extcsdbuf[179]; cardHandle->Boot2_Capacity = s_extcsdbuf[226]*256; //128/512 ==256 ,unit is 512 byte if(SDIO_CARD_PAL_ERR_NONE != SDIO_Card_Pal_SendCmd(cardHandle->sdioPalHd,CARD_CMD13_SEND_STATUS, 1<<16,NULL,rspBuf)) { @@ -1927,10 +1929,10 @@ PUBLIC BOOLEAN SDSetBusWidth(CARD_SDIO_HANDLE cardHandle, CARD_BUS_WIDTH_E width uint8 CARD_SDIO_getCID(unsigned int *uid) { - uid[0] = g_CID.MMC_CID.MID << 24 | g_CID.MMC_CID.OID & 0xff << 16 | (g_CID.MMC_CID.OID >> 8) & 0xff << 8 | g_CID.MMC_CID.PNM[0]; - uid[1] = g_CID.MMC_CID.PNM[1] << 24 | g_CID.MMC_CID.PNM[2] << 16 | g_CID.MMC_CID.PNM[3] << 8 | g_CID.MMC_CID.PNM[4]; - uid[2] = g_CID.MMC_CID.PRV << 24 | g_CID.MMC_CID.PSN & 0xff << 16 | (g_CID.MMC_CID.PSN >> 8) & 0xff << 8 | (g_CID.MMC_CID.PSN >> 16) & 0xff; - uid[3] = (g_CID.MMC_CID.PSN >> 24) & 0xff << 24 | g_CID.MMC_CID.MDT & 0xff << 16 | (g_CID.MMC_CID.MDT >> 8) & 0xff << 8 | 1; + uid[0] = (g_CID.MMC_CID.MID << 24) | ((g_CID.MMC_CID.OID & 0xff) << 16) | (((g_CID.MMC_CID.OID >> 8) & 0xff) << 8) | g_CID.MMC_CID.PNM[0]; + uid[1] = (g_CID.MMC_CID.PNM[1] << 24) | (g_CID.MMC_CID.PNM[2] << 16) | (g_CID.MMC_CID.PNM[3] << 8) | (g_CID.MMC_CID.PNM[4]); + uid[2] = (g_CID.MMC_CID.PRV << 24) | ((g_CID.MMC_CID.PSN & 0xff) << 16) | (((g_CID.MMC_CID.PSN >> 8) & 0xff) << 8) | ((g_CID.MMC_CID.PSN >> 16) & 0xff); + uid[3] = (((g_CID.MMC_CID.PSN >> 24) & 0xff) << 24) | ((g_CID.MMC_CID.MDT & 0xff) << 16) | (((g_CID.MMC_CID.MDT >> 8) & 0xff) << 8) | 1; return 1; } @@ -1950,7 +1952,6 @@ PUBLIC BOOLEAN SDCARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE uint8 rspBuf[16]; uint32 pre_tick, cur_tick,temp; CARD_CSD_T CSD; - CARD_BUS_WIDTH_E busWidth = CARD_WIDTH_1_BIT; uint16 RCA; BOOLEAN vertion_flag; //TRUE: SD2.0 FALSE: SD1.x SDIO_CARD_PAL_ERROR_E errCode; @@ -1961,7 +1962,6 @@ PUBLIC BOOLEAN SDCARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE cardHandle->BlockLen = 0; cardHandle->vertion = CARD_V_UNKONWN; #if defined(CONFIG_SC8830) -#include temp = (*(volatile unsigned int *)((SPRD_PIN_PHYS+REG_PIN_SD0_D3))); *((volatile unsigned int *)(SPRD_PIN_PHYS+REG_PIN_SD0_D3)) = BIT_PIN_NULL|BITS_PIN_DS(1)|BITS_PIN_AF(3)|BIT_PIN_SLP_NUL|BIT_PIN_SLP_Z; @@ -2780,10 +2780,8 @@ PUBLIC BOOLEAN SDCARD_Read(uint32 startBlcok, uint32 blkCnt, uint8* buf) return SDCARD_SDIO_ReadMultiBlock(sdcard_handle, startBlcok, blkCnt, buf); } -PUBLIC BOOLEAN SDCARD_Init() +PUBLIC BOOLEAN SDCARD_Init(void) { - uint32 ret = 0; - sdcard_handle = CARD_SDIO_Open(CARD_SDIO_SLOT_6); SDIO_Card_Pal_SetType(sdcard_handle->sdioPalHd, SDIO_CARD_PAL_TYPE_SD); @@ -2794,7 +2792,7 @@ PUBLIC BOOLEAN SDCARD_Init() #endif -PUBLIC BOOLEAN SDCARD_PowerOn() +PUBLIC BOOLEAN SDCARD_PowerOn(void) { sdcard_handle = CARD_SDIO_Open(CARD_SDIO_SLOT_6); SDIO_Card_Pal_SetType(sdcard_handle->sdioPalHd, SDIO_CARD_PAL_TYPE_SD); diff --git a/drivers/mmc/card_sdio.h b/drivers/mmc/card_sdio.h index dc06ad9..b090ab8 100644 --- a/drivers/mmc/card_sdio.h +++ b/drivers/mmc/card_sdio.h @@ -202,7 +202,9 @@ PUBLIC BOOLEAN Emmc_Read(CARD_EMMC_PARTITION_TPYE cardPartiton, uint32 startBlo PUBLIC uint32 Emmc_GetCapacity(CARD_EMMC_PARTITION_TPYE cardPartiton); -PUBLIC void Emmc_DisSdClk(); +PUBLIC void Emmc_DisSdClk(void); + +PUBLIC BOOLEAN SDCARD_PowerOn(void); #endif diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 4aa00a3..0e26394 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -54,6 +54,7 @@ #include #include #endif +#include "card_sdio.h" static struct list_head mmc_devices; static int cur_dev_num = -1; @@ -1018,11 +1019,8 @@ int mmc_initialize(bd_t *bis) #define MMCSD_SECTOR_SIZE 512 int mmc_legacy_init(int dev) { + int rc = -ENODEV; printf("mmc_legacy_init\n"); - int retries, rc = -ENODEV; - uint32_t cid_resp[4]; - uint32_t *resp; - uint16_t rca = 0; if(TRUE == Emmc_Init()) { @@ -1050,7 +1048,7 @@ int mmc_legacy_init(int dev) #endif #ifdef CONFIG_GENERIC_MMC -int mmc_sdcard_init() +int mmc_sdcard_init(void) { #if defined(CONFIG_SC8830) || defined(CONFIG_SC9630) if (TRUE == SDCARD_PowerOn()) { diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index dc0391f..d9de0ac 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -15,7 +15,7 @@ void sdhci_dumpregs(struct sdhci_host *host) printf(KERN_DEBUG DRIVER_NAME ":AHB CTRL 0x%08x\n", *((unsigned int*)0x20900200)); #if 1 for(i = 0; i < MAX_DUMP_NUM; i++){ - printf(KERN_DEBUG DRIVER_NAME ": address 0x%08x | value 0x%08x\n", host->ioaddr + i*4, sdhci_readl(host, i*4)); + printf(KERN_DEBUG DRIVER_NAME ": address 0x%08lx | value 0x%08x\n", (unsigned long)host->ioaddr + i*4, sdhci_readl(host, i*4)); } #endif @@ -60,10 +60,10 @@ void sdhci_dumpregs(struct sdhci_host *host) #define __raw_bits_and(v, a) writel((readl(a)&v), a) #define __raw_bits_or(v, a) writel((readl(a)|v), a) + +#if !defined(CONFIG_SC8830) && !defined(CONFIG_SC9630) static void sdhci_sprd_set_base_clock(unsigned int clock) { - unsigned long flags; - /* don't bother if the clock is going off. */ if (clock == 0) return; @@ -89,7 +89,7 @@ static void sdhci_sprd_set_base_clock(unsigned int clock) __raw_readl(GR_CLK_GEN5)); return; } - +#endif #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS static struct sdhci_ops mv_ops; diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 8394221..d677de4 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -29,6 +29,11 @@ #include #include +#ifdef CONFIG_MMC_SDMA +extern void Dcache_InvalRegion(unsigned int addr, unsigned int length); +extern void Dcache_CleanRegion(unsigned int addr, unsigned int length); +#endif + void *aligned_buffer; void sdhci_dumpregs(struct sdhci_host *host); diff --git a/drivers/mmc/sdhost_phy.c b/drivers/mmc/sdhost_phy.c index 26586db..33e7973 100644 --- a/drivers/mmc/sdhost_phy.c +++ b/drivers/mmc/sdhost_phy.c @@ -50,6 +50,11 @@ #else #define SDHOST_PRINT(x) SCI_TRACE_LOW x #endif + +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + /*****************************************************************************/ // Description: Handle of sdhost // Author: Jason.wu @@ -91,10 +96,9 @@ typedef struct LOCAL SDHOST_PORT_T sdio_port_ctl[SDHOST_SLOT_MAX_NUM]; #ifndef OS_NONE LOCAL DEVICE_HANDLE s_dev_sdio = SCI_NULL; +LOCAL void SdhostHisrFunc (uint32 cnt, void *pData); #endif - PUBLIC ISR_EXE_T _SDHOST_IrqHandle (uint32 isrnum); -LOCAL void SdhostHisrFunc (uint32 cnt, void *pData); PUBLIC void SDHOST_Delayus(uint32 usec) { @@ -112,7 +116,7 @@ PUBLIC void SDHOST_Delayus(uint32 usec) // FALSE:the handle is not valid // Note: /*****************************************************************************/ -LOCAL BOOLEAN _RegisterVerifyHOST (SDHOST_HANDLE sdhost_handler) +LOCAL BOOLEAN __maybe_unused _RegisterVerifyHOST (SDHOST_HANDLE sdhost_handler) { uint32 index; @@ -1618,7 +1622,7 @@ PUBLIC void SDHOST_GetRspFromBuf (SDHOST_HANDLE sdhost_handler,CMD_RSP_TYPE_E Re // NONE // Note: /*****************************************************************************/ -LOCAL void _GetSDHOSTCapbility (SDHOST_HANDLE sdhost_handler,SDHOST_CAPBILIT_T *capbility) +LOCAL void __maybe_unused _GetSDHOSTCapbility (SDHOST_HANDLE sdhost_handler,SDHOST_CAPBILIT_T *capbility) { volatile uint32 tmpReg; SCI_MEMSET (capbility,0,sizeof (SDHOST_CAPBILIT_T)); @@ -2336,13 +2340,13 @@ PUBLIC void SDHOST_SetErrCodeFilter (SDHOST_HANDLE sdhost_handler,uint32 err_msg // uint32 value: indicate which slot event happened // Note: /*****************************************************************************/ -LOCAL SDHOST_SLOT_NO _GetIntSDHOSTSlotNum (uint32 port) +LOCAL SDHOST_SLOT_NO __maybe_unused _GetIntSDHOSTSlotNum (uint32 port) { - uint32 tmpReg; SDHOST_SLOT_NO ret; #if defined(CONFIG_SC8830) || (defined CONFIG_SC9630) ret = SDHOST_SLOT_7; #else + uint32 tmpReg; #if defined(CONFIG_TIGER)|| defined (CONFIG_SC7710G2) if(SDHOST_SLOT_6 == port){ tmpReg = REG32 (SDIO2_NML_INT_SIG_EN); @@ -2470,6 +2474,7 @@ PUBLIC ISR_EXE_T _SDHOST_IrqHandle (uint32 isrnum) return CALL_HISR; } +#ifndef OS_NONE /*****************************************************************************/ // Description: This function is SDIO 's HISR. // 1. THE priority is higher than normal task. @@ -2486,7 +2491,9 @@ LOCAL void SdhostHisrFunc (uint32 cnt, void *pData) buffer.pSdhost_handler->sigCallBack (buffer.msg, buffer.errCode, buffer.slotNum); } } +#endif +#if !defined (CONFIG_SC8825) && !defined(CONFIG_SPX15) && !defined(CONFIG_SPX30G) && !defined(CONFIG_SC9630) && !defined (CONFIG_SC8830) && !defined(CONFIG_SC7710G2) LOCAL void _SDHOST_Pin_select(SDHOST_SLOT_NO slot_NO) { if(slot_NO == SDHOST_SLOT_1){ @@ -2498,6 +2505,7 @@ LOCAL void _SDHOST_Pin_select(SDHOST_SLOT_NO slot_NO) *(volatile uint32*)(0x8c0003fc) = 0x280; //SD1 D3 pullup drv3, strongest strength } } +#endif /*****************************************************************************/ // Description: Regist host slot @@ -2512,7 +2520,9 @@ LOCAL void _SDHOST_Pin_select(SDHOST_SLOT_NO slot_NO) /*****************************************************************************/ PUBLIC SDHOST_HANDLE SDHOST_Register (SDHOST_SLOT_NO slot_NO,SDIO_CALLBACK fun) { - uint32 status = 0, i = 0; +#ifndef OS_NONE + uint32 status = 0; +#endif SCI_ASSERT (slot_NO < SDHOST_SLOT_MAX_NUM);/*assert verified*/ diff --git a/drivers/mmc/sdio_card_pal.c b/drivers/mmc/sdio_card_pal.c index b562961..08ea460 100644 --- a/drivers/mmc/sdio_card_pal.c +++ b/drivers/mmc/sdio_card_pal.c @@ -1,7 +1,8 @@ - +#include #include "asm/arch/sci_types.h" #include "sdio_card_pal.h" #include "sdhost_drv.h" +#include "asm/arch/isr_drvapi.h" #include "asm/arch/mmu_drvapi.h" //#include "asm/arch/chng_freq.h" #include "asm/arch/sc_reg.h" @@ -44,6 +45,9 @@ #endif /*-----------------------------------------*/ +extern void Dcache_InvalRegion(unsigned int addr, unsigned int length); +extern void Dcache_CleanRegion(unsigned int addr, unsigned int length); +extern ISR_EXE_T _SDHOST_IrqHandle (uint32 isrnum); typedef struct { @@ -749,10 +753,6 @@ PUBLIC SDIO_CARD_PAL_ERROR_E SDIO_Card_Pal_SendCmd ( #endif curCmdInfo = &s_cmdDetail[cmd]; - -#ifdef OS_NONE - uint32 isr_status; -#endif SDIO_CARD_PRINT(("%s : cmd:%x, cmdIndex:%x, argument:%x\r\n", __FUNCTION__, cmd, curCmdInfo->cmdIndex, argument)); SDIO_CARD_PAL_ASSERT ( /*assert verified*/ -- 2.7.4 From 5c9df9258ad660ab44f4c692c1577c8a6915347d Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 15:38:12 +0900 Subject: [PATCH 10/16] spi: sprd: remove build warnings Remove build warnings from sprd spi driver. Change-Id: I59d195f8ff6b2d21d1c2ae7b7eb6fbcfabc5198b Signed-off-by: Seung-Woo Kim --- arch/arm/include/asm/arch-sc8830/sprd_spi.h | 2 +- drivers/spi/sprd_spi.c | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/arch/arm/include/asm/arch-sc8830/sprd_spi.h b/arch/arm/include/asm/arch-sc8830/sprd_spi.h index aa6277f..d1b2bad 100644 --- a/arch/arm/include/asm/arch-sc8830/sprd_spi.h +++ b/arch/arm/include/asm/arch-sc8830/sprd_spi.h @@ -214,7 +214,7 @@ extern "C" PUBLIC void SPI_SetRxLen(uint32 data_len, uint32 dummy_bitlen); PUBLIC void SPI_TxReq( void ); PUBLIC void SPI_RxReq( void ); - PUBLIC void SPI_WaitTxFinish(); + PUBLIC void SPI_WaitTxFinish(void); PUBLIC void SPI_Init(SPI_INIT_PARM *spi_parm); PUBLIC void SPI_WriteData(uint32 data, uint32 data_len, uint32 dummy_bitlen); diff --git a/drivers/spi/sprd_spi.c b/drivers/spi/sprd_spi.c index 1fffaf7..6cbddfa 100644 --- a/drivers/spi/sprd_spi.c +++ b/drivers/spi/sprd_spi.c @@ -91,10 +91,10 @@ PUBLIC void SPI_Enable( uint32 spi_id, BOOLEAN is_en) PUBLIC void SPI_Reset( uint32 spi_id, uint32 ms) { - uint32 i = 0; #if defined(CONFIG_SC8830) || defined(CONFIG_SC9630) - #else + uint32 i = 0; + if(spi_id == 0) { *(volatile uint32 *)GR_SOFT_RST |= (1 << 14); @@ -116,12 +116,6 @@ PUBLIC void SPI_Reset( uint32 spi_id, uint32 ms) #endif } - -LOCAL void SPI_PinConfig(void) -{ -} - - // The dividend is clk_spiX_div[1:0] + 1 PUBLIC void SPI_ClkSetting(uint32 spi_id, uint32 clk_src, uint32 clk_div) { @@ -150,7 +144,6 @@ PUBLIC void SPI_ClkSetting(uint32 spi_id, uint32 clk_src, uint32 clk_div) PUBLIC void SPI_SetCsLow( uint32 spi_sel_csx , BOOLEAN is_low) { volatile SPI_CTL_REG_T *spi_ctr_ptr = (volatile SPI_CTL_REG_T*)(SPI_USED_BASE); - uint32 temp; if(is_low) { //spi_ctl0[11:8]:cs3<->cs0 chip select, 0-selected;1-none @@ -332,7 +325,6 @@ PUBLIC void SPI_Init(SPI_INIT_PARM *spi_parm) { volatile SPI_CTL_REG_T *spi_ctr_ptr = (volatile SPI_CTL_REG_T *)(SPI_USED_BASE); uint32 temp; - uint32 ctl0, ctl1, ctl2, ctl3; /*default clk is 500k 192M /(0xc0 * 2)*/ spi_ctr_ptr->clkd =0xc0; @@ -363,11 +355,11 @@ PUBLIC void SPI_Init(SPI_INIT_PARM *spi_parm) #endif } -PUBLIC void SPI_WaitTxFinish() +PUBLIC void SPI_WaitTxFinish(void) { volatile SPI_CTL_REG_T *spi_ctr_ptr = (volatile SPI_CTL_REG_T *)(SPI_USED_BASE); - while( !(spi_ctr_ptr->iraw)&BIT_8 ) // IS tx finish + while( !((spi_ctr_ptr->iraw)&BIT_8) ) // IS tx finish { } spi_ctr_ptr->iclr |= BIT_8; @@ -384,7 +376,6 @@ PUBLIC void SPI_WaitTxFinish() PUBLIC void SPI_WriteData(uint32 data, uint32 data_len, uint32 dummy_bitlen) { - uint32 command; volatile SPI_CTL_REG_T *spi_ctr_ptr = (volatile SPI_CTL_REG_T *)(SPI_USED_BASE); // The unit of data_len is identical with buswidth -- 2.7.4 From b98127f6bde53a107420a395f97efe8cac9c0244 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 16:58:53 +0900 Subject: [PATCH 11/16] usb: dwc_otg: remove build warnings Remove build warnings. Change-Id: I19ec76087004120706834e7547d9413f4ee429f3 Signed-off-by: Seung-Woo Kim --- drivers/usb/gadget/dwc_otg/dwc_otg_cil.c | 20 +- drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c | 6 +- drivers/usb/gadget/dwc_otg/dwc_otg_driver.c | 349 ++----------------------- drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c | 13 +- drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c | 12 +- drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c | 56 +--- 6 files changed, 50 insertions(+), 406 deletions(-) diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c b/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c index aafc4c5..4fbe5da 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c @@ -61,6 +61,10 @@ #include "dwc_otg_regs.h" #include "dwc_otg_cil.h" +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + static int in_calibration = 0; static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if); @@ -433,7 +437,9 @@ static uint32_t calc_num_in_eps(dwc_otg_core_if_t * core_if) uint32_t num_in_eps = 0; uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; +#if 0 uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; +#endif int i; for (i = 0; i < num_eps; ++i) { @@ -2883,7 +2889,7 @@ void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) if (ep->is_in == 1) { dwc_otg_dev_in_ep_regs_t *in_regs = core_if->dev_if->in_ep_regs[0]; - gnptxsts_data_t tx_status = {.d32 = 0 }; + __maybe_unused gnptxsts_data_t tx_status = {.d32 = 0 }; tx_status.d32 = dwc_read_reg32(&core_if->core_global_regs->gnptxsts); @@ -3254,7 +3260,7 @@ void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * core_if) { int i; - volatile uint32_t *addr; + __maybe_unused volatile uint32_t *addr; DWC_DEBUGPL(DBG_CIL,"Device Global Registers\n"); addr = &core_if->dev_if->dev_global_regs->dcfg; @@ -3411,7 +3417,7 @@ DWC_DEBUGPL(DBG_CIL,"0x%8X:\t%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) { int i; - volatile uint32_t *addr; + __maybe_unused volatile uint32_t *addr; DWC_DEBUGPL(DBG_CIL,"Host Global Registers\n"); addr = &core_if->host_if->host_global_regs->hcfg; @@ -3468,7 +3474,7 @@ void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) void dwc_otg_dump_global_registers(dwc_otg_core_if_t * core_if) { int i; - volatile uint32_t *addr; + __maybe_unused volatile uint32_t *addr; DWC_DEBUGPL(DBG_CIL,"Core Global Registers\n"); addr = &core_if->core_global_regs->gotgctl; @@ -5086,7 +5092,7 @@ uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if) void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val) { - hprt0_data_t hprt0; + __maybe_unused hprt0_data_t hprt0; hprt0.d32 = dwc_read_reg32(core_if->host_if->hprt0); hprt0.b.prtpwr = val; dwc_write_reg32(core_if->host_if->hprt0, val); @@ -5102,7 +5108,7 @@ uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if) void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) { - hprt0_data_t hprt0; + __maybe_unused hprt0_data_t hprt0; hprt0.d32 = dwc_read_reg32(core_if->host_if->hprt0); hprt0.b.prtsusp = val; dwc_write_reg32(core_if->host_if->hprt0, val); @@ -5110,7 +5116,7 @@ void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val) { - hprt0_data_t hprt0; + __maybe_unused hprt0_data_t hprt0; hprt0.d32 = dwc_read_reg32(core_if->host_if->hprt0); hprt0.b.prtres = val; dwc_write_reg32(core_if->host_if->hprt0, val); diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c index cd7bef6..0e6cf72 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c @@ -43,6 +43,10 @@ #include "dwc_otg_regs.h" #include "dwc_otg_cil.h" +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #ifdef DEBUG inline const char *op_state_str(dwc_otg_core_if_t * core_if) { @@ -648,7 +652,7 @@ int32_t dwc_otg_handle_disconnect_intr(dwc_otg_core_if_t * core_if) */ int32_t dwc_otg_handle_usb_suspend_intr(dwc_otg_core_if_t * core_if) { - dsts_data_t dsts; + __maybe_unused dsts_data_t dsts; gintsts_data_t gintsts; DWC_DEBUGPL(DBG_ANY, "USB SUSPEND\n"); diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c b/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c index d910b39..dd6fc28 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c @@ -63,23 +63,28 @@ #include "dwc_otg_pcd_if.h" #include +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #define DWC_DRIVER_VERSION "2.81a 04-FEB-2009" #define DWC_DRIVER_DESC "HS OTG USB Controller driver" -static const char dwc_driver_name[] = "dwc_otg"; +__maybe_unused static const char dwc_driver_name[] = "dwc_otg"; +#ifndef DWC_HOST_ONLY extern int pcd_init( struct dwc_otg_device *_dev ); +extern int pcd_remove( + struct dwc_otg_device *_dev + ); +#endif /* extern int hcd_init( struct platform_device *_dev ); -extern int pcd_remove( - struct platform_device *_dev - ); - extern void hcd_remove( struct platform_device *_dev ); @@ -492,24 +497,6 @@ static int set_parameters(dwc_otg_core_if_t * core_if) } /** - * This function is the top level interrupt handler for the Common - * (Device and host modes) interrupts. - */ - -/* -static irqreturn_t dwc_otg_common_irq(int irq, void *dev) -{ - dwc_otg_device_t *otg_dev = dev; - int32_t retval = IRQ_NONE; - - retval = dwc_otg_handle_common_intr(otg_dev->core_if); - if (retval != 0) { - S3C2410X_CLEAR_EINTPEND(); - } - return IRQ_RETVAL(retval); -} -*/ -/** * This function is called when a lm_device is unregistered with the * dwc_otg_driver. This happens, for example, when the rmmod command is * executed. The device may or may not be electrically present. If it is @@ -548,14 +535,6 @@ static int dwc_otg_driver_remove(void) pcd_remove(dwc_otg_device); } #endif - /* - * Free the IRQ - */ -#if 0 //sword - if (otg_dev->common_irq_installed) { - free_irq(_dev->irq, otg_dev); - } -#endif if (dwc_otg_device->core_if) { dwc_otg_cil_remove(dwc_otg_device->core_if); } @@ -603,7 +582,6 @@ static int dwc_otg_driver_probe(void) { int retval = 0; //dwc_otg_device_t *dwc_otg_device; - int irq; dwc_debug("dwc_otg_driver_probe(%p)\n", dwc_otg_device); @@ -623,7 +601,7 @@ static int dwc_otg_driver_probe(void) */ //dwc_otg_device->base = platform_get_resource(_dev, IORESOURCE_MEM, 0)->start; - dwc_otg_device->base = USB_PHYS; + dwc_otg_device->base = (void *)USB_PHYS; if (!dwc_otg_device->base) { dwc_debug("ioremap() failed\n"); @@ -631,11 +609,7 @@ static int dwc_otg_driver_probe(void) goto fail; } dwc_debug("base=0x%x\n", (unsigned)dwc_otg_device->base); -/* - irq = platform_get_irq(_dev, 0); - dwc_debug(&_dev->dev, "base=0x%08x irq:%d\n", (unsigned)dwc_otg_device->base, - irq); -*/ + /* * Initialize driver data to point to the global DWC_otg * Device structure. @@ -691,26 +665,6 @@ static int dwc_otg_driver_probe(void) dwc_otg_disable_global_interrupts(dwc_otg_device->core_if); /* - * Install the interrupt handler for the common interrupts before - * enabling common interrupts in core_init below. - */ - DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n", - irq); -//sword -/* - retval = request_irq(irq, dwc_otg_common_irq, - 0, "dwc_otg", dwc_otg_device); - //SA_SHIRQ, "dwc_otg", dwc_otg_device); - if (retval) { - DWC_ERROR("request of irq%d failed\n", irq); - retval = -EBUSY; - goto fail; - } else { - dwc_otg_device->common_irq_installed = 1; - } -*/ - - /* * Initialize the DWC_otg core. */ dwc_otg_core_init(dwc_otg_device->core_if); @@ -754,29 +708,6 @@ fail: } /** - * This structure defines the methods to be called by a bus driver - * during the lifecycle of a device on that bus. Both drivers and - * devices are registered with a bus driver. The bus driver matches - * devices to drivers based on information in the device and driver - * structures. - * - * The probe function is called when the bus driver matches a device - * to this driver. The remove function is called when a device is - * unregistered with the bus driver. - */ - #if 0 -static struct platform_driver dwc_otg_driver = { - .driver = { - .name = "dwc_otg", - .owner = THIS_MODULE, - }, - - .probe = dwc_otg_driver_probe, - .remove = dwc_otg_driver_remove, - -}; - #endif -/** * This function is called when the dwc_otg_driver is installed with the * insmod command. It registers the dwc_otg_driver structure with the * appropriate bus driver. This will cause the dwc_otg_driver_probe function @@ -790,23 +721,19 @@ static struct platform_driver dwc_otg_driver = { int dwc_otg_driver_init(void) { int retval = 0; - int error; + dwc_debug("%s: version %s\n", dwc_driver_name, DWC_DRIVER_VERSION); dwc_debug("Working version %s\n", "No 007 - 10/24/2007"); udc_power_on(); - - //retval = platform_driver_probe(&dwc_otg_driver, dwc_otg_driver_probe); + retval = dwc_otg_driver_probe(); if (retval < 0) { dwc_debug("%s retval=%d\n", __func__, retval); return retval; } -/* - error = driver_create_file(&dwc_otg_driver.driver, &driver_attr_version); - error = driver_create_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); -*/ + return retval; } void dwc_otg_driver_cleanup(void) @@ -822,252 +749,6 @@ int dwc_otg_driver_init(void) dwc_debug(KERN_INFO "%s module removed\n", dwc_driver_name); } -#if 0 -module_init(dwc_otg_driver_init); - -/** - * This function is called when the driver is removed from the kernel - * with the rmmod command. The driver unregisters itself with its bus - * driver. - * - */ -static void __exit dwc_otg_driver_cleanup(void) -{ - dwc_debug(KERN_DEBUG "dwc_otg_driver_cleanup()\n"); - - - driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); - driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); - platform_driver_unregister(&dwc_otg_driver); - - dwc_debug(KERN_INFO "%s module removed\n", dwc_driver_name); -} -module_exit(dwc_otg_driver_cleanup); - -MODULE_DESCRIPTION(DWC_DRIVER_DESC); -MODULE_AUTHOR("Synopsys Inc."); -MODULE_LICENSE("GPL"); - -module_param_named(otg_cap, dwc_otg_module_params.otg_cap, int, 0444); -MODULE_PARM_DESC(otg_cap, "OTG Capabilities 0=HNP&SRP 1=SRP Only 2=None"); -module_param_named(opt, dwc_otg_module_params.opt, int, 0444); -MODULE_PARM_DESC(opt, "OPT Mode"); -module_param_named(dma_enable, dwc_otg_module_params.dma_enable, int, 0444); -MODULE_PARM_DESC(dma_enable, "DMA Mode 0=Slave 1=DMA enabled"); - -module_param_named(dma_desc_enable, dwc_otg_module_params.dma_desc_enable, int, - 0444); -MODULE_PARM_DESC(dma_desc_enable, - "DMA Desc Mode 0=Address DMA 1=DMA Descriptor enabled"); - -module_param_named(dma_burst_size, dwc_otg_module_params.dma_burst_size, int, - 0444); -MODULE_PARM_DESC(dma_burst_size, - "DMA Burst Size 1, 4, 8, 16, 32, 64, 128, 256"); -module_param_named(speed, dwc_otg_module_params.speed, int, 0444); -MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); -module_param_named(host_support_fs_ls_low_power, - dwc_otg_module_params.host_support_fs_ls_low_power, int, - 0444); -MODULE_PARM_DESC(host_support_fs_ls_low_power, - "Support Low Power w/FS or LS 0=Support 1=Don't Support"); -module_param_named(host_ls_low_power_phy_clk, - dwc_otg_module_params.host_ls_low_power_phy_clk, int, 0444); -MODULE_PARM_DESC(host_ls_low_power_phy_clk, - "Low Speed Low Power Clock 0=48Mhz 1=6Mhz"); -module_param_named(enable_dynamic_fifo, - dwc_otg_module_params.enable_dynamic_fifo, int, 0444); -MODULE_PARM_DESC(enable_dynamic_fifo, "0=cC Setting 1=Allow Dynamic Sizing"); -module_param_named(data_fifo_size, dwc_otg_module_params.data_fifo_size, int, - 0444); -MODULE_PARM_DESC(data_fifo_size, - "Total number of words in the data FIFO memory 32-32768"); -module_param_named(dev_rx_fifo_size, dwc_otg_module_params.dev_rx_fifo_size, - int, 0444); -MODULE_PARM_DESC(dev_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); -module_param_named(dev_nperio_tx_fifo_size, - dwc_otg_module_params.dev_nperio_tx_fifo_size, int, 0444); -MODULE_PARM_DESC(dev_nperio_tx_fifo_size, - "Number of words in the non-periodic Tx FIFO 16-32768"); -module_param_named(dev_perio_tx_fifo_size_1, - dwc_otg_module_params.dev_perio_tx_fifo_size[0], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_1, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_2, - dwc_otg_module_params.dev_perio_tx_fifo_size[1], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_2, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_3, - dwc_otg_module_params.dev_perio_tx_fifo_size[2], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_3, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_4, - dwc_otg_module_params.dev_perio_tx_fifo_size[3], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_4, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_5, - dwc_otg_module_params.dev_perio_tx_fifo_size[4], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_5, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_6, - dwc_otg_module_params.dev_perio_tx_fifo_size[5], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_6, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_7, - dwc_otg_module_params.dev_perio_tx_fifo_size[6], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_7, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_8, - dwc_otg_module_params.dev_perio_tx_fifo_size[7], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_8, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_9, - dwc_otg_module_params.dev_perio_tx_fifo_size[8], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_9, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_10, - dwc_otg_module_params.dev_perio_tx_fifo_size[9], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_10, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_11, - dwc_otg_module_params.dev_perio_tx_fifo_size[10], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_11, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_12, - dwc_otg_module_params.dev_perio_tx_fifo_size[11], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_12, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_13, - dwc_otg_module_params.dev_perio_tx_fifo_size[12], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_13, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_14, - dwc_otg_module_params.dev_perio_tx_fifo_size[13], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_14, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(dev_perio_tx_fifo_size_15, - dwc_otg_module_params.dev_perio_tx_fifo_size[14], int, 0444); -MODULE_PARM_DESC(dev_perio_tx_fifo_size_15, - "Number of words in the periodic Tx FIFO 4-768"); -module_param_named(host_rx_fifo_size, dwc_otg_module_params.host_rx_fifo_size, - int, 0444); -MODULE_PARM_DESC(host_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); -module_param_named(host_nperio_tx_fifo_size, - dwc_otg_module_params.host_nperio_tx_fifo_size, int, 0444); -MODULE_PARM_DESC(host_nperio_tx_fifo_size, - "Number of words in the non-periodic Tx FIFO 16-32768"); -module_param_named(host_perio_tx_fifo_size, - dwc_otg_module_params.host_perio_tx_fifo_size, int, 0444); -MODULE_PARM_DESC(host_perio_tx_fifo_size, - "Number of words in the host periodic Tx FIFO 16-32768"); -module_param_named(max_transfer_size, dwc_otg_module_params.max_transfer_size, - int, 0444); -/** @todo Set the max to 512K, modify checks */ -MODULE_PARM_DESC(max_transfer_size, - "The maximum transfer size supported in bytes 2047-65535"); -module_param_named(max_packet_count, dwc_otg_module_params.max_packet_count, - int, 0444); -MODULE_PARM_DESC(max_packet_count, - "The maximum number of packets in a transfer 15-511"); -module_param_named(host_channels, dwc_otg_module_params.host_channels, int, - 0444); -MODULE_PARM_DESC(host_channels, - "The number of host channel registers to use 1-16"); -module_param_named(dev_endpoints, dwc_otg_module_params.dev_endpoints, int, - 0444); -MODULE_PARM_DESC(dev_endpoints, - "The number of endpoints in addition to EP0 available for device mode 1-15"); -module_param_named(phy_type, dwc_otg_module_params.phy_type, int, 0444); -MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI"); -module_param_named(phy_utmi_width, dwc_otg_module_params.phy_utmi_width, int, - 0444); -MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); -module_param_named(phy_ulpi_ddr, dwc_otg_module_params.phy_ulpi_ddr, int, 0444); -MODULE_PARM_DESC(phy_ulpi_ddr, - "ULPI at double or single data rate 0=Single 1=Double"); -module_param_named(phy_ulpi_ext_vbus, dwc_otg_module_params.phy_ulpi_ext_vbus, - int, 0444); -MODULE_PARM_DESC(phy_ulpi_ext_vbus, - "ULPI PHY using internal or external vbus 0=Internal"); -module_param_named(i2c_enable, dwc_otg_module_params.i2c_enable, int, 0444); -MODULE_PARM_DESC(i2c_enable, "FS PHY Interface"); -module_param_named(ulpi_fs_ls, dwc_otg_module_params.ulpi_fs_ls, int, 0444); -MODULE_PARM_DESC(ulpi_fs_ls, "ULPI PHY FS/LS mode only"); -module_param_named(ts_dline, dwc_otg_module_params.ts_dline, int, 0444); -MODULE_PARM_DESC(ts_dline, "Term select Dline pulsing for all PHYs"); -module_param_named(debug, g_dbg_lvl, int, 0444); -MODULE_PARM_DESC(debug, ""); - -module_param_named(en_multiple_tx_fifo, - dwc_otg_module_params.en_multiple_tx_fifo, int, 0444); -MODULE_PARM_DESC(en_multiple_tx_fifo, - "Dedicated Non Periodic Tx FIFOs 0=disabled 1=enabled"); -module_param_named(dev_tx_fifo_size_1, - dwc_otg_module_params.dev_tx_fifo_size[0], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_1, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_2, - dwc_otg_module_params.dev_tx_fifo_size[1], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_2, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_3, - dwc_otg_module_params.dev_tx_fifo_size[2], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_3, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_4, - dwc_otg_module_params.dev_tx_fifo_size[3], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_4, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_5, - dwc_otg_module_params.dev_tx_fifo_size[4], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_5, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_6, - dwc_otg_module_params.dev_tx_fifo_size[5], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_6, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_7, - dwc_otg_module_params.dev_tx_fifo_size[6], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_7, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_8, - dwc_otg_module_params.dev_tx_fifo_size[7], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_8, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_9, - dwc_otg_module_params.dev_tx_fifo_size[8], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_9, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_10, - dwc_otg_module_params.dev_tx_fifo_size[9], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_10, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_11, - dwc_otg_module_params.dev_tx_fifo_size[10], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_11, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_12, - dwc_otg_module_params.dev_tx_fifo_size[11], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_12, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_13, - dwc_otg_module_params.dev_tx_fifo_size[12], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_13, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_14, - dwc_otg_module_params.dev_tx_fifo_size[13], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_14, "Number of words in the Tx FIFO 4-768"); -module_param_named(dev_tx_fifo_size_15, - dwc_otg_module_params.dev_tx_fifo_size[14], int, 0444); -MODULE_PARM_DESC(dev_tx_fifo_size_15, "Number of words in the Tx FIFO 4-768"); - -module_param_named(thr_ctl, dwc_otg_module_params.thr_ctl, int, 0444); -MODULE_PARM_DESC(thr_ctl, - "Thresholding enable flag bit 0 - non ISO Tx thr., 1 - ISO Tx thr., 2 - Rx thr.- bit 0=disabled 1=enabled"); -module_param_named(tx_thr_length, dwc_otg_module_params.tx_thr_length, int, - 0444); -MODULE_PARM_DESC(tx_thr_length, "Tx Threshold length in 32 bit DWORDs"); -module_param_named(rx_thr_length, dwc_otg_module_params.rx_thr_length, int, - 0444); -MODULE_PARM_DESC(rx_thr_length, "Rx Threshold length in 32 bit DWORDs"); - -module_param_named(pti_enable, dwc_otg_module_params.pti_enable, int, 0444); -module_param_named(mpi_enable, dwc_otg_module_params.mpi_enable, int, 0444); -module_param_named(lpm_enable, dwc_otg_module_params.lpm_enable, int, 0444); -MODULE_PARM_DESC(lpm_enable, "LPM Enable 0=LPM Disabled 1=LPM Enabled"); -module_param_named(ic_usb_cap, dwc_otg_module_params.ic_usb_cap, int, 0444); -MODULE_PARM_DESC(ic_usb_cap, - "IC_USB Capability 0=IC_USB Disabled 1=IC_USB Enabled"); -module_param_named(ahb_thr_ratio, dwc_otg_module_params.ahb_thr_ratio, int, 0444); -MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio"); -#endif /** @page "Module Parameters" * * The following parameters may be specified when starting the module. diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c index 3e7bd01..c7ee72d 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c @@ -56,6 +56,10 @@ extern int init_cfi(cfiobject_t * cfiobj); #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #define DMA_ADDR_INVALID (~(dma_addr_t)0) static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) @@ -74,6 +78,7 @@ static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) return NULL; } +#if 0 static void dump_log(unsigned char * buf, int len, int direction) { #ifdef DEBUG @@ -89,6 +94,8 @@ static void dump_log(unsigned char * buf, int len, int direction) } #endif } +#endif + /** * This function completes a request. It call's the request call back. */ @@ -989,6 +996,7 @@ static void dwc_otg_pcd_reinit(dwc_otg_pcd_t * pcd) pcd->ep0.dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; } +#if 0 /** * This function is called when the SRP timer expires. The SRP should * complete within 6 seconds. @@ -1048,7 +1056,7 @@ static void start_xfer_tasklet_func(void *data) dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); int i; - depctl_data_t diepctl; + __maybe_unused depctl_data_t diepctl; DWC_DEBUGPL(DBG_PCDV, "Start xfer tasklet\n"); @@ -1061,7 +1069,6 @@ static void start_xfer_tasklet_func(void *data) } for (i = 0; i < core_if->dev_if->num_in_eps; i++) { - depctl_data_t diepctl; diepctl.d32 = dwc_read_reg32(&core_if->dev_if->in_ep_regs[i]->diepctl); @@ -1074,6 +1081,7 @@ static void start_xfer_tasklet_func(void *data) return; } +#endif /** * This function initialized the PCD portion of the driver. @@ -1531,7 +1539,6 @@ int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, int zero, void *req_handle, int atomic_alloc) { - int prevented = 0; unsigned long flags; dwc_otg_pcd_request_t *req; dwc_otg_pcd_ep_t *ep; diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c index 452cb5c..d2454bb 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c @@ -37,6 +37,10 @@ #include "dwc_otg_cfi.h" #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + //#define PRINT_CFI_DMA_DESCS #define DEBUG_EP0 @@ -453,7 +457,6 @@ int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) { dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; - dwc_otg_dev_in_ep_regs_t *ep_regs; gnptxsts_data_t txstatus = {.d32 = 0 }; gintsts_data_t gintsts; @@ -468,8 +471,6 @@ int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) DWC_DEBUGPL(DBG_PCD, "NP TxFifo Empty: %d \n", epnum); - ep_regs = core_if->dev_if->in_ep_regs[epnum]; - len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; if (len > ep->dwc_ep.maxpacket) { len = ep->dwc_ep.maxpacket; @@ -517,7 +518,6 @@ static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) { dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); dwc_otg_dev_if_t *dev_if = core_if->dev_if; - dwc_otg_dev_in_ep_regs_t *ep_regs; dtxfsts_data_t txstatus = {.d32 = 0 }; dwc_otg_pcd_ep_t *ep = 0; uint32_t len = 0; @@ -527,8 +527,6 @@ static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); - ep_regs = core_if->dev_if->in_ep_regs[epnum]; - len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; if (len > ep->dwc_ep.maxpacket) { @@ -3287,7 +3285,7 @@ do { \ /* Service the Device IN interrupts for each endpoint */ while (ep_intr) { if (ep_intr & 0x1) { - uint32_t empty_msk; + __maybe_unused uint32_t empty_msk; /* Get EP pointer */ ep = get_in_ep(pcd, epnum); dwc_ep = &ep->dwc_ep; diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c index 2de1cf7..01efdfb 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c @@ -993,17 +993,6 @@ void gadget_add_eps(struct gadget_wrapper *d) d->ep0.maxpacket = MAX_EP0_SIZE; } -/** - * This function releases the Gadget device. - * required by device_unregister(). - * - * @todo Should this do something? Should it free the PCD? - */ -static void dwc_otg_pcd_gadget_release(struct device *dev) -{ - DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, dev); -} - static struct gadget_wrapper *alloc_wrapper( struct dwc_otg_device *_dev ) @@ -1012,7 +1001,6 @@ static struct gadget_wrapper *alloc_wrapper( //dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); dwc_otg_device_t *otg_dev = _dev; struct gadget_wrapper *d; - int retval; d = dwc_alloc(sizeof(*d)); if (d == NULL) { @@ -1023,30 +1011,14 @@ static struct gadget_wrapper *alloc_wrapper( d->gadget.name = pcd_name; d->pcd = otg_dev->pcd; - //sword - /* - strcpy(d->gadget.dev.bus_id, "gadget"); - */ - #if 0 - dev_set_name(&d->gadget.dev, "gadget"); - d->gadget.dev.parent = &_dev->dev; - d->gadget.dev.release = dwc_otg_pcd_gadget_release; - #endif + d->gadget.ops = &dwc_otg_pcd_ops; d->gadget.is_dualspeed = dwc_otg_pcd_is_dualspeed(otg_dev->pcd); d->gadget.is_otg = dwc_otg_pcd_is_otg(otg_dev->pcd); d->driver = 0; /* Register the gadget device */ - #if 0 - retval = device_register(&d->gadget.dev); - if (retval != 0) { - DWC_ERROR("device_register failed\n"); - dwc_free(d); - return NULL; - } - #endif - + return d; } @@ -1058,7 +1030,6 @@ static void free_wrapper(struct gadget_wrapper *d) usb_gadget_unregister_driver(d->driver); } - //device_unregister(&d->gadget.dev); dwc_free(d); } @@ -1073,7 +1044,6 @@ int pcd_init( //dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); dwc_otg_device_t *otg_dev = _dev; int retval = 0; - int irq; DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _dev); @@ -1091,23 +1061,6 @@ int pcd_init( */ gadget_add_eps(gadget_wrapper); - /* - * Setup interupt handler - */ - - #if 0 - irq = platform_get_irq(_dev, 0); - DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", irq); - retval = request_irq(irq, dwc_otg_pcd_irq, - 0, gadget_wrapper->gadget.name, - otg_dev->pcd); - //SA_SHIRQ, gadget_wrapper->gadget.name, - if (retval != 0) { - DWC_ERROR("request of irq%d failed\n", irq); - free_wrapper(gadget_wrapper); - return -EBUSY; - } - #endif sprd_pcd = otg_dev->pcd; dwc_otg_pcd_start(gadget_wrapper->pcd, &fops); @@ -1125,14 +1078,9 @@ void pcd_remove( ) { dwc_otg_device_t *otg_dev = _dev; - dwc_otg_pcd_t *pcd = otg_dev->pcd; DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _dev); - /* - * Free the IRQ - */ - //free_irq(_dev->irq, pcd); dwc_otg_pcd_remove(otg_dev->pcd); free_wrapper(gadget_wrapper); otg_dev->pcd = 0; -- 2.7.4 From a4eddf5b16cd522496e70bc550db6eb6ae756d1c Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 16:59:23 +0900 Subject: [PATCH 12/16] fs: fat: remove build warnings Remove unused-variable build warnings. Change-Id: Ibecbdfb96299742d9a60669e043ee2ab87a8c469 Signed-off-by: Seung-Woo Kim --- fs/fat/fat_write.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 917580c..bfab3fe 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -479,7 +479,6 @@ delete_long_file_name(fsdata *mydata, int curclust, __u8 *cluster, PREFETCH_BLOCKS : mydata->clust_size); __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff; - int idx = 0, cur_position = 0; if (counter > VFAT_MAXSEQ) { debug("Error: VFAT name is too long\n"); @@ -1204,7 +1203,6 @@ static dir_entry *delete_directory_entry(fsdata *mydata, int startsect, dir_entry *dentptr; int i; - int mark_cnt; if (get_cluster(mydata, curclust, get_dentfromdir_block, mydata->clust_size * mydata->sect_size) != 0) { @@ -1383,7 +1381,7 @@ static int do_fat_rm(const char *filename) startsect = mydata->rootdir_sect; retdent = delete_directory_entry(mydata, startsect, l_filename, dentptr, 0); - int i; + if (retdent) { /* Update file size and start_cluster in a directory entry */ start_cluster = FAT2CPU16(retdent->start); -- 2.7.4 From 3a763d560a9c390fbe2c2d4463ecc4c980f7d854 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 3 Jan 2018 11:31:56 +0900 Subject: [PATCH 13/16] bootmode: remove build warnings Remove build warnings from bootmode. Change-Id: Ic52a8049c760fe0888b20315865a7eea9e9b1845 Signed-off-by: Seung-Woo Kim --- property/alarm_mode.c | 2 ++ property/android_boot.c | 1 - property/autodloader_mode.c | 3 -- property/backupnvitem.c | 20 ++++++------ property/calibration_detect.c | 27 ++++++++-------- property/calibration_mode.c | 2 +- property/cmd_cboot.c | 20 ++++++++++-- property/dev_tree.c | 1 + property/fastboot_mode.c | 2 +- property/fs_common_rw.c | 13 +++++--- property/modem_entry.c | 4 +-- property/normal_emc_mode.c | 56 ++++++++++++++++++++++------------ property/normal_mode.c | 71 +++++++++++++++++++++++++++++-------------- property/reboot_mode.c | 4 +++ property/recv_mode.c | 4 +++ 15 files changed, 149 insertions(+), 81 deletions(-) diff --git a/property/alarm_mode.c b/property/alarm_mode.c index 5686594..d321a5d 100644 --- a/property/alarm_mode.c +++ b/property/alarm_mode.c @@ -16,6 +16,8 @@ #define msleep(a) udelay(a * 1000) #define PROD_PART "prodnv" +extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len); +extern unsigned int get_alarm_lead_set(void); extern void sprd_rtc_init(void); extern void sprd_rtc_set_alarm_sec(unsigned long secs); extern unsigned long sprd_rtc_get_alarm_sec(void); diff --git a/property/android_boot.c b/property/android_boot.c index b456809..ac9bb16 100644 --- a/property/android_boot.c +++ b/property/android_boot.c @@ -5,7 +5,6 @@ void MMU_InvalideICACHEALL(void); void creat_atags(unsigned taddr, const char *cmdline,unsigned raddr, unsigned rsize) { unsigned n = 0; - unsigned pcount; unsigned *tags = (unsigned *)taddr; //ATAG_CORE diff --git a/property/autodloader_mode.c b/property/autodloader_mode.c index fccf28c..bba7f29 100644 --- a/property/autodloader_mode.c +++ b/property/autodloader_mode.c @@ -205,10 +205,7 @@ void autodlader_remap(void) #ifdef CONFIG_AUTODLOADER void autodloader_mode(void) { - int i = 0; printf("%s\n", __FUNCTION__); - //for(i = 0; i < 0xfffffff; i++) - //printf("hello world! \n"); //CARD_SDIO_PwrCtl(emmc_handle, FALSE); diff --git a/property/backupnvitem.c b/property/backupnvitem.c index b1ce770..e9600b4 100644 --- a/property/backupnvitem.c +++ b/property/backupnvitem.c @@ -1,4 +1,4 @@ - +#include #include #define NV_MULTI_LANG_ID (405) @@ -453,7 +453,7 @@ unsigned long XFindNVOffset(unsigned short wId, unsigned char *lpCode, unsigned if (wCurID == wId) { /* check length */ - printf("dwOffset = 0x%08x dwLength = 0x%08x bRet = %d\n", *dwOffset, *dwLength, bRet); + printf("dwOffset = 0x%08lx dwLength = 0x%08lx bRet = %lu\n", *dwOffset, *dwLength, bRet); if ((*dwOffset + *dwLength - bRet) <= dwCodeSize) return 1; else @@ -495,7 +495,7 @@ unsigned long XCheckCalibration(unsigned char *lpPhoBuf, unsigned long dwPhoSize } - printf("dwOffsetPho = 0x%08x dwLengthPho = 0x%08x\n", dwOffsetPho, dwLengthPho); + printf("dwOffsetPho = 0x%08lx dwLengthPho = 0x%08lx\n", dwOffsetPho, dwLengthPho); unsigned char *pCaliBuf = pSrcPho + dwOffsetPho; unsigned short wVerPho = *(unsigned short *)pCaliBuf; @@ -514,7 +514,7 @@ unsigned long XCheckCalibration(unsigned char *lpPhoBuf, unsigned long dwPhoSize dwPhoCaliFlag = paraPho.adc.reserved[7]; if (paraPho.adc.reserved[7] == 0) { - printf("GSM Calibration in phone is not calibrated, Reserved[7] : 0x%08X\n", dwPhoCaliFlag); + printf("GSM Calibration in phone is not calibrated, Reserved[7] : 0x%08lX\n", dwPhoCaliFlag); return 0; } @@ -748,7 +748,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, /* Find calibration in file */ if (!XFindNVOffsetEx(XTD_CALI_ITEM_ID, pFileBuf, dwCodeSize, &dwOffsetFile, &dwLengthFile, 0, 1)) return ERR_NOT_FIND_PARAM_IN_FILE; - printf("dwOffsetFile = 0x%08x dwLengthFile = 0x%08x\n", dwOffsetFile, dwLengthFile); + printf("dwOffsetFile = 0x%08lx dwLengthFile = 0x%08lx\n", dwOffsetFile, dwLengthFile); unsigned short wVerFile = *(unsigned short *)(pFileBuf + dwOffsetFile); printf("wVerFile = 0x%08x\n", wVerFile); @@ -759,7 +759,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, else return ERR_NOT_FIND_PARAM_IN_MODULE; } - printf("dwOffsetModu = 0x%08x dwLengthModu = 0x%08x\n", dwOffsetModu, dwLengthModu); + printf("dwOffsetModu = 0x%08lx dwLengthModu = 0x%08lx\n", dwOffsetModu, dwLengthModu); unsigned short wVerModu = *(unsigned short*)(pModuBuf + dwOffsetModu); printf("wVerModu = 0x%08x\n", wVerModu); @@ -771,7 +771,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, if (XTD_CALI_VER_4 == wVerFile) { dwSizeAligned = sizeof(/*td_calibration_struct_v4::*/td_calibration_v4_T); dwSizeAligned = ((unsigned long)((dwSizeAligned + 3) / 4)) * 4; - printf("dwSizeAligned = 0x%08x dwLengthFile = 0x%08x\n", dwSizeAligned, dwLengthFile); + printf("dwSizeAligned = 0x%08lx dwLengthFile = 0x%08lx\n", dwSizeAligned, dwLengthFile); if (dwLengthFile != dwSizeAligned) return ERR_PARAM_LEN_NOT_MATCH_DEF; @@ -789,7 +789,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, } else if (XTD_CALI_VER_3 == wVerFile) { dwSizeAligned = sizeof(/*td_calibration_struct_v3::*/td_calibration_v3_T); dwSizeAligned = ((unsigned long)((dwSizeAligned + 3) / 4)) * 4; - printf("dwSizeAligned = 0x%08x dwLengthFile = 0x%08x\n", dwSizeAligned, dwLengthFile); + printf("dwSizeAligned = 0x%08lx dwLengthFile = 0x%08lx\n", dwSizeAligned, dwLengthFile); if (dwLengthFile != dwSizeAligned) return ERR_PARAM_LEN_NOT_MATCH_DEF; @@ -886,12 +886,12 @@ unsigned long XPreserveNVItem(unsigned short wID, unsigned char *lpCode, unsigne return ERR_NOT_FIND_PARAM_IN_MODULE; } - printf("wID = 0x%08x dwOffsetModu = 0x%08x dwLengthModu = 0x%08x\n", wID, dwOffsetModu, dwLengthModu); + printf("wID = 0x%08x dwOffsetModu = 0x%08lx dwLengthModu = 0x%08lx\n", wID, dwOffsetModu, dwLengthModu); if (!XFindNVOffsetEx(wID, lpCode, dwCodeSize, &dwOffsetFile, &dwLengthFile, 0, 1)) return ERR_NOT_FIND_PARAM_IN_FILE; - printf("wID = 0x%08x dwOffsetFile = 0x%08x dwLengthFile = 0x%08x\n", wID, dwOffsetFile, dwLengthFile); + printf("wID = 0x%08x dwOffsetFile = 0x%08lx dwLengthFile = 0x%08lx\n", wID, dwOffsetFile, dwLengthFile); if (dwLengthModu != dwLengthFile) return ERR_PARAM_LEN_NOT_MATCH; diff --git a/property/calibration_detect.c b/property/calibration_detect.c index e5a5614..d9902b8 100644 --- a/property/calibration_detect.c +++ b/property/calibration_detect.c @@ -1,5 +1,6 @@ #include "calibration_detect.h" #include +#include static unsigned int nv_buffer[256]={0}; static int s_is_calibration_mode = 0; @@ -38,13 +39,15 @@ typedef struct tag_cali_command { unsigned char sub_cmd; } COMMAND_T; +extern int get_mode_from_gpio(void); +extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len); extern int serial_tstc(void); static unsigned long long start_time; static unsigned long long now_time; -static caliberate_device = CALIBERATE_DEVICE_NULL; +static int caliberate_device = CALIBERATE_DEVICE_NULL; static void send_caliberation_request(void) { @@ -123,14 +126,12 @@ unsigned int check_caliberate(uint8_t * buf, int len) int pctool_mode_detect_uart(void) { - int ret; int i ; unsigned int caliberate_mode; uint8_t buf[20]; int got = 0; printf("%s\n", "uart calibrate detecting"); - loff_t off = 0; send_caliberation_request(); #ifdef CONFIG_MODEM_CALIBERATE @@ -138,7 +139,7 @@ int pctool_mode_detect_uart(void) buf[i] = i + 'a'; start_time = get_timer_masked(); - printf("uart calibrate configuration start_time=%d\n", start_time); + printf("uart calibrate configuration start_time=%llu\n", start_time); while (1) { got = receive_caliberation_response(buf, sizeof(buf)); if (caliberate_device == CALIBERATE_DEVICE_UART) @@ -247,11 +248,12 @@ int check_pctool_cmd(uint8_t* buf, int len) return command; } -extern int power_button_pressed(void); static int count_ms; static unsigned long long start_time; static unsigned long long now_time; +#if 0 +extern int power_button_pressed(void); static int recheck_power_button(void) { int cnt = 0; @@ -270,6 +272,8 @@ static int recheck_power_button(void) } }while(1); } +#endif + int is_timeout(void) { @@ -307,7 +311,7 @@ void cali_usb_debug(uint8_t *buf) if(usb_trans_status) printf("func: %s line %d usb trans with error %d\n", __func__, __LINE__, usb_trans_status); ret = gs_read(buf, &count); - printf("func: %s readly read %d\n", __func__, count); + printf("func: %s readly read %d ret(%d)\n", __func__, count, ret); if(usb_trans_status) printf("func: %s line %d usb trans with error %d\n", __func__, __LINE__, usb_trans_status); for(i = 0; istatus = status; aprsp->length = CALIBERATE_CNF_LEN; - total_len = translate_packet((unsigned char*)pctool_cnf_buf,(unsigned char*)rsp_ptr,((MSG_HEAD_T*)rsp_ptr)->len); + total_len = translate_packet((char*)pctool_cnf_buf,(char*)rsp_ptr,((MSG_HEAD_T*)rsp_ptr)->len); free(rsp_ptr); return total_len; } @@ -483,8 +485,7 @@ int pctool_mode_detect(void) { int ret , command; - unsigned int caliberate_mode; - loff_t off = 0; + printf("%s\n", "uart cooperating with pc tool"); if(get_mode_from_gpio()) return pctool_mode_detect_uart(); diff --git a/property/calibration_mode.c b/property/calibration_mode.c index 0f548f0..d96d1d6 100644 --- a/property/calibration_mode.c +++ b/property/calibration_mode.c @@ -341,7 +341,7 @@ void calibration_mode(const uint8_t *pcmd, int length) //add by kenyliu in 2013 06 20 for bug 146310 if(0xE == get_adc_flag()) { - power_down_devices(); + power_down_devices(0); } //end kenyliu } diff --git a/property/cmd_cboot.c b/property/cmd_cboot.c index 663ad2d..5cff012 100644 --- a/property/cmd_cboot.c +++ b/property/cmd_cboot.c @@ -22,8 +22,20 @@ extern int power_button_pressed(void); extern int charger_connected(void); extern int alarm_triggered(void); extern int cali_file_check(void); -extern int get_mode_from_gpio(); -unsigned check_reboot_mode(void); +extern int get_mode_from_gpio(void); +extern unsigned check_reboot_mode(void); +extern int pctool_mode_detect(void); +extern unsigned int get_pwr_key_cnt(void); +#ifdef CONFIG_TIZEN +boot_mode_enum_type tizen_check_keypad(void); +#endif +#ifdef CONFIG_LCD_LOGO +extern void draw_image(int mode); +extern void lcd_display(void); +extern void MMU_DisableIDCM(void); +#endif +extern void cmd_mode_regist(CBOOT_MODE_ENTRY *array); +extern void power_down_devices(unsigned pd_cmd); //extern void CHG_LateInit(void); //extern void CHG_LowBatChg(void); @@ -163,6 +175,8 @@ boot_mode_enum_type get_mode_from_alarm_register(void){ }else{ return CMD_NONE; } + + return CMD_NONE; } // 4 get mode from charger @@ -334,7 +348,7 @@ int do_cboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) boot_mode_array[bootmode](); }else{ DBG("do_cboot: power down device\n"); - power_down_devices(); + power_down_devices(0); while(1); } diff --git a/property/dev_tree.c b/property/dev_tree.c index 059838b..a845bf3 100644 --- a/property/dev_tree.c +++ b/property/dev_tree.c @@ -26,6 +26,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include "dev_tree.h" diff --git a/property/fastboot_mode.c b/property/fastboot_mode.c index 7db647d..5932a4e 100644 --- a/property/fastboot_mode.c +++ b/property/fastboot_mode.c @@ -27,7 +27,7 @@ void fastboot_mode(void) extern void *lcd_base; extern int lcd_display_bitmap(ulong bmp_image, int x, int y); - extern lcd_display(void); + extern void lcd_display(void); extern void set_backlight(uint32_t value); extern void Dcache_CleanRegion(unsigned int addr, unsigned int length); diff --git a/property/fs_common_rw.c b/property/fs_common_rw.c index 5fb46ea..272eb22 100644 --- a/property/fs_common_rw.c +++ b/property/fs_common_rw.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -11,6 +12,10 @@ #include "../drivers/mmc/card_sdio.h" #endif +#ifdef CONFIG_FS_EXT4 +extern int ext4_read_content(int dev, wchar_t* partition_name, const char *filename, void *buf, int offset, int len); +#endif + int do_fs_file_read(char *mpart, char *filenm, void *buf, int len) { int ret=-1; @@ -107,7 +112,7 @@ int do_raw_data_read(char *part, u32 size, u32 off, char *buf) cursct = info.start + off/EMMC_SECTOR_SIZE; //read first unaligned data if(offp) { - if(!Emmc_Read(PARTITION_USER, cursct, 1, sctbuf)) + if(!Emmc_Read(PARTITION_USER, cursct, 1, (uint8 *)sctbuf)) goto end; cursct += 1; memcpy(bufwp,sctbuf+offp,len); @@ -115,14 +120,14 @@ int do_raw_data_read(char *part, u32 size, u32 off, char *buf) } //read sector aligned data if(nsct) { - if(!Emmc_Read(PARTITION_USER, cursct, nsct, bufwp)) + if(!Emmc_Read(PARTITION_USER, cursct, nsct, (uint8 *)bufwp)) goto end; cursct += nsct; bufwp += size-left; } //read last unaligned data if(left) { - if(!Emmc_Read(PARTITION_USER, cursct, 1, sctbuf)) + if(!Emmc_Read(PARTITION_USER, cursct, 1, (uint8 *)sctbuf)) goto end; memcpy(bufwp,sctbuf,left); bufwp += left; @@ -248,9 +253,9 @@ try_ubi: } ret = 0; ubi_close_volume(vol); -#endif end: +#endif if (ret) printf("do_raw_data_write error.\n"); return ret; diff --git a/property/modem_entry.c b/property/modem_entry.c index 99d69cd..69ccc0a 100644 --- a/property/modem_entry.c +++ b/property/modem_entry.c @@ -16,7 +16,7 @@ void cp_adr_remap(u32 cp_kernel_exec_addr, u32 cp_zero_map_addr) memcpy( cp_zero_map_addr, data, sizeof(data)); /* copy cp0 source code */ } -void modem_entry() +void modem_entry(void) { #ifdef CONFIG_PMIC_ARM7_BOOT //arm7 boot @@ -35,7 +35,7 @@ void modem_entry() #endif //end of TDLTE_DSDA } #else //shark,9620,tshark branch -void modem_entry() +void modem_entry(void) { #if modem_cp0_enable boot_cp0(); diff --git a/property/normal_emc_mode.c b/property/normal_emc_mode.c index 55b1fa1..f8694dc 100644 --- a/property/normal_emc_mode.c +++ b/property/normal_emc_mode.c @@ -21,6 +21,16 @@ long long load_image_time = 0; +#if BOOT_NATIVE_LINUX_MODEM +extern void sipc_addr_reset(void); +#endif +extern unsigned char _chkNVEcc(uint8_t * buf, uint32_t size, uint32_t checksum); +#ifdef CONFIG_TIZEN +#ifdef CONFIG_RAMDISK_BOOT +extern int load_ramdisk(char *name, unsigned int base_addr, unsigned int size); +#endif +#endif + #ifdef CONFIG_SUPPORT_TDLTE static boot_image_required_t const s_boot_image_tl_table[] = { {L"tl_fixnv1", L"tl_fixnv2", LTE_FIXNV_SIZE, LTE_FIXNV_ADDR}, @@ -76,6 +86,7 @@ static boot_image_required_t const s_boot_image_gsm_table[] = { }; #endif +#ifndef CONFIG_TIZEN #ifdef CONFIG_SUPPORT_W static boot_image_required_t const s_boot_image_W_table[] = { {L"wfixnv1", L"wfixnv2", FIXNV_SIZE, WFIXNV_ADR}, @@ -94,6 +105,7 @@ static boot_image_required_t const s_boot_image_WIFI_table[] = { {NULL, NULL, 0, 0} }; #endif +#endif static boot_image_required_t const s_boot_image_COMMON_table[] = { #if !BOOT_NATIVE_LINUX @@ -109,7 +121,7 @@ static boot_image_required_t const s_boot_image_COMMON_table[] = { }; -static boot_image_required_t *const s_boot_image_table[] = { +static boot_image_required_t const *s_boot_image_table[] = { #ifdef CONFIG_SUPPORT_TDLTE s_boot_image_tl_table, #endif @@ -160,7 +172,7 @@ int read_logoimg(char *bmp_img, size_t size) return -1; } if (!get_partition_info_by_name(p_block_dev, L"logo", &info)) { - if (TRUE != Emmc_Read(PARTITION_USER, info.start, size / EMMC_SECTOR_SIZE, bmp_img)) { + if (TRUE != Emmc_Read(PARTITION_USER, info.start, size / EMMC_SECTOR_SIZE, (uint8 *)bmp_img)) { debugf("function: %s nand read error\n", __FUNCTION__); return -1; } @@ -224,7 +236,7 @@ LOCAL __inline char *w2c(wchar_t * wchar) { static char buf[72] = { 0 }; unsigned int i = 0; - while ((NULL != wchar[i]) && (i < 72)) { + while ((!wchar[i]) && (i < 72)) { buf[i] = wchar[i] & 0xFF; i++; } @@ -233,6 +245,7 @@ LOCAL __inline char *w2c(wchar_t * wchar) return buf; } +#if 0 LOCAL void _boot_secure_check(void) { #ifdef CONFIG_SECURE_BOOT @@ -267,6 +280,7 @@ LOCAL void _boot_secure_check(void) #endif return; } +#endif /** Function for reading user partition. @@ -291,13 +305,13 @@ PUBLIC int _boot_partition_read(block_dev_desc_t * dev, wchar_t * partition_name goto end; } - if (TRUE != Emmc_Read(PARTITION_USER, info.start + offsetsector, nsct, buf)) + if (TRUE != Emmc_Read(PARTITION_USER, info.start + offsetsector, nsct, (uint8 *)buf)) goto end; if (left) { sctbuf = malloc(EMMC_SECTOR_SIZE); if (NULL != sctbuf) { - if (TRUE == Emmc_Read(PARTITION_USER, info.start + offsetsector + nsct, 1, sctbuf)) { + if (TRUE == Emmc_Read(PARTITION_USER, info.start + offsetsector + nsct, 1, (uint8 *)sctbuf)) { memcpy(buf + (nsct * EMMC_SECTOR_SIZE), sctbuf, left); ret = 1; } @@ -327,7 +341,7 @@ PUBLIC int blk_data_read(u32 offset, u32 size, u8 *buf) nsct = size / EMMC_SECTOR_SIZE; left = size % EMMC_SECTOR_SIZE; - if (nsct && !Emmc_Read(PARTITION_USER, start_sec, nsct, buf)) { + if (nsct && !Emmc_Read(PARTITION_USER, start_sec, nsct, (uint8 *)buf)) { debugf("Failed to read mmc\n"); goto end; } @@ -335,7 +349,7 @@ PUBLIC int blk_data_read(u32 offset, u32 size, u8 *buf) if (left) { sctbuf = malloc(EMMC_SECTOR_SIZE); if (sctbuf) { - if (!Emmc_Read(PARTITION_USER, start_sec + nsct, 1, sctbuf)) { + if (!Emmc_Read(PARTITION_USER, start_sec + nsct, 1, (uint8 *)sctbuf)) { debugf("Failed to read mmc\n"); goto end; } @@ -418,7 +432,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot nv_header_t *header_p = NULL; uint32 bufsize = info.size + EMMC_SECTOR_SIZE; - header_p = header; + header_p = (void *)header; bakbuf = malloc(bufsize); if (NULL == bakbuf) return 0; @@ -434,9 +448,9 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot memset(header, 0, EMMC_SECTOR_SIZE); memcpy(header, oribuf, EMMC_SECTOR_SIZE); checksum = header_p->checksum; - debugf("_boot_read_partition_with_backup origin checksum 0x%x\n", checksum); + debugf("_boot_read_partition_with_backup origin checksum 0x%lx\n", checksum); if (_chkNVEcc(oribuf + EMMC_SECTOR_SIZE, info.size, checksum)) { - memcpy(info.mem_addr, oribuf + EMMC_SECTOR_SIZE, info.size); + memcpy((void *)info.mem_addr, oribuf + EMMC_SECTOR_SIZE, info.size); status += 1; } } @@ -444,7 +458,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot memset(header, 0, EMMC_SECTOR_SIZE); memcpy(header, bakbuf, EMMC_SECTOR_SIZE); checksum = header_p->checksum; - debugf("_boot_read_partition_with_backup backup checksum 0x%x\n", checksum); + debugf("_boot_read_partition_with_backup backup checksum 0x%lx\n", checksum); if (_chkNVEcc(bakbuf + EMMC_SECTOR_SIZE, info.size, checksum)) status += 1 << 1; } @@ -452,7 +466,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot switch (status) { case 0: debugf("%s:(%s)both org and bak partition are damaged!\n", __FUNCTION__, w2c(info.partition)); - memset(info.mem_addr, 0, info.size); + memset((void *)info.mem_addr, 0, info.size); free(bakbuf); free(oribuf); return 0; @@ -462,7 +476,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot break; case 2: debugf("%s:(%s)org partition is damaged!\n!", __FUNCTION__, w2c(info.partition)); - memcpy(info.mem_addr, bakbuf + EMMC_SECTOR_SIZE, info.size); + memcpy((void *)info.mem_addr, bakbuf + EMMC_SECTOR_SIZE, info.size); _boot_partition_write(dev, info.partition, info.size + EMMC_SECTOR_SIZE, bakbuf); break; case 3: @@ -485,9 +499,11 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot //LOCAL __inline int _boot_load_required_image(block_dev_desc_t * dev, boot_image_required_t img_info) { +#ifdef CONFIG_SECURE_BOOT uint32 secure_boot_offset = 0; +#endif - debugf("%s: load %s to addr 0x%08x\n", __FUNCTION__, w2c(img_info.partition), img_info.mem_addr); + debugf("%s: load %s to addr 0x%08lx\n", __FUNCTION__, w2c(img_info.partition), img_info.mem_addr); if (NULL != img_info.bak_partition) { _boot_read_partition_with_backup(dev, img_info); @@ -518,7 +534,6 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode wchar_t *partition = NULL; uint32 size, offset; uint32 dt_img_adr; - uint32 secure_boot_offset = 0; disk_partition_t info; if (0 == memcmp(bootmode, RECOVERY_PART, strlen(RECOVERY_PART))) { @@ -537,7 +552,7 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode offset = info.start * info.blksz; - if (!blk_data_read(offset, sizeof(*hdr), hdr)) { + if (!blk_data_read(offset, sizeof(*hdr), (u8 *)hdr)) { debugf("%s:%s read error!\n", __FUNCTION__, w2c(partition)); return 0; } @@ -554,17 +569,16 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode roundup(hdr->kernel_size, ALIGN_SIZE) + roundup(hdr->dt_size, ALIGN_SIZE); - debugf("bzImage size: %x\n", size); + debugf("bzImage size: %lx\n", size); - if (!blk_data_read(offset, size, KERNEL_ADR - roundup(sizeof(*hdr), ALIGN_SIZE))) { + if (!blk_data_read(offset, size, (u8 *)(KERNEL_ADR - roundup(sizeof(*hdr), ALIGN_SIZE)))) { debugf("%s:%s kernel read error!\n", __FUNCTION__, w2c(partition)); return 0; } //read dt image dt_img_adr = KERNEL_ADR + roundup(hdr->kernel_size, ALIGN_SIZE); - debugf("dt_img_adr: %u\n", dt_img_adr); - debugf("dt_img_adr: %x\n", dt_img_adr); + debugf("dt_img_adr: %lx\n", dt_img_adr); if (load_dtb((int)DT_ADR, (void *)dt_img_adr)) { debugf("%s:dt load error!\n", __FUNCTION__); return 0; @@ -625,7 +639,9 @@ void vlx_nand_boot(char *kernel_pname, char *cmdline, int backlight_set) { boot_img_hdr *hdr = (void *)raw_header; block_dev_desc_t *dev = NULL; +#ifdef CONFIG_SECURE_BOOT wchar_t *partition = NULL; +#endif int i, j; long long start = get_ticks(); diff --git a/property/normal_mode.c b/property/normal_mode.c index f1dbf0a..90f7a2e 100644 --- a/property/normal_mode.c +++ b/property/normal_mode.c @@ -22,10 +22,10 @@ DECLARE_GLOBAL_DATA_PTR; #define FACTORY_PART "prodnv" #define CMDLINE_BUF_SIZE (1024) -unsigned spl_data_buf[0x2000] __attribute__ ((align(4))) = { +unsigned spl_data_buf[0x2000] __attribute__ ((aligned(4))) = { 0}; -unsigned harsh_data_buf[8] __attribute__ ((align(4))) = { +unsigned harsh_data_buf[8] __attribute__ ((aligned(4))) = { 0}; void *spl_data = spl_data_buf; @@ -36,7 +36,38 @@ unsigned int g_charger_mode = 0; unsigned int g_recovery_mode = 0; char serial_number_to_transfer[SP09_MAX_SN_LEN]; +void sipc_addr_reset(void); extern int charger_connected(void); +extern void power_down_devices(unsigned pd_cmd); +#if (defined CONFIG_SC8810) || (defined CONFIG_SC8825) || (defined CONFIG_SC8830) || (defined CONFIG_SC9630) +extern void MMU_DisableIDCM(void); +#endif +extern uint32_t load_lcd_id_to_kernel(void); +extern int get_dram_cs_number(void); +extern int get_dram_cs0_size(void); +extern bool is_calibration_by_uart(void); +extern unsigned int get_fgu_vol(void); +extern unsigned int get_fgu_cur(void); +extern void modem_entry(void); +#ifdef CONFIG_EMMC_BOOT +extern void Emmc_DisSdClk(void); +#endif +extern int fdt_fixup_adc_calibration_data(void *fdt); +extern int fdt_fixup_boot_ram_log(void *fdt); +extern int fdt_fixup_chosen_bootargs_board_private(void *fdt, const char *boot_mode); +extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len); +extern int do_raw_data_read(char *part, u32 size, u32 off, char *buf); +#ifdef CONFIG_TIZEN +extern uint8_t *load_mtp_offset_to_kernel(void); +extern uint8_t load_elvss_offset_to_kernel(void); +extern uint8_t *load_hbm_offset_to_kernel(void); +extern void sprdchg_start_charge(void); +extern int thor_save_env(char *str); +extern void tizen_get_emmc_serial_number(unsigned int *uid); +extern int load_nvitem(void); +extern int load_modem_data(void); +extern int load_dsp_data(void); +#endif extern void *lcd_base; #ifdef CONFIG_OF_LIBFDT @@ -108,7 +139,7 @@ unsigned char _chkNVEcc(uint8_t * buf, uint32_t size, uint32_t checksum) uint16_t crc; crc = calc_checksum(buf, size); - debugf("_chkNVEcc calcout 0x%lx, org 0x%llx\n", crc, checksum); + debugf("_chkNVEcc calcout 0x%x, org 0x%x\n", crc, checksum); return (crc == (uint16_t) checksum); } @@ -168,10 +199,9 @@ int fdt_fixup_for_tizen(void *fdt) char *ptr = buf; char *s; unsigned int val; - struct mmc *mmc; /* Tizen default cmdline: mem */ - ptr += sprintf(ptr, CMDLINE_DEFAULT_TIZEN); + ptr += sprintf(ptr, CMDLINE_DEFAULT_TIZEN " "); #ifdef CONFIG_RAMDISK_BOOT if (g_recovery_mode) @@ -188,9 +218,9 @@ int fdt_fixup_for_tizen(void *fdt) ptr += sprintf(ptr, " lcd_id=ID%06x", load_lcd_id_to_kernel()); ptr += sprintf(ptr, " lcd_base=%x", CONFIG_FB_RAM_BASE); - ptr += sprintf(ptr, " mtp_offset=%s", load_mtp_offset_to_kernel()); + ptr += sprintf(ptr, " mtp_offset=%s", (char *)load_mtp_offset_to_kernel()); ptr += sprintf(ptr, " elvss_offset=0x%x", load_elvss_offset_to_kernel()); - ptr += sprintf(ptr, " hbm_offset=%s", load_hbm_offset_to_kernel()); + ptr += sprintf(ptr, " hbm_offset=%s", (char *)load_hbm_offset_to_kernel()); ptr += sprintf(ptr, " wfixnv=0x%x,0x%x", WFIXNV_ADR, FIXNV_SIZE); ptr += sprintf(ptr, " wruntimenv=0x%x,0x%x", WRUNTIMENV_ADR, RUNTIMENV_SIZE); @@ -255,7 +285,8 @@ int fdt_fixup_for_tizen(void *fdt) s = getenv("sec_log"); if (s && (*s == 'o')) { - if (s = getenv("sec_log_addr")) { + s = getenv("sec_log_addr"); + if (s) { val = (u32) simple_strtoul(s, NULL, 16); ptr += sprintf(ptr, " sec_log=0x%x@0x%x", SEC_LOG_LENGTH, val); } @@ -305,15 +336,12 @@ int fdt_fixup_for_tizen(void *fdt) /*FDT_ADD_SIZE used to describe the size of the new bootargs items*/ /*include lcd id, lcd base, etc*/ #define FDT_ADD_SIZE (1024) -static int start_linux() +static int start_linux(void) { void (*theKernel) (int zero, int arch, u32 params); - u32 exec_at = (u32) - 1; - u32 parm_at = (u32) - 1; u32 machine_type; u8 *fdt_blob; u32 fdt_size; - boot_img_hdr *hdr = raw_header; int err; machine_type = machine_arch_type; /* get machine type */ @@ -354,8 +382,6 @@ static int start_linux() while (1); #endif /* CONFIG_TIZEN */ -//#else -// fdt_initrd_norsvmem(fdt_blob, RAMDISK_ADR, RAMDISK_ADR + hdr->ramdisk_size, 1); fdt_fixup_lcdid(fdt_blob); fdt_fixup_lcdbase(fdt_blob); fdt_fixup_calibration_parameter(fdt_blob); @@ -420,7 +446,7 @@ void lcd_display_logo(int backlight_set, ulong bmp_img, size_t size) mdelay(50); set_backlight(255); } else { - memset((unsigned int)lcd_base, 0, size); + memset(lcd_base, 0, size); #if defined(CONFIG_SC8810) || defined(CONFIG_SC8825) || defined(CONFIG_SC8830) || defined(CONFIG_SC9630) Dcache_CleanRegion((unsigned int)(lcd_base), size << 1); //Size is to large. #endif @@ -429,7 +455,7 @@ void lcd_display_logo(int backlight_set, ulong bmp_img, size_t size) #endif } -int is_factorymode() +int is_factorymode(void) { char factorymode_falg[8] = { 0 }; int ret = 0; @@ -646,25 +672,25 @@ void cmdline_set_cp_cmdline(char *buf, int str_len) nv_info = (char *)(((volatile u32 *)CALIBRATION_FLAG)); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif #ifdef CONFIG_SUPPORT_W nv_info = (char *)((volatile u32 *)CALIBRATION_FLAG_WCDMA); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif #ifdef CONFIG_SC9630 #ifdef CONFIG_CP0_ARM0_BOOT nv_info = (char *)(((volatile u32 *)CALIBRATION_FLAG_CP0)); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif nv_info = (char *)(((volatile u32 *)CALIBRATION_FLAG_CP1)); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif } @@ -672,7 +698,6 @@ int creat_cmdline(char *cmdline, boot_img_hdr * hdr) { char *buf; int offset = 0; - int ret = 0; if (cmdline == NULL) { return -1; @@ -759,7 +784,7 @@ void vlx_entry() /*down the device if charger disconnect during calibration detect. */ if (g_charger_mode && !charger_connected()) { g_charger_mode = 0; - power_down_devices(); + power_down_devices(0); while (1) ; } #if !(defined CONFIG_SC8810 || defined CONFIG_TIGER || defined CONFIG_SC8830) || (defined CONFIG_SC9630) @@ -882,7 +907,7 @@ void panic_reboot_mode(void) #if BOOT_NATIVE_LINUX_MODEM -void sipc_addr_reset() +void sipc_addr_reset(void) { #ifdef CONFIG_SC8825 memset((void *)SIPC_APCP_START_ADDR, 0x0, SIPC_APCP_RESET_ADDR_SIZE); diff --git a/property/reboot_mode.c b/property/reboot_mode.c index bca9de5..504d3eb 100644 --- a/property/reboot_mode.c +++ b/property/reboot_mode.c @@ -9,6 +9,10 @@ #include #include +extern void CHIP_PHY_ResetHWFlag(uint32 val); +extern void CHIP_PHY_SetWDGHWFlag(WDG_HW_FLAG_T type, uint32 val); +extern void CHIP_ResetMCU(void); + static void ResetMCU(void) { /* set watchdog reset flag */ diff --git a/property/recv_mode.c b/property/recv_mode.c index 47457ae..18b66cd 100644 --- a/property/recv_mode.c +++ b/property/recv_mode.c @@ -19,6 +19,8 @@ #endif #define dprintf(fmt, args...) printf(fmt, ##args) +extern void reboot_devices(unsigned reboot_mode); + void nv_patch(char * addr, int size) { int i = 0; @@ -142,6 +144,8 @@ int do_recovery(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) puts("Tizen Recovery mode\n"); recovery_mode(); + + return 0; } U_BOOT_CMD(recovery, 1, 1, do_recovery, -- 2.7.4 From 5e06d3a9ce625d55b95f46438f7f5d2fd47cb0e7 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 3 Jan 2018 11:32:35 +0900 Subject: [PATCH 14/16] bootmode: tizen: remove build warnings and static analysis tool warnings Remove build warnings and static analysis tool warnings. Change-Id: I6422c6147ba979b6ae8340e2ffd229dd2cf47ffe Signed-off-by: Seung-Woo Kim --- property/tizen_misc.c | 259 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 166 insertions(+), 93 deletions(-) diff --git a/property/tizen_misc.c b/property/tizen_misc.c index 263c476..37c9994 100644 --- a/property/tizen_misc.c +++ b/property/tizen_misc.c @@ -13,9 +13,19 @@ #include #include +#ifdef CONFIG_TIZEN_LPM_SUPPORT +extern int charger_connected(void); +#endif +extern unsigned char *get_global_cid(void); +extern int get_volumn_down_status2(void); +extern unsigned char _chkNVEcc(uint8_t * buf, uint32_t size, uint32_t checksum); +extern unsigned short calc_checksum(unsigned char *dat, unsigned long len); + static void convert_to_string(wchar_t *crap, char *buf) { - while (*buf++ = (char)*crap++); + while (*crap) + *buf++ = (char)*crap++; + *buf = '\0'; } int tizen_get_partition_info_by_name (block_dev_desc_t *dev_desc, @@ -58,48 +68,50 @@ int thor_save_env(char *str) #ifndef CONFIG_TIZEN_LPM_SUPPORT return ret; -#endif - ret = Emmc_Write(PARTITION_USER, part_info.start, 1, str); +#else + ret = Emmc_Write(PARTITION_USER, part_info.start, 1, (uint8 *)str); return ret; +#endif } -char *thor_get_env(void) +static int thor_get_env(char *str) { block_dev_desc_t *p_block_dev; disk_partition_t part_info; - char str[EMMC_SECTOR_SIZE]; int ret; p_block_dev = get_dev("mmc", CONFIG_MMC_DEFAULT_DEV); if (!p_block_dev) - return NULL; + return -1; ret = tizen_get_partition_info_by_name(p_block_dev, L"param", &part_info); if (ret < 0) - return NULL; + return ret; - ret = Emmc_Read(PARTITION_USER, part_info.start, 1, str); - if (ret <0) - return NULL; + ret = Emmc_Read(PARTITION_USER, part_info.start, 1, (uint8 *)str); + if (!ret) + return -1; - return str; + return 0; } enum tizen_pm_state check_pm_status(void) { enum tizen_pm_state state = PM_STATE_NORMAL; - char *str = thor_get_env(); + char str[EMMC_SECTOR_SIZE]; + int ret; -#ifndef CONFIG_TIZEN_LPM_SUPPORT - return PM_STATE_NORMAL; -#endif + ret = thor_get_env(str); - if (str) { + if (!ret) { if (!strncmp(str, "thor", strlen("thor"))) - return PM_STATE_NORMAL; + return state; } +#ifndef CONFIG_TIZEN_LPM_SUPPORT + return state; +#else if (charger_connected()) { int adp_type = sprdchg_charger_is_adapter(); @@ -113,6 +125,7 @@ enum tizen_pm_state check_pm_status(void) } return state; +#endif } unsigned int tizen_get_part_num(const char *part_name) @@ -175,13 +188,25 @@ unsigned int tizen_get_part_info(const char *name, struct thor_part_info *info) unsigned int thor_get_part_info(struct thor_part_info *part_info, const char *name) { int i; - const char *file_name = strtok(name, "."); + char *orig_name, *file_name; + + orig_name = strdup(name); + if (!orig_name) + return -1; + + file_name = strtok(orig_name, "."); + if (!file_name) + goto out; for (i = 0; i < ARRAY_SIZE(thor_part_map); i++) { - if (!strcmp(file_name, thor_part_map[i].file_name)) + if (!strcmp(file_name, thor_part_map[i].file_name)) { + free(orig_name); return tizen_get_part_info(thor_part_map[i].part_name, part_info); + } } +out: + free(orig_name); return -1; } @@ -203,7 +228,6 @@ unsigned int tizen_board_key_scan(void) unsigned int s_int_status = REG_KPD_INT_RAW_STATUS; unsigned int s_key_status = REG_KPD_KEY_STATUS; unsigned int scan_code = 0; - unsigned int key_code = 0; if(s_key_status &KPD1_KEY_STS) scan_code = (uint32_t)(s_key_status & (KPD1_KEY_STS | KPD1_ROW_CNT | KPD1_COL_CNT)); @@ -254,7 +278,7 @@ boot_mode_enum_type tizen_check_keypad(void) typedef struct _NV_Update{ uint32 nv_id; - void (*update)(); + void (*update)(void); } NV_Update_T; typedef enum _NV_UPDATE_ERR_E @@ -299,13 +323,13 @@ int runtimenv_read_with_backup(void) char header[SECTOR_SIZE]; unsigned int checksum = 0; nv_header_t * header_p = NULL; - unsigned int runtimenv_adr; + void *runtimenv_adr; int ret; block_dev_desc_t *p_block_dev; disk_partition_t part_info; - runtimenv_adr = WRUNTIMENV_ADR; + runtimenv_adr = (void *)WRUNTIMENV_ADR; p_block_dev = get_dev("mmc", CONFIG_MMC_DEFAULT_DEV); if (!p_block_dev) @@ -334,28 +358,37 @@ int runtimenv_read_with_backup(void) } //mmc_bread((u8 *)oribuf, base_sector, RUNTIMENV_SIZE); - ret = Emmc_Read(PARTITION_USER, part_info.start, RUNTIMENV_SIZE / SECTOR_SIZE, oribuf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, RUNTIMENV_SIZE / SECTOR_SIZE, (uint8 *)oribuf); + if (!ret) { + free(bakbuf); + free(oribuf); return -1; + } memset(header, 0, SECTOR_SIZE); memcpy(header, oribuf, SECTOR_SIZE); checksum = header_p->checksum; printf("runtimenv_read_with_backup origin checksum 0x%x\n", checksum); - if (_chkNVEcc(oribuf + SECTOR_SIZE, RUNTIMENV_SIZE, checksum)) { + if (_chkNVEcc((uint8_t *)oribuf + SECTOR_SIZE, RUNTIMENV_SIZE, checksum)) { memcpy(runtimenv_adr,oribuf+SECTOR_SIZE,RUNTIMENV_SIZE); status += 1; } ret = tizen_get_partition_info_by_name(p_block_dev, L"runtimenv2", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); return -1; + } //mmc_bread((u8 *)bakbuf, base_sector, RUNTIMENV_SIZE); - ret = Emmc_Read(PARTITION_USER, part_info.start, RUNTIMENV_SIZE / SECTOR_SIZE, bakbuf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, RUNTIMENV_SIZE / SECTOR_SIZE, (uint8 *)bakbuf); + if (!ret) { + free(bakbuf); + free(oribuf); return -1; + } memset(header, 0, SECTOR_SIZE); memcpy(header, bakbuf, SECTOR_SIZE); @@ -363,7 +396,7 @@ int runtimenv_read_with_backup(void) checksum = header_p->checksum; printf("runtime_read_with_backup backup checksum 0x%x\n", checksum); - if(_chkNVEcc(bakbuf + SECTOR_SIZE, RUNTIMENV_SIZE, checksum)) { + if(_chkNVEcc((uint8_t *)bakbuf + SECTOR_SIZE, RUNTIMENV_SIZE, checksum)) { memcpy(runtimenv_adr,bakbuf+SECTOR_SIZE,RUNTIMENV_SIZE); status += 1 << 1; } @@ -377,17 +410,20 @@ int runtimenv_read_with_backup(void) case 1: printf("bak partition is damaged!\n"); // mmc_bwrite((u8 *)oribuf, base_sector, (RUNTIMENV_SIZE+SECTOR_SIZE)); - Emmc_Write(PARTITION_USER, part_info.start, (RUNTIMENV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, oribuf); + Emmc_Write(PARTITION_USER, part_info.start, (RUNTIMENV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, (uint8 *)oribuf); break; case 2: printf("org partition is damaged!\n!"); memcpy(runtimenv_adr, bakbuf + SECTOR_SIZE, RUNTIMENV_SIZE); ret = tizen_get_partition_info_by_name(p_block_dev, L"runtimenv1", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); return -1; + } - Emmc_Write(PARTITION_USER, part_info.start, (RUNTIMENV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, bakbuf); + Emmc_Write(PARTITION_USER, part_info.start, (RUNTIMENV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, (uint8 *)bakbuf); break; case 3: printf("both org and bak partition are ok!\n"); @@ -402,7 +438,7 @@ int runtimenv_read_with_backup(void) int fixnv_read_with_backup(void) { - unsigned int fixnv_adr = WFIXNV_ADR; + void *fixnv_adr = (void *)WFIXNV_ADR; nv_header_t * header_p = NULL; nv_header_t *tmp_header_p = NULL; unsigned char status = 0; @@ -432,8 +468,8 @@ int fixnv_read_with_backup(void) memset(tmp_header, 0, SECTOR_SIZE); // mmc_bread((u8 *)tmpbuf, ppi->blkstart, FIXNV_SIZE+SECTOR_SIZE); - ret = Emmc_Read(PARTITION_USER, part_info.start, (FIXNV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, tmpbuf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, (FIXNV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, (uint8 *)tmpbuf); + if (!ret) return -1; memcpy(tmp_header, tmpbuf, SECTOR_SIZE); @@ -441,7 +477,7 @@ int fixnv_read_with_backup(void) if (tmp_header_p->magic != NV_HEAD_MAGIC) { tmp_header_p->magic = NV_HEAD_MAGIC; tmp_header_p->len = FIXNV_SIZE; - tmp_header_p->checksum = (unsigned long)calc_checksum(tmpbuf, FIXNV_SIZE); + tmp_header_p->checksum = (unsigned long)calc_checksum((unsigned char *)tmpbuf, FIXNV_SIZE); tmp_header_p->version = NV_VERSION; tmp_header_p->updated = NV_UPDATED; @@ -449,8 +485,8 @@ int fixnv_read_with_backup(void) // mmc_bwrite(tmp_header,ppi->blkstart,SECTOR_SIZE); // mmc_bwrite(tmpbuf,ppi->blkstart+1,FIXNV_SIZE); - Emmc_Write(PARTITION_USER, part_info.start, 1, tmp_header); - Emmc_Write(PARTITION_USER, part_info.start + 1, FIXNV_SIZE / SECTOR_SIZE, tmpbuf); + Emmc_Write(PARTITION_USER, part_info.start, 1, (uint8 *)tmp_header); + Emmc_Write(PARTITION_USER, part_info.start + 1, FIXNV_SIZE / SECTOR_SIZE, (uint8 *)tmpbuf); } free(tmpbuf); @@ -475,19 +511,22 @@ int fixnv_read_with_backup(void) return -1; } - printf("loading fixnv1 from %x(%x) to %x\n", part_info.start, FIXNV_SIZE, fixnv_adr); + printf("loading fixnv1 from %lx(%x) to %lx\n", part_info.start, FIXNV_SIZE, (unsigned long)fixnv_adr); //mmc_bread((u8 *)oribuf, base_sector, FIXNV_SIZE); - ret = Emmc_Read(PARTITION_USER, part_info.start, FIXNV_SIZE / SECTOR_SIZE, oribuf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, FIXNV_SIZE / SECTOR_SIZE, (uint8 *)oribuf); + if (!ret) { + free(bakbuf); + free(oribuf); return -1; + } memset(header, 0, SECTOR_SIZE); memcpy(header, oribuf, SECTOR_SIZE); checksum = header_p->checksum; printf("nv_read_with_backup origin checksum 0x%x\n", checksum); - if (_chkNVEcc(oribuf + SECTOR_SIZE, FIXNV_SIZE, checksum)) { + if (_chkNVEcc((uint8_t *)oribuf + SECTOR_SIZE, FIXNV_SIZE, checksum)) { memcpy(fixnv_adr, oribuf + SECTOR_SIZE, FIXNV_SIZE); status += 1; } @@ -498,13 +537,16 @@ int fixnv_read_with_backup(void) status = 0; ret = tizen_get_partition_info_by_name(p_block_dev, L"fixnv2", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); return -1; + } - printf("loading fixnv2 from %x(%x) to %x\n", part_info.start, FIXNV_SIZE, fixnv_adr); + printf("loading fixnv2 from %lx(%x) to %lx\n", part_info.start, FIXNV_SIZE, (unsigned long)fixnv_adr); //mmc_bread((u8 *)bakbuf, base_sector, FIXNV_SIZE); - ret = Emmc_Read(PARTITION_USER, part_info.start, FIXNV_SIZE / SECTOR_SIZE, bakbuf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, FIXNV_SIZE / SECTOR_SIZE, (uint8 *)bakbuf); + if (!ret) return -1; memset(header, 0, SECTOR_SIZE); @@ -515,7 +557,9 @@ int fixnv_read_with_backup(void) printf("nv1_magic: %x, NV_HEAD_MAGIC: %x\n", nv_magic, NV_HEAD_MAGIC); if ((nv_updated == NV_UPDATED) && (nv_magic == NV_HEAD_MAGIC)) { - unsigned int nv_backup_status; +#if NV_BACKUP + unsigned int nv_backup_status = ERR_FIXNV_NONE; +#endif char *bakbuf_update = NULL; char *oribuf_update = NULL; @@ -545,6 +589,8 @@ int fixnv_read_with_backup(void) memset(bakbuf_update, 0xff, FIXNV_SIZE); memcpy(bakbuf_update, bakbuf + SECTOR_SIZE, FIXNV_SIZE); + +#if NV_BACKUP /* TODO */ // nv_backup_status = modem_update_fixnv_image(bakbuf_update, oribuf_update); printf("nv_backup_status = %d \n", nv_backup_status); @@ -555,34 +601,46 @@ int fixnv_read_with_backup(void) case ERR_FIXNV_INITCPY: case ERR_FIXNV_UPDATE_CPY: printf("nv update is succeeded.\n"); +#endif header_p = (nv_header_t *)header; header_p->magic = NV_HEAD_MAGIC; header_p->len = FIXNV_SIZE; - header_p->checksum = (unsigned long)calc_checksum(oribuf_update,FIXNV_SIZE); + header_p->checksum = (unsigned long)calc_checksum((unsigned char *)oribuf_update,FIXNV_SIZE); header_p->version = NV_VERSION; header_p->updated = 0x0; ret = tizen_get_partition_info_by_name(p_block_dev, L"fixnv1", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); + free(bakbuf_update); + free(oribuf_update); return -1; + } //mmc_bwrite(header, ppi->blkstart, SECTOR_SIZE); //mmc_bwrite(oribuf_update, (ppi->blkstart+1), FIXNV_SIZE); - Emmc_Write(PARTITION_USER, part_info.start, 1, header); - Emmc_Write(PARTITION_USER, part_info.start + 1, FIXNV_SIZE / SECTOR_SIZE, oribuf_update); + Emmc_Write(PARTITION_USER, part_info.start, 1, (uint8 *)header); + Emmc_Write(PARTITION_USER, part_info.start + 1, FIXNV_SIZE / SECTOR_SIZE, (uint8 *)oribuf_update); ret = tizen_get_partition_info_by_name(p_block_dev, L"fixnv2", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); + free(bakbuf_update); + free(oribuf_update); return -1; + } //mmc_bwrite(header, ppi->blkstart, SECTOR_SIZE); //mmc_bwrite(oribuf_update, (ppi->blkstart+1), FIXNV_SIZE); - Emmc_Write(PARTITION_USER, part_info.start, 1, header); - Emmc_Write(PARTITION_USER, part_info.start + 1, FIXNV_SIZE / SECTOR_SIZE, oribuf_update); + Emmc_Write(PARTITION_USER, part_info.start, 1, (uint8 *)header); + Emmc_Write(PARTITION_USER, part_info.start + 1, FIXNV_SIZE / SECTOR_SIZE, (uint8 *)oribuf_update); memset(fixnv_adr, 0xff, FIXNV_SIZE); memcpy(fixnv_adr, oribuf_update, FIXNV_SIZE); +#if NV_BACKUP break; default: printf("nv update is failed. Original NV will be NV partitions.\n"); @@ -590,24 +648,30 @@ int fixnv_read_with_backup(void) header_p->updated = 0x1; ret = tizen_get_partition_info_by_name(p_block_dev, L"fixnv2", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); + free(bakbuf_update); + free(oribuf_update); return -1; + } //mmc_bwrite(header, ppi->blkstart, SECTOR_SIZE); - Emmc_Write(PARTITION_USER, part_info.start, 1, header); + Emmc_Write(PARTITION_USER, part_info.start, 1, (uint8 *)header); memcpy(fixnv_adr, oribuf_update, FIXNV_SIZE); } +#endif free(bakbuf_update); free(oribuf_update); } else { checksum = header_p->checksum; - printf("nv_read_with_backup backup checksum 0x%x\n", checksum); - if (_chkNVEcc(bakbuf + SECTOR_SIZE, FIXNV_SIZE, checksum)) { - memcpy(fixnv_adr, bakbuf + SECTOR_SIZE,FIXNV_SIZE); - status += 1<<1; - } + printf("nv_read_with_backup backup checksum 0x%x\n", checksum); + if (_chkNVEcc((uint8_t *)bakbuf + SECTOR_SIZE, FIXNV_SIZE, checksum)) { + memcpy(fixnv_adr, bakbuf + SECTOR_SIZE,FIXNV_SIZE); + status += 1<<1; + } - switch(status) { + switch(status) { case 0: printf("both org and bak partition are damaged!\n"); free(bakbuf); @@ -616,7 +680,7 @@ int fixnv_read_with_backup(void) case 1: printf("bak partition is damaged!\n"); //mmc_bwrite((u8 *)oribuf, base_sector, (FIXNV_SIZE+SECTOR_SIZE)); - Emmc_Write(PARTITION_USER, part_info.start, (FIXNV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, oribuf); + Emmc_Write(PARTITION_USER, part_info.start, (FIXNV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, (uint8 *)oribuf); break; case 2: @@ -624,19 +688,22 @@ int fixnv_read_with_backup(void) memcpy(fixnv_adr, bakbuf+SECTOR_SIZE, FIXNV_SIZE); ret = tizen_get_partition_info_by_name(p_block_dev, L"fixnv1", &part_info); - if (ret < 0) + if (ret < 0) { + free(bakbuf); + free(oribuf); return -1; + } //mmc_bwrite((u8 *)bakbuf, base_sector, (FIXNV_SIZE+SECTOR_SIZE)); - Emmc_Write(PARTITION_USER, part_info.start, (FIXNV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, bakbuf); + Emmc_Write(PARTITION_USER, part_info.start, (FIXNV_SIZE + SECTOR_SIZE) / SECTOR_SIZE, (uint8 *)bakbuf); break; case 3: printf("both org and bak partition are ok!\n"); break; - } + } } free(bakbuf); - free(oribuf); + free(oribuf); return 0; } @@ -660,18 +727,19 @@ int load_modem_data(void) block_dev_desc_t *p_block_dev; disk_partition_t part_info; int ret = 0; +#if BIN_SIZE_LEFT u32 left; +#endif u32 nsct; - char *sctbuf = NULL; - unsigned char *buf = WMODEM_ADR; + unsigned char *buf = (void *)WMODEM_ADR; - if(!buf) - return -1; - - printf("load modem to addr 0x%08x\n", buf); + printf("load modem to addr 0x%08lx\n", (unsigned long)buf); nsct = WMODEM_SIZE / EMMC_SECTOR_SIZE; +#if BIN_SIZE_LEFT + /* size of the image is multiple of emmc sector size, so no need to check it */ left = WMODEM_SIZE % EMMC_SECTOR_SIZE; +#endif p_block_dev = get_dev("mmc", CONFIG_MMC_DEFAULT_DEV); if (!p_block_dev) @@ -681,20 +749,22 @@ int load_modem_data(void) if (ret < 0) return -1; - ret = Emmc_Read(PARTITION_USER, part_info.start, nsct, buf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, nsct, (uint8 *)buf); + if (!ret) return -1; +#if BIN_SIZE_LEFT if (left) { - sctbuf = malloc(EMMC_SECTOR_SIZE); + char *sctbuf = sctbuf = malloc(EMMC_SECTOR_SIZE); if (!sctbuf) return -1; - ret = Emmc_Read(PARTITION_USER, part_info.start + nsct, 1, sctbuf); + ret = Emmc_Read(PARTITION_USER, part_info.start + nsct, 1, (uint8 *)sctbuf); if (ret) memcpy(buf + (nsct * EMMC_SECTOR_SIZE), sctbuf, left); free(sctbuf); } +#endif printf("partition; modem read success!\n"); @@ -706,18 +776,19 @@ int load_dsp_data(void) block_dev_desc_t *p_block_dev; disk_partition_t part_info; int ret = 0; +#if BIN_SIZE_LEFT u32 left; +#endif u32 nsct; - char *sctbuf = NULL; - unsigned char *buf = WDSP_ADR; - - if(!buf) - return -1; + unsigned char *buf = (void *)WDSP_ADR; - printf("load dsp to addr 0x%08x\n", buf); + printf("load dsp to addr 0x%08lx\n", (unsigned long)buf); nsct = WDSP_SIZE / EMMC_SECTOR_SIZE; +#if BIN_SIZE_LEFT + /* size of the image is multiple of emmc sector size, so no need to check it */ left = WDSP_SIZE % EMMC_SECTOR_SIZE; +#endif p_block_dev = get_dev("mmc", CONFIG_MMC_DEFAULT_DEV); if (!p_block_dev) @@ -727,20 +798,22 @@ int load_dsp_data(void) if (ret < 0) return -1; - ret = Emmc_Read(PARTITION_USER, part_info.start, nsct, buf); - if (ret < 0) + ret = Emmc_Read(PARTITION_USER, part_info.start, nsct, (uint8 *)buf); + if (!ret) return -1; +#if BIN_SIZE_LEFT if (left) { - sctbuf = malloc(EMMC_SECTOR_SIZE); + char *sctbuf = malloc(EMMC_SECTOR_SIZE); if (!sctbuf) return -1; - ret = Emmc_Read(PARTITION_USER, part_info.start + nsct, 1, sctbuf); + ret = Emmc_Read(PARTITION_USER, part_info.start + nsct, 1, (uint8 *)sctbuf); if (ret) memcpy(buf + (nsct * EMMC_SECTOR_SIZE), sctbuf, left); free(sctbuf); } +#endif printf("partition; dsp read success!\n"); @@ -768,9 +841,9 @@ static int load_binary_to_addr(char *name, unsigned int addr, unsigned int size) if (ret < 0) return ret; - ret = Emmc_Read(PARTITION_USER, info.offset, size / info.blksz, addr); - if (ret < 0) - return ret; + ret = Emmc_Read(PARTITION_USER, info.offset, size / info.blksz, (uint8 *)addr); + if (!ret) + return -1; return 0; } @@ -792,11 +865,11 @@ int check_board_signature(char *fname, unsigned int dn_addr, unsigned int size) return 0; /* can't found signature in target - download continue */ - ret = load_binary_to_addr(PARTS_BOOT, bl_buf, CONFIG_SIG_IMAGE_SIZE); + ret = load_binary_to_addr(PARTS_BOOT, (unsigned int)(unsigned long)bl_buf, CONFIG_SIG_IMAGE_SIZE); if (ret < 0) return 0; - ret = get_image_signature(&bh_target, bl_buf, CONFIG_SIG_IMAGE_SIZE); + ret = get_image_signature(&bh_target, (unsigned int)(unsigned long)bl_buf, CONFIG_SIG_IMAGE_SIZE); if (ret) return 0; -- 2.7.4 From 3f98b0827c777c7e00493d75df1bbbef233e2dab Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 3 Jan 2018 15:22:16 +0900 Subject: [PATCH 15/16] video: sprd: remove build warnings Remove build warnings. Change-Id: I211276db4d2f8472a5ad2df584877828c4b56338 Signed-off-by: Seung-Woo Kim --- drivers/video/sprdfb/dsi_1_21a/mipi_dsih_dphy.c | 2 +- drivers/video/sprdfb/lcd/lcd_s6e8aa5x01_mipi.c | 22 ++++++---------------- drivers/video/sprdfb/sprdfb.h | 1 + drivers/video/sprdfb/sprdfb_chip_common.h | 2 ++ drivers/video/sprdfb/sprdfb_dispc.c | 5 ----- drivers/video/sprdfb/sprdfb_dsi.c | 8 ++------ drivers/video/sprdfb/sprdfb_i2c.c | 2 +- drivers/video/sprdfb/sprdfb_main.c | 20 +++++++++++--------- drivers/video/sprdfb/sprdfb_panel.c | 7 +++++++ drivers/video/sprdfb/sprdfb_rgb.c | 2 +- 10 files changed, 32 insertions(+), 39 deletions(-) diff --git a/drivers/video/sprdfb/dsi_1_21a/mipi_dsih_dphy.c b/drivers/video/sprdfb/dsi_1_21a/mipi_dsih_dphy.c index 1dd8619..fd41856 100644 --- a/drivers/video/sprdfb/dsi_1_21a/mipi_dsih_dphy.c +++ b/drivers/video/sprdfb/dsi_1_21a/mipi_dsih_dphy.c @@ -26,7 +26,7 @@ uint8_t mipi_dsih_dphy_calibration(dphy_t * phy)// tianci need check with thomas { - uint8_t rd_data[3],sv_data[3]; + uint8_t rd_data[3],sv_data[3] = {0,}; uint8_t data[3]; uint8_t i = 0; /* iterator */ int8_t j = 0; diff --git a/drivers/video/sprdfb/lcd/lcd_s6e8aa5x01_mipi.c b/drivers/video/sprdfb/lcd/lcd_s6e8aa5x01_mipi.c index 9226bff..ac89902 100644 --- a/drivers/video/sprdfb/lcd/lcd_s6e8aa5x01_mipi.c +++ b/drivers/video/sprdfb/lcd/lcd_s6e8aa5x01_mipi.c @@ -52,6 +52,10 @@ typedef struct LCM_force_cmd_code_tag{ #define MTP_LEN 0x21 #define ELVSS_ADDR 0xB6 +extern void save_mtp_offset_to_kernel(uint8_t *mtp); +extern void save_elvss_offset_to_kernel(uint8_t elvss); +extern void save_hbm_offset_to_kernel(uint8_t *hbm); + static LCM_Init_Code init_data[] = { {LCM_SEND(5), {3, 0x00, 0xF0, 0x5A, 0x5A} }, {LCM_SEND(5), {3, 0x00, 0xF1, 0x5A, 0x5A} }, @@ -69,8 +73,6 @@ static LCM_Init_Code init_data[] = { {LCM_SEND(1), {0x29}}, }; -static LCM_Init_Code disp_on = {LCM_SEND(1), {0x29}}; - static LCM_Init_Code sleep_in[] = { {LCM_SEND(1), {0x28}}, {LCM_SLEEP(150)}, //>150ms @@ -131,7 +133,6 @@ static uint32_t s6e8aa5x01_readid(struct panel_spec *self) { uint8_t j =0; uint8_t read_data[4] = {0}; - int32_t read_rtn = 0; uint8_t param[2] = {0}; mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode; mipi_force_write_t mipi_force_write = self->info.mipi->ops->mipi_force_write; @@ -147,7 +148,7 @@ static uint32_t s6e8aa5x01_readid(struct panel_spec *self) param[0] = 0x03; param[1] = 0x00; mipi_force_write(0x37, param, 2); - read_rtn = mipi_force_read(0x04, 3, read_data); + mipi_force_read(0x04, 3, read_data); LCD_PRINT("lcd_s6e8aa5x01_mipi read id 0xda, 0xdb,0xdc is 0x%x,0x%x,0x%x!\n", read_data[0], read_data[1], read_data[2]); if ((0x40 == read_data[0]) && (0x00 == read_data[1]) @@ -248,18 +249,13 @@ static void s6e8aa5x01_test_key(struct panel_spec *self, uint8_t enable) static int32_t s6e8aa5x01_check_mtp(struct panel_spec *self) { - LCM_Init_Code *g_para = NULL; uint8_t i = 0; uint8_t mtp_offset[MTP_LEN + 6] = {0}; - int32_t read_rtn = 0; uint8_t param[2] = {0}; - int32_t size = 0; mipi_force_write_t mipi_force_write = self->info.mipi->ops->mipi_force_write; mipi_force_read_t mipi_force_read = self->info.mipi->ops->mipi_force_read; - mipi_dcs_write_t mipi_dcs_write = - self->info.mipi->ops->mipi_dcs_write; mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode; @@ -279,7 +275,7 @@ static int32_t s6e8aa5x01_check_mtp(struct panel_spec *self) for (i = 0; i < 3; i++) { mipi_force_write(0x37, param, 2); - read_rtn = mipi_force_read(MTP_ADDR, MTP_LEN + 6, mtp_offset); + mipi_force_read(MTP_ADDR, MTP_LEN + 6, mtp_offset); if (mtp_offset[30] != 2 || mtp_offset[31] != 3 || mtp_offset[32] != 2) @@ -301,12 +297,10 @@ static int32_t s6e8aa5x01_check_mtp(struct panel_spec *self) static int32_t s6e8aa5x01_check_elvss(struct panel_spec *self) { LCM_Init_Code *g_para = NULL; - LCM_Init_Code *hbm = NULL; uint8_t i = 0; uint8_t elvss_offset = 0; int32_t read_rtn = 0; uint8_t param[2] = {0}; - int32_t size = 0; mipi_force_write_t mipi_force_write = self->info.mipi->ops->mipi_force_write; mipi_force_read_t mipi_force_read = @@ -328,7 +322,6 @@ static int32_t s6e8aa5x01_check_elvss(struct panel_spec *self) /* ELVSS OFFSET */ for (i = 0; i < 3; i++) { g_para = global_para; - size = ARRAY_SIZE(global_para); param[0] = 0x1; param[1] = 0x00; mipi_force_write(0x37, param, 2); @@ -352,12 +345,10 @@ static int32_t s6e8aa5x01_check_elvss(struct panel_spec *self) static int32_t s6e8aa5x01_check_hbm(struct panel_spec *self) { LCM_Init_Code *g_para = NULL; - LCM_Init_Code *hbm = NULL; uint8_t i = 0; uint8_t hbm_g[15] = {0}; int32_t read_rtn = 0; uint8_t param[2] = {0}; - int32_t size = 0; mipi_force_write_t mipi_force_write = self->info.mipi->ops->mipi_force_write; mipi_force_read_t mipi_force_read = @@ -379,7 +370,6 @@ static int32_t s6e8aa5x01_check_hbm(struct panel_spec *self) /* HBM GAMMA */ for (i = 0; i < 3; i++) { g_para = global_para; - size = ARRAY_SIZE(global_para); param[0] = 0xf; param[1] = 0x00; mipi_force_write(0x37, param, 2); diff --git a/drivers/video/sprdfb/sprdfb.h b/drivers/video/sprdfb/sprdfb.h index 61947ea..b07e52c 100644 --- a/drivers/video/sprdfb/sprdfb.h +++ b/drivers/video/sprdfb/sprdfb.h @@ -37,6 +37,7 @@ enum{ }; struct sprdfb_device; +struct panel_spec; struct panel_if_ctrl{ diff --git a/drivers/video/sprdfb/sprdfb_chip_common.h b/drivers/video/sprdfb/sprdfb_chip_common.h index 9e23596..061b9c9 100644 --- a/drivers/video/sprdfb/sprdfb_chip_common.h +++ b/drivers/video/sprdfb/sprdfb_chip_common.h @@ -47,6 +47,8 @@ #define SPRDFB_SUPPORT_LVDS_PANEL #endif +void __raw_bits_and(unsigned int v, unsigned int a); + void __raw_bits_or(unsigned int v, unsigned int a); void __raw_bits_set_value(unsigned int reg, unsigned int value, unsigned int bit, unsigned int mask); diff --git a/drivers/video/sprdfb/sprdfb_dispc.c b/drivers/video/sprdfb/sprdfb_dispc.c index 59b3181..97a8787 100644 --- a/drivers/video/sprdfb/sprdfb_dispc.c +++ b/drivers/video/sprdfb/sprdfb_dispc.c @@ -28,11 +28,6 @@ extern void sprdfb_panel_invalidate_rect(struct panel_spec *self, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom); -static void __raw_bits_and(unsigned int v, unsigned int a) -{ - __raw_writel((__raw_readl(a) & v), a); -} - /* dispc soft reset */ static void dispc_reset(void) { diff --git a/drivers/video/sprdfb/sprdfb_dsi.c b/drivers/video/sprdfb/sprdfb_dsi.c index 5f83e18..c944c25 100644 --- a/drivers/video/sprdfb/sprdfb_dsi.c +++ b/drivers/video/sprdfb/sprdfb_dsi.c @@ -35,11 +35,6 @@ struct sprdfb_dsi_context { static struct sprdfb_dsi_context dsi_ctx; -static void __raw_bits_and(unsigned int v, unsigned int a) -{ - __raw_writel((__raw_readl(a) & v), a); -} - static uint32_t dsi_core_read_function(uint32_t addr, uint32_t offset) { return __raw_readl(addr + offset); @@ -371,7 +366,9 @@ int32_t sprdfb_dsi_ready(struct sprdfb_device *dev) static int32_t sprdfb_dsi_set_lp_mode(void) { +#ifndef CONFIG_DSIH_VERSION_1P21A uint32_t reg_val; +#endif FB_PRINT("sprdfb:[%s]\n", __FUNCTION__); mipi_dsih_cmd_mode(&(dsi_ctx.dsi_inst), 1); @@ -445,7 +442,6 @@ void backlight_control(int brigtness) printf("%s : %d\n", __func__, brigtness); sprdfb_dsi_gen_write(set_bl_seq, LCM_SEND(2) & LCM_TAG_MASK); } -EXPORT_SYMBOL(backlight_control); static int32_t sprdfb_dsi_gen_read(uint8_t *param, uint16_t param_length, uint8_t bytes_to_read, uint8_t *read_buffer) { diff --git a/drivers/video/sprdfb/sprdfb_i2c.c b/drivers/video/sprdfb/sprdfb_i2c.c index 37bdba4..ea89933 100644 --- a/drivers/video/sprdfb/sprdfb_i2c.c +++ b/drivers/video/sprdfb/sprdfb_i2c.c @@ -76,7 +76,7 @@ static int32_t sprdfb_i2c_read_8bits(uint8 addr, uint8_t reg, uint8_t *val) } for (i = 0; i < SPRDFB_I2C_TRY_NUM; i++) { - ret = I2C_ReadCmd(addr, *val, TRUE); + ret = I2C_ReadCmd(addr, (void*)(unsigned long)*val, TRUE); if (ret != ERR_I2C_NONE) { printf("sprdfb:[%s]: read i2c reg fail(2), ret: %d, I2C r addr: 0x%x \n", __FUNCTION__, ret, addr); diff --git a/drivers/video/sprdfb/sprdfb_main.c b/drivers/video/sprdfb/sprdfb_main.c index 59d794c..7afa52e 100644 --- a/drivers/video/sprdfb/sprdfb_main.c +++ b/drivers/video/sprdfb/sprdfb_main.c @@ -43,7 +43,10 @@ int lcd_color_bg; short console_col; short console_row; - +struct gpio_chip; +extern int sprd_gpio_request(struct gpio_chip *chip, unsigned offset); +extern int sprd_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value); +extern void sprd_gpio_set(struct gpio_chip *chip, unsigned offset, int value); extern int sprdfb_panel_probe(struct sprdfb_device *dev); extern void sprdfb_panel_remove(struct sprdfb_device *dev); @@ -64,11 +67,6 @@ static unsigned char hbm_g[(15 * 2) + 1] = {0}; #define WHTLED_V_SHIFT 2 #define WHTLED_V_MSK (0x1F << WHTLED_V_SHIFT) -static void __raw_bits_and(unsigned int v, unsigned int a) -{ - __raw_writel((__raw_readl(a) & v), a); -} - static void __raw_bits_or(unsigned int v, unsigned int a) { __raw_writel((__raw_readl(a) | v), a); @@ -105,6 +103,7 @@ void LCD_SetBackLightBrightness( unsigned long value) LCD_SetPwmRatio(duty_mod); } +#if defined(CONFIG_SPX15) && defined(CONFIG_EMMC_BOOT) static uint32 get_adie_chipid(void) { uint32 chip_id; @@ -112,6 +111,7 @@ static uint32 get_adie_chipid(void) chip_id |= ANA_REG_GET(ANA_REG_GLB_CHIP_ID_LOW) & 0xffff; return chip_id; } +#endif void sprd_white_led_init(void) { @@ -391,7 +391,9 @@ static char byte2hex(unsigned char b) return '0' + b; if (b >= 10 && b <= 15) return 'a' + (b - 10); -/* return '0'; */ + + /* should not be here */ + return '0'; } static void hex_encoder(unsigned char *in, char *out, int sz) @@ -408,7 +410,7 @@ static void hex_encoder(unsigned char *in, char *out, int sz) void save_mtp_offset_to_kernel(uint8_t *mtp) { - hex_encoder((unsigned char *)mtp, mtp_offset, (MTP_LEN + 6)); + hex_encoder((unsigned char *)mtp, (char *)mtp_offset, (MTP_LEN + 6)); mtp_offset[(MTP_LEN + 6) * 2] = '\0'; } @@ -429,7 +431,7 @@ uint8_t load_elvss_offset_to_kernel(void) void save_hbm_offset_to_kernel(uint8_t *hbm) { - hex_encoder((unsigned char *)hbm, hbm_g, 15); + hex_encoder((unsigned char *)hbm, (char *)hbm_g, 15); hbm_g[15 * 2] = '\0'; } diff --git a/drivers/video/sprdfb/sprdfb_panel.c b/drivers/video/sprdfb/sprdfb_panel.c index cb9a977..452aff7 100644 --- a/drivers/video/sprdfb/sprdfb_panel.c +++ b/drivers/video/sprdfb/sprdfb_panel.c @@ -56,6 +56,13 @@ extern struct panel_spec lcd_s6d77a1_mipi_spec; extern struct panel_spec lcd_nt51017_mipi_spec; extern struct panel_spec lcd_hx8394d_mipi_spec; +struct gpio_chip; + +extern void save_lcd_id_to_kernel(uint32_t id); +extern int sprd_gpio_request(struct gpio_chip *chip, unsigned offset); +extern int sprd_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value); +extern void sprd_gpio_set(struct gpio_chip *chip, unsigned offset, int value); + void sprdfb_panel_remove(struct sprdfb_device *dev); static ushort colormap[256]; diff --git a/drivers/video/sprdfb/sprdfb_rgb.c b/drivers/video/sprdfb/sprdfb_rgb.c index 386808a..26f31ce 100644 --- a/drivers/video/sprdfb/sprdfb_rgb.c +++ b/drivers/video/sprdfb/sprdfb_rgb.c @@ -25,7 +25,7 @@ static uint32_t rgb_readid(struct panel_spec *self) /* default id reg is 0 */ if(SPRDFB_RGB_BUS_TYPE_I2C == rgb->cmd_bus_mode){ - rgb->bus_info.i2c->ops->i2c_read_16bits(rgb->bus_info.i2c->i2c_addr , 0x0, FALSE, &id, FALSE); + rgb->bus_info.i2c->ops->i2c_read_16bits(rgb->bus_info.i2c->i2c_addr , 0x0, FALSE, (void *)&id, FALSE); }else{ rgb->bus_info.spi->ops->spi_send_cmd(0x0); rgb->bus_info.spi->ops->spi_read(&id); -- 2.7.4 From b25c7f53daffa02d3d5fe76fc6138ca7cbf57556 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 9 Apr 2020 20:09:35 +0900 Subject: [PATCH 16/16] thor: fix invalid larger device descriptor than requested New Linux kernel xhci hub uses new usb descriptor scheme first for high speed usb peripheral device and it requests 8 bytes usb device descriptor and then 18 bytes full usb device descriptor but thor cdc-acm gadget always sends 18 bytes full usb device descriptor, so thor download mode is failed to recognize for linux host with new scheme. Fix the invalid larger device descriptor than requested by sending only requested bytes. Change-Id: I9ada9831a9667512f372d3a93d196fa8788f11b5 Ref: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=48fc7dbd52c0559647291f33a10ccdc6cdbe4c72 Signed-off-by: Seung-Woo Kim --- property/usb/drv_cdc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/property/usb/drv_cdc.c b/property/usb/drv_cdc.c index b18a0d6..8596fa2 100644 --- a/property/usb/drv_cdc.c +++ b/property/usb/drv_cdc.c @@ -17,6 +17,7 @@ #include #include #include +#include #define USB_DEBUG @@ -259,7 +260,13 @@ LOCAL void usb_get_descriptor (USB_REQUEST_1_U *request1, USB_REQUEST_2_U *reque case USB_DEVICE_DESCRIPTOR_TYPE: send_data = (uint8 *) thor_get_device_desc(enum_speed); - EPI0_config (0x12, 0x1, TRUE, (uint32 *) send_data); + /* + * only send less or equal than requested length. + * no need to care about larger reqeust than possible + * descriptor length because of zero-length packet + * generated by usb controller + */ + EPI0_config (min(USB_DT_DEVICE_SIZE, length), 0x1, TRUE, (uint32 *) send_data); break; case USB_CONFIGURATION_DESCRIPTOR_TYPE: -- 2.7.4