From patchwork Fri Jun 9 13:39:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 105646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp962055vqr; Fri, 9 Jun 2023 06:51:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54OfYVKTL+xtnk4DhdcRy+FaSyWgT179Ij7ozUgxCkjHRCF8YPyL6VVBJl6I2NUM2nxTt9 X-Received: by 2002:a05:6a20:7f8c:b0:10e:786c:8219 with SMTP id d12-20020a056a207f8c00b0010e786c8219mr1372129pzj.3.1686318698739; Fri, 09 Jun 2023 06:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686318698; cv=none; d=google.com; s=arc-20160816; b=odaSjcKjDUkdsysMb8CKUldm0lDOob0pKIHFH4Ja05qdK2sYX/KUBeh7qBrj/FOBBB e+Z883qdKq9LoBWRBiphxAK6LtdzJfJeUHdO0xdGmd63df2mojtlrRZGrzbncO9MmsNB 3vH1FihoeoeeH+nIub+fu8OUFg13Au9POwHpRkfl5d3Ju+4Jvzcu21mvg1r68fxYi9SA VS1Lf2hqScFuF9bYabYRQxxlJHdlxbpYXXjuvtgNUXFP36fAoyE3XPiDhml9yAZl/Y/E AcYEINgHpkvcGhF1VGscopCmy7qFUV59Df57QWt27tiR3YlUqa83/NNSFvEzQqaJpo7r cpXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oj6jjRL6KpUwiWnoqrGIJRE3r5WBRcldOIdGJdBymiA=; b=o0n/l4HfNhkExk39DMWa+Rbco6kh35AWix9RfksnGiGt4ZAFsTtz4ypc1L3kmgcy5M JfTtheXQrpOcTCRE4vKgOMmGRRcCYr3mdOoTr4qgbz1JhT0IH3R+24qc29WTGZn8ly63 wcywcBJIX40rrsMlTFjEY+Ba52Z7npWjKQNsKFAHpgJ/z/z8GIcJ7prt0YJpEsZP7G1Y ugqItvUel8AFhbXiLak9Dz88bfq7vNjmCLU66a6N3zkdXSf4gBqLevm6XG5KKbxQL6aN oTJqeVko3J4Edsa4HA3DeIVgkxIbdrs1HdvM82lVevUU5t11mRmw6XEmssTHI0pMqAtG EQcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b27-20020a63931b000000b00524b2358ffcsi2750493pge.574.2023.06.09.06.51.26; Fri, 09 Jun 2023 06:51:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238922AbjFINkE (ORCPT + 99 others); Fri, 9 Jun 2023 09:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbjFINkC (ORCPT ); Fri, 9 Jun 2023 09:40:02 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6808B30F1 for ; Fri, 9 Jun 2023 06:40:00 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7cL5-00015c-Ly; Fri, 09 Jun 2023 15:39:39 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q7cL2-006DQG-Iv; Fri, 09 Jun 2023 15:39:36 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q7cL1-00CbLA-Tk; Fri, 09 Jun 2023 15:39:35 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Michael Ellerman , Greg Kroah-Hartman , Jiri Slaby Cc: Nicholas Piggin , Christophe Leroy , Rob Herring , Randy Dunlap , Liang He , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v4 1/2] powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures Date: Fri, 9 Jun 2023 15:39:31 +0200 Message-Id: <20230609133932.786117-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609133932.786117-1-u.kleine-koenig@pengutronix.de> References: <20230609133932.786117-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1479; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=UaetvPn93yjffnvRpl05XP9ES/YlsYyRkVTXp98DFLg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkgyuPTpnk3tAaU03gC4tcNyer+VWIXMkAUiNKc HgxNljHuy2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZIMrjwAKCRCPgPtYfRL+ TjC6B/9zeis0/Hsbg7mICcaw8jshAoTaOCKLITarBQvJoy4Nb5Hw7DfNETfz++t9Is22wt/mU2A VOivO/vxkzDxL6vyRZA5qXQIKs5XUMYrMcWZipTltj/SlD9TtmHZuGMcSHFllbNhfc+BaZASspf /SkuBf0luljF/Hsu942HEm64CDQmtpDHdSU0blz50GQaW1vYp68q6Hne6Z5IAixcoB+Tmq9JbLW zmPqv9bgtJMVb1tIEL/iSVC9M7q7EX531/lSkErdRjbFtYYUIgKUwI9IGBTEfaLiVn4LT9QK1Rb I1aVrbuc7xwtYXaVc3oXrEQD5cKgZWsItmLFDqT3GWW+Cseh X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768233315683118121?= X-GMAIL-MSGID: =?utf-8?q?1768233315683118121?= With SERIAL_8250=y and SERIAL_8250_FSL_CONSOLE=n the both IS_ENABLED(CONFIG_SERIAL_8250) and IS_REACHABLE(CONFIG_SERIAL_8250) evaluate to true and so fsl8250_handle_irq() is used. However this function is only available if CONFIG_SERIAL_8250_CONSOLE=y (and thus SERIAL_8250_FSL=y). To prepare SERIAL_8250_FSL becoming tristate and being enabled in more cases, check for IS_REACHABLE(CONFIG_SERIAL_8250_FSL) before making use of fsl8250_handle_irq(). This check is correct with and without the change to make SERIAL_8250_FSL modular. Reported-by: Randy Dunlap Fixes: 66eff0ef528b ("powerpc/legacy_serial: Warn about 8250 devices operated without active FSL workarounds") Signed-off-by: Uwe Kleine-König Acked-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested --- arch/powerpc/kernel/legacy_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index fdbd85aafeb1..6ee65741dbd5 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c @@ -510,7 +510,7 @@ static void __init fixup_port_irq(int index, if (IS_ENABLED(CONFIG_SERIAL_8250) && of_device_is_compatible(np, "fsl,ns16550")) { - if (IS_REACHABLE(CONFIG_SERIAL_8250)) { + if (IS_REACHABLE(CONFIG_SERIAL_8250_FSL)) { port->handle_irq = fsl8250_handle_irq; port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); } else { From patchwork Fri Jun 9 13:39:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 105640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp958834vqr; Fri, 9 Jun 2023 06:46:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Fm5xh+30D7PzxPyqDRbE7kXAyj6S6klpJmYGlm1vLAkqWbVrUpCd1229UyBsTJ5a6tff7 X-Received: by 2002:aca:b01:0:b0:38c:5a32:325b with SMTP id 1-20020aca0b01000000b0038c5a32325bmr1570810oil.41.1686318365316; Fri, 09 Jun 2023 06:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686318365; cv=none; d=google.com; s=arc-20160816; b=iUdJxpzshbYJOgA9pQuLWplpNATxCxXzZX3+05HT5iHVdlZBW7qL6nTDy5r6q3qpaF 5nUZBKO6DWnrLrRxsO/aGc92SwFSSpWEOfREHB1CI7Fe1wqGbbi/nMLDScGiinvkITv9 RH8qOikkfR5V0KPWip4RJSPU7gqo/ipHyctbMDnz2R8HNE2KEafUYyGftae17g0B3oRu WmZZ+K+p5enz6H5gMGR1cs9sC/cTCZYSUbHH+gOCsyjENxWrCf/vFUsa74ujiy2/lqpc U/fF+k04s24FzcL5BMR5jtjdlob/QYf74QNLWVH1hgoXWe0dbi/Zn7VMgirF0efz8UVw o0eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kMXCbkqp948Pbs3N9AuAF1rDKxoWgGqyGNSopPddz6Q=; b=R+8nB5YR+kB5eG6Sa4ID4rR6XuQdSHQHRlrOCcfWfWzUhbM56Nd30gQjClwEbp5xHe mrSdq76KbftOihmzR079F0EdGqrK9Ena2QLk0naTxrC3VEgKSk2gZJdq3KlqoiT8oA/0 e/gQzE1dHkz+X6jzGEmsR0UIgCVuZ0gzZPjcgFgiN7NzvLPhVmRvLcJptDyUpKKIotqe WF4QwqAQeGuxc3z9+E1dOjWruTHmkPWgjWuemFSb1Et1OueQNOAsSo1NhK9KDg4Ju8Hj L8XWEe5P36jLYSjatSv6YHOQOjfe0KFvglbBQmhU4Z/ww+nDnNF3SKzi8jl/3hnFMQoO BFPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a63380f000000b005303a7ca04bsi2535832pga.486.2023.06.09.06.45.49; Fri, 09 Jun 2023 06:46:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240127AbjFINkM (ORCPT + 99 others); Fri, 9 Jun 2023 09:40:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240065AbjFINkL (ORCPT ); Fri, 9 Jun 2023 09:40:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FE930E4 for ; Fri, 9 Jun 2023 06:40:10 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7cL4-00015d-Ra; Fri, 09 Jun 2023 15:39:38 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q7cL2-006DQJ-Qu; Fri, 09 Jun 2023 15:39:36 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q7cL2-00CbLD-4K; Fri, 09 Jun 2023 15:39:36 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Johan Hovold , Lino Sanfilippo , Andy Shevchenko , Kumaravel Thiagarajan , Geert Uytterhoeven , Helge Deller , Randy Dunlap , James Hilliard , Matthew Gerlach , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v4 2/2] serial: 8250: Apply FSL workarounds also without SERIAL_8250_CONSOLE Date: Fri, 9 Jun 2023 15:39:32 +0200 Message-Id: <20230609133932.786117-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609133932.786117-1-u.kleine-koenig@pengutronix.de> References: <20230609133932.786117-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2680; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=zB+nREgR0ioXCxDriGCn0uNP6oRfU37lV4x5/oeQRjY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkgyuQzE4icrvDwcYxjDRmAz7VThTpOhibkaKy6 A4ADQdh51uJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZIMrkAAKCRCPgPtYfRL+ TlHyB/985ClvRZpO1/y6Zl5lPwWj9BtW+ksfgSKb4pUlTpvQ0ckxlpeGBDDHp7sGriIenr8/PgX a0ZbnoZH+dMVaaI0aY3oErMFsC1yM35DnhaEm/0+EptMWyETlN6FgW5tgYIONVj9johm+0KBfJr Y/2ASo6bEMXrJpki+R886L2DLVaakLY6No0nq5LqZ+SYE7M6nmEd1LVCMxPZ2DYW1b+u24qs8Gw x+HqUMHjhLki8/EfBt+qb+uv+EWT6U2tFZsmht954IEHLKAcAU+Ln/D/9tAqIywmydtiOGioKOj CTVa+T9fUStKa3b1jrHi7C8+5gv1ND/YZmaXupvyse1Aw5l3 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768232966215847692?= X-GMAIL-MSGID: =?utf-8?q?1768232966215847692?= The need to handle the FSL variant of 8250 in a special way is also present without console support. So soften the dependency for SERIAL_8250_FSL from SERIAL_8250_CONSOLE to SERIAL_8250. To handle SERIAL_8250=m, the FSL code can be modular, too, thus SERIAL_8250_FSL becomes tristate. Compiling 8250_fsl as a module requires adding a module license so this is added, too. While add it also add a appropriate module description. As then SERIAL_OF_PLATFORM=y + SERIAL_8250_FSL=m is a valid combination (if COMPILE_TEST is enabled on a platform that is neither PPC, ARM nor ARM64), the check in 8250_of.c must be weakened a bit. Signed-off-by: Uwe Kleine-König Reviewed-by: Andy Shevchenko --- drivers/tty/serial/8250/8250_fsl.c | 3 +++ drivers/tty/serial/8250/8250_of.c | 2 +- drivers/tty/serial/8250/Kconfig | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c index 00f46b9a8b09..6af4e1c1210a 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c @@ -184,3 +184,6 @@ static struct platform_driver fsl8250_platform_driver = { module_platform_driver(fsl8250_platform_driver); #endif + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Handling of Freescale specific 8250 variants"); diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c index c9f6bd7a7038..51329625c48a 100644 --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -177,7 +177,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, break; } - if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) && + if (IS_REACHABLE(CONFIG_SERIAL_8250_FSL) && (of_device_is_compatible(np, "fsl,ns16550") || of_device_is_compatible(np, "fsl,16550-FIFO64"))) { port->handle_irq = fsl8250_handle_irq; diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig index cf33e858b0be..ee17cf5c44c6 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig @@ -379,9 +379,9 @@ config SERIAL_8250_BCM2835AUX If unsure, say N. config SERIAL_8250_FSL - bool "Freescale 16550 UART support" if COMPILE_TEST && !(PPC || ARM || ARM64) - depends on SERIAL_8250_CONSOLE - default PPC || ARM || ARM64 + tristate "Freescale 16550 UART support" if COMPILE_TEST && !(PPC || ARM || ARM64) + depends on SERIAL_8250 + default SERIAL_8250 if PPC || ARM || ARM64 help Selecting this option enables a workaround for a break-detection erratum for Freescale 16550 UARTs in the 8250 driver. It also