From patchwork Thu Aug 3 13:56:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710794 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4219BEB64DD for ; Thu, 3 Aug 2023 14:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235906AbjHCOUV (ORCPT ); Thu, 3 Aug 2023 10:20:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235913AbjHCOUU (ORCPT ); Thu, 3 Aug 2023 10:20:20 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0978011B; Thu, 3 Aug 2023 07:20:18 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4c1Jw0z9t3S; Thu, 3 Aug 2023 15:57:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pCYp6389DTH2; Thu, 3 Aug 2023 15:57:04 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4b1NMZz9t3W; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2A4778B776; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id kDG7ZK9UYyI2; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D0DF18B763; Thu, 3 Aug 2023 15:57:02 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373DuvIJ494161 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:56:57 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Duv1P494160; Thu, 3 Aug 2023 15:56:57 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 01/12] serial: cpm_uart: Avoid suspicious locking Date: Thu, 3 Aug 2023 15:56:42 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071000; l=2066; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=g1/VJfSY6urnYolQkf6XjuqARyJIyQnB+2i32ZVNAL8=; b=ox36XmAYX8W9jeRLvNG7fKCBBZNkkZiraAKzbwxaL6IRb4RnMjidksKybn8nHV7gQhBFVWUS2 KtQcpca72eOB3BTBWKygA/DrIogB5ilpy3rzlEEst3AvHs/emqviZtG X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org CHECK drivers/tty/serial/cpm_uart/cpm_uart_core.c drivers/tty/serial/cpm_uart/cpm_uart_core.c:1271:39: warning: context imbalance in 'cpm_uart_console_write' - unexpected unlock Allthough 'nolock' is not expected to change, sparse find the following form suspicious: if (unlikely(nolock)) { local_irq_save(flags); } else { spin_lock_irqsave(&pinfo->port.lock, flags); } cpm_uart_early_write(pinfo, s, count, true); if (unlikely(nolock)) { local_irq_restore(flags); } else { spin_unlock_irqrestore(&pinfo->port.lock, flags); } Rewrite it a more obvious form: if (unlikely(oops_in_progress)) { local_irq_save(flags); cpm_uart_early_write(pinfo, s, count, true); local_irq_restore(flags); } else { spin_lock_irqsave(&pinfo->port.lock, flags); cpm_uart_early_write(pinfo, s, count, true); spin_unlock_irqrestore(&pinfo->port.lock, flags); } Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 66afa9bea6bf..71366a4cea22 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -1255,19 +1255,14 @@ static void cpm_uart_console_write(struct console *co, const char *s, { struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index]; unsigned long flags; - int nolock = oops_in_progress; - if (unlikely(nolock)) { + if (unlikely(oops_in_progress)) { local_irq_save(flags); - } else { - spin_lock_irqsave(&pinfo->port.lock, flags); - } - - cpm_uart_early_write(pinfo, s, count, true); - - if (unlikely(nolock)) { + cpm_uart_early_write(pinfo, s, count, true); local_irq_restore(flags); } else { + spin_lock_irqsave(&pinfo->port.lock, flags); + cpm_uart_early_write(pinfo, s, count, true); spin_unlock_irqrestore(&pinfo->port.lock, flags); } } From patchwork Thu Aug 3 13:56:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710792 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 798EBEB64DD for ; Thu, 3 Aug 2023 14:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236210AbjHCOVJ (ORCPT ); Thu, 3 Aug 2023 10:21:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236679AbjHCOUt (ORCPT ); Thu, 3 Aug 2023 10:20:49 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4021BFD; Thu, 3 Aug 2023 07:20:38 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4d1yS9z9t3p; Thu, 3 Aug 2023 15:57:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rqY3Rxt---OG; Thu, 3 Aug 2023 15:57:05 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4b1Zl6z9t3X; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3123E8B763; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id fj89w-MMInYw; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D0E1D8B773; Thu, 3 Aug 2023 15:57:02 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373DuvPq494165 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:56:57 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373DuvXQ494164; Thu, 3 Aug 2023 15:56:57 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 02/12] serial: cpm_uart: Remove stale prototypes and table and macros Date: Thu, 3 Aug 2023 15:56:43 +0200 Message-ID: <96ef20ae1df056d1b7967871ba6e27e5b5aaeea6.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071000; l=3831; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=oiNGC6eHSN+sfiKHeY488a9l1XS8iu6dN8mXSfaWcE0=; b=wY2eIuYJkPizF1edM948UtQ6Qd7myJYrzVef6C+O4j/+Gfa/tgcVABTQURU046iiG/6oabTA3 jSNMGXSDUjFB3GJuq7Ri+Yz7Nfsc57yhbb1tikDO1RQ+wKWysfKbZvo X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org cpm_uart_init_portdesc() smc1_lineif() smc2_lineif() scc1_lineif() scc2_lineif() scc3_lineif() scc4_lineif() Those functions were removed by commit 0b2a2e5b7747 ("cpm_uart: Remove !CONFIG_PPC_CPM_NEW_BINDING code"). Remove stale prototypes. UART_SMC{1..2} and UART_SCC{1..4} and SCC_WAIT_CLOSING macros are not used anymore since the above commit. cpm_uart_ports[] isn't used outside cpm_uart_core.c since the same commit, so make it static. cpm_uart_init_smc() and cpm_uart_init_scc() don't need a forward declaration. FLAG_DISCARDING and IS_DISCARDING have never been used since at least 2.6.12 and the start of git repository for kernel. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart.h | 21 --------------------- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 4 +--- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h index 46c03ed71c31..687b48fc6fb6 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart.h +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h @@ -25,18 +25,9 @@ struct gpio_desc; #define SERIAL_CPM_MINOR 46 #define IS_SMC(pinfo) (pinfo->flags & FLAG_SMC) -#define IS_DISCARDING(pinfo) (pinfo->flags & FLAG_DISCARDING) -#define FLAG_DISCARDING 0x00000004 /* when set, don't discard */ #define FLAG_SMC 0x00000002 #define FLAG_CONSOLE 0x00000001 -#define UART_SMC1 fsid_smc1_uart -#define UART_SMC2 fsid_smc2_uart -#define UART_SCC1 fsid_scc1_uart -#define UART_SCC2 fsid_scc2_uart -#define UART_SCC3 fsid_scc3_uart -#define UART_SCC4 fsid_scc4_uart - #define UART_NR fs_uart_nr #define RX_NUM_FIFO 4 @@ -44,8 +35,6 @@ struct gpio_desc; #define TX_NUM_FIFO 4 #define TX_BUF_SIZE 32 -#define SCC_WAIT_CLOSING 100 - #define GPIO_CTS 0 #define GPIO_RTS 1 #define GPIO_DCD 2 @@ -85,24 +74,14 @@ struct uart_cpm_port { struct gpio_desc *gpios[NUM_GPIOS]; }; -extern struct uart_cpm_port cpm_uart_ports[UART_NR]; - /* these are located in their respective files */ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd); void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, struct device_node *np); void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram); -int cpm_uart_init_portdesc(void); int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); void cpm_uart_freebuf(struct uart_cpm_port *pinfo); -void smc1_lineif(struct uart_cpm_port *pinfo); -void smc2_lineif(struct uart_cpm_port *pinfo); -void scc1_lineif(struct uart_cpm_port *pinfo); -void scc2_lineif(struct uart_cpm_port *pinfo); -void scc3_lineif(struct uart_cpm_port *pinfo); -void scc4_lineif(struct uart_cpm_port *pinfo); - /* virtual to phys transtalion */ diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 71366a4cea22..d804dd4019c0 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -48,8 +48,6 @@ /**************************************************************/ static int cpm_uart_tx_pump(struct uart_port *port); -static void cpm_uart_init_smc(struct uart_cpm_port *pinfo); -static void cpm_uart_init_scc(struct uart_cpm_port *pinfo); static void cpm_uart_initbd(struct uart_cpm_port *pinfo); /**************************************************************/ @@ -1128,7 +1126,7 @@ static const struct uart_ops cpm_uart_pops = { #endif }; -struct uart_cpm_port cpm_uart_ports[UART_NR]; +static struct uart_cpm_port cpm_uart_ports[UART_NR]; static int cpm_uart_init_port(struct device_node *np, struct uart_cpm_port *pinfo) From patchwork Thu Aug 3 13:56:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710158 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78AC8C04A6A for ; Thu, 3 Aug 2023 14:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235838AbjHCOUu (ORCPT ); Thu, 3 Aug 2023 10:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236213AbjHCOUf (ORCPT ); Thu, 3 Aug 2023 10:20:35 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01543211F; Thu, 3 Aug 2023 07:20:30 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4b212Mz9t3b; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ak7R_ssOuJCs; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4b1HkPz9t3S; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 26F3D8B775; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id T6xF0XTocxw5; Thu, 3 Aug 2023 15:57:03 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D45C68B774; Thu, 3 Aug 2023 15:57:02 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373DuvZJ494169 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:56:58 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Duv1W494168; Thu, 3 Aug 2023 15:56:57 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 03/12] serial: cpm_uart: Stop using fs_uart_id enum Date: Thu, 3 Aug 2023 15:56:44 +0200 Message-ID: <4772d2a21894db443fe42836421eb22206a334aa.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071000; l=1401; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=r4taSckRnJqi2ljuzJlsU6U+LaNsK9KbE/XTRnntqGg=; b=EYOi0XZS4gbljM+1i4YrImOx0hKzYpJQ2QLfzBaxWoBZA096FR7PAksGEU3MGKEw/AiJDfLdq T6mtPW9OoXWAGmdVd+Yg39IzySZxcDbJAUcrO+5eLibNUzg0+PfEAZE X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Using an enum indirection to define numeric macros is pointless. Directly use the wanted numeric value. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart.h | 3 +-- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h index 687b48fc6fb6..c220700df693 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart.h +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h @@ -11,7 +11,6 @@ #define CPM_UART_H #include -#include struct gpio_desc; @@ -28,7 +27,7 @@ struct gpio_desc; #define FLAG_SMC 0x00000002 #define FLAG_CONSOLE 0x00000001 -#define UART_NR fs_uart_nr +#define UART_NR 6 #define RX_NUM_FIFO 4 #define RX_BUF_SIZE 32 diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index d804dd4019c0..c5a896f79d80 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include From patchwork Thu Aug 3 13:56:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710160 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1997EB64DD for ; Thu, 3 Aug 2023 14:20:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231874AbjHCOUS (ORCPT ); Thu, 3 Aug 2023 10:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235838AbjHCOUQ (ORCPT ); Thu, 3 Aug 2023 10:20:16 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D27910CA; Thu, 3 Aug 2023 07:20:14 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4n3qbPz9t4x; Thu, 3 Aug 2023 15:57:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4Sf1yU4GLUXO; Thu, 3 Aug 2023 15:57:13 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4l6PrLz9t4C; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D84368B773; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Rk4TqBzrY9_N; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5F87B8B778; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv3TI494181 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:03 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv31f494172; Thu, 3 Aug 2023 15:57:03 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 04/12] serial: cpm_uart: Use get_baudrate() instead of uart_baudrate() Date: Thu, 3 Aug 2023 15:56:45 +0200 Message-ID: <4d497386f576a3df768e44a04f9bb512e424c311.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071000; l=1833; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=hqhoT/NVGFbL9/t+3tZhmV5v3NEDaEY38X+4uIs3ScI=; b=ZOklVu9kfWIIzoy3UK20I9xmKXif6N0Ux2nYcILxBHxaiFftos1FFcd/dH9k17h7+cRluuJbh 9ZJfRFEUimiAbKYwBbX/93dVdVTY35fdcOaXmnMtO7U0ukWB0t8EWyt X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org uart_baudrate() is just a trivial wrapper to get_baudrate(). Use get_baudrate() directly and remove assignment in if condition. And also remove uart_clock() which is not used since commit 0b2a2e5b7747 ("cpm_uart: Remove !CONFIG_PPC_CPM_NEW_BINDING code") Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/fs_pd.h | 10 ---------- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 6 ++++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/include/asm/fs_pd.h b/arch/powerpc/include/asm/fs_pd.h index 8def56ec05c6..7b61b80f212d 100644 --- a/arch/powerpc/include/asm/fs_pd.h +++ b/arch/powerpc/include/asm/fs_pd.h @@ -36,14 +36,4 @@ extern immap_t __iomem *mpc8xx_immr; #define immr_unmap(addr) do {} while (0) #endif -static inline int uart_baudrate(void) -{ - return get_baudrate(); -} - -static inline int uart_clock(void) -{ - return ppc_proc_freq; -} - #endif diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index c5a896f79d80..36bac4390c13 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -32,10 +32,11 @@ #include #include +#include + #include #include #include -#include #include #include @@ -1311,7 +1312,8 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) if (options) { uart_parse_options(options, &baud, &parity, &bits, &flow); } else { - if ((baud = uart_baudrate()) == -1) + baud = get_baudrate(); + if (baud == -1) baud = 9600; } From patchwork Thu Aug 3 13:56:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710159 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 075C5EB64DD for ; Thu, 3 Aug 2023 14:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236439AbjHCOU2 (ORCPT ); Thu, 3 Aug 2023 10:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236296AbjHCOUY (ORCPT ); Thu, 3 Aug 2023 10:20:24 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338B1DA; Thu, 3 Aug 2023 07:20:22 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4p1171z9t4C; Thu, 3 Aug 2023 15:57:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dIybbaA2s4qM; Thu, 3 Aug 2023 15:57:14 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4l6X85z9t4G; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DC2D38B775; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id e-x1_hcJiGHO; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4CEB58B774; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv3hd494185 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:03 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv3VR494184; Thu, 3 Aug 2023 15:57:03 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 05/12] serial: cpm_uart: Deduplicate cpm_set_{brg/smc_fcr/scc_fcr}() Date: Thu, 3 Aug 2023 15:56:46 +0200 Message-ID: <6920e61fd362961ae1aeda897c8bfe1efacdc9dc.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071000; l=4981; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=dehNxJt+NVQgHzWczRwdWctQB1n4VJLDxJOGm5qbyXQ=; b=pEEgwzS+a9mP7i2GVRXIyfDl6V8yctoxxHIfZmK6VXoRj9JHVUk+AX05sg7qAIrxyAqh/Ga2t b6yzurMZ/DjAJGIDDZME47grF8P0Gww+UcSDfi2QxfpXHTCLgpXt4RW X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org CPMFCR_EB is the same as SMC_EB and is defined for both CPM1 and CPM2. CPMFCR_GBL is defined as 0 for CPM1. Therefore the CPM2 version of cpm_set_scc_fcr() and cpm_set_smc_fcr() can be used on both CPM1 and CPM2. And cpm_set_brg() is already identical and just a wrapper of cpm_setbrg(). In addition those three fonctions are only called once from cpm_uart_core.c, so just replace the calls with the content of the CPM2 versions of them. And DPRAM_BASE is identical so can go in cpm_uart.h. While moving it, use cpm_muram_addr() directly instead of the cpm_dpram_addr() macro and remove __force tag which isn't needed. Then cpm_uart_cpm1.h and cpm_uart_cpm2.h go away. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart.h | 6 ++-- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 8 +++-- drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h | 33 --------------------- drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h | 33 --------------------- 4 files changed, 9 insertions(+), 71 deletions(-) delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h index c220700df693..81c1c5f97d19 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart.h +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h @@ -15,11 +15,13 @@ struct gpio_desc; #if defined(CONFIG_CPM2) -#include "cpm_uart_cpm2.h" +#include "asm/cpm2.h" #elif defined(CONFIG_CPM1) -#include "cpm_uart_cpm1.h" +#include "asm/cpm1.h" #endif +#define DPRAM_BASE ((u8 __iomem *)cpm_muram_addr(0)) + #define SERIAL_CPM_MAJOR 204 #define SERIAL_CPM_MINOR 46 diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 36bac4390c13..743892c0e143 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -603,7 +603,7 @@ static void cpm_uart_set_termios(struct uart_port *port, if (pinfo->clk) clk_set_rate(pinfo->clk, baud); else - cpm_set_brg(pinfo->brg - 1, baud); + cpm_setbrg(pinfo->brg - 1, baud); spin_unlock_irqrestore(&port->lock, flags); } @@ -769,7 +769,8 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo) * parameter ram. */ - cpm_set_scc_fcr(sup); + out_8(&sup->scc_genscc.scc_rfcr, CPMFCR_GBL | CPMFCR_EB); + out_8(&sup->scc_genscc.scc_tfcr, CPMFCR_GBL | CPMFCR_EB); out_be16(&sup->scc_genscc.scc_mrblr, pinfo->rx_fifosize); out_be16(&sup->scc_maxidl, 0x10); @@ -840,7 +841,8 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo) /* Set up the uart parameters in the * parameter ram. */ - cpm_set_smc_fcr(up); + out_8(&up->smc_rfcr, CPMFCR_GBL | CPMFCR_EB); + out_8(&up->smc_tfcr, CPMFCR_GBL | CPMFCR_EB); /* Using idle character time requires some additional tuning. */ out_be16(&up->smc_mrblr, pinfo->rx_fifosize); diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h deleted file mode 100644 index 18ec0849918a..000000000000 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Driver for CPM (SCC/SMC) serial ports - * - * definitions for cpm1 - * - */ - -#ifndef CPM_UART_CPM1_H -#define CPM_UART_CPM1_H - -#include - -static inline void cpm_set_brg(int brg, int baud) -{ - cpm_setbrg(brg, baud); -} - -static inline void cpm_set_scc_fcr(scc_uart_t __iomem * sup) -{ - out_8(&sup->scc_genscc.scc_rfcr, SMC_EB); - out_8(&sup->scc_genscc.scc_tfcr, SMC_EB); -} - -static inline void cpm_set_smc_fcr(smc_uart_t __iomem * up) -{ - out_8(&up->smc_rfcr, SMC_EB); - out_8(&up->smc_tfcr, SMC_EB); -} - -#define DPRAM_BASE ((u8 __iomem __force *)cpm_dpram_addr(0)) - -#endif diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h deleted file mode 100644 index 051a8509c3e5..000000000000 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Driver for CPM (SCC/SMC) serial ports - * - * definitions for cpm2 - * - */ - -#ifndef CPM_UART_CPM2_H -#define CPM_UART_CPM2_H - -#include - -static inline void cpm_set_brg(int brg, int baud) -{ - cpm_setbrg(brg, baud); -} - -static inline void cpm_set_scc_fcr(scc_uart_t __iomem *sup) -{ - out_8(&sup->scc_genscc.scc_rfcr, CPMFCR_GBL | CPMFCR_EB); - out_8(&sup->scc_genscc.scc_tfcr, CPMFCR_GBL | CPMFCR_EB); -} - -static inline void cpm_set_smc_fcr(smc_uart_t __iomem *up) -{ - out_8(&up->smc_rfcr, CPMFCR_GBL | CPMFCR_EB); - out_8(&up->smc_tfcr, CPMFCR_GBL | CPMFCR_EB); -} - -#define DPRAM_BASE ((u8 __iomem __force *)cpm_dpram_addr(0)) - -#endif From patchwork Thu Aug 3 13:56:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710793 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EAF1EB64DD for ; Thu, 3 Aug 2023 14:20:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236625AbjHCOUi (ORCPT ); Thu, 3 Aug 2023 10:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236384AbjHCOU2 (ORCPT ); Thu, 3 Aug 2023 10:20:28 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E641BF0; Thu, 3 Aug 2023 07:20:27 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4q23GCz9t4G; Thu, 3 Aug 2023 15:57:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id skcV4jzBXpBA; Thu, 3 Aug 2023 15:57:15 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4l6htXz9t4M; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E1D9C8B773; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id NRx7_-NHv-Ra; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 62D1B8B779; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv3Fa494189 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:03 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv3jX494188; Thu, 3 Aug 2023 15:57:03 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 06/12] serial: cpm_uart: Deduplicate cpm_line_cr_cmd() Date: Thu, 3 Aug 2023 15:56:47 +0200 Message-ID: <6996e6ff93067dcddebf0d0c86487345149e165c.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=2645; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=HHdfsZwGCoQoPJlY4fcmGryatj/HR1mbiEinpIS97SI=; b=Gb8p1cajdgOeWcLg5Wf1sxyN/GxsyD454iTMUoImOT2Vnrd5+OQuwzjykmZW75j+nNfwmwXuT Ozv5jBmGO6TCu2IKNl7rUhdmMRQW9FtfviTfbL9LDj7BklwicGrMP0j X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org cpm_line_cr_cmd() is identical for CPM1 and CPM2 and is used only in cpm_uart_core.c. Move it there. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart.h | 1 - drivers/tty/serial/cpm_uart/cpm_uart_core.c | 5 +++++ drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 5 ----- drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 5 ----- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h index 81c1c5f97d19..1b5523474ab4 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart.h +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h @@ -76,7 +76,6 @@ struct uart_cpm_port { }; /* these are located in their respective files */ -void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd); void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, struct device_node *np); void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram); diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 743892c0e143..e6f3e4da3144 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -54,6 +54,11 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo); #define HW_BUF_SPD_THRESHOLD 2400 +static void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd) +{ + cpm_command(port->command, cmd); +} + /* * Check, if transmit buffers are processed */ diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c index 56fc527015cb..b5680376ff3c 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c @@ -36,11 +36,6 @@ /**************************************************************/ -void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd) -{ - cpm_command(port->command, cmd); -} - void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, struct device_node *np) { diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c index 108af254e8f3..35f539fcfde8 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c @@ -33,11 +33,6 @@ /**************************************************************/ -void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd) -{ - cpm_command(port->command, cmd); -} - void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, struct device_node *np) { From patchwork Thu Aug 3 13:56:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710790 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1C4EEB64DD for ; Thu, 3 Aug 2023 14:22:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236635AbjHCOWW (ORCPT ); Thu, 3 Aug 2023 10:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236643AbjHCOVt (ORCPT ); Thu, 3 Aug 2023 10:21:49 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 396B73ABE; Thu, 3 Aug 2023 07:21:26 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4s4mwJz9t57; Thu, 3 Aug 2023 15:57:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CZiBhBspuz9s; Thu, 3 Aug 2023 15:57:17 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4m0Tfxz9t4f; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0C66F8B763; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ZEwKmc-3qekQ; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 59B6D8B776; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv3b6494193 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:03 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv3OP494192; Thu, 3 Aug 2023 15:57:03 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 07/12] serial: cpm_uart: Refactor cpm_uart_allocbuf()/cpm_uart_freebuf() Date: Thu, 3 Aug 2023 15:56:48 +0200 Message-ID: <606dfdd258a4f2f2882e2e189bef37526bb3b499.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=10344; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=fmng3Yf13DSccy9K/kGH8+3XHyPP4k1wDxdkiZ3ooIc=; b=evVODVaZYCr7v2sQu1GSMFW4wvKfaKvuYWagIcYq3jPk100Nlz8BTMH9CH15gjJqGHwzdchiP FKwkHAh7WiLDGVcCINH4WS+tg7HufZCFs22qhaxGjsojSIKbZXcrGzg X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org cpm_uart_freebuf() is identical for CPM1 and CPM2. cpm_uart_allocbuf() only has a small difference between CPM1 and CPM2 as shown below: CPM1: if (is_con) { /* was hostalloc but changed cause it blows away the */ /* large tlb mapping when pinning the kernel area */ mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); dma_addr = (u32)cpm_dpram_phys(mem_addr); } else mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, GFP_KERNEL); CPM2: if (is_con) { mem_addr = kzalloc(memsz, GFP_NOWAIT); dma_addr = virt_to_bus(mem_addr); } else mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, GFP_KERNEL); Refactor this by using IS_ENABLED(CONFIG_CPM1) and move both functions in cpm_uart_core.c as they are used only there. While doing this, add the necessary casts to silence sparse for the CPM1 part. This is because a dma alloc is not expected to be an iomem but for CPM1 as we use DPRAM this is seen as iomem. Also replace calls to cpm_dpxxxx() by relevant cpm_muram_xxxx() calls. This is needed at least for cpm_dpram_phys() which is only defined for CPM1. Just do the same for all so that cpm_dpxxxx() macros can get droped in the future. To silence checkpatch, replace printk(KERN_ERR by pr_err( and display function name instead of hard coded filename. Also replace mem_addr == NULL by !mem_addr. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart.h | 2 - drivers/tty/serial/cpm_uart/cpm_uart_core.c | 72 +++++++++++++++++++++ drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 69 -------------------- drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 69 -------------------- 4 files changed, 72 insertions(+), 140 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h index 1b5523474ab4..6d6046d45bec 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart.h +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h @@ -79,8 +79,6 @@ struct uart_cpm_port { void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, struct device_node *np); void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram); -int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); -void cpm_uart_freebuf(struct uart_cpm_port *pinfo); /* virtual to phys transtalion diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index e6f3e4da3144..fa5466518536 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -868,6 +868,78 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo) setbits16(&sp->smc_smcmr, SMCMR_REN | SMCMR_TEN); } +/* + * Allocate DP-Ram and memory buffers. We need to allocate a transmit and + * receive buffer descriptors from dual port ram, and a character + * buffer area from host mem. If we are allocating for the console we need + * to do it from bootmem + */ +static int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) +{ + int dpmemsz, memsz; + u8 __iomem *dp_mem; + unsigned long dp_offset; + u8 *mem_addr; + dma_addr_t dma_addr = 0; + + pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line); + + dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); + dp_offset = cpm_muram_alloc(dpmemsz, 8); + if (IS_ERR_VALUE(dp_offset)) { + pr_err("%s: could not allocate buffer descriptors\n", __func__); + return -ENOMEM; + } + + dp_mem = cpm_muram_addr(dp_offset); + + memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + + L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); + if (IS_ENABLED(CONFIG_CPM1) && is_con) { + /* was hostalloc but changed cause it blows away the */ + /* large tlb mapping when pinning the kernel area */ + mem_addr = (u8 __force *)cpm_muram_addr(cpm_muram_alloc(memsz, 8)); + dma_addr = cpm_muram_dma((void __iomem *)mem_addr); + } else if (is_con) { + mem_addr = kzalloc(memsz, GFP_NOWAIT); + dma_addr = virt_to_bus(mem_addr); + } else { + mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, + GFP_KERNEL); + } + + if (!mem_addr) { + cpm_muram_free(dp_offset); + pr_err("%s: could not allocate coherent memory\n", __func__); + return -ENOMEM; + } + + pinfo->dp_addr = dp_offset; + pinfo->mem_addr = mem_addr; + pinfo->dma_addr = dma_addr; + pinfo->mem_size = memsz; + + pinfo->rx_buf = mem_addr; + pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos + * pinfo->rx_fifosize); + + pinfo->rx_bd_base = (cbd_t __iomem *)dp_mem; + pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos; + + return 0; +} + +static void cpm_uart_freebuf(struct uart_cpm_port *pinfo) +{ + dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * + pinfo->rx_fifosize) + + L1_CACHE_ALIGN(pinfo->tx_nrfifos * + pinfo->tx_fifosize), (void __force *)pinfo->mem_addr, + pinfo->dma_addr); + + cpm_muram_free(pinfo->dp_addr); +} + /* * Initialize port. This is called from early_console stuff * so we have to be careful here ! diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c index b5680376ff3c..3fe436dc2f95 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c @@ -46,72 +46,3 @@ void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram) { iounmap(pram); } - -/* - * Allocate DP-Ram and memory buffers. We need to allocate a transmit and - * receive buffer descriptors from dual port ram, and a character - * buffer area from host mem. If we are allocating for the console we need - * to do it from bootmem - */ -int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) -{ - int dpmemsz, memsz; - u8 *dp_mem; - unsigned long dp_offset; - u8 *mem_addr; - dma_addr_t dma_addr = 0; - - pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line); - - dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); - dp_offset = cpm_dpalloc(dpmemsz, 8); - if (IS_ERR_VALUE(dp_offset)) { - printk(KERN_ERR - "cpm_uart_cpm1.c: could not allocate buffer descriptors\n"); - return -ENOMEM; - } - dp_mem = cpm_dpram_addr(dp_offset); - - memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + - L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); - if (is_con) { - /* was hostalloc but changed cause it blows away the */ - /* large tlb mapping when pinning the kernel area */ - mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); - dma_addr = (u32)cpm_dpram_phys(mem_addr); - } else - mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, - GFP_KERNEL); - - if (mem_addr == NULL) { - cpm_dpfree(dp_offset); - printk(KERN_ERR - "cpm_uart_cpm1.c: could not allocate coherent memory\n"); - return -ENOMEM; - } - - pinfo->dp_addr = dp_offset; - pinfo->mem_addr = mem_addr; /* virtual address*/ - pinfo->dma_addr = dma_addr; /* physical address*/ - pinfo->mem_size = memsz; - - pinfo->rx_buf = mem_addr; - pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos - * pinfo->rx_fifosize); - - pinfo->rx_bd_base = (cbd_t __iomem __force *)dp_mem; - pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos; - - return 0; -} - -void cpm_uart_freebuf(struct uart_cpm_port *pinfo) -{ - dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * - pinfo->rx_fifosize) + - L1_CACHE_ALIGN(pinfo->tx_nrfifos * - pinfo->tx_fifosize), pinfo->mem_addr, - pinfo->dma_addr); - - cpm_dpfree(pinfo->dp_addr); -} diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c index 35f539fcfde8..09d46255aa9d 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c @@ -80,72 +80,3 @@ void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram) if (!IS_SMC(port)) iounmap(pram); } - -/* - * Allocate DP-Ram and memory buffers. We need to allocate a transmit and - * receive buffer descriptors from dual port ram, and a character - * buffer area from host mem. If we are allocating for the console we need - * to do it from bootmem - */ -int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) -{ - int dpmemsz, memsz; - u8 __iomem *dp_mem; - unsigned long dp_offset; - u8 *mem_addr; - dma_addr_t dma_addr = 0; - - pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line); - - dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); - dp_offset = cpm_dpalloc(dpmemsz, 8); - if (IS_ERR_VALUE(dp_offset)) { - printk(KERN_ERR - "cpm_uart_cpm.c: could not allocate buffer descriptors\n"); - return -ENOMEM; - } - - dp_mem = cpm_dpram_addr(dp_offset); - - memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + - L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); - if (is_con) { - mem_addr = kzalloc(memsz, GFP_NOWAIT); - dma_addr = virt_to_bus(mem_addr); - } - else - mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, - GFP_KERNEL); - - if (mem_addr == NULL) { - cpm_dpfree(dp_offset); - printk(KERN_ERR - "cpm_uart_cpm.c: could not allocate coherent memory\n"); - return -ENOMEM; - } - - pinfo->dp_addr = dp_offset; - pinfo->mem_addr = mem_addr; - pinfo->dma_addr = dma_addr; - pinfo->mem_size = memsz; - - pinfo->rx_buf = mem_addr; - pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos - * pinfo->rx_fifosize); - - pinfo->rx_bd_base = (cbd_t __iomem *)dp_mem; - pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos; - - return 0; -} - -void cpm_uart_freebuf(struct uart_cpm_port *pinfo) -{ - dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * - pinfo->rx_fifosize) + - L1_CACHE_ALIGN(pinfo->tx_nrfifos * - pinfo->tx_fifosize), (void __force *)pinfo->mem_addr, - pinfo->dma_addr); - - cpm_dpfree(pinfo->dp_addr); -} From patchwork Thu Aug 3 13:56:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710789 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95521C04A6A for ; Thu, 3 Aug 2023 14:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234746AbjHCOXN (ORCPT ); Thu, 3 Aug 2023 10:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236739AbjHCOWh (ORCPT ); Thu, 3 Aug 2023 10:22:37 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E0C10D4; Thu, 3 Aug 2023 07:21:57 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4r0bY7z9t4M; Thu, 3 Aug 2023 15:57:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hKPqEZ46o4_5; Thu, 3 Aug 2023 15:57:16 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4m01Qtz9t3r; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F068B8B773; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id rtP7P-yA6_dj; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4C04B8B763; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv3A2494197 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:03 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv3Vx494196; Thu, 3 Aug 2023 15:57:03 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 08/12] serial: cpm_uart: Refactor cpm_uart_[un]map_pram() Date: Thu, 3 Aug 2023 15:56:49 +0200 Message-ID: <44a266106c421319aa8e700c2db52d5dcd652c0f.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=8278; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=28TMaYNg/wuam2YMhRwXHhITAluBiIelYQ4EfteMINs=; b=c4GE1AZBOq4J+DsReWNHsw7bxtwt8JqAV81wvuEQ1UWvm5bNkVtmTdTMB7Z4yLpggCLSTVn8c 86kNZeCSNRmDmF4NK7QzzeXD/rb+9lH/XoBEcWNbwBPoZftNJECN+p/ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org cpm_uart_map_pram() and cpm_uart_unmap_pram() are very similar for CPM1 and CPM2. On CPM1 cpm_uart_map_pram() uses of_iomap() while CPM2 uses of_address_to_resource()/ioremap(). CPM2 version will also work on CPM1. On CPM2 cpm_uart_map_pram() and cpm_uart_unmap_pram() has a special handling for SMC. Just gate it by an IS_ENABLED(CONFIG_CPM2). So move the CPM2 version into cpm_uart_core.c which is the only user of those two fonctions and refactor to also handle CPM1 as mentionned above. PROFF_SMC_SIZE is only defined for SMC2 and used only there. To make it simple, just use the numerical value 64, this is the only place it is used and anyway there's already the same numerical value for the alignment. Use cpm_muram_alloc() instead of cpm_dpalloc() macro. Then cpm_uart_cpm1.c and cpm_uart_cpm2.c are now empty and go away. Replace printk(KERN_WARN by pr_warn( to make checkpatch happier. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/Makefile | 8 +- drivers/tty/serial/cpm_uart/cpm_uart.h | 5 -- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 48 ++++++++++++ drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 48 ------------ drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 82 --------------------- 5 files changed, 49 insertions(+), 142 deletions(-) delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c diff --git a/drivers/tty/serial/cpm_uart/Makefile b/drivers/tty/serial/cpm_uart/Makefile index 3f3a6ed02ed4..91f202fa5251 100644 --- a/drivers/tty/serial/cpm_uart/Makefile +++ b/drivers/tty/serial/cpm_uart/Makefile @@ -3,10 +3,4 @@ # Makefile for the Motorola 8xx FEC ethernet controller # -obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o - -# Select the correct platform objects. -cpm_uart-objs-$(CONFIG_CPM2) += cpm_uart_cpm2.o -cpm_uart-objs-$(CONFIG_CPM1) += cpm_uart_cpm1.o - -cpm_uart-objs := cpm_uart_core.o $(cpm_uart-objs-y) +obj-$(CONFIG_SERIAL_CPM) += cpm_uart_core.o diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h index 6d6046d45bec..37bb6e976e03 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart.h +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h @@ -75,11 +75,6 @@ struct uart_cpm_port { struct gpio_desc *gpios[NUM_GPIOS]; }; -/* these are located in their respective files */ -void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, - struct device_node *np); -void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram); - /* virtual to phys transtalion */ diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index fa5466518536..626423022d62 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -1207,6 +1207,54 @@ static const struct uart_ops cpm_uart_pops = { static struct uart_cpm_port cpm_uart_ports[UART_NR]; +static void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, + struct device_node *np) +{ + void __iomem *pram; + unsigned long offset; + struct resource res; + resource_size_t len; + + /* Don't remap parameter RAM if it has already been initialized + * during console setup. + */ + if (IS_SMC(port) && port->smcup) + return port->smcup; + else if (!IS_SMC(port) && port->sccup) + return port->sccup; + + if (of_address_to_resource(np, 1, &res)) + return NULL; + + len = resource_size(&res); + pram = ioremap(res.start, len); + if (!pram) + return NULL; + + if (!IS_ENABLED(CONFIG_CPM2) || !IS_SMC(port)) + return pram; + + if (len != 2) { + pr_warn("cpm_uart[%d]: device tree references " + "SMC pram, using boot loader/wrapper pram mapping. " + "Please fix your device tree to reference the pram " + "base register instead.\n", + port->port.line); + return pram; + } + + offset = cpm_muram_alloc(64, 64); + out_be16(pram, offset); + iounmap(pram); + return cpm_muram_addr(offset); +} + +static void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram) +{ + if (!IS_ENABLED(CONFIG_CPM2) || !IS_SMC(port)) + iounmap(pram); +} + static int cpm_uart_init_port(struct device_node *np, struct uart_cpm_port *pinfo) { diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c deleted file mode 100644 index 3fe436dc2f95..000000000000 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Driver for CPM (SCC/SMC) serial ports; CPM1 definitions - * - * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2) - * Pantelis Antoniou (panto@intracom.gr) (CPM1) - * - * Copyright (C) 2004 Freescale Semiconductor, Inc. - * (C) 2004 Intracom, S.A. - * (C) 2006 MontaVista Software, Inc. - * Vitaly Bordug - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include "cpm_uart.h" - -/**************************************************************/ - -void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, - struct device_node *np) -{ - return of_iomap(np, 1); -} - -void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram) -{ - iounmap(pram); -} diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c deleted file mode 100644 index 09d46255aa9d..000000000000 --- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c +++ /dev/null @@ -1,82 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Driver for CPM (SCC/SMC) serial ports; CPM2 definitions - * - * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2) - * Pantelis Antoniou (panto@intracom.gr) (CPM1) - * - * Copyright (C) 2004 Freescale Semiconductor, Inc. - * (C) 2004 Intracom, S.A. - * (C) 2006 MontaVista Software, Inc. - * Vitaly Bordug - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "cpm_uart.h" - -/**************************************************************/ - -void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port, - struct device_node *np) -{ - void __iomem *pram; - unsigned long offset; - struct resource res; - resource_size_t len; - - /* Don't remap parameter RAM if it has already been initialized - * during console setup. - */ - if (IS_SMC(port) && port->smcup) - return port->smcup; - else if (!IS_SMC(port) && port->sccup) - return port->sccup; - - if (of_address_to_resource(np, 1, &res)) - return NULL; - - len = resource_size(&res); - pram = ioremap(res.start, len); - if (!pram) - return NULL; - - if (!IS_SMC(port)) - return pram; - - if (len != 2) { - printk(KERN_WARNING "cpm_uart[%d]: device tree references " - "SMC pram, using boot loader/wrapper pram mapping. " - "Please fix your device tree to reference the pram " - "base register instead.\n", - port->port.line); - return pram; - } - - offset = cpm_dpalloc(PROFF_SMC_SIZE, 64); - out_be16(pram, offset); - iounmap(pram); - return cpm_muram_addr(offset); -} - -void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram) -{ - if (!IS_SMC(port)) - iounmap(pram); -} From patchwork Thu Aug 3 13:56:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710791 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46467EB64DD for ; Thu, 3 Aug 2023 14:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236603AbjHCOV4 (ORCPT ); Thu, 3 Aug 2023 10:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236492AbjHCOVb (ORCPT ); Thu, 3 Aug 2023 10:21:31 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D677B10D4; Thu, 3 Aug 2023 07:21:10 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4v4KHDz9t5J; Thu, 3 Aug 2023 15:57:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nBQnO2JIAsnV; Thu, 3 Aug 2023 15:57:19 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4m4W8Qz9t48; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 964E88B773; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Kl1IMwn4jdMF; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4DE3C8B763; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv3sK494201 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:04 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv3Bu494200; Thu, 3 Aug 2023 15:57:03 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 09/12] serial: cpm_uart: Remove cpm_uart/ subdirectory Date: Thu, 3 Aug 2023 15:56:50 +0200 Message-ID: <9b8b8f89fc386480030f5339abe307541ae436a6.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=2136; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=2acxSC4fZPJjOV4LM1mPnEJI/PngyFJEEkHBhlNg2TQ=; b=YgxQ7g01RNqoTvf18homXVUBRxjsg1kJK1TG/t81XtG70hzyS7tP4/HhQj2wTPUREm8mR1+5G 9laqmukkjvLAcDprHTMnYDsSiey4AJOjP5epzhqNSdxFsKkQ6OfYU44 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org cpm_uart/ subdirectory only has cpm_uart_core.c and cpm_uart.h now. Move them up and remove cpm_uart/ directory while renaming cpm_uart_core.c as cpm_uart.c Signed-off-by: Christophe Leroy --- drivers/tty/serial/Makefile | 2 +- drivers/tty/serial/{cpm_uart/cpm_uart_core.c => cpm_uart.c} | 0 drivers/tty/serial/{cpm_uart => }/cpm_uart.h | 0 drivers/tty/serial/cpm_uart/Makefile | 6 ------ 4 files changed, 1 insertion(+), 7 deletions(-) rename drivers/tty/serial/{cpm_uart/cpm_uart_core.c => cpm_uart.c} (100%) rename drivers/tty/serial/{cpm_uart => }/cpm_uart.h (100%) delete mode 100644 drivers/tty/serial/cpm_uart/Makefile diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index d4123469583d..138abbc89738 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -41,7 +41,7 @@ obj-$(CONFIG_SERIAL_HS_LPC32XX) += lpc32xx_hs.o obj-$(CONFIG_SERIAL_DZ) += dz.o obj-$(CONFIG_SERIAL_ZS) += zs.o obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o -obj-$(CONFIG_SERIAL_CPM) += cpm_uart/ +obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o obj-$(CONFIG_SERIAL_IMX) += imx.o obj-$(CONFIG_SERIAL_IMX_EARLYCON) += imx_earlycon.o obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart.c similarity index 100% rename from drivers/tty/serial/cpm_uart/cpm_uart_core.c rename to drivers/tty/serial/cpm_uart.c diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart.h similarity index 100% rename from drivers/tty/serial/cpm_uart/cpm_uart.h rename to drivers/tty/serial/cpm_uart.h diff --git a/drivers/tty/serial/cpm_uart/Makefile b/drivers/tty/serial/cpm_uart/Makefile deleted file mode 100644 index 91f202fa5251..000000000000 --- a/drivers/tty/serial/cpm_uart/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the Motorola 8xx FEC ethernet controller -# - -obj-$(CONFIG_SERIAL_CPM) += cpm_uart_core.o From patchwork Thu Aug 3 13:56:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710154 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CC07EB64DD for ; Thu, 3 Aug 2023 14:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236213AbjHCOXN (ORCPT ); Thu, 3 Aug 2023 10:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236781AbjHCOW7 (ORCPT ); Thu, 3 Aug 2023 10:22:59 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7673A81; Thu, 3 Aug 2023 07:22:13 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4m0f4Vz9t4m; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rsocvGl_6HMr; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4l6KdWz9t48; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D47548B77C; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 6U3gfTAN2Ygb; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 563A28B775; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv4p1494205 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:04 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv4OL494204; Thu, 3 Aug 2023 15:57:04 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 10/12] serial: cpm_uart: Remove stale prototype in powerpc/fsl_soc.c Date: Thu, 3 Aug 2023 15:56:51 +0200 Message-ID: <2869659e7faa20b0a506347bc4d1059e22709f19.1691068700.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=1082; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=3ogOgS2BB6p6HXhiyFQecdAfWGHf7CVyFxNJSBfAzFk=; b=E8KRktKzY074rZpvLdDVgKe+UrCOCH1VCzuESRgFoOFuVRbNGJv4MVUgFa12R5pv5Tc0zcuTx 63OZEfRg8hkAPdNjSzSl94YNPiuyB4Qwym92XxlUuZRvXIuae+FNZq9 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Commit 0b5cf10691eb ("[POWERPC] 8xx: Convert mpc866ads to the new device binding.") removed last definition of init_smc_ioports(). Remove it. And don't include anymore fs_uart_pd.h which is only included to provide fs_uart_platform_info structure. Signed-off-by: Christophe Leroy --- arch/powerpc/sysdev/fsl_soc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index e71b3ede147e..46431c4daaed 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -38,7 +37,6 @@ extern void init_fcc_ioports(struct fs_platform_info*); extern void init_fec_ioports(struct fs_platform_info*); -extern void init_smc_ioports(struct fs_uart_platform_info*); static phys_addr_t immrbase = -1; phys_addr_t get_immrbase(void) From patchwork Thu Aug 3 13:56:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710155 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CCD5EB64DD for ; Thu, 3 Aug 2023 14:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236590AbjHCOWn (ORCPT ); Thu, 3 Aug 2023 10:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236434AbjHCOWQ (ORCPT ); Thu, 3 Aug 2023 10:22:16 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD2044AF; Thu, 3 Aug 2023 07:21:40 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4l6rK8z9t4b; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SmivFkfxxodt; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4l6F4Pz9t3r; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D136F8B77B; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id fL7RHbQVA329; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4CE2A8B773; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv4Hp494209 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:04 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv4gp494208; Thu, 3 Aug 2023 15:57:04 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 11/12] serial: cpm_uart: Don't include fs_uart_pd.h when not needed Date: Thu, 3 Aug 2023 15:56:52 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=1634; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=Jfny+kxsl2Pw4WoCsysqPMFMfA6KwYHaxcdK6pRrO/c=; b=9RyywDdrcJEd5gsTu2SzwslYjtmsaJNRlgv+Sj3rkqbeqtxQh7ljfXilbVxA6vxbTR8JHdCxt TB/Tr71Wsw1B11R74k+eb2YukoCFRpoa+EOHMKmtFYFkmL+MtR4747X X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Remove inclusion of fs_uart_pd.h from all files not using anything from that file. Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 1 - arch/powerpc/platforms/8xx/tqm8xx_setup.c | 1 - drivers/tty/serial/ucc_uart.c | 1 - 3 files changed, 3 deletions(-) diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index 2fc7cacbcd96..6ecc7fa2a816 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c index 7d8eb50bb9cd..a451f5003abd 100644 --- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c +++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 404230c1ebb2..6995c10938a8 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -28,7 +28,6 @@ #include #include -#include #include #include From patchwork Thu Aug 3 13:56:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 710157 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9374C41513 for ; Thu, 3 Aug 2023 14:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236610AbjHCOVd (ORCPT ); Thu, 3 Aug 2023 10:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236677AbjHCOVJ (ORCPT ); Thu, 3 Aug 2023 10:21:09 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F26B2684; Thu, 3 Aug 2023 07:20:51 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4RGr4t1jffz9t4f; Thu, 3 Aug 2023 15:57:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MCduBF0o_i5C; Thu, 3 Aug 2023 15:57:18 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4RGr4m0kFqz9t4n; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 13F5B8B773; Thu, 3 Aug 2023 15:57:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id SEOQdp5N5PsN; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.144]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B5E0E8B77A; Thu, 3 Aug 2023 15:57:11 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 373Dv4Yu494213 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 15:57:04 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 373Dv4LC494212; Thu, 3 Aug 2023 15:57:04 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Greg Kroah-Hartman , Jiri Slaby , Michael Ellerman , Nicholas Piggin , Timur Tabi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH v1 12/12] serial: cpm_uart: Remove linux/fs_uart_pd.h Date: Thu, 3 Aug 2023 15:56:53 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691071001; l=2154; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=HrW+xy1mV9LzVHBn5BKDV/j8NZ7SIr3YuDt4l5zZYWg=; b=SdK5pHkJWllauesE1RX5dyJy0LrcFgHaRXxxuxOaVzLotCbSaMVmZ0KMHIZFsaBKbAfua+39r hiNo4obrsUEAbvpe/ljhUWlxDBpm5I1eK5Q0ABO5zr++3evq4BLo2wD X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org linux/fs_uart_pd.h is not used anymore. Remove it. Signed-off-by: Christophe Leroy --- include/linux/fs_uart_pd.h | 71 -------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 include/linux/fs_uart_pd.h diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h deleted file mode 100644 index 36b61ff39277..000000000000 --- a/include/linux/fs_uart_pd.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Platform information definitions for the CPM Uart driver. - * - * 2006 (c) MontaVista Software, Inc. - * Vitaly Bordug - * - * This file is licensed under the terms of the GNU General Public License - * version 2. This program is licensed "as is" without any warranty of any - * kind, whether express or implied. - */ - -#ifndef FS_UART_PD_H -#define FS_UART_PD_H - -#include - -enum fs_uart_id { - fsid_smc1_uart, - fsid_smc2_uart, - fsid_scc1_uart, - fsid_scc2_uart, - fsid_scc3_uart, - fsid_scc4_uart, - fs_uart_nr, -}; - -static inline int fs_uart_id_scc2fsid(int id) -{ - return fsid_scc1_uart + id - 1; -} - -static inline int fs_uart_id_fsid2scc(int id) -{ - return id - fsid_scc1_uart + 1; -} - -static inline int fs_uart_id_smc2fsid(int id) -{ - return fsid_smc1_uart + id - 1; -} - -static inline int fs_uart_id_fsid2smc(int id) -{ - return id - fsid_smc1_uart + 1; -} - -struct fs_uart_platform_info { - void(*init_ioports)(struct fs_uart_platform_info *); - /* device specific information */ - int fs_no; /* controller index */ - char fs_type[4]; /* controller type */ - u32 uart_clk; - u8 tx_num_fifo; - u8 tx_buf_size; - u8 rx_num_fifo; - u8 rx_buf_size; - u8 brg; - u8 clk_rx; - u8 clk_tx; -}; - -static inline int fs_uart_get_id(struct fs_uart_platform_info *fpi) -{ - if(strstr(fpi->fs_type, "SMC")) - return fs_uart_id_smc2fsid(fpi->fs_no); - if(strstr(fpi->fs_type, "SCC")) - return fs_uart_id_scc2fsid(fpi->fs_no); - return fpi->fs_no; -} - -#endif