From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57CF64CC262; Fri, 9 Oct 2026 11:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791543604; cv=none; b=gx6TDcCjHxt0dnMN+cy6yl7eB1dDLGrEeQeYdkUdqMrvcNraS5IiVj/l1efycX5JRNlvNeYXbmBPxS9Mjjc9oHejVQzkhX5WJRCumZW4UEXYuVuXLFqujfs7pkCeCdprtwJLKQV6mHdhe8qAimwdJlmjCPup/G+J+CEJ7d7oH3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791543604; c=relaxed/simple; bh=5GFqfQIbCg2UdEeRrw8f0OXijIQlOGnsXzu/vsVQh9g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OF/C44CDDNxKUDoAS2CCtR+2bZ22F16GQXe1U+AA9qyo31O3D1ZyI/7j7mEkJPmwOx8fcaRr6uIb30PBILbpyZ5l10n6KFrawrUFqvW8xNuHSl2UfA6uMdk36bdsFLPS6yRcnT8Y4WjgxIawOjt640AQrZwroVp3bJPib7zQjPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Oa7eGbat; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Oa7eGbat" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6BEB7C4AF09; Fri, 9 Oct 2026 11:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1791543603; bh=5GFqfQIbCg2UdEeRrw8f0OXijIQlOGnsXzu/vsVQh9g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Oa7eGbateNU8RyS+9ll2MZKkirPYtR3ZpbZhhailvxRaBJFh76wKxLPKbSWneDjyt 2JFoIe7cNaEG6i20DuqMInbQOovvM3iN77M/X1O9mCNNMI6Wg4qEFQ78qWXR1OezLe 2QJoxegry2AfgusDY5tW+6DTPPU6HOM2/XcuOeqNQ5iBgoGqyFTxqFpLWeX/hcV5qg rKiFB9AjNQfRQGOcbkK3/aXkPj5zJSk+//FmYJy0/x+uQFeziJ/MEGQ/cuN01SZqul uOsVnC/X0RsCooTaxkhPVCFbGnWGLF70abOPyBEt01+oElDgv5zHlzThfpWpJTOL3u LcMqXkEodpMBg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F7CACA601E; Fri, 9 Oct 2026 11:00:03 +0000 (UTC) From: Long Zhao via B4 Relay Date: Fri, 09 Oct 2026 18:59:59 +0800 Subject: [PATCH 2/2] serial: 8250_dw: add Ambarella CV75 quirks Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261009-cv75-uart-v1-2-38c098efaa99@ambarella.com> References: <20261009-cv75-uart-v1-0-38c098efaa99@ambarella.com> In-Reply-To: <20261009-cv75-uart-v1-0-38c098efaa99@ambarella.com> To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Cc: Linus Walleij , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Rob Herring , Krzysztof Kozlowski , Krzysztof Kozlowski , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, Long Zhao , Long Zhao , linux-kernel@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1791543601; l=3394; i=longzhao@ambarella.com; s=20260730; h=from:subject:message-id; bh=r8t/FG9wW+i95rGWMVag4aWVspLRurIpWPfr+INLVog=; b=hv7yDdv8ftrjIZ71bzvGTmVvggxkbx5wiX6jR+t+LikCzqq6/aACh1DAvEnC9I2wZw06ojkCk VB6RFtmbUSkA55Zxuns057H+2D/ZyvASUSjSTMuWoOqwssQNiNnNIwp X-Developer-Key: i=longzhao@ambarella.com; a=ed25519; pk=/xGhPTOX0/eYsyTWzyjjgAIW1Z/YD+IlnOnvcdRozow= X-Endpoint-Received: by B4 Relay for longzhao@ambarella.com/20260730 with auth_id=903 X-Original-From: Long Zhao Reply-To: longzhao@ambarella.com From: Long Zhao The Ambarella CV75 UART is Ambarella IP, not a Synopsys DesignWare licensed block. At the register level it is close enough to DW APB UART that a full custom UART driver is unnecessary: reuse 8250_dw with a small platform quirk. Quirks: - keep IER ETOI (bit 5) set for RX timeout behaviour - skip set_rate; baud clock is managed outside the UART block Reviewed-by: Linus Walleij Reviewed-by: Andy Shevchenko Reviewed-by: Ilpo Järvinen Signed-off-by: Long Zhao --- drivers/tty/serial/8250/8250_dw.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 5fba913f3301..06f03e893346 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -43,6 +43,9 @@ #define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1) #define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3) +/* Ambarella IER: receive timeout interrupt enable */ +#define AMBARELLA_UART_IER_ETOI BIT(5) + /* Quirks */ #define DW_UART_QUIRK_OCTEON BIT(0) #define DW_UART_QUIRK_ARMADA_38X BIT(1) @@ -60,6 +63,7 @@ struct dw8250_platform_data { u8 usr_reg; + u8 ier_mask; u32 cpr_value; unsigned int quirks; }; @@ -572,6 +576,25 @@ static void dw8250_prepare_rx_dma(struct uart_8250_port *p) dw8250_writel_ext(up, RZN1_UART_RDMACR, val); } +static int dw8250_ier_mask_startup(struct uart_port *p) +{ + struct dw8250_data *d = to_dw8250_data(p->private_data); + struct uart_8250_port *up = up_to_u8250p(p); + int ret; + + ret = serial8250_do_startup(p); + if (ret) + return ret; + + /* + * Ambarella keeps variant IER bits (e.g. ETOI) set for correct RX + * timeout behaviour. + */ + up->ier |= d->pdata->ier_mask; + + return 0; +} + static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) { unsigned int quirks = data->pdata->quirks; @@ -606,6 +629,8 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) p->serial_in = dw8250_serial_in32; data->uart_16550_compatible = true; } + if (data->pdata->ier_mask) + p->startup = dw8250_ier_mask_startup; } static void dw8250_reset_control_assert(void *data) @@ -879,6 +904,12 @@ static const struct dw8250_platform_data dw8250_intc10ee = { .quirks = DW_UART_QUIRK_IER_KICK, }; +static const struct dw8250_platform_data dw8250_ambarella_cv75_data = { + .usr_reg = DW_UART_USR, + .ier_mask = AMBARELLA_UART_IER_ETOI, + .quirks = DW_UART_QUIRK_SKIP_SET_RATE, +}; + static const struct dw8250_platform_data dw8250_ultrarisc_dp1000_data = { .usr_reg = DW_UART_USR, .cpr_value = FIELD_PREP_CONST(DW_UART_CPR_ABP_DATA_WIDTH, 2) | @@ -890,6 +921,7 @@ static const struct dw8250_platform_data dw8250_ultrarisc_dp1000_data = { static const struct of_device_id dw8250_of_match[] = { { .compatible = "snps,dw-apb-uart", .data = &dw8250_dw_apb }, + { .compatible = "ambarella,cv75-uart", .data = &dw8250_ambarella_cv75_data }, { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, -- 2.34.1