Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp964751pxb; Wed, 6 Apr 2022 05:29:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUb9BK1e37gddUH2epz+xCMbux8wtz5p9pip1j53X32NNM8X1xETtR+1Q/5jqRe8hDgKFh X-Received: by 2002:a05:6a00:1988:b0:4fa:c15d:190d with SMTP id d8-20020a056a00198800b004fac15d190dmr8438293pfl.44.1649248181943; Wed, 06 Apr 2022 05:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649248181; cv=none; d=google.com; s=arc-20160816; b=ruDYsDbN2Tqp2PLBOawzxTvaUSarO3rh2QY+JT520WULZp8nqo4Qke5XNrMrupV0Ta NVIAabB3yyl/0bIepk8kHtt79oNsW8igUC4/TTVyy6Q8cy+WxfFKbqZsLrUDhzIWGnAy hgBLcx4j8uaIFX9Do0KCsiU80LvGXVSr9w6m+Yb+Hpxdt86/89IWPs/bM33WbbMyllqL lLI1KHLJnOwJhqzqQaEngbv+HvXdyB34KXyxgCwuHeRijg6/kcjw1G/YCbFKBcEVxQ7z U/FYIzd1/iU4a1H57ZyzZ7pDlUr78XXvwCXOIWYM14ctPsdnLIBwUWOkAakiT+nvizv7 urdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aiayZaG1+ZwmZOclwcuzSONnaSQyqrx1tsS7HxKbl8c=; b=KL9ebmO3yV22mQOrjRA6rLo6exp74SgQ3aanXE7dEpn/iURHsCxziAUqxf3HtrR4Dp KJUbaBGWHDm0Q13YnU2/WsQ+7xw/pr0aTft2FL98NPnhh8WzY/n+h2uxkIFCN7xMZvYy lo6c8SOPY7Nf/Sh1j8SfJex53Ki82MLmPtXMaZnogKsGanRqqndg2a9iw/83gjrNBpcw 1LKPcm84+IyFGzJ2m68o26/hgv2tjCE0oRdmrsXqP5hSCH5kFoZhKpZjnLx06rJ7ytCu mkbi3OBo91/hkE/6gKgR3cNhx9+UCMODR0OmYb1w1Iopxwjrp39ufAMaU1VZINMdwDQq rSJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JDI1sfhu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e4-20020a636904000000b003860f95cfa9si15031809pgc.855.2022.04.06.05.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:29:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JDI1sfhu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 116D147C3EC; Wed, 6 Apr 2022 02:04:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351902AbiDEVKJ (ORCPT + 99 others); Tue, 5 Apr 2022 17:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349426AbiDEJtu (ORCPT ); Tue, 5 Apr 2022 05:49:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DF4D22284; Tue, 5 Apr 2022 02:45:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C61D61576; Tue, 5 Apr 2022 09:45:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8135C385A3; Tue, 5 Apr 2022 09:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151929; bh=V/Q7HNgsqsem44bPKXcSU/aQJQJuM9QmL0binbVJQA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JDI1sfhujywQCoKb9rvVQzKdlxjjS9ilALYpBiKIWl6nW6EwD6cu9dV+NXNdkDbQO WX+470hdemlbhz9pBpre+m99anpYXV7KwNJvkgLwPkhp4ARymjwjsZgE//K6pBPsyJ 3dNRuFLfY3Vgp2zzRF3DlGWc4mVh/zE5pXLdx++8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Aladyshev , Andy Shevchenko , Zev Weiss , Sasha Levin Subject: [PATCH 5.15 593/913] serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type Date: Tue, 5 Apr 2022 09:27:35 +0200 Message-Id: <20220405070357.617553343@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Zev Weiss [ Upstream commit a603ca60cebff8589882427a67f870ed946b3fc8 ] Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to set up register mapping") fixed a bug that had, as a side-effect, prevented the 8250_aspeed_vuart driver from enabling the VUART's FIFOs. However, fixing that (and hence enabling the FIFOs) has in turn revealed what appears to be a hardware bug in the ASPEED VUART in which the host-side THRE bit doesn't get if the BMC-side receive FIFO trigger level is set to anything but one byte. This causes problems for polled-mode writes from the host -- for example, Linux kernel console writes proceed at a glacial pace (less than 100 bytes per second) because the write path waits for a 10ms timeout to expire after every character instead of being able to continue on to the next character upon seeing THRE asserted. (GRUB behaves similarly.) As a workaround, introduce a new port type for the ASPEED VUART that's identical to PORT_16550A as it had previously been using, but with UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to one byte, which (experimentally) seems to avoid the problematic THRE behavior. Fixes: 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to set up register mapping") Tested-by: Konstantin Aladyshev Reviewed-by: Andy Shevchenko Signed-off-by: Zev Weiss Link: https://lore.kernel.org/r/20220211004203.14915-1-zev@bewilderbeest.net Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- drivers/tty/serial/8250/8250_port.c | 8 ++++++++ include/uapi/linux/serial_core.h | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 2350fb3bb5e4..c2cecc6f47db 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -487,7 +487,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) port.port.irq = irq_of_parse_and_map(np, 0); port.port.handle_irq = aspeed_vuart_handle_irq; port.port.iotype = UPIO_MEM; - port.port.type = PORT_16550A; + port.port.type = PORT_ASPEED_VUART; port.port.uartclk = clk; port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index ec88b706e882..b470bc747b99 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -307,6 +307,14 @@ static const struct serial8250_config uart_config[] = { .rxtrig_bytes = {1, 32, 64, 112}, .flags = UART_CAP_FIFO | UART_CAP_SLEEP, }, + [PORT_ASPEED_VUART] = { + .name = "ASPEED VUART", + .fifo_size = 16, + .tx_loadsz = 16, + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, + .rxtrig_bytes = {1, 4, 8, 14}, + .flags = UART_CAP_FIFO, + }, }; /* Uart divisor latch read */ diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index c4042dcfdc0c..8885e69178bd 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -68,6 +68,9 @@ /* NVIDIA Tegra Combined UART */ #define PORT_TEGRA_TCU 41 +/* ASPEED AST2x00 virtual UART */ +#define PORT_ASPEED_VUART 42 + /* Intel EG20 */ #define PORT_PCH_8LINE 44 #define PORT_PCH_2LINE 45 -- 2.34.1