feat(common): add SZ_* macros

Add the SZ_* macros from 32 to 2G.
This allows removing some defines in raw NAND driver
and STM32MP1 boot device selection code.

Change-Id: I3c4d4959b0f43e785eeb37a43d03b2906b7fcfbc
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
Signed-off-by: Arpita S.K <Arpita.S.K@arm.com>
This commit is contained in:
Yann Gautier 2022-02-08 10:21:58 +01:00
parent acd0e9bf64
commit 1af59c4570
3 changed files with 37 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
* Copyright (c) 2019-2022, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -8,13 +8,13 @@
#include <errno.h>
#include <stddef.h>
#include <platform_def.h>
#include <common/debug.h>
#include <drivers/delay_timer.h>
#include <drivers/raw_nand.h>
#include <lib/utils.h>
#include <platform_def.h>
#define ONFI_SIGNATURE_ADDR 0x20U
/* CRC calculation */
@ -24,9 +24,6 @@
/* Status register */
#define NAND_STATUS_READY BIT(6)
#define SZ_128M 0x08000000U
#define SZ_512 0x200U
static struct rawnand_device rawnand_dev;
#pragma weak plat_get_raw_nand_data

View File

@ -1,17 +1,48 @@
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef COMMON_DEF_H
#define COMMON_DEF_H
#include <platform_def.h>
#include <common/bl_common.h>
#include <lib/utils_def.h>
#include <lib/xlat_tables/xlat_tables_defs.h>
#include <platform_def.h>
#define SZ_32 U(0x00000020)
#define SZ_64 U(0x00000040)
#define SZ_128 U(0x00000080)
#define SZ_256 U(0x00000100)
#define SZ_512 U(0x00000200)
#define SZ_1K U(0x00000400)
#define SZ_2K U(0x00000800)
#define SZ_4K U(0x00001000)
#define SZ_8K U(0x00002000)
#define SZ_16K U(0x00004000)
#define SZ_32K U(0x00008000)
#define SZ_64K U(0x00010000)
#define SZ_128K U(0x00020000)
#define SZ_256K U(0x00040000)
#define SZ_512K U(0x00080000)
#define SZ_1M U(0x00100000)
#define SZ_2M U(0x00200000)
#define SZ_4M U(0x00400000)
#define SZ_8M U(0x00800000)
#define SZ_16M U(0x01000000)
#define SZ_32M U(0x02000000)
#define SZ_64M U(0x04000000)
#define SZ_128M U(0x08000000)
#define SZ_256M U(0x10000000)
#define SZ_512M U(0x20000000)
#define SZ_1G U(0x40000000)
#define SZ_2G U(0x80000000)
/******************************************************************************
* Required platform porting definitions that are expected to be common to
* all platforms

View File

@ -14,9 +14,6 @@
#include <lib/utils.h>
#include <plat/common/platform.h>
#define SZ_512 0x200U
#define SZ_64M 0x4000000U
#if STM32MP_RAW_NAND || STM32MP_SPI_NAND
static int get_data_from_otp(struct nand_device *nand_dev, bool is_slc)
{