From c8b71a35289112f77691df0d0b4a97ef19dac87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Majewski?= Date: Wed, 4 Mar 2015 10:54:48 +0100 Subject: samsung: board: fix: Define loop iterator as an unsigned int to suppress gcc 4.8 warning This patch suppress following warning: board/samsung/common/board.c:95:32: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations] addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); ^ board/samsung/common/board.c:94:2: note: containing loop about possible signed integer overflow at gcc 4.8.2 (odroid board) Signed-off-by: Lukasz Majewski Signed-off-by: Minkyu Kang --- board/samsung/common/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 6c7f59b..97950fa 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -88,7 +88,7 @@ int board_init(void) int dram_init(void) { - int i; + unsigned int i; u32 addr; for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { @@ -100,7 +100,7 @@ int dram_init(void) void dram_init_banksize(void) { - int i; + unsigned int i; u32 addr, size; for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { -- cgit v1.1 From a0643e227ad98fbc34b1950ddc6d1d2a0f5aadad Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Tue, 17 Feb 2015 14:50:25 +0100 Subject: board: samsung: reserve memory for the secure firmware Since more than one board requires memory reservation for the secure firmware, the reservation code can be made in a common code. Now, to reserve some part of the the last bank, board config should define: - CONFIG_TZSW_RESERVED_DRAM - len in bytes - CONFIG_NR_DRAM_BANKS - number of memory banks Signed-off-by: Przemyslaw Marczak Cc: Akshay Saraswat Cc: Hyungwon Hwang Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- board/samsung/common/board.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 97950fa..2e17da8 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -82,7 +82,13 @@ int board_init(void) } boot_temp_check(); #endif +#ifdef CONFIG_TZSW_RESERVED_DRAM_SIZE + /* The last few MB of memory can be reserved for secure firmware */ + ulong size = CONFIG_TZSW_RESERVED_DRAM_SIZE; + gd->ram_size -= size; + gd->bd->bi_dram[CONFIG_NR_DRAM_BANKS - 1].size -= size; +#endif return exynos_init(); } -- cgit v1.1 From 973ae1e0858d3a1e34f9b33cedab0a344a83c7c8 Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Tue, 17 Feb 2015 14:50:26 +0100 Subject: Odroid-XU3: enable the last dram bank and reserve 22MiB This commit enables the last DRAM bank and reserves the last 22 MiB of it, for the secure firmware. Signed-off-by: Przemyslaw Marczak Cc: Akshay Saraswat Cc: Hyungwon Hwang Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- include/configs/odroid_xu3.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/configs/odroid_xu3.h b/include/configs/odroid_xu3.h index 9fa8660..c395020 100644 --- a/include/configs/odroid_xu3.h +++ b/include/configs/odroid_xu3.h @@ -25,13 +25,11 @@ #define CONFIG_CMD_MMC -/* - * FIXME: The number of bank is actually 8. But there is no way to reserve the - * last 16 Mib in the last bank now. So I just excluded the last bank - * temporally. - */ -#define CONFIG_NR_DRAM_BANKS 7 +#define CONFIG_NR_DRAM_BANKS 8 #define SDRAM_BANK_SIZE (256UL << 20UL) /* 256 MB */ +/* Reserve the last 22 MiB for the secure firmware */ +#define CONFIG_SYS_MEM_TOP_HIDE (22UL << 20UL) +#define CONFIG_TZSW_RESERVED_DRAM_SIZE CONFIG_SYS_MEM_TOP_HIDE #define CONFIG_ENV_IS_IN_MMC -- cgit v1.1 From ddb49f3a6c659ee7349a984af2698b440cb786dd Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Tue, 17 Feb 2015 14:50:27 +0100 Subject: Odroid U3: use common code for dram reservation This commit removes the dram reservation from board file, because it is done in a common code. Signed-off-by: Przemyslaw Marczak Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- board/samsung/odroid/odroid.c | 4 ---- include/configs/odroid.h | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c index 6f4b8ca..ae41c29 100644 --- a/board/samsung/odroid/odroid.c +++ b/board/samsung/odroid/odroid.c @@ -427,10 +427,6 @@ int exynos_early_init_f(void) int exynos_init(void) { - /* The last MB of memory is reserved for secure firmware */ - gd->ram_size -= SZ_1M; - gd->bd->bi_dram[CONFIG_NR_DRAM_BANKS - 1].size -= SZ_1M; - board_gpio_init(); return 0; diff --git a/include/configs/odroid.h b/include/configs/odroid.h index 8b47537..5ee0abe 100644 --- a/include/configs/odroid.h +++ b/include/configs/odroid.h @@ -29,6 +29,9 @@ #define CONFIG_SYS_SDRAM_BASE 0x40000000 #define SDRAM_BANK_SIZE (256 << 20) /* 256 MB */ #define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE +/* Reserve the last 1 MiB for the secure firmware */ +#define CONFIG_SYS_MEM_TOP_HIDE (1UL << 20UL) +#define CONFIG_TZSW_RESERVED_DRAM_SIZE CONFIG_SYS_MEM_TOP_HIDE /* memtest works on */ #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE @@ -56,8 +59,6 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR \ - GENERATED_GBL_DATA_SIZE) -#define CONFIG_SYS_MEM_TOP_HIDE (SZ_1M) /* ram console */ - #define CONFIG_SYS_MONITOR_BASE 0x00000000 #define CONFIG_ENV_IS_IN_MMC -- cgit v1.1