Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14986044rwb; Mon, 28 Nov 2022 06:57:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6QZnKgUmvR+abiBpk665GrcEXzuilGM1U+5JTsBDfcRlZiYi0j5L49c9aQRB0uqq7BTVVe X-Received: by 2002:a63:4b24:0:b0:476:e640:d016 with SMTP id y36-20020a634b24000000b00476e640d016mr45514416pga.205.1669647439152; Mon, 28 Nov 2022 06:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669647439; cv=none; d=google.com; s=arc-20160816; b=ms9eQluR45xsqFWMWhSZz/HgJoc8dbWQzUkIKAfdBaE9/NNajFq1QwmI3u0aaem8fi dvYhAgv8FJMkdOdPrI+x0Vqo7ljOrvJsqSq9UiSz2BwpTMU3mUmCeRHrO54QyizY1sF2 KdookSeBLW58vdg23M+vIY9a/9EEZNch4Xklg+5MTwHR5WZSlkfbv4Iqd7Gn5TdS07PO u8BmfJ6teX+XmGEOvEEGRBhTU8OfEQcahT4awUqqqHC/YDO75fCSn4J+OhMDrs6LQpeo 4rRC0L8/tQk3Lc6tmjLMaOgRoLI8Ac3H10uhofXKwAIK2FiUIfRVGQYQgIAn5LHW7Qat /Pmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KKrtm9NKDDfh9YkBaXC4EgYOE8U3bsegnXYfzOrcKFY=; b=QeTlXTRRY39eXeFyDlEfGoMeI57l8yZaTVNbrMpANI796eT+6aXAws+oUMbWGQeZs5 3iRw0nRsbPB7LjlESrqy8vV7LXwNROq3idSNJ7FUVkVRRCQgEhwIQEl+x0PkGOU/sE2d Ib5l0bdOAv+uXv+UEwrQ54LwqaE0QOa2ljH0BUjpMEbPR1PBKYojFjf281yFKAwjvLr3 Lxqe6Fh4fSkiKLq14b43JSgX8kUjBOdHwiRg8xMPm3vmeBb+yzc+WBcXmroDUn4YOqUT 84MmGQS0MCOEzn5d4tulvwMe44n4kd5/S9WwMlIkwVmJ8jkX4wjcDaJOocVwb2dO3+ps hd5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Cvl/V8Cd"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a630e16000000b00476f238d231si12091606pgl.807.2022.11.28.06.57.01; Mon, 28 Nov 2022 06:57:19 -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=@kernel.org header.s=k20201202 header.b="Cvl/V8Cd"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232410AbiK1OcC (ORCPT + 85 others); Mon, 28 Nov 2022 09:32:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232609AbiK1Obr (ORCPT ); Mon, 28 Nov 2022 09:31:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85707222B8; Mon, 28 Nov 2022 06:31:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21B14611CC; Mon, 28 Nov 2022 14:31:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF8F8C433C1; Mon, 28 Nov 2022 14:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669645877; bh=o6vs9x16gtpUsWQXrNUt1RAdeTIsOsJrIh1//CI7WcU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cvl/V8Cdke02ytFWeQMSOfxV3zHGc1NmsEpKtrNhyfgGO1lEP62W2rmIndHnkful9 lDAHRxaTVcId6ZfW8aNbYOBso3/cQccmdpjo1ztEEqiWLPfaGwPGlWYeR2imhWUSy7 rSXLFrTckP8/lbRuNZuwnaqZ2eGH66mZ3Kl3WFyzSnGlGJCsr2eBMKdKhfBsdd/76S n98FZztU6y9Btv0HpPpxEy0FfVIUPvSXLpEMKttXHdLtim9fhJ1rnUE9S5YXj5OEV6 01bOaG93q2gw3gOPcdhXAQW4QcXmjg/Uu/C3zrcERB5q3obnQwXku1CjvvpX4fDOf1 AJ27pLmtsPKzA== Date: Mon, 28 Nov 2022 22:21:23 +0800 From: Jisheng Zhang To: Jiri Slaby Cc: Rob Herring , Conor Dooley , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Greg Kroah-Hartman , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v2 2/9] serial: bflb_uart: add Bouffalolab UART Driver Message-ID: References: <20221127132448.4034-1-jszhang@kernel.org> <20221127132448.4034-3-jszhang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Mon, Nov 28, 2022 at 07:10:41AM +0100, Jiri Slaby wrote: > On 27. 11. 22, 14:24, Jisheng Zhang wrote: > > +static void bflb_uart_tx_chars(struct uart_port *port) > > Again: > > Are you unable to use the TX helper? If so: You know serial subsystem better than me, may I ask for more details? For example, Besides uart_xmit_advance(), do you expect other TX helpers? If yes, can you please list them? > * why? > * use uart_advance_xmit() at least. Do you mean uart_xmit_advance()? in the do while loop below? I'm not sure I understand the meaning, correct me If I misunderstand something. thanks > > > +{ > > + struct circ_buf *xmit = &port->state->xmit; > > + unsigned int count; > > + > > + if (port->x_char) { > > + /* Send special char - probably flow control */ > > + wrl(port, UART_FIFO_WDATA, port->x_char); > > + port->x_char = 0; > > + port->icount.tx++; > > + return; > > + } > > + > > + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { > > + bflb_uart_stop_tx(port); > > + return; > > + } > > + > > + count = BFLB_UART_TX_FIFO_TH; > > + do { > > + wrl(port, UART_FIFO_WDATA, xmit->buf[xmit->tail]); > > + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); > > + port->icount.tx++; > > + if (uart_circ_empty(xmit)) > > + break; > > + } while (--count > 0); > > + > > + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) > > + uart_write_wakeup(port); > > + > > + if (uart_circ_empty(xmit)) > > + bflb_uart_stop_tx(port); > > +} > > -- > js > suse labs >