Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41BC4C433EF for ; Sat, 9 Jul 2022 18:49:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 782FC845FD; Sat, 9 Jul 2022 20:49:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GJRPDSW0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8EE5984604; Sat, 9 Jul 2022 20:49:51 +0200 (CEST) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A68AC845F3 for ; Sat, 9 Jul 2022 20:49:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x535.google.com with SMTP id g1so1974837edb.12 for ; Sat, 09 Jul 2022 11:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:cc :references:content-language:in-reply-to:content-transfer-encoding; bh=YR3frPdRSPo3hIcmGCM2c1lXJ1BHIrJIA8CdUl7B5YU=; b=GJRPDSW0ooOrsm6u4LEdOXNBBR+TlTfC03WoXm6bB7i+ye7yi6yvrBYktuFSwG6laQ i0hV2u/AnzpLnLdvnbxcQ/2kE85XFU2ldYaIqVT5N3UJii+GQLklJ5SZuc3nXIrD6zTm eAo2oa9j8DmLiLH8QjsGaPTVw4Xesogj2KF1ivv6ugcOzXLwKGX/ne8LoYTtAYBXE5sP d82s1oGIirMCBQr7GFgSCE3TaEC8COWXhIY+J09c0Oz4ucPWaj+GkuCBXrl3L3PdOugk SJ5vgbKkRJQD2s7Ws38RWRm4WMYSLrRnb2jG2c71xL9jrCWPIk8ies6xh/5OafI4VyOk nN5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:cc:references:content-language:in-reply-to :content-transfer-encoding; bh=YR3frPdRSPo3hIcmGCM2c1lXJ1BHIrJIA8CdUl7B5YU=; b=CLbNKo3NmQOKmxvYN7aBLAzKh/ELYXDi8W6OImJz4GWDuyrxom6tbT12BvxFoFo0zn SRceMqMGFPqvd3JM0KqGCPC7T/x8V72MoUYMei9rLmNUIJH9X7PKtFQoGvSE680ElX9K lSU+aZgu6I0uFI37HgFLYlpCdnNICetYJNUEO4nZZITJs0dq3C1QUvCMDypdMWAtm4JA 2lrqJSEmHt+dFZv4LuI3T+Mx5QPS1YAGJOJ3K3VwAcyHtypEz80ttq18POJjdq409QaP ebppkRzC0iKP8ah+pVDINP3kcAFnfZqPizUBgeDq/CYY/skH1mzqyJPPl4NtY10OVj8s LtYg== X-Gm-Message-State: AJIora8j9Kthixx1WX4SkcLvECos+a/DLljUw1Ph928dYTFd65/RcVPC /OIMWREsU7F+EWe53lhVuek= X-Google-Smtp-Source: AGRyM1vy1n9NLpSFoY+u8rZkCsp6eiOMEJ1Q7h9jVT2gW78CuEswQaRN6vyi7260GJAvs8CEGagjsw== X-Received: by 2002:a05:6402:3553:b0:434:ef34:664f with SMTP id f19-20020a056402355300b00434ef34664fmr13567040edd.236.1657392588213; Sat, 09 Jul 2022 11:49:48 -0700 (PDT) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id ky6-20020a170907778600b0072b11cb485asm833787ejc.208.2022.07.09.11.49.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Jul 2022 11:49:47 -0700 (PDT) Message-ID: <97371b48-62a5-5095-70ec-96c0e817c865@gmail.com> Date: Sat, 9 Jul 2022 20:49:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 From: Johan Jonker Subject: [PATCH v2 05/11] rockchip: idb: add sector1 info To: kever.yang@rock-chips.com Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, xypron.glpk@gmx.de, yifeng.zhao@rock-chips.com, jon.lin@rock-chips.com, u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, miquel.raynal@bootlin.com, michael@amarulasolutions.com, dario.binacchi@amarulasolutions.com References: <20220709183130.8039-1-jbx6244@gmail.com> Content-Language: en-US In-Reply-To: <20220709183130.8039-1-jbx6244@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 --- 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