mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
32181ca03d
PD#SWPL-224631
Problem:
mtd partition in spinand and slcnand have no difference,
should unify there code
Solution:
1. spinand partitions table define in dts keep same format with slc nand:
partitions {
#address = <1>;
#size-cells= <1>;
partition@n {
label = "part_name";
reg = < ... >;
};
};
instead of:
partition = <&partitions>;
partitions: partitions{
part_name {
offset = < ... >;
size = < ... >;
};
}
2. the definition of SLCNAND bl_mode in dts remains the same
as that of SPINAND
bl_mode = <0> : NAND_FIPMODE_COMPACT;
bl_mode = <1> : NAND_FIPMODE_DISCRETE;
bl_mode = <2> : NAND_FIPMODE_ADVANCE;
in this way, SLCNAND does not need to define bl2ex_mode in platform data by
meosn_nand.c
Change-Id: I32d1b1b55e6c927d73937f8f748d8285f3c6dff3
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
94 lines
2.5 KiB
C
94 lines
2.5 KiB
C
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
|
|
/*
|
|
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
|
|
*/
|
|
|
|
#ifndef __AML_STORAGE_H_
|
|
#define __AML_STORAGE_H_
|
|
|
|
#define BL2E_STORAGE_PARAM_SIZE (0x80)
|
|
#define BOOT_FIRST_BLOB_SIZE (254 * 1024)
|
|
#define BOOT_FILLER_SIZE (4 * 1024)
|
|
#define BOOT_RESERVED_SIZE (4 * 1024)
|
|
#define BOOT_RANDOM_NONCE (16)
|
|
#define BOOT_BL2E_SIZE (66672) //74864-8K
|
|
#define BOOT_EBL2E_SIZE \
|
|
(BOOT_FILLER_SIZE + BOOT_RESERVED_SIZE + BOOT_BL2E_SIZE)
|
|
#define BOOT_BL2X_SIZE (66672)
|
|
#define MAX_BOOT_AREA_ENTRIES (8)
|
|
#define BL2_CORE_BASE_OFFSET_EMMC (0x200000)
|
|
#define BOOT_AREA_BB1ST (0)
|
|
#define BOOT_AREA_BL2E (1)
|
|
#define BOOT_AREA_BL2X (2)
|
|
#define BOOT_AREA_DDRFIP (3)
|
|
#define BOOT_AREA_DEVFIP (4)
|
|
#define BOOT_AREA_INVALID (MAX_BOOT_AREA_ENTRIES)
|
|
#define BAE_BB1ST "1STBLOB"
|
|
#define BAE_BL2E "BL2E"
|
|
#define BAE_BL2X "BL2X"
|
|
#define BAE_DDRFIP "DDRFIP"
|
|
#define BAE_DEVFIP "DEVFIP"
|
|
|
|
#define NAND_FIPMODE_COMPACT (0)
|
|
#define NAND_FIPMODE_DISCRETE (1)
|
|
#define NAND_FIPMODE_ADVANCE (2)
|
|
|
|
/*cmdline_parser - MTD Master Name*/
|
|
#define AML_MTD_NAME "aml-mtd"
|
|
|
|
/* slc nand mtd name */
|
|
#define NAND_BOOT_NAME "bootloader"
|
|
#define NAND_NORMAL_NAME AML_MTD_NAME
|
|
|
|
struct boot_area_entry {
|
|
char name[11];
|
|
unsigned char idx;
|
|
u64 offset;
|
|
u64 size;
|
|
};
|
|
|
|
struct boot_layout {
|
|
struct boot_area_entry *boot_entry;
|
|
};
|
|
|
|
struct storage_boot_entry {
|
|
unsigned int offset;
|
|
unsigned int size;
|
|
};
|
|
|
|
struct nand_startup_parameter {
|
|
int page_size;
|
|
int block_size;
|
|
int layout_reserve_size;
|
|
int pages_per_block;
|
|
int setup_data;
|
|
int page0_disable;
|
|
};
|
|
|
|
union storage_independent_parameter {
|
|
struct nand_startup_parameter nsp;
|
|
};
|
|
|
|
struct storage_startup_parameter {
|
|
unsigned char boot_device;
|
|
unsigned char boot_seq;
|
|
unsigned char boot_backups;
|
|
unsigned char reserved;
|
|
struct storage_boot_entry boot_entry[MAX_BOOT_AREA_ENTRIES];
|
|
union storage_independent_parameter sip;
|
|
};
|
|
|
|
extern struct storage_startup_parameter g_ssp;
|
|
int aml_nand_param_check_and_layout_init(struct mtd_info *mtd);
|
|
void meson_nand_set_fipsize(u32 fip_size);
|
|
u32 meson_nand_get_fipsize(void);
|
|
void meson_nand_set_fipcopies(u32 fip_copies);
|
|
u32 meson_nand_get_fipcopies(void);
|
|
void meson_nand_set_bootloader_mode(u32 bl_mode);
|
|
u32 meson_nand_get_bootloader_mode(void);
|
|
void meson_nand_set_skip_bad_block(u32 skip);
|
|
int meson_add_mtd_partitions(struct mtd_info *mtd);
|
|
/**sc2 new layout**/
|
|
|
|
#endif /* __AML_STORAGE_H_ */
|