arm: omap3: Cleanup sys_info to fit OMAP3 booting with LTO
Subsystems (3)
PATCH 1/2 arm: omap3: Cleanup sys_info to fit OMAP3 booting with LTO
With LTO enabled, some functions appear to be optimized in a way that causes hanging on some OMAP3 boards after some unrelated patches were applied. The solution appears to make several functions __used. There also appears be to be some dead code, so remove it while cleaning this up.
This has been tested on a general purpose OMAP3530, DM3730, and AM3517.
arch/arm/include/asm/arch-omap3/sys_proto.h +0 -4
@@ -45,16 +45,12 @@ void gpmc_init(void);void enable_gpmc_cs_config (const u32 *gpmc_config,const struct gpmc_cs *cs,u32 base,u32 size);void set_gpmc_cs0 (int flash_type); -void watchdog_init (void );void set_muxconf_regs (void ); -u32 get_cpu_family (void );u32 get_cpu_rev (void ); -u32 get_sku_id (void );u32 is_gpmc_muxed (void );u32 get_gpmc0_type (void ); -u32 get_gpmc0_width (void );u32 is_running_in_sdram (void );u32 is_running_in_sram (void );u32 is_running_in_flash (void );
arch/arm/mach-omap2/omap3/sys_info.c +5 -34
@@ -55,7 +55,7 @@ void omap_die_id(unsigned int *die_id)/****************************************** * get_cpu_type(void) - extract cpu info ******************************************/ -u32 get_cpu_type (void ) +static u32 get_cpu_type (void ) {return readl (&ctrl_base->ctrl_omap_stat); }
@@ -64,7 +64,7 @@ u32 get_cpu_type(void)* get_cpu_id(void) - extract cpu id * returns 0 for ES1.0, cpuid otherwise ******************************************/ -u32 get_cpu_id (void ) +static u32 get_cpu_id (void ) {struct ctrl_id *id_base;u32 cpuid =0 ;
@@ -89,7 +89,7 @@ u32 get_cpu_id(void)/****************************************** * get_cpu_family(void) - extract cpu info ******************************************/ -u32 get_cpu_family (void ) +__used u32 get_cpu_family (void ) {u16 hawkeye;u32 cpu_family;
@@ -119,7 +119,7 @@ u32 get_cpu_family(void)/****************************************** * get_cpu_rev(void) - extract version info ******************************************/ -u32 get_cpu_rev (void ) +__used u32 get_cpu_rev (void ) {u32 cpuid =get_cpu_id ();
@@ -132,41 +132,12 @@ u32 get_cpu_rev(void)/***************************************************************** * get_sku_id(void) - read sku_id to get info on max clock rate *****************************************************************/ -u32 get_sku_id (void ) +static u32 get_sku_id (void ) {struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE ;return readl (&id_base->sku_id) &SKUID_CLK_MASK ; } -/*************************************************************************** -* get_gpmc0_base() - Return current address hardware will be -* fetching from. The below effectively gives what is correct, its a bit -* mis-leading compared to the TRM. For the most general case the mask -* needs to be also taken into account this does work in practice. -* - for u-boot we currently map: -* -- 0 to nothing, -* -- 4 to flash -* -- 8 to enent -* -- c to wifi -****************************************************************************/ -u32 get_gpmc0_base (void ) -{ -u32 b; - - b =readl (&gpmc_cfg->cs[0 ].config7); - b &=0x1F ;/* keep base [5:0] */ - b = b <<24 ;/* ret 0x0b000000 */ -return b; -} - -/******************************************************************* -* get_gpmc0_width() - See if bus is in x8 or x16 (mainly for nand) -*******************************************************************/ -u32 get_gpmc0_width (void ) -{ -return WIDTH_16BIT ; -} -/************************************************************************* * get_board_rev() - setup to pass kernel board revision information * returns:(bit[0-3] sub version, higher bit[7-4] is higher version)
Signature · 1 line
2.32.0
PATCH 2/2 arm: omap3: Make some memory functions static and clean headers
There are a few memory functions for both the emif4 (AM3517) and sdrc (OMAP35/DM37) code that can be defined as static, because those functions are not used externally. Make them static and clean up some of the corresponding headers.
arch/arm/include/asm/arch-omap3/mem.h +0 -1
@@ -480,7 +480,6 @@ void mem_init(void);u32 is_mem_sdr (void );u32 mem_ok (u32 cs); -u32 get_sdr_cs_size (u32 );u32 get_sdr_cs_offset (u32 );#endif /* __ASSEMBLY__ */
arch/arm/include/asm/arch-omap3/sys_proto.h +0 -5
@@ -33,11 +33,8 @@ struct board_sdrc_timings {void prcm_init (void );void per_clocks_enable (void );void ehci_clocks_enable (void ); -void memif_init (void );void sdrc_init (void ); -void do_sdrc_init (u32 ,u32 ); -void get_board_mem_timings (struct board_sdrc_timings *timings);int identify_nand_chip (int *mfr,int *id);void emif4_init (void );
@@ -60,12 +57,10 @@ void invalidate_dcache(u32);u32 wait_on_value (u32 ,u32 ,void *,u32 );void cancel_out (u32 *num,u32 *den,u32 den_limit);void sdelay (unsigned long ); -void make_cs1_contiguous (void );int omap_nand_switch_ecc (uint32_t ,uint32_t );void power_init_r (void );void do_omap3_emu_romcode_call (u32 service_id,u32 parameters);void omap3_set_aux_cr_secure (u32 acr);u32 warm_reset (void ); -void save_omap_boot_params (void );#endif
arch/arm/mach-omap2/omap3/emif4.c +1 -1
@@ -35,7 +35,7 @@ u32 is_mem_sdr(void)* get_sdr_cs_size - * - Get size of chip select 0/1 */ -u32 get_sdr_cs_size (u32 cs) +static u32 get_sdr_cs_size (u32 cs) {u32 size =0 ;
arch/arm/mach-omap2/omap3/sdrc.c +17 -18
@@ -44,13 +44,28 @@ u32 is_mem_sdr(void)return 0 ; } +/* +* get_sdr_cs_size - +* - Get size of chip select 0/1 +*/ +static u32 get_sdr_cs_size (u32 cs) +{ +u32 size; + +/* get ram size field */ + size =readl (&sdrc_base->cs[cs].mcfg) >>8 ; + size &=0x3FF ;/* remove unwanted bits */ + size <<=21 ;/* multiply by 2 MiB to find size in MB */ +return size; +} +/* * make_cs1_contiguous - * - When we have CS1 populated we want to have it mapped after cs0 to allow * command line mem=xyz use all memory with out discontinuous support * compiled in. We could do it in the ATAG, but there really is two banks... */ -void make_cs1_contiguous (void ) +static void make_cs1_contiguous (void ) {u32 size, a_add_low, a_add_high;
@@ -62,22 +77,6 @@ void make_cs1_contiguous(void) } - -/* -* get_sdr_cs_size - -* - Get size of chip select 0/1 -*/ -u32 get_sdr_cs_size (u32 cs) -{ -u32 size; - -/* get ram size field */ - size =readl (&sdrc_base->cs[cs].mcfg) >>8 ; - size &=0x3FF ;/* remove unwanted bits */ - size <<=21 ;/* multiply by 2 MiB to find size in MB */ -return size; -} -/* * get_sdr_cs_offset - * - Get offset of cs from cs0 start
@@ -128,7 +127,7 @@ static void write_sdrc_timings(u32 cs, struct sdrc_actim *sdrc_actim_base,* true and a possible 2nd time depending on memory configuration from * stack+global context. */ -void do_sdrc_init (u32 cs,u32 early) +static void do_sdrc_init (u32 cs,u32 early) {struct sdrc_actim *sdrc_actim_base0, *sdrc_actim_base1;struct board_sdrc_timings timings;
Signature · 1 line
2.32.0
Re: [PATCH 2/2] arm: omap3: Make some memory functions static and clean headers
arch/arm/include/asm/arch-omap3/mem.h
Quoted 9 lines · Adam Ford
There are a few memory functions for both the emif4 (AM3517) and sdrc (OMAP35/DM37) code that can be defined as static, because those functions are not used externally. Make them static and clean up some of the corresponding headers.
Signed-off-by Adam Ford <[email protected]>arch/arm/include/asm/arch-omap3/mem.h +0
-0
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
arch/arm/include/asm/arch-omap3/sys_proto.h
Quoted 13 lines · Adam Ford
With LTO enabled, some functions appear to be optimized in a way that causes hanging on some OMAP3 boards after some unrelated patches were applied. The solution appears to make several functions
__used. There also appears be to be some dead code, so remove it while cleaning this up.This has been tested on a general purpose OMAP3530, DM3730, and AM3517.
Signed-off-by Adam Ford <[email protected]>arch/arm/include/asm/arch-omap3/sys_proto.h +0
-0
Applied to u-boot/master, thanks!
Signature · 1 line
Tom