Commit 5cb7fc82 authored by Yann Gautier's avatar Yann Gautier
Browse files

plat/intel: do not keep mmc_device_info in stack

Create a dedicated static struct mmc_device_info mmc_info mmc_info
instead of having this in stack.
A boot issue has been seen on some platform when applying patch [1].

 [1] 13f3c516

 ("mmc:prevent accessing to the released space in case of wrong usage")
Signed-off-by: default avatarYann Gautier <yann.gautier@foss.st.com>
Change-Id: Id52c0be61a30f453a551385883eaf3cbe32b04b9
parent 9171ced3
/* /*
* Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2019-2021, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2019-2020, Intel Corporation. All rights reserved. * Copyright (c) 2019-2021, Intel Corporation. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "socfpga_system_manager.h" #include "socfpga_system_manager.h"
#include "wdt/watchdog.h" #include "wdt/watchdog.h"
static struct mmc_device_info mmc_info;
const mmap_region_t agilex_plat_mmap[] = { const mmap_region_t agilex_plat_mmap[] = {
MAP_REGION_FLAT(DRAM_BASE, DRAM_SIZE, MAP_REGION_FLAT(DRAM_BASE, DRAM_SIZE,
...@@ -87,7 +88,6 @@ void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1, ...@@ -87,7 +88,6 @@ void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
void bl2_el3_plat_arch_setup(void) void bl2_el3_plat_arch_setup(void)
{ {
struct mmc_device_info info;
const mmap_region_t bl_regions[] = { const mmap_region_t bl_regions[] = {
MAP_REGION_FLAT(BL2_BASE, BL2_END - BL2_BASE, MAP_REGION_FLAT(BL2_BASE, BL2_END - BL2_BASE,
MT_MEMORY | MT_RW | MT_SECURE), MT_MEMORY | MT_RW | MT_SECURE),
...@@ -110,12 +110,12 @@ void bl2_el3_plat_arch_setup(void) ...@@ -110,12 +110,12 @@ void bl2_el3_plat_arch_setup(void)
dw_mmc_params_t params = EMMC_INIT_PARAMS(0x100000, get_mmc_clk()); dw_mmc_params_t params = EMMC_INIT_PARAMS(0x100000, get_mmc_clk());
info.mmc_dev_type = MMC_IS_SD; mmc_info.mmc_dev_type = MMC_IS_SD;
info.ocr_voltage = OCR_3_3_3_4 | OCR_3_2_3_3; mmc_info.ocr_voltage = OCR_3_3_3_4 | OCR_3_2_3_3;
switch (boot_source) { switch (boot_source) {
case BOOT_SOURCE_SDMMC: case BOOT_SOURCE_SDMMC:
dw_mmc_init(&params, &info); dw_mmc_init(&params, &mmc_info);
socfpga_io_setup(boot_source); socfpga_io_setup(boot_source);
break; break;
......
/* /*
* Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2019-2021, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2019-2020, Intel Corporation. All rights reserved. * Copyright (c) 2019-2021, Intel Corporation. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "s10_pinmux.h" #include "s10_pinmux.h"
#include "wdt/watchdog.h" #include "wdt/watchdog.h"
static struct mmc_device_info mmc_info;
const mmap_region_t plat_stratix10_mmap[] = { const mmap_region_t plat_stratix10_mmap[] = {
MAP_REGION_FLAT(DRAM_BASE, DRAM_SIZE, MAP_REGION_FLAT(DRAM_BASE, DRAM_SIZE,
...@@ -83,7 +84,6 @@ void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1, ...@@ -83,7 +84,6 @@ void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
void bl2_el3_plat_arch_setup(void) void bl2_el3_plat_arch_setup(void)
{ {
struct mmc_device_info info;
const mmap_region_t bl_regions[] = { const mmap_region_t bl_regions[] = {
MAP_REGION_FLAT(BL2_BASE, BL2_END - BL2_BASE, MAP_REGION_FLAT(BL2_BASE, BL2_END - BL2_BASE,
MT_MEMORY | MT_RW | MT_SECURE), MT_MEMORY | MT_RW | MT_SECURE),
...@@ -106,12 +106,12 @@ void bl2_el3_plat_arch_setup(void) ...@@ -106,12 +106,12 @@ void bl2_el3_plat_arch_setup(void)
dw_mmc_params_t params = EMMC_INIT_PARAMS(0x100000, get_mmc_clk()); dw_mmc_params_t params = EMMC_INIT_PARAMS(0x100000, get_mmc_clk());
info.mmc_dev_type = MMC_IS_SD; mmc_info.mmc_dev_type = MMC_IS_SD;
info.ocr_voltage = OCR_3_3_3_4 | OCR_3_2_3_3; mmc_info.ocr_voltage = OCR_3_3_3_4 | OCR_3_2_3_3;
switch (boot_source) { switch (boot_source) {
case BOOT_SOURCE_SDMMC: case BOOT_SOURCE_SDMMC:
dw_mmc_init(&params, &info); dw_mmc_init(&params, &mmc_info);
socfpga_io_setup(boot_source); socfpga_io_setup(boot_source);
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment