[PATCH v2 05/11] rockchip: idb: add sector1 info
Johan Jonker
jbx6244 at gmail.com
Sat Jul 9 20:49:46 CEST 2022
Add Rockchip IDB sector1 info to make it easier to identify the
IDB date and version. Sector1 data is currently not added by U-boot
tools, but is generated by external tools that have support for it.
Signed-off-by: Johan Jonker <jbx6244 at gmail.com>
---
optional
---
arch/arm/mach-rockchip/rockchip_idb.c | 46 +++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/arch/arm/mach-rockchip/rockchip_idb.c b/arch/arm/mach-rockchip/rockchip_idb.c
index 0692ce1a..37fe6ff2 100644
--- a/arch/arm/mach-rockchip/rockchip_idb.c
+++ b/arch/arm/mach-rockchip/rockchip_idb.c
@@ -59,6 +59,11 @@
#define NAND_CMD_ERASE2 0xd0
#define NAND_CMD_RESET 0xff
+#define BCD2INT(num) (((((num) >> 12) & 0x0F) * 1000) + \
+ ((((num) >> 8) & 0x0F) * 100) + \
+ ((((num) >> 4) & 0x0F) * 10) + \
+ ((num) & 0x0F))
+
#define DATA_STEP 1024
#define OOB_STEP 4
#define LBA 64 + 512 + 33
@@ -80,6 +85,35 @@ struct sector0 {
u8 reserved2[2];
} __packed;
+struct sector1 {
+ u16 sys_reserved_block;
+ u16 disk0_size;
+ u16 disk1_size;
+ u16 disk2_size;
+ u16 disk3_size;
+ u32 chip_tag;
+ u32 machine_id;
+ u16 loader_year;
+ u16 loader_date;
+ u16 loader_ver;
+ u8 reserved[72];
+ u16 flash_data_offset;
+ u16 flash_data_len;
+ u8 reserved2[384];
+ u32 flash_chip_size;
+ u8 reserved1;
+ u8 access_time;
+ u16 phy_block_size;
+ u8 phy_page_size;
+ u8 ecc_bits;
+ u8 reserved3[8];
+ u16 id_block0;
+ u16 id_block1;
+ u16 id_block2;
+ u16 id_block3;
+ u16 id_block4;
+} __packed;
+
struct nand_para_info {
u8 id_bytes;
u8 nand_id[6];
@@ -1475,10 +1509,22 @@ int rk_idb_stop(void)
void rk_idb_print_idb_data(u32 *data)
{
+ struct sector1 *sec1 = (struct sector1 *)((u8 *)data + 512);
struct sector0 *sec0 = (struct sector0 *)data;
printf("\n");
+ printf("DATE : %d-%d-%d\n",
+ BCD2INT(sec1->loader_year),
+ BCD2INT(sec1->loader_date >> 8),
+ BCD2INT(sec1->loader_date & 0xff));
+
+ printf("VERSION : %d.%d\n",
+ BCD2INT(sec1->loader_ver >> 8),
+ BCD2INT(sec1->loader_ver & 0xff));
+
+ printf("\n");
+
printf("magic : %08x\n"
"rc4_flag : %08x\n"
"boot_code1_offset: %d\n"
--
2.20.1
More information about the U-Boot
mailing list