Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5584806rwb; Tue, 22 Nov 2022 01:58:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf65upUiNuLAhLs+6lJRgUPo0a0R+Z8CDKM7gb6/bFsIFBZVyasXTnJ8YUZZ6scvC+4hWHyv X-Received: by 2002:aa7:c758:0:b0:469:b3fc:8d7c with SMTP id c24-20020aa7c758000000b00469b3fc8d7cmr6361722eds.393.1669111119936; Tue, 22 Nov 2022 01:58:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669111119; cv=none; d=google.com; s=arc-20160816; b=O9DFyJGivrXzHJantOMBG/JIKuwkJbe6KdrJeLOJ+4T1IqPCBt5sUHm+nPZDIrP3wo Y1C66IHZutoIuk+2iEANFxIwflMBt2XbFXepgCQin2UfZSJEDXhej+T9DyGYSJvzHpg4 rIhxpQjOT6Ge6MwOPb/XxSBakKnGyHUWkZovTzruYI4Bf4EgZDG78pqmeQ2SeG80zs11 ANccpneyvfZQh5fwR29Fs7GyzGl3sLbGVXm53HIGiGd3uAEoIoLRtcH9OmNdJozylZet jnd62j23/IYYyEWS376bLtCiVs26VwfRA6nlu2JeH9HD3BYC3/thmFoX8Uyu1QFaqnbW u1mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature; bh=0jzxJILOmZR9kNFAVBaAl88x5NuAOBcfaq/p9dIrGvk=; b=zKT6Drvi5Mw9uDDi0JJoMwUlOi4INwzANbjml0ROJY343H5fP8iJy2GEWmA7sM+lmv JJO2P0wMXR1b7/LYFOOYsMnN768Sj5J3QD/ytjIUh5cxZOUKdSOWq/QTtlIvqykJ2eaD PvptBW7a+NoLQUFRHY1UNIsushNZLxpL4aLoHExk7iO/Iph2wvgtwfyNMq5nFSzBK0vP C0BY6WxlodekPEMi3Pylj4eYGl+/UUbfXvE2JXjRuejCpVdKONNznCgVP8TM5+vbytxs QpvpgB2AUFMWHmRtBgSSfminWIPVSTIx2t7d+oNA3Iar7/0JKxfViiTd3EotIUzP04qz zgfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=u5BUGpvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa31-20020a1709076d1f00b0078dfe6dc4d2si9242741ejc.33.2022.11.22.01.58.17; Tue, 22 Nov 2022 01:58:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=u5BUGpvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbiKVISw (ORCPT + 91 others); Tue, 22 Nov 2022 03:18:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiKVISv (ORCPT ); Tue, 22 Nov 2022 03:18:51 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2183F043; Tue, 22 Nov 2022 00:18:50 -0800 (PST) Received: from 3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 8F2CE61C; Tue, 22 Nov 2022 09:18:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1669105128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0jzxJILOmZR9kNFAVBaAl88x5NuAOBcfaq/p9dIrGvk=; b=u5BUGpvVW/rUCa2kjt6T2Dspo/EkZw3OSnEmcYvD/AnUJP27LIp2N8A7lXf4qKrCAU0xMU iMit/9dFt+goCrh1W9bFYMgpxVEA5A6ANSpkl7MHd6aWUH86e38h0AiOfFEuiQxK8adGBb 7P/yhM6SH9qESvtYiietiXaoer1V7BZueALIWLYw5gZTRavPPpT+MnWM/7OmdD5LNa0XRh QoOO/BgMxC2uLKKjMXzORQ4dHpYpoZJ4bbWECogQU6pKwnXR/FsATMFYdNumZVzWDTKjjb h/JX8I9F202s8z/k5KEz33CIH0NvpGqpCZGtib4uqgYGUoXiifceopVQBqUu7w== MIME-Version: 1.0 Date: Tue, 22 Nov 2022 09:18:48 +0100 From: Michael Walle To: Jiri Slaby Cc: afaerber@suse.de, alexandre.belloni@bootlin.com, claudiu.beznea@microchip.com, festevam@gmail.com, gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com, kernel@pengutronix.de, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, liviu.dudau@arm.com, lorenzo.pieralisi@arm.com, mani@kernel.org, nicolas.ferre@microchip.com, richard.genoud@gmail.com, s.hauer@pengutronix.de, shawnguo@kernel.org, sudeep.holla@arm.com, tklauser@distanz.ch, vz@mleia.com Subject: Re: [PATCH v5 2/3] tty: serial: use uart_port_tx() helper In-Reply-To: <0ef4f1e6d92601a39fe0d1c316506c12@walle.cc> References: <20221004104927.14361-3-jirislaby@kernel.org> <20221121202724.1708460-1-michael@walle.cc> <0ef4f1e6d92601a39fe0d1c316506c12@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <325fdfbf37b155c41e2b45bcddd96e9b@walle.cc> X-Sender: michael@walle.cc Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2022-11-22 09:09, schrieb Michael Walle: > Hi, > > Am 2022-11-22 08:02, schrieb Jiri Slaby: >> On 21. 11. 22, 21:27, Michael Walle wrote: >>> This will break serial output for the userspace on my board >>> (arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt*dts). The >>> uart_port_tx() >>> helper will call __port->ops->stop_tx(__port) if >>> uart_circ_chars_pending() >>> returns 0. But the code above, doesn't do that. In fact, removing the >>> stop_tx() call in the helper macro, will fix the console output. >>> >>> Any ideas how to fix that? >> >> Hm, so ATMEL_US_TXRDY is removed from tx_done_mask in stop_tx, but not >> added back in start_tx. So the tx interrupt is never handled (the tx >> tasklet is not scheduled to send the queue chars) in >> atmel_handle_transmit(). >> >> Any chance, the below fixes it? >> >> diff --git a/drivers/tty/serial/atmel_serial.c >> b/drivers/tty/serial/atmel_serial.c >> index 11bf2466390e..395370e0c77b 100644 >> --- a/drivers/tty/serial/atmel_serial.c >> +++ b/drivers/tty/serial/atmel_serial.c >> @@ -596,6 +596,8 @@ static void atmel_start_tx(struct uart_port *port) >> /* re-enable PDC transmit */ >> atmel_uart_writel(port, ATMEL_PDC_PTCR, >> ATMEL_PDC_TXTEN); >> >> + atmel_port->tx_done_mask |= ATMEL_US_TXRDY; >> + >> /* Enable interrupts */ >> atmel_uart_writel(port, ATMEL_US_IER, >> atmel_port->tx_done_mask); >> >> >> thanks, > > Unfortunately, that doesn't help. Btw, some characters are transmitted: > > > [ 6.219356] Key type dns_resolver registered > [ 6.223679] Registering SWP/SWPB emulation handler > [ 6.247530] Loading compiled-in X.509 certificates > [ 6.288467] Freeing unused kernel image (initmem) memory: 1024K > [ 6.297789] Run /init as init process > WbSOROSOSOSOSOStarting linuxptp system clock synchronization: O > > -michael But you made me look at atmel_stop_tx() and there is this: /* * Disable the transmitter. * This is mandatory when DMA is used, otherwise the DMA buffer * is fully transmitted. */ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS); Removing that write, will also fix the problem. Could it be, that the transmit is still active (via DMA) but the driver will call tx_stop() and then stop the transmission in the background? -michael