From 7e23307745f6050790da9d14c0dae8b1565503be Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 28 Dec 2017 17:38:21 +0900 Subject: [PATCH 01/16] logo: remove meaningless packed attributte The logo image is not in struct, so packed attribute has no meaning. Remove the meaning less packed attribute to fix build warnings. Change-Id: I35d118600c44af1fcfbd59b6ad59d7601e1bec9a Signed-off-by: Seung-Woo Kim --- include/charge_bmp_logo.h | 6 +++--- include/normal_mode.h | 6 ++---- include/prog_end_logo.h | 6 +++--- include/prog_mid_logo.h | 6 +++--- include/prog_start_logo.h | 6 +++--- include/sp_bmp_logo.h | 6 +++--- include/thor_bmp_logo.h | 6 +++--- 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/include/charge_bmp_logo.h b/include/charge_bmp_logo.h index 005a603..aeb7a40 100644 --- a/include/charge_bmp_logo.h +++ b/include/charge_bmp_logo.h @@ -1,8 +1,8 @@ -unsigned short __attribute__((packed, aligned(4))) charge_palette[] = { +unsigned short __attribute__((aligned(4))) charge_palette[] = { 0x0, 0x222, 0x444, 0x666, 0x888, 0xaaa, 0xccc, 0xeee, 0x111, 0x333, 0x555, 0x777, 0x999, 0xbbb, 0xddd, 0xfff, }; -unsigned short __attribute__((packed, aligned(4))) charge_bitmap[] = { +unsigned short __attribute__((aligned(4))) charge_bitmap[] = { 0x0, 0x8, 0x9, 0x8, 0x0, 0x1, 0x2, 0x1, 0x0, 0x1, 0x2, 0x9, 0x2, 0x9, 0x2, 0x1, 0x0, 0x1, 0x2, 0x9, 0x2, 0x8, 0x0, 0x1, 0x2, 0x9, 0x2, 0x8, 0x0, 0x1, @@ -378,7 +378,7 @@ unsigned short __attribute__((packed, aligned(4))) charge_bitmap[] = { 0x0, 0x9, 0x2, 0x9, 0x0, 0x9, 0x2, 0x9, 0x0, 0x1, 0x9, 0x1, 0x0, }; -unsigned int __attribute__((packed, aligned(4))) charge_num_bitmap[] = { +unsigned int __attribute__((aligned(4))) charge_num_bitmap[] = { 3213, 1, 50, 1, 133, 1, 50, 1, 133, 1, 5, 1, 38, 1, 5, 1, 133, 1, 2, 46, 2, 1, 133, 1, 2, 46, 2, 1, 133, 1, diff --git a/include/normal_mode.h b/include/normal_mode.h index 21d955e..ffe8c93 100644 --- a/include/normal_mode.h +++ b/include/normal_mode.h @@ -23,8 +23,6 @@ #include #endif -extern unsigned spl_data_buf[0x2000] __attribute__((align(4))); -extern unsigned harsh_data_buf[8]__attribute__((align(4))); extern void *spl_data; extern void *harsh_data; extern unsigned char raw_header[8192]; @@ -210,10 +208,10 @@ typedef struct _NV_HEADER { void set_vibrator(int on); void vibrator_hw_init(void); void MMU_InvalideICACHEALL(void); -int read_spldata(); +int read_spldata(void); void lcd_display_logo(int backlight_set,ulong bmp_image,size_t size); int creat_cmdline(char * cmdline,boot_img_hdr *hdr); -void vlx_entry(); +void vlx_entry(void); extern char* get_product_sn(void); extern char *calibration_cmd_buf; void set_recovery_mode(unsigned int recovery_mode); diff --git a/include/prog_end_logo.h b/include/prog_end_logo.h index e165253..6a452a4 100644 --- a/include/prog_end_logo.h +++ b/include/prog_end_logo.h @@ -1,4 +1,4 @@ -unsigned short __attribute__((packed, aligned(4))) prog_end_palette[] = { +unsigned short __attribute__((aligned(4))) prog_end_palette[] = { 0x0, 0x1, 0x2, 0x8ab, 0x269, 0x356, 0x7cf, 0x589, 0x68a, 0x357, 0x379, 0x6ad, 0x258, 0x12, 0x13, 0x368, 0x9be, 0x79a, 0x79b, 0x69c, 0x59d, 0xacf, 0x245, 0x23, 0x123, 0x24, 0x146, 0x59c, 0x469, 0x7ab, @@ -9,7 +9,7 @@ unsigned short __attribute__((packed, aligned(4))) prog_end_palette[] = { 0x112, 0x78a, 0x8bd, 0x8ce, 0x568, 0x8ac, 0x89b, 0x7be, 0x477, 0x478, 0x479, 0x37a, 0x6bf, 0x6be, }; -unsigned short __attribute__((packed, aligned(4))) prog_end_bitmap[] = { +unsigned short __attribute__((aligned(4))) prog_end_bitmap[] = { 0x5, 0x38, 0x39, 0x38, 0x2d, 0x26, 0x18, 0xd, 0x1, 0x0, 0x4e, 0x4f, 0x50, 0x44, 0x9, 0x5, 0x16, 0x22, 0x18, 0xd, 0x0, 0x11, 0x1d, 0x1e, 0x12, 0x8, 0x7, 0x35, 0x28, 0x22, @@ -34,7 +34,7 @@ unsigned short __attribute__((packed, aligned(4))) prog_end_bitmap[] = { 0x21, 0x19, 0xe, 0xd, 0x2, 0x1, 0x0, 0x19, 0x3d, 0x19, 0xe, 0xd, 0x1, 0x0, }; -unsigned int __attribute__((packed, aligned(4))) prog_end_num_bitmap[] = { +unsigned int __attribute__((aligned(4))) prog_end_num_bitmap[] = { 1, 6, 1, 1, 1, 2, 1, 1, 1, 2, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4, 2, 1, 1, 1, 1, 1, 1, diff --git a/include/prog_mid_logo.h b/include/prog_mid_logo.h index 9147264..9d78e86 100644 --- a/include/prog_mid_logo.h +++ b/include/prog_mid_logo.h @@ -1,13 +1,13 @@ -unsigned short __attribute__((packed, aligned(4))) prog_mid_palette[] = { +unsigned short __attribute__((aligned(4))) prog_mid_palette[] = { 0x7cf, 0x69d, 0x7bf, 0x246, 0x147, 0x468, 0x8cf, 0x25, 0x7be, 0x59d, 0xadf, 0x37a, 0x79b, 0x6bf, 0x9be, 0x9df, }; -unsigned short __attribute__((packed, aligned(4))) prog_mid_bitmap[] = { +unsigned short __attribute__((aligned(4))) prog_mid_bitmap[] = { 0x3, 0x5, 0xc, 0xe, 0xa, 0xf, 0x6, 0x0, 0x2, 0xd, 0x2, 0x8, 0x1, 0x9, 0x1, 0x9, 0x1, 0x9, 0xb, 0x4, 0x7, }; -unsigned int __attribute__((packed, aligned(4))) prog_mid_num_bitmap[] = { +unsigned int __attribute__((aligned(4))) prog_mid_num_bitmap[] = { 6, 6, 6, 6, 12, 6, 12, 6, 12, 18, 12, 6, 1, 1, 1, 1, 1, 1, 6, 6, 6, }; diff --git a/include/prog_start_logo.h b/include/prog_start_logo.h index 9776441..fffe297 100644 --- a/include/prog_start_logo.h +++ b/include/prog_start_logo.h @@ -1,4 +1,4 @@ -unsigned short __attribute__((packed, aligned(4))) prog_start_palette[] = { +unsigned short __attribute__((aligned(4))) prog_start_palette[] = { 0x0, 0x1, 0x2, 0x3, 0x8ad, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x21, 0x22, 0x25, 0x32, 0x33, 0x234, 0x235, 0x244, 0x245, 0x246, 0x247, 0x255, 0x256, 0x267, 0x468, 0x469, 0x467, 0x7bd, 0x9be, @@ -10,7 +10,7 @@ unsigned short __attribute__((packed, aligned(4))) prog_start_palette[] = { 0x346, 0x7ab, 0x7ac, 0x7ad, 0x7ae, 0x9bd, 0x7be, 0x7bf, 0x9cd, 0x7ce, 0x7cf, 0x9df, }; -unsigned short __attribute__((packed, aligned(4))) prog_start_bitmap[] = { +unsigned short __attribute__((aligned(4))) prog_start_bitmap[] = { 0x0, 0x1, 0x7, 0x34, 0x12, 0x3b, 0x13, 0x16, 0x0, 0x1, 0x34, 0x10, 0x3d, 0x41, 0x1b, 0x1f, 0x1e, 0x0, 0x1, 0x7, 0x34, 0x50, 0x1b, 0x46, 0x23, 0x25, 0x26, 0x4e, 0x4d, 0x1, @@ -34,7 +34,7 @@ unsigned short __attribute__((packed, aligned(4))) prog_start_bitmap[] = { 0xe, 0xf, 0x4c, 0x3b, 0x3a, 0x0, 0x5, 0x6, 0xb, 0xc, 0xe, 0xf, 0xe, 0xc, }; -unsigned int __attribute__((packed, aligned(4))) prog_start_num_bitmap[] = { +unsigned int __attribute__((aligned(4))) prog_start_num_bitmap[] = { 4, 1, 1, 1, 1, 1, 2, 6, 4, 1, 1, 1, 2, 1, 1, 2, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 2, diff --git a/include/sp_bmp_logo.h b/include/sp_bmp_logo.h index 447ff73..80383cc 100644 --- a/include/sp_bmp_logo.h +++ b/include/sp_bmp_logo.h @@ -1,4 +1,4 @@ -unsigned short __attribute__((packed, aligned(4))) sp_palette[] = { +unsigned short __attribute__((aligned(4))) sp_palette[] = { 0x0, 0x1, 0x6ab, 0x269, 0x156, 0x44, 0x133, 0xbde, 0x3ad, 0xad, 0x10, 0x11, 0x12, 0x13, 0x211, 0xae, 0x9a, 0x59, 0x78, 0x1af, 0x233, 0x455, 0x221, 0x22, 0x23, 0x24, 0x289, 0x677, 0x799, 0x232, @@ -23,7 +23,7 @@ unsigned short __attribute__((packed, aligned(4))) sp_palette[] = { 0xbce, 0xddc, 0xddd, 0xdde, 0xbc, 0xade, 0xded, 0xfee, 0xfef, 0xcee, 0x27a, 0xff, 0x8aa, 0xffe, 0xfff, }; -unsigned short __attribute__((packed, aligned(4))) sp_bitmap[] = { +unsigned short __attribute__((aligned(4))) sp_bitmap[] = { 0x0, 0x40, 0x7b, 0x6c, 0x18, 0x0, 0x18, 0x6c, 0x87, 0x83, 0x87, 0x74, 0x0, 0x32, 0x83, 0x87, 0x83, 0x17, 0x0, 0xb, 0x58, 0x87, 0x83, 0x17, 0x0, 0x1f, 0x74, 0x87, 0x83, 0x17, @@ -788,7 +788,7 @@ unsigned short __attribute__((packed, aligned(4))) sp_bitmap[] = { 0xa3, 0x7a, 0x0, 0x8d, 0x0, 0xb, 0x3f, 0x12, 0x40, 0x3f, 0x33, 0x3f, 0x33, 0x4, 0x9e, 0x1f, 0x8f, 0x8d, 0x0, }; -unsigned int __attribute__((packed, aligned(4))) sp_num_bitmap[] = { +unsigned int __attribute__((aligned(4))) sp_num_bitmap[] = { 6786, 1, 1, 1, 1, 508, 1, 1, 1, 1, 1, 1, 507, 1, 1, 1, 4, 1, 504, 1, 1, 1, 6, 1, 503, 1, 1, 1, 7, 1, diff --git a/include/thor_bmp_logo.h b/include/thor_bmp_logo.h index e207187..12af40b 100644 --- a/include/thor_bmp_logo.h +++ b/include/thor_bmp_logo.h @@ -1,4 +1,4 @@ -unsigned short __attribute__((packed, aligned(4))) thor_palette[] = { +unsigned short __attribute__((aligned(4))) thor_palette[] = { 0x0, 0x1, 0x2, 0x3, 0xaac, 0x10, 0x11, 0x12, 0x13, 0x14, 0x22, 0x23, 0x24, 0x25, 0x26, 0x33, 0x34, 0x35, 0x36, 0x37, 0x45, 0x46, 0x47, 0x57, 0x6a, 0x6b, 0x6c, 0xabd, 0xabe, 0x877, @@ -41,7 +41,7 @@ unsigned short __attribute__((packed, aligned(4))) thor_palette[] = { 0x78a, 0x78b, 0x79a, 0x79b, 0x79c, 0x29a, 0x7aa, 0x7ab, 0x7ac, 0x7bc, 0x7bd, 0x7be, 0x7cd, 0x7ce, 0xfee, 0xfef, 0xffe, 0xfff, }; -unsigned short __attribute__((packed, aligned(4))) thor_bitmap[] = { +unsigned short __attribute__((aligned(4))) thor_bitmap[] = { 0x0, 0x1, 0x6, 0x7, 0x6, 0x0, 0x1, 0x8, 0x8c, 0xcd, 0x105, 0xcd, 0x4e, 0xb, 0x6, 0x0, 0x1, 0x7, 0x47, 0xce, 0x13d, 0x189, 0x18e, 0x18d, 0x10a, 0x8c, 0xa, 0x1, 0x0, 0x1, @@ -2905,7 +2905,7 @@ unsigned short __attribute__((packed, aligned(4))) thor_bitmap[] = { 0xc, 0x7, 0x6, 0x1, 0x0, 0x1, 0x7, 0x46, 0x88, 0x4a, 0xb, 0x1, 0x0, 0x1, 0x2, 0x1, 0x0, }; -unsigned int __attribute__((packed, aligned(4))) thor_num_bitmap[] = { +unsigned int __attribute__((aligned(4))) thor_num_bitmap[] = { 1320, 3, 2, 2, 1, 367, 4, 1, 1, 1, 1, 1, 1, 1, 1, 365, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 361, 5, -- 2.7.4 From df8dde92f49793a4ad21811252f47acf7776c370 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 27 Dec 2017 13:45:34 +0900 Subject: [PATCH 02/16] arm: sc8830: fix redefined macro warnings There are several redefied macro warnings. Remove the warnings with NOTE: some macro value are different from previous define, so it changes to use #undef when the macro is defined. Change-Id: I54284b2de3d26c2385d5e1ae356882a4507754c0 Signed-off-by: Seung-Woo Kim --- arch/arm/include/asm/arch-sc8830/analog_reg_v3.h | 6 +++--- arch/arm/include/asm/arch-sc8830/chip_x30g/__hardware-sc8830.h | 6 ++++++ arch/arm/include/asm/arch-sc8830/gpio_reg_v0.h | 6 ++++++ arch/arm/include/asm/arch-sc8830/ldo.h | 9 +++++++++ arch/arm/include/asm/arch-sc8830/regs_adi.h | 3 +++ arch/arm/include/asm/arch-sc8830/regs_ahb.h | 9 +++++++++ arch/arm/include/asm/arch-sc8830/regs_global.h | 3 +++ arch/arm/include/asm/arch-sc8830/rtc_reg_v3.h | 3 +++ arch/arm/include/asm/arch-sc8830/secure_boot.h | 1 - arch/arm/include/asm/arch-sc8830/sprd_reg_base.h | 3 +++ arch/arm/include/asm/arch-sc8830/sys_timer_reg_v0.h | 3 +++ arch/arm/include/asm/arch-sc8830/watchdog_reg_v3.h | 3 +++ 12 files changed, 51 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-sc8830/analog_reg_v3.h b/arch/arm/include/asm/arch-sc8830/analog_reg_v3.h index 0a87fb3..b684122 100644 --- a/arch/arm/include/asm/arch-sc8830/analog_reg_v3.h +++ b/arch/arm/include/asm/arch-sc8830/analog_reg_v3.h @@ -109,9 +109,9 @@ extern "C" #define ANA_APB_ARM_MF_REG (ANA_REGS_GLB_PHYS + 0x110) #define ANA_APB_AFUSE_CTL (ANA_REGS_GLB_PHYS + 0x114) #define ANA_APB_AFUSE_OUT0 (ANA_REGS_GLB_PHYS + 0x118) -#define ANA_APB_AFUSE_OUT0 (ANA_REGS_GLB_PHYS + 0x11C) -#define ANA_APB_AFUSE_OUT0 (ANA_REGS_GLB_PHYS + 0x120) -#define ANA_APB_AFUSE_OUT0 (ANA_REGS_GLB_PHYS + 0x124) +#define ANA_APB_AFUSE_OUT1 (ANA_REGS_GLB_PHYS + 0x11C) +#define ANA_APB_AFUSE_OUT2 (ANA_REGS_GLB_PHYS + 0x120) +#define ANA_APB_AFUSE_OUT3 (ANA_REGS_GLB_PHYS + 0x124) #define ANA_APB_ARCH_EN (ANA_REGS_GLB_PHYS + 0x128) #define ANA_APB_MCU_WR_PROT_VAL (ANA_REGS_GLB_PHYS + 0x12C) #define ANA_APB_DCDC_CORE (ANA_REGS_GLB_PHYS + 0x160) diff --git a/arch/arm/include/asm/arch-sc8830/chip_x30g/__hardware-sc8830.h b/arch/arm/include/asm/arch-sc8830/chip_x30g/__hardware-sc8830.h index 2df05e1..73187b3 100644 --- a/arch/arm/include/asm/arch-sc8830/chip_x30g/__hardware-sc8830.h +++ b/arch/arm/include/asm/arch-sc8830/chip_x30g/__hardware-sc8830.h @@ -223,6 +223,9 @@ #define SPRD_KPD_PHYS 0X40250000 #define SPRD_KPD_SIZE SZ_4K +#ifdef SPRD_PWM_BASE +#undef SPRD_PWM_BASE +#endif #define SPRD_PWM_BASE SCI_IOMAP(0x20a000) #define SPRD_PWM_PHYS 0X40260000 #define SPRD_PWM_SIZE SZ_4K @@ -465,6 +468,9 @@ #define ANA_CTL_GLB_BASE ( SPRD_MISC_BASE + 0x8800 ) +#ifdef ADC_BASE +#undef ADC_BASE +#endif #define ADC_BASE ((unsigned int)SPRD_ADI_BASE + 0x8300) #ifndef REGS_AHB_BASE diff --git a/arch/arm/include/asm/arch-sc8830/gpio_reg_v0.h b/arch/arm/include/asm/arch-sc8830/gpio_reg_v0.h index fe14904..87bea2f 100644 --- a/arch/arm/include/asm/arch-sc8830/gpio_reg_v0.h +++ b/arch/arm/include/asm/arch-sc8830/gpio_reg_v0.h @@ -29,7 +29,13 @@ extern "C" /**---------------------------------------------------------------------------* ** Micro Define ** **---------------------------------------------------------------------------*/ +#ifdef ANA_GPIO_BASE +#undef ANA_GPIO_BASE +#endif #define ANA_GPIO_BASE SPRD_ANA_GPIO_PHYS +#ifdef GPIO_BASE +#undef GPIO_BASE +#endif #define GPIO_BASE SPRD_GPIO_PHYS //GPIO_OFFSET #define GPIO_DATA 0x0000 //GPIO data register diff --git a/arch/arm/include/asm/arch-sc8830/ldo.h b/arch/arm/include/asm/arch-sc8830/ldo.h index 24e7089..2d9f34c 100644 --- a/arch/arm/include/asm/arch-sc8830/ldo.h +++ b/arch/arm/include/asm/arch-sc8830/ldo.h @@ -18,6 +18,9 @@ #include /* set or clear the bit of register in reg_addr address */ +#ifdef REG_SETCLRBIT +#undef REG_SETCLRBIT +#endif #define REG_SETCLRBIT(_reg_addr, _set_bit, _clr_bit) \ do { \ unsigned int reg_val = 0; \ @@ -31,6 +34,9 @@ #define REG_SETBIT(_reg_addr, _bit_mask, _bit_set) ANA_REG_MSK_OR(_reg_addr, _bit_set, _bit_mask); /* macro used to get voltage level(one bit level) */ +#ifdef GET_LEVELBIT +#undef GET_LEVELBIT +#endif #define GET_LEVELBIT(_reg_addr, _bit_mask, _bit_set, _level_var) \ do { \ (_level_var) |= \ @@ -38,6 +44,9 @@ } while (0) /* macro used to get voltage level */ +#ifdef GET_LEVEL +#undef GET_LEVEL +#endif #define GET_LEVEL(_reg_addr, _bit0_mask, _bit1_mask, _level_var) \ do { \ (_level_var) |= \ diff --git a/arch/arm/include/asm/arch-sc8830/regs_adi.h b/arch/arm/include/asm/arch-sc8830/regs_adi.h index f7d9be7..e2547af 100644 --- a/arch/arm/include/asm/arch-sc8830/regs_adi.h +++ b/arch/arm/include/asm/arch-sc8830/regs_adi.h @@ -17,6 +17,9 @@ #include #include +#ifdef SPRD_ADI_BASE +#undef SPRD_ADI_BASE +#endif #define SPRD_ADI_BASE SPRD_MISC_PHYS #define ADI_CTL_REG (SPRD_ADI_BASE + 0x4 ) diff --git a/arch/arm/include/asm/arch-sc8830/regs_ahb.h b/arch/arm/include/asm/arch-sc8830/regs_ahb.h index 2a2294d..eabfd15 100644 --- a/arch/arm/include/asm/arch-sc8830/regs_ahb.h +++ b/arch/arm/include/asm/arch-sc8830/regs_ahb.h @@ -23,6 +23,9 @@ #define CHIP_TYPE 0x209003FC #define AHB_CTL0 (AHB_REG_BASE + 0x00) +#ifdef AHB_SOFT_RST +#undef AHB_SOFT_RST +#endif #define AHB_SOFT_RST (AHB_REG_BASE + 0x04) #define AHB_PAUSE (AHB_REG_BASE + 0x14) #define AHB_REMAP (AHB_REG_BASE + 0x18) @@ -35,9 +38,15 @@ #define DSP_BOOT_VEC (AHB_REG_BASE + 0x88) #define DSP_RST (AHB_REG_BASE + 0x8C) #define AHB_ENDIAN_EN (AHB_REG_BASE + 0x90) +#ifdef USB_PHY_CTRL +#undef USB_PHY_CTRL +#endif #define USB_PHY_CTRL (AHB_REG_BASE + 0xA0) #define USB_SPR_REG (AHB_REG_BASE + 0xC0) +#ifdef CHIP_ID +#undef CHIP_ID +#endif #define CHIP_ID (AHB_REG_BASE + 0x1FC) #define AHB_DSP_BOOT_EN (AHB_REG_BASE + 0x84) diff --git a/arch/arm/include/asm/arch-sc8830/regs_global.h b/arch/arm/include/asm/arch-sc8830/regs_global.h index 5ba2e9d..159052b 100644 --- a/arch/arm/include/asm/arch-sc8830/regs_global.h +++ b/arch/arm/include/asm/arch-sc8830/regs_global.h @@ -18,6 +18,9 @@ #include /*----------Global Registers----------*/ +#ifdef GREG_BASE +#undef GREG_BASE +#endif #define GREG_BASE 0x4B000000 #define GR_GEN0 (GREG_BASE + 0x0008) diff --git a/arch/arm/include/asm/arch-sc8830/rtc_reg_v3.h b/arch/arm/include/asm/arch-sc8830/rtc_reg_v3.h index b3693ab..88c994f 100644 --- a/arch/arm/include/asm/arch-sc8830/rtc_reg_v3.h +++ b/arch/arm/include/asm/arch-sc8830/rtc_reg_v3.h @@ -31,6 +31,9 @@ extern "C" //// /*----------Real Timer Counter Register----------*/ /// +#ifdef RTC_BASE +#undef RTC_BASE +#endif #define RTC_BASE SPRD_ANA_RTC_PHYS #define ANA_RTC_SEC_CNT (RTC_BASE + 0x00) #define ANA_RTC_MIN_CNT (RTC_BASE + 0x04) diff --git a/arch/arm/include/asm/arch-sc8830/secure_boot.h b/arch/arm/include/asm/arch-sc8830/secure_boot.h index e299c7b..8f48701 100644 --- a/arch/arm/include/asm/arch-sc8830/secure_boot.h +++ b/arch/arm/include/asm/arch-sc8830/secure_boot.h @@ -4,7 +4,6 @@ #define KEY_INFO_SIZ (512) #define CUSTOM_DATA_SIZ (1024) #define VLR_INFO_SIZ (512) -#define VLR_INFO_OFF (512) #if defined(CONFIG_SPX30G) #define INTER_RAM_BEGIN 0x50003000 diff --git a/arch/arm/include/asm/arch-sc8830/sprd_reg_base.h b/arch/arm/include/asm/arch-sc8830/sprd_reg_base.h index 599664d..b5c67ad 100644 --- a/arch/arm/include/asm/arch-sc8830/sprd_reg_base.h +++ b/arch/arm/include/asm/arch-sc8830/sprd_reg_base.h @@ -214,6 +214,9 @@ extern "C" #define EFUSE_BASE CTL_BASE_EFUSE #define GPIO_BASE CTL_BASE_GPIO #define PWM_BASE CTL_BASE_PWM +#ifdef GREG_BASE +#undef GREG_BASE +#endif #define GREG_BASE CTL_BASE_GLB_REG #define WDG_BASE 0x40038040 //CHGR_WDG:0x820003C0 WDG:0x82000040 diff --git a/arch/arm/include/asm/arch-sc8830/sys_timer_reg_v0.h b/arch/arm/include/asm/arch-sc8830/sys_timer_reg_v0.h index 3855ed3..03f5ddb 100644 --- a/arch/arm/include/asm/arch-sc8830/sys_timer_reg_v0.h +++ b/arch/arm/include/asm/arch-sc8830/sys_timer_reg_v0.h @@ -30,6 +30,9 @@ extern "C" /*----------System Count----------*/ #include "sprd_reg.h" +#ifdef SYSTIMER_BASE +#undef SYSTIMER_BASE +#endif #define SYSTIMER_BASE (SPRD_SYSCNT_PHYS) #define SYS_ALM (SYSTIMER_BASE + 0x0000) diff --git a/arch/arm/include/asm/arch-sc8830/watchdog_reg_v3.h b/arch/arm/include/asm/arch-sc8830/watchdog_reg_v3.h index 7d70738..7497326 100644 --- a/arch/arm/include/asm/arch-sc8830/watchdog_reg_v3.h +++ b/arch/arm/include/asm/arch-sc8830/watchdog_reg_v3.h @@ -30,6 +30,9 @@ extern "C" /*----------Watchdog Timer Counter Register----------*/ #include "sprd_reg.h" +#ifdef WDG_BASE +#undef WDG_BASE +#endif #define WDG_BASE (SPRD_ANA_WDG_PHYS) #define WDG_LOAD_LOW (WDG_BASE + 0x00) #define WDG_LOAD_HIGH (WDG_BASE + 0x04) -- 2.7.4 From 2b427c722a66bd4766e19a897c1ce81b184d41e8 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 28 Dec 2017 14:30:33 +0900 Subject: [PATCH 03/16] arm: sc8830: remove build warnings Remove build warnings from sc8830 arch bsp code. Change-Id: I253660a28de843f9f0e61ce7d5bd0a75cf05a86b Signed-off-by: Seung-Woo Kim --- arch/arm/cpu/armv7/sc8830/Tshark_boot_cp.c | 4 +- arch/arm/cpu/armv7/sc8830/adi.c | 2 +- arch/arm/cpu/armv7/sc8830/ana_efuse.c | 4 -- arch/arm/cpu/armv7/sc8830/check_reboot.c | 46 ++++++++++++---------- .../arm/cpu/armv7/sc8830/chip_x30g/chip_phy_x30g.c | 17 ++++---- arch/arm/cpu/armv7/sc8830/clock.c | 33 ++++++---------- arch/arm/cpu/armv7/sc8830/dcdc_cal_sc2723.c | 6 +-- arch/arm/cpu/armv7/sc8830/eic.c | 14 ++----- arch/arm/cpu/armv7/sc8830/glb.c | 1 - arch/arm/cpu/armv7/sc8830/gpio.c | 11 ------ arch/arm/cpu/armv7/sc8830/misc.c | 45 ++++++++++++--------- arch/arm/cpu/armv7/sc8830/otp-helper.c | 3 ++ arch/arm/cpu/armv7/sc8830/watchdog.c | 8 ++++ arch/arm/cpu/armv7/sc8830/watchdog_hal.c | 21 ++++------ arch/arm/cpu/armv7/sc8830/watchdog_phy_v3.c | 6 +-- arch/arm/include/asm/arch-sc8830/boot_drvapi.h | 2 +- arch/arm/include/asm/arch-sc8830/gpio_phy.h | 7 ++++ 17 files changed, 111 insertions(+), 119 deletions(-) diff --git a/arch/arm/cpu/armv7/sc8830/Tshark_boot_cp.c b/arch/arm/cpu/armv7/sc8830/Tshark_boot_cp.c index db67971..d823155 100644 --- a/arch/arm/cpu/armv7/sc8830/Tshark_boot_cp.c +++ b/arch/arm/cpu/armv7/sc8830/Tshark_boot_cp.c @@ -6,7 +6,7 @@ static u32 state; void boot_cp0(void) { u32 m_data[3] = {0xe59f0000, 0xe12fff10, MODEM_ADR}; - memcpy(CP0_CODE_COPY_ADR, m_data, sizeof(m_data)); /* copy cp0 source code */ + memcpy((u32 *)CP0_CODE_COPY_ADR, m_data, sizeof(m_data)); /* copy cp0 source code */ *((volatile u32*)COOPERATE_PMU_CTRL0_ADDR) &= ~BIT_25; /* open cp0 pmu controller*/ msleep(50); @@ -32,7 +32,7 @@ void boot_cp1(void); void boot_cp2(void) { u32 wcndata[3] = {0xe59f0000, 0xe12fff10, WCNMODEM_ADR}; - memcpy(CP2_CODE_COPY_ADR, wcndata, sizeof(wcndata)); /* copy cp2 source code */ + memcpy((u32 *)CP2_CODE_COPY_ADR, wcndata, sizeof(wcndata)); /* copy cp2 source code */ *((volatile u32*)COOPERATE_PMU_CTRL2_ADDR) &= ~BIT_25; /* open cp2 pmu controller*/ msleep(50); diff --git a/arch/arm/cpu/armv7/sc8830/adi.c b/arch/arm/cpu/armv7/sc8830/adi.c index d86400f..f4cacda 100644 --- a/arch/arm/cpu/armv7/sc8830/adi.c +++ b/arch/arm/cpu/armv7/sc8830/adi.c @@ -169,7 +169,7 @@ static inline int __adi_read(u32 regPddr) if (cnt + 1 <= 0){ while(1){ - printf("[0x%s]: ADI READ timeout!!! reg = 0x%x, value = 0x%x\n", __func__, regPddr, val); + printf("[0x%s]: ADI READ timeout!!! reg = 0x%x, value = 0x%lx\n", __func__, regPddr, val); udelay(1000000); } } diff --git a/arch/arm/cpu/armv7/sc8830/ana_efuse.c b/arch/arm/cpu/armv7/sc8830/ana_efuse.c index 8fff484..080c4ef 100644 --- a/arch/arm/cpu/armv7/sc8830/ana_efuse.c +++ b/arch/arm/cpu/armv7/sc8830/ana_efuse.c @@ -82,10 +82,6 @@ static void adie_efuse_unlock(void) { } -static void adie_efuse_reset(void) -{ -} - static void __adie_efuse_power_on(void) { sci_adi_set(ANA_REG_GLB_ARM_MODULE_EN, BIT_ANA_EFS_EN); diff --git a/arch/arm/cpu/armv7/sc8830/check_reboot.c b/arch/arm/cpu/armv7/sc8830/check_reboot.c index f751d8f..7a936e4 100644 --- a/arch/arm/cpu/armv7/sc8830/check_reboot.c +++ b/arch/arm/cpu/armv7/sc8830/check_reboot.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -36,15 +37,20 @@ #define debugf(fmt, args...) #endif - extern int hw_watchdog_rst_pending(void); -extern inline int is_7s_reset(void); +extern int is_7s_reset(void); extern int is_7s_reset_for_systemdump(void); -extern inline int is_hw_smpl_enable(void); +extern int is_hw_smpl_enable(void); __attribute__ ((gnu_inline))inline int is_smpl_bootup(void); +extern void reset_cpu(ulong ignored); +extern void power_down_cpu(ulong ignored); +extern int sci_glb_set(u32 reg, u32 bit); +extern int sprd_eic_get(unsigned offset); +extern int sprd_eic_request(unsigned offset); + unsigned check_reboot_mode(void) { - unsigned val, rst_mode= 0; + unsigned rst_mode= 0; unsigned hw_rst_mode = ANA_REG_GET(ANA_REG_GLB_POR_SRC_FLAG); debugf("hw_rst_mode==%x\n", hw_rst_mode); @@ -120,7 +126,22 @@ unsigned check_reboot_mode(void) } -int get_mode_from_gpio() +int charger_connected(void) +{ + sprd_eic_request(EIC_CHG_INT); + udelay(3000); + debugf("eica status %x\n", sprd_eic_get(EIC_CHG_INT)); +#ifdef CONFIG_SHARK_PAD_HW_V102 + sprd_eic_request(EIC_USB_DETECT); + udelay(3000); + debugf("eica status %x\n", sprd_eic_get(EIC_USB_DETECT)); + return (!!sprd_eic_get(EIC_USB_DETECT)) ||(!!sprd_eic_get(EIC_CHG_INT)); +#else + return !!sprd_eic_get(EIC_CHG_INT); +#endif +} + +int get_mode_from_gpio(void) { int ret = 0; unsigned hw_rst_mode; @@ -187,21 +208,6 @@ int power_button_pressed(void) } -int charger_connected(void) -{ - sprd_eic_request(EIC_CHG_INT); - udelay(3000); - debugf("eica status %x\n", sprd_eic_get(EIC_CHG_INT)); -#ifdef CONFIG_SHARK_PAD_HW_V102 - sprd_eic_request(EIC_USB_DETECT); - udelay(3000); - debugf("eica status %x\n", sprd_eic_get(EIC_USB_DETECT)); - return (!!sprd_eic_get(EIC_USB_DETECT)) ||(!!sprd_eic_get(EIC_CHG_INT)); -#else - return !!sprd_eic_get(EIC_CHG_INT); -#endif -} - int alarm_triggered(void) { //printf("ANA_RTC_INT_RSTS is 0x%x\n", ANA_RTC_INT_RSTS); diff --git a/arch/arm/cpu/armv7/sc8830/chip_x30g/chip_phy_x30g.c b/arch/arm/cpu/armv7/sc8830/chip_x30g/chip_phy_x30g.c index 57c5639..de834a1 100644 --- a/arch/arm/cpu/armv7/sc8830/chip_x30g/chip_phy_x30g.c +++ b/arch/arm/cpu/armv7/sc8830/chip_x30g/chip_phy_x30g.c @@ -18,6 +18,7 @@ /**---------------------------------------------------------------------------* ** Dependencies * **---------------------------------------------------------------------------*/ +#include #include #include "asm/arch/sc_reg.h" #include "asm/arch/adi_hal_internal.h" @@ -56,6 +57,8 @@ struct dcdc_core_ds_step_info{ /**---------------------------------------------------------------------------* ** Function Definitions * **---------------------------------------------------------------------------*/ +extern int calibrate_register_callback(void *callback_fun); + /*****************************************************************************/ // Description : This function is used to reset MCU. // Global resource dependence : @@ -200,7 +203,7 @@ PUBLIC void CHIP_PHY_SetWDGHWFlag (WDG_HW_FLAG_T type, uint32 val) // Author: Jeff.Li // Note: Do nothing. There are 32KB internal ram dedicated for ARM. /*****************************************************************************/ -PUBLIC void CHIP_PHY_BootIramEn () +PUBLIC void CHIP_PHY_BootIramEn (void) { } @@ -233,7 +236,7 @@ PUBLIC BOOLEAN CHIP_PHY_IsWDGRstByMCU (uint32 flag) // Note : | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 | // |ALL_HRST_MONITOR | POR_HRST_MONITOR| WDG_HRST_MONITOR | /*****************************************************************************/ -PUBLIC BOOLEAN CHIP_PHY_IsResetByPowerUp() +PUBLIC BOOLEAN CHIP_PHY_IsResetByPowerUp(void) { if ((CHIP_PHY_GetANAReg () & 0xF0) == 0x0) { @@ -252,7 +255,7 @@ PUBLIC BOOLEAN CHIP_PHY_IsResetByPowerUp() // Note : | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 | // |ALL_HRST_MONITOR | POR_HRST_MONITOR| WDG_HRST_MONITOR | /*****************************************************************************/ -PUBLIC BOOLEAN CHIP_PHY_IsResetByWatchDog() +PUBLIC BOOLEAN CHIP_PHY_IsResetByWatchDog(void) { if ((CHIP_PHY_GetANAReg () & 0xF) == 0x0) { @@ -717,9 +720,9 @@ static void dcdc_optimize_config(unsigned int para) static void dcdc_core_ds_config(unsigned int para) { #if defined(CONFIG_ADIE_SC2723S) || defined(CONFIG_ADIE_SC2723) +#if 0 uint32 dcdc_core_ctl_adi = 0; uint32 reg_val = 0; -#if 0 uint32 dcdc_core_ctl_ds = -1; uint32 dcdc_core_cal_adi = 0; uint32 reg_val_cal = 0; @@ -843,9 +846,9 @@ struct ddr_phy_lp_reg_ctrl lp_cfg= 0x00000007, #endif 0x99998888, - 0x402b006c, + {0x402b006c, 0x402b0140, - 0x402b0144 + 0x402b0144} }; static unsigned int dmc_phy_is_auto_pd(unsigned int is_auto_pd) { @@ -865,8 +868,6 @@ static unsigned int dmc_phy_is_auto_pd(unsigned int is_auto_pd) static void setup_ap_cp_sync_sleep_code(unsigned int start_addr) { #ifndef CONFIG_SPX20 - unsigned int *sa = (unsigned int*)start_addr; - dmc_phy_is_auto_pd(lp_cfg.is_auto_pd); #endif /*enable cp2 can access 0x50001800*/ diff --git a/arch/arm/cpu/armv7/sc8830/clock.c b/arch/arm/cpu/armv7/sc8830/clock.c index 2496a67..6a25432 100644 --- a/arch/arm/cpu/armv7/sc8830/clock.c +++ b/arch/arm/cpu/armv7/sc8830/clock.c @@ -17,10 +17,6 @@ #define __ffs(x) (ffs(x) - 1) -#define DEFINE_SPINLOCK(...) -#define spin_lock_irqsave(...) -#define spin_unlock_irqrestore(...) - #include #include #include @@ -36,7 +32,11 @@ const u32 __clkinit2 __clkinit_end = &CLK_LK_clk_mpll; //#define debug0 printf -DEFINE_SPINLOCK(clocks_lock); +extern void clkdev_add(struct clk_lookup *cl); +extern int sci_glb_set(u32 reg, u32 bit); +extern int sci_glb_clr(u32 reg, u32 bit); +extern u32 sci_glb_read(u32 reg, u32 msk); +extern int sci_glb_write(u32 reg, u32 val, u32 msk); int clk_enable(struct clk *clk) { @@ -46,10 +46,8 @@ int clk_enable(struct clk *clk) clk_enable(clk->parent); - spin_lock_irqsave(&clocks_lock, flags); if ((clk->usage++) == 0 && clk->enable) (clk->enable) (clk, 1, &flags); - spin_unlock_irqrestore(&clocks_lock, flags); debug0("clk %p, usage %d\n", clk, clk->usage); return 0; } @@ -62,16 +60,13 @@ void clk_disable(struct clk *clk) if (IS_ERR_OR_NULL(clk)) return; - spin_lock_irqsave(&clocks_lock, flags); if ((--clk->usage) == 0 && clk->enable) (clk->enable) (clk, 0, &flags); if (WARN(clk->usage < 0, "warning: clock (%s) usage (%d)\n", clk->regs->name, clk->usage)) { clk->usage = 0; /* force reset clock refcnt */ - spin_unlock_irqrestore(&clocks_lock, flags); return; } - spin_unlock_irqrestore(&clocks_lock, flags); debug0("clk %p, usage %d\n", clk, clk->usage); clk_disable(clk->parent); } @@ -135,7 +130,6 @@ EXPORT_SYMBOL(clk_round_rate); int clk_set_rate(struct clk *clk, unsigned long rate) { int ret; - unsigned long flags; debug0("clk %p, rate %lu\n", clk, rate); if (IS_ERR_OR_NULL(clk) || rate == 0) return -EINVAL; @@ -150,9 +144,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) if (clk->ops == NULL || clk->ops->set_rate == NULL) return -EINVAL; - spin_lock_irqsave(&clocks_lock, flags); ret = (clk->ops->set_rate) (clk, rate); - spin_unlock_irqrestore(&clocks_lock, flags); return ret; } @@ -168,7 +160,6 @@ EXPORT_SYMBOL(clk_get_parent); int clk_set_parent(struct clk *clk, struct clk *parent) { int ret = -EACCES; - unsigned long flags; #if defined(CONFIG_DEBUG_FS) struct clk *old_parent = clk_get_parent(clk); debug0("clk %p, parent %p <<< %p\n", clk, parent, old_parent); @@ -176,10 +167,8 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (IS_ERR_OR_NULL(clk) || IS_ERR(parent)) return -EINVAL; - spin_lock_irqsave(&clocks_lock, flags); if (clk->ops && clk->ops->set_parent) ret = (clk->ops->set_parent) (clk, parent); - spin_unlock_irqrestore(&clocks_lock, flags); #if defined(CONFIG_DEBUG_FS) /* FIXME: call debugfs_rename() out of spin lock, @@ -209,14 +198,10 @@ static int sci_clk_enable(struct clk *c, int enable, unsigned long *pflags) enable = !enable; if (!c->regs->enb.mask) { /* enable matrix clock */ - if (pflags) - spin_unlock_irqrestore(&clocks_lock, *pflags); if (enable) clk_enable((struct clk *)c->regs->enb.reg); else clk_disable((struct clk *)c->regs->enb.reg); - if (pflags) - spin_lock_irqsave(&clocks_lock, *pflags); } else { if (enable) sci_glb_set(c->regs->enb.reg & ~1, c->regs->enb.mask); @@ -449,6 +434,7 @@ int __init sci_clk_register(struct clk_lookup *cl) return 0; } +#ifdef CONFIG_NKERNEL static int __init sci_clock_dump(void) { struct clk_lookup *cl = (struct clk_lookup *)(&__clkinit_begin + 1); @@ -464,8 +450,10 @@ static int __init sci_clock_dump(void) } return 0; } +#endif -static int __clk_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) +#if 0 +static int __clk_cpufreq_notifier(struct notifier_block nb, unsigned long val, void *data) { struct cpufreq_freqs *freq = data; @@ -479,6 +467,7 @@ static int __clk_cpufreq_notifier(struct notifier_block *nb, unsigned long val, static struct notifier_block __clk_cpufreq_notifier_block = { .notifier_call = __clk_cpufreq_notifier }; +#endif int __init sci_clock_init(void) { @@ -514,7 +503,7 @@ int __init sci_clock_init(void) return 0; } -#ifndef CONFIG_NKERNEL +#ifdef CONFIG_NKERNEL arch_initcall(sci_clock_init); late_initcall_sync(sci_clock_dump); #endif diff --git a/arch/arm/cpu/armv7/sc8830/dcdc_cal_sc2723.c b/arch/arm/cpu/armv7/sc8830/dcdc_cal_sc2723.c index 2c2babe..01aa8d6 100644 --- a/arch/arm/cpu/armv7/sc8830/dcdc_cal_sc2723.c +++ b/arch/arm/cpu/armv7/sc8830/dcdc_cal_sc2723.c @@ -782,11 +782,11 @@ typedef struct { }vol_para_t; #if defined(CONFIG_FDL2_BUILD) -vol_para_t **ppvol_para = 0x50000020; +vol_para_t **ppvol_para = (vol_para_t **)0x50000020; #elif defined(CONFIG_SPL_32K) -vol_para_t **ppvol_para = 0x50003C20; +vol_para_t **ppvol_para = (vol_para_t **)0x50003C20; #else -vol_para_t **ppvol_para = 0x50003C20; +vol_para_t **ppvol_para = (vol_para_t **)0x50003C20; #endif static int get_vol_para_num(void) diff --git a/arch/arm/cpu/armv7/sc8830/eic.c b/arch/arm/cpu/armv7/sc8830/eic.c index 7b8a94a..65f5949 100644 --- a/arch/arm/cpu/armv7/sc8830/eic.c +++ b/arch/arm/cpu/armv7/sc8830/eic.c @@ -11,6 +11,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include @@ -22,9 +23,7 @@ #define KERN_WARNING "" #define WARN(nmu, fmt...) printf(fmt) #define WARN_ON(num) -#define BUG_ON(__cond__) if(__cond__) printf("%s line: %d bug on\n", __FUNCTION__, __LINE__) #define pr_err(fmt...) printf(fmt) -#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) #define pr_debug(fmt...) printf(fmt) //#define DEBUG @@ -76,10 +75,6 @@ enum eic_die { static void __get_eic_base_info (u32 eic_id, struct eic_info *info) { - int i = 0; - u32 table_size = 0; - struct gpio_section *section_table; - if (eic_id>=SPRD_ADIE_EIC_START && eic_id<=SPRD_ADIE_EIC_END) { info->base_addr= SPRD_ANA_EIC_PHYS; @@ -105,7 +100,6 @@ static void __get_eic_base_info (u32 eic_id, struct eic_info *info) static int __eic_get_pin_data (struct eic_info *info) { - u32 offset_addr = 0; u32 reg_addr = 0, reg_data; if (info->base_addr == INVALID_REG) @@ -126,7 +120,6 @@ static int __eic_get_pin_data (struct eic_info *info) static int __eic_get_data_mask (struct eic_info *info) { - u32 offset_addr = 0; u32 reg_addr = 0, reg_data; if (info->base_addr == INVALID_REG) @@ -150,7 +143,6 @@ static int __eic_get_data_mask (struct eic_info *info) */ static void __eic_set_data_mask (struct eic_info *info, int b_on) { - u32 offset_addr = 0; u32 reg_addr = 0, reg_data; reg_addr = info->base_addr + EIC_MASK; @@ -223,6 +215,7 @@ int sprd_eic_request(unsigned offset) return 0; } +#if 0 static void sprd_eic_free(unsigned offset) { unsigned eic_id = offset; @@ -232,6 +225,7 @@ static void sprd_eic_free(unsigned offset) __eic_set_data_mask (&gpio_info, 0); return; } +#endif void sprd_eic_init(void) { @@ -241,7 +235,7 @@ void sprd_eic_init(void) ANA_REG_OR(ANA_REG_GLB_RTC_CLK_EN, BIT_RTC_EIC_EN); } -int get_volumn_down_status2() +int get_volumn_down_status2(void) { int temp_cnt = 600; int status = 0; diff --git a/arch/arm/cpu/armv7/sc8830/glb.c b/arch/arm/cpu/armv7/sc8830/glb.c index 6e666a2..c5ee2a2 100644 --- a/arch/arm/cpu/armv7/sc8830/glb.c +++ b/arch/arm/cpu/armv7/sc8830/glb.c @@ -37,7 +37,6 @@ u32 sci_glb_read(u32 reg, u32 msk) int sci_glb_write(u32 reg, u32 val, u32 msk) { - unsigned long flags, hw_flags; __raw_writel((__raw_readl(reg) & ~msk) | val, reg); return 0; } diff --git a/arch/arm/cpu/armv7/sc8830/gpio.c b/arch/arm/cpu/armv7/sc8830/gpio.c index 3ea3b1e..dd6b536 100644 --- a/arch/arm/cpu/armv7/sc8830/gpio.c +++ b/arch/arm/cpu/armv7/sc8830/gpio.c @@ -80,7 +80,6 @@ static void __gpio_set_dir (struct gpio_info * info, int dir) { int value = !!dir; u32 reg_addr = 0; - unsigned long flags; reg_addr = info->base_addr; @@ -106,7 +105,6 @@ static void __gpio_set_dir (struct gpio_info * info, int dir) return; } - //local_irq_save(flags); value = gpio_reg_get(reg_addr, info->die); if (dir) @@ -114,8 +112,6 @@ static void __gpio_set_dir (struct gpio_info * info, int dir) else value &= ~(1 << info->bit_num); gpio_reg_set(reg_addr, info->die, value); - - //local_irq_restore(flags); } /* @@ -244,7 +240,6 @@ static void __gpio_set_pin_data (struct gpio_info *info ,int b_on) u32 offset_addr; u32 reg_addr; int value; - unsigned long flags; reg_addr = info->base_addr; @@ -254,15 +249,12 @@ static void __gpio_set_pin_data (struct gpio_info *info ,int b_on) reg_addr += offset_addr; - //local_irq_save(flags); - value = gpio_reg_get(reg_addr, info->die); if (b_on) value |= 1 << info->bit_num; else value &= ~(1 << info->bit_num); gpio_reg_set(reg_addr, info->die, value); - //local_irq_restore(flags); } /* @@ -273,21 +265,18 @@ static void __gpio_set_data_mask (struct gpio_info *info, int b_on) int value; u32 reg_addr; u32 offset_addr; - unsigned long flags; reg_addr = info->base_addr; offset_addr = __gpio_get_data_mask_reg_offs(info); if (offset_addr != INVALID_REG) { reg_addr += offset_addr; - //local_irq_save(flags); value = gpio_reg_get(reg_addr, info->die); if (b_on) value |= 1 << info->bit_num; else value &= ~(1 << info->bit_num); gpio_reg_set(reg_addr, info->die, value); - //local_irq_restore(flags); GPIO_DBG("After setting gpio_addr %x data mask :%x\r\n", reg_addr, gpio_reg_get(reg_addr, info->die)); diff --git a/arch/arm/cpu/armv7/sc8830/misc.c b/arch/arm/cpu/armv7/sc8830/misc.c index fbe348f..e3559e4 100644 --- a/arch/arm/cpu/armv7/sc8830/misc.c +++ b/arch/arm/cpu/armv7/sc8830/misc.c @@ -3,6 +3,9 @@ #include #include #include + +extern void __raw_bits_or(unsigned int v, unsigned int a); + /* REG_AON_APB_BOND_OPT0 ==> romcode set REG_AON_APB_BOND_OPT1 ==> set it later @@ -20,7 +23,7 @@ * 1 : enable jtag success * * 0 : enable jtag fail * *************************************************/ -int sprd_jtag_enable() +int sprd_jtag_enable(void) { if (*((volatile unsigned int *)(REG_AON_APB_BOND_OPT0)) & 1) { @@ -35,7 +38,7 @@ int sprd_jtag_enable() * 1 : disable jtag success * * 0 : disable jtag fail * *************************************************/ -int sprd_jtag_disable() +int sprd_jtag_disable(void) { if (!(*((volatile unsigned int *)(REG_AON_APB_BOND_OPT0)) & 1)) { @@ -51,42 +54,44 @@ int sprd_jtag_disable() } } -static void ap_slp_cp_dbg_cfg() +static void ap_slp_cp_dbg_cfg(void) { *((volatile unsigned int *)(REG_AP_AHB_MCU_PAUSE)) |= BIT_MCU_SLEEP_FOLLOW_CA7_EN; //when ap sleep, cp can continue debug } -static void ap_cpll_rel_cfg() +static void ap_cpll_rel_cfg(void) { *((volatile unsigned int *)(REG_PMU_APB_CPLL_REL_CFG)) |= BIT_CPLL_AP_SEL; } -static void bb_bg_auto_en() -{ - *((volatile unsigned int *)(REG_AON_APB_RES_REG0)) |= 1<<8; -} - - -static void ap_close_wpll_en() +#if 0 +static void ap_close_wpll_en(void) { *((volatile unsigned int *)(REG_PMU_APB_CGM_AP_EN)) &= ~BIT_CGM_WPLL_AP_EN; } -static void ap_close_cpll_en() +static void ap_close_cpll_en(void) { *((volatile unsigned int *)(REG_PMU_APB_CGM_AP_EN)) &= ~BIT_CGM_CPLL_AP_EN; } -static void ap_close_wifipll_en() +static void ap_close_wifipll_en(void) { *((volatile unsigned int *)(REG_PMU_APB_CGM_AP_EN)) &= ~BIT_CGM_WIFIPLL1_AP_EN; } +#endif +#ifndef CONFIG_SPX30G +static void bb_bg_auto_en(void) +{ + *((volatile unsigned int *)(REG_AON_APB_RES_REG0)) |= 1<<8; +} -static void bb_ldo_auto_en() +static void bb_ldo_auto_en(void) { *((volatile unsigned int *)(REG_AON_APB_RES_REG0)) |= 1<<9; -} +} +#endif #ifdef CONFIG_PBINT_7S_RESET_V1 @@ -407,7 +412,9 @@ static void vbat_crash_vol_set(void) void pmic_init(void) { +#ifndef CONFIG_TIZEN u32 val; +#endif pbint_7s_rst_cfg(CONFIG_7S_RST_MODULE_EN, CONFIG_7S_RST_SW_MODE, CONFIG_7S_RST_SHORT_MODE); @@ -458,12 +465,12 @@ int tizen_reboot_recovery_check(void) #endif #define REG32(x) (*((volatile uint32 *)(x))) -void gpu_clk_auto_gate_disable() +void gpu_clk_auto_gate_disable(void) { REG32(REG_PMU_APB_CGM_GPU_MM_AUTO_GATE_EN) &= ~(0x7F); } -void misc_init() +void misc_init(void) { scx35_pmu_reconfig(); ap_slp_cp_dbg_cfg(); @@ -505,11 +512,11 @@ typedef struct mem_cs_info }mem_cs_info_t; PUBLIC int get_dram_cs_number(void) { - mem_cs_info_t *cs_info_ptr = 0x1C00; + mem_cs_info_t *cs_info_ptr = (mem_cs_info_t *)0x1C00; return cs_info_ptr->cs_number; } PUBLIC int get_dram_cs0_size(void) { - mem_cs_info_t *cs_info_ptr = 0x1C00; + mem_cs_info_t *cs_info_ptr = (mem_cs_info_t *)0x1C00; return cs_info_ptr->cs0_size; } diff --git a/arch/arm/cpu/armv7/sc8830/otp-helper.c b/arch/arm/cpu/armv7/sc8830/otp-helper.c index f98db8c..9c2a64e 100644 --- a/arch/arm/cpu/armv7/sc8830/otp-helper.c +++ b/arch/arm/cpu/armv7/sc8830/otp-helper.c @@ -35,6 +35,9 @@ #define VOL_P1 4200 #define ADC_DATA_OFFSET 128 +extern int __ddie_efuse_prog(int blk_index, u32 val); +extern u32 __adie_efuse_read(int blk_index); + u32 efuse_read(int id,int blk_index) { return __ddie_efuse_read(blk_index); diff --git a/arch/arm/cpu/armv7/sc8830/watchdog.c b/arch/arm/cpu/armv7/sc8830/watchdog.c index e4de885..5e7bf39 100644 --- a/arch/arm/cpu/armv7/sc8830/watchdog.c +++ b/arch/arm/cpu/armv7/sc8830/watchdog.c @@ -2,8 +2,16 @@ #include #include #include +#include #include +extern void WDG_ClockOn(void); +extern void WDG_ResetMCU(void); +extern void WDG_TimerInit(void); +extern void WDG_TimerStop(void); +extern void WDG_TimerLoad(uint32 time_ms); +extern uint32 WDG_PHY_RST_INT_ON(void); + void start_watchdog(uint32_t init_time_ms) { WDG_ClockOn(); diff --git a/arch/arm/cpu/armv7/sc8830/watchdog_hal.c b/arch/arm/cpu/armv7/sc8830/watchdog_hal.c index 8a0629c..c232703 100644 --- a/arch/arm/cpu/armv7/sc8830/watchdog_hal.c +++ b/arch/arm/cpu/armv7/sc8830/watchdog_hal.c @@ -19,6 +19,7 @@ /**---------------------------------------------------------------------------* ** Dependencies * **---------------------------------------------------------------------------*/ +#include #include #include #include @@ -44,7 +45,6 @@ PUBLIC void WDG_TimerStop ) { WDG_CONFIG_T config; - int32 ret; WDG_TRACE ("Watch Dog Trace: WDG_TimerStop"); WDG_PHY_INT_CLR(); @@ -53,7 +53,7 @@ PUBLIC void WDG_TimerStop config.mode = WDG_TIMEOUT_MODE_RESET; config.val = WDG_MAX_COUNT; - ret = WDG_PHY_CONFIG (&config); + WDG_PHY_CONFIG (&config); return; } @@ -70,7 +70,6 @@ PUBLIC void WDG_TimerStart ) { WDG_CONFIG_T config; - int32 ret; WDG_TRACE ("Watch Dog Trace: WDG_TimerStart"); @@ -78,7 +77,7 @@ PUBLIC void WDG_TimerStart config.mode = WDG_TIMEOUT_MODE_RESET; config.val = init_val; - ret = WDG_PHY_CONFIG (&config); + WDG_PHY_CONFIG (&config); } @@ -100,8 +99,6 @@ PUBLIC void WDG_TimerHandler (uint32 int_num) PUBLIC void WDG_TimerInit (void) { WDG_CONFIG_T config; - uint32 status; - int32 ret; WDG_TRACE ("Watch Dog Trace: WDG_TimerInit"); @@ -109,7 +106,7 @@ PUBLIC void WDG_TimerInit (void) config.mode = WDG_TIMEOUT_MODE_RESET; config.val = WDG_INIT_COUNT; - ret = WDG_PHY_CONFIG (&config); + WDG_PHY_CONFIG (&config); } /*****************************************************************************/ @@ -120,14 +117,13 @@ PUBLIC void WDG_TimerInit (void) PUBLIC void WDG_ResetMCU (void) { WDG_CONFIG_T config; - int32 ret; WDG_TRACE ("Watch Dog Trace: WDG_ResetMCU"); config.state = WDG_TIMER_STATE_START ; config.mode = WDG_TIMEOUT_MODE_RESET; config.val = 0x50; - ret = WDG_PHY_CONFIG (&config); + WDG_PHY_CONFIG (&config); } /*****************************************************************************/ @@ -138,15 +134,14 @@ PUBLIC void WDG_ResetMCU (void) PUBLIC void WDG_TimerLoad (uint32 time_ms) { WDG_CONFIG_T config; - int32 ret; - WDG_TRACE ("Watch Dog Trace: WDG_TimerLoad %d", time_ms); + WDG_TRACE ("Watch Dog Trace: WDG_TimerLoad %lu", time_ms); config.state = WDG_TIMER_STATE_KEEP ; config.mode = WDG_TIMEOUT_MODE_KEEP ; config.val = (time_ms * 1000) / 30; - ret = WDG_PHY_CONFIG (&config); + WDG_PHY_CONFIG (&config); } PUBLIC uint32 WDG_PHY_RST_INT_ON(void) @@ -154,7 +149,7 @@ PUBLIC uint32 WDG_PHY_RST_INT_ON(void) uint32 ret = 0; uint32 val = 0; val = WDG_PHY_RST_RAW_INT(); - printf("hw watchdog int raw status 0x%x\n", val); + printf("hw watchdog int raw status 0x%lx\n", val); ret = val & WDG_INT_RST_BIT; WDG_PHY_INT_CLR(); return ret; diff --git a/arch/arm/cpu/armv7/sc8830/watchdog_phy_v3.c b/arch/arm/cpu/armv7/sc8830/watchdog_phy_v3.c index 9b843ec..35c2a88 100644 --- a/arch/arm/cpu/armv7/sc8830/watchdog_phy_v3.c +++ b/arch/arm/cpu/armv7/sc8830/watchdog_phy_v3.c @@ -16,6 +16,7 @@ /**---------------------------------------------------------------------------* ** Dependencies * **---------------------------------------------------------------------------*/ +#include #include #include #include @@ -37,7 +38,7 @@ extern "C" uint32 cnt = 0;\ while((ANA_REG_GET(WDG_INT_RAW) & WDG_LD_BUSY_BIT) && ( cnt < ANA_WDG_LOAD_TIMEOUT_NUM )) cnt++;\ ANA_REG_SET( WDG_LOAD_HIGH, (uint16)(((value) >> 16 ) & 0xffff));\ - ANA_REG_SET( WDG_LOAD_LOW , (uint16)((value) & 0xffff) );\ + ANA_REG_SET( WDG_LOAD_LOW , (uint16)((value) & 0xffff) );\ }while(0) #define CLEAR_WDG_INT(msk) \ @@ -61,9 +62,6 @@ extern "C" /*****************************************************************************/ PUBLIC int32 WDG_PHY_CONFIG (WDG_CONFIG_T *cfg) { - uint32 ctrl = 0; - uint32 val = 0; - ///WDG_TRACE("Watch Dog Trace: Watch Dog Value 0x%8.8x", CHIP_REG_GET(WDG_VALUE)); ANA_REG_SET (WDG_LOCK, WDG_UNLOCK_KEY); diff --git a/arch/arm/include/asm/arch-sc8830/boot_drvapi.h b/arch/arm/include/asm/arch-sc8830/boot_drvapi.h index 5eff94c..7f0836b 100644 --- a/arch/arm/include/asm/arch-sc8830/boot_drvapi.h +++ b/arch/arm/include/asm/arch-sc8830/boot_drvapi.h @@ -76,7 +76,7 @@ PUBLIC uint32 BOOT_GetResetFlag (WDG_HW_FLAG_T type); // Author: Jeff.Li // Note: /*****************************************************************************/ -PUBLIC void BOOT_ResetHWFlag (); +PUBLIC void BOOT_ResetHWFlag (void); /*****************************************************************************/ // Description: Get HW Flag diff --git a/arch/arm/include/asm/arch-sc8830/gpio_phy.h b/arch/arm/include/asm/arch-sc8830/gpio_phy.h index 6a3bbc1..4e6495a 100644 --- a/arch/arm/include/asm/arch-sc8830/gpio_phy.h +++ b/arch/arm/include/asm/arch-sc8830/gpio_phy.h @@ -9,6 +9,13 @@ #include #define GPIO_DBG(fmt...) printf(fmt) +#ifndef WARN +#define WARN(nmu, fmt...) printf(fmt) +#endif + +void __raw_bits_and(unsigned int v, unsigned int a); +void __raw_bits_or(unsigned int v, unsigned int a); + enum gpio_section_type { GPIO_SECTION_GPI = 0x0, GPIO_SECTION_GPO, -- 2.7.4 From 873f878d0a0bf77bc599c7c857eb78bf9a811992 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 28 Dec 2017 14:36:10 +0900 Subject: [PATCH 04/16] board: tizen_tm1: remove build warnings Remove build warnings from tizen_tm1 board bsp code. Change-Id: I2f89ef18bc5f35c2f29aa885f10d98f0496ea06c Signed-off-by: Seung-Woo Kim --- board/spreadtrum/tizen_tm1/ldo_sleep.c | 1 + board/spreadtrum/tizen_tm1/openphone.c | 32 ++++++++++++++++++++------------ board/spreadtrum/tizen_tm1/sprd_kp.c | 6 ++++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/board/spreadtrum/tizen_tm1/ldo_sleep.c b/board/spreadtrum/tizen_tm1/ldo_sleep.c index 7e167d6..75af0fe 100644 --- a/board/spreadtrum/tizen_tm1/ldo_sleep.c +++ b/board/spreadtrum/tizen_tm1/ldo_sleep.c @@ -771,5 +771,6 @@ void init_ldo_sleep_gr(void) ); /*chip service package init*/ + extern void CSP_Init(unsigned int gen_para); CSP_Init(0); } diff --git a/board/spreadtrum/tizen_tm1/openphone.c b/board/spreadtrum/tizen_tm1/openphone.c index 5dfcb0a..2a92d48 100644 --- a/board/spreadtrum/tizen_tm1/openphone.c +++ b/board/spreadtrum/tizen_tm1/openphone.c @@ -19,10 +19,18 @@ extern void ADI_init (void); extern int LDO_Init(void); extern void ADC_Init(void); extern int sound_init(void); +extern void misc_init(void); +extern int pin_init(void); +extern void sprd_eic_init(void); +extern void init_ldo_sleep_gr(void); +extern int sprd_gpio_request(struct gpio_chip *chip, unsigned offset); +extern int sprd_gpio_direction_input(struct gpio_chip *chip, unsigned offset); +extern int sprd_gpio_get(struct gpio_chip *chip, unsigned offset); +extern void sprd_gpio_free(struct gpio_chip *chip, unsigned offset); #ifdef CONFIG_GENERIC_MMC int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks); -int mmc_sdcard_init(); +int mmc_sdcard_init(void); int board_mmc_init(bd_t *bd) { @@ -39,7 +47,7 @@ int board_mmc_init(bd_t *bd) extern struct eic_gpio_resource sprd_gpio_resource[]; /*enable aon timer2 for udelay functions*/ -void aon_26M_timer2_enable() +void aon_26M_timer2_enable(void) { REG32(REG_AON_APB_APB_EB0) |= BIT_AON_TMR_EB; } @@ -64,7 +72,16 @@ int get_hw_rev(void) return hw_revision; } -int board_init() +void check_smpl(void) +{ +#ifdef CONFIG_SMPL_MODE + if(is_real_battery() == 0){ + sci_adi_write_fast(ANA_REG_GLB_SMPL_CTRL0,0x0,1); + } +#endif +} + +int board_init(void) { gd->bd->bi_arch_number = 0x7df; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x02000100; @@ -88,15 +105,6 @@ int board_init() return 0; } -void check_smpl(void) -{ -#ifdef CONFIG_SMPL_MODE - if(is_real_battery() == 0){ - sci_adi_write_fast(ANA_REG_GLB_SMPL_CTRL0,0x0,1); - } -#endif -} - int dram_init(void) { gd->ram_size = get_ram_size((volatile void *)PHYS_SDRAM_1, diff --git a/board/spreadtrum/tizen_tm1/sprd_kp.c b/board/spreadtrum/tizen_tm1/sprd_kp.c index 3ede70e..facf65e 100644 --- a/board/spreadtrum/tizen_tm1/sprd_kp.c +++ b/board/spreadtrum/tizen_tm1/sprd_kp.c @@ -11,8 +11,6 @@ struct key_map_info * sprd_key_map = 0; void board_keypad_init(void) { - unsigned int key_type; - sprd_key_map = malloc(sizeof(struct key_map_info)); if(NULL == sprd_key_map){ @@ -79,6 +77,10 @@ unsigned char board_key_scan(void) uint32_t s_key_status = REG_KPD_KEY_STATUS; uint32_t scan_code = 0; uint32_t key_code =0; + + extern int sprd_eic_request(unsigned offset); + extern int sprd_eic_get(unsigned offset); + #ifdef KEYPAD_DEBUG printf("key operation flags is %08x, key %08x\n", REG_KPD_INT_RAW_STATUS, REG_KPD_KEY_STATUS); #endif -- 2.7.4 From b4cbdd0e102e74e0891c7d488f2989aee2c83d31 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 27 Dec 2017 15:22:57 +0900 Subject: [PATCH 05/16] usb: gadget: remove duplicated print macro There are duplicated print macros. Remove the macros. Change-Id: I26cfa53689c39d661e64eb1a61e381f8baf30ac4 Signed-off-by: Seung-Woo Kim --- drivers/usb/gadget/serial.c | 2 -- include/linux/usb/composite.h | 4 ---- 2 files changed, 6 deletions(-) diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 61a694a..72c7662 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c @@ -54,8 +54,6 @@ #include "f_serial.c" #include "u_serial.c" -#define pr_warning(args...) printf(##args) - /*-------------------------------------------------------------------------*/ /* Thanks to NetChip Technologies for donating this product ID. diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index b200ef7..9359360 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -363,8 +363,6 @@ extern int usb_string_id(struct usb_composite_dev *c); /* messaging utils */ #ifdef DEBUG -#define pr_warning(args...) printf(##args) -#define pr_debug(args...) printf(#args) #define DBG(d, fmt, args...) \ printf(fmt, ##args) #define VDBG(d, fmt, args...) \ @@ -376,8 +374,6 @@ extern int usb_string_id(struct usb_composite_dev *c); #define INFO(d, fmt, args...) \ printf(fmt, ##args) #else -#define pr_warning(args...) -#define pr_debug(args...) #define DBG(d, fmt, args...) #define VDBG(d, fmt, args...) #define ERROR(d, fmt, args...) \ -- 2.7.4 From 3d31e8c499ad7cd8054fcb4d6e8bfcb5e62ce541 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 27 Dec 2017 16:52:54 +0900 Subject: [PATCH 06/16] bootmode: normal: remove duplicated macro There is duplicated macro, and it causes build warning. Remove the duplication. Change-Id: I05b23aba350bbefb6e95a952a1d24a57bed960fe Signed-off-by: Seung-Woo Kim --- property/normal_mode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/property/normal_mode.c b/property/normal_mode.c index 0e4cd49..f1dbf0a 100644 --- a/property/normal_mode.c +++ b/property/normal_mode.c @@ -402,7 +402,6 @@ void set_recovery_mode(unsigned int recovery_mode) void lcd_display_logo(int backlight_set, ulong bmp_img, size_t size) { -#define mdelay(t) ({unsigned long msec=(t); while (msec--) { udelay(1000);}}) //LiWei add #ifdef CONFIG_SPLASH_SCREEN extern int lcd_display_bitmap(ulong bmp_image, int x, int y); extern void lcd_display(void); -- 2.7.4 From 4221f77f501213ce31f46c74bf991ab86faa7b4b Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 11:31:33 +0900 Subject: [PATCH 07/16] fdt: remove build warnings caused by sprd bsp Remove build warnings caused by sprd bsp. Change-Id: I8989a6fdbac336354feb5736db2ea815ec19e95e Signed-off-by: Seung-Woo Kim --- common/fdt_support.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index 7c389d5..a7253df 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -37,6 +37,7 @@ extern PUBLIC phys_size_t get_dram_size_from_gd(void); extern char* get_calibration_parameter(void); extern bool is_calibration_by_uart(void); +extern int poweron_by_calibration(void); /** * fdt_getprop_u32_default - Find a node and return it's property or a default @@ -219,7 +220,6 @@ int fdt_initrd_norsvmem(void *fdt, ulong initrd_start, ulong initrd_end, int for int err; u32 tmp; const char *path; - uint64_t addr, size; /* Find the "chosen" node. */ nodeoffset = fdt_path_offset (fdt, "/chosen"); @@ -332,8 +332,8 @@ int fdt_chosen_bootargs_replace(void *fdt, char *old_args, char *new_args) { int nodeoffset; int err, i; - char *str, *src, *dst; - const char *path; + char *str, *dst; + const char *src, *path; char *strargs; if (!old_args || !new_args) @@ -468,7 +468,7 @@ int fdt_chosen_bootargs_append(void *fdt, char* append_args,int force) int fdt_fixup_lcdid(void *fdt) { char buf[16]; - extern uint32_t load_lcd_id_to_kernel(); + extern uint32_t load_lcd_id_to_kernel(void); uint32_t lcd_id = 0; int str_len; int ret; @@ -498,7 +498,7 @@ int fdt_fixup_lcdbase(void *fdt) //add lcd frame buffer base, length should be lcd w*h*2(RGB565) sprintf(buf, "lcd_base="); str_len = strlen(buf); - sprintf(&buf[str_len], "%x",lcd_base); + sprintf(&buf[str_len], "%lx",(unsigned long)lcd_base); str_len = strlen(buf); buf[str_len] = '\0'; @@ -625,13 +625,12 @@ int fdt_fixup_adc_calibration_data(void *fdt) { //extern unsigned int *adc_data_to_transfer; unsigned int *adc_data = malloc(64); - int ret = read_adc_calibration_data(adc_data,48); + int ret = read_adc_calibration_data((void *)adc_data,48); if (ret) { char buf[64]; int str_len; - int ret; memset(buf, 0, 64); if(((adc_data[2]&0xffff) < 4500 )&&((adc_data[2]&0xffff) > 3000)&& @@ -1680,11 +1679,10 @@ void fdt_debug_print_prop(void *fdt, const char *node_path, const char *name) int nodeoffset; int err; const char *path; - char *strargs; int len; int i = 0; - printf("fdt addr: 0x%x\n", fdt); + printf("fdt addr: 0x%lx\n", (unsigned long)fdt); err = fdt_check_header(fdt); if (err < 0) { -- 2.7.4 From 0b5a99446a699980f92a803591cd9443967c620d Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 11:32:30 +0900 Subject: [PATCH 08/16] console: remove build warning in ram console Remove build warning in ram console. Change-Id: I1b783345c081fbd9d24c727fc1ec00f9d16eb38c Signed-off-by: Seung-Woo Kim --- common/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/console.c b/common/console.c index 31146cc..aca0d77 100644 --- a/common/console.c +++ b/common/console.c @@ -207,7 +207,7 @@ void ram_puts(const char* s) uint *p = NULL; uint wlen = strlen(s); - p = (unsigned char*)CONFIG_RAM_CONSOLE_START + used_size; + p = (uint *)CONFIG_RAM_CONSOLE_START + used_size; if (used_size >= CONFIG_RAM_CONSOLE_SIZE) { serial_puts("ram console: space overflow!\n"); -- 2.7.4 From 10e4c001da219403b1fecca09932a36e01170b99 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 11:33:54 +0900 Subject: [PATCH 09/16] part: remove build warnings in sprd partition Remove build warnings in sprd partition. Change-Id: I58dc3673b0c48b8c97f583f92133b5f39ecd0b3a Signed-off-by: Seung-Woo Kim --- common/idh_layout.c | 16 +++++++++------- disk/part.c | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/common/idh_layout.c b/common/idh_layout.c index a3ecfd4..8fbff48 100644 --- a/common/idh_layout.c +++ b/common/idh_layout.c @@ -19,7 +19,9 @@ typedef struct _MTD_PARTITION_STRUCT } MTD_PARTITION_T; +#ifndef MTDPARTS_DEFAULT static unsigned long nandsize = 0; +#endif unsigned char mtdpartbuffer[MTDPARTS_MAXLEN] = "mtdparts=sprd-nand:256k(spl),512k(2ndbl),256k(params),512k(vmjaluna),10m(modem),3840k(fixnv),3840k(backupfixnv),5120k(dsp),3840k(runtimenv),10m(boot),10m(recovery),250m(system),180m(userdata),20m(cache),256k(misc),1m(boot_logo),1m(fastboot_logo),3840k(productinfo),512k(kpanic)"; static MTD_PARTITION_T mtd_partition_cfg[] = { @@ -51,7 +53,7 @@ void create_mtdpart_buffer(unsigned long nandsize, unsigned long realsize) unsigned long str_len; i = 0; - while (strcmp(mtd_partition_cfg[i].name, "cache") != 0) + while (strcmp((char *)mtd_partition_cfg[i].name, "cache") != 0) i++; if (nandsize <= (512 * 1024)) @@ -61,7 +63,7 @@ void create_mtdpart_buffer(unsigned long nandsize, unsigned long realsize) realsize += mtd_partition_cfg[i].size; i = 0; - while (strcmp(mtd_partition_cfg[i].name, "userdata") != 0) + while (strcmp((char *)mtd_partition_cfg[i].name, "userdata") != 0) i++; if (nandsize <= (512 * 1024)) @@ -76,15 +78,15 @@ void create_mtdpart_buffer(unsigned long nandsize, unsigned long realsize) }*/ memset(mtdpartbuffer, 0, MTDPARTS_MAXLEN); - sprintf(mtdpartbuffer, "mtdparts=sprd-nand:"); - str_len = strlen(mtdpartbuffer); + sprintf((char *)mtdpartbuffer, "mtdparts=sprd-nand:"); + str_len = strlen((char *)mtdpartbuffer); i = 0; while (mtd_partition_cfg[i].size) { - sprintf(&mtdpartbuffer[str_len], "%dk(%s),", mtd_partition_cfg[i].size, mtd_partition_cfg[i].name); - str_len = strlen(mtdpartbuffer); + sprintf((char *)&mtdpartbuffer[str_len], "%luk(%s),", mtd_partition_cfg[i].size, (char *)mtd_partition_cfg[i].name); + str_len = strlen((char *)mtdpartbuffer); i++; } - str_len = strlen(mtdpartbuffer); + str_len = strlen((char *)mtdpartbuffer); mtdpartbuffer[str_len - 1] = '\0'; /* delete the last , */ } diff --git a/disk/part.c b/disk/part.c index f2de286..0750522 100644 --- a/disk/part.c +++ b/disk/part.c @@ -408,6 +408,11 @@ int get_partition_info_with_partnum (block_dev_desc_t *dev_desc, int part int get_all_partition_info (block_dev_desc_t *dev_desc, PARTITION_CFG *info, unsigned int *total_partition_num) { +#ifdef CONFIG_EFI_PARTITION + extern int get_all_partition_info_efi(block_dev_desc_t * dev_desc, + PARTITION_CFG * info, + unsigned int *total_partition_num); +#endif switch(dev_desc->part_type){ #ifdef CONFIG_EFI_PARTITION case PART_TYPE_EFI: -- 2.7.4 From 64291860c6d7c335fef77fe851ee9b0a53ec2729 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 29 Dec 2017 12:04:39 +0900 Subject: [PATCH 10/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 11/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 12/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 13/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 14/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 15/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 16/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