From patchwork Thu Aug 15 20:55:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1147839 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="aOIND+kv"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 468f2n730Fz9s00 for ; Fri, 16 Aug 2019 06:59:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9C07BC21C27; Thu, 15 Aug 2019 20:57:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4A340C21DA6; Thu, 15 Aug 2019 20:56:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 25259C21C2C; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 475FAC21C2C for ; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuQdJ110278; Thu, 15 Aug 2019 15:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565902586; bh=7GFSA0dKHfskAZl+bhJDQdMzvMYxBslk7CI6d7vbkKI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aOIND+kvQRIpPDmRzFOuyaYHNuY2DklvhkZOjU9A7aEtng1FguvZ/wue5LuRm+Fqm EYUO990ovgJtRSgE1Dvo/R2IyNfwBKz1fKKXimpWYONEZ9kfiz+FwBYfZpWZwuNtJP 2rCiwGwYEBnYRlWq1AgA3Ml3BpmWnxbXYj9ue24U= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7FKuQjl124174 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Aug 2019 15:56:26 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 15 Aug 2019 15:56:25 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 15 Aug 2019 15:56:25 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuPeD089038; Thu, 15 Aug 2019 15:56:25 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Thu, 15 Aug 2019 15:55:26 -0500 Message-ID: <20190815205532.16545-2-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815205532.16545-1-dannenberg@ti.com> References: <20190815205532.16545-1-dannenberg@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH 1/7] spl: ymodem: Fix FIT loading termination handling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" During FIT reading through ymodem_read_fit() the function xyzModem_stream_read() is being used which returns zero once the end of a stream has been reached. This could lead to an premature exit from ymodem_read_fit() with certain-sized FIT images reporting that zero bytes overall were read. Such a premature exit would then result in an -EIO failure being triggered within the spl_load_simple_fit() caller function and ultimately lead to a boot failure. Fix this logic by simply aborting the stream read loops and continuing with the regular code flow which ultimately would lead to returning the number of bytes to be read ('size') as expected by the callers of ymodem_read_fit(). Fixes: fa715193c083 ("spl: Add an option to load a FIT containing U-Boot from UART") Signed-off-by: Andreas Dannenberg --- common/spl/spl_ymodem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 20f4260062..8ad580d8ae 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -44,7 +44,8 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset, while (info->image_read < offset) { res = xyzModem_stream_read(buf, BUF_SIZE, &err); if (res <= 0) - return res; + break; + info->image_read += res; } @@ -57,7 +58,7 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset, while (info->image_read < offset + size) { res = xyzModem_stream_read(buf, BUF_SIZE, &err); if (res <= 0) - return res; + break; memcpy(addr, buf, res); info->image_read += res; From patchwork Thu Aug 15 20:55:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1147834 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="EJd69dPU"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 468dzz2lQZz9s00 for ; Fri, 16 Aug 2019 06:57:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 679DDC21C2F; Thu, 15 Aug 2019 20:56:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B055CC21C27; Thu, 15 Aug 2019 20:56:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CB0F1C21C50; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 40147C21BE5 for ; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuQn3110282; Thu, 15 Aug 2019 15:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565902586; bh=jcRExqnicMba6R8QqlgIVY5SVATYYPWpsjS2ClfJU4A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EJd69dPUg9AsY2cP3u5g7DqNv127xraY969hq48A4Yx4vtSVrJ6OVA1fsLTlNMlKs YGkgYR/pXl02C0d91p3QS3Uj1lZbLxRB8WGOryWe2tnAelQJljoakdTtmTFtYxlgsl hJQyensWUVVl6sl5N8FACkDOMnWDeX5a2KKUdxqM= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7FKuQiU124175 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Aug 2019 15:56:26 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 15 Aug 2019 15:56:25 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 15 Aug 2019 15:56:25 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuPeE089038; Thu, 15 Aug 2019 15:56:25 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Thu, 15 Aug 2019 15:55:27 -0500 Message-ID: <20190815205532.16545-3-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815205532.16545-1-dannenberg@ti.com> References: <20190815205532.16545-1-dannenberg@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH 2/7] spl: ymodem: Make SPL Y-Modem loader framework accessible X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Expose SPL's Y-Modem core loader function via the common SPL header file so it can be re-used for purposes other than loading U-Boot itself. Signed-off-by: Andreas Dannenberg --- common/spl/spl_ymodem.c | 4 ++-- include/spl.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 8ad580d8ae..c02c05624d 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -68,8 +68,8 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset, return size; } -static int spl_ymodem_load_image(struct spl_image_info *spl_image, - struct spl_boot_device *bootdev) +int spl_ymodem_load_image(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev) { ulong size = 0; int err; diff --git a/include/spl.h b/include/spl.h index a90f971a23..a2c6278c00 100644 --- a/include/spl.h +++ b/include/spl.h @@ -356,6 +356,9 @@ int spl_mmc_load(struct spl_image_info *spl_image, int raw_part, unsigned long raw_sect); +int spl_ymodem_load_image(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev); + /** * spl_invoke_atf - boot using an ARM trusted firmware image */ From patchwork Thu Aug 15 20:55:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1147840 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="LpdKyAa6"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 468f2p1Dcjz9sML for ; Fri, 16 Aug 2019 06:59:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E41A7C21DA1; Thu, 15 Aug 2019 20:57:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7F963C21DAF; Thu, 15 Aug 2019 20:56:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 16595C21C29; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 49727C21C2F for ; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuQpJ110284; Thu, 15 Aug 2019 15:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565902586; bh=6uSX6FHbGknCXtH271xFWIBq0dDI/JftuJUyx+zy00s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LpdKyAa6iRx45rRvtpa2BT/Zn953aTiBcaQZyo5HI/IYZsH2Dbg0bGBzZttdntZo1 nx6VxYbf3m09fSV4QWEIZu8IgdnuHCt9G+GSASQmttjpxIF1mYLf3qAbCg2tgdOGVd 1yPI4B+VvCwlPPHnm4UmYICnuECsewyFHE7b09LI= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7FKuQdc107868 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Aug 2019 15:56:26 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 15 Aug 2019 15:56:25 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 15 Aug 2019 15:56:25 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuPeF089038; Thu, 15 Aug 2019 15:56:25 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Thu, 15 Aug 2019 15:55:28 -0500 Message-ID: <20190815205532.16545-4-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815205532.16545-1-dannenberg@ti.com> References: <20190815205532.16545-1-dannenberg@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH 3/7] arm: K3: common: Allow for early console functionality X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Implement an early console functionality in SPL that can be used before the main console is being brought up. This helps in situations where the main console is dependent on System Firmware (SYSFW) being up and running, which is usually not the case during the very early stages of boot. Using this early console functionality will allow for an alternate serial port to be used to support things like UART-based boot and early diagnostic messages until the main console is ready to get activated. Signed-off-by: Andreas Dannenberg --- arch/arm/mach-k3/Kconfig | 21 +++++++++++++++++++++ arch/arm/mach-k3/common.c | 26 ++++++++++++++++++++++++++ arch/arm/mach-k3/common.h | 1 + 3 files changed, 48 insertions(+) diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index 9652c96a78..a878277e39 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -66,6 +66,27 @@ config SYS_K3_BOOT_CORE_ID int default 16 +config K3_EARLY_CONS + bool "Activate to allow for an early console during SPL" + depends on SPL + help + Turn this option on to enable an early console functionality in SPL + before the main console is being brought up. This can be useful in + situations where the main console is dependent on System Firmware + (SYSFW) being up and running, which is usually not the case during + the very early stages of boot. Using this early console functionality + will allow for an alternate serial port to be used to support things + like UART-based boot and early diagnostic messages until the main + console is ready to get activated. + +config K3_EARLY_CONS_IDX + depends on K3_EARLY_CONS + int "Index of serial device to use for SPL early console" + default 1 + help + Use this option to set the index of the serial device to be used + for the early console during SPL execution. + config K3_LOAD_SYSFW bool depends on SPL diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index bab5ffdf40..279bd96467 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -27,6 +27,32 @@ struct ti_sci_handle *get_ti_sci_handle(void) return (struct ti_sci_handle *)ti_sci_get_handle_from_sysfw(dev); } +DECLARE_GLOBAL_DATA_PTR; + +#ifdef CONFIG_K3_EARLY_CONS +int early_console_init(void) +{ + struct udevice *dev; + int ret; + + gd->baudrate = CONFIG_BAUDRATE; + + ret = uclass_get_device_by_seq(UCLASS_SERIAL, CONFIG_K3_EARLY_CONS_IDX, + &dev); + if (ret) { + printf("Error getting serial dev for early console! (%d)\n", + ret); + return ret; + } + + gd->cur_serial_dev = dev; + gd->flags |= GD_FLG_SERIAL_READY; + gd->have_console = 1; + + return 0; +} +#endif + #ifdef CONFIG_SYS_K3_SPL_ATF void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h index ac7e80d9af..ab68e14de8 100644 --- a/arch/arm/mach-k3/common.h +++ b/arch/arm/mach-k3/common.h @@ -9,3 +9,4 @@ #include void setup_k3_mpu_regions(void); +int early_console_init(void); From patchwork Thu Aug 15 20:55:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1147841 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="SE1E+9Nq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 468f3n48cZz9sML for ; Fri, 16 Aug 2019 07:00:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 45DC0C21DDC; Thu, 15 Aug 2019 20:57:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id DF6DAC21C2C; Thu, 15 Aug 2019 20:56:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3528FC21BE5; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 4557CC21C29 for ; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuQse110294; Thu, 15 Aug 2019 15:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565902586; bh=HrIjxlz4LLKdYk/Ik3Ul2NcPzPdsbY/TPzLq33GPo+Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SE1E+9NqZifCqZeP6Q9y2H4Ya0tGh32z9IpwmNqLRZiEbsq0F4jex/YclfCyWbVk9 bZmtPn2KHeoCWUe6F4tUmDu6Hz+7/H/ZkH2ihSn5anZAOAT6lq4EzRGPT65+5b8p1i h+nQdtt+RH8z2wfsKPkFKXv26IMi9z9rh3BwnuD8= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7FKuQUg094840 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Aug 2019 15:56:26 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 15 Aug 2019 15:56:26 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 15 Aug 2019 15:56:25 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuPeG089038; Thu, 15 Aug 2019 15:56:25 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Thu, 15 Aug 2019 15:55:29 -0500 Message-ID: <20190815205532.16545-5-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815205532.16545-1-dannenberg@ti.com> References: <20190815205532.16545-1-dannenberg@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH 4/7] arm: K3: sysfw-loader: Allow loading SYSFW via Y-Modem X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" In order to allow booting TI K3 family SoCs via Y-Modem add support for loading System Firmware by tapping into the associated SPL core loader function. In this context also make sure a console is available and if not go ahead and activate the early console feature which allows bringing up an alternate full console before the main console is activated. Such an alternate console is typically setup in a way that the associated UART can be fully initialized prior to SYSFW services being available. Signed-off-by: Andreas Dannenberg --- arch/arm/mach-k3/sysfw-loader.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c index 7a482bdc8a..5903bbe12a 100644 --- a/arch/arm/mach-k3/sysfw-loader.c +++ b/arch/arm/mach-k3/sysfw-loader.c @@ -12,6 +12,9 @@ #include #include #include +#include "common.h" + +DECLARE_GLOBAL_DATA_PTR; /* Name of the FIT image nodes for SYSFW and its config data */ #define SYSFW_FIRMWARE "sysfw.bin" @@ -214,6 +217,24 @@ void k3_sysfw_loader(void (*config_pm_done_callback)(void)) 0); #endif break; +#endif +#if CONFIG_IS_ENABLED(YMODEM_SUPPORT) + case BOOT_DEVICE_UART: +#ifdef CONFIG_K3_EARLY_CONS + /* + * Establish a serial console if not yet available as required + * for UART-based boot. For this use the early console feature + * that allows setting up a UART for use before SYSFW has been + * brought up. Note that the associated UART module's clocks + * must have gotten enabled by the ROM bootcode which will be + * the case when continuing to boot serially from the same + * UART that the ROM loaded the initial bootloader from. + */ + if (!gd->have_console) + early_console_init(); +#endif + ret = spl_ymodem_load_image(&spl_image, &bootdev); + break; #endif default: panic("Loading SYSFW image from device %u not supported!\n", From patchwork Thu Aug 15 20:55:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1147837 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="dLSZCQQ0"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 468f1n1bqYz9sML for ; Fri, 16 Aug 2019 06:58:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DCC8AC21D72; Thu, 15 Aug 2019 20:57:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 86F86C21DB3; Thu, 15 Aug 2019 20:56:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 43959C21C27; Thu, 15 Aug 2019 20:56:29 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id A0013C21C4A for ; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuQRi033873; Thu, 15 Aug 2019 15:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565902586; bh=RcpJfE/NnRjcZCymmpgAdAVu0xn0ICm8EHyqHZW2Eqs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dLSZCQQ0bCsk7Zy8aHP7unbqiL1lLXK4GduvamA8EFn0n8uBPeRBo5kHfN8uWFrDr mRdKlUzN+1XFv7kerh33CHyKvBw3VY+TKojd2GUIVSbNXfUFIRgvUuLloZmsUKBMkD c6fPvQjIZa4o+b2g3yET1jW9rn5tGDR8JSH9wjvQ= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7FKuQdM113710 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Aug 2019 15:56:26 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 15 Aug 2019 15:56:26 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 15 Aug 2019 15:56:26 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuPeH089038; Thu, 15 Aug 2019 15:56:26 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Thu, 15 Aug 2019 15:55:30 -0500 Message-ID: <20190815205532.16545-6-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815205532.16545-1-dannenberg@ti.com> References: <20190815205532.16545-1-dannenberg@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH 5/7] armv7R: dts: k3: am654: Add MCU_UART0 related definitions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Although we currently use the MAIN_UART0 for R5 SPL console output there are cases where we require access to the MCU_UART0 as well for example in case of UART-based Y-Modem boot. To support these scenarios add related DTS definitions to be able to use that UART early on. Signed-off-by: Andreas Dannenberg --- arch/arm/dts/k3-am654-r5-base-board.dts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts b/arch/arm/dts/k3-am654-r5-base-board.dts index 7ed307f0d8..e31ed4fe64 100644 --- a/arch/arm/dts/k3-am654-r5-base-board.dts +++ b/arch/arm/dts/k3-am654-r5-base-board.dts @@ -16,6 +16,7 @@ aliases { serial0 = &wkup_uart0; + serial1 = &mcu_uart0; serial2 = &main_uart0; }; @@ -118,6 +119,14 @@ status = "okay"; }; +&mcu_uart0 { + u-boot,dm-spl; + pinctrl-names = "default"; + pinctrl-0 = <&mcu_uart0_pins_default>; + clock-frequency = <48000000>; + status = "okay"; +}; + &main_uart0 { power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>; }; @@ -141,6 +150,16 @@ u-boot,dm-spl; }; + mcu_uart0_pins_default: mcu_uart0_pins_default { + pinctrl-single,pins = < + AM65X_WKUP_IOPAD(0x0044, PIN_INPUT, 4) /* (P4) MCU_OSPI1_D1.MCU_UART0_RXD */ + AM65X_WKUP_IOPAD(0x0048, PIN_OUTPUT, 4) /* (P5) MCU_OSPI1_D2.MCU_UART0_TXD */ + AM65X_WKUP_IOPAD(0x004C, PIN_INPUT, 4) /* (P1) MCU_OSPI1_D3.MCU_UART0_CTSn */ + AM65X_WKUP_IOPAD(0x0054, PIN_OUTPUT, 4) /* (N3) MCU_OSPI1_CSn1.MCU_UART0_RTSn */ + >; + u-boot,dm-spl; + }; + wkup_i2c0_pins_default: wkup-i2c0-pins-default { pinctrl-single,pins = < AM65X_WKUP_IOPAD(0x00e0, PIN_INPUT, 0) /* (AC7) WKUP_I2C0_SCL */ From patchwork Thu Aug 15 20:55:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1147836 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="KwmbtEzo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 468f0X5Gw2z9s00 for ; Fri, 16 Aug 2019 06:57:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4D2DEC21C29; Thu, 15 Aug 2019 20:56:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D7E2EC21D65; Thu, 15 Aug 2019 20:56:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0695CC21C27; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 4B8B2C21C38 for ; Thu, 15 Aug 2019 20:56:28 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuQbJ110306; Thu, 15 Aug 2019 15:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565902586; bh=oUVkoAVooJeilFnF7WCDDvK2K/IvHa2rU6yaWswRz+I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KwmbtEzo26yNj7s30GOJZ7sy1i3jAxbvgkhKJ8vBgTJqdMD7QtrImAt+B+Blt8K5I cVcD2YiClBA5Lq7xLN8BV/J/gd8qdOyQab7hWfk83Dx8k67rD2dKNdAyeLVd7wK+aX w2tLLAGQnrJCZMvlHG3uG6VNdRxt7Uphrqtw5kf0= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7FKuQwi124193 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Aug 2019 15:56:26 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 15 Aug 2019 15:56:26 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 15 Aug 2019 15:56:26 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7FKuPeJ089038; Thu, 15 Aug 2019 15:56:26 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Thu, 15 Aug 2019 15:55:32 -0500 Message-ID: <20190815205532.16545-8-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815205532.16545-1-dannenberg@ti.com> References: <20190815205532.16545-1-dannenberg@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH 7/7] board: ti: am65x: Add UART boot procedure in README X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" am65x ROM support booting over UART. And U-Boot built for am65x EVM supports UART boot as well. Add the UART boot procedure into the README also providing a corresponding example command sequence for execution on a host PC. Signed-off-by: Andreas Dannenberg --- board/ti/am65x/README | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/board/ti/am65x/README b/board/ti/am65x/README index 16384e05ea..2e3fd9c4a8 100644 --- a/board/ti/am65x/README +++ b/board/ti/am65x/README @@ -261,3 +261,35 @@ To boot kernel from eMMC, use the following commands: => setenv mmcdev 0 => setenv bootpart 0 => boot + +UART: +----- +ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based +boot process up to U-Boot (proper) prompt goes through different stages and uses +different UART peripherals as follows: + + WHO | Loading WHAT | HW Module | Protocol +----------+---------------+-------------+------------ +Boot ROM | tiboot3.bin | MCU_UART0 | X-Modem(*) +R5 SPL | sysfw.itb | MCU_UART0 | Y-Modem(*) +R5 SPL | tispl.bin | MAIN_UART0 | Y-Modem +A53 SPL | u-boot.img | MAIN_UART0 | Y-Modem + +(*) Note that in addition to X/Y-Modem related protocol timeouts the DMSC + watchdog timeout of 3min (typ.) needs to be observed until System Firmware + is fully loaded (from sysfw.itb) and started. + +Example bash script sequence for running on a Linux host PC feeding all boot +artifacts needed to the device: + +MCU_DEV=/dev/ttyUSB1 +MAIN_DEV=/dev/ttyUSB0 + +stty -F $MCU_DEV 115200 cs8 -cstopb -parenb +stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb + +sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV +sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV +sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV +sleep 1 +sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV