From patchwork Wed Jul 5 18:18:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57C8CEB64DD for ; Wed, 5 Jul 2023 18:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0Bs1HoFNHLHp02bfRM7zgG4t+4M7Y33+NKtB6sxD9dY=; b=ADS0U/ZATXorXA BUzId1Foek7UzqiC15IJLFeL51Io33aBdWlh7HSso0igCy9gZ5XbFx859c0SyqrVgAqy/1+aTl5SQ CcCNiAQM3Y22tsME5SFbPUvDXn82pZtAsgxXdhtgYgVih24RTNrPZr3W4elpJE3uJIEY6opkcn6+0 3DNwuYCD7zWjVOnq4qBIB2yDAtb4d2lARFb8tbKdlGUARN7ZVV5D7JOxdaOAH/C6lviWKwi+7dQ/2 8BgGJFdIEY/b9BvrueYt9GAl6+qd61HJ+x6SKjXXpyzs/nN7sfsTmEpy3LMB2hYp3ID9+6sr1ul6C TU50tLIjt8UNG2gub2dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75e-00GjJf-1o; Wed, 05 Jul 2023 18:18:58 +0000 Received: from mx1.sberdevices.ru ([37.18.73.165]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75U-00GjCr-1V; Wed, 05 Jul 2023 18:18:52 +0000 Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 8F56A100083; Wed, 5 Jul 2023 21:18:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 8F56A100083 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581123; bh=kyAhP+a5MdH8156TEXfJ8bCkKxhir6gem5fgbZ1Vf6U=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=jKv+4qIu5x9/akaqn98sZ4oL/q7DPy88yXc+C+z6niQGXwfmfLWDQEvNx0+4bVoZP YVDJHEet2JJwNL5SKryfCn5Iy29+zEnmq8pDKR40LggEBlC4po1GfC94EJPMijWLq0 LHela+VJu4JotoLDNZ9tZfvUxd7WUthth/MEX6Qk+mK6ltMzpFax8phra282mo931G GRcp3QV726iXp/eVZLF1TiyyITNEbx4ZlaBkuHpwWfkU0ZSRt5ATlSNlLO5NN/Lkqz N/OvFTrE3rL8N7aW3iZfF44FvUOYMWw+uPrTMJXXJ36P9gDPApTpltncPBfRYNqgWc VxW25HgudoF+Q== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:43 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:40 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 1/7] tty: serial: meson: use dev_err_probe Date: Wed, 5 Jul 2023 21:18:27 +0300 Message-ID: <20230705181833.16137-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;100.64.160.123:7.1.2;sberdevices.ru:5.0.1,7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111849_278836_68F25490 X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Use dev_err_probe() helper for error checking and standard logging. It makes the driver's probe() function a little bit shorter. Signed-off-by: Dmitry Rokosov Reviewed-by: Neil Armstrong --- drivers/tty/serial/meson_uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index 2501db5a7aaf..bca54f3d92a1 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -726,8 +726,8 @@ static int meson_uart_probe(struct platform_device *pdev) of_property_read_u32(pdev->dev.of_node, "fifo-size", &fifosize); if (meson_ports[pdev->id]) { - dev_err(&pdev->dev, "port %d already allocated\n", pdev->id); - return -EBUSY; + return dev_err_probe(&pdev->dev, -EBUSY, + "port %d already allocated\n", pdev->id); } port = devm_kzalloc(&pdev->dev, sizeof(struct uart_port), GFP_KERNEL); From patchwork Wed Jul 5 18:18:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302614 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E95FEB64DD for ; Wed, 5 Jul 2023 18:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kfzfnp74lZYUBoZU426veKGUGwamX5Pg5/X0GIlHRe4=; b=vxtP0011EMn4nl pE/PBcAxGtPI7QkRWYL8q7SXvOI2ZWKgSLykHrfh4/bG+uW1cq+GWy0qBxsYqVmLooGgK+ceGdEY9 1HEe8/OuqpraIov7Ql+hXxhWKQ0It6mmhVlf0vO1bspGwOUW70AdNrrGnueye6T9lGSvOSK02pBK5 SsGf1qMKqlR5nGKmikjt8li/FdK/Bi9XpHcGapomu/2FI3TKxPJ8H7oV7j81/1/mSsSNfbhbbE3BA p1NNUmaBddZlpFftQKdxmQ5KmztNN6l+PA9VEAn9tRvVBPLWhCLCwj45KFqRjKhCOCuguaHnZUCtJ AJD8tMG00/tpo8Pe8qlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75b-00GjHb-1K; Wed, 05 Jul 2023 18:18:55 +0000 Received: from mx2.sberdevices.ru ([45.89.224.132] helo=mx1.sberdevices.ru) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75U-00GjCs-1V; Wed, 05 Jul 2023 18:18:51 +0000 Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 61188120070; Wed, 5 Jul 2023 21:18:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 61188120070 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581124; bh=CgHHkQaUikVmJKKkBOsrWXHsYXYWRSpDbopAmvzkH28=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=m8bzVULfvgpsjAsLxm1m3ICpSlxMY9LsGIWbgVVbBmSm4Vif3k4o9+HvSuWL8D/pS lA7Jqxb50eyjtESVEU65kLxKkKjHj3EYnPv9toJ4XMghjtKwQa5KW2byuuPfEYk4iD /9k9nwHZ/IGnJaCbWmRUNw1F5KBdm2TvEyojO1AedN+S3hubWdGraLh16xuDP0XJ/k ZUCfLGPUbWpRlg8yN4vwVolYZfgUcxWJt7NO2GGwANFNtiIC3mzwjBt4BQd8XNLlve aUJdbmeFgFf+9fRZyxLOJh+BR6xBvtdJuU8SC1vVOxHbtn3AWir3e2f6qbs0Js+YaV dYH6gNxDXQoEQ== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:44 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:41 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 2/7] tty: serial: meson: redesign the module to platform_driver Date: Wed, 5 Jul 2023 21:18:28 +0300 Message-ID: <20230705181833.16137-3-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_from_domain_doesnt_match_to}, 100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;sberdevices.ru:7.1.1,5.0.1;127.0.0.199:7.1.2, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111849_236728_79EA5311 X-CRM114-Status: GOOD ( 19.16 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Actually, the meson_uart module is already a platform_driver, but it is currently registered manually and the uart core registration is run outside the probe() scope, which results in some restrictions. For instance, it is not possible to communicate with the OF subsystem because it requires an initialized device object. To address this issue, apply module_platform_driver() instead of direct module init/exit routines. Additionally, move uart_register_driver() to the driver probe(), and destroy manual console registration because it's already run in the uart_register_driver() flow. Signed-off-by: Dmitry Rokosov Reviewed-by: Neil Armstrong --- drivers/tty/serial/meson_uart.c | 51 ++++++++++----------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index bca54f3d92a1..dcf994a11a21 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -621,12 +621,6 @@ static struct console meson_serial_console = { .data = &meson_uart_driver, }; -static int __init meson_serial_console_init(void) -{ - register_console(&meson_serial_console); - return 0; -} - static void meson_serial_early_console_write(struct console *co, const char *s, u_int count) @@ -652,9 +646,6 @@ OF_EARLYCON_DECLARE(meson, "amlogic,meson-ao-uart", #define MESON_SERIAL_CONSOLE (&meson_serial_console) #else -static int __init meson_serial_console_init(void) { - return 0; -} #define MESON_SERIAL_CONSOLE NULL #endif @@ -738,6 +729,13 @@ static int meson_uart_probe(struct platform_device *pdev) if (ret) return ret; + if (!meson_uart_driver.state) { + ret = uart_register_driver(&meson_uart_driver); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "can't register uart driver\n"); + } + port->iotype = UPIO_MEM; port->mapbase = res_mem->start; port->mapsize = resource_size(res_mem); @@ -776,6 +774,13 @@ static int meson_uart_remove(struct platform_device *pdev) uart_remove_one_port(&meson_uart_driver, port); meson_ports[pdev->id] = NULL; + for (int id = 0; id < AML_UART_PORT_NUM; id++) + if (meson_ports[id]) + return 0; + + /* No more available uart ports, unregister uart driver */ + uart_unregister_driver(&meson_uart_driver); + return 0; } @@ -809,33 +814,7 @@ static struct platform_driver meson_uart_platform_driver = { }, }; -static int __init meson_uart_init(void) -{ - int ret; - - ret = meson_serial_console_init(); - if (ret) - return ret; - - ret = uart_register_driver(&meson_uart_driver); - if (ret) - return ret; - - ret = platform_driver_register(&meson_uart_platform_driver); - if (ret) - uart_unregister_driver(&meson_uart_driver); - - return ret; -} - -static void __exit meson_uart_exit(void) -{ - platform_driver_unregister(&meson_uart_platform_driver); - uart_unregister_driver(&meson_uart_driver); -} - -module_init(meson_uart_init); -module_exit(meson_uart_exit); +module_platform_driver(meson_uart_platform_driver); MODULE_AUTHOR("Carlo Caione "); MODULE_DESCRIPTION("Amlogic Meson serial port driver"); From patchwork Wed Jul 5 18:18:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D689C001DD for ; Wed, 5 Jul 2023 18:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ihvGVCDVrH63TDMfrZSWYTlL49cmqo2CiqktM5H2VDY=; b=JehUYQX7ALHpR2 zuRLWdgO4buA1y608sSl4zHLfUNTEFJfBfV69eRmDRg3lFoD+hSNZxOJTQxbWAybc0AxywMbqRdhw yHGnHxThXvcOeXxLcvFwtbVCXANoio+hc0Y8BW76CWmmJvL9F7BT8/arhh0rj0Oq/meXxY3431LFR DtGj+0fJHk5VCMONL0hjYxi1bWvNcf4E8HtmYLGzt8VMgu+GQjQICVWnzfd1EyN8GQgKldbQ6hvIV 7av6SM632E531qgD8ZOkXRm+Y2UHfKoZ2n1Vk2GA9nrcSwHquZ2V+rkL8InDVIDAHRoUcD46mT/wp p+M176kHzs7ZexNApGhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75g-00GjKz-0N; Wed, 05 Jul 2023 18:19:00 +0000 Received: from mx1.sberdevices.ru ([37.18.73.165]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75U-00GjD1-1V; Wed, 05 Jul 2023 18:18:53 +0000 Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 55F19100088; Wed, 5 Jul 2023 21:18:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 55F19100088 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581125; bh=94uluQFPCIUYqZVpJLF+nD32K2aS5ta69HMKmaPydDo=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=kwRXq9uCpVKdVoRPcxYiZQFiPbFFtob1yr+QdKoTnhg7KX9HzYLMiU9xUuax4hs7F 1m4DbYUvMdYB5L37/js9v+m2O+gU3kPTu+fSUz8EI3eJSTL4Lcn/TF/BaM7TQ10sEI x9mpxb9Gqybtw7Xr8swG0z8asZH4n4uMOvGR47hM2/PqcOhyYaiv9YvjVfIz6yWVgz HtMb5P29CM7LRjmchSfrtLVtipmNenQwGH85sLMMqJbhKd9OceKOzKCgggFxbZ+57w jMFgFTLJNEtjbB9RwSuWO9U/KDhGVwNBJhvIBiJpMQ79KFRk5FOgOF4TQ3HauCl1aU 9NHZobsRyig2Q== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:45 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:42 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 3/7] tty: serial: meson: apply ttyS devname instead of ttyAML for new SoCs Date: Wed, 5 Jul 2023 21:18:29 +0300 Message-ID: <20230705181833.16137-4-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_uf_ne_domains}, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1;sberdevices.ru:5.0.1,7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;libera.irclog.whitequark.org:7.1.1, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean, bases: 2023/07/05 16:50:00 X-KSMG-LinksScanning: Clean, bases: 2023/07/05 16:49:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111849_245343_1E5F3AE4 X-CRM114-Status: GOOD ( 20.22 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org It is worth noting that the devname ttyS is a widely recognized tty name and is commonly used by many uart device drivers. Given the established usage and compatibility concerns, it may not be feasible to change the devname for older SoCs. However, for new definitions, it is acceptable and even recommended to use a new devname to help ensure clarity and avoid any potential conflicts on lower or upper software levels. For more information please refer to IRC discussion at [1]. Links: [1]: https://libera.irclog.whitequark.org/linux-amlogic/2023-07-03 Signed-off-by: Dmitry Rokosov --- drivers/tty/serial/meson_uart.c | 82 ++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index dcf994a11a21..ad0748a10db7 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -72,16 +72,22 @@ #define AML_UART_PORT_NUM 12 #define AML_UART_PORT_OFFSET 6 -#define AML_UART_DEV_NAME "ttyAML" #define AML_UART_POLL_USEC 5 #define AML_UART_TIMEOUT_USEC 10000 -static struct uart_driver meson_uart_driver; +#define MESON_UART_DRIVER(_devname) meson_uart_driver_##_devname + +#define MESON_UART_DRIVER_DECLARE(_devname) \ + static struct uart_driver MESON_UART_DRIVER(_devname) + +MESON_UART_DRIVER_DECLARE(ttyAML); +MESON_UART_DRIVER_DECLARE(ttyS); static struct uart_port *meson_ports[AML_UART_PORT_NUM]; struct meson_uart_data { + struct uart_driver *uart_driver; bool has_xtal_div2; }; @@ -611,15 +617,21 @@ static int meson_serial_console_setup(struct console *co, char *options) return uart_set_options(port, co, baud, parity, bits, flow); } -static struct console meson_serial_console = { - .name = AML_UART_DEV_NAME, - .write = meson_serial_console_write, - .device = uart_console_device, - .setup = meson_serial_console_setup, - .flags = CON_PRINTBUFFER, - .index = -1, - .data = &meson_uart_driver, -}; +#define MESON_SERIAL_CONSOLE(_devname) meson_serial_console_##_devname + +#define MESON_SERIAL_CONSOLE_DEFINE(_devname) \ + static struct console MESON_SERIAL_CONSOLE(_devname) = { \ + .name = __stringify(_devname), \ + .write = meson_serial_console_write, \ + .device = uart_console_device, \ + .setup = meson_serial_console_setup, \ + .flags = CON_PRINTBUFFER, \ + .index = -1, \ + .data = &MESON_UART_DRIVER(_devname), \ + } + +MESON_SERIAL_CONSOLE_DEFINE(ttyAML); +MESON_SERIAL_CONSOLE_DEFINE(ttyS); static void meson_serial_early_console_write(struct console *co, const char *s, @@ -644,18 +656,22 @@ meson_serial_early_console_setup(struct earlycon_device *device, const char *opt OF_EARLYCON_DECLARE(meson, "amlogic,meson-ao-uart", meson_serial_early_console_setup); -#define MESON_SERIAL_CONSOLE (&meson_serial_console) +#define MESON_SERIAL_CONSOLE_PTR(_devname) (&MESON_SERIAL_CONSOLE(_devname)) #else -#define MESON_SERIAL_CONSOLE NULL +#define MESON_SERIAL_CONSOLE_PTR(_devname) (NULL) #endif -static struct uart_driver meson_uart_driver = { - .owner = THIS_MODULE, - .driver_name = "meson_uart", - .dev_name = AML_UART_DEV_NAME, - .nr = AML_UART_PORT_NUM, - .cons = MESON_SERIAL_CONSOLE, -}; +#define MESON_UART_DRIVER_DEFINE(_devname) \ + static struct uart_driver MESON_UART_DRIVER(_devname) = { \ + .owner = THIS_MODULE, \ + .driver_name = "meson_uart", \ + .dev_name = __stringify(_devname), \ + .nr = AML_UART_PORT_NUM, \ + .cons = MESON_SERIAL_CONSOLE_PTR(_devname), \ + } + +MESON_UART_DRIVER_DEFINE(ttyAML); +MESON_UART_DRIVER_DEFINE(ttyS); static int meson_uart_probe_clocks(struct platform_device *pdev, struct uart_port *port) @@ -681,8 +697,16 @@ static int meson_uart_probe_clocks(struct platform_device *pdev, return 0; } +static struct uart_driver *meson_uart_current(const struct meson_uart_data *pd) +{ + return (pd && pd->uart_driver) ? + pd->uart_driver : &MESON_UART_DRIVER(ttyAML); +} + static int meson_uart_probe(struct platform_device *pdev) { + const struct meson_uart_data *priv_data; + struct uart_driver *uart_driver; struct resource *res_mem; struct uart_port *port; u32 fifosize = 64; /* Default is 64, 128 for EE UART_0 */ @@ -729,8 +753,12 @@ static int meson_uart_probe(struct platform_device *pdev) if (ret) return ret; - if (!meson_uart_driver.state) { - ret = uart_register_driver(&meson_uart_driver); + priv_data = device_get_match_data(&pdev->dev); + + uart_driver = meson_uart_current(priv_data); + + if (!uart_driver->state) { + ret = uart_register_driver(uart_driver); if (ret) return dev_err_probe(&pdev->dev, ret, "can't register uart driver\n"); @@ -748,7 +776,7 @@ static int meson_uart_probe(struct platform_device *pdev) port->x_char = 0; port->ops = &meson_uart_ops; port->fifosize = fifosize; - port->private_data = (void *)device_get_match_data(&pdev->dev); + port->private_data = (void *)priv_data; meson_ports[pdev->id] = port; platform_set_drvdata(pdev, port); @@ -759,7 +787,7 @@ static int meson_uart_probe(struct platform_device *pdev) meson_uart_release_port(port); } - ret = uart_add_one_port(&meson_uart_driver, port); + ret = uart_add_one_port(uart_driver, port); if (ret) meson_ports[pdev->id] = NULL; @@ -768,10 +796,12 @@ static int meson_uart_probe(struct platform_device *pdev) static int meson_uart_remove(struct platform_device *pdev) { + struct uart_driver *uart_driver; struct uart_port *port; port = platform_get_drvdata(pdev); - uart_remove_one_port(&meson_uart_driver, port); + uart_driver = meson_uart_current(port->private_data); + uart_remove_one_port(uart_driver, port); meson_ports[pdev->id] = NULL; for (int id = 0; id < AML_UART_PORT_NUM; id++) @@ -779,7 +809,7 @@ static int meson_uart_remove(struct platform_device *pdev) return 0; /* No more available uart ports, unregister uart driver */ - uart_unregister_driver(&meson_uart_driver); + uart_unregister_driver(uart_driver); return 0; } From patchwork Wed Jul 5 18:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F2EFEB64DA for ; Wed, 5 Jul 2023 18:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gmPWdduWxGZA4qhLmwoascPUhqYBnD4Pawqg/31B5F4=; b=VGWw6eLtDz7T3d lgF3SUw3/NfbWu1PZOrHX7Jm6CM6J35ARVqHEiivuLNNJduNvu+hDBF90lUZgeWbMmeCEchvvq53G akrZyzDT7iQbNd4337H9NF64ARJ+JcQpvcKPYNPU7IhOQvViX52SC/QFS+l2yo7NQB1yXU04SZEg7 6Ga8re2gxIMo/wv3v9HpkJyeIxMl1jhXZjDMJGhf1I+5Ye+2NN5hG/kUUkbGcMnwvcyin9tLDNqnH Vm2wxF5zts3KSusRscQx2WO2BbuWtUsxjZQDnU2/ZvC4mhj6NkytfJSisJi0d8/a7TXRdHN5DhtAX 6+DlSo3976JkKGbUpkEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75X-00GjFs-2b; Wed, 05 Jul 2023 18:18:51 +0000 Received: from mx2.sberdevices.ru ([45.89.224.132] helo=mx1.sberdevices.ru) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75U-00GjDI-1W; Wed, 05 Jul 2023 18:18:51 +0000 Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 1B56B120071; Wed, 5 Jul 2023 21:18:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 1B56B120071 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581126; bh=OllYyhrUJ08P7wMySV5F6J3h9lBYzlt948FsMshI588=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=RRT2fsKX+4aBYJHk8wqotSPoX9ajwXxJA/z27vHSCg28qI07e4Q3QdC+DOQsO05aN hJWNJT7JyoITSJ4W8TewnamvRVio5cwFyBtd18QTd78qZ5fZhUBEEPsYgKhtXQg98R OZw41A7gm/a+8r4ZRMiv9smll3uwcpCj1Ie7W53Iw2TT61UHCyXv3r/TwcUnxVFy1q 2Ph9Dk5ZSBXyn8IKTK+VrA0kzGN/DHf2PDOzX7PZgnh9ChFI3TM/XrqFDeXeteaBgG JRv1YXTsqR/howZcb0PHfXCf6xOMtL6UOi+pBpy7VFI7u/MnMz3eiCoUisXrcj0O8+ OxJznG/mrlH+w== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:45 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:43 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 4/7] tty: serial: meson: introduce separate uart_data for S4 SoC family Date: Wed, 5 Jul 2023 21:18:30 +0300 Message-ID: <20230705181833.16137-5-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_from_domain_doesnt_match_to}, 100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;sberdevices.ru:7.1.1,5.0.1;127.0.0.199:7.1.2, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111849_241927_B4454DC9 X-CRM114-Status: GOOD ( 14.60 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org In order to use the correct devname value for the S4 SoC family, it is imperative that we implement separate uart_data. Unlike the legacy g12a architecture, the S4 architecture should employ the use of 'ttyS' devname. Signed-off-by: Dmitry Rokosov Reviewed-by: Neil Armstrong --- drivers/tty/serial/meson_uart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index ad0748a10db7..6a63184b8091 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -818,6 +818,11 @@ static struct meson_uart_data meson_g12a_uart_data = { .has_xtal_div2 = true, }; +static struct meson_uart_data meson_s4_uart_data = { + .uart_driver = &MESON_UART_DRIVER(ttyS), + .has_xtal_div2 = true, +}; + static const struct of_device_id meson_uart_dt_match[] = { { .compatible = "amlogic,meson6-uart" }, { .compatible = "amlogic,meson8-uart" }, @@ -829,7 +834,7 @@ static const struct of_device_id meson_uart_dt_match[] = { }, { .compatible = "amlogic,meson-s4-uart", - .data = (void *)&meson_g12a_uart_data, + .data = (void *)&meson_s4_uart_data, }, { /* sentinel */ }, }; From patchwork Wed Jul 5 18:18:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9521EC001E0 for ; Wed, 5 Jul 2023 18:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PUiRz7JshyOG3B4zHR5R2l09vBuqj7XRCIaz+NMbwzo=; b=kj1xgqdF+QeIC8 Bs/5Cx+03MrQN7Hcs5JnoC3cQHxS3UnD4Xolk7VkAaGMTE6AMYjE+X0TVWE3lqgtXMzRJPH6QmeAM +wv4ZlLEpsWO+PkACrjjROZdonTkoTqoAXxWibBzuAvAuVuHvJaw2qd/+Tj+OPl1O0OkwFALVnGWR kkNaZdLcQH0yOnEz1TYOrwOfjCVVprjwXP6vxL2u+rrft0ARgRP8QBXMdE2QevRDpDW8sjQS4rP6A 4WkDZEwQGe7q22PEQcOMttHk4Lo5bYWm4WAmFe0jetQutAZR7R1/BpWYhmP9sG4/6Bl7EznBvXCnl 1JXR5s+v5984ZUrZRIZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75d-00GjJ0-22; Wed, 05 Jul 2023 18:18:57 +0000 Received: from mx1.sberdevices.ru ([37.18.73.165]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75U-00GjDO-1V; Wed, 05 Jul 2023 18:18:52 +0000 Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id CC95E100089; Wed, 5 Jul 2023 21:18:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru CC95E100089 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581126; bh=lUsGVmEZ9HdiqCKFqlDHSTPFlOQgyzCZXz2/LX15NfQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=a9CLMmEI8Df+FkG502jMBMHrmtNz0M+Fh8z+c+neESXtLH03/lSf1ur9h0oT1nJWl 9GoPJsLrJNfSr28TqTMYoOjA8GCY6AhhOVl3A43hEiMNaE+Bwyu6kHy5vkO8NKGZ3o vWRHq2+FS9D6e8kd2NfgV0hTl3zNw2N/QvSD1/lIoSkuzZfXtlMY2Kws2FqgUZKszO GGgB0zrkxW57/AyDDff2KKNqlUKMAkt7Gd3vdBuhxVXOTET+TCThxCsOCxQlaUn9Ny fmUrxpMjpc9tdPdkdFPluLrHOdiETG+qXhLjutBr6V5tO/Z2NID+4kwpYsLphI86lA 6tyqqV4fTogCA== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:46 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:44 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 5/7] tty: serial: meson: add independent uart_data for A1 SoC family Date: Wed, 5 Jul 2023 21:18:31 +0300 Message-ID: <20230705181833.16137-6-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;100.64.160.123:7.1.2;sberdevices.ru:5.0.1,7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111849_242777_299265C7 X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Implement separate uart_data to ensure proper devname value for the A1 SoC family. Use 'ttyS' devname, as required by the A1 architecture, instead of the legacy gx architecture. Signed-off-by: Dmitry Rokosov Reviewed-by: Neil Armstrong --- drivers/tty/serial/meson_uart.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index 6a63184b8091..84cf10b0ca5c 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -818,6 +818,11 @@ static struct meson_uart_data meson_g12a_uart_data = { .has_xtal_div2 = true, }; +static struct meson_uart_data meson_a1_uart_data = { + .uart_driver = &MESON_UART_DRIVER(ttyS), + .has_xtal_div2 = false, +}; + static struct meson_uart_data meson_s4_uart_data = { .uart_driver = &MESON_UART_DRIVER(ttyS), .has_xtal_div2 = true, @@ -836,6 +841,10 @@ static const struct of_device_id meson_uart_dt_match[] = { .compatible = "amlogic,meson-s4-uart", .data = (void *)&meson_s4_uart_data, }, + { + .compatible = "amlogic,meson-a1-uart", + .data = (void *)&meson_a1_uart_data, + }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, meson_uart_dt_match); From patchwork Wed Jul 5 18:18:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3856C001B0 for ; Wed, 5 Jul 2023 18:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xac3171ts8JH6yMEiSRTe31Yo2EAvd7grt0eLzZOAkg=; b=CFHuR8mYiXvdUA InlYGIzYBaAo4Xb9LVM+f37zX+5wMWVx51BXV/XcBs0H6FbfL8W1qhdysYBr6y/cCc6JsYXHVImFi oAdgB25MxUpvGqlkHuZX5r1PzaKJVRIs31uO1OJ4cNbzAmNbB/+6ONOvHLeQZpuJfwN21BXenzdHZ s5j//bHLVwTNVdWqsGODtQLce9TXHJnzKn2vOo6a8wQ3dq0hiLPNXFVscFmCAIN7xIf0VAvyQuEob Rj8+1BWbE3elsefoV+wgfSSu7+KCw4Zhc5zUceLPVfvMUpJYCTkQ8Cy98seSf7RApYaWluzWHBje0 NVs+Oqubbb4v0Oe3NAuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75d-00GjIo-0m; Wed, 05 Jul 2023 18:18:57 +0000 Received: from mx2.sberdevices.ru ([45.89.224.132] helo=mx1.sberdevices.ru) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75V-00GjDS-0c; Wed, 05 Jul 2023 18:18:52 +0000 Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id A87C4120072; Wed, 5 Jul 2023 21:18:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru A87C4120072 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581127; bh=dFRSuVZiYwDdVCYDf8lScbiLvLEgKBhX1VHxXBr3arc=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=cNsMGvyLTh7ygX0RBtlkGSvYULyqDP4PeCpzgueTC/FTwnlsnI5Ej/9pKJSFkV9Po s/RJuXwWWTyffhy3RPUbi2k+1e88eaItXISuZLEIFrQTuGHnQOaR2ApWtjZGdoN4xn +e86rfMxRL+ajNO+5G/39wut7rsMifLf/MssGVbt0FpKun0J/2IP0bsMHTEgCl3qrC sKyz2VUWHLLkUznBBC3kHmh1rIgjpF2A8dK77+llbk5O+kCNN75T3RvHcfWGkOuXUR AAITh4irSKUnsfn7hz9SAZ8y787vdtALakp6V5w9XyS+MzSjXUBcIFZwVO6hc0N1uf 0xT9PjQjv4fGg== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:47 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:45 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 6/7] dt-bindings: serial: amlogic,meson-uart: support Amlogic A1 Date: Wed, 5 Jul 2023 21:18:32 +0300 Message-ID: <20230705181833.16137-7-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_from_domain_doesnt_match_to}, 100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;sberdevices.ru:7.1.1,5.0.1;127.0.0.199:7.1.2, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111849_598541_299FF51B X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Introduce meson uart serial bindings for A1 SoC family. Signed-off-by: Dmitry Rokosov Acked-by: Rob Herring --- .../devicetree/bindings/serial/amlogic,meson-uart.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml index 01ec45b3b406..f1ae8c4934d9 100644 --- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml @@ -33,6 +33,7 @@ properties: - amlogic,meson8b-uart - amlogic,meson-gx-uart - amlogic,meson-s4-uart + - amlogic,meson-a1-uart - const: amlogic,meson-ao-uart - description: Always-on power domain UART controller on G12A SoCs items: @@ -46,6 +47,7 @@ properties: - amlogic,meson8b-uart - amlogic,meson-gx-uart - amlogic,meson-s4-uart + - amlogic,meson-a1-uart - description: Everything-Else power domain UART controller on G12A SoCs items: - const: amlogic,meson-g12a-uart From patchwork Wed Jul 5 18:18:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 13302613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D12CFEB64DA for ; Wed, 5 Jul 2023 18:19:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zSHZlxUyP3kpZFfm9KfImD0HkwY5DKsJ82gxJ9X473A=; b=IdsXG20X0Mmfe7 hkPAOJTI2uVBMgXHrDESSP2+HIYiUrdnL5AY3TQDzRWV1kEnt+0arwzGIUyuVqZ7JsNkp1w+K57Xe QerqEYDNZTT/DKareI76MJEbmBTao9+OJlaL0tpU6o5I1pk1JepyYLISl9LxNivXSpibasOznIf8k RKL4WE7cxXnjbbnVCSnWUd4fM69MaGIkEJm5ARbrh6OGkqp0a8PVc4W7Jg5wxYJbCJGvlIcyNYQ1X aF8b2zZquyemux9dvtyw90kQG5Pil3WaedKWwXt5J6Y3g/zrkQuZ9S3FXbY2RuaXVZy2tiduZTwie 9jYtFQNBTeblH8qJQW6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH75k-00GjOn-2d; Wed, 05 Jul 2023 18:19:04 +0000 Received: from mx1.sberdevices.ru ([37.18.73.165]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH75W-00GjEq-1h; Wed, 05 Jul 2023 18:18:54 +0000 Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 114A810008A; Wed, 5 Jul 2023 21:18:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 114A810008A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688581129; bh=SVqe3A4FxeAdixEi7Nd7L65hAuANY8HEBhEw2Kj2u+8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=WHiJoQEoJApoLtBEzj03EJrI6awNmuGRtUyYBEpNbNn8VKD5kj3Uz+MydQTEb32Je BFnt8YM5M778FzibKRA8ii/F2Qcdq+5/Ost7LLg7T6HBkCmpkXJG9MJQHF91/7dSCE 4FKS4cFcggNYWG1+DziLfxB8GIBF3+Q+pPFT3O6rSYh9h1bayvtgqF5ziAALyJDLFl 2v0289b8q44/EYA4drx8anDifV5LQ8oXtU+qpevAYFXFzHAC3PqbtVs2/7iDWaZA+u wPKhXNm3w0rj1XqnEH3gMeMWItpaFjj+XcO21UkQB/W1JyMjpO8L+Nl3k8FjOf/OXj 2uxHbPLnwAfgA== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 5 Jul 2023 21:18:48 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 5 Jul 2023 21:18:46 +0300 From: Dmitry Rokosov To: , , , , , , , , CC: , , , , , , , , , Dmitry Rokosov Subject: [PATCH v2 7/7] arm64: dts: meson: a1: change uart compatible string Date: Wed, 5 Jul 2023 21:18:33 +0300 Message-ID: <20230705181833.16137-8-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230705181833.16137-1-ddrokosov@sberdevices.ru> References: <20230705181833.16137-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178461 [Jul 05 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: DDRokosov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 520 520 ccb018a655251011855942a2571029252d3d69a2, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;100.64.160.123:7.1.2;sberdevices.ru:5.0.1,7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/05 14:57:00 #21566867 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_111850_943739_34DD7F27 X-CRM114-Status: GOOD ( 13.50 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org In the current implementation, the meson-a1 configuration incorporates a unique compatibility tag "amlogic,meson-a1-uart' within the meson-uart driver due to its usage of the new console device name "ttyS". Consequently, the previous compatibility tag designated for the 'amlogic,meson-gx-uart' configuration has become obsolete and is no longer relevant to the current setup. Signed-off-by: Dmitry Rokosov Reviewed-by: Neil Armstrong --- arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi index c5567031ba12..6273b9c862b3 100644 --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi @@ -344,7 +344,7 @@ mux { }; uart_AO: serial@1c00 { - compatible = "amlogic,meson-gx-uart", + compatible = "amlogic,meson-a1-uart", "amlogic,meson-ao-uart"; reg = <0x0 0x1c00 0x0 0x18>; interrupts = ; @@ -354,7 +354,7 @@ uart_AO: serial@1c00 { }; uart_AO_B: serial@2000 { - compatible = "amlogic,meson-gx-uart", + compatible = "amlogic,meson-a1-uart", "amlogic,meson-ao-uart"; reg = <0x0 0x2000 0x0 0x18>; interrupts = ;