Message ID | 1691792050-25042-1-git-send-email-justin.chen@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1413848vqi; Fri, 11 Aug 2023 16:21:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9PHwLB1oa1Nz7TfPqy3MmctmbuPo3oCNTYcAQV9aqR2LfZ04O36I/foPl9aiM3ZEayRhv X-Received: by 2002:a2e:9b16:0:b0:2b9:af56:f4b8 with SMTP id u22-20020a2e9b16000000b002b9af56f4b8mr2960296lji.10.1691796089299; Fri, 11 Aug 2023 16:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691796089; cv=none; d=google.com; s=arc-20160816; b=L+tbJFMC53bG+i6tTwcJnTKajtBefcWUVXO1c0TAoNYokQcLXk3wv5LfZ1PVJ6ccVF jFlvLnAzYTQzYIhhn8k5xBTRI+xt/+D+bVoJEteBbidAVoTT47nwc1Fxd6/+Av/jIZ4f DRfpXpYL3gjFg8pWdGv6apmNEWPopHGGacMcnjep/TG6meeCV3rrCWDW3Nc+05ZJnoU9 1JU3G8ye6GdY4q8/TTiPK6z/wbbhC/Y0BKKEmHlNPWGcSBV3NqbjGXahaGB372VWmX+H JiQJ97LQE86HvCIrxatAnxkSZShapovGM1zA/rzA/RLW5mJb+eB+UJvqbRnMmSqKCcqj lrNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=pFPd+0ldkXINzBbD3kvk7SeWp3MkRy33opw+tlkZZZo=; fh=8gxql61aLzgp0u8rpaii0bhSg7KjbP3V5FZqJJ95kkQ=; b=macoHO7/WiCrV5yCrzHl6cztfvfRcE+Y/YmrKvbM/jgztaNq8fA8N5wKudOcpJf5Pb bORf659uxdiSkkTj7Nkaw7YJmDKTRUpxg2Rzoej3+vajJUI9r+xE96YtL9G++F/o8Fqz 7U3N1rynzcuWJ1s4L50ObdSgb/z+w5gpiymE7vR5Y1LeznexnMioSkUw32sT9YNZcAyF DN1gislENRCawclX+kApg+L8gE1kHgWSOx6CY/TWU21U+69ycbwf6JSfVhAhm4k32u8x gSqD44fgspIqOa9G6FpPCCiD9HixN7C69awmciT6gevjtpukkNxncEXmRABl9/pqv+tk HsTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="BkA4xMT/"; 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=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rh22-20020a17090720f600b00977d04a8fd4si3679981ejb.1054.2023.08.11.16.21.04; Fri, 11 Aug 2023 16:21:28 -0700 (PDT) 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=@broadcom.com header.s=google header.b="BkA4xMT/"; 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=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233551AbjHKWPN (ORCPT <rfc822;lanlanxiyiji@gmail.com> + 99 others); Fri, 11 Aug 2023 18:15:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235652AbjHKWOx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 18:14:53 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0702B2D55 for <linux-kernel@vger.kernel.org>; Fri, 11 Aug 2023 15:14:28 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-686ed1d2594so2341302b3a.2 for <linux-kernel@vger.kernel.org>; Fri, 11 Aug 2023 15:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1691792068; x=1692396868; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pFPd+0ldkXINzBbD3kvk7SeWp3MkRy33opw+tlkZZZo=; b=BkA4xMT/4PzC/7r4YfVFtf7ztZvT5jIN9O5sv2iVkYDRBqQRUNlZrhHZe10oMuB/OM XXvSV+Vm2FfecJ3IlNln7Br7No6fhqmLD98LPE7XCRIUTckaf99BTeO/kpv/g8SDmOYg IgBMh4R3/P/9cVt9ENm8SGsmSGb2ECQNL5B8I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691792068; x=1692396868; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pFPd+0ldkXINzBbD3kvk7SeWp3MkRy33opw+tlkZZZo=; b=GY3V4IUny2IrivA4QBGpuwnAotLMabzpql1nMaaHBeuZQflFJ/WzxiVXU1aq/rykWT oAwjgAWFrRlC8Jlb6ExW0fbibiZcGatm2svJR1h4lAqk8FjlQ439+XWYKE5N8QG09M+2 WE2W0gJYyzZFFuhRiMxheC+/qe8BI7F9mjJO93zsIf/6EvvK2MdaTHpebioZU8qiB69u wsbAen7HOZp9JD+wMO6/z+jOP7/i2iCNQqR2CJwfJqAZ2WmP1VIjvwOEVVTaCZBK+Mh5 3LR6vhvuoSdAdYMLucFgEklVQe7R8G89GPU5D20Yih39JImQESuTyJeDpita1YkJpQc2 +z6g== X-Gm-Message-State: AOJu0Yz45XoZDf3qKLJT2KE1GXZUtMx7UBhBDdZNGfJAzaObx4Ths5Cc GZKX/xrjBPDX1brS1CzH3di/9g== X-Received: by 2002:a05:6a20:138b:b0:140:cb66:73c0 with SMTP id hn11-20020a056a20138b00b00140cb6673c0mr3604015pzc.58.1691792067944; Fri, 11 Aug 2023 15:14:27 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n21-20020aa79055000000b006878c00537bsm3778171pfo.120.2023.08.11.15.14.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2023 15:14:27 -0700 (PDT) From: Justin Chen <justin.chen@broadcom.com> To: linux-serial@vger.kernel.org Cc: opendmb@gmail.com, Justin Chen <justin.chen@broadcom.com>, Al Cooper <alcooperx@gmail.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, John Ogness <john.ogness@linutronix.de>, Jiaqing Zhao <jiaqing.zhao@linux.intel.com>, linux-kernel@vger.kernel.org (open list:TTY LAYER) Subject: [PATCH] serial: 8250_bcm7271: improve bcm7271 8250 port Date: Fri, 11 Aug 2023 15:14:01 -0700 Message-Id: <1691792050-25042-1-git-send-email-justin.chen@broadcom.com> X-Mailer: git-send-email 2.7.4 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000004497290602ad09dc" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, MIME_HEADER_CTYPE_ONLY,MIME_NO_TEXT,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773976775798070889 X-GMAIL-MSGID: 1773976775798070889 |
Series |
serial: 8250_bcm7271: improve bcm7271 8250 port
|
|
Commit Message
Justin Chen
Aug. 11, 2023, 10:14 p.m. UTC
The 8250 bcm7271 UART is not a direct match to PORT_16550A. The
Fifo is 32 and rxtrig values are {1, 8, 16, 30}. Create a PORT_BCM7271
to better capture the HW CAPS.
Default the rxtrig level to 8.
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
---
drivers/tty/serial/8250/8250_bcm7271.c | 4 +---
drivers/tty/serial/8250/8250_port.c | 8 ++++++++
include/uapi/linux/serial_core.h | 3 +++
3 files changed, 12 insertions(+), 3 deletions(-)
Comments
On 8/11/2023 3:14 PM, Justin Chen wrote: > The 8250 bcm7271 UART is not a direct match to PORT_16550A. The > Fifo is 32 and rxtrig values are {1, 8, 16, 30}. Create a PORT_BCM7271 > to better capture the HW CAPS. > > Default the rxtrig level to 8. > > Signed-off-by: Justin Chen <justin.chen@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
On Fri, Aug 11, 2023 at 03:14:01PM -0700, Justin Chen wrote: > The 8250 bcm7271 UART is not a direct match to PORT_16550A. The > Fifo is 32 and rxtrig values are {1, 8, 16, 30}. Create a PORT_BCM7271 > to better capture the HW CAPS. > > Default the rxtrig level to 8. > > Signed-off-by: Justin Chen <justin.chen@broadcom.com> > --- > drivers/tty/serial/8250/8250_bcm7271.c | 4 +--- > drivers/tty/serial/8250/8250_port.c | 8 ++++++++ > include/uapi/linux/serial_core.h | 3 +++ > 3 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c > index d4b05d7ad9e8..aa5aff046756 100644 > --- a/drivers/tty/serial/8250/8250_bcm7271.c > +++ b/drivers/tty/serial/8250/8250_bcm7271.c > @@ -1042,7 +1042,7 @@ static int brcmuart_probe(struct platform_device *pdev) > dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not "); > > memset(&up, 0, sizeof(up)); > - up.port.type = PORT_16550A; > + up.port.type = PORT_BCM7271; > up.port.uartclk = clk_rate; > up.port.dev = dev; > up.port.mapbase = mapbase; > @@ -1056,8 +1056,6 @@ static int brcmuart_probe(struct platform_device *pdev) > | UPF_FIXED_PORT | UPF_FIXED_TYPE; > up.port.dev = dev; > up.port.private_data = priv; > - up.capabilities = UART_CAP_FIFO | UART_CAP_AFE; > - up.port.fifosize = 32; > > /* Check for a fixed line number */ > ret = of_alias_get_id(np, "serial"); > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > index 16aeb1420137..a6259a264041 100644 > --- a/drivers/tty/serial/8250/8250_port.c > +++ b/drivers/tty/serial/8250/8250_port.c > @@ -322,6 +322,14 @@ static const struct serial8250_config uart_config[] = { > .rxtrig_bytes = {2, 66, 130, 194}, > .flags = UART_CAP_FIFO, > }, > + [PORT_BCM7271] = { > + .name = "bcm7271_uart", > + .fifo_size = 32, > + .tx_loadsz = 32, > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, > + .rxtrig_bytes = {1, 8, 16, 30}, > + .flags = UART_CAP_FIFO | UART_CAP_AFE > + }, > }; > > /* Uart divisor latch read */ > diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h > index 281fa286555c..369f845a3d1d 100644 > --- a/include/uapi/linux/serial_core.h > +++ b/include/uapi/linux/serial_core.h > @@ -279,4 +279,7 @@ > /* Sunplus UART */ > #define PORT_SUNPLUS 123 > > +/* Broadcom 7271 UART */ > +#define PORT_BCM7271 124 Why is this new id required? What in userspace is going to use it and why can't the generic value be used instead? thanks, greg k-h
On Sat, Aug 12, 2023 at 3:50 AM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Fri, Aug 11, 2023 at 03:14:01PM -0700, Justin Chen wrote: > > The 8250 bcm7271 UART is not a direct match to PORT_16550A. The > > Fifo is 32 and rxtrig values are {1, 8, 16, 30}. Create a PORT_BCM7271 > > to better capture the HW CAPS. > > > > Default the rxtrig level to 8. > > > > Signed-off-by: Justin Chen <justin.chen@broadcom.com> > > --- > > drivers/tty/serial/8250/8250_bcm7271.c | 4 +--- > > drivers/tty/serial/8250/8250_port.c | 8 ++++++++ > > include/uapi/linux/serial_core.h | 3 +++ > > 3 files changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c > > index d4b05d7ad9e8..aa5aff046756 100644 > > --- a/drivers/tty/serial/8250/8250_bcm7271.c > > +++ b/drivers/tty/serial/8250/8250_bcm7271.c > > @@ -1042,7 +1042,7 @@ static int brcmuart_probe(struct platform_device *pdev) > > dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not "); > > > > memset(&up, 0, sizeof(up)); > > - up.port.type = PORT_16550A; > > + up.port.type = PORT_BCM7271; > > up.port.uartclk = clk_rate; > > up.port.dev = dev; > > up.port.mapbase = mapbase; > > @@ -1056,8 +1056,6 @@ static int brcmuart_probe(struct platform_device *pdev) > > | UPF_FIXED_PORT | UPF_FIXED_TYPE; > > up.port.dev = dev; > > up.port.private_data = priv; > > - up.capabilities = UART_CAP_FIFO | UART_CAP_AFE; > > - up.port.fifosize = 32; > > > > /* Check for a fixed line number */ > > ret = of_alias_get_id(np, "serial"); > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > > index 16aeb1420137..a6259a264041 100644 > > --- a/drivers/tty/serial/8250/8250_port.c > > +++ b/drivers/tty/serial/8250/8250_port.c > > @@ -322,6 +322,14 @@ static const struct serial8250_config uart_config[] = { > > .rxtrig_bytes = {2, 66, 130, 194}, > > .flags = UART_CAP_FIFO, > > }, > > + [PORT_BCM7271] = { > > + .name = "bcm7271_uart", > > + .fifo_size = 32, > > + .tx_loadsz = 32, > > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, > > + .rxtrig_bytes = {1, 8, 16, 30}, > > + .flags = UART_CAP_FIFO | UART_CAP_AFE > > + }, > > }; > > > > /* Uart divisor latch read */ > > diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h > > index 281fa286555c..369f845a3d1d 100644 > > --- a/include/uapi/linux/serial_core.h > > +++ b/include/uapi/linux/serial_core.h > > @@ -279,4 +279,7 @@ > > /* Sunplus UART */ > > #define PORT_SUNPLUS 123 > > > > +/* Broadcom 7271 UART */ > > +#define PORT_BCM7271 124 > > Why is this new id required? What in userspace is going to use it and > why can't the generic value be used instead? > I couldn't find a generic port that matches our FIFO size and rxtrig_bytes. That is why I created a new one. Userspace currently misreports what the rxtrig level is. Thanks, Justin > thanks, > > greg k-h
On Sat, Aug 12, 2023 at 09:24:21PM -0700, Justin Chen wrote: > On Sat, Aug 12, 2023 at 3:50 AM Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > On Fri, Aug 11, 2023 at 03:14:01PM -0700, Justin Chen wrote: > > > + [PORT_BCM7271] = { > > > + .name = "bcm7271_uart", This is badly named port type. > > > + .fifo_size = 32, > > > + .tx_loadsz = 32, > > > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, > > > + .rxtrig_bytes = {1, 8, 16, 30}, > > > + .flags = UART_CAP_FIFO | UART_CAP_AFE > > > + }, > > > }; This is almost a dup of PORT_ALTR_16550_F32. Use it if you wish. You can always rename it if it feels the right thing to do. But why 8 and not 16 is the default rxtrig?
On 8/14/2023 9:28 AM, Justin Chen wrote: > > > On 8/14/23 8:12 AM, Andy Shevchenko wrote: >> On Sat, Aug 12, 2023 at 09:24:21PM -0700, Justin Chen wrote: >>> On Sat, Aug 12, 2023 at 3:50 AM Greg Kroah-Hartman >>> <gregkh@linuxfoundation.org> wrote: >>>> On Fri, Aug 11, 2023 at 03:14:01PM -0700, Justin Chen wrote: >> >>>>> + [PORT_BCM7271] = { >>>>> + .name = "bcm7271_uart", >> >> This is badly named port type. >> This may be true, but it does mirror the PORT_BCM63XX naming and I do value consistency so it is acceptable to me. However, I will happily yield to a better name if one can be determined by popular consensus. > > Would "Brcmstb 7271 UART" suffice? > Perhaps, "Broadcom BCM7271 UART" but it seems excessively "chatty" to me, so as I said I am OK with the original submission. >>>>> + .fifo_size = 32, >>>>> + .tx_loadsz = 32, >>>>> + .fcr = UART_FCR_ENABLE_FIFO | >>>>> UART_FCR_R_TRIG_01, >>>>> + .rxtrig_bytes = {1, 8, 16, 30}, >>>>> + .flags = UART_CAP_FIFO | UART_CAP_AFE >>>>> + }, >>>>> }; >> >> This is almost a dup of PORT_ALTR_16550_F32. Use it if you wish. >> You can always rename it if it feels the right thing to do. >> > > There is some other PORT_ALTR logic that I would like to avoid. I would > also like to avoid future changes to PORT_ALTR that wouldn't be > applicable to us. I too am reluctant to introduce yet another port type, but Justin is correct in pointing out that the PORT_ALTR_16550_* port types include Tx FIFO threshold programming that is incompatible with the BCM7271 UART hardware. This port type does appear necessary to address fundamental differences in the hardware unless we are willing to scrap the uart_config[] array and have the individual drivers manage these differences (which I would also be OK with, but I am just a tail on this dog). The BCM7271 UART IP does support programmable Tx FIFO thresholds in a different way, so if I (or someone else) decided to enable support for that it would appear that this new port type would be necessary at that time as well. > >> But why 8 and not 16 is the default rxtrig? >> > > We were seeing some latency issues on our chips where 16 would cause > overflows. Trying to kill 2 birds with one stone. If creating another > port type is avoidable then alternatively I can change the default in > userspace. > > Thanks, > Justin Regards, Doug
diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c index d4b05d7ad9e8..aa5aff046756 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1042,7 +1042,7 @@ static int brcmuart_probe(struct platform_device *pdev) dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not "); memset(&up, 0, sizeof(up)); - up.port.type = PORT_16550A; + up.port.type = PORT_BCM7271; up.port.uartclk = clk_rate; up.port.dev = dev; up.port.mapbase = mapbase; @@ -1056,8 +1056,6 @@ static int brcmuart_probe(struct platform_device *pdev) | UPF_FIXED_PORT | UPF_FIXED_TYPE; up.port.dev = dev; up.port.private_data = priv; - up.capabilities = UART_CAP_FIFO | UART_CAP_AFE; - up.port.fifosize = 32; /* Check for a fixed line number */ ret = of_alias_get_id(np, "serial"); diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 16aeb1420137..a6259a264041 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -322,6 +322,14 @@ static const struct serial8250_config uart_config[] = { .rxtrig_bytes = {2, 66, 130, 194}, .flags = UART_CAP_FIFO, }, + [PORT_BCM7271] = { + .name = "bcm7271_uart", + .fifo_size = 32, + .tx_loadsz = 32, + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, + .rxtrig_bytes = {1, 8, 16, 30}, + .flags = UART_CAP_FIFO | UART_CAP_AFE + }, }; /* Uart divisor latch read */ diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index 281fa286555c..369f845a3d1d 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -279,4 +279,7 @@ /* Sunplus UART */ #define PORT_SUNPLUS 123 +/* Broadcom 7271 UART */ +#define PORT_BCM7271 124 + #endif /* _UAPILINUX_SERIAL_CORE_H */