From: Enric Balletbo i Serra Date: Wed, 25 May 2011 12:04:05 +0000 (+0200) Subject: OMAP3: Move try_unlock_memory() function to not duplicate code X-Git-Tag: v1.5.1~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdc887b1c75ee7f264f8684e38ed0859f88ee40b;p=pandora-x-loader.git OMAP3: Move try_unlock_memory() function to not duplicate code The try_unlock_memory() function is implemented by various boards, this patch moves this function to a common place to not duplicate code. board/omap3530beagle/omap3530beagle.c :527:void try_unlock_memory(void) board/igep00x0/igep00x0.c :271:void try_unlock_memory(void) board/omap3430sdp/omap3430sdp.c :314:void try_unlock_memory(void) board/omap3evm/omap3evm.c :359:void try_unlock_memory(void) board/omap3430labrador/omap3430sdp.c :316:void try_unlock_memory(void) board/overo/overo.c :478:void try_unlock_memory(void) Signed-off-by: Enric Balletbo i Serra Signed-off-by: Anand Gadiyar --- diff --git a/board/igep00x0/igep00x0.c b/board/igep00x0/igep00x0.c index 8c99923..5550741 100644 --- a/board/igep00x0/igep00x0.c +++ b/board/igep00x0/igep00x0.c @@ -263,23 +263,6 @@ void prcm_init(void) delay(5000); } -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - * general use. - ***********************************************************/ -void try_unlock_memory(void) -{ - int mode; - - /* if GP device unlock device SRAM for general use */ - /* secure code breaks for Secure/Emulation device - HS/E/T */ - mode = get_device_type(); - if (mode == GP_DEVICE) - secure_unlock(); - return; -} - /********************************************************************* * config_sdram_m65kx002am() - 2 dice of 2Gb, DDR x32 I/O, 4KB page *********************************************************************/ diff --git a/board/omap3430labrador/omap3430sdp.c b/board/omap3430labrador/omap3430sdp.c index 2c42168..522de06 100644 --- a/board/omap3430labrador/omap3430sdp.c +++ b/board/omap3430labrador/omap3430sdp.c @@ -308,24 +308,6 @@ void prcm_init(void) delay(5000); } -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - * general use. - ***********************************************************/ -void try_unlock_memory(void) -{ - int mode; - - /* if GP device unlock device SRAM for general use */ - /* secure code breaks for Secure/Emulation device - HS/E/T*/ - mode = get_device_type(); - if (mode == GP_DEVICE) { - secure_unlock(); - } - return; -} - /********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. diff --git a/board/omap3430sdp/omap3430sdp.c b/board/omap3430sdp/omap3430sdp.c index fe3f8e1..d8a2c1b 100644 --- a/board/omap3430sdp/omap3430sdp.c +++ b/board/omap3430sdp/omap3430sdp.c @@ -306,24 +306,6 @@ void prcm_init(void) delay(5000); } -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - * general use. - ***********************************************************/ -void try_unlock_memory(void) -{ - int mode; - - /* if GP device unlock device SRAM for general use */ - /* secure code breaks for Secure/Emulation device - HS/E/T*/ - mode = get_device_type(); - if (mode == GP_DEVICE) { - secure_unlock(); - } - return; -} - /********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. diff --git a/board/omap3530beagle/omap3530beagle.c b/board/omap3530beagle/omap3530beagle.c index c861b21..c85bebf 100644 --- a/board/omap3530beagle/omap3530beagle.c +++ b/board/omap3530beagle/omap3530beagle.c @@ -519,23 +519,6 @@ void prcm_init(void) delay(5000); } -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - * general use. - ***********************************************************/ -void try_unlock_memory(void) -{ - int mode; - - /* if GP device unlock device SRAM for general use */ - /* secure code breaks for Secure/Emulation device - HS/E/T */ - mode = get_device_type(); - if (mode == GP_DEVICE) - secure_unlock(); - return; -} - /********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. diff --git a/board/omap3evm/omap3evm.c b/board/omap3evm/omap3evm.c index 164c211..6048964 100644 --- a/board/omap3evm/omap3evm.c +++ b/board/omap3evm/omap3evm.c @@ -351,24 +351,6 @@ void prcm_init(void) delay(5000); } -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - * general use. - ***********************************************************/ -void try_unlock_memory(void) -{ - int mode; - - /* if GP device unlock device SRAM for general use */ - /* secure code breaks for Secure/Emulation device - HS/E/T*/ - mode = get_device_type(); - if (mode == GP_DEVICE) { - secure_unlock(); - } - return; -} - /********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. diff --git a/board/overo/overo.c b/board/overo/overo.c index 1c8102b..413fe43 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -470,23 +470,6 @@ void prcm_init(void) delay(5000); } -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - * general use. - ***********************************************************/ -void try_unlock_memory(void) -{ - int mode; - - /* if GP device unlock device SRAM for general use */ - /* secure code breaks for Secure/Emulation device - HS/E/T*/ - mode = get_device_type(); - if (mode == GP_DEVICE) - secure_unlock(); - return; -} - /********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. diff --git a/cpu/omap3/sys_info.c b/cpu/omap3/sys_info.c index 09bd823..0d592e9 100644 --- a/cpu/omap3/sys_info.c +++ b/cpu/omap3/sys_info.c @@ -290,3 +290,20 @@ void secure_unlock(void) __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */ } + +/* + * try_unlock_memory(void): If chip is GP type, unlock the SRAM for + * general use. + */ +void try_unlock_memory(void) +{ + int mode; + + /* if GP device unlock device SRAM for general use */ + /* secure code breaks for Secure/Emulation device - HS/E/T*/ + mode = get_device_type(); + if (mode == GP_DEVICE) { + secure_unlock(); + } + return; +} diff --git a/include/asm/arch-omap3/sys_proto.h b/include/asm/arch-omap3/sys_proto.h index 7e768fa..8622d9f 100644 --- a/include/asm/arch-omap3/sys_proto.h +++ b/include/asm/arch-omap3/sys_proto.h @@ -55,6 +55,7 @@ u32 get_device_type(void); void get_sys_clkin_sel(u32 osc_clk, u32 *sys_clkin_sel); void secure_unlock(void); +void try_unlock_memory(void); void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value); u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);