From patchwork Fri Aug 11 22:14:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 713459 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 3E1EAC001DB for ; Fri, 11 Aug 2023 22:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbjHKWPE (ORCPT ); Fri, 11 Aug 2023 18:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233777AbjHKWOq (ORCPT ); Fri, 11 Aug 2023 18:14:46 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E7D1724 for ; Fri, 11 Aug 2023 15:14:29 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-686f1240a22so2361594b3a.0 for ; Fri, 11 Aug 2023 15:14:29 -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=240AxdMMaldk+g7fw53LojwcLK4U9jGObKQxSzF0En0=; b=Fp3GXkAYuhSpSe2YVkZ1bh/BCEztsSg8pwe7AWtSm812xEisuKoggzIiFxxw8nd3/g z3YLOzqGjT1iX9pA5PrWeQdi+i4Gu2q5qSDEnoJ1Z133xATC8e4XySAeQ4UVZFCMRXpv rAumgp7wk0pW1U5NwqRSB2/xYH6D0ThLHxcfY= 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=240AxdMMaldk+g7fw53LojwcLK4U9jGObKQxSzF0En0=; b=WD60yHZvyocjQtbYmaGcfdhf35u4A65/4MqrMt+W3oIHdoCQhLTrvQuZlyoSfb04Dc nDArfauRkCfT3h/X+So03gGGsgjPF1hNsxjJv34B0nWnAlh2ZLgAsj+A7XrgnI4d4F21 afZextdGmzNSBs9mq7MB08GK7WMJOuOiEWe/44MpQuiHLEpCVx1zQl+GY6hHihlqFNZY ZRgAa/fTWa3b186qYrYp47W9wRGK8fdkhYyl26geuGvPfCgfdBEf9xQfGlSbQUjDd/9n QTqYNCaSLEpVJF6H91bGGTV67xaZHR59+wQloKIsR0A8mjv2m5bTgYNg01CcYVcXADON 3EzA== X-Gm-Message-State: AOJu0YwEBHCSzyun30Gs9Wi5vgyBguR6sx9ufabMCrtA+UwTmgiWEhxf IswI6xJbuLNEAHqhWsLZpJ2TMa50u9JzJuKOJp2YG0xwTCO10tVXUGz2YzgwoIt5/IOrcpCOoXH xBvTqIpTPDQrCixO9bdoLiEkNJ0sCwq5B7tS8BUEdGT4Dr96vWdfVw2mOVzA8kwhlrS0d8ebF0l G6HepndDF9s3p9tg== X-Google-Smtp-Source: AGHT+IFNCpK+SFo/jVQXxIJUfTMKXpIHOUx8IHsRrZ7r8q3e+NN1cMheBNwukNLak4uwsB8lMcGzFQ== 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 To: linux-serial@vger.kernel.org Cc: opendmb@gmail.com, Justin Chen , Al Cooper , Broadcom internal kernel review list , Greg Kroah-Hartman , Jiri Slaby , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko , John Ogness , Jiaqing Zhao , 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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 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..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 */