From patchwork Fri Mar 25 10:50:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1609372 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=pwEOSz5h; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KPzQL4d0Zz9s5V for ; Fri, 25 Mar 2022 21:50:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B3B98418B; Fri, 25 Mar 2022 11:50:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="pwEOSz5h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BF9168418D; Fri, 25 Mar 2022 11:50:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AC2E484189 for ; Fri, 25 Mar 2022 11:50:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62e.google.com with SMTP id pv16so14611112ejb.0 for ; Fri, 25 Mar 2022 03:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uiihUVJGrp7MmKxgNwaXxuQIEJBwJTu+y9m1A6yHyeA=; b=pwEOSz5hYwSgPIAT2JJ6up5/kueMdrEMAxaXMBjLCB/ofW7rX2FxLcUiUY2vzyqH7p vjCfUkmOXm7Cg2Wzq2Nt0f8vLkUmHsvcflpe8urpbUJIj0LkCD4AJuOneGUeG+mrVKuz oFUUoP/2sYriY8SaOQfx2kCvYmf+H6K6l0wBb6yY1d+72008kLXQS7p6BtPoBcsq2E0e PBQj9Q+tM7Yhjb0daxx/EVDZ9bmVKiDKxTE3NiJobehqPIJ8ovf7PvLUVE5rXxgp8f1b rczixYD+edHPSnk6r5trQwT7fBuJ3p48bWd+n7WkTrvB155UpeBOq8UO5kS43Qm/E2zQ zYlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=uiihUVJGrp7MmKxgNwaXxuQIEJBwJTu+y9m1A6yHyeA=; b=b4JE0FGWE0jNs7SJg3Y02n0eGnyZSceFnU+iHpP3GsuhU0OWnv4zbEH86sJ0b6lmDn 683HBQGqZHjJ1XpHBseua1G7c7c/hKVkRr+9Xf22Enp1+AHc7OMlQPwJQpoIKkojxXog W/2zxZm61HRhLV1G+H1MICQjql9GKHN1h7d1YDM1I58npbE92iDxgq4d9yO02JBGozmV LbSAe4mC8ubT2OD5TsyKMhhyRFyBtbtqXiwBnjEhDXNgTWdb7bVoJcCKpMX+VWOCY99J bULbUcyIy8gU1eH6XsBOYyo9op1R/is/m0PocPhjostpWyEiA7gMifEtw3yjJipTiExr FhoQ== X-Gm-Message-State: AOAM532/NidDhLEswtV0/k9HQ6aZfr3GEFv2aBDRfzPUPc2YlJcTA6Gy X8WE7zQNTHY3/poGn0XuBdrMRREfaG9FKw== X-Google-Smtp-Source: ABdhPJw9iLrqTaMZdNHeiAxFoUVEAgmLLU503/udYL8HJ92Z+MuzFc301rlSdeh4sAlppip9aOLYIw== X-Received: by 2002:a17:907:7b86:b0:6e0:5c28:4f5f with SMTP id ne6-20020a1709077b8600b006e05c284f5fmr10378098ejc.675.1648205413104; Fri, 25 Mar 2022 03:50:13 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id j17-20020a05640211d100b00419357a2647sm2815496edw.25.2022.03.25.03.50.12 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Mar 2022 03:50:12 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Michal Simek Subject: [PATCH] serial: zynq: Change fifor behavior in debug mode Date: Fri, 25 Mar 2022 11:50:07 +0100 Message-Id: <332b2106d7a8190dd1001b5387f8bd1fba2e061b.1648205405.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Serial IP has output buffer which status is indicated by two bits. If fifo if empty or full. Default configuration is that chars are pushed to fifo till it is full. Time to time it is visible that chars are scambled and logs are not visible. Not sure what it is exactly happening but all the time it helps to change driver behavior to write only one char at a time. That's why enable this mode when debug uart is enabled not to see scrambled chars in debug by default. Signed-off-by: Michal Simek --- drivers/serial/serial_zynq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index fd999368ab70..6bb003dc1558 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -21,6 +21,7 @@ #define ZYNQ_UART_SR_TXACTIVE BIT(11) /* TX active */ #define ZYNQ_UART_SR_TXFULL BIT(4) /* TX FIFO full */ +#define ZYNQ_UART_SR_TXEMPTY BIT(3) /* TX FIFO empty */ #define ZYNQ_UART_SR_RXEMPTY BIT(1) /* RX FIFO empty */ #define ZYNQ_UART_CR_TX_EN BIT(4) /* TX enabled */ @@ -107,8 +108,13 @@ static void _uart_zynq_serial_init(struct uart_zynq *regs) static int _uart_zynq_serial_putc(struct uart_zynq *regs, const char c) { - if (readl(®s->channel_sts) & ZYNQ_UART_SR_TXFULL) - return -EAGAIN; + if (CONFIG_IS_ENABLED(DEBUG_UART_ZYNQ)) { + if (!(readl(®s->channel_sts) & ZYNQ_UART_SR_TXEMPTY)) + return -EAGAIN; + } else { + if (readl(®s->channel_sts) & ZYNQ_UART_SR_TXFULL) + return -EAGAIN; + } writel(c, ®s->tx_rx_fifo);