From patchwork Mon Jun 8 18:31:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11593817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D30790 for ; Mon, 8 Jun 2020 18:32:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39499206D5 for ; Mon, 8 Jun 2020 18:32:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aHZVVY7c"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="KXrbf0GJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39499206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aWoONp/Z95lbpX2nT+zbOw/yllCcwwvHwj0EATdWKXg=; b=aHZVVY7cvWD+93 S6BTlyXXP7Ea1QB7sStSzUE1GHqw4ZUuiBA2bUvJZrDH9CbDNM17QazpvSVoF0Lhl2+NQ3rkJQrxm OD8Yp8hTYvLbAK5pn7XHmj43NIlNWLqxy3dFHbpLzii4z8jvd2oU6p2Uqw7JFHtAFbvEpsBAISiNw /lhwbCUZ18axTefuZJPxn6Ee1nNDDKRBp53qY0H0iz9VmcsxCqx0ivq+f3g7Kj4OlpkWUBps7+FRq yNGFxp6y5KyDLOK2oASmQDb/swjfhSy2UzQsErSEDq3Gx8Fmrps9EFARgWxzbwHU5BOxINMz1IX+K FSEtxpJBdJAbHOlWtR2w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZ1-00039G-6Y; Mon, 08 Jun 2020 18:32:03 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMYy-000385-OS for linux-rockchip@lists.infradead.org; Mon, 08 Jun 2020 18:32:02 +0000 Received: by mail-pj1-x1041.google.com with SMTP id ne5so189017pjb.5 for ; Mon, 08 Jun 2020 11:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+OOH0MJYGocj8ptIYBFShfjnt/CJ6WeKYHtBzKGq9J0=; b=KXrbf0GJxR39+3k6fAIO5E62G0bhoBULcRt6O+kEb/zL8ISqKbg+8tCA16LPULiN46 F6f5HJB3sJZojD/alYCToc9MLc/Owr/+DLeqhw3he8bt92gAHS7BZppL+QOovdodIjxU zZR5b7msWV9Z77IO+Izw6EPtAcAr3ITMbN3Yo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+OOH0MJYGocj8ptIYBFShfjnt/CJ6WeKYHtBzKGq9J0=; b=O1fneiJ2jUOibjsbyRdz3JR4eYOCl6Z7W89vXj+D2NXxcRf48M0bJbv/4fGV+gGXHg I4xExkHVMPMg8T06IVbzseFeDwKCC8EmIaH3JLl0VnNDtkxukZ9l/4B4XXVJpNliJ7jP IHyOZxUkHBUPeSuWGaVnmoKQlSB4KK533qLvG0r9Eudg/FaFpCmdnP0G4M7Cmjo6bSsv SIoEsEADjk1EaB1BSfqag27Lp8Pok0nhTQg42UC8syvFEWzNRVuPPqwuXfYQE2ZuX4Yu MX9TgaQZGaLwph6+JeyVTzimGD/lIOOSfUjfvgPUuQIFIkV6l1E6GvblRmUaY6RKapW/ 04xg== X-Gm-Message-State: AOAM530+9HeaeEjEYE/UpQ1v9/Q3mt3299Sj+VnRx6488O7GY6wMOX3Y p+fup9heD4luv6G/qvmF5N0f1A== X-Google-Smtp-Source: ABdhPJw547zfZGYd6D4c8qE+50OP2OjdtddrG2LznRFGOksNBDfpkRhpeQROYt5dvPNG8MISrTTXyw== X-Received: by 2002:a17:902:9047:: with SMTP id w7mr86571plz.275.1591641119986; Mon, 08 Jun 2020 11:31:59 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:31:59 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Subject: [PATCH v3 1/5] rk3399: spl: Add rk_spl_board_init as __weak Date: Mon, 8 Jun 2020 14:31:40 -0400 Message-Id: <20200608183144.26809-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_113200_793268_93FF9DAD X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1041 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Current spl_board_init is mostly specific to puma-rk3399 target and in other words it cannot be required or useful for other rk3399 boards. Some boards require their custom initialization to be part of spl_board_init like roc-rk3399-pc require leds setup, environments. So, this patch handles all these possible scenarios. Add rk_spl_board_init as __weak so that boards that require their own custom initialization can be defined on their board file. Signed-off-by: Jagan Teki Tested-by: Suniel Mahesh --- Changes for v3: - new patch arch/arm/mach-rockchip/rk3399/rk3399.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index 4fda93b152..681f80f339 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -241,7 +241,7 @@ static void rk3399_force_power_on_reset(void) } #endif -void spl_board_init(void) +__weak void rk_spl_board_init(void) { #if defined(SPL_GPIO_SUPPORT) struct rockchip_cru *cru = rockchip_get_cru(); @@ -274,4 +274,11 @@ void spl_board_init(void) debug("%s: Cannot enable boot on regulator\n", __func__); #endif } + +void spl_board_init(void) +{ + /* board specific spl init */ + rk_spl_board_init(); +} + #endif From patchwork Mon Jun 8 18:31:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11593819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 137E790 for ; Mon, 8 Jun 2020 18:32:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4325206D5 for ; Mon, 8 Jun 2020 18:32:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jMb4Rpym"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="o4vOcHSl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4325206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=57rz4QwljcCON8wNHHKITgWfe9kFFUf7q8v8MqiaZw8=; b=jMb4Rpym7lT5Yu VWw4fYGTvf+1dO6/CmkVIRCtHYOHTZDkqdkdgDuqQBFyclYNA1UN8aoNZ+US+ok2XbAUMdXA7LbWF HGosTJRzjXvcF2m3JwyExSl1ebyppUmtSI6RYzVbbyYv728PzsZ19wiR70pud2TkTQLBXJ7CvQ7a/ wRNdN1pq+ybPzkZKCDl8xe2v7D6UUMa7KMNDRCe+/92gVybc47oGYPWx464f8RR4mPxZ81WqjBbuH QNEf9xtGjSZ5ux6vYvP7kZ0+UfoImKB1nw0kj/U3560X5gw+DWHWir5f0B08l5/8S9ebM+TBm7ddp 4CmjA5Svlg2rHGyKO79g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZ5-0003CU-Pw; Mon, 08 Jun 2020 18:32:07 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZ3-0003Aw-8c for linux-rockchip@lists.infradead.org; Mon, 08 Jun 2020 18:32:06 +0000 Received: by mail-pj1-x1044.google.com with SMTP id ne5so189109pjb.5 for ; Mon, 08 Jun 2020 11:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=whusgV3SuU4OYdnISZ0eE6+udK0GNJd8qRyaT+j/kBs=; b=o4vOcHSlGohJvcJZsnzHRbPKP7nyciDvvH7VydgtrjIIASHxjDjpDCWmH2j7VWkyzM cLp9+WZJSK2eXzZC/ciB0FJYmvZJu8nmr7uwP/JbgmnVXEiisOENPge7hiJX9HFawMdw wXfzXOF+3FzlQZOGbjbeZeTc1YqoEnXXZguyk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=whusgV3SuU4OYdnISZ0eE6+udK0GNJd8qRyaT+j/kBs=; b=NhTDgkgVqy8J0DXMSuOVIjDwZdhIiIifqK83rGIWDJnJeKYZtQBCEhyd+q1v+2cAIF Mzpsi8yHDeVlU4jO2sTdV4w3vjp3nAAjg/9V4ocyMu552uqxsCzwcvh7QORPim8W1oSJ et5rs1lOTudAEWA9Ear+FTnIVgBBicZToWTn0IBEehksR6pfSX6d3o3WO+TpbvnsqG3N XAi6yt+SkkkW8C2LE5a/R8wsoiAlPGDwb0eqzkmnhiHSLIe87oNxWWnAkm6akmwO3DAT lUK9qGxESWLxYEjcUQ6j50Ss81JJ+NGKNJBMzDD9AtEqCovqSH4Z89ltP78IqFYgN2xK u6Hw== X-Gm-Message-State: AOAM532tmS9ViE5bF3y1wV2R8pUlmTtc5hicEp5cgH+kf36OClHqzHY3 t3SYe0SQXNmE8cqFO31nTCCXSQ== X-Google-Smtp-Source: ABdhPJz3Uf3oNHvSfG8gGMGJlnb3J6nbhjLmIQw3YuaF9MqH/XeL08lK3vefRaK8yOlV+gJUP0lgtg== X-Received: by 2002:a17:90b:110f:: with SMTP id gi15mr622869pjb.87.1591641124486; Mon, 08 Jun 2020 11:32:04 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:32:03 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Subject: [PATCH v3 2/5] rk3399: spl: Print SPL banner after relocation Date: Mon, 8 Jun 2020 14:31:41 -0400 Message-Id: <20200608183144.26809-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_113205_318354_6BB4FD4B X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Usually printing the SPL banner varies between architecture or board codes. - Some would print before relocation at the end board_init_f   for making sure all initialization prior to this would happen   properly. if at all there is a requirement for serial init,   that happens properly since it prints all after that. - Some would print after relocation at the spl_board_init for   making sure all initialization prior to relocation would happen properly. Also debug uart on these cases would be available before relocation. So debug support is available in before and after relocation. Rockchip SPL is following formar step to print the banner at the end of board_init_f. To support various custom use cases in SPL like leds, environment, board detections later options like printing the banner after relocation would be a better option. Printing banner would also help to support debugging availability between relocation codes, like debug uart available before relocation and banner availability after relation. By demonstrating all the above use cases, this patch is trying to print the SPL banner after relocation. Signed-off-by: Jagan Teki Tested-by: Suniel Mahesh --- Changes for v3: - new patch arch/arm/mach-rockchip/rk3399/rk3399.c | 2 ++ arch/arm/mach-rockchip/spl.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index 681f80f339..af4b0e271b 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -279,6 +279,8 @@ void spl_board_init(void) { /* board specific spl init */ rk_spl_board_init(); + + preloader_console_init(); } #endif diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c index cddf4fd3d5..1c2dca8a72 100644 --- a/arch/arm/mach-rockchip/spl.c +++ b/arch/arm/mach-rockchip/spl.c @@ -147,7 +147,6 @@ void board_init_f(ulong dummy) gd->ram_top = gd->ram_base + get_effective_memsize(); gd->ram_top = board_get_usable_ram_top(gd->ram_size); #endif - preloader_console_init(); } #ifdef CONFIG_SPL_LOAD_FIT From patchwork Mon Jun 8 18:31:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11593821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A72190 for ; Mon, 8 Jun 2020 18:32:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB3F7206D5 for ; Mon, 8 Jun 2020 18:32:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oPy3oPs0"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="XzaGTtGK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB3F7206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8ZVM2QZnmQEoxTLQrDCvrobWZCyZSqph+q90OXiRhns=; b=oPy3oPs0qp2h/A 7Eu/PbfQe1fPv91MVK/f48Xc5MR8kXLR/rxwzAP+B7FPJ5D1Kxmi9LnCrju+HSKgUWUHlg15b5sSX kSRqhvJQit9TK/yxh1FWFhvNabLACKOI7dH58lzmZ/2mnw34BerZ1QnJzLWYLJiUT4aHQiXQn7DWR 0kLCQZpgHXN0bDBaUd5RjpH3Zi3414em+Scq21tbDRQ7xZMeU39Xg/ntk/e+OyiY+63vvNi+okYAC +3UlNaUd2Ze1onNdlpC4t9tR4P9op+hmQ7eWcywjkfysX1uNIcCe9MVBbEQMlIvxZdg4k9sUr6fTP uz0RBustONtUUaNcotLQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZA-0003Ft-LD; Mon, 08 Jun 2020 18:32:12 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZ8-0003ER-8q for linux-rockchip@lists.infradead.org; Mon, 08 Jun 2020 18:32:11 +0000 Received: by mail-pl1-x641.google.com with SMTP id g12so6983529pll.10 for ; Mon, 08 Jun 2020 11:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TaT1kiJbKgOZ27aOPi7fOvnt0RXKINFMOW4k3Bf6P3c=; b=XzaGTtGKePyzKqat2cTy/apZbBTB/QwTdb6ag2d1Rai7X9KD/gNOQ36G3YA3c3XfHd LHhR+nzH3fL14QGh51woPOCnWdNqiaIXHUrhaT3AFc/eqga3Gu9y58UpjIaIPhgjCPiH 6aORK+O7ID/CGLRu1InqHubgGJ4HUg8EAuyfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TaT1kiJbKgOZ27aOPi7fOvnt0RXKINFMOW4k3Bf6P3c=; b=M7lTOzvi9SBZyUNp30ASgqLBw9cs90pUEJ9ZUof4558fV8FkJ6rHRu2EYRQ/bhQ6rp xip0DkZtDQjSpqxvVK7K6N2IBZ6ggBVSM+vE86FltMc0tvewmMtKykYd92IoyZC16LMJ Z6+YQvsiQrlNBTHJvHLAAgCnMPvo3qXAMwGMAKKYsCJZ4kwoBxfnLJ9Jkhv0UBg8nUo5 xIRv2HhHikbw5TCeFrijvQqgvSKy8rfiOa+ooSa69GcEV6YozT/UVojiaj42QU7JxR5j 9lXTM8DNOrL4ebAMKYA3pjT7+hslBwXfRRWvriM9LYbWyCg4Vh6ud4guBoL8Fmq4A6QA F8uQ== X-Gm-Message-State: AOAM533wSKYEkjyxmxDJ6/tCxJBBuobiVfrcImVhP54I0WP17uaG0sw5 gADqkTJbkuJL4zLj71lwWh739X5pdLMNZA== X-Google-Smtp-Source: ABdhPJzoqmv6x/OSjNdSxzzsvcsESyYx2xSQm49xGsgd6Uj+kmJBY0WHl3X33ZU7ECCkAblpzh/QmA== X-Received: by 2002:a17:902:fe01:: with SMTP id g1mr127225plj.254.1591641129758; Mon, 08 Jun 2020 11:32:09 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:32:09 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Subject: [PATCH v3 3/5] roc-rk3399-pc: Move leds setup in SPL Date: Mon, 8 Jun 2020 14:31:42 -0400 Message-Id: <20200608183144.26809-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_113210_310364_9CBF41D8 X-CRM114-Status: GOOD ( 14.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org roc-rk3399-pc has some specific requirements to support LEDS, environment. board detection and etc prior to U-Boot proper. So as of now SPL would be a better stage for these custom board requirements to support unlike TPL. Adding few of these custom requirements like LEDS in TPL would require extra code pulling and also the size of TPL can grow. So, this patch moves the leds code from TPL into SPL after relocation. Signed-off-by: Jagan Teki Tested-by: Suniel Mahesh --- Changes for v3: - new patch arch/arm/mach-rockchip/tpl.c | 7 ------- board/firefly/roc-pc-rk3399/Makefile | 4 ++++ board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 21 ------------------- board/firefly/roc-pc-rk3399/spl.c | 23 +++++++++++++++++++++ configs/roc-pc-mezzanine-rk3399_defconfig | 2 +- configs/roc-pc-rk3399_defconfig | 2 +- 6 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 board/firefly/roc-pc-rk3399/spl.c diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c index 88f80b05a9..cc908e1b0e 100644 --- a/arch/arm/mach-rockchip/tpl.c +++ b/arch/arm/mach-rockchip/tpl.c @@ -43,18 +43,11 @@ __weak void rockchip_stimer_init(void) TIMER_CONTROL_REG); } -__weak int board_early_init_f(void) -{ - return 0; -} - void board_init_f(ulong dummy) { struct udevice *dev; int ret; - board_early_init_f(); - #if defined(CONFIG_DEBUG_UART) && defined(CONFIG_TPL_SERIAL_SUPPORT) /* * Debug UART can be used from here if required: diff --git a/board/firefly/roc-pc-rk3399/Makefile b/board/firefly/roc-pc-rk3399/Makefile index 29c79b25d7..3a9c4c744d 100644 --- a/board/firefly/roc-pc-rk3399/Makefile +++ b/board/firefly/roc-pc-rk3399/Makefile @@ -4,4 +4,8 @@ # SPDX-License-Identifier: GPL-2.0+ # +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +else obj-y += roc-pc-rk3399.o +endif diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c index 7c3a803654..581cdcd3b0 100644 --- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c @@ -6,13 +6,8 @@ #include #include #include -#include #include -#include -#include -#include -#ifndef CONFIG_SPL_BUILD int board_early_init_f(void) { struct udevice *regulator; @@ -30,19 +25,3 @@ int board_early_init_f(void) out: return 0; } -#endif - -#if defined(CONFIG_TPL_BUILD) - -#define GPIO0_BASE 0xff720000 - -int board_early_init_f(void) -{ - struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE; - - /* Turn on red LED, indicating full power mode */ - spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); - - return 0; -} -#endif diff --git a/board/firefly/roc-pc-rk3399/spl.c b/board/firefly/roc-pc-rk3399/spl.c new file mode 100644 index 0000000000..a7664c6b86 --- /dev/null +++ b/board/firefly/roc-pc-rk3399/spl.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Amarula Solutions(India) + */ + +#include +#include +#include + +#define GPIO0_BASE 0xff720000 + +static void led_setup(void) +{ + struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE; + + /* Turn on red LED, indicating full power mode */ + spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); +} + +void rk_spl_board_init(void) +{ + led_setup(); +} diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig index 03ba519af1..8ad74dc408 100644 --- a/configs/roc-pc-mezzanine-rk3399_defconfig +++ b/configs/roc-pc-mezzanine-rk3399_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y CONFIG_SYS_TEXT_BASE=0x00200000 +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_ENV_SIZE=0x8000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_ENV_SECT_SIZE=0x1000 @@ -19,7 +20,6 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y CONFIG_TPL=y -CONFIG_TPL_GPIO_SUPPORT=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig index b59b54bd89..6fd06d6381 100644 --- a/configs/roc-pc-rk3399_defconfig +++ b/configs/roc-pc-rk3399_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y CONFIG_SYS_TEXT_BASE=0x00200000 +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_ENV_SIZE=0x8000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_ENV_SECT_SIZE=0x1000 @@ -19,7 +20,6 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y CONFIG_TPL=y -CONFIG_TPL_GPIO_SUPPORT=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y From patchwork Mon Jun 8 18:31:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11593823 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 987A41392 for ; Mon, 8 Jun 2020 18:32:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73867206D5 for ; Mon, 8 Jun 2020 18:32:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dkS27jRk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="oN/BomlY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73867206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q5xZThzXi/EC/dQdhDLRX/6kAa0HridVrgdfx1g33rc=; b=dkS27jRksfd9Uk PxWmvCdgyPtE+GJvLZdGwcBcrk7gMrThwkmxICJvxmBoqVdx8sjPMbuDJ+TOp2sHQwOK/rcBBZ2PG XU/2fPbQlIjtQ5uLbmYcgTG2DEeVVolmkIbzefmZT/6OgErQk6Fzq1g83+dX5Sbu7gb0qaevuBLBx 9HwS9Wi6og3CiUvR8N0ioiulcinU/T5YDn/eV2YMkt/3+ukvnf8Y8YByW/0aN3p36zGm+malzjAxv 0j7oTi1hizzj9F8eKYLkZDu4ki+fiVc6KGnFJFOexYap73iQryZrUn6yurxVrEvqgt826YJna3e/C Xk/noQ/g6dlh3QJ41+Xg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZG-0003Ir-92; Mon, 08 Jun 2020 18:32:18 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZD-0003Hr-RA for linux-rockchip@lists.infradead.org; Mon, 08 Jun 2020 18:32:17 +0000 Received: by mail-pl1-x643.google.com with SMTP id bh7so6976977plb.11 for ; Mon, 08 Jun 2020 11:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rqJBGafkC3epYtnj6Q8KpKJpJibk/KrCcH9/odNpSyA=; b=oN/BomlYfcDtDxOF0wUZ+sk4WvHFL/OdC+qPoPvj4+z2+oirX70wa8LA1aa3t+x/yL Ljt9XVP+KqJB7cufzOIztnqGsh+WQB5myheXJ8/EmS6ft9Tm6kwpd7y7PZq8uaU3lHlS imqa2Zo/m37HmQKQzqRejbXuQWwm7E+kZuK2s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rqJBGafkC3epYtnj6Q8KpKJpJibk/KrCcH9/odNpSyA=; b=gE5/t1ubYvaW/ZyovCwj0+LI50MN3ysWiP0z/eK3ZGGVduSVlasmjJkdayEuaZO/S9 eeWqCcOJAPkCBgYzju4oKrBpZWbUAbHSOZNu4RH26ogKiY31T0mhlej9BpeMz0kOkcec V9gP1Z0dpTuuDoy9FUwzbZFps1a9xij5QTL+dZiMErczpm4E4A7dR1biJgtW9o1DFhUl ci4bSzVAGoxYbO2TsV8O6z9NQdauzQqSkCcvQ/exidYOvqjb+6FSW5uWtFQXz6+40s81 GyB6ymuMMy2f/gCELdd+RanO2FXpAi9GDJrfU0Q4Zc7s/SsmY+595sfZXNBoHsytgBI2 u4zQ== X-Gm-Message-State: AOAM530mUfI/DD4o1LY83xld6G0nknUGpulT4o7uYEaWTv+fw90henfS opaOXu1jpHaRUJJeQhTM1af6vg== X-Google-Smtp-Source: ABdhPJzGLsyzPpG3iSjsipQMmGo6KGp7KLI5hpLIdL6T8p5qWcQfbYYsn55BRpzolfFCN4VJzmDmsw== X-Received: by 2002:a17:902:7297:: with SMTP id d23mr125758pll.282.1591641134981; Mon, 08 Jun 2020 11:32:14 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:32:14 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Subject: [PATCH v3 4/5] rockchip: Separate the reset cause from display cpuinfo Date: Mon, 8 Jun 2020 14:31:43 -0400 Message-Id: <20200608183144.26809-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_113215_880814_05E00190 X-CRM114-Status: GOOD ( 14.49 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org reset cause is a generic functionality based on the soc cru registers in rockchip. This can be used for printing the cause of reset in cpuinfo or some other place where reset cause is needed.  Other than cpuinfo, reset cause can also be using during bootcount for checking the specific reset cause and glow the led based on the reset cause. So, let's separate the reset cause code from cpuinfo, and add a check to build it for rk3399, rk3288 since these two soc are supporting reset cause as of now. Signed-off-by: Jagan Teki Tested-by: Suniel Mahesh --- Changes for v3: - none arch/arm/include/asm/arch-rockchip/cru.h | 2 ++ arch/arm/mach-rockchip/Makefile | 5 ++++- arch/arm/mach-rockchip/cpu-info.c | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/cru.h b/arch/arm/include/asm/arch-rockchip/cru.h index 5eb17f9d55..317eb61049 100644 --- a/arch/arm/include/asm/arch-rockchip/cru.h +++ b/arch/arm/include/asm/arch-rockchip/cru.h @@ -31,4 +31,6 @@ enum { #define MHz 1000000 +char *get_reset_cause(void); + #endif /* _ROCKCHIP_CLOCK_H */ diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 5b38526fe0..ef4898e00c 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -15,6 +15,10 @@ obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +ifeq ($(CONFIG_ROCKCHIP_RK3288)$(CONFIG_ROCKCHIP_RK3399), y) +obj-y += cpu-info.o +endif + ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # Always include boot_mode.o, as we bypass it (i.e. turn it off) @@ -22,7 +26,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # we can have the preprocessor correctly recognise both 0x0 and 0 # meaning "turn it off". obj-y += boot_mode.o -obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o obj-$(CONFIG_MISC_INIT_R) += misc.o endif diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c index 21ca9dedce..76a840e2c3 100644 --- a/arch/arm/mach-rockchip/cpu-info.c +++ b/arch/arm/mach-rockchip/cpu-info.c @@ -13,7 +13,7 @@ #include #include -static char *get_reset_cause(void) +char *get_reset_cause(void) { struct rockchip_cru *cru = rockchip_get_cru(); char *cause = NULL; @@ -41,12 +41,6 @@ static char *get_reset_cause(void) cause = "unknown reset"; } - /** - * reset_reason env is used by rk3288, due to special use case - * to figure it the boot behavior. so keep this as it is. - */ - env_set("reset_reason", cause); - /* * Clear glb_rst_st, so we can determine the last reset cause * for following resets. @@ -56,12 +50,22 @@ static char *get_reset_cause(void) return cause; } +#ifdef CONFIG_DISPLAY_CPUINFO int print_cpuinfo(void) { + char *cause = get_reset_cause(); + printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC); - printf("Reset cause: %s\n", get_reset_cause()); + printf("Reset cause: %s\n", cause); + + /** + * reset_reason env is used by rk3288, due to special use case + * to figure it the boot behavior. so keep this as it is. + */ + env_set("reset_reason", cause); /* TODO print operating temparature and clock */ return 0; } +#endif From patchwork Mon Jun 8 18:31:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11593825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BB6B90 for ; Mon, 8 Jun 2020 18:32:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 47276206D5 for ; Mon, 8 Jun 2020 18:32:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m4uyXUxe"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="VoxPyd/q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47276206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MTr0m1rOsqA8lDLFI7ekyht49smnMLRMwiXZnzwKN1A=; b=m4uyXUxewdXgwV QQu9KTCTt2JIeLl97096gHVLOhTSZZaFfVYK6w+ZEiS2Mb4izzAGwx9Rvud79Jv1hbygEJRTDxP2X hfe/W47N5FbM3fF+DWe7NoDiyqbcMqoLR8wRnGTT95kWFLVpP30ST0FGJiZxHFXJjFcPmkQDGozws Sobjs0aYLZ7flBocsnC3k9v5W7KO0CsJv/S7VAQfnQFbDkDSUflUsh59h8+TzILaNdPU3DeoO29Ju b/1O8KVhjDgeL3/8/Eby7o0HN4oWSgBy6hG/UaGLOZEbPk56v0PLd9G3vYG+TD8mgt0P12JHKhWmu ttWwSrne0FQDALRVEWVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZK-0003M0-UT; Mon, 08 Jun 2020 18:32:22 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiMZI-0003L5-TE for linux-rockchip@lists.infradead.org; Mon, 08 Jun 2020 18:32:22 +0000 Received: by mail-pj1-x1041.google.com with SMTP id h95so191377pje.4 for ; Mon, 08 Jun 2020 11:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lj7UGgufzUrli12AvwkCo5i8blVe87esYrdniDn/yFw=; b=VoxPyd/qf/mZWC0YEfWVnlHPTc9U9skg3sJpVZSdrRqDYKoj6KAio8bNrYjRScgk54 yrKw/8DcyPJCfg11V0S1xxIyHTkoo7ElIJae/Xu2pLUpTqkTPQo68OkPAlIuPOXbg4JI dnb9Mdisr3bBB8CtpbDr9yjnThONNHPtoU+vI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lj7UGgufzUrli12AvwkCo5i8blVe87esYrdniDn/yFw=; b=Iwj15pDWpH7grBKqOYesBOdWua1IiMX1DpvhwziEh28RmQlwu941DXO1G66KpKEcEe 0P48zxr6qdPvRHGsE5Kx1S17CZJr5ZJ+ZsiMz5atziCWa6v+vKpFxJp7O2+7HHchMhTz U7uv6Ym7/kCLUuOJinKzF2ttJwsuwlLqK+JHifCJdrDWLgL9Ys1WUbSYKAVEiD+r/1N6 +TTTdeFD49NtpxTvkM6xK0OpCbM1pM55mY8crpTUrsSg2I21P7WMNLsir9g1mImQoDSS hEqnasvXffHqo9ahNCUdqRwWFj1kEXflhMxjNOaYJYso6YcyIsJbHXPnZ3Kx5g8zatTg 1JgQ== X-Gm-Message-State: AOAM530qte3PBm52b5YNp3CNPFMg3sZXsCcWucrLJJacctVh6igHoYU0 SIeNyUZ4p7Dk00XRu0aC3IYBXg== X-Google-Smtp-Source: ABdhPJypCmSzNW5Io35Hs/Bp7sb3cEuXeVxVaiePkK1EZpexT0GXnzz9Ukqm+xmzYiIKJ6AyHHRBag== X-Received: by 2002:a17:902:bcc9:: with SMTP id o9mr94687pls.335.1591641140373; Mon, 08 Jun 2020 11:32:20 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:32:19 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Subject: [PATCH v3 5/5] roc-rk3399-pc: Set LED only during POR and pwr_key=y Date: Mon, 8 Jun 2020 14:31:44 -0400 Message-Id: <20200608183144.26809-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_113220_943630_71AE8415 X-CRM114-Status: GOOD ( 13.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1041 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org ROC-RK3399-PC has specific set of configurations for on-board led setup. Due to easiness for user to know the state of the board roc-rk339-pc board code will setup the low power led on/off, and waiting for user to press power key and then glow full power led. All this needs to happen only during power-on-reset not for soft reset or WDT. Also, it is not a proper usage to ask the user to press the Power key if the board connected remotely, so add the environment variable 'pwr_key' to check as well. So, user need to press Power key only - during POR - pwr_key=y Tested-by: Suniel Mahesh Signed-off-by: Jagan Teki --- Changes for v3: - new patch board/firefly/roc-pc-rk3399/spl.c | 35 ++++++++++++++++++++++- configs/roc-pc-mezzanine-rk3399_defconfig | 4 ++- configs/roc-pc-rk3399_defconfig | 4 ++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/board/firefly/roc-pc-rk3399/spl.c b/board/firefly/roc-pc-rk3399/spl.c index a7664c6b86..771a7fb2f2 100644 --- a/board/firefly/roc-pc-rk3399/spl.c +++ b/board/firefly/roc-pc-rk3399/spl.c @@ -4,16 +4,49 @@ */ #include +#include #include +#include +#include #include +#include +#define PMUGRF_BASE 0xff320000 #define GPIO0_BASE 0xff720000 +/** + * LED setup for roc-rk3399-pc + * + * 1. Set the low power leds (only during POR, pwr_key env is 'y') + * glow yellow LED, termed as low power + * poll for on board power key press + * once powe key pressed, turn off yellow + * 2. Turn on red LED, indicating full power mode + */ static void led_setup(void) { struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE; + struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE; + bool press_pwr_key = false; + + if (IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)) { + env_init(); + env_load(); + if (env_get_yesno("pwr_key") == 1) + press_pwr_key = true; + } + + if (press_pwr_key && !strcmp(get_reset_cause(), "POR")) { + spl_gpio_output(gpio0, GPIO(BANK_A, 2), 1); + + spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_A, 5), + GPIO_PULL_NORMAL); + while (readl(&gpio0->ext_port) & 0x20) + ; + + spl_gpio_output(gpio0, GPIO(BANK_A, 2), 0); + } - /* Turn on red LED, indicating full power mode */ spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); } diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig index 8ad74dc408..d3369063ea 100644 --- a/configs/roc-pc-mezzanine-rk3399_defconfig +++ b/configs/roc-pc-mezzanine-rk3399_defconfig @@ -17,7 +17,8 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_STACK_R=y -CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x20000 +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y @@ -32,6 +33,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-roc-pc-mezzanine" CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig index 6fd06d6381..0650b941c2 100644 --- a/configs/roc-pc-rk3399_defconfig +++ b/configs/roc-pc-rk3399_defconfig @@ -17,7 +17,8 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_STACK_R=y -CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x20000 +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_TPL=y CONFIG_CMD_BOOTZ=y @@ -31,6 +32,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-roc-pc" CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y