From patchwork Thu Aug 17 21:13:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 714551 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 81FE0C64EB4 for ; Thu, 17 Aug 2023 21:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351823AbjHQVNf (ORCPT ); Thu, 17 Aug 2023 17:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355150AbjHQVN3 (ORCPT ); Thu, 17 Aug 2023 17:13:29 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699C8358E for ; Thu, 17 Aug 2023 14:13:28 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-40fed08b990so1964691cf.2 for ; Thu, 17 Aug 2023 14:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1692306807; x=1692911607; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CcBaHqQXHzMj3NhFqT0Wex/baKxPXj4lv6tbMTF8Dy8=; b=V4SS0027MgOATHDoPqGSPv98pW4YvbeZDsC9rgu5N9Buuh+Qi/ekY0JwH+OxIKXnBH cYCdYJqQJIqvkw4BuSkE/hfjoB9S6cXNc9sFEp1MnjaynSWMrLVb789+6sKw7Al7/WuB dJjVBsXVQd4gTMoQbS+XrZK9SmIb4c74ABWDE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692306807; x=1692911607; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CcBaHqQXHzMj3NhFqT0Wex/baKxPXj4lv6tbMTF8Dy8=; b=k1sbCf9kK7NzIcq+W6zl6vDGga8bdO/CWISlHPPZtUqvUS/BER60DA7HozgEFJRcvU /paNpq3PHp7ldVeHeRvch/nw/ylHpSKwqo8tlMbI21v2o24xMoVih5lUHt191wrt6WAp eBBh6ms3IfWg14XSQm92JDmbVrab0k3wymvC/K/q3aOwg7eDWAoX6o+CiYuayC1ezAyJ bPLuvlnR9zDRabxwxE+5X6Urxs2WNtldnw1hw7iafyb1Y8/nKMpVHFVMu0RoEb/oXERD RkK5cHvynzAN+4WkXElnN5mIA9/7wr3RVcm3zp/f2Zfsgbp58HZ6cnoTQjb1TSMikiej I/8g== X-Gm-Message-State: AOJu0YwHcEdBvpVOZpmn3lJzUmXq4dZycf8ckF2QPsKnycte4ePu7Tyq Tlx7XYZbj3OrPy44wuWOYT4xeWJ+ZHMZmGjE2R/141XdD8BVjEpCqEpMmIj/wuHF6rxm51rczpL jG87Clpxf+SW+efne/+4O+ibzhpJE1INtiNCy7UmXwzqr8bYZxQakSmj9tJ7iQm9VYzMhG1RVyC qJV3IGMoPjf+0= X-Google-Smtp-Source: AGHT+IGOC4gi43NE5+I+iBO1VZaeFp8M0TDfwQbxCpChPMY121JfIfiUxWjYTuzACEvNTqjtV+2wXg== X-Received: by 2002:a05:622a:1c6:b0:403:929f:12e2 with SMTP id t6-20020a05622a01c600b00403929f12e2mr1007323qtw.49.1692306807165; Thu, 17 Aug 2023 14:13:27 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id h3-20020ac85043000000b00410538a2e74sm119383qtm.16.2023.08.17.14.13.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2023 14:13:26 -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 v2] serial: 8250_bcm7271: improve bcm7271 8250 port Date: Thu, 17 Aug 2023 14:13:18 -0700 Message-Id: <1692306801-13191-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 --- 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..9f05745e221b 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..9646629496ab 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