From patchwork Mon Aug 21 18:52:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 715657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2B08EE4996 for ; Mon, 21 Aug 2023 18:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbjHUSzh (ORCPT ); Mon, 21 Aug 2023 14:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjHUSzg (ORCPT ); Mon, 21 Aug 2023 14:55:36 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03DFE876E for ; Mon, 21 Aug 2023 11:53:27 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-68a56401c12so745440b3a.2 for ; Mon, 21 Aug 2023 11:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1692644000; x=1693248800; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R4QnaiqajdimjjZ+5oMeKvD+9e97m/ttVj0yqLVKTWs=; b=Xg8P0VrEGxsWS/LztR+4DyaYam0ijnJc/soHnMMk73pkvwwGT/V444z6Pdf1L241Xu VqXzhFnOPJDeDiYJgN4utRes3gfuUDn1EWEPsMYJQoXQJlMtFMh/bLqw0TeNX6M/0dzb H7ckN4jP2MI4r9CKIsFFljq1oI1BJV2CnwdHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692644000; x=1693248800; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R4QnaiqajdimjjZ+5oMeKvD+9e97m/ttVj0yqLVKTWs=; b=aGI2G55Qmt9pCaFxA/jKcm4A8MCJzaQeQlkaw2XVuxx8ACmAvu8OAw7iFdrtRQ5yqe FejJfsRuJIxPRdB5JAVGPJSiitLmICfQld1l8X1Ca96F2R15iq5dvfKJv2IY9vGiyvSD AmwCDYDdfQydd9eBu16pd8OyTYQcQoWKg7ii8a4vzZeJjoflAKvSHaH9DDUoA+Ii1EhG rHgr7NuUkuA2JZ4g8SG0ruQJTajztuz1i+/8Onf2kPNwWPwFoOylMAtc8zDZANOABHz5 4N8Irjsp5I20mjZfVJZSRkQDT7YHsF2QvmasYOdunLZ33Xtn0kc5AGawwtszcfxgiSXw 9Sgw== X-Gm-Message-State: AOJu0YwUjQsUp18qrU0TsqqKTOWFuYl6B1mB4yiaPFx2mSnmUKVXrdil +9eKcBfbrO/4LJHWWANZMcluR3hHK5W3OmJ0BFb2ufMkaPW035FvUWXIBMjQvY5YeVTkwVHQHgw 92y5lqHru6NPro3htZ7gGbx07GTWsHjh2Dx/Yl4hpgVoX3jm0mRDYSsHzvW+vziTDBqwSP2iBme 57k1Y9H9WGKYI= X-Google-Smtp-Source: AGHT+IGCTwwQYX11qi34wNlJhy6TLOpX0IDtFVBd8HmuhERm01Ec8Wg3XrwcSWvQmnUBqFqEJKtwIw== X-Received: by 2002:a05:6a00:22c6:b0:687:2be1:e335 with SMTP id f6-20020a056a0022c600b006872be1e335mr7019135pfj.2.1692644000063; Mon, 21 Aug 2023 11:53:20 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id k3-20020aa790c3000000b00682a61fa525sm6592188pfk.91.2023.08.21.11.53.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2023 11:53:15 -0700 (PDT) From: Justin Chen To: linux-serial@vger.kernel.org Cc: Justin Chen , Al Cooper , Broadcom internal kernel review list , Greg Kroah-Hartman , Jiri Slaby , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko , Florian Fainelli , John Ogness , Jiaqing Zhao , linux-kernel@vger.kernel.org (open list:TTY LAYER) Subject: [PATCH v4] serial: 8250_bcm7271: improve bcm7271 8250 port Date: Mon, 21 Aug 2023 11:52:51 -0700 Message-Id: <1692643978-16570-1-git-send-email-justin.chen@broadcom.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The 8250 BCM7271 UART is not a direct match to PORT_16550A and other generic ports do not match its hardware capabilities. PORT_ALTR matches the rx trigger levels, but its vendor configurations are not compatible. Unfortunately this means we need to create another port to fully capture the hardware capabilities of the BCM7271 UART. To alleviate some latency pressures, we default the rx trigger level to 8. Signed-off-by: Justin Chen Reviewed-by: Florian Fainelli Acked-by: Doug Berger Reviewed-by: Andy Shevchenko --- v4 - Switch PORT_BCM7271 back to 76 v3 - Switch PORT_BCM7271 to 13 - Added trailing comma to struct declaration v2 - Switch PORT_BCM7271 to 76 - Elaborated commit message - Renamed port name 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..7fb1d7c00001 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 = "Broadcom 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..7e66067b6c06 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -144,6 +144,9 @@ /* Blackfin bf5xx */ #define PORT_BFIN 75 +/* Broadcom BCM7271 UART */ +#define PORT_BCM7271 76 + /* Broadcom SB1250, etc. SOC */ #define PORT_SB1250_DUART 77