From patchwork Tue Jan 2 15:46:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881666 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=UQEZamaR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HKf6FYvz20LT for ; Wed, 3 Jan 2024 02:47:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 206F6878F9; Tue, 2 Jan 2024 16:47:08 +0100 (CET) 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="UQEZamaR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8F7BF878EB; Tue, 2 Jan 2024 16:47:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) (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 C1310878EB for ; Tue, 2 Jan 2024 16:47:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5955764ea9bso175259eaf.1 for ; Tue, 02 Jan 2024 07:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210422; x=1704815222; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w/gYMJ6pegZY2reuOvRvPqOctDiX5Us81kSa+j+kj7U=; b=UQEZamaRVQIHoY0WDJzFv/FQGOtlZqjFGX9PAGB4JRPCpo+RxMrFLoajBf45JQDxsx 4zd4Y/OSV4GsITJ+KY2Ef2MgVUHWG7OcVjsWtvBk99t2gFSVjmWzqYAR/27iK3cRBVKG xc8EWZRK/fw494ylrT020BRDOEL8sskk5S8Kb5FAk/73M56Cw1B2WRTbJlYf2KmHFLpO vxVFIBb8ecIPTh2UwxfXTODCnbJ7+/iXn4onPg51e4qAMD/S7f4LfzJizB+epZjBSmIL +X36jCaVIT5nDkpfdAoTosIcMmGROlyc11ew7cnfLNye7dHe8P+x2DEil7PPvDmgya6h f8JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210422; x=1704815222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w/gYMJ6pegZY2reuOvRvPqOctDiX5Us81kSa+j+kj7U=; b=OFhsF48Wz54H/jKAqyxTg8YcYd1NClKLsfMwdOB+eAkfDDjMjndkbDXVJu+V9D2LgL CHDSHPRVi7o/X6bue3Ht0JDrSISXAv7EOjERZuFuhr/O49IISVM5f8Wui/FATPcHOoSy qLa72xDYVQmTM7+HcB9VaihoxJ6he+XVRwsiUsmOxNSuPK1Pls/heLHJ2EOdMz3NDnng lh0ZHSNe4qp/Yxj8hzNdh1b+KZCG9HjctIewiFwOCHd4szyGTEU8n2QN6Db+bdzIV4sq tYwyN4YSpr8dP3qriHGIwGpxzGlCUfonGb9XApD/E1ZUze/cGgc5PRNg0ZbQMg3C44dH vAFg== X-Gm-Message-State: AOJu0YxG4yYUXGfUuuFbnBuUF0QGMiVUE9GFw/EyqaHiMU7L8ZDSES/J e5c+HFX2gPmMExYNwdvZcNEFRJ/N3q+uKg== X-Google-Smtp-Source: AGHT+IETVtgJi9gzl5o1qypWPsEbiDxW62v6SrpWaRXUgdhExmuA9p2rKHEt7wGz/8rb80kn8T2L6A== X-Received: by 2002:a4a:988e:0:b0:595:c337:6f with SMTP id a14-20020a4a988e000000b00595c337006fmr645024ooj.12.1704210422105; Tue, 02 Jan 2024 07:47:02 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:01 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 1/7] board: rockchip: Refactor panel auto-detect code Date: Tue, 2 Jan 2024 09:46:48 -0600 Message-Id: <20240102154654.191055-2-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Make the inability to detect a panel using the auto detection code not fail the entire boot process. This means that if the panel ID cannot be read we don't set an environment variable for the panel, and if an environment variable for the panel is not set we don't attempt to update the compatible string. Changes to the code also ensure that when there are multiple compatible strings required for the panel we use them both, which solves some issues that will pop up soon for the Linux driver. Signed-off-by: Chris Morgan Reviewed-by: Kever Yang --- board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 115 +++++++++++++-------- 1 file changed, 74 insertions(+), 41 deletions(-) diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c index 3f1a42d184..3d0c614623 100644 --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c @@ -40,6 +40,7 @@ struct rg3xx_model { const char *board; const char *board_name; const char *fdtfile; + const bool detect_panel; }; enum rgxx3_device_id { @@ -54,52 +55,67 @@ enum rgxx3_device_id { static const struct rg3xx_model rg3xx_model_details[] = { [RG353M] = { - 517, /* Observed average from device */ - "rk3566-anbernic-rg353m", - "RG353M", - DTB_DIR "rk3566-anbernic-rg353p.dtb", /* Identical devices */ + .adc_value = 517, /* Observed average from device */ + .board = "rk3566-anbernic-rg353m", + .board_name = "RG353M", + /* Device is identical to RG353P. */ + .fdtfile = DTB_DIR "rk3566-anbernic-rg353p.dtb", + .detect_panel = 1, }, [RG353P] = { - 860, /* Documented value of 860 */ - "rk3566-anbernic-rg353p", - "RG353P", - DTB_DIR "rk3566-anbernic-rg353p.dtb", + .adc_value = 860, /* Documented value of 860 */ + .board = "rk3566-anbernic-rg353p", + .board_name = "RG353P", + .fdtfile = DTB_DIR "rk3566-anbernic-rg353p.dtb", + .detect_panel = 1, }, [RG353V] = { - 695, /* Observed average from device */ - "rk3566-anbernic-rg353v", - "RG353V", - DTB_DIR "rk3566-anbernic-rg353v.dtb", + .adc_value = 695, /* Observed average from device */ + .board = "rk3566-anbernic-rg353v", + .board_name = "RG353V", + .fdtfile = DTB_DIR "rk3566-anbernic-rg353v.dtb", + .detect_panel = 1, }, [RG503] = { - 1023, /* Observed average from device */ - "rk3566-anbernic-rg503", - "RG503", - DTB_DIR "rk3566-anbernic-rg503.dtb", + .adc_value = 1023, /* Observed average from device */ + .board = "rk3566-anbernic-rg503", + .board_name = "RG503", + .fdtfile = DTB_DIR "rk3566-anbernic-rg503.dtb", + .detect_panel = 0, }, /* Devices with duplicate ADC value */ [RG353PS] = { - 860, /* Observed average from device */ - "rk3566-anbernic-rg353ps", - "RG353PS", - DTB_DIR "rk3566-anbernic-rg353ps.dtb", + .adc_value = 860, /* Observed average from device */ + .board = "rk3566-anbernic-rg353ps", + .board_name = "RG353PS", + .fdtfile = DTB_DIR "rk3566-anbernic-rg353ps.dtb", + .detect_panel = 1, }, [RG353VS] = { - 695, /* Gathered from second hand information */ - "rk3566-anbernic-rg353vs", - "RG353VS", - DTB_DIR "rk3566-anbernic-rg353vs.dtb", + .adc_value = 695, /* Gathered from second hand information */ + .board = "rk3566-anbernic-rg353vs", + .board_name = "RG353VS", + .fdtfile = DTB_DIR "rk3566-anbernic-rg353vs.dtb", + .detect_panel = 1, }, }; struct rg353_panel { const u16 id; - const char *panel_compat; + const char *panel_compat[2]; }; static const struct rg353_panel rg353_panel_details[] = { - { .id = 0x3052, .panel_compat = "newvision,nv3051d"}, - { .id = 0x3821, .panel_compat = "anbernic,rg353v-panel-v2"}, + { + .id = 0x3052, + .panel_compat[0] = "anbernic,rg353p-panel", + .panel_compat[1] = "newvision,nv3051d", + }, + { + .id = 0x3821, + .panel_compat[0] = "anbernic,rg353v-panel-v2", + .panel_compat[1] = NULL, + }, }; /* @@ -298,11 +314,10 @@ int rgxx3_detect_display(void) if (!panel) { printf("Unable to identify panel_id %x\n", (panel_id[0] << 8) | panel_id[1]); - env_set("panel", "unknown"); return -EINVAL; } - env_set("panel", panel->panel_compat); + env_set("panel", panel->panel_compat[0]); return 0; } @@ -367,13 +382,14 @@ int rgxx3_detect_device(void) rg3xx_model_details[board_id].board_name); env_set("fdtfile", rg3xx_model_details[board_id].fdtfile); - /* Detect the panel type for any device that isn't a 503. */ - if (board_id == RG503) + /* Skip panel detection for when it is not needed. */ + if (!rg3xx_model_details[board_id].detect_panel) return 0; + /* Warn but don't fail for errors in auto-detection of the panel. */ ret = rgxx3_detect_display(); if (ret) - return ret; + printf("Failed to detect panel type\n"); return 0; } @@ -400,7 +416,8 @@ int rk_board_late_init(void) int ft_board_setup(void *blob, struct bd_info *bd) { - int node, ret; + const struct rg353_panel *panel = NULL; + int node, ret, i; char *env; /* No fixups necessary for the RG503 */ @@ -414,6 +431,12 @@ int ft_board_setup(void *blob, struct bd_info *bd) rg3xx_model_details[RG353M].board_name, sizeof(rg3xx_model_details[RG353M].board_name)); + env = env_get("panel"); + if (!env) { + printf("Can't get panel env\n"); + return 0; + } + /* * Check if the environment variable doesn't equal the panel. * If it doesn't, update the devicetree to the correct panel. @@ -424,12 +447,6 @@ int ft_board_setup(void *blob, struct bd_info *bd) return -ENODEV; } - env = env_get("panel"); - if (!env) { - printf("Can't get panel env\n"); - return -ENODEV; - } - ret = fdt_node_check_compatible(blob, node, env); if (ret < 0) return -ENODEV; @@ -438,8 +455,24 @@ int ft_board_setup(void *blob, struct bd_info *bd) if (!ret) return 0; - do_fixup_by_path_string(blob, "/dsi@fe060000/panel@0", - "compatible", env); + /* Panels don't match, search by first compatible value. */ + for (i = 0; i < ARRAY_SIZE(rg353_panel_details); i++) { + if (!strcmp(env, rg353_panel_details[i].panel_compat[0])) { + panel = &rg353_panel_details[i]; + break; + } + } + + if (!panel) { + printf("Unable to identify panel by compat string\n"); + return -ENODEV; + } + + /* Set the compatible with the auto-detected values */ + fdt_setprop_string(blob, node, "compatible", panel->panel_compat[0]); + if (panel->panel_compat[1]) + fdt_appendprop_string(blob, node, "compatible", + panel->panel_compat[1]); return 0; } From patchwork Tue Jan 2 15:46:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881667 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kEZ5ys07; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HKs1FbSz20LT for ; Wed, 3 Jan 2024 02:47:29 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9553087922; Tue, 2 Jan 2024 16:47:08 +0100 (CET) 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="kEZ5ys07"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8ED1587916; Tue, 2 Jan 2024 16:47:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) (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 D2FBD878F9 for ; Tue, 2 Jan 2024 16:47:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-594bea92494so3382688eaf.2 for ; Tue, 02 Jan 2024 07:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210423; x=1704815223; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VXUyqvMBbSvRf5h0yFwfQJJ9bpGctCcbPKtGC3XkLqs=; b=kEZ5ys07CkSoKCmBW3zc/Eu99k0yVG5v9CWL/sHPjWtFtk/3D8JyFpO9bB7SKz8eXA N3qRceRbgWb05cYYfd5u16r/ByDRK+6AACXksQvgzQ8ycDd8WJjks401IlkXte90AyQF UNSLRKt0bn5iYaia9DkVXTBUxsQLUUYF7CXsUsKKklnmVw2CToHctczBNV7J/zQm5uhP 3pqaqAWmTaohz3jz8cxJVWoJsz+cuJmHho86cLUJu/hC9ABCGAshWlce2sWIH189z4mQ O3RabBU8GogdXQ8iYQFeqBMFW1k96fDI6wat1Dt5xb7F98f5gq9XB9GiCRTp2p7mgVWk jdXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210423; x=1704815223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VXUyqvMBbSvRf5h0yFwfQJJ9bpGctCcbPKtGC3XkLqs=; b=JYvq7LXpkgtmHDj2xYLjbVtSmsjdQn4ksDEw7GF6p+0PzZgCjm0qlXsh+eTUE6j43f yJfOl39PwDXwFkXKIyRdk09D1p0izNZpFlbSOeotoOAChdmD1ED/I92wq6sqYymrj0BI hAf1x/NuCFkIZpWt+3t6Xoa50tPRA1DGNZzM7WMA3p3Ki/lCY2hmW4LWm2OCivNBQVbD RE+CYEikqqesahQifuMVZxn2CVXd0amEOh5zQ69SdZZrDCxxYafpmX1X/WMkARvzKnwD XW7HjrCQd684ppaMQpQizhIPf0rHvr8Y4j3m4mP+SyFskCdZfGajNiXFUCuuKcC9eGWx J/4Q== X-Gm-Message-State: AOJu0YxGq6HCcouHXSBo7q15OICcYMZAdfpiQJGZM5Pd5qxJOOdjVEWH EFHPHxvoVJqAXJ00J02mkVYTKCZyOMvhDw== X-Google-Smtp-Source: AGHT+IHnduA91YWgtvlV+z1mdX/AWf15qEAuZcedWvjO63k58eA7Y2OS9DV+wIpuYxSlhYbZjPv92A== X-Received: by 2002:a05:6820:230d:b0:58d:9b89:a844 with SMTP id cn13-20020a056820230d00b0058d9b89a844mr8220006oob.7.1704210423262; Tue, 02 Jan 2024 07:47:03 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:02 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 2/7] spl: Add Kconfig options for ADC Date: Tue, 2 Jan 2024 09:46:49 -0600 Message-Id: <20240102154654.191055-3-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Add kconfig options to enable ADC in SPL Signed-off-by: Chris Morgan --- common/spl/Kconfig | 7 +++++++ drivers/Makefile | 1 + drivers/adc/Makefile | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c521b02f4a..ada9dcea5c 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -579,6 +579,13 @@ config SPL_FIT_IMAGE_TINY ensure this information is available to the next image invoked). +config SPL_ADC + bool "Support ADC drivers" + help + Enable ADC drivers in SPL. These drivers can allow the reading of + analog values from one or more channels. Enable this option to + build the drivers in drivers/adc as part of an SPL build. + config SPL_CACHE bool "Support CACHE drivers" help diff --git a/drivers/Makefile b/drivers/Makefile index bf73b7718c..81ba2c534e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ +obj-$(CONFIG_$(SPL_)ADC) += adc/ obj-$(CONFIG_$(SPL_TPL_)BIOSEMU) += bios_emulator/ obj-$(CONFIG_$(SPL_TPL_)BLK) += block/ obj-$(CONFIG_$(SPL_TPL_)BOOTCOUNT_LIMIT) += bootcount/ diff --git a/drivers/adc/Makefile b/drivers/adc/Makefile index 5336c82097..9eb07769b0 100644 --- a/drivers/adc/Makefile +++ b/drivers/adc/Makefile @@ -4,7 +4,7 @@ # Przemyslaw Marczak # -obj-$(CONFIG_ADC) += adc-uclass.o +obj-$(CONFIG_$(SPL_)ADC) += adc-uclass.o obj-$(CONFIG_ADC_EXYNOS) += exynos-adc.o obj-$(CONFIG_ADC_SANDBOX) += sandbox.o obj-$(CONFIG_SARADC_ROCKCHIP) += rockchip-saradc.o From patchwork Tue Jan 2 15:46:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881668 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=DxvZmX6R; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HL31tSwz20LT for ; Wed, 3 Jan 2024 02:47:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1720587927; Tue, 2 Jan 2024 16:47:09 +0100 (CET) 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="DxvZmX6R"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC157878F9; Tue, 2 Jan 2024 16:47:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) (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 C0576876C0 for ; Tue, 2 Jan 2024 16:47:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-59505095b0dso687637eaf.0 for ; Tue, 02 Jan 2024 07:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210424; x=1704815224; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HF8fBHR/6AzEi0G7QM1eJ1umr8wAFHQApw15e/f+Vfk=; b=DxvZmX6Re1pMfTxWR1LmecK//HcGJY2cSTa24FF0kHkYzMRm1TrJ2fZb4tGdul4j3Y i3R5tHAivtDDGCCAO+CeXemIr3ehmN8Rw92H89ZZdcNmmF2q6pjyYzsqg1Pvh+kdvgMa 3Lka7Q1TAWOWClZcbkF2N6edlo9UrAs8sEsdMYrEhQbMypMgXIvzWurZ740wiV7mIM1O JoDh/WWicfK43xNvWHeb4vRGR71Wati/YUHMcGosZduX/bczqeC95MWm6c5R1avewdcO N0+bwnqtp6CQfZ1UhP85FNpIek3xH389qxt3/SeCZnYAW2XvPjK2Tb9BWmIm0YjVrlH+ U3lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210424; x=1704815224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HF8fBHR/6AzEi0G7QM1eJ1umr8wAFHQApw15e/f+Vfk=; b=R2V/iD6jTNir+rQyOlTz7RIbwG8xda4XTWhOwzHqAAaNLaqhQjudb4LpAvUkjt6xSv Pz+PugzT84OHVU32ouGlpwhlntRVFXxMRKAy1qJUpH5z4kuV6hRyl3GiTctJUHfnzGOO Ro/08vTPmkUdHb6DwanmXVvMQVS+Tcycp3ajUWKqBhSE8LK5ptoEgBLh2rs+mzjH+YTu Yzg7zFE3HNMQCgxJQqdbMvGD0+l9/5gVYkjkIUHvcBRWP5LSE0dcMvEPnr6cwqkM0YJC cyjmGULm8r9fVhH//NEapCJhzC6kue2xD8IBnUm+Z6OnA/XuQS9chXTkuInwtOaK0y9p u91w== X-Gm-Message-State: AOJu0YxoSTRro0uefrQbhcTVzs0NaflgTgqRPMg15epkukwQO+QeWdWy qQxQgl+pmUcxn+Zj+wQdvPxS0HB6fkOCrw== X-Google-Smtp-Source: AGHT+IFvEGDxr9ThaqurZsbH8Y1KGLptXfQlaojS6Js9ZmSEkEhUC5xkw/rWMwGikV0WRziX8RGg2w== X-Received: by 2002:a4a:988e:0:b0:595:c337:6f with SMTP id a14-20020a4a988e000000b00595c337006fmr645054ooj.12.1704210424070; Tue, 02 Jan 2024 07:47:04 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:03 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 3/7] rockchip: boot_mode: Allow rockchip_dnl_key_pressed() in SPL Date: Tue, 2 Jan 2024 09:46:50 -0600 Message-Id: <20240102154654.191055-4-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Update the rockchip_dnl_key_pressed() so that it can run in SPL. Also change the ADC channel to a define that can be overridden by a board specific option. Signed-off-by: Chris Morgan --- arch/arm/mach-rockchip/Makefile | 4 ++-- arch/arm/mach-rockchip/boot_mode.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 1dc92066bb..ff089ae949 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -15,13 +15,13 @@ obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) - # Always include boot_mode.o, as we bypass it (i.e. turn it off) # inside of boot_mode.c when CONFIG_ROCKCHIP_BOOT_MODE_REG is 0. This way, # we can have the preprocessor correctly recognise both 0x0 and 0 # meaning "turn it off". obj-y += boot_mode.o + +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o obj-$(CONFIG_MISC_INIT_R) += misc.o endif diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c index eb8f65ae4e..d2308768be 100644 --- a/arch/arm/mach-rockchip/boot_mode.c +++ b/arch/arm/mach-rockchip/boot_mode.c @@ -38,6 +38,10 @@ void set_back_to_bootrom_dnl_flag(void) #define KEY_DOWN_MIN_VAL 0 #define KEY_DOWN_MAX_VAL 30 +#ifndef RK_DNL_ADC_CHAN +#define RK_DNL_ADC_CHAN 1 +#endif + __weak int rockchip_dnl_key_pressed(void) { unsigned int val; @@ -52,7 +56,8 @@ __weak int rockchip_dnl_key_pressed(void) ret = -ENODEV; uclass_foreach_dev(dev, uc) { if (!strncmp(dev->name, "saradc", 6)) { - ret = adc_channel_single_shot(dev->name, 1, &val); + ret = adc_channel_single_shot(dev->name, + RK_DNL_ADC_CHAN, &val); break; } } @@ -73,11 +78,13 @@ __weak int rockchip_dnl_key_pressed(void) void rockchip_dnl_mode_check(void) { +#if CONFIG_IS_ENABLED(ADC) if (rockchip_dnl_key_pressed()) { printf("download key pressed, entering download mode..."); set_back_to_bootrom_dnl_flag(); do_reset(NULL, 0, 0, NULL); } +#endif } int setup_boot_mode(void) @@ -90,6 +97,7 @@ int setup_boot_mode(void) boot_mode = readl(reg); debug("%s: boot mode 0x%08x\n", __func__, boot_mode); +#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) /* Clear boot mode */ writel(BOOT_NORMAL, reg); @@ -103,6 +111,7 @@ int setup_boot_mode(void) env_set("preboot", "setenv preboot; ums mmc 0"); break; } +#endif return 0; } From patchwork Tue Jan 2 15:46:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881669 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=BoqQEPLB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HLF2NVjz20LT for ; Wed, 3 Jan 2024 02:47:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF9C487913; Tue, 2 Jan 2024 16:47:11 +0100 (CET) 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="BoqQEPLB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F3B587921; Tue, 2 Jan 2024 16:47:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) (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 69F30878FF for ; Tue, 2 Jan 2024 16:47:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-593f7a1afd7so5588439eaf.0 for ; Tue, 02 Jan 2024 07:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210425; x=1704815225; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p5MmLTyPSaXbpcUIGw5nJR17KHdoAWQ54YJDEvdfcRo=; b=BoqQEPLB3LW2LdsVQk0RTB+chWBxTSEoXbPdtgZu11kHePgaa6E0WJNZpoYsOY9NM7 8az1kXjvncz3FxLgnUjO2H625YVFCCJHlC6FSBm6QIBlgo0Mfh2utVono+aEFGrDzEMg t5s/dkaBifF7qGLKoT9///HWSeZiirpchxylhOKLRQ7jKxaci4RpNO/hIXToaLXIi3H6 a3iSeS67b7IVGHYILo5dVMwSK7J7Fu+SoHQuAbCplkexHQR/6DUzGZLQ7KGb/iNF036N Vtr+rBRo7IDKO2U1VOyYDgkD8J+y80/LifOq4i3Jp9IhI371cB5gfspDO5xYNqRgdR5x 1Sng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210425; x=1704815225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p5MmLTyPSaXbpcUIGw5nJR17KHdoAWQ54YJDEvdfcRo=; b=N0PGKWdGa9ri6uKOECwpB7rmyCpaOHfOgyIRBDJR1xOXNM/wn2ysejPo1plUKtwAo0 OsOu1SFLjLcployiYWvk2Ln0FwFuVv7JoIrF0HUw89yDjGfrCJAq3ZQ2IFhhAOFyww3G RizUnZPs/XGZoKU3Veg2IHud8K9TT5yJnXPt9lcEKw7u7S2Ovx9G8Cn4b+YeSmUto8mU m2qLsbSXh8v6VkScbTIEySI1I4Qu3FNeVM//zacBq8nMJVB9NQ3BJ6YrrVGe79H+G9RV UymcKEDKF86eoOVlSKCe+F+rQhSUReuDyz6lrNmlp16JqNfNA02yKmg9KTviJVYfttLZ r4RQ== X-Gm-Message-State: AOJu0Yzy7rorOhvo4G1cjhqDYayS738inDjcsK28ecU1+q52mkZ10UCx bSC201XA9NjFo0tb6k3hNf1l/i1Vgvl46Q== X-Google-Smtp-Source: AGHT+IHD2Gn/vsWqhvRjgAP432CiqwCISQ4NrjY4DJSzRC7wVv9dM/5J3BNq1GS0PhQeYg+/8+Susg== X-Received: by 2002:a4a:643:0:b0:594:406:4416 with SMTP id 64-20020a4a0643000000b0059404064416mr8680976ooj.8.1704210424875; Tue, 02 Jan 2024 07:47:04 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:04 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 4/7] board: rockchip: Add Recovery Button for Anbernic RGxx3 Date: Tue, 2 Jan 2024 09:46:51 -0600 Message-Id: <20240102154654.191055-5-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Add support for users to enter recovery mode by holding the function button when they power up the device. Since the device has soldered eMMC and sometimes does not expose a clk pin on the mainboard there is a small chance that a user who flashes a bad bootloader may not be able to recover if the headers themselves are valid. As a result this check is done during spl_early_init() to ensure that it runs as early as possible, and it does so by directly manipulating the ADC hardware in lieu of loading the ADC driver. Signed-off-by: Chris Morgan --- arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi | 11 +++++++++++ board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 6 +++++- configs/anbernic-rgxx3-rk3566_defconfig | 16 ++++++++++++---- include/configs/anbernic-rgxx3-rk3566.h | 2 ++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi index f986e1941e..e3ab196d22 100644 --- a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi +++ b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi @@ -76,6 +76,12 @@ /delete-property/ clock-names; }; +&saradc { + bootph-all; + vref-supply = <&vcc_sys>; + status = "okay"; +}; + &sdhci { pinctrl-0 = <&emmc_bus8>, <&emmc_clk>, <&emmc_cmd>, <&emmc_datastrobe>, <&emmc_rstnout>; @@ -94,3 +100,8 @@ bootph-all; status = "okay"; }; + +&vcc_sys { + bootph-all; + status = "okay"; +}; diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c index 3d0c614623..45854709f5 100644 --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -119,11 +120,14 @@ static const struct rg353_panel rg353_panel_details[] = { }; /* - * Start LED very early so user knows device is on. Set color + * Check if rockchip_dnl button is pressed and reboot into rockusb if + * true. Start LED very early so user knows device is on. Set color * to red. */ void spl_board_init(void) { + setup_boot_mode(); + /* Set GPIO0_C5, GPIO0_C6, and GPIO0_C7 to output. */ writel(GPIO_WRITEMASK(GPIO_C7 | GPIO_C6 | GPIO_C5) | \ (GPIO_C7 | GPIO_C6 | GPIO_C5), diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig index ed6643d9d4..4e72f75815 100644 --- a/configs/anbernic-rgxx3-rk3566_defconfig +++ b/configs/anbernic-rgxx3-rk3566_defconfig @@ -3,6 +3,7 @@ CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_COUNTER_FREQUENCY=24000000 CONFIG_ARCH_ROCKCHIP=y CONFIG_TEXT_BASE=0x00a00000 +CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 @@ -24,7 +25,9 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y +CONFIG_SPL_FIT_SIGNATURE=y CONFIG_SPL_LOAD_FIT=y +CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-anbernic-rgxx3.dtb" @@ -32,7 +35,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-anbernic-rgxx3.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_RNG_SEED=y -CONFIG_SPL_MAX_SIZE=0x20000 +CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x4000000 @@ -41,6 +44,8 @@ CONFIG_SPL_BOARD_INIT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set CONFIG_SPL_STACK_R=y +CONFIG_SPL_ADC=y +CONFIG_SPL_POWER=y CONFIG_SPL_ATF=y CONFIG_CMD_PWM=y CONFIG_CMD_GPT=y @@ -50,8 +55,10 @@ CONFIG_CMD_MMC=y # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIVE=y +CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y # CONFIG_NET is not set +CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y CONFIG_SPL_CLK=y @@ -67,13 +74,13 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY=y +CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_FAN53555=y CONFIG_PMIC_RK8XX=y -CONFIG_REGULATOR_PWM=y -CONFIG_DM_REGULATOR_GPIO=y +CONFIG_SPL_DM_REGULATOR=y +CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_REGULATOR_RK8XX=y -CONFIG_DM_REGULATOR_SCMI=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=y # CONFIG_RAM_ROCKCHIP_DEBUG is not set @@ -89,5 +96,6 @@ CONFIG_VIDEO_ROCKCHIP=y CONFIG_DISPLAY_ROCKCHIP_DW_MIPI=y CONFIG_VIDEO_BRIDGE=y CONFIG_REGEX=y +# CONFIG_RSA is not set CONFIG_ERRNO_STR=y # CONFIG_EFI_LOADER is not set diff --git a/include/configs/anbernic-rgxx3-rk3566.h b/include/configs/anbernic-rgxx3-rk3566.h index 3c4ea4e7d8..2aaac55c06 100644 --- a/include/configs/anbernic-rgxx3-rk3566.h +++ b/include/configs/anbernic-rgxx3-rk3566.h @@ -9,4 +9,6 @@ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" +#define RK_DNL_ADC_CHAN 0 + #endif From patchwork Tue Jan 2 15:46:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881670 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=h7I9jDDG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HLR4kCSz20LT for ; Wed, 3 Jan 2024 02:47:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 81FD887940; Tue, 2 Jan 2024 16:47:12 +0100 (CET) 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="h7I9jDDG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D9B3878F1; Tue, 2 Jan 2024 16:47:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) (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 3C32087913 for ; Tue, 2 Jan 2024 16:47:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5953a6a00ddso1448217eaf.0 for ; Tue, 02 Jan 2024 07:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210425; x=1704815225; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i87RhnjO8GZSHdEP0gaGe/4YhkfPRWoWKMbSvztmvCg=; b=h7I9jDDGM5j6GL2t3APpJCTerfUguSAvhUeS0omKnwwZ2g/qGxYZgU3zZDwyL1yxp1 T0eDwlP3cldSk95vddx4UHLVDSbNoH6dLm14H7SCp7P0zu2les3AVAyLwteZHuYtIgOe IDHP+USdGt5Kgc39Wol5huFPWaNv725FMuYaUZjKwbj/yCRA1irHCKPPtGDtydh8ZV8D rEB4zN+YmKKoNgawOvH9mxPu+IAp+eJk6K3p461aSYZDoRkLpMKOLJ0TSUHMnTGwNFwY 0khOAHqo/pyTX4RMVl2Yyaj4wMih+OqgokIUvci7VYciYf/+SHQQ45JA1508Rulq7dNr Cn5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210425; x=1704815225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i87RhnjO8GZSHdEP0gaGe/4YhkfPRWoWKMbSvztmvCg=; b=u8p19X+G8fQFp/yWLireQoWlvgkhwpGOKsg/ywvyxgQzr0MX48JZoL1Kk5P3xm9GH+ N/eurPjiQO6ysu6oPuQgEUXLfRRNGBD1sXTf2ET27hW00X4oCT7YX7K0wPeg0ziY7U8+ 5b5OSEKBZXCKNUSVCdjV/e9BPedGubprJ+IBHxfbiqPl8x2Bug5ogGa7wtOYHxdq5e5z iwe+5CpktcnxicuJl9CHvAFl5+VWnBz0kiv+TDXGCrllvwWGLwgbFAk2yNIdaYuPShz0 OPgiBrjAtQAbQnJlf0vKDHxDgCE3y8IoOb4vaoS2pmx6FKMzRiJRnZtuIZxKTSdP+4nz ug0g== X-Gm-Message-State: AOJu0YzRVVmhdWbiuRPBzhgGQ1Gfh+bTlYjUyJMeUHn/8/MzvdwfifrK aIcWCfKXN7a20T0EQVI1imJTEqqo4o2ECA== X-Google-Smtp-Source: AGHT+IHr3XTHoX3FgU5hlrkw7eG2z8sf95KNQp+NifjPj1Pg9FUp7SV3mO5zYbWfP7LDTTUuyNzdGw== X-Received: by 2002:a4a:5590:0:b0:591:c8d7:aa80 with SMTP id e138-20020a4a5590000000b00591c8d7aa80mr10146880oob.14.1704210425723; Tue, 02 Jan 2024 07:47:05 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:05 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 5/7] rockchip: board: Add board_rng_seed() for all Rockchip devices Date: Tue, 2 Jan 2024 09:46:52 -0600 Message-Id: <20240102154654.191055-6-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Allow all rockchip devices to use the hardware RNG to seed Linux RNG. Signed-off-by: Chris Morgan Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/board.c | 32 ++++++++++++++++++++++ board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 29 -------------------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 57f08e0be0..77145524ea 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -348,3 +348,35 @@ __weak int misc_init_r(void) return ret; } #endif + +#if IS_ENABLED(CONFIG_BOARD_RNG_SEED) && IS_ENABLED(CONFIG_RNG_ROCKCHIP) +#include + +/* Use hardware rng to seed Linux random. */ +__weak int board_rng_seed(struct abuf *buf) +{ + struct udevice *dev; + size_t len = 0x8; + u64 *data; + + data = malloc(len); + if (!data) { + printf("Out of memory\n"); + return -ENOMEM; + } + + if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { + printf("No RNG device\n"); + return -ENODEV; + } + + if (dm_rng_read(dev, data, len)) { + printf("Reading RNG failed\n"); + return -EIO; + } + + abuf_init_set(buf, data, len); + + return 0; +} +#endif diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c index 45854709f5..7bef5a53f0 100644 --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -137,34 +136,6 @@ void spl_board_init(void) (GPIO0_BASE + GPIO_SWPORT_DR_H)); } -/* Use hardware rng to seed Linux random. */ -int board_rng_seed(struct abuf *buf) -{ - struct udevice *dev; - size_t len = 0x8; - u64 *data; - - data = malloc(len); - if (!data) { - printf("Out of memory\n"); - return -ENOMEM; - } - - if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { - printf("No RNG device\n"); - return -ENODEV; - } - - if (dm_rng_read(dev, data, len)) { - printf("Reading RNG failed\n"); - return -EIO; - } - - abuf_init_set(buf, data, len); - - return 0; -} - /* * Buzz the buzzer so the user knows something is going on. Make it * optional in case PWM is disabled. From patchwork Tue Jan 2 15:46:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881671 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Pm4DUL/d; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HLd5NZJz20LT for ; Wed, 3 Jan 2024 02:48:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0320087944; Tue, 2 Jan 2024 16:47:13 +0100 (CET) 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="Pm4DUL/d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 49DB5878DB; Tue, 2 Jan 2024 16:47:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) (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 199C2876C0 for ; Tue, 2 Jan 2024 16:47:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-59574cbcd50so419079eaf.2 for ; Tue, 02 Jan 2024 07:47:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210426; x=1704815226; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UJhSCYRgS5TwE24+2YJfWeVs9zEBA+O1bqP3d5jKlAo=; b=Pm4DUL/dlmPYByq2ilaxETV0fz5X9CU6MYa1dyNQvm/4COp8YLN7AT4+0oPeSv5H3E fwv9E/n84Z+bR99W51hNqKNj+1+mpdWMpiR+R8hCohHKJMB9BZoNFMR4tcbytRA3Z0/N yDiHl/FC+hOXPV8mZZu5CMnzU9fH3hlfCjiZEgtCLZbRN4cXzU2ZXbk4NOA/M+k1n6o0 6JDdIC07sFqjdFC8qywikoLRvOzWG9xKDJCEWAgQv1Rbz//0NsweSjyq0w0xPW35fJrP a6vs5nm6yx8XCxmBsD+26lBmUMeAMmn0OLeNyylfC4ilmU7db1Bwi/FiRXi3EzQIpTkc IODQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210426; x=1704815226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UJhSCYRgS5TwE24+2YJfWeVs9zEBA+O1bqP3d5jKlAo=; b=t3svYUyNztiao0vhFDTe8AAoYa72e9IafzteEbi1KP/aI/ght3WmE5+3rilcKrYZGT 1SwdXvCTrb/2RFiqu6EPSk0X2ZlN7t7mXYzopni/++Ftvt6TbR5+07u+0I6EUC/7k7Vr Ic8YNUexxg6i/0oTBX9VMPuz0zqweJAGDIjiPMMgYKRckLeIMC+dPl30Eh0ShHIHKwVS qRbQbkLCdp5zf0Ez47pQyQYSbOQmf3wNJi+GXCzEYB1JlhWXr/SiVskzDW4BkNeB/ldd oocRm/9y6BvVqSWPjUHGxixDUHg9QZ/EsdIPT8D57AH/+0vVvcWrXEEQrnotqXa/uedq jdZA== X-Gm-Message-State: AOJu0YwGlfIbCeUQzf8vPfTJQKu2VisgWWWZybzGXQnM1l4BtVbyysa0 jdXZHUQGGBZ1QWsLmDdVNqV88HTvUniDMQ== X-Google-Smtp-Source: AGHT+IHTgNtfupM+yqflhk+1K2rENb+UpCO8Bp0BJ0172t9EigvYzIM+wDC+fxHMlaxys7TvJW1BTQ== X-Received: by 2002:a4a:57c1:0:b0:594:35b8:5fb9 with SMTP id u184-20020a4a57c1000000b0059435b85fb9mr6486113ooa.15.1704210426586; Tue, 02 Jan 2024 07:47:06 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:06 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 6/7] board: rockchip: Add support for new boards to RGxx3 Date: Tue, 2 Jan 2024 09:46:53 -0600 Message-Id: <20240102154654.191055-7-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Add support for the Anbernic RG-ARC-D, Anbernic RG-ARC-S, Powkiddy RK2023, and Powkiddy RGB30 to the Anbernic RGxx3. While the Powkiddy devices are manufactured by Powkiddy instead of Anbernic, the hardware is so similar they can all use the same bootloader. Signed-off-by: Chris Morgan Reviewed-by: Kever Yang --- board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c index 7bef5a53f0..e12a85a02a 100644 --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c @@ -48,9 +48,13 @@ enum rgxx3_device_id { RG353P, RG353V, RG503, + RGB30, + RK2023, + RGARCD, /* Devices with duplicate ADC value */ RG353PS, RG353VS, + RGARCS, }; static const struct rg3xx_model rg3xx_model_details[] = { @@ -83,6 +87,27 @@ static const struct rg3xx_model rg3xx_model_details[] = { .fdtfile = DTB_DIR "rk3566-anbernic-rg503.dtb", .detect_panel = 0, }, + [RGB30] = { + .adc_value = 383, /* Gathered from second hand information */ + .board = "rk3566-powkiddy-rgb30", + .board_name = "RGB30", + .fdtfile = DTB_DIR "rk3566-powkiddy-rgb30.dtb", + .detect_panel = 0, + }, + [RK2023] = { + .adc_value = 635, /* Observed average from device */ + .board = "rk3566-powkiddy-rk2023", + .board_name = "RK2023", + .fdtfile = DTB_DIR "rk3566-powkiddy-rk2023.dtb", + .detect_panel = 0, + }, + [RGARCD] = { + .adc_value = 183, /* Observed average from device */ + .board = "rk3566-anbernic-rg-arc-d", + .board_name = "Anbernic RG ARC-D", + .fdtfile = DTB_DIR "rk3566-anbernic-rg-arc-d.dtb", + .detect_panel = 0, + }, /* Devices with duplicate ADC value */ [RG353PS] = { .adc_value = 860, /* Observed average from device */ @@ -98,6 +123,13 @@ static const struct rg3xx_model rg3xx_model_details[] = { .fdtfile = DTB_DIR "rk3566-anbernic-rg353vs.dtb", .detect_panel = 1, }, + [RGARCS] = { + .adc_value = 183, /* Observed average from device */ + .board = "rk3566-anbernic-rg-arc-s", + .board_name = "Anbernic RG ARC-S", + .fdtfile = DTB_DIR "rk3566-anbernic-rg-arc-s.dtb", + .detect_panel = 0, + }, }; struct rg353_panel { @@ -332,19 +364,21 @@ int rgxx3_detect_device(void) } /* - * Try to access the eMMC on an RG353V or RG353P. If it's - * missing, it's an RG353VS or RG353PS. Note we could also - * check for a touchscreen at 0x1a on i2c2. + * Try to access the eMMC on an RG353V, RG353P, or RG Arc D. + * If it's missing, it's an RG353VS, RG353PS, or RG Arc S. + * Note we could also check for a touchscreen at 0x1a on i2c2. */ - if (board_id == RG353V || board_id == RG353P) { + if (board_id == RG353V || board_id == RG353P || board_id == RGARCD) { mmc = find_mmc_device(0); if (mmc) { ret = mmc_init(mmc); if (ret) { if (board_id == RG353V) board_id = RG353VS; - else + else if (board_id == RG353P) board_id = RG353PS; + else + board_id = RGARCS; } } } From patchwork Tue Jan 2 15:46:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1881672 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=H9L7lOdu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4HLr00jmz20LT for ; Wed, 3 Jan 2024 02:48:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8F8A8794B; Tue, 2 Jan 2024 16:47:13 +0100 (CET) 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="H9L7lOdu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 63536878DB; Tue, 2 Jan 2024 16:47:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) (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 07ACE87923 for ; Tue, 2 Jan 2024 16:47:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-594bea92494so3382722eaf.2 for ; Tue, 02 Jan 2024 07:47:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704210427; x=1704815227; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k5CXCYUczBUQjKQamPloqkUsFz2d5ZVu36134TsC2t4=; b=H9L7lOduZcyMBHQfO3tjWHVgYOmhD4smrRImISCL/fCOtHkK4a24vKXiOBdqQiFYAq d5qx/LDgmjFgipVfLOjXatcTtOH2k+QfKBZcoqIbtqvNEyYSiruh7dJNFTVxA/YhxMn3 kNMvzkjQQuYeuhki5Nw2G1xNu3cv3DnswNh8Epl2r+P5xgBCiSPloKZ5s59vSQapnl/D f2vjULMe7FE/ge9viRwJAP2XTU0Eu/VNUWnGqp2jSOBRxufxCMLl9dbYO2d4936fMduV qTcn4r1kJDDLz83ilmD0B4Z0mDuPnUDgdPfgUOv9X4zImo9fo2iHPXeOBrssxKF0WvsX 3V5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704210427; x=1704815227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k5CXCYUczBUQjKQamPloqkUsFz2d5ZVu36134TsC2t4=; b=eQlO8havFt97u1LZ+XxN6b+gRpO96xNHWv47VoSFjjRFndbN1QwJ7ouOZc+mmv0t9p tchh3CqOsRHK8uVYOgxTjMlvGguxTMex37Z9x+r0a06Z5/KZ7Q9JQ1hsUDg/2mG9Wnea Z7DZSbDvggh1aac98ar+H+PZBbYauoN40sx1MW/U4C0TRQ6FMeQq/msti124eLjpKlKB bbvaO73FCV3GXRkfKEM/5m3hzVMdXNOapfhQRtsjifuwzglcycFAwJSQt0+dMeuArNou coR9PpjpxW+rNPXab2f9yH2kmiYns+IQom/JCX4Kep5gNpj9r6XprcHz5gMa3+is02cK tWlg== X-Gm-Message-State: AOJu0YwTyIXEH48TYASzmxD5AkD8ciGO7Xg0iCI+eSZXGeFHeisE8C+w wTKe9i7tZ/TnZyMB+xvJIWWbyvpTyGtyoA== X-Google-Smtp-Source: AGHT+IG3P6LXnNFfsTkbEiW30t44RiGzB7zfFya0DQfFfkD2QJM+HK+/hMSG6xF+M+V6s+8aYYUy6w== X-Received: by 2002:a4a:ab84:0:b0:595:e14c:6aee with SMTP id m4-20020a4aab84000000b00595e14c6aeemr562931oon.6.1704210427557; Tue, 02 Jan 2024 07:47:07 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id 127-20020a4a0d85000000b005958af24e84sm843197oob.42.2024.01.02.07.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:47:06 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai, jonas@kwiboo.se, Chris Morgan Subject: [PATCH V4 7/7] doc: board: anbernic: Update rgxx3 to add new boards Date: Tue, 2 Jan 2024 09:46:54 -0600 Message-Id: <20240102154654.191055-8-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com> References: <20240102154654.191055-1-macroalpha82@gmail.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Update the RGxx3 documentation to note that it now supports the RG-ARC-D, RG-ARC-S, Powkiddy RK2023, and Powkiddy RGB30. Also update verbiage around panel detection to note that it is no longer hard coded to the RG503. Signed-off-by: Chris Morgan Reviewed-by: Kever Yang --- doc/board/anbernic/rgxx3.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/board/anbernic/rgxx3.rst b/doc/board/anbernic/rgxx3.rst index 7d1beb423c..d159ed2f76 100644 --- a/doc/board/anbernic/rgxx3.rst +++ b/doc/board/anbernic/rgxx3.rst @@ -5,6 +5,8 @@ U-Boot for Anbernic RGxx3 Devices This allows U-Boot to boot the following Anbernic devices: + - Anbernic RG-ARC-D + - Anbernic RG-ARC-S - Anbernic RG353M - Anbernic RG353P - Anbernic RG353PS @@ -12,18 +14,24 @@ This allows U-Boot to boot the following Anbernic devices: - Anbernic RG353VS - Anbernic RG503 +Additionally, the following very similar non-Anbernic devices are also +supported: + + - Powkiddy RGB30 + - Powkiddy RK2023 + The correct device is detected automatically by comparing ADC values from ADC channel 1. In the event of an RG353V or RG353P, an attempt is then made to probe for an eMMC and if it fails the device is assumed to be an RG353VS or RG353PS. Based on the detected device, the environment variables "board", "board_name", and "fdtfile" are set to the correct values corresponding to the board which can be read by a -boot script to boot with the correct device tree. If the board detected -is not of type RG503 (which currently has only 1 panel revision) a -panel detect is then performed by probing a "dummy" display on the DSI -bus and then querying the display ID. The display ID is then compared -to a table to get the known compatible string for use in Linux, and -this string is saved as an environment variable of "panel". +boot script to boot with the correct device tree. If a board is defined +as requiring panel detection, a panel detect is then performed by +probing a "dummy" display on the DSI bus and then querying the display +ID. The display ID is then compared to a table to get the known +compatible string for use in Linux, and this string is saved as an +environment variable of "panel". FDT fixups are performed in the event of an RG353M to change the device name, or in the event the panel detected does not match the devicetree.