From nobody Thu Dec 25 13:09:40 2025 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF29C4D136 for ; Fri, 19 Jan 2024 10:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705661140; cv=none; b=U1cN/K69R/b0/Tds7HyKh5P2rbYAhl8vRoCi07/mlKd6xI9kBUlzAIbs2U8xIEKYWsu5ytAla4m9U7b6NP+K0GfEeQWixoVcrFtITo4Shy151T7eaVDqxNwkChejhEf38d59z1brsTmrXMp2mCJ8ZaVtDw4uEPvnQA3MG2BiSIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705661140; c=relaxed/simple; bh=oEYUcOy19JcxG6WXptwvlTUqdV/Cr+vl3K7z1gXFbpw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ey2T0STwxP5TYq0kvSTOiiMi7XuI//TzDIewl9wr59ZsEa8FOThEwqKmB1qzsCbGASwbPHvP2W+l64TSFOVh8xqUNZxX2ZdCSMAScZ5tgC2S1vUNyK4ateZB563YKUv/1lsPDoEcVdJYzsdrZIDoUhkF4CtI1MrTVFTLXtPANkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=l1h1Iocs; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l1h1Iocs" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-40e80046264so7274435e9.0 for ; Fri, 19 Jan 2024 02:45:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705661137; x=1706265937; darn=vger.kernel.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=draq2LBr3rh1hsqpn+xELW8VPhSh6bMilJxVO89mlwc=; b=l1h1IocsTOTGdlOQJe84x3IbnwLm2iB2j7LJn5FB4Pibp8Mop8bOIBKSEANH67jjX7 ygY1zSd25caagYGFV/VNRL7JCOIbGHTF2fXThlN5GImLwHnVh+8u31NNe98qlqCAd+Q4 g0UEIKUhD6IllYIo7Z+VYoDBwFp+eZotv8jegf7AIOGFPT5W53yAsbqkdh8huV/kxfng EuTSr92MAfnn0tJXiUt7/z+AsbrwGtDigdb0iRwPU0eOKep2Kt65mDzCQSY9RFUI+ifV tJnZKr5px653PYILJH7+U0+S62dAX35Y83h7TbGYEJtkiGduk+ATvRBIrVTrl23LMiS3 6hkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705661137; x=1706265937; 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=draq2LBr3rh1hsqpn+xELW8VPhSh6bMilJxVO89mlwc=; b=NE9t6KiZOJCPS/enOuuBt7oJiuA6mySkw/cAhNKRBD1AhkSDX/IYpVayow/uy1P1SW LnWHUltS+GeitpagEtTG+b94F9blq3ME+Vlb6o8DVED/rEvHuAA9R4fkL8eThXljKuYi sj8l9bn9ShJqsYc7NoHDKN4u0inub+lbUVLQzTVSLhpfevvwXD9E4uMo5XtcWPN7rpk6 55CtzEHInck6wmDUnVFHdDPw7q/VQ+/KLKL4fZ6Nrzwcgy30IjP4H+oiedBdX4+War1f sv5/qLKeZmYnr2032vyPv3aHYSyMn+QkZv7hq48u5Ql11OuiLAKNFVUvDh/9Xu/SzIrP rQbA== X-Gm-Message-State: AOJu0Yx4b4t5shXzrys3roPuomDrT+B0LVCxc1+pBsoEw15S4LUcKC91 EVBV/dYs0aeVauG3sdLri0mu5l+odBrtC8Yaz8gm5E7kJcUDk8OpjAWdfBPSezQ= X-Google-Smtp-Source: AGHT+IGpcApyIWJFtLX0iIOlhoAeQ17PNEjsoOdq7qV3HI9GzWTu3avyi91tcVAFJS0Xme35Yc5gZg== X-Received: by 2002:a05:600c:524a:b0:40d:8815:afff with SMTP id fc10-20020a05600c524a00b0040d8815afffmr1597586wmb.39.1705661136915; Fri, 19 Jan 2024 02:45:36 -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 fm16-20020a05600c0c1000b0040ea10178f3sm77470wmb.21.2024.01.19.02.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 02:45:36 -0800 (PST) From: Tudor Ambarus To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, andre.draszik@linaro.org, kernel-team@android.com, peter.griffin@linaro.org, semen.protsenko@linaro.org, willmcvicker@google.com, Tudor Ambarus Subject: [PATCH v2 08/19] tty: serial: samsung: use u32 for register interactions Date: Fri, 19 Jan 2024 10:45:15 +0000 Message-ID: <20240119104526.1221243-9-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240119104526.1221243-1-tudor.ambarus@linaro.org> References: <20240119104526.1221243-1-tudor.ambarus@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" All registers of the IP have 32 bits. Use u32 variables when reading or writing from/to the registers. The purpose of those variables becomes clearer. Reviewed-by: Sam Protsenko Signed-off-by: Tudor Ambarus --- drivers/tty/serial/samsung_tty.c | 79 ++++++++++++++++---------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_= tty.c index b9b91ff6a1d7..8b396c950933 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -199,7 +199,7 @@ static void wr_reg(const struct uart_port *port, u32 re= g, u32 val) /* Byte-order aware bit setting/clearing functions. */ =20 static inline void s3c24xx_set_bit(const struct uart_port *port, int idx, - unsigned int reg) + u32 reg) { unsigned long flags; u32 val; @@ -212,7 +212,7 @@ static inline void s3c24xx_set_bit(const struct uart_po= rt *port, int idx, } =20 static inline void s3c24xx_clear_bit(const struct uart_port *port, int idx, - unsigned int reg) + u32 reg) { unsigned long flags; u32 val; @@ -245,8 +245,8 @@ static void s3c24xx_serial_rx_enable(struct uart_port *= port) { struct s3c24xx_uart_port *ourport =3D to_ourport(port); unsigned long flags; - unsigned int ucon, ufcon; int count =3D 10000; + u32 ucon, ufcon; =20 uart_port_lock_irqsave(port, &flags); =20 @@ -269,7 +269,7 @@ static void s3c24xx_serial_rx_disable(struct uart_port = *port) { struct s3c24xx_uart_port *ourport =3D to_ourport(port); unsigned long flags; - unsigned int ucon; + u32 ucon; =20 uart_port_lock_irqsave(port, &flags); =20 @@ -591,7 +591,7 @@ static inline const struct s3c2410_uartcfg } =20 static int s3c24xx_serial_rx_fifocnt(const struct s3c24xx_uart_port *ourpo= rt, - unsigned long ufstat) + u32 ufstat) { const struct s3c24xx_uart_info *info =3D ourport->info; =20 @@ -663,7 +663,7 @@ static void s3c64xx_start_rx_dma(struct s3c24xx_uart_po= rt *ourport) static void enable_rx_dma(struct s3c24xx_uart_port *ourport) { struct uart_port *port =3D &ourport->port; - unsigned int ucon; + u32 ucon; =20 /* set Rx mode to DMA mode */ ucon =3D rd_regl(port, S3C2410_UCON); @@ -686,7 +686,7 @@ static void enable_rx_dma(struct s3c24xx_uart_port *our= port) static void enable_rx_pio(struct s3c24xx_uart_port *ourport) { struct uart_port *port =3D &ourport->port; - unsigned int ucon; + u32 ucon; =20 /* set Rx mode to DMA mode */ ucon =3D rd_regl(port, S3C2410_UCON); @@ -711,13 +711,14 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24= xx_uart_port *ourport); =20 static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id) { - unsigned int utrstat, received; struct s3c24xx_uart_port *ourport =3D dev_id; struct uart_port *port =3D &ourport->port; struct s3c24xx_uart_dma *dma =3D ourport->dma; struct tty_struct *tty =3D tty_port_tty_get(&ourport->port.state->port); struct tty_port *t =3D &port->state->port; struct dma_tx_state state; + unsigned int received; + u32 utrstat; =20 utrstat =3D rd_regl(port, S3C2410_UTRSTAT); rd_regl(port, S3C2410_UFSTAT); @@ -759,9 +760,9 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(void *de= v_id) static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport) { struct uart_port *port =3D &ourport->port; - unsigned int ufcon, ufstat, uerstat; unsigned int fifocnt =3D 0; int max_count =3D port->fifosize; + u32 ufcon, ufstat, uerstat; u8 ch, flag; =20 while (max_count-- > 0) { @@ -945,7 +946,7 @@ static irqreturn_t s3c64xx_serial_handle_irq(int irq, v= oid *id) { const struct s3c24xx_uart_port *ourport =3D id; const struct uart_port *port =3D &ourport->port; - unsigned int pend =3D rd_regl(port, S3C64XX_UINTP); + u32 pend =3D rd_regl(port, S3C64XX_UINTP); irqreturn_t ret =3D IRQ_HANDLED; =20 if (pend & S3C64XX_UINTM_RXD_MSK) { @@ -964,7 +965,7 @@ static irqreturn_t apple_serial_handle_irq(int irq, voi= d *id) { const struct s3c24xx_uart_port *ourport =3D id; const struct uart_port *port =3D &ourport->port; - unsigned int pend =3D rd_regl(port, S3C2410_UTRSTAT); + u32 pend =3D rd_regl(port, S3C2410_UTRSTAT); irqreturn_t ret =3D IRQ_NONE; =20 if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO)) { @@ -983,8 +984,8 @@ static irqreturn_t apple_serial_handle_irq(int irq, voi= d *id) static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port) { const struct s3c24xx_uart_info *info =3D s3c24xx_port_to_info(port); - unsigned long ufstat =3D rd_regl(port, S3C2410_UFSTAT); - unsigned long ufcon =3D rd_regl(port, S3C2410_UFCON); + u32 ufstat =3D rd_regl(port, S3C2410_UFSTAT); + u32 ufcon =3D rd_regl(port, S3C2410_UFCON); =20 if (ufcon & S3C2410_UFCON_FIFOMODE) { if ((ufstat & info->tx_fifomask) !=3D 0 || @@ -999,7 +1000,7 @@ static unsigned int s3c24xx_serial_tx_empty(struct uar= t_port *port) /* no modem control lines */ static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port) { - unsigned int umstat =3D rd_reg(port, S3C2410_UMSTAT); + u32 umstat =3D rd_reg(port, S3C2410_UMSTAT); =20 if (umstat & S3C2410_UMSTAT_CTS) return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; @@ -1009,8 +1010,8 @@ static unsigned int s3c24xx_serial_get_mctrl(struct u= art_port *port) =20 static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int = mctrl) { - unsigned int umcon =3D rd_regl(port, S3C2410_UMCON); - unsigned int ucon =3D rd_regl(port, S3C2410_UCON); + u32 umcon =3D rd_regl(port, S3C2410_UMCON); + u32 ucon =3D rd_regl(port, S3C2410_UCON); =20 if (mctrl & TIOCM_RTS) umcon |=3D S3C2410_UMCOM_RTS_LOW; @@ -1030,7 +1031,7 @@ static void s3c24xx_serial_set_mctrl(struct uart_port= *port, unsigned int mctrl) static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_sta= te) { unsigned long flags; - unsigned int ucon; + u32 ucon; =20 uart_port_lock_irqsave(port, &flags); =20 @@ -1188,7 +1189,7 @@ static void apple_s5l_serial_shutdown(struct uart_por= t *port) { struct s3c24xx_uart_port *ourport =3D to_ourport(port); =20 - unsigned int ucon; + u32 ucon; =20 ucon =3D rd_regl(port, S3C2410_UCON); ucon &=3D ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK | @@ -1214,7 +1215,7 @@ static int s3c64xx_serial_startup(struct uart_port *p= ort) { struct s3c24xx_uart_port *ourport =3D to_ourport(port); unsigned long flags; - unsigned int ufcon; + u32 ufcon; int ret; =20 wr_regl(port, S3C64XX_UINTM, 0xf); @@ -1259,7 +1260,7 @@ static int apple_s5l_serial_startup(struct uart_port = *port) { struct s3c24xx_uart_port *ourport =3D to_ourport(port); unsigned long flags; - unsigned int ufcon; + u32 ufcon; int ret; =20 wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_ALL_FLAGS); @@ -1344,7 +1345,7 @@ static void s3c24xx_serial_pm(struct uart_port *port,= unsigned int level, static inline int s3c24xx_serial_getsource(struct uart_port *port) { const struct s3c24xx_uart_info *info =3D s3c24xx_port_to_info(port); - unsigned int ucon; + u32 ucon; =20 if (info->num_clks =3D=3D 1) return 0; @@ -1358,7 +1359,7 @@ static void s3c24xx_serial_setsource(struct uart_port= *port, unsigned int clk_sel) { const struct s3c24xx_uart_info *info =3D s3c24xx_port_to_info(port); - unsigned int ucon; + u32 ucon; =20 if (info->num_clks =3D=3D 1) return; @@ -1475,9 +1476,8 @@ static void s3c24xx_serial_set_termios(struct uart_po= rt *port, struct clk *clk =3D ERR_PTR(-EINVAL); unsigned long flags; unsigned int baud, quot, clk_sel =3D 0; - unsigned int ulcon; - unsigned int umcon; unsigned int udivslot =3D 0; + u32 ulcon, umcon; =20 /* * We don't support modem control lines. @@ -1759,7 +1759,7 @@ static void s3c24xx_serial_resetport(struct uart_port= *port, const struct s3c2410_uartcfg *cfg) { const struct s3c24xx_uart_info *info =3D s3c24xx_port_to_info(port); - unsigned long ucon =3D rd_regl(port, S3C2410_UCON); + u32 ucon =3D rd_regl(port, S3C2410_UCON); =20 ucon &=3D (info->clksel_mask | info->ucon_mask); wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); @@ -1905,7 +1905,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_ua= rt_port *ourport, wr_regl(port, S3C64XX_UINTSP, 0xf); break; case TYPE_APPLE_S5L: { - unsigned int ucon; + u32 ucon; =20 ucon =3D rd_regl(port, S3C2410_UCON); ucon &=3D ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK | @@ -2109,7 +2109,7 @@ static int s3c24xx_serial_resume_noirq(struct device = *dev) /* restore IRQ mask */ switch (ourport->info->type) { case TYPE_S3C6400: { - unsigned int uintm =3D 0xf; + u32 uintm =3D 0xf; =20 if (ourport->tx_enabled) uintm &=3D ~S3C64XX_UINTM_TXD_MSK; @@ -2125,7 +2125,7 @@ static int s3c24xx_serial_resume_noirq(struct device = *dev) break; } case TYPE_APPLE_S5L: { - unsigned int ucon; + u32 ucon; int ret; =20 ret =3D clk_prepare_enable(ourport->clk); @@ -2187,10 +2187,10 @@ static const struct dev_pm_ops s3c24xx_serial_pm_op= s =3D { static struct uart_port *cons_uart; =20 static int -s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon) +s3c24xx_serial_console_txrdy(struct uart_port *port, u32 ufcon) { const struct s3c24xx_uart_info *info =3D s3c24xx_port_to_info(port); - unsigned long ufstat, utrstat; + u32 ufstat, utrstat; =20 if (ufcon & S3C2410_UFCON_FIFOMODE) { /* fifo mode - check amount of data in fifo registers... */ @@ -2206,7 +2206,7 @@ s3c24xx_serial_console_txrdy(struct uart_port *port, = unsigned int ufcon) } =20 static bool -s3c24xx_port_configured(unsigned int ucon) +s3c24xx_port_configured(u32 ucon) { /* consider the serial port configured if the tx/rx mode set */ return (ucon & 0xf) !=3D 0; @@ -2221,7 +2221,7 @@ s3c24xx_port_configured(unsigned int ucon) static int s3c24xx_serial_get_poll_char(struct uart_port *port) { const struct s3c24xx_uart_port *ourport =3D to_ourport(port); - unsigned int ufstat; + u32 ufstat; =20 ufstat =3D rd_regl(port, S3C2410_UFSTAT); if (s3c24xx_serial_rx_fifocnt(ourport, ufstat) =3D=3D 0) @@ -2233,8 +2233,8 @@ static int s3c24xx_serial_get_poll_char(struct uart_p= ort *port) static void s3c24xx_serial_put_poll_char(struct uart_port *port, unsigned char c) { - unsigned int ufcon =3D rd_regl(port, S3C2410_UFCON); - unsigned int ucon =3D rd_regl(port, S3C2410_UCON); + u32 ufcon =3D rd_regl(port, S3C2410_UFCON); + u32 ucon =3D rd_regl(port, S3C2410_UCON); =20 /* not possible to xmit on unconfigured port */ if (!s3c24xx_port_configured(ucon)) @@ -2250,7 +2250,7 @@ static void s3c24xx_serial_put_poll_char(struct uart_= port *port, static void s3c24xx_serial_console_putchar(struct uart_port *port, unsigned char ch) { - unsigned int ufcon =3D rd_regl(port, S3C2410_UFCON); + u32 ufcon =3D rd_regl(port, S3C2410_UFCON); =20 while (!s3c24xx_serial_console_txrdy(port, ufcon)) cpu_relax(); @@ -2261,7 +2261,7 @@ static void s3c24xx_serial_console_write(struct console *co, const char *s, unsigned int count) { - unsigned int ucon =3D rd_regl(cons_uart, S3C2410_UCON); + u32 ucon =3D rd_regl(cons_uart, S3C2410_UCON); unsigned long flags; bool locked =3D true; =20 @@ -2288,11 +2288,9 @@ s3c24xx_serial_get_options(struct uart_port *port, i= nt *baud, int *parity, int *bits) { struct clk *clk; - unsigned int ulcon; - unsigned int ucon; - unsigned int ubrdiv; unsigned long rate; unsigned int clk_sel; + u32 ulcon, ucon, ubrdiv; char clk_name[MAX_CLK_NAME_LENGTH]; =20 ulcon =3D rd_regl(port, S3C2410_ULCON); @@ -2742,7 +2740,8 @@ static int samsung_early_read(struct console *con, ch= ar *s, unsigned int n) { struct earlycon_device *dev =3D con->data; const struct samsung_early_console_data *data =3D dev->port.private_data; - int ch, ufstat, num_read =3D 0; + int num_read =3D 0; + u32 ch, ufstat; =20 while (num_read < n) { ufstat =3D rd_regl(&dev->port, S3C2410_UFSTAT); --=20 2.43.0.429.g432eaa2c6b-goog