From patchwork Tue Mar 11 03:33:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 872783 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011061.outbound.protection.outlook.com [52.101.65.61]) (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 3DA401991CA; Tue, 11 Mar 2025 03:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741664216; cv=fail; b=oc1nc4HHqHuhySFkbFTVONk9HCfNCUQJx7XS5nwxGS4C56KIH1NHu7lGWiFYq5Su+LlmsRJVsk0AnjU/0nryYWJ6MVDtpuACoPb6fFz9jENJiWgFEdMnLcnCuTJISjaiMc50/mzd6v9hkmIUQn1tul0PwSBPMS0tBKQ/ba+RcqM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741664216; c=relaxed/simple; bh=JisxMN9Zb7FAFGcQ/4J6XLhq1SD6orPrO1vLrTMfXoU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=MpjfCxRd4cv+56r/yYw447xD4OscU59EdsJ4+YvkBsDDnuj/QsgsL7Cxw0UpDmLEGmlApK6JkKhO4VnKULfjirU/YoFV0t+fIkpPeGENVTed86ZTrZF6TsniFweSJtnlSZ0/oS/akmkhp4KGchsD6QcNCRfJgtcnNaA7QO01ykY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=kXuaK7Mk; arc=fail smtp.client-ip=52.101.65.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="kXuaK7Mk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kKSe/4y3oWIrPW1HbHOd8jHbpok2WamolIl1qduto3KL/5IlZ1TCdnHSHrUt9vHeXvW9v2UJrvZ2aMZw6W4UOUE9LNS2AM/l7Q3i2VLRJqYKF7PaMbuip0CCOskzh6LwDc0OcMbEPEdZBYtzIQ5PbTrTERDO9gs37oqxAlSxNOGZZRiRXH2qXtsXk+BgFe3nUgeArxZixYSDrOAtbPUlYWGhKnibo+nxoWLh9zulWS7mIFdO9t+L/LAKBS83tpefyvrmVFVZGy+2aWmx1ljQvBokYhCyeOFiGCXicQEWrN7Me0MkBoJ7LMqYrKFTjLqJh8PdS2wt5wuTf4iYNMqnnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wiej7i9634pkPg0VRODoO2s31a/t9mAEBo65axHF9+Q=; b=FGv9T5kGFkQC32EvE38E3Xo7CpwChCmskFJNOjzxyLB01zkvmVDd4aVbF5PGw7GLgM6+Zm0ycNf4S4+YmgNGV0XYEXmzwSCj4R3xoGyIgfibzweFn2mp9+I/womuNjKZ94VLvJID9F+15N91J5BCvVOBztrPJI95IFxnGhPNu37kAQ7u7Ji4BqhSmlX6VR/tt6Bgnxj46oSW3n1ykBDIx0b6nYa7mXrbTALTTVR9WfmwjpBXab4Xk8wsKz+vOtmTeHZjECFdcHuhhFf7haojiVDd7cmYPbu977BCoMR5lEhW6g82Lsu4PrpybaIZHj/obXIQhaPsd/LuemMHFXutOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wiej7i9634pkPg0VRODoO2s31a/t9mAEBo65axHF9+Q=; b=kXuaK7MkVSZPtaKG4v8wsXzv+2KaDruRGK3Bw9llxjxrRdt7GEYB2ycgomfKIjyKl8yDppDC60jyUVFKLnyd1UeHoHKVsG4tOOpOuM7YBVpW8cplGQmUTVctOnG/iCLMRL4aAIH8E1kbtuq8EAHeqvdDn5rpqmfHL/jZSOWJEDEnqyRS77tL4fIQifT8QvfBXbd8Z36QeA3dVouF+rJlEW7ymSHXYj3XQyiSMJC6LfI0N2pRhDD3S6US+fkTGZcDxLSm1XsykxwJwHQofnmQdRgzQ2APafCOMgZhY3X6S8bw8DGS9arbz9K7EcL17TowTjwP0suvrDQWWgKe+3Z1NA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) by AS1PR04MB9480.eurprd04.prod.outlook.com (2603:10a6:20b:4d6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Tue, 11 Mar 2025 03:36:51 +0000 Received: from DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::2edf:edc4:794f:4e37]) by DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::2edf:edc4:794f:4e37%6]) with mapi id 15.20.8511.026; Tue, 11 Mar 2025 03:36:50 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, shenwei.wang@nxp.com Subject: [PATCH V2 1/3] tty: serial: fsl_lpuart: Use u32 for register variables Date: Tue, 11 Mar 2025 11:33:34 +0800 Message-Id: <20250311033336.1254842-2-sherry.sun@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311033336.1254842-1-sherry.sun@nxp.com> References: <20250311033336.1254842-1-sherry.sun@nxp.com> X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8429:EE_|AS1PR04MB9480:EE_ X-MS-Office365-Filtering-Correlation-Id: f907207a-5d04-4a74-da62-08dd604df52c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: ISjcwTwwYE6B9m18bKhZ2MVZlXuzm0obLpwExgCdykB4tFB972dGRVAcjuiEnx/wd4ANOHJiwq0CPuo657P9XjTa0YfI70WH2EAbacC7s4mgKJ40qYpuXfhwG3F/T865TvJJjRh8pVhOrQ/7Y/wWr/U/6dl+XalicsQExVBHwcNDI2J5ZjZdDuAjz9l6Id5zWKXDlQSy/vr6xxtgMgX1sTVw5CkS1BjK/10kMUQ8r38IYbzl9IOrbuGkbMFpnwgGCaiuopuRdLktaPqnYH62WBeah+gqUlEsH+AnOvhIwUk+0bZRSnMPq0aCfW66CZ8+tBc9UvaLknNw8X9PmfKIzfQWaaSGAHOFVFWkT2ONhjvgwstZq3W74ixonW7pd3FG9kcecgC8v2pR63wWc4ocw+c4sO3r7TEeFvkF/hRxNqWIrfhxdvYKztb1j6KeWc1zimDSPC0N2O3tEgjecI/s+H70t8vf3gAdzVTahk/Sk/K/TCGTKrA0mpUoQ7pNHKQw614rAu4C6SFXtFm1ytp9aTJGlYwJ7V0dnurnfic26a7fb8M7M1Dp64+WyEVf/CkhI2jHYEKDlmy2Uahr/KFn2ZE0tFtKRYfErQrKyYY+gYM1yZuEFGNq9b+BiIjJygkP74NMPq0ZxwL70ofZFPQrodhO2VSCwa6BV+U3/6o3PArVR9veJB8cCs2bsEjThbcq+RdsGYCAyH/7ROd5OFZ6QOpIydxyI5t3ALXGD0fMkIGz6pndiMidjY4epqs02HyTu9q6QRm/bxjkfXxLPGcOxie64DteClqOoNPNVG9gR2eOGSGluokZL4D9AasN5O4J/ZVbEXiLNvYp5yJv5lyRp2dOCOJGar4juIXroBgFC+Nl6TiQc2zn7f7QHgzY1Nmcmjr3iT6jbXGjwmPhrkmj2X3iSE/77mN1WryOenhkV08E7SrW/CvIXeqo6J9EIL8Za43y72t1AiLTWnOCFrYxIALL3SIDvWBOucgsKA8uIUK5ni+gLpgaAqRnwhUxPWoHLTTb3vDnNT/1IznEeLDipNWEtrthk+B5gmbSLm3fZygoO8yXod2V3MlLUkDE+B+GUfOAHAi4djIS46qp2xtYQ86fGz7fy4p99WL/Qs+ToT6n7j7Q02IOlNyDrJ87FpmB9bTXdkcwOM5u86c1Y4n2roNVMev0oiQ7EL949sShj6TgeenFpF8jVHE/CV87gJ4iMBBkGr+3haDJb1Y1RQg0eaU3VctNk7JteecTptiaMY97bRWaulMAsVqb7+d3yTji7YjzR2myncvjyQT2hgmV/i5mVDfAOpRfJnnQwaFmjV/pPenNg/mKai2Ya3zV36KSG+arfqvKTn0cJq9VgBRLHnO+lRsR5DgOP1MYt6Oo63HWW2cWapi2zSWTltHPKX+g/qPZtzpBB3j5yYfyQdEY6h/liA59MJ5xJUFjzWFJyF1QlgBrr8565vZMN/mv/rOZ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB8429.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A8IJdhUD4AKVp9YiarfkSGFBkTI+qmFMoRtM7AStrNCXONEwDT2X7mAeSKdtxH+dNiaQzfhSrUq7YF+08UoxwAAgbyhIMzWCKG7bY66RnhbdTJjo8tYyg6iwVY/DhJEHgC8RK0177wI4mL81rkeNuwiozpiBzFqOkNctoCtxSebd14PXcUkEkC+Ga1lv+WBT9Otubb5+iBdMKfxRG/fFt3g4Q0SrRQ38W7C/2N4IrveTGoyn9Hf0bn5YUJ3iNL7/Nb+pouu+g7DJQZwLahWeCuorrkmfV5qCGLwm9f1UURZqUWUHWyJ12oP3zhhYgOIUsKQQcWk+Rs/oH6gxjf6l8JAVlsiHNa78Cp0iebOo8cSZsctv5h2vEOCqd2kqlHsuYUQ4tG8cb2fAWB1T0i+dvQXi9EiXOOynNbjn/K91VvouBTX+q319+jfYK+Ri9oJOS/VgiWrjfYTq3HNYkinD718PREgAgG5yDQIZ5blVjNI0MpNZ1cF4kLwsslO9VSwV/cClWjcFdKGXZhw92ZjbInU+VDB3AvHch+6100+1gqhrF4dRakrjZv8zAISLm8PGjJ5VyGKyoAuf9YbR4Ci5oYyB2ZLH7Us1upr1EyugauZ8Km1LNs1oB9wahhRnGbd7ysjYu6Xb1wEbN0Gv/oHNfpf5UPgx08Ae1Vm2sGmdUkv1ev7Jfyh97gsPwqnNhXXa1NY+K7edp+K/fOxltpEj5CSqywQTMsLLHeL1P8F2Rp9ljPt60MXPV0ynkuCqAL5QYJ5f5/rHB3k+TjBupLiVEiHXlr9svTCY+J1y57sEp1aF4U3Qp1Aw7ZjKPqV68qGTlhonb+dzi5GwUGpJ5adEfk0ZQ24VGc1AxpjCloUGUaoIkPdNcYp3eEQV/nJiNUSWQyLTJNkhTvorQFR1skcvmpQh/O6m/oI0TXfrWZ5aQ46Mbjgm8fKQXT2qOWYr9ebWcEMkX7VLQ7Y0s0sEM9qqFuY31NSaNg6a2cA2RPMazF+lJTT3ZSuGR5uVlB/ySrkBVl+SbpUi84ASNpxh61fEFJFkdCyTJokwqnHPbvVKIa541xJ2WD0Gk5qiyXZMHb1QelRefUBLUoiXKWdIBjJ9c7X9KaDtIrxftdHKWIbDKS7FOsTr2xj/3mC/5SJwm2dkJdzFy5VkBS8uFvCkHxtM/e66B1z3Xn9RA0pVOZXJH/3Jwqtfv51Ks2KhtP102KO5VeqJJFeIof6QEhLR0Mf6PiBwTQrsgUOH0kCh84J8l4ikt5bfHPlTSOpIogA56066i+hJjhyoag9GU9TP0NYjFi9ZkXoemd/qjMd45xQlWgqpC66Ifwjn4YYE53RPem/lWUj4E9fzDOx6Pja0xDqUks0fShAphovVPwJPnyvUOpciaE0Sy3i2I+Lw99pWdsDCJ1/NmQGI4oU8jgp4Jjc4WsiIO08jUEWv6dSfKz54DohDwZJczYdLTswnbYX6Qk2vLQEZ+sgb3ouALJi7vHmWx+yMPrb1DhEGmHy4FHm+AXKDbOh/7mk6UAhXZIxwVA9AhsiYWliU880zHnKCD55rFeLIsr3s0x9cbZuuqSrK1/LrvJhPyHpWOi3zAuJ0VSNi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f907207a-5d04-4a74-da62-08dd604df52c X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8429.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2025 03:36:50.0604 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: POESk0j99M1jiPZKEf/XNCiQ86WafLmVqQeqrJo+re9RzWOAhFnF1L4lUGbhj4PBRnmumKe0hxfjgS1vA8TOtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9480 Use u32 rather than unsigned long for register variables for clarity and consistency. Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 6b2f3a73a367..29ce9b25b796 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -450,7 +450,7 @@ static void lpuart_stop_tx(struct uart_port *port) static void lpuart32_stop_tx(struct uart_port *port) { - unsigned long temp; + u32 temp; temp = lpuart32_read(port, UARTCTRL); temp &= ~(UARTCTRL_TIE | UARTCTRL_TCIE); @@ -467,7 +467,7 @@ static void lpuart_stop_rx(struct uart_port *port) static void lpuart32_stop_rx(struct uart_port *port) { - unsigned long temp; + u32 temp; temp = lpuart32_read(port, UARTCTRL); lpuart32_write(port, temp & ~UARTCTRL_RE, UARTCTRL); @@ -752,7 +752,7 @@ static inline void lpuart_transmit_buffer(struct lpuart_port *sport) static inline void lpuart32_transmit_buffer(struct lpuart_port *sport) { struct tty_port *tport = &sport->port.state->port; - unsigned long txcnt; + u32 txcnt; unsigned char c; if (sport->port.x_char) { @@ -806,7 +806,7 @@ static void lpuart_start_tx(struct uart_port *port) static void lpuart32_start_tx(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned long temp; + u32 temp; if (sport->lpuart_dma_tx_use) { if (!lpuart_stopped_or_empty(port)) @@ -855,9 +855,9 @@ static unsigned int lpuart32_tx_empty(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned long stat = lpuart32_read(port, UARTSTAT); - unsigned long sfifo = lpuart32_read(port, UARTFIFO); - unsigned long ctrl = lpuart32_read(port, UARTCTRL); + u32 stat = lpuart32_read(port, UARTSTAT); + u32 sfifo = lpuart32_read(port, UARTFIFO); + u32 ctrl = lpuart32_read(port, UARTCTRL); if (sport->dma_tx_in_progress) return 0; @@ -961,7 +961,7 @@ static void lpuart32_rxint(struct lpuart_port *sport) { unsigned int flg, ignored = 0; struct tty_port *port = &sport->port.state->port; - unsigned long rx, sr; + u32 rx, sr; bool is_break; uart_port_lock(&sport->port); @@ -1113,7 +1113,7 @@ static void lpuart_copy_rx_to_tty(struct lpuart_port *sport) int count, copied; if (lpuart_is_32(sport)) { - unsigned long sr = lpuart32_read(&sport->port, UARTSTAT); + u32 sr = lpuart32_read(&sport->port, UARTSTAT); if (sr & (UARTSTAT_PE | UARTSTAT_FE)) { /* Clear the error flags */ @@ -1279,7 +1279,7 @@ static void lpuart32_dma_idleint(struct lpuart_port *sport) static irqreturn_t lpuart32_int(int irq, void *dev_id) { struct lpuart_port *sport = dev_id; - unsigned long sts, rxcount; + u32 sts, rxcount; sts = lpuart32_read(&sport->port, UARTSTAT); rxcount = lpuart32_read(&sport->port, UARTWATER); @@ -1411,12 +1411,12 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) dma_async_issue_pending(chan); if (lpuart_is_32(sport)) { - unsigned long temp = lpuart32_read(&sport->port, UARTBAUD); + u32 temp = lpuart32_read(&sport->port, UARTBAUD); lpuart32_write(&sport->port, temp | UARTBAUD_RDMAE, UARTBAUD); if (sport->dma_idle_int) { - unsigned long ctrl = lpuart32_read(&sport->port, UARTCTRL); + u32 ctrl = lpuart32_read(&sport->port, UARTCTRL); lpuart32_write(&sport->port, ctrl | UARTCTRL_ILIE, UARTCTRL); } @@ -1482,7 +1482,7 @@ static int lpuart32_config_rs485(struct uart_port *port, struct ktermios *termio struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned long modem = lpuart32_read(&sport->port, UARTMODIR) + u32 modem = lpuart32_read(&sport->port, UARTMODIR) & ~(UARTMODIR_TXRTSPOL | UARTMODIR_TXRTSE); u32 ctrl; @@ -1589,7 +1589,7 @@ static void lpuart_break_ctl(struct uart_port *port, int break_state) static void lpuart32_break_ctl(struct uart_port *port, int break_state) { - unsigned long temp; + u32 temp; temp = lpuart32_read(port, UARTCTRL); @@ -1668,8 +1668,7 @@ static void lpuart_setup_watermark_enable(struct lpuart_port *sport) static void lpuart32_setup_watermark(struct lpuart_port *sport) { - unsigned long val, ctrl; - unsigned long ctrl_saved; + u32 val, ctrl, ctrl_saved; ctrl = lpuart32_read(&sport->port, UARTCTRL); ctrl_saved = ctrl; @@ -1848,7 +1847,7 @@ static int lpuart_startup(struct uart_port *port) static void lpuart32_hw_disable(struct lpuart_port *sport) { - unsigned long temp; + u32 temp; temp = lpuart32_read(&sport->port, UARTCTRL); temp &= ~(UARTCTRL_RIE | UARTCTRL_ILIE | UARTCTRL_RE | @@ -1858,7 +1857,7 @@ static void lpuart32_hw_disable(struct lpuart_port *sport) static void lpuart32_configure(struct lpuart_port *sport) { - unsigned long temp; + u32 temp; temp = lpuart32_read(&sport->port, UARTCTRL); if (!sport->lpuart_dma_rx_use) @@ -1888,7 +1887,7 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) static int lpuart32_startup(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned long temp; + u32 temp; /* determine FIFO size */ temp = lpuart32_read(&sport->port, UARTFIFO); @@ -1962,7 +1961,7 @@ static void lpuart32_shutdown(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned long temp; + u32 temp; unsigned long flags; uart_port_lock_irqsave(port, &flags); @@ -2236,7 +2235,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); unsigned long flags; - unsigned long ctrl, old_ctrl, bd, modem; + u32 ctrl, old_ctrl, bd, modem; unsigned int baud; unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; @@ -2533,7 +2532,7 @@ static void lpuart32_console_write(struct console *co, const char *s, unsigned int count) { struct lpuart_port *sport = lpuart_ports[co->index]; - unsigned long old_cr, cr; + u32 old_cr, cr; unsigned long flags; int locked = 1; @@ -2616,7 +2615,7 @@ static void __init lpuart32_console_get_options(struct lpuart_port *sport, int *baud, int *parity, int *bits) { - unsigned long cr, bd; + u32 cr, bd; unsigned int sbr, uartclk, baud_raw; cr = lpuart32_read(&sport->port, UARTCTRL); @@ -2822,7 +2821,7 @@ static int lpuart_global_reset(struct lpuart_port *sport) { struct uart_port *port = &sport->port; void __iomem *global_addr; - unsigned long ctrl, bd; + u32 ctrl, bd; unsigned int val = 0; int ret; @@ -3028,7 +3027,7 @@ static int lpuart_runtime_resume(struct device *dev) static void serial_lpuart_enable_wakeup(struct lpuart_port *sport, bool on) { - unsigned int val, baud; + u32 val, baud; if (lpuart_is_32(sport)) { val = lpuart32_read(&sport->port, UARTCTRL); @@ -3093,7 +3092,7 @@ static int lpuart_suspend_noirq(struct device *dev) static int lpuart_resume_noirq(struct device *dev) { struct lpuart_port *sport = dev_get_drvdata(dev); - unsigned int val; + u32 val; pinctrl_pm_select_default_state(dev); @@ -3113,7 +3112,8 @@ static int lpuart_resume_noirq(struct device *dev) static int lpuart_suspend(struct device *dev) { struct lpuart_port *sport = dev_get_drvdata(dev); - unsigned long temp, flags; + u32 temp; + unsigned long flags; uart_suspend_port(&lpuart_reg, &sport->port); From patchwork Tue Mar 11 03:33:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 874343 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011061.outbound.protection.outlook.com [52.101.65.61]) (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 B24D61E3DC4; Tue, 11 Mar 2025 03:36:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741664219; cv=fail; b=u4vv9NjWoRvU/T9kFIH5zIm1g74P/EAPVL3roZ7n7suV3YoojK4yS+pNuTb6W1odAwHMBky/nO623R+YxobETP4PNQ0nTUCXoXy7IoDMLKdQ+Kj6eRfLqci3CqgONUU7ToAw1pd8I6grSAYpohkO7g+Jg2XivsXd0mhJYIRNZAQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741664219; c=relaxed/simple; bh=OraOtfrNs3/IB4HX5vjr43b/E24RmkpHPKHmGp3AYos=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Olqs50V3+zjE1b/kM57YfljEATimsbW0ILq4mrCQnmW6TCiDQ61Ilkeim06pWkQ9cA2CgXBXi35zp310KBEBVyrhvBf5UYI1SfwP4by7agoCwd1Jj9yxn5U9gg5CHKLQgwjez38V0CC6d2p5Yb7BoxfVyk4uh5Z4BceEjvMq2tY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Y4jjgisJ; arc=fail smtp.client-ip=52.101.65.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Y4jjgisJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XPmgqrWA7ocDaFF3N66Xpv7yPOIiKCCx83fETmJuOaBe+2ZuPmH0/NSWwc8s+bd4wUelc3i8IVFtZ92leQdbI+XAQkHab6/cX3+8vv6EB8xTy6VwwhxRWsQCy7Dyugq1sW7jUrUanq/uOMSZU0fvcsx97fmgk9yz7NO4FOK3H1NJA6hfIkZ+4MRhkjlq5toSC22V2KhSqiDkvqon73o91fpUTFIqaLBMLwhSPR8uHMBjjBZMNRn2Gx/69DpNmSiV8MF4Ou3wTZxWzZdt0q5PA31/U/JiP+r0TrMkrVgpSE0dc5O1KsmjUNMoS19mVNdRxWHyFLxKxMtre2cYria4zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qSbJ4osvESbe58shnoNOa7BwDukru3dPvBnylP6A4SI=; b=VlR8arohBmUrgTO8Q0fHYOGmJ2Gnv7VNEiTVnanscyd+ilvkk+ByX+NoUBDuELytHO+cu8slwOhXTGThLL1SKe0hFPPKMq5q2PmcDHWTqcsdTKUup0CRKT9QR4efoD7/RAa5PliGKRcQ8r/ueXLrsH0xwjn/kpfhwYnyMdvQV7kaFTJ+Mn+TMusbsHXinH1RSfJ8sAh7O6AA7JFVmuBDOI7IWBN1Iw1gznFaBg1ddq0hVS7WCO2Vt60STXBAVFj4Rws4MDXSKXL53lEHQH7q08SofKDhD7YiFxTP/yZW0ABrW520FxcuIwGvI+JQB355yRDBCSkOkrxNWQME07I36g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qSbJ4osvESbe58shnoNOa7BwDukru3dPvBnylP6A4SI=; b=Y4jjgisJwe6JWEDkaIG13PkQiBHlZXnXjw+zOxRTpxYK33f26bS3MRTiLo6lZkTEga9mJ1KpHJAjAkxLJKHa9gxax8hSnPmqDcAP0OO+InIYJjTnarOHpAVSwjQox6cllx3LHoef95Nsicz9uPUp0QZxh4X+SzrviOKGRC0yHLH5zPVYDmv1GroC5LIm2r/JQ8NltJ44tcq93cgdM9lC2++9MoTZTCqo0W2LVQ2ncNjtZOjIW4scesrZQafFsduTj58vT31XV/THogA1jwM4nTJSIp5gSsKXYJYpkmd7FKbpJ3ah2w4eNSnGX4KDjUrA0dLErNBgZXsqi87wNLMiDg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) by AS1PR04MB9480.eurprd04.prod.outlook.com (2603:10a6:20b:4d6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Tue, 11 Mar 2025 03:36:54 +0000 Received: from DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::2edf:edc4:794f:4e37]) by DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::2edf:edc4:794f:4e37%6]) with mapi id 15.20.8511.026; Tue, 11 Mar 2025 03:36:54 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, shenwei.wang@nxp.com Subject: [PATCH V2 2/3] tty: serial: fsl_lpuart: use port struct directly to simply code Date: Tue, 11 Mar 2025 11:33:35 +0800 Message-Id: <20250311033336.1254842-3-sherry.sun@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311033336.1254842-1-sherry.sun@nxp.com> References: <20250311033336.1254842-1-sherry.sun@nxp.com> X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8429:EE_|AS1PR04MB9480:EE_ X-MS-Office365-Filtering-Correlation-Id: 009d9ad1-82de-4c04-9379-08dd604df7b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: LE3Fjfh+MeRIUM2UH3mbUZehzXoH0FDU5qw78aHoORpU5FpMwVPSL/ztJXO2uykdoTFz0xZQlx21R+oR/Q8PJ1GktZyYJdNC6J0iaQPj2h0S425zYXsW6Dr25TGNQPlRHHGNCj3a2NZIds1ktL45jOm4IlT5P1lCYYBftzRAbkXEo8gh8q3gFHya20ah4Jdqfzfdq7WIDY6Urk3DV8g9aP8ndkYpX1S6U4P+XjS0eviDaSeWimE6A0eHe9Jsq2uexqlcICvyNRpbhrwmFRk/dWRer4ASv1iDwkqXWKH4+UgfnejizQgWBIDLGyjvStmIFAIDeu8guhrSyvKaJ0iRP1s+PT4+Zp7NA0fOI+LY/mEbS5ghFS9LukVK08tNGzs9tB1GoyXjsRu1F+2+Lr7lF7cugS6b2y9rTDj3qR4W0oau7AFrjG0vMJ0UnWRlK68OIxdacf2KQ+WHf6KFrefiKl//Cmx6HEZ4xU6qmdoXHOy7znTRXYCgzbIm28xI17Jer15agyhKWdNS4D5OSMAWWcBYtLFm9+q+XNHLjIpPT9t5lCpnopeh69Y6I1snjwaKRhn8KGzbdjxRh3YyvPsfG0FyImTZoouR/5Tao40B8GM5X5WHIxZwcJu+9U8xza0PFnthm4Lz74TPp2a2Q44oikWyAAbTqvUsDVPDxYiObgmHxaNnDk3AmvOh8nLH09mNBwRV4nwaPgLF3QXtcAMI5pDFHHvNPpiy7MPkw8ZdwFDYi8yp0oaxyjut8TIno/cwaa6awkjB8iFF5akacLhCsOedHMHlMU4gEFLXoVEg4dcGAauuQKEWO+nIosIYswW8hWAxYx2scat4105O2APHQ7sEuxN3hXS2f3lkUyL5qsVv543LQ4bIkwjQtsp0p4hMONEYZWp0APqZEzic2IOvV/kmi9g3zPeFJBUh+fQwldGW6tueAeuTRHpvauvI/Y71V6QUTsdSRyL2KYidUntQYFqz2pAwGu45DkrkMqcoyjN9RARqQljG5TW9EbnBCitQZJgjfV7iKQyptCC3JjbYS6/s7cqJtsnC+x8Zki0ZZ/rOsDqYHhC/qzihxbUYhqk9q1ya7dMLEsGcT+Nit51UGGk5JPvHEWZ3GTnrwXpLk8mdjbaYKjwDLF8zlqN8bdHSoSJ8koSL5bBq4B8s6Xk1aECvWpYuzVkaCc/yTHYsVBt2nfXCraZsjaYDsF8ocAx46kWAu+ZCSlCtjAGBruhr1pBL5p86dfonqNZ/8Ez1X9YMuWRrW0mupYdFyBPEYGmoTAlJYsYd5ZD2WBbt2idydNhKRYeTHSDBtRyPOWgr203DAAqX14imVjITaey4wbPXZs23+Zisbk+zb1a7Sdkx1BiEOIpl73Gs7k+nSxO6IWoLQelN58J58lqVXDvhkICwvr2RCxmR+mk2vHHqGauywAlOSZy+2ShE1TFAxiHYEPeV3RbDUlhI9iv7Oc47Ng7C X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB8429.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uKtblF/vrWMyajbqJNlalJXA81iRQAx0SlXamMgOAvqp610YTCW3ljlmI1xHcw7yepDJquBj8J/TNKNlHjx9flVtpyft+tks68g9IDbZNqHLu3GwtYoF8IVKQ2DISaNHB3pEgi8LeauvzJNoTdfVuYtWmteaYq4WWHJsEChH7AJTeHRV4qs5MzA3jeDs4puzoc9tRg8oivrXKXZi3HSYgGwC8Jjgos3bj4MPHxIsNzwnmDc9HZBeppnfTnQGqfXlBNmw7BjpU1QF0HEukbTlXK2PHuNlwnRcPjBVFa2IYc8ZCsi+0GW3MhK7E/h/MZ/8yiWeUE+PnY911KFsvX3WhRvOvba6ezeMmOOfyfvRL/8Gkyt8T7ZGR+GhXUkYyAC4+idY51jW4h4jHhYNPoEFBLurTCh3c7ZIwJM/k4e5i3t1DSTZSt4KJ1xdWcb4BmTrWMpmd76Jn96ClSac6lLW411Wfh/glLm7ncIDgbyU8rYyt/7JmG20K8OsXGArf16nuXPxFyEJOiYv0H605AX8XtuRYPRHgmDurac4B8ay5OUzdcW/UMGPKcexWnMAIfa5cnggJAfAhCtNs5Or3ieeB+u4HWHN7eObt9pksBRtZlENNzKP/930DoraAZEYtXtUV7/6dhsmCA19zr5qXe1ae/sa2zp9QbwGLsEv0BgN7mAntYcfWdI644CqdspiKKqZn03F8nag1susPJYoYYERBOnWOT85O/GqD/0OK3QdE85IsE55AgrQqXflKoTG634LnByBuDxwLzq7hl6xogV5aW/ZP4aznvie36WcDhY3mGy4tJv8Jc7RpNu2FAUSzPaLta7zC3X0s/f3muNg/Xz4G+Zd5SAeaFA7VKVPAOWtzvKZZPXVxu3zuRBxZWcBbHiRCrcNzmGWZCYUyznGPlrauuWS5oiK88MNre3SJD9E0lUfpYRQxp55Wbl5VrqgIv8KgD6Vumsv+mTxzLI8adoFUgpHrFIKd8/es55bZS4ImnX8CY6SkGaTXwhOW930UBzhU4S5hf67iVCKIRONL3y3USejHIpEdFEWO+EG+xRF94lQkKQ3GCDGH/KoM7rXb1p7f4YVecp8OtNglQAL2QUCVYWvFOQGTP3rU7QxKhUAi3yDQxh0kB7x4H7i5Z3Fo5zFjZueLsJ1U5AuourLuBNvhxrlMARpEysLTv6IYL10zMmtJ8n1HCMtMkpEO0ogKeeL8KRe/4iPZ3bcoO3EasyxcS8Hr6hJZF+H0IRYq5CZZFDNuNS3HGg0QMVeTBppHBFNRpSI/8ZJOWJP3Ty2s6JiYeI5ta0WzJwC9KjO7V2eIdzaa3EkjMRRjTjuvuKq7axLyEvDEI4I/OWGZNRLaa0EcuSvmG81JpdPxXh1uFuyOv3HuClNmnK20hUkGr4M3zw89U9ZM6hfe5rFNYQ/n0pfKjQj8GlXV6gBWoaCjY5FVN//aZ5SHoai6XCwZQKPrX0VNh6qaFIVI8K1Ih92tbIR8h1b4isbUm2oUGV/025Co5ylV9GX9qt6bGh9rVx71OmFq0liypKnxMlESu29FC8fcdc++XT6r50Hmg6hY8a/nzIUWPm7NT2bJly+G4kRl6Ee X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 009d9ad1-82de-4c04-9379-08dd604df7b2 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8429.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2025 03:36:54.3618 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a1yn2pZf8kPo1IjHOeqqQVBn7d8DkhcQD1FixeC1Drmwi9JZcoNkIysxDbIII1cBSFpLQGErbJrQkanxG0SQdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9480 Most lpuart functions have the parameter struct uart_port *port, but still use the &sport->port to get the uart_port instead of use it directly, let's simply the code logic, directly use this struct instead of covert it from struct sport. Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 210 ++++++++++++++++---------------- 1 file changed, 102 insertions(+), 108 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 29ce9b25b796..f830b5a3ba8e 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -581,7 +581,7 @@ static int lpuart_dma_tx_request(struct uart_port *port) ret = dmaengine_slave_config(sport->dma_tx_chan, &dma_tx_sconfig); if (ret) { - dev_err(sport->port.dev, + dev_err(port->dev, "DMA slave config failed, err = %d\n", ret); return ret; } @@ -611,13 +611,13 @@ static void lpuart_flush_buffer(struct uart_port *port) } if (lpuart_is_32(sport)) { - val = lpuart32_read(&sport->port, UARTFIFO); + val = lpuart32_read(port, UARTFIFO); val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH; - lpuart32_write(&sport->port, val, UARTFIFO); + lpuart32_write(port, val, UARTFIFO); } else { - val = readb(sport->port.membase + UARTCFIFO); + val = readb(port->membase + UARTCFIFO); val |= UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH; - writeb(val, sport->port.membase + UARTCFIFO); + writeb(val, port->membase + UARTCFIFO); } } @@ -644,33 +644,33 @@ static int lpuart_poll_init(struct uart_port *port) unsigned long flags; unsigned char temp; - sport->port.fifosize = 0; + port->fifosize = 0; - uart_port_lock_irqsave(&sport->port, &flags); + uart_port_lock_irqsave(port, &flags); /* Disable Rx & Tx */ - writeb(0, sport->port.membase + UARTCR2); + writeb(0, port->membase + UARTCR2); - temp = readb(sport->port.membase + UARTPFIFO); + temp = readb(port->membase + UARTPFIFO); /* Enable Rx and Tx FIFO */ writeb(temp | UARTPFIFO_RXFE | UARTPFIFO_TXFE, - sport->port.membase + UARTPFIFO); + port->membase + UARTPFIFO); /* flush Tx and Rx FIFO */ writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH, - sport->port.membase + UARTCFIFO); + port->membase + UARTCFIFO); /* explicitly clear RDRF */ - if (readb(sport->port.membase + UARTSR1) & UARTSR1_RDRF) { - readb(sport->port.membase + UARTDR); - writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO); + if (readb(port->membase + UARTSR1) & UARTSR1_RDRF) { + readb(port->membase + UARTDR); + writeb(UARTSFIFO_RXUF, port->membase + UARTSFIFO); } - writeb(0, sport->port.membase + UARTTWFIFO); - writeb(1, sport->port.membase + UARTRWFIFO); + writeb(0, port->membase + UARTTWFIFO); + writeb(1, port->membase + UARTRWFIFO); /* Enable Rx and Tx */ - writeb(UARTCR2_RE | UARTCR2_TE, sport->port.membase + UARTCR2); - uart_port_unlock_irqrestore(&sport->port, flags); + writeb(UARTCR2_RE | UARTCR2_TE, port->membase + UARTCR2); + uart_port_unlock_irqrestore(port, flags); return 0; } @@ -696,30 +696,30 @@ static int lpuart32_poll_init(struct uart_port *port) struct lpuart_port *sport = container_of(port, struct lpuart_port, port); u32 temp; - sport->port.fifosize = 0; + port->fifosize = 0; - uart_port_lock_irqsave(&sport->port, &flags); + uart_port_lock_irqsave(port, &flags); /* Disable Rx & Tx */ - lpuart32_write(&sport->port, 0, UARTCTRL); + lpuart32_write(port, 0, UARTCTRL); - temp = lpuart32_read(&sport->port, UARTFIFO); + temp = lpuart32_read(port, UARTFIFO); /* Enable Rx and Tx FIFO */ - lpuart32_write(&sport->port, temp | UARTFIFO_RXFE | UARTFIFO_TXFE, UARTFIFO); + lpuart32_write(port, temp | UARTFIFO_RXFE | UARTFIFO_TXFE, UARTFIFO); /* flush Tx and Rx FIFO */ - lpuart32_write(&sport->port, UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH, UARTFIFO); + lpuart32_write(port, UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH, UARTFIFO); /* explicitly clear RDRF */ - if (lpuart32_read(&sport->port, UARTSTAT) & UARTSTAT_RDRF) { - lpuart32_read(&sport->port, UARTDATA); - lpuart32_write(&sport->port, UARTFIFO_RXUF, UARTFIFO); + if (lpuart32_read(port, UARTSTAT) & UARTSTAT_RDRF) { + lpuart32_read(port, UARTDATA); + lpuart32_write(port, UARTFIFO_RXUF, UARTFIFO); } /* Enable Rx and Tx */ - lpuart32_write(&sport->port, UARTCTRL_RE | UARTCTRL_TE, UARTCTRL); - uart_port_unlock_irqrestore(&sport->port, flags); + lpuart32_write(port, UARTCTRL_RE | UARTCTRL_TE, UARTCTRL); + uart_port_unlock_irqrestore(port, flags); return 0; } @@ -1449,12 +1449,9 @@ static void lpuart_dma_rx_free(struct uart_port *port) static int lpuart_config_rs485(struct uart_port *port, struct ktermios *termios, struct serial_rs485 *rs485) { - struct lpuart_port *sport = container_of(port, - struct lpuart_port, port); - - u8 modem = readb(sport->port.membase + UARTMODEM) & + u8 modem = readb(port->membase + UARTMODEM) & ~(UARTMODEM_TXRTSPOL | UARTMODEM_TXRTSE); - writeb(modem, sport->port.membase + UARTMODEM); + writeb(modem, port->membase + UARTMODEM); if (rs485->flags & SER_RS485_ENABLED) { /* Enable auto RS-485 RTS mode */ @@ -1472,32 +1469,29 @@ static int lpuart_config_rs485(struct uart_port *port, struct ktermios *termios, modem &= ~UARTMODEM_TXRTSPOL; } - writeb(modem, sport->port.membase + UARTMODEM); + writeb(modem, port->membase + UARTMODEM); return 0; } static int lpuart32_config_rs485(struct uart_port *port, struct ktermios *termios, struct serial_rs485 *rs485) { - struct lpuart_port *sport = container_of(port, - struct lpuart_port, port); - - u32 modem = lpuart32_read(&sport->port, UARTMODIR) + u32 modem = lpuart32_read(port, UARTMODIR) & ~(UARTMODIR_TXRTSPOL | UARTMODIR_TXRTSE); u32 ctrl; /* TXRTSE and TXRTSPOL only can be changed when transmitter is disabled. */ - ctrl = lpuart32_read(&sport->port, UARTCTRL); + ctrl = lpuart32_read(port, UARTCTRL); if (ctrl & UARTCTRL_TE) { /* wait transmit engin complete */ - lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); - lpuart32_write(&sport->port, ctrl & ~UARTCTRL_TE, UARTCTRL); + lpuart32_wait_bit_set(port, UARTSTAT, UARTSTAT_TC); + lpuart32_write(port, ctrl & ~UARTCTRL_TE, UARTCTRL); - while (lpuart32_read(&sport->port, UARTCTRL) & UARTCTRL_TE) + while (lpuart32_read(port, UARTCTRL) & UARTCTRL_TE) cpu_relax(); } - lpuart32_write(&sport->port, modem, UARTMODIR); + lpuart32_write(port, modem, UARTMODIR); if (rs485->flags & SER_RS485_ENABLED) { /* Enable auto RS-485 RTS mode */ @@ -1515,10 +1509,10 @@ static int lpuart32_config_rs485(struct uart_port *port, struct ktermios *termio modem &= ~UARTMODIR_TXRTSPOL; } - lpuart32_write(&sport->port, modem, UARTMODIR); + lpuart32_write(port, modem, UARTMODIR); if (ctrl & UARTCTRL_TE) - lpuart32_write(&sport->port, ctrl, UARTCTRL); + lpuart32_write(port, ctrl, UARTCTRL); return 0; } @@ -1830,11 +1824,11 @@ static int lpuart_startup(struct uart_port *port) unsigned char temp; /* determine FIFO size and enable FIFO mode */ - temp = readb(sport->port.membase + UARTPFIFO); + temp = readb(port->membase + UARTPFIFO); sport->txfifo_size = UARTFIFO_DEPTH((temp >> UARTPFIFO_TXSIZE_OFF) & UARTPFIFO_FIFOSIZE_MASK); - sport->port.fifosize = sport->txfifo_size; + port->fifosize = sport->txfifo_size; sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTPFIFO_RXSIZE_OFF) & UARTPFIFO_FIFOSIZE_MASK); @@ -1890,11 +1884,11 @@ static int lpuart32_startup(struct uart_port *port) u32 temp; /* determine FIFO size */ - temp = lpuart32_read(&sport->port, UARTFIFO); + temp = lpuart32_read(port, UARTFIFO); sport->txfifo_size = UARTFIFO_DEPTH((temp >> UARTFIFO_TXSIZE_OFF) & UARTFIFO_FIFOSIZE_MASK); - sport->port.fifosize = sport->txfifo_size; + port->fifosize = sport->txfifo_size; sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTFIFO_RXSIZE_OFF) & UARTFIFO_FIFOSIZE_MASK); @@ -1907,7 +1901,7 @@ static int lpuart32_startup(struct uart_port *port) if (is_layerscape_lpuart(sport)) { sport->rxfifo_size = 16; sport->txfifo_size = 16; - sport->port.fifosize = sport->txfifo_size; + port->fifosize = sport->txfifo_size; } lpuart_request_dma(sport); @@ -1967,8 +1961,8 @@ static void lpuart32_shutdown(struct uart_port *port) uart_port_lock_irqsave(port, &flags); /* clear status */ - temp = lpuart32_read(&sport->port, UARTSTAT); - lpuart32_write(&sport->port, temp, UARTSTAT); + temp = lpuart32_read(port, UARTSTAT); + lpuart32_write(port, temp, UARTSTAT); /* disable Rx/Tx DMA */ temp = lpuart32_read(port, UARTBAUD); @@ -2002,12 +1996,12 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; unsigned int sbr, brfa; - cr1 = old_cr1 = readb(sport->port.membase + UARTCR1); - old_cr2 = readb(sport->port.membase + UARTCR2); - cr3 = readb(sport->port.membase + UARTCR3); - cr4 = readb(sport->port.membase + UARTCR4); - bdh = readb(sport->port.membase + UARTBDH); - modem = readb(sport->port.membase + UARTMODEM); + cr1 = old_cr1 = readb(port->membase + UARTCR1); + old_cr2 = readb(port->membase + UARTCR2); + cr3 = readb(port->membase + UARTCR3); + cr4 = readb(port->membase + UARTCR4); + bdh = readb(port->membase + UARTBDH); + modem = readb(port->membase + UARTMODEM); /* * only support CS8 and CS7, and for CS7 must enable PE. * supported mode: @@ -2039,7 +2033,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, * When auto RS-485 RTS mode is enabled, * hardware flow control need to be disabled. */ - if (sport->port.rs485.flags & SER_RS485_ENABLED) + if (port->rs485.flags & SER_RS485_ENABLED) termios->c_cflag &= ~CRTSCTS; if (termios->c_cflag & CRTSCTS) @@ -2080,59 +2074,59 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, * Need to update the Ring buffer length according to the selected * baud rate and restart Rx DMA path. * - * Since timer function acqures sport->port.lock, need to stop before + * Since timer function acqures port->lock, need to stop before * acquring same lock because otherwise del_timer_sync() can deadlock. */ if (old && sport->lpuart_dma_rx_use) - lpuart_dma_rx_free(&sport->port); + lpuart_dma_rx_free(port); - uart_port_lock_irqsave(&sport->port, &flags); + uart_port_lock_irqsave(port, &flags); - sport->port.read_status_mask = 0; + port->read_status_mask = 0; if (termios->c_iflag & INPCK) - sport->port.read_status_mask |= UARTSR1_FE | UARTSR1_PE; + port->read_status_mask |= UARTSR1_FE | UARTSR1_PE; if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) - sport->port.read_status_mask |= UARTSR1_FE; + port->read_status_mask |= UARTSR1_FE; /* characters to ignore */ - sport->port.ignore_status_mask = 0; + port->ignore_status_mask = 0; if (termios->c_iflag & IGNPAR) - sport->port.ignore_status_mask |= UARTSR1_PE; + port->ignore_status_mask |= UARTSR1_PE; if (termios->c_iflag & IGNBRK) { - sport->port.ignore_status_mask |= UARTSR1_FE; + port->ignore_status_mask |= UARTSR1_FE; /* * if we're ignoring parity and break indicators, * ignore overruns too (for real raw support). */ if (termios->c_iflag & IGNPAR) - sport->port.ignore_status_mask |= UARTSR1_OR; + port->ignore_status_mask |= UARTSR1_OR; } /* update the per-port timeout */ uart_update_timeout(port, termios->c_cflag, baud); /* wait transmit engin complete */ - lpuart_wait_bit_set(&sport->port, UARTSR1, UARTSR1_TC); + lpuart_wait_bit_set(port, UARTSR1, UARTSR1_TC); /* disable transmit and receive */ writeb(old_cr2 & ~(UARTCR2_TE | UARTCR2_RE), - sport->port.membase + UARTCR2); + port->membase + UARTCR2); - sbr = sport->port.uartclk / (16 * baud); - brfa = ((sport->port.uartclk - (16 * sbr * baud)) * 2) / baud; + sbr = port->uartclk / (16 * baud); + brfa = ((port->uartclk - (16 * sbr * baud)) * 2) / baud; bdh &= ~UARTBDH_SBR_MASK; bdh |= (sbr >> 8) & 0x1F; cr4 &= ~UARTCR4_BRFA_MASK; brfa &= UARTCR4_BRFA_MASK; - writeb(cr4 | brfa, sport->port.membase + UARTCR4); - writeb(bdh, sport->port.membase + UARTBDH); - writeb(sbr & 0xFF, sport->port.membase + UARTBDL); - writeb(cr3, sport->port.membase + UARTCR3); - writeb(cr1, sport->port.membase + UARTCR1); - writeb(modem, sport->port.membase + UARTMODEM); + writeb(cr4 | brfa, port->membase + UARTCR4); + writeb(bdh, port->membase + UARTBDH); + writeb(sbr & 0xFF, port->membase + UARTBDL); + writeb(cr3, port->membase + UARTCR3); + writeb(cr1, port->membase + UARTCR1); + writeb(modem, port->membase + UARTMODEM); /* restore control register */ - writeb(old_cr2, sport->port.membase + UARTCR2); + writeb(old_cr2, port->membase + UARTCR2); if (old && sport->lpuart_dma_rx_use) { if (!lpuart_start_rx_dma(sport)) @@ -2141,7 +2135,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, sport->lpuart_dma_rx_use = false; } - uart_port_unlock_irqrestore(&sport->port, flags); + uart_port_unlock_irqrestore(port, flags); } static void __lpuart32_serial_setbrg(struct uart_port *port, @@ -2239,9 +2233,9 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, unsigned int baud; unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; - ctrl = old_ctrl = lpuart32_read(&sport->port, UARTCTRL); - bd = lpuart32_read(&sport->port, UARTBAUD); - modem = lpuart32_read(&sport->port, UARTMODIR); + ctrl = old_ctrl = lpuart32_read(port, UARTCTRL); + bd = lpuart32_read(port, UARTBAUD); + modem = lpuart32_read(port, UARTMODIR); sport->is_cs7 = false; /* * only support CS8 and CS7 @@ -2275,7 +2269,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, * When auto RS-485 RTS mode is enabled, * hardware flow control need to be disabled. */ - if (sport->port.rs485.flags & SER_RS485_ENABLED) + if (port->rs485.flags & SER_RS485_ENABLED) termios->c_cflag &= ~CRTSCTS; if (termios->c_cflag & CRTSCTS) @@ -2325,32 +2319,32 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, * Need to update the Ring buffer length according to the selected * baud rate and restart Rx DMA path. * - * Since timer function acqures sport->port.lock, need to stop before + * Since timer function acqures port->lock, need to stop before * acquring same lock because otherwise del_timer_sync() can deadlock. */ if (old && sport->lpuart_dma_rx_use) - lpuart_dma_rx_free(&sport->port); + lpuart_dma_rx_free(port); - uart_port_lock_irqsave(&sport->port, &flags); + uart_port_lock_irqsave(port, &flags); - sport->port.read_status_mask = 0; + port->read_status_mask = 0; if (termios->c_iflag & INPCK) - sport->port.read_status_mask |= UARTSTAT_FE | UARTSTAT_PE; + port->read_status_mask |= UARTSTAT_FE | UARTSTAT_PE; if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) - sport->port.read_status_mask |= UARTSTAT_FE; + port->read_status_mask |= UARTSTAT_FE; /* characters to ignore */ - sport->port.ignore_status_mask = 0; + port->ignore_status_mask = 0; if (termios->c_iflag & IGNPAR) - sport->port.ignore_status_mask |= UARTSTAT_PE; + port->ignore_status_mask |= UARTSTAT_PE; if (termios->c_iflag & IGNBRK) { - sport->port.ignore_status_mask |= UARTSTAT_FE; + port->ignore_status_mask |= UARTSTAT_FE; /* * if we're ignoring parity and break indicators, * ignore overruns too (for real raw support). */ if (termios->c_iflag & IGNPAR) - sport->port.ignore_status_mask |= UARTSTAT_OR; + port->ignore_status_mask |= UARTSTAT_OR; } /* update the per-port timeout */ @@ -2362,22 +2356,22 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, * asserted. */ if (!(old_ctrl & UARTCTRL_SBK)) { - lpuart32_write(&sport->port, 0, UARTMODIR); - lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); + lpuart32_write(port, 0, UARTMODIR); + lpuart32_wait_bit_set(port, UARTSTAT, UARTSTAT_TC); } /* disable transmit and receive */ - lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE), + lpuart32_write(port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE), UARTCTRL); - lpuart32_write(&sport->port, bd, UARTBAUD); + lpuart32_write(port, bd, UARTBAUD); lpuart32_serial_setbrg(sport, baud); /* disable CTS before enabling UARTCTRL_TE to avoid pending idle preamble */ - lpuart32_write(&sport->port, modem & ~UARTMODIR_TXCTSE, UARTMODIR); + lpuart32_write(port, modem & ~UARTMODIR_TXCTSE, UARTMODIR); /* restore control register */ - lpuart32_write(&sport->port, ctrl, UARTCTRL); + lpuart32_write(port, ctrl, UARTCTRL); /* re-enable the CTS if needed */ - lpuart32_write(&sport->port, modem, UARTMODIR); + lpuart32_write(port, modem, UARTMODIR); if ((ctrl & (UARTCTRL_PE | UARTCTRL_M)) == UARTCTRL_PE) sport->is_cs7 = true; @@ -2389,7 +2383,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, sport->lpuart_dma_rx_use = false; } - uart_port_unlock_irqrestore(&sport->port, flags); + uart_port_unlock_irqrestore(port, flags); } static const char *lpuart_type(struct uart_port *port) @@ -2827,7 +2821,7 @@ static int lpuart_global_reset(struct lpuart_port *sport) ret = clk_prepare_enable(sport->ipg_clk); if (ret) { - dev_err(sport->port.dev, "failed to enable uart ipg clk: %d\n", ret); + dev_err(port->dev, "failed to enable uart ipg clk: %d\n", ret); return ret; } @@ -2838,10 +2832,10 @@ static int lpuart_global_reset(struct lpuart_port *sport) */ ctrl = lpuart32_read(port, UARTCTRL); if (ctrl & UARTCTRL_TE) { - bd = lpuart32_read(&sport->port, UARTBAUD); + bd = lpuart32_read(port, UARTBAUD); if (read_poll_timeout(lpuart32_tx_empty, val, val, 1, 100000, false, port)) { - dev_warn(sport->port.dev, + dev_warn(port->dev, "timeout waiting for transmit engine to complete\n"); clk_disable_unprepare(sport->ipg_clk); return 0; @@ -3193,7 +3187,7 @@ static void lpuart_console_fixup(struct lpuart_port *sport) * in VLLS mode, or restore console setting here. */ if (is_imx7ulp_lpuart(sport) && lpuart_uport_is_active(sport) && - console_suspend_enabled && uart_console(&sport->port)) { + console_suspend_enabled && uart_console(uport)) { mutex_lock(&port->mutex); memset(&termios, 0, sizeof(struct ktermios)); From patchwork Tue Mar 11 03:33:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 872782 Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013057.outbound.protection.outlook.com [40.107.162.57]) (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 E6FFB1EDA03; Tue, 11 Mar 2025 03:37:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.162.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741664224; cv=fail; b=UTVA+k451xxgSITJH/hFB46geRpSlZyE10W3W+rNEg8zE7epmGkpan3WvWkscbZg8BQw8+5YQzEyUeJ7dQxYVHwFyVwWoz3Yl5Pr1UpU+j6oPK4yFmJ4JbDlynk/MiAsPe8la+NRUaYDJBelfCCnXjzwdrVws9HDzK9HAwrpyyA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741664224; c=relaxed/simple; bh=Z2axqzaNorXTMNYGKosvBeRXZNgG4stUjXJ4+dkmmsI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=U1aAW1gMBlaMeMI8yMZCL2lGMsAjKq3Q8E9FNn5bwUKPqDVvuCFUuWGsh07G5X2ziTNzL7Ruih/LEkFKt+yjQ9zbAF2m9LrekO1ICWqn41Sel2Jjy14gIFspy6dF8rlCh32VXenBFamC5M3oN4ASwckfcsWFyZMelp03tkgStVw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=gsr9fsWn; arc=fail smtp.client-ip=40.107.162.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="gsr9fsWn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xbN1QXzCqK9d07JIzEbl2hbnNzGQVmFhq3JfDVWc2f3LqNyaKxfkWaoaRMj3xRyMZCCG32t1El9QZUBeLmGvK063W9Oeyio8upScI10/QZMc4iC+R1PYH0rQ+7Y32Kt3YqhvT3+P0TgnLNjYBtS8ui1WysAc0k6nMhxjCJIYh4eHUyVdCp1U9k/O/mTW8871yoDeuAAlO3AXiAHb4tSsLjinHPibkrxU+pKxx+1oG1V6NTQGicYGu9keM/9HNRr4LaWhDJjJwK0Fk+W7UdyCy8tRSNyABnoyKN4QRATDI10FhdE83/lgXYRR0M1aClPGN2NotAwJihrF4NWJWCvo/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kxecN82h/OsOvd3ovqJHvPRo3/M5uymOIR/t1v875e0=; b=nyk/DrGBdiWVwLKfieZZjLQ6L7/SLmgTNxQHJarYJR07+M7H0U8G6RPC8UTzRbDTL8CM3ZuKuFk/zb3w8WRtriaye98kO8oO37qN8Z5aOmTDDtv/l06eUP4UN3vOxeuXm5Wf2/uoj75Gli4zoACHdDWhCF9vopmDKqUUD1C/t7/9OP4VIZQF+Tjg/xFG9uMtbKTPJ3bRUozGXky+HqVP7AJZVGvH8Y98rPcnb2UInWowBdgWkucAD/TvZWkbg6iKyPrT/SUaSVV2oNJ2oNyC3iI6MERgjQXh4v0dPR6E++fBwKSVj3YJOXkE3DNb/+TcFOYZy25PGTJOZRL+SATYNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kxecN82h/OsOvd3ovqJHvPRo3/M5uymOIR/t1v875e0=; b=gsr9fsWnLGIk2/PBbxWFforsDBsA9suKrA3kqNc+LJtBZZ25o18eKsoZqmWost4a1hDkuEdTdXCz5RP7NMjnavDzPmraNe8zQG7aQl6piHXsJfssN1y61YsGrEwsb2ICwLkeEFPhzMHQYWOzD0gtXTDfKdRerFtvGcfar9+1MsSxWLTHNEEqTRxbG0iu+wXkN40V/TulRYGv0t2+5x4uXXn/QIxE7ZtPEcU31WpAjTYki4IyeNbmfM6yYf2H+ufTFHMfgV8kLz+QMvuLBLByNXys9qIjNjuL6VfMYT0i6Miyeh77Kfl+c7oqoezi1NdrOOw1ydkLw6WyN/GfusgAsQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) by AS1PR04MB9480.eurprd04.prod.outlook.com (2603:10a6:20b:4d6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.27; Tue, 11 Mar 2025 03:36:59 +0000 Received: from DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::2edf:edc4:794f:4e37]) by DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::2edf:edc4:794f:4e37%6]) with mapi id 15.20.8511.026; Tue, 11 Mar 2025 03:36:58 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, shenwei.wang@nxp.com Subject: [PATCH V2 3/3] tty: serial: lpuart: rename register variables more specifically Date: Tue, 11 Mar 2025 11:33:36 +0800 Message-Id: <20250311033336.1254842-4-sherry.sun@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311033336.1254842-1-sherry.sun@nxp.com> References: <20250311033336.1254842-1-sherry.sun@nxp.com> X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8429:EE_|AS1PR04MB9480:EE_ X-MS-Office365-Filtering-Correlation-Id: 0efb9a0d-88db-4684-d298-08dd604dfa13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 2HVSt/MFMdWY+4q8ohfbJIhi2bHzsmNOmBluK28biD4rOeE37OETR+20t2Q6VVIKd2EW3co+QXjs9uAioqaXudpFDZTrNU4HhzCUXDbfQMZ9DAXm09zZWe3IOhqW1aupF2WsF5wANY7V8LCUQKx66T0PVQfHyPIwyWZ83AjI7h0gTL/6Q8lyH0nFrmff9v65YBlBe0yIEyQ3VY5FcMSwTxL+rwkuc/+8WEgdPApuOAMTAhUWDl2KFKKBad2+Bwgq5EbN+RkJ5U9QfQSAaFR8zlL+OyzafYbPQ2mnd1aav6gLc+aHV1yi6U/hQQU+HCyfZ2F2w0UTGELrncdBRpcqgZhWyfNOYINhb75ZftMGlUF9QPF9NJLrHjimvOOgy8EAc+L2R2XYFntivLlurRiF2mIzlUQHI+OE5YjPtEUrDsNG3q4GEpZHboWGr87Iaxclye4w27+cxxTLnFyazxE9zu//KzhNhasxmN8ds46U3lq3/RrLoAlrBgwop+XuzHsxfnbVzcIpAxXp3sEogUWAPqDC65QL4GHKNP1O32SRTZWMNXDX5BR/W2LBSb68XkWTC5ZXDc3h43OLtOSAwgVddekRciC4feGe2qv2uZvY+cmCZcruE+4Bb5W6NUtDX7DLbaerdyve8vXsIaxI2ywzAGlFsHd4qHDWOLLEOReRQmfQwcC/2zKn1AEon2bOUPIls0XvVUZ+GbPiRhohyeffx5vP6loRQj9GfkEpjsr7+BtZd0KRGs7jhYU8rZMCDjS6/M7rIhQ2+cCVDIlQcyKhSDsLy9YMfUXhmnUyNBocZsTHibQaSZ0dzrBe/Vd/tQzarXUGT1ZEOh10ZNPkp69zKUj7tcTrHSycs0Ltk8gLmi9m3G2W5PAEQRiuX6urtjYTlh7jqBpHgChzxviHl7q8wMGEHf0gZVthpiJ0LWn2WBX66Ls537rB4TZNJPvi4tZyJ1Lhxxq3SziqO0pswsI2fQl32h7L+HFM5XRPZBPCPDKGvtnr+S3i07biF2uA3ChZ8QcQDtwHDkEHcos7lammTIS4ZXVH/MDYf1tJZmYb9D51ojqIBVSZiDpuKAIAe6dDAYeHtfu9loJvye9QLGMlshIVZxik4UNVNgLnlJNFu4AxAY/wmtbeW08SSYUWhaDjYed1mPu7LNhFBW9DXxEUWLbICj2CbYCci+0DpHhHfBStyl/EE6tatIliJ+agkNCbRYdZreAIXLCQqersGmaJDT4zmD18S86x+LuNhqRFn8eWmsWil4F9HUCVRV7Cq/WVNzEUDD6gXcCc/FLFPx389IP0wJLfEgevdZHKs8ZvCfyw2eO3aXADtVsoNKgWiU0cYf6HcoNL5msZ2yaio0duhZwaUU+M4pvtmrnd38Dz/pzy5HXhI7iyWA2QGprSjmdWS5qMqOTbpPsDMir6d0OfnEjQV1pHlIbKiwdL9utVGwLCXvRtlGvArhBK47jhM5rw X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB8429.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vfQ3tCTLkAQJ7yWh9P24R9Apo974z3ukbTOMJgmSUhA0dX5x65YoqJ2TUJXoxQ67ljN07e33o1vVSsi8BZSpqnzAYBl3WU6tbShyGnY352n1ah/a4S3iRj31zLwAIk5zTeygLV0Qror371vOJI06C4QcskSTJ7WbRzvArC0uWJNa+2PFvSSz0B5S3ntBxA8y9oVHEBoCFAofsB2jY0Lgs5fFW917z33Vx1SyaakjWP7lJKti2romCAz4j+uqOejb4GI83AvvMFOmFfGAO0uqC4HmmPEjjPmL9kgpBwKM6NXKQ4kfey0iamHtRNs/Zt6x+Q8KcVgV78TXGr+QrFmXJ425w8jlZzQYWBkpx3VnU71C1a7G93j7AMmKXaqVvsk3PXyMz2NjrWlQkAsINNAWqcGqwhiPy27Fj13olrzRem4qNQd0yOdH/b/J4L5NB2cU+4aEwFKOz5SbLDEknEVYFZfy8LDrjnMiFKbRCvkHH6QzSm9SSFp8mcYYrhNOC+Wu667ueYbi8e99n0KXVTKjzEvrXMWom57IaSPMFy60nicB+YNQ6RTvbaViRk08iZ2mLtBXrT3QY9GzQjvuMSFgilMzGdXui3YELadgvzrvzN5OvUcCv+ueqe56aqV0A6DMpKi673cfc+DIsLk3B9AXsZEs7Kip3bvzNdlL0AqIo9EnYiJ8rNO6XCui6+xtf90b4W0hLyBLCm5VRBhcb6E5f5F0KqzLBr+7zSWtNlLSDC+1ARRSu1rpzCEaGLPJASG7zwR+rj32xfLdCd/EMD4ZK6Mkg4LCxquztdUdJBM7z9PPkEdHxcl3NAUMQyeilqEHsa5WXZN7JiuxwOj3M0Drn6t29PcLJzjIp8D7tMBRIpmlaDb0ior5Sp2gUOJN8urCiNq+k/4qBCR92p3e31SLdXuh3Qur8EFSTkk2VyxHY6kEyXf6oZrmB1X+ifvEBme7npSEn8nP9UG/nMRkZ008tt/NwZ5LQg0YDctQ4W4Zc5xYo266ugLtkxahnA8YTn+p4ZZ8CvGz1NaC+Nv7s/h9DvPF51mHWsomOWFr4Kql5Ji2nOe9sURpHrHjqQFncXtfGWuQdQriUzzjY4tcFoFIfMV0I80sLVGfJolTVLiLOJDjx706BlXtU5Ow/ytPPKlR/jBq6rWglI/szWOUrQvrnE99OgyzpIrHLTo8KUlcdqWeMXy+u7cUmjMGNzBx0WD56RJnXdFuFexhwuid4rGmpcVt3Lp9ZHcHVZ1gtjgdbmNiRiHWjTNXrQJMQdOMUNYRrBkjolIOsmn+spI3217kFbi9J3Su/x6wCZMzHrs2X0FmArxQ89kVIvEq8fJgiTku7yJNwG9Ub3fwBu3aanVsyV/H7ewgvxbpqF7A2/mHprGJg6KB9Cfljm+vvGBzk7y1tHIfHJ93gOxp75YC64oDDX824dLUYBR2ykBdA/DJZ3+IDFhm0wHI96/NuCdi9u5AiaAhxfBlgBy+kORFYrk3byfFsG+gl7YOwtEkp4fZg7BhMRVfO9KBg2LQZs9b0Tg/2edL3Kcva6Vv2yRhLMoVCYrPyYYQUhawv8pnnaq2V5X7Dy7nhjv5756rYPi+8SnS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0efb9a0d-88db-4684-d298-08dd604dfa13 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8429.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2025 03:36:58.3416 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hb5vduS6YPYkSuyyyzSJix3ZZ6aqr7BEDYCO4jWk89UVl2x4hQtcOhfAPD+ObPQdNjo8s2smB+EpPjki/k2KNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9480 There are many fuzzy register variables in the lpuart driver, such as temp, tmp, val, reg. Let's give these register variables more specific names. Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 220 ++++++++++++++++---------------- 1 file changed, 110 insertions(+), 110 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index f830b5a3ba8e..901c83461bfc 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -441,36 +441,36 @@ static unsigned int lpuart_get_baud_clk_rate(struct lpuart_port *sport) static void lpuart_stop_tx(struct uart_port *port) { - unsigned char temp; + unsigned char cr2; - temp = readb(port->membase + UARTCR2); - temp &= ~(UARTCR2_TIE | UARTCR2_TCIE); - writeb(temp, port->membase + UARTCR2); + cr2 = readb(port->membase + UARTCR2); + cr2 &= ~(UARTCR2_TIE | UARTCR2_TCIE); + writeb(cr2, port->membase + UARTCR2); } static void lpuart32_stop_tx(struct uart_port *port) { - u32 temp; + u32 ctrl; - temp = lpuart32_read(port, UARTCTRL); - temp &= ~(UARTCTRL_TIE | UARTCTRL_TCIE); - lpuart32_write(port, temp, UARTCTRL); + ctrl = lpuart32_read(port, UARTCTRL); + ctrl &= ~(UARTCTRL_TIE | UARTCTRL_TCIE); + lpuart32_write(port, ctrl, UARTCTRL); } static void lpuart_stop_rx(struct uart_port *port) { - unsigned char temp; + unsigned char cr2; - temp = readb(port->membase + UARTCR2); - writeb(temp & ~UARTCR2_RE, port->membase + UARTCR2); + cr2 = readb(port->membase + UARTCR2); + writeb(cr2 & ~UARTCR2_RE, port->membase + UARTCR2); } static void lpuart32_stop_rx(struct uart_port *port) { - u32 temp; + u32 ctrl; - temp = lpuart32_read(port, UARTCTRL); - lpuart32_write(port, temp & ~UARTCTRL_RE, UARTCTRL); + ctrl = lpuart32_read(port, UARTCTRL); + lpuart32_write(port, ctrl & ~UARTCTRL_RE, UARTCTRL); } static void lpuart_dma_tx(struct lpuart_port *sport) @@ -599,7 +599,7 @@ static void lpuart_flush_buffer(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); struct dma_chan *chan = sport->dma_tx_chan; - u32 val; + u32 fifo; if (sport->lpuart_dma_tx_use) { if (sport->dma_tx_in_progress) { @@ -611,13 +611,13 @@ static void lpuart_flush_buffer(struct uart_port *port) } if (lpuart_is_32(sport)) { - val = lpuart32_read(port, UARTFIFO); - val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH; - lpuart32_write(port, val, UARTFIFO); + fifo = lpuart32_read(port, UARTFIFO); + fifo |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH; + lpuart32_write(port, fifo, UARTFIFO); } else { - val = readb(port->membase + UARTCFIFO); - val |= UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH; - writeb(val, port->membase + UARTCFIFO); + fifo = readb(port->membase + UARTCFIFO); + fifo |= UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH; + writeb(fifo, port->membase + UARTCFIFO); } } @@ -642,7 +642,7 @@ static int lpuart_poll_init(struct uart_port *port) struct lpuart_port *sport = container_of(port, struct lpuart_port, port); unsigned long flags; - unsigned char temp; + unsigned char fifo; port->fifosize = 0; @@ -650,9 +650,9 @@ static int lpuart_poll_init(struct uart_port *port) /* Disable Rx & Tx */ writeb(0, port->membase + UARTCR2); - temp = readb(port->membase + UARTPFIFO); + fifo = readb(port->membase + UARTPFIFO); /* Enable Rx and Tx FIFO */ - writeb(temp | UARTPFIFO_RXFE | UARTPFIFO_TXFE, + writeb(fifo | UARTPFIFO_RXFE | UARTPFIFO_TXFE, port->membase + UARTPFIFO); /* flush Tx and Rx FIFO */ @@ -694,7 +694,7 @@ static int lpuart32_poll_init(struct uart_port *port) { unsigned long flags; struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - u32 temp; + u32 fifo; port->fifosize = 0; @@ -703,10 +703,10 @@ static int lpuart32_poll_init(struct uart_port *port) /* Disable Rx & Tx */ lpuart32_write(port, 0, UARTCTRL); - temp = lpuart32_read(port, UARTFIFO); + fifo = lpuart32_read(port, UARTFIFO); /* Enable Rx and Tx FIFO */ - lpuart32_write(port, temp | UARTFIFO_RXFE | UARTFIFO_TXFE, UARTFIFO); + lpuart32_write(port, fifo | UARTFIFO_RXFE | UARTFIFO_TXFE, UARTFIFO); /* flush Tx and Rx FIFO */ lpuart32_write(port, UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH, UARTFIFO); @@ -789,10 +789,10 @@ static void lpuart_start_tx(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned char temp; + unsigned char cr2; - temp = readb(port->membase + UARTCR2); - writeb(temp | UARTCR2_TIE, port->membase + UARTCR2); + cr2 = readb(port->membase + UARTCR2); + writeb(cr2 | UARTCR2_TIE, port->membase + UARTCR2); if (sport->lpuart_dma_tx_use) { if (!lpuart_stopped_or_empty(port)) @@ -806,14 +806,14 @@ static void lpuart_start_tx(struct uart_port *port) static void lpuart32_start_tx(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - u32 temp; + u32 ctrl; if (sport->lpuart_dma_tx_use) { if (!lpuart_stopped_or_empty(port)) lpuart_dma_tx(sport); } else { - temp = lpuart32_read(port, UARTCTRL); - lpuart32_write(port, temp | UARTCTRL_TIE, UARTCTRL); + ctrl = lpuart32_read(port, UARTCTRL); + lpuart32_write(port, ctrl | UARTCTRL_TIE, UARTCTRL); if (lpuart32_read(port, UARTSTAT) & UARTSTAT_TDRE) lpuart32_transmit_buffer(sport); @@ -1411,9 +1411,9 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) dma_async_issue_pending(chan); if (lpuart_is_32(sport)) { - u32 temp = lpuart32_read(&sport->port, UARTBAUD); + u32 baud = lpuart32_read(&sport->port, UARTBAUD); - lpuart32_write(&sport->port, temp | UARTBAUD_RDMAE, UARTBAUD); + lpuart32_write(&sport->port, baud | UARTBAUD_RDMAE, UARTBAUD); if (sport->dma_idle_int) { u32 ctrl = lpuart32_read(&sport->port, UARTCTRL); @@ -1520,10 +1520,10 @@ static int lpuart32_config_rs485(struct uart_port *port, struct ktermios *termio static unsigned int lpuart_get_mctrl(struct uart_port *port) { unsigned int mctrl = 0; - u8 reg; + u8 cr1; - reg = readb(port->membase + UARTCR1); - if (reg & UARTCR1_LOOPS) + cr1 = readb(port->membase + UARTCR1); + if (cr1 & UARTCR1_LOOPS) mctrl |= TIOCM_LOOP; return mctrl; @@ -1532,10 +1532,10 @@ static unsigned int lpuart_get_mctrl(struct uart_port *port) static unsigned int lpuart32_get_mctrl(struct uart_port *port) { unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; - u32 reg; + u32 ctrl; - reg = lpuart32_read(port, UARTCTRL); - if (reg & UARTCTRL_LOOPS) + ctrl = lpuart32_read(port, UARTCTRL); + if (ctrl & UARTCTRL_LOOPS) mctrl |= TIOCM_LOOP; return mctrl; @@ -1543,49 +1543,49 @@ static unsigned int lpuart32_get_mctrl(struct uart_port *port) static void lpuart_set_mctrl(struct uart_port *port, unsigned int mctrl) { - u8 reg; + u8 cr1; - reg = readb(port->membase + UARTCR1); + cr1 = readb(port->membase + UARTCR1); /* for internal loopback we need LOOPS=1 and RSRC=0 */ - reg &= ~(UARTCR1_LOOPS | UARTCR1_RSRC); + cr1 &= ~(UARTCR1_LOOPS | UARTCR1_RSRC); if (mctrl & TIOCM_LOOP) - reg |= UARTCR1_LOOPS; + cr1 |= UARTCR1_LOOPS; - writeb(reg, port->membase + UARTCR1); + writeb(cr1, port->membase + UARTCR1); } static void lpuart32_set_mctrl(struct uart_port *port, unsigned int mctrl) { - u32 reg; + u32 ctrl; - reg = lpuart32_read(port, UARTCTRL); + ctrl = lpuart32_read(port, UARTCTRL); /* for internal loopback we need LOOPS=1 and RSRC=0 */ - reg &= ~(UARTCTRL_LOOPS | UARTCTRL_RSRC); + ctrl &= ~(UARTCTRL_LOOPS | UARTCTRL_RSRC); if (mctrl & TIOCM_LOOP) - reg |= UARTCTRL_LOOPS; + ctrl |= UARTCTRL_LOOPS; - lpuart32_write(port, reg, UARTCTRL); + lpuart32_write(port, ctrl, UARTCTRL); } static void lpuart_break_ctl(struct uart_port *port, int break_state) { - unsigned char temp; + unsigned char cr2; - temp = readb(port->membase + UARTCR2) & ~UARTCR2_SBK; + cr2 = readb(port->membase + UARTCR2) & ~UARTCR2_SBK; if (break_state != 0) - temp |= UARTCR2_SBK; + cr2 |= UARTCR2_SBK; - writeb(temp, port->membase + UARTCR2); + writeb(cr2, port->membase + UARTCR2); } static void lpuart32_break_ctl(struct uart_port *port, int break_state) { - u32 temp; + u32 ctrl; - temp = lpuart32_read(port, UARTCTRL); + ctrl = lpuart32_read(port, UARTCTRL); /* * LPUART IP now has two known bugs, one is CTS has higher priority than the @@ -1602,22 +1602,22 @@ static void lpuart32_break_ctl(struct uart_port *port, int break_state) * Disable the transmitter to prevent any data from being sent out * during break, then invert the TX line to send break. */ - temp &= ~UARTCTRL_TE; - lpuart32_write(port, temp, UARTCTRL); - temp |= UARTCTRL_TXINV; - lpuart32_write(port, temp, UARTCTRL); + ctrl &= ~UARTCTRL_TE; + lpuart32_write(port, ctrl, UARTCTRL); + ctrl |= UARTCTRL_TXINV; + lpuart32_write(port, ctrl, UARTCTRL); } else { /* Disable the TXINV to turn off break and re-enable transmitter. */ - temp &= ~UARTCTRL_TXINV; - lpuart32_write(port, temp, UARTCTRL); - temp |= UARTCTRL_TE; - lpuart32_write(port, temp, UARTCTRL); + ctrl &= ~UARTCTRL_TXINV; + lpuart32_write(port, ctrl, UARTCTRL); + ctrl |= UARTCTRL_TE; + lpuart32_write(port, ctrl, UARTCTRL); } } static void lpuart_setup_watermark(struct lpuart_port *sport) { - unsigned char val, cr2; + unsigned char fifo, cr2; unsigned char cr2_saved; cr2 = readb(sport->port.membase + UARTCR2); @@ -1626,8 +1626,8 @@ static void lpuart_setup_watermark(struct lpuart_port *sport) UARTCR2_RIE | UARTCR2_RE); writeb(cr2, sport->port.membase + UARTCR2); - val = readb(sport->port.membase + UARTPFIFO); - writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE, + fifo = readb(sport->port.membase + UARTPFIFO); + writeb(fifo | UARTPFIFO_TXFE | UARTPFIFO_RXFE, sport->port.membase + UARTPFIFO); /* flush Tx and Rx FIFO */ @@ -1697,14 +1697,14 @@ static void lpuart32_setup_watermark(struct lpuart_port *sport) static void lpuart32_setup_watermark_enable(struct lpuart_port *sport) { - u32 temp; + u32 ctrl; lpuart32_setup_watermark(sport); - temp = lpuart32_read(&sport->port, UARTCTRL); - temp |= UARTCTRL_RE | UARTCTRL_TE; - temp |= FIELD_PREP(UARTCTRL_IDLECFG, 0x7); - lpuart32_write(&sport->port, temp, UARTCTRL); + ctrl = lpuart32_read(&sport->port, UARTCTRL); + ctrl |= UARTCTRL_RE | UARTCTRL_TE; + ctrl |= FIELD_PREP(UARTCTRL_IDLECFG, 0x7); + lpuart32_write(&sport->port, ctrl, UARTCTRL); } static void rx_dma_timer_init(struct lpuart_port *sport) @@ -1821,16 +1821,16 @@ static void lpuart_hw_setup(struct lpuart_port *sport) static int lpuart_startup(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned char temp; + unsigned char fifo; /* determine FIFO size and enable FIFO mode */ - temp = readb(port->membase + UARTPFIFO); + fifo = readb(port->membase + UARTPFIFO); - sport->txfifo_size = UARTFIFO_DEPTH((temp >> UARTPFIFO_TXSIZE_OFF) & + sport->txfifo_size = UARTFIFO_DEPTH((fifo >> UARTPFIFO_TXSIZE_OFF) & UARTPFIFO_FIFOSIZE_MASK); port->fifosize = sport->txfifo_size; - sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTPFIFO_RXSIZE_OFF) & + sport->rxfifo_size = UARTFIFO_DEPTH((fifo >> UARTPFIFO_RXSIZE_OFF) & UARTPFIFO_FIFOSIZE_MASK); lpuart_request_dma(sport); @@ -1841,24 +1841,24 @@ static int lpuart_startup(struct uart_port *port) static void lpuart32_hw_disable(struct lpuart_port *sport) { - u32 temp; + u32 ctrl; - temp = lpuart32_read(&sport->port, UARTCTRL); - temp &= ~(UARTCTRL_RIE | UARTCTRL_ILIE | UARTCTRL_RE | + ctrl = lpuart32_read(&sport->port, UARTCTRL); + ctrl &= ~(UARTCTRL_RIE | UARTCTRL_ILIE | UARTCTRL_RE | UARTCTRL_TIE | UARTCTRL_TE); - lpuart32_write(&sport->port, temp, UARTCTRL); + lpuart32_write(&sport->port, ctrl, UARTCTRL); } static void lpuart32_configure(struct lpuart_port *sport) { - u32 temp; + u32 ctrl; - temp = lpuart32_read(&sport->port, UARTCTRL); + ctrl = lpuart32_read(&sport->port, UARTCTRL); if (!sport->lpuart_dma_rx_use) - temp |= UARTCTRL_RIE | UARTCTRL_ILIE; + ctrl |= UARTCTRL_RIE | UARTCTRL_ILIE; if (!sport->lpuart_dma_tx_use) - temp |= UARTCTRL_TIE; - lpuart32_write(&sport->port, temp, UARTCTRL); + ctrl |= UARTCTRL_TIE; + lpuart32_write(&sport->port, ctrl, UARTCTRL); } static void lpuart32_hw_setup(struct lpuart_port *sport) @@ -1881,16 +1881,16 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) static int lpuart32_startup(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - u32 temp; + u32 fifo; /* determine FIFO size */ - temp = lpuart32_read(port, UARTFIFO); + fifo = lpuart32_read(port, UARTFIFO); - sport->txfifo_size = UARTFIFO_DEPTH((temp >> UARTFIFO_TXSIZE_OFF) & + sport->txfifo_size = UARTFIFO_DEPTH((fifo >> UARTFIFO_TXSIZE_OFF) & UARTFIFO_FIFOSIZE_MASK); port->fifosize = sport->txfifo_size; - sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTFIFO_RXSIZE_OFF) & + sport->rxfifo_size = UARTFIFO_DEPTH((fifo >> UARTFIFO_RXSIZE_OFF) & UARTFIFO_FIFOSIZE_MASK); /* @@ -1935,16 +1935,16 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) static void lpuart_shutdown(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); - unsigned char temp; + unsigned char cr2; unsigned long flags; uart_port_lock_irqsave(port, &flags); /* disable Rx/Tx and interrupts */ - temp = readb(port->membase + UARTCR2); - temp &= ~(UARTCR2_TE | UARTCR2_RE | + cr2 = readb(port->membase + UARTCR2); + cr2 &= ~(UARTCR2_TE | UARTCR2_RE | UARTCR2_TIE | UARTCR2_TCIE | UARTCR2_RIE); - writeb(temp, port->membase + UARTCR2); + writeb(cr2, port->membase + UARTCR2); uart_port_unlock_irqrestore(port, flags); @@ -2142,7 +2142,7 @@ static void __lpuart32_serial_setbrg(struct uart_port *port, unsigned int baudrate, bool use_rx_dma, bool use_tx_dma) { - u32 sbr, osr, baud_diff, tmp_osr, tmp_sbr, tmp_diff, tmp; + u32 sbr, osr, baud_diff, tmp_osr, tmp_sbr, tmp_diff, baud; u32 clk = port->uartclk; /* @@ -2171,9 +2171,9 @@ static void __lpuart32_serial_setbrg(struct uart_port *port, tmp_diff = clk / (tmp_osr * tmp_sbr) - baudrate; /* select best values between sbr and sbr+1 */ - tmp = clk / (tmp_osr * (tmp_sbr + 1)); - if (tmp_diff > (baudrate - tmp)) { - tmp_diff = baudrate - tmp; + baud = clk / (tmp_osr * (tmp_sbr + 1)); + if (tmp_diff > (baudrate - baud)) { + tmp_diff = baudrate - baud; tmp_sbr++; } @@ -2195,23 +2195,23 @@ static void __lpuart32_serial_setbrg(struct uart_port *port, dev_warn(port->dev, "unacceptable baud rate difference of more than 3%%\n"); - tmp = lpuart32_read(port, UARTBAUD); + baud = lpuart32_read(port, UARTBAUD); if ((osr > 3) && (osr < 8)) - tmp |= UARTBAUD_BOTHEDGE; + baud |= UARTBAUD_BOTHEDGE; - tmp &= ~(UARTBAUD_OSR_MASK << UARTBAUD_OSR_SHIFT); - tmp |= ((osr-1) & UARTBAUD_OSR_MASK) << UARTBAUD_OSR_SHIFT; + baud &= ~(UARTBAUD_OSR_MASK << UARTBAUD_OSR_SHIFT); + baud |= ((osr-1) & UARTBAUD_OSR_MASK) << UARTBAUD_OSR_SHIFT; - tmp &= ~UARTBAUD_SBR_MASK; - tmp |= sbr & UARTBAUD_SBR_MASK; + baud &= ~UARTBAUD_SBR_MASK; + baud |= sbr & UARTBAUD_SBR_MASK; if (!use_rx_dma) - tmp &= ~UARTBAUD_RDMAE; + baud &= ~UARTBAUD_RDMAE; if (!use_tx_dma) - tmp &= ~UARTBAUD_TDMAE; + baud &= ~UARTBAUD_TDMAE; - lpuart32_write(port, tmp, UARTBAUD); + lpuart32_write(port, baud, UARTBAUD); } static void lpuart32_serial_setbrg(struct lpuart_port *sport, @@ -3086,7 +3086,7 @@ static int lpuart_suspend_noirq(struct device *dev) static int lpuart_resume_noirq(struct device *dev) { struct lpuart_port *sport = dev_get_drvdata(dev); - u32 val; + u32 stat; pinctrl_pm_select_default_state(dev); @@ -3095,8 +3095,8 @@ static int lpuart_resume_noirq(struct device *dev) /* clear the wakeup flags */ if (lpuart_is_32(sport)) { - val = lpuart32_read(&sport->port, UARTSTAT); - lpuart32_write(&sport->port, val, UARTSTAT); + stat = lpuart32_read(&sport->port, UARTSTAT); + lpuart32_write(&sport->port, stat, UARTSTAT); } }