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: 134769 Return-Path: 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 + 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 ); 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 ; Fri, 11 Aug 2023 15:14:28 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-686ed1d2594so2341302b3a.2 for ; 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 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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773976775798070889 X-GMAIL-MSGID: 1773976775798070889 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 --- 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 */