feat(stm32mp1): add define for external scratch buffer for nand devices

Override the default platform function to use an external buffer
on STM32MP13 platform.
It allows to use a temporary buffer located at the SRAM1 memory end.

Signed-off-by: Lionel Debieve <lionel.debieve@foss.st.com>
Change-Id: Ibd84bb336c60af24608268916b3a18bb5a0fa3db
This commit is contained in:
Lionel Debieve 2021-04-13 17:11:00 +02:00 committed by Yann Gautier
parent f29c0702d2
commit 9ee2510b62
2 changed files with 18 additions and 0 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <errno.h>
#include <common/debug.h>
@ -15,6 +16,17 @@
#include <plat/common/platform.h>
#if STM32MP_RAW_NAND || STM32MP_SPI_NAND
#if STM32MP13
void plat_get_scratch_buffer(void **buffer_addr, size_t *buf_size)
{
assert(buffer_addr != NULL);
assert(buf_size != NULL);
*buffer_addr = (void *)STM32MP_MTD_BUFFER;
*buf_size = PLATFORM_MTD_MAX_PAGE_SIZE;
}
#endif
static int get_data_from_otp(struct nand_device *nand_dev, bool is_slc)
{
uint32_t nand_param;

View file

@ -194,6 +194,12 @@ enum ddr_type {
/* Define maximum page size for NAND devices */
#define PLATFORM_MTD_MAX_PAGE_SIZE U(0x1000)
/* Define location for the MTD scratch buffer */
#if STM32MP13
#define STM32MP_MTD_BUFFER (SRAM1_BASE + \
SRAM1_SIZE - \
PLATFORM_MTD_MAX_PAGE_SIZE)
#endif
/*******************************************************************************
* STM32MP1 device/io map related constants (used for MMU)
******************************************************************************/