From patchwork Fri Aug 3 11:38:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 953210 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=none (p=none dis=none) header.from=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41hlY202scz9s0R for ; Fri, 3 Aug 2018 21:43:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A0D9FC21F53; Fri, 3 Aug 2018 11:42:29 +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=none 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 C0FCDC21F03; Fri, 3 Aug 2018 11:42:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B57BEC21C2F; Fri, 3 Aug 2018 11:42:04 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id DCE3AC21C2F for ; Fri, 3 Aug 2018 11:42:00 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w73BdKMD024664; Fri, 3 Aug 2018 13:42:00 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2kmmk9gkjn-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 03 Aug 2018 13:42:00 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1898231; Fri, 3 Aug 2018 11:42:00 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F34B14DBB; Fri, 3 Aug 2018 11:41:59 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:41:59 +0200 Received: from localhost (10.201.23.85) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:41:59 +0200 From: Patrick Delaunay To: Date: Fri, 3 Aug 2018 13:38:42 +0200 Message-ID: <1533296325-2490-2-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> References: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-03_04:, , signatures=0 Cc: U-Boot STM32 Subject: [U-Boot] [PATCH 1/4] stm32mp1: activate serial rx buffer 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" Activate the serial rx buffer. Prepare console MUX activation with vidconsole, and avoid console performance issue (missing character for copy-paste). Signed-off-by: Patrick Delaunay --- configs/stm32mp15_basic_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index c72a440..9792e49 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -41,4 +41,5 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_REGULATOR_STM32_VREFBUF=y CONFIG_DM_REGULATOR_STPMU1=y +CONFIG_SERIAL_RX_BUFFER=y CONFIG_STM32_SERIAL=y From patchwork Fri Aug 3 11:38:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 953211 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=none (p=none dis=none) header.from=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41hlYX0psNz9s0R for ; Fri, 3 Aug 2018 21:43:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D3BA7C21F2B; Fri, 3 Aug 2018 11:42:46 +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=none 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 695DBC21F4E; Fri, 3 Aug 2018 11:42:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E8C39C21C2F; Fri, 3 Aug 2018 11:42:05 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id EC5F5C21C2F for ; Fri, 3 Aug 2018 11:42:04 +0000 (UTC) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w73Bcfq6003990; Fri, 3 Aug 2018 13:42:03 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2kmjt6h7pu-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 03 Aug 2018 13:42:03 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4C5CB3D; Fri, 3 Aug 2018 11:42:01 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 213274DBD; Fri, 3 Aug 2018 11:42:01 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:42:00 +0200 Received: from localhost (10.201.23.85) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:42:00 +0200 From: Patrick Delaunay To: Date: Fri, 3 Aug 2018 13:38:43 +0200 Message-ID: <1533296325-2490-3-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> References: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-03_04:, , signatures=0 Cc: Stefan Roese , Alexander Graf , U-Boot STM32 Subject: [U-Boot] [PATCH 2/4] serial: protect access to serial rx buffer 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" Add test to avoid access to rx buffer when this buffer is empty. In this case directly call getc() function to avoid issue when tstc() is not called. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- drivers/serial/serial-uclass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 321d23e..4121a37 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -228,6 +228,9 @@ static int _serial_getc(struct udevice *dev) struct serial_dev_priv *upriv = dev_get_uclass_priv(dev); char val; + if (upriv->rd_ptr == upriv->wr_ptr) + return __serial_getc(dev); + val = upriv->buf[upriv->rd_ptr++]; upriv->rd_ptr %= CONFIG_SERIAL_RX_BUFFER_SIZE; From patchwork Fri Aug 3 11:38:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 953214 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=none (p=none dis=none) header.from=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41hlZq5PgNz9s0R for ; Fri, 3 Aug 2018 21:44:51 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 74373C21F6E; Fri, 3 Aug 2018 11:43:19 +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=none 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 32DC0C220D0; Fri, 3 Aug 2018 11:42:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 662BDC2209D; Fri, 3 Aug 2018 11:42:11 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id E2935C21F1A for ; Fri, 3 Aug 2018 11:42:05 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w73BdLTu024669; Fri, 3 Aug 2018 13:42:05 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2kmmk9gkk2-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 03 Aug 2018 13:42:05 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E3B5A34; Fri, 3 Aug 2018 11:42:02 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4B7F34DC0; Fri, 3 Aug 2018 11:42:02 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by Safex1hubcas22.st.com (10.75.90.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:42:02 +0200 Received: from localhost (10.201.23.85) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:42:01 +0200 From: Patrick Delaunay To: Date: Fri, 3 Aug 2018 13:38:44 +0200 Message-ID: <1533296325-2490-4-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> References: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-03_04:, , signatures=0 Cc: Heinrich Schuchardt , Joe Hershberger , Soeren Moch , Wilson Lee , U-Boot STM32 Subject: [U-Boot] [PATCH 3/4] console: unify fgetc function when console MUX is deactivated 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" Unify the fgetc function when MUX is activated or not: - always call tstc() : it is the normal behavior expected by serial uclass (call tstc then getc) and that avoids issue when SERIAL_RX_BUFFER is activated - reload WATCHDOG in the char waiting loop This patch allow to have the same behavior when CONSOLE_MUX is activated or not and avoid regression when this feature is deactivated. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- common/console.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/console.c b/common/console.c index 7aa58d0..9a94f32 100644 --- a/common/console.c +++ b/common/console.c @@ -311,12 +311,12 @@ int serial_printf(const char *fmt, ...) int fgetc(int file) { if (file < MAX_FILES) { -#if CONFIG_IS_ENABLED(CONSOLE_MUX) /* * Effectively poll for input wherever it may be available. */ for (;;) { WATCHDOG_RESET(); +#if CONFIG_IS_ENABLED(CONSOLE_MUX) /* * Upper layer may have already called tstc() so * check for that first. @@ -324,6 +324,10 @@ int fgetc(int file) if (tstcdev != NULL) return console_getc(file); console_tstc(file); +#else + if (console_tstc(file)) + return console_getc(file); +#endif #ifdef CONFIG_WATCHDOG /* * If the watchdog must be rate-limited then it should @@ -332,9 +336,6 @@ int fgetc(int file) udelay(1); #endif } -#else - return console_getc(file); -#endif } return -1; From patchwork Fri Aug 3 11:38:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 953212 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=none (p=none dis=none) header.from=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41hlZR19xkz9s0R for ; Fri, 3 Aug 2018 21:44:31 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D6BCAC22034; Fri, 3 Aug 2018 11:43:02 +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=none 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 31423C220BF; Fri, 3 Aug 2018 11:42:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 844CCC21F1A; Fri, 3 Aug 2018 11:42:11 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lists.denx.de (Postfix) with ESMTPS id 4EAAFC21E89 for ; Fri, 3 Aug 2018 11:42:05 +0000 (UTC) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w73BdKo6031290; Fri, 3 Aug 2018 13:42:04 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2kmgnvstwr-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 03 Aug 2018 13:42:04 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D778B41; Fri, 3 Aug 2018 11:42:03 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8106C4DC2; Fri, 3 Aug 2018 11:42:03 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:42:03 +0200 Received: from localhost (10.201.23.85) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 3 Aug 2018 13:42:03 +0200 From: Patrick Delaunay To: Date: Fri, 3 Aug 2018 13:38:45 +0200 Message-ID: <1533296325-2490-5-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> References: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-03_04:, , signatures=0 Cc: U-Boot STM32 Subject: [U-Boot] [PATCH 4/4] cli: handle getch error 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" Handle getch error (when getch return 0x0) to avoid display issue in the console. Signed-off-by: Patrick Delaunay --- common/cli_readline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/cli_readline.c b/common/cli_readline.c index 60a232b..99b6317 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -273,6 +273,10 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, ichar = getcmd_getch(); + /* ichar=0x0 when error occurs in U-Boot getc */ + if (!ichar) + continue; + if ((ichar == '\n') || (ichar == '\r')) { putc('\n'); break;