From patchwork Fri Aug 18 21:26:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 714966 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 59A52EE4998 for ; Fri, 18 Aug 2023 21:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240749AbjHRV0o (ORCPT ); Fri, 18 Aug 2023 17:26:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241049AbjHRV0h (ORCPT ); Fri, 18 Aug 2023 17:26:37 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43C2B2102 for ; Fri, 18 Aug 2023 14:26:33 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-76d764128d2so84237085a.3 for ; Fri, 18 Aug 2023 14:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1692393992; x=1692998792; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g7pw/i/UW+zKCrLLB4wtMMSGm8IV8dOUiiGsTnzKSjo=; b=bfZHz5w2YlMhnZFXIJaGaUqmuvFg6YhaTG/4M8jc9K85/C0AWfvF3zcuJk+A5KBDsU wxWV5gNumzKU8LX0FLzMz+P9c+HK5H3X1bCKUs3n14Vta8U9LISL4NnXxqcF3TM05tKy FrHoBKkz23kq3exYelEAjQnKq/Ew5RL1xUFkE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692393992; x=1692998792; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g7pw/i/UW+zKCrLLB4wtMMSGm8IV8dOUiiGsTnzKSjo=; b=KKF9xOOCwLa0DAt2Xy1aCR8yUdSkiOdB0RQbwirlYpLBUX6NxM9Gyb+5aoF47lXYPi oYva7lHpfRv0vcJTmja7/l3iloUu6sl3hM6ZPlF0yLIQtbeGb+tuUHREzltNHGjB/+Cd wgtbA9kUAZb/IMmAKK30hSf/w8dshZxbC+W9qPO/r+wk7Fq9HxVSjwSJIYM99suWk7Mw a3jRp/f5t9Ih52TTY1MHtKit8fi/lIIP2OTHfuwjy/A8YSB8UQKbIPEw589H2+QnoFJ4 ECzqUeIr7vzgmMedVJQdTzzZtLtS9f1mGkk95KsjHjboEOs703CRc21202R5HDTYSzYC 7Byw== X-Gm-Message-State: AOJu0YzRlc7VPJ+8DU8pZiBoyrFNbxZH3Clng2cYDEgsVrshIYAy5yuz fKPJ29yI1BsKIOC1Qmq9xm1Jv/c2veOBDWHyVsNr4TLnpA9VSlP4Lqk7W4TLUKN9bFkyrLwoGVP Hm86gXo8DEcD1XJeyq6lt3LA+rgouhKhZeD+rweZ3IPdJZFeVZD5AC3FR7VRpBQc0BR8Yx9KKU4 AQcabRLsT2zPE= X-Google-Smtp-Source: AGHT+IE6ogvHFlvTK4sin77z1fG2nBkPPckbLJ3+MQluisovlLtRxC2Y3hZcK13HWBqawgzungGnBg== X-Received: by 2002:a05:620a:22b3:b0:766:e430:21b8 with SMTP id p19-20020a05620a22b300b00766e43021b8mr391902qkh.75.1692393992070; Fri, 18 Aug 2023 14:26:32 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id g16-20020a05620a109000b0076ceb5eb309sm785635qkk.74.2023.08.18.14.26.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2023 14:26:28 -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 v3] serial: 8250_bcm7271: improve bcm7271 8250 port Date: Fri, 18 Aug 2023 14:26:08 -0700 Message-Id: <1692393971-31361-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 --- 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 | 1 + 3 files changed, 10 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..04ea56a0c342 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -26,6 +26,7 @@ /* * The type definitions. These are from Ted Ts'o's serial.h */ +#define PORT_BCM7271 13 /* Broadcom BCM7271 UART */ #define PORT_NS16550A 14 #define PORT_XSCALE 15 #define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */