From patchwork Tue Jan 9 12:58:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13514904 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47202C47077 for ; Tue, 9 Jan 2024 12:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JoCY3YksOYQRgosk1RNhN1oJXfDY32JVbmV9J2Eros4=; b=0tR36kaH9di4+g xN9C17V/6sgTV1POfLggpdLnU9ken/ny4ajQw5pQj+gCG6ihQhierLcyLtbS8zIQEFN16gY0KajU6 r7xBmbQXfzPP1QXKLQqtiJZ1UKmQTWjaiX5t9CKpUv5C8FqlHE5MrFHOohesNYeb0r74tJPivOMAF TJjt5KgIkcDFh63khLWcBKdqtCNoBYopta06zxliRjlq755secIRy5lkmpzWBEKvjbENxMNsKKKWr 6nWbWWm/g9dFcPo2R8Po1zHqgvaDoEczeF39dIBFFeOHEV8v2k4voGAj1fWUPGwzjPX7f1x7xj78f 1/lMeCWN6gBueVC1KPPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNBgs-008IU4-1b; Tue, 09 Jan 2024 12:58:46 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNBgk-008INb-1A for linux-arm-kernel@lists.infradead.org; Tue, 09 Jan 2024 12:58:39 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3373a30af67so2773024f8f.0 for ; Tue, 09 Jan 2024 04:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704805114; x=1705409914; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QYANYm/flTLm8ltfdyXSV/4KcEiWh8iO47/Oolwzemw=; b=pIqIHxD0jhtMu2HtEl86aFENkbi3g2YFbHPIYIt0/aOvVghiWUON2zLyuIIlw63HHV jDcw/IxrIQOcCPvF+wiIK0yOsNb9426iwF2aKh8EQvnw/fwQ0WLyek1Ktq/wL2sjLTc4 wjpvTuV3mrGTfnS36KzenPCJkh9qHpXrwlHF2Vu9VRHYmt2EHqP2g2JMgOWKN1qxGHOL +0SMNCIQ8RBQaRy+z80MT2h+UOmI9uPhQjbj/OcqbbH+UYINhItsg9LwR7PGKfb1Sj7M G+Cd8I7ldDojudd0fRNMhrcw9/gc7HRb8mSQj7JBsxNrvD2PXe2+pa6lQQqAdIqqWYUw SSug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704805114; x=1705409914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QYANYm/flTLm8ltfdyXSV/4KcEiWh8iO47/Oolwzemw=; b=SN0xVnkK9wdwcJubLIiH9grRfk4f2+GpGFd9JC5gAC+TAtz9di6MiswxYfz/pdy1JO 8AxM1exbALnjv3Xcf4Iwa4hyXv2Ob52UlPZxjxbx7llMoXSdFIAuyRx8fzVcB25Oa6tj 0V8dN1THKJMCslAZVNkE3Uv+lPKjVFrIAuZ+xAWZnCnZtPbwBSzwmEIs5AnUhEDsLAU7 fA/dnWQfXDKWXR/F1ycawdlm0K3iE+2sPPnMt7EWrIZ2XEnDXgoJn9pTblFVh6o53i+7 2ex8Kb+Yp9aMx3FF5wpfzEFvzostjoDphoWPPTEpcnTktcBzXLPJ/6ShbPftNu5l13IL wOcA== X-Gm-Message-State: AOJu0YzyPF9eZ/SAq3A93Is4jkhP15YjwNrJBauB/awV/amW93k7A2Ut m5VpSLl1ahLCV7PTWkjl7j8Uj+g5Rkx9Mw== X-Google-Smtp-Source: AGHT+IGceZtkC0wZrtIHBAy7xlhr33Ldl9WFLcDfsJupgFjb103my2Ayh3FwlSnEldsW+8gESDuUsw== X-Received: by 2002:a5d:55c5:0:b0:337:5d0:1f1a with SMTP id i5-20020a5d55c5000000b0033705d01f1amr478794wrw.66.1704805114750; Tue, 09 Jan 2024 04:58:34 -0800 (PST) Received: from ta2.c.googlers.com.com (88.140.78.34.bc.googleusercontent.com. [34.78.140.88]) by smtp.gmail.com with ESMTPSA id cw16-20020a056000091000b0033753a61e96sm2351302wrb.108.2024.01.09.04.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 04:58:33 -0800 (PST) From: Tudor Ambarus To: peter.griffin@linaro.org, krzysztof.kozlowski+dt@linaro.org, gregkh@linuxfoundation.org Cc: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, conor+dt@kernel.org, andi.shyti@kernel.org, alim.akhtar@samsung.com, jirislaby@kernel.org, s.nawrocki@samsung.com, tomasz.figa@gmail.com, cw00.choi@samsung.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-serial@vger.kernel.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com, Tudor Ambarus Subject: [PATCH v3 04/12] tty: serial: samsung: prepare for different IO types Date: Tue, 9 Jan 2024 12:58:06 +0000 Message-ID: <20240109125814.3691033-5-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240109125814.3691033-1-tudor.ambarus@linaro.org> References: <20240109125814.3691033-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240109_045838_417163_2E3B7A4B X-CRM114-Status: GOOD ( 17.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org GS101's Connectivity Peripheral blocks (peric0/1 blocks) which include the I3C and USI (I2C, SPI, UART) only allow 32-bit register accesses. If using 8-bit register accesses, a SError Interrupt is raised causing the system unusable. Instead of specifying the reg-io-width = 4 everywhere, for each node, the requirement should be deduced from the compatible. Prepare the samsung tty driver to allow IO types different than UPIO_MEM. ``struct uart_port::iotype`` is an unsigned char where all its 8 bits are exposed to uapi. We can't make NULL checks on it to verify if it's set, thus always set it from the driver's data. Use u8 for the ``iotype`` member of ``struct s3c24xx_uart_info`` to emphasize that the iotype is an 8 bit mask. Signed-off-by: Tudor Ambarus Reviewed-by: Krzysztof Kozlowski Reviewed-by: Sam Protsenko --- v3: - reposition the ``iotype`` member of ``struct s3c24xx_uart_info`` so that we reduce the struct's memory footprint. - change ``iotype`` to u8 to emphasize that it's a 8 bit mask and update the commit message explaining why. v2: new patch drivers/tty/serial/samsung_tty.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 66bd6c090ace..ff646cddd3f8 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -84,6 +84,7 @@ struct s3c24xx_uart_info { unsigned long clksel_mask; unsigned long clksel_shift; unsigned long ucon_mask; + u8 iotype; /* uart port features */ @@ -1742,7 +1743,6 @@ static void s3c24xx_serial_init_port_default(int index) { spin_lock_init(&port->lock); - port->iotype = UPIO_MEM; port->uartclk = 0; port->fifosize = 16; port->flags = UPF_BOOT_AUTOCONF; @@ -1989,6 +1989,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) break; } + ourport->port.iotype = ourport->info->iotype; + if (np) { of_property_read_u32(np, "samsung,uart-fifosize", &ourport->port.fifosize); @@ -2401,6 +2403,7 @@ static const struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { .name = "Samsung S3C6400 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, + .iotype = UPIO_MEM, .fifosize = 64, .has_divslot = 1, .rx_fifomask = S3C2440_UFSTAT_RXMASK, @@ -2430,6 +2433,7 @@ static const struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .name = "Samsung S5PV210 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, + .iotype = UPIO_MEM, .has_divslot = 1, .rx_fifomask = S5PV210_UFSTAT_RXMASK, .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, @@ -2459,6 +2463,7 @@ static const struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .name = "Samsung Exynos UART", \ .type = TYPE_S3C6400, \ .port_type = PORT_S3C6400, \ + .iotype = UPIO_MEM, \ .has_divslot = 1, \ .rx_fifomask = S5PV210_UFSTAT_RXMASK, \ .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, \ @@ -2519,6 +2524,7 @@ static const struct s3c24xx_serial_drv_data s5l_serial_drv_data = { .name = "Apple S5L UART", .type = TYPE_APPLE_S5L, .port_type = PORT_8250, + .iotype = UPIO_MEM, .fifosize = 16, .rx_fifomask = S3C2410_UFSTAT_RXMASK, .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT, @@ -2548,6 +2554,7 @@ static const struct s3c24xx_serial_drv_data artpec8_serial_drv_data = { .name = "Axis ARTPEC-8 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, + .iotype = UPIO_MEM, .fifosize = 64, .has_divslot = 1, .rx_fifomask = S5PV210_UFSTAT_RXMASK,