From patchwork Mon Oct 17 07:40:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13008259 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 E964EC433FE for ; Mon, 17 Oct 2022 07:40:39 +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=lOqzi1lnBVCtz5TzEFrxTiRUDQZK39qitUNkXXgJkL0=; b=wxPp4WR9CzjGER avGIZV47IhKlCAO+ePbYhgRYee2NTLzHv9qlfmk68hVdNzBCma/0Woi6RLcHdBCaMr1FqLvaop0h5 HhNVDbbcMmHrRSDYQ2f9FzxHRMwP8HyLJpaTmcgnIVFZ88zHrN5IajqjFR8ZLc3QkDVXEJ9wm/ES6 cPoxUM6qiPelK+Nt1ZGOJ+4yp147k0WfFHlzlW04WJvlPOOMmlud+TqlMCDbql+gpVqQjUDgJoVDq Kmn+Q4fkJ0QhOheZAOx6hhERJRwwnOQCngE/x/nztafJ3GGAtUcVGiJlVkcS+HOaRPPZkTjjItZIB wYCbKkOdY3sFFmuEP3pA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okKim-008Vbp-27; Mon, 17 Oct 2022 07:39:36 +0000 Received: from mail-am6eur05on2058.outbound.protection.outlook.com ([40.107.22.58] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okKia-008VSg-VK for linux-arm-kernel@lists.infradead.org; Mon, 17 Oct 2022 07:39:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PP/+nOtABHumazqWJP1UK3JagJXQx9bB6UlbOxB8crfUblXBtPcVtDGqH9OQRJaGuYD+yMmA8uvCsZpMSQDsQPdDkWlMJ8xm05YpueY9ga2UwZ8NUsLcz1bYcNg1iVsEQGRURZKSTBLkv2xmpMVn6eXCX8bVdvSVyjUNbDuEltPkfPE1zDI9dLexTr944IgkDHkgexkRyb56fErbnVRYaKSYQPO9xOMif5F/sWCEvXIj1RDw7T8a3u9th75LpvN72S5Zmjccc+z0chSSHNYjc3Ld7VvqbHpqpNg8q66B4NQ+22xQ/tUAY7fpVW4FPh2kP/bp0JFAIjFtLaBtdkokDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/LuE9t6xE7VgZDLpktxCcelohM6tQZoKemd1YsbKbV0=; b=oBIWSXzBMJxy6RfQZOzAzdwr23zVVa0DecW0/cHwaiitY10QNltRNSQrwI4PrflMDg2o+199KFwFSsUaxRZEZgK6Ajb1wdTIcyp48F+AF+EN68CBmKPauhJuc4lWkq1lTv5Z8D+Q2c/Ui/mXp0SC7DsGNpWOZlbvSuXaoZe73Nlq894e1jjEz5/UPP3AqS32z6wxXHdovK5/2pEUMOBvb7mXQxyHZ9MeVdEliTQJc9f9pTbrwEH72OcebovNdXpkV8FUunotYmr3jR3Kst0n1WjwAUNdrBr3xZFyxjj0G+QSjRVdE2uAF+TLQMpI1qtr4p4KzOYO7360TYYH17N9Bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/LuE9t6xE7VgZDLpktxCcelohM6tQZoKemd1YsbKbV0=; b=WpiZj99KRUIVXO2z+/ysyzwbsMI9rcpbS9l6U3jQvjOVpFKwvOIdpRju8YqN5gFD77cze6cLPy5rpnqdtA9CJ17IFj7TgKHAGIHIsuzv81/faAFLeCajs0FhnlmpykaLLNdk6el713Ig0QaBj9lLUrvLO9CaFY55IxEm5A1YZqc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AS8PR04MB8296.eurprd04.prod.outlook.com (2603:10a6:20b:3f2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Mon, 17 Oct 2022 07:39:23 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::181b:75f7:dbc8:b4bc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::181b:75f7:dbc8:b4bc%6]) with mapi id 15.20.5723.032; Mon, 17 Oct 2022 07:39:23 +0000 From: Liu Ying To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, saravanak@google.com, gregkh@linuxfoundation.org, geert+renesas@glider.be, krzysztof.kozlowski@linaro.org, robh@kernel.org Subject: [PATCH v4 RESEND 1/2] drivers: bus: simple-pm-bus: Use clocks Date: Mon, 17 Oct 2022 15:40:38 +0800 Message-Id: <20221017074039.4181843-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221017074039.4181843-1-victor.liu@nxp.com> References: <20221017074039.4181843-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:196::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB8296:EE_ X-MS-Office365-Filtering-Correlation-Id: ee2c4fe2-dda8-4219-e034-08dab012b5a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c+vkZl6Pf2CTX90/qRcYxaE5058DMHqJs0y1jrpOmVM/5Wq1Je9HKS0KbGsOfDT/oE8Qw3j64tyTWyX5ZmaBfZZoJ0KFIOceCA1N/T4xPSDXhLXSji2+n02UK0Zna2Mf/tkrWD31W37en+TMUvVZXGyDW07E8dhronCASO2Lco8lls16N73bcrEe1FLp+xG8KP/HpDAjIecnDVslQX8/GgTCwbyrhHbFRPH2y8PifUs/t0DSjffbseMU6SozaeW8Vl8FtlEpcVvuibsU9EGF2paOTW0F+ET4cyqAmef2jau3M/7cf/bT5pbGrnIfxIHsbmiXDTnSkdpb1v16sZC/tk9KfI8KCK1wTiBomsnTxDQQ+yJmg+QewS/d1D+eIxVIJ2KcFtUi93Nlpz4m53O5yXny3Z+PtN1FZ75gWh2CSCEGKQcymIhXCOhh7dbdSfkLUcEn8zbuAIvCIJppeeYphdqzHc9eOy/kK1eHM5q8BUnJpe4MeTuc2G4NApgimUiQx224RwviZo4PfOgrjvxZtSUpbrCGaLILJGIbuTUAYn0uCFEXzsmc3RcbdiK/WpMegrZxqIWjKAf7V+rcJgnHYeeXTszfO44v4NLTPvLe+8MN+z9QFfv90veBE8hkIV0kIxIdUn73OpQDUUvFlCIx/F4ApIZcOJt5/LGJdXnysxsYk0rwLEYj21fZOrZ9qD14cDDgWER/DgZn6Wf2BEPOYOJ3SyhGgaqhyKy6hwChT+OwrOPps5ekX1KlLuIbFz+Oc3qDvlNbW7NhsJAlys9aiw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(366004)(396003)(39860400002)(376002)(451199015)(4326008)(8676002)(6666004)(66476007)(66556008)(66946007)(83380400001)(52116002)(6506007)(36756003)(86362001)(41300700001)(5660300002)(26005)(6512007)(8936002)(7416002)(316002)(2616005)(2906002)(38100700002)(1076003)(186003)(38350700002)(6486002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w7g8z3ZIKhPcrWpgLcFqRNdqGnkiJDCbbc9VP4Jin2kLLOEUazOmXliPEwAJyzxw4a9AYBhv9LzNJvECOMrrl1U37uH0+lZ/2nNA8EDLU72eqLVsjC3iRj4fKoIamMPzv5d+niVK6V0ejwbUW3HEGjOlTbjGXxAFEyLWxt2s+ZZWqm6QXAEzxlW5Lfw7lt74soXvzklU5xoJ0GZNTtf7w7RUzqX8wS/KNhwjR3chb9Ln4GL1kUmeFDky+3Wp3DETXqAisJJ5cW+YzmRFW4zHKibOu7ZZvvrnVrS4mJw+d9L/8HobwHtdoTjpxfGRd8fUYAJCFW6vHF9KQ4EDTCdZ86gqx0O53Qp7nCFlNBBApyDD1+HSgdTqQ9NoSpyiDtZ9nBGkNOEOGRZNXQ+bTinHImAW8T6eRKeCuzeIfeXcnvZ9zQmBAZ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cSyBSrDI6fWwX7xeDwH4k9BZnDGvtWZFOb3wc/BmlPs19nYwgw1OMz/JN2IJmLw80r35/OKmMx8aOqizaoCf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee2c4fe2-dda8-4219-e034-08dab012b5a3 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 07:39:23.2161 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Rxv+cZBSBuAeeAFMzhqcNUe6N64MjAuskOvh5Cf62S/0JgPbuWWyqkBHLQiAwfzugunTx3P5hUPfWVDH+GoVkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8296 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221017_003925_030271_36BFFB4C X-CRM114-Status: GOOD ( 19.43 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Simple Power-Managed bus controller may need functional clock(s) to be enabled before child devices connected to the bus can be accessed. Get the clock(s) as a bulk and enable/disable the clock(s) when the bus is being power managed. One example is that Freescale i.MX8qxp pixel link MSI bus controller needs MSI clock and AHB clock to be enabled before accessing child devices. Reviewed-by: Geert Uytterhoeven Signed-off-by: Liu Ying --- v3->v4: * Drop unnecessary 'bus == NULL' check from simple_pm_bus_runtime_{suspend,resume}. (Geert) * Add Geert's R-b tag. * Resend v4 based on v6.1-rc1. (Greg) v1->v3: * No change. drivers/bus/simple-pm-bus.c | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index 6b8d6257ed8a..d7b043fefde9 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -8,17 +8,24 @@ * for more details. */ +#include #include #include #include #include +struct simple_pm_bus { + struct clk_bulk_data *clks; + int num_clks; +}; + static int simple_pm_bus_probe(struct platform_device *pdev) { const struct device *dev = &pdev->dev; const struct of_dev_auxdata *lookup = dev_get_platdata(dev); struct device_node *np = dev->of_node; const struct of_device_id *match; + struct simple_pm_bus *bus; /* * Allow user to use driver_override to bind this driver to a @@ -44,6 +51,16 @@ static int simple_pm_bus_probe(struct platform_device *pdev) return -ENODEV; } + bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + if (!bus) + return -ENOMEM; + + bus->num_clks = devm_clk_bulk_get_all(&pdev->dev, &bus->clks); + if (bus->num_clks < 0) + return dev_err_probe(&pdev->dev, bus->num_clks, "failed to get clocks\n"); + + dev_set_drvdata(&pdev->dev, bus); + dev_dbg(&pdev->dev, "%s\n", __func__); pm_runtime_enable(&pdev->dev); @@ -67,6 +84,36 @@ static int simple_pm_bus_remove(struct platform_device *pdev) return 0; } +static int simple_pm_bus_runtime_suspend(struct device *dev) +{ + struct simple_pm_bus *bus = dev_get_drvdata(dev); + + clk_bulk_disable_unprepare(bus->num_clks, bus->clks); + + return 0; +} + +static int simple_pm_bus_runtime_resume(struct device *dev) +{ + struct simple_pm_bus *bus = dev_get_drvdata(dev); + int ret; + + ret = clk_bulk_prepare_enable(bus->num_clks, bus->clks); + if (ret) { + dev_err(dev, "failed to enable clocks: %d\n", ret); + return ret; + } + + return 0; +} + +static const struct dev_pm_ops simple_pm_bus_pm_ops = { + SET_RUNTIME_PM_OPS(simple_pm_bus_runtime_suspend, + simple_pm_bus_runtime_resume, NULL) + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) +}; + #define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */ static const struct of_device_id simple_pm_bus_of_match[] = { @@ -85,6 +132,7 @@ static struct platform_driver simple_pm_bus_driver = { .driver = { .name = "simple-pm-bus", .of_match_table = simple_pm_bus_of_match, + .pm = &simple_pm_bus_pm_ops, }, }; From patchwork Mon Oct 17 07:40:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13008261 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 E5B83C4332F for ; Mon, 17 Oct 2022 07:40:48 +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=y2HdO3tqN6NNIkCOzC1L6YRO2nylD2DBgnhjJgeoIUE=; b=02HNCe+vQyW5rX ZWgSRTzC+9AsD5uUHvCVaIn74xqWaJNFE1UtA346ye0SFkiEjVDbI+i2jPMBPYYsjNUXFYF2Pf1Bg IkAf+EnHXAbRuTseULN8u3Wz4M5FZB4YfgPKXSUnDRay0pWq/XxHo36iH9fiqKCQFdWQxWIAP74tR MdOYZaWDu/DUu1xhP1fF+0lON0Orv1C3kb6/UiDNLrYvVoi3ur05ZzJWvPzlMjn3fPb+ietZV2TsA L/jBMfZiaAXLa24FGdP+aUlVx/kFsVtYx7IA4nbO8qcuNZ9yN/4+ieIeZfhsuvmaJXsytBrnExeIZ 6EY7F4ep3AV/gA6VMm6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okKiu-008Vfm-TU; Mon, 17 Oct 2022 07:39:45 +0000 Received: from mail-am6eur05on2050.outbound.protection.outlook.com ([40.107.22.50] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okKii-008VWB-Jj for linux-arm-kernel@lists.infradead.org; Mon, 17 Oct 2022 07:39:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8+75v/OVN3cGNeZOqAs6dbCP+gmMNBmglEYOUFf7U5W42EkFr+mO6SDjqIkpj7/YBYUUK5Pept3yCN2KI+/4Qpohy30ibiWr2NeQVoV0gMOT94R0PJrUkjvJSL8GHWjZcBW/R8zXi/y2ohikLP7XO0+v/CWlvCHBflBT00jtzVjdotOfGT2dH53hz8zvT2zDY0aXZHKoVHDzmJuJ2fqd32rqNJ0JqHA8YUVQVy1WAeFgPGGEvxTNmxWZGrD9DCfGzsajVsFQZEBHNVd1lofbbPKIP+bJIC8VsbMnbaJzkHwdTGV2C/aTOBNryNCkpDdpyzE3ySwqrEzHmQqDZ3qyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nJDEDv1VRRd0eGjIGre7g6bjvhDBPv81iXX5yZ29A5s=; b=bhobrGP+P/MIZt235g/1VGrNZtq+J9KC0OtYKe5yHy2PEIX1Blr0k9SaC9H+FU8pC9++dPUGjjZ3JNdro8fl8htxPepLbXC0o096cvTYqRQnh9Ej7JNNSffZC0wumwbxsnwj7c5BBWqXOICgnWzJ2L4fiPHf6WzcFNMdTCa3oV8L99Y77NugspraCUEhzqIv2vQOEAVcVPKQmGo2xvmYgtbclljbYq4fG2SUsmYvPbdYqTezBikMftsIv+Wg/0bE1uI+6yW2xuYmXxnD/7DMQgbl8wfW4w+GzKzRfMMGYjAbMRne04sOjLcAlMTiEBZ6P45K0TO5vBGwffeIYQ9K7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nJDEDv1VRRd0eGjIGre7g6bjvhDBPv81iXX5yZ29A5s=; b=gj0rl7lp5fimUJfQFV7XEqRGbb9HK25acieChsr80Uavaca5FlwoRIYOdmTuCwyu20zYC5P3Wcco9TQmdgAxf9IgrxnwUqeOcX1L0fI+ZNK/XQDOGZs3ajIDlz39XQy0Dlm9nbCfTVe5uLG1bM1CVpvroXVBRpjvMIYMf9dWNAc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AS8PR04MB8296.eurprd04.prod.outlook.com (2603:10a6:20b:3f2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Mon, 17 Oct 2022 07:39:29 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::181b:75f7:dbc8:b4bc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::181b:75f7:dbc8:b4bc%6]) with mapi id 15.20.5723.032; Mon, 17 Oct 2022 07:39:29 +0000 From: Liu Ying To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, saravanak@google.com, gregkh@linuxfoundation.org, geert+renesas@glider.be, krzysztof.kozlowski@linaro.org, robh@kernel.org Subject: [PATCH v4 RESEND 2/2] dt-bindings: bus: Add Freescale i.MX8qxp pixel link MSI bus binding Date: Mon, 17 Oct 2022 15:40:39 +0800 Message-Id: <20221017074039.4181843-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221017074039.4181843-1-victor.liu@nxp.com> References: <20221017074039.4181843-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:196::12) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB8296:EE_ X-MS-Office365-Filtering-Correlation-Id: 49754669-1f02-4a7d-3ab1-08dab012b984 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bni484sZjUulPlT6X3B1jzbdyh9bd3omS9KsFhUQwPZ0uIyVlhuJljtu44UUIgvRCyRrq9efIuBFMo5rjrB8KnSSu4JfvCUyqwvMrXUIoQpxf2mjhrz03nFaKcr9mgTg3vBr7PoYObZW4OUxak7akdWAjO7TkPqKIuFNJc95b+QKG+mI25RuSUh0XR+6cD7sWRmlLQfu7EBpT6YlWeuNtnOerqD9mgahpKhY65xodiCrmSs01lIV4sZ3I91v1t2l6Kw4ne2EvyaixT3pw/oilF51lHLQwLMCPJT/zmo/eDX1XMAmfMBNr2jMFqT0G+EfWV1VyAqnvJVFAgIOrNnR4U2ramwUAKhLOHoUcb89Rzk1nBHQ0TfveRWbkjpmLkuqTrzvWZs/lelyfXxDCbHDCoHCkHpOGpUAQqCoZPBpB6/6WLAQ/5xoyTOYSgfbbzBpELHDKe/wIEu740/yCV4i138+KZJVL+NiCcKJcz2tnmKUV4yGri3J+9nr9kkQCByGxBYoX7t0x0TPcoColRRXDZPl0SaMFvbm3fV7X1/dk0Pv09YKpJMtm+WH4Jsy5XDOEUJ9PQ0ku5wjkqiJRNaSaEKCpObWA/Ta6R6iuKkCIP/ONaygxF2ap+GjT4wcmUr+Ar2yvTEI4JLywUSqVJ0hcmwbEeHHfWI+LnJT/Ufyt7MwoEUqoXKSQSfpHgeId4/ZC4TiF9qzGCwXmIjRAbFiqjnUx6Y8JV0Z1GDl4VcXRVzwhipnRpZXaZAdf+EpcyDRxet64I8VsE6K09CIfGA1T8nNrH8ZSaaFxi9wfbDbYJ0bkku6FwjoJpewe7r7n30xWwFJlONae/kiuKF48t4/Lw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(366004)(396003)(39860400002)(376002)(451199015)(4326008)(8676002)(6666004)(66476007)(66556008)(66946007)(83380400001)(52116002)(6506007)(36756003)(86362001)(41300700001)(5660300002)(26005)(6512007)(8936002)(7416002)(316002)(2616005)(2906002)(38100700002)(1076003)(186003)(38350700002)(966005)(6486002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vQmj7R1nU3nKnGQE3PFAskt7t2Vg3Umrx8PE816gd/w7Wv9BBbo7vzuz9YO9L1GIYR52y5vgFsKeAXu7ky4Ev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74TJomEU3TwaBnsEXahrfS96H/ZVb5INxeYu/HYJqhCTp8nPL24x/fh+FFMyecs5IZF4FbcfqwJXzduYnlhRtU2UXyk1ZYmZhhNrwqs0mwuSlpDiMmMgYiJ6SRyKPrHSQtlU4UaUBiH5zMT6UnfJSyLwy4YEpPPQU2nwo2lBcarWLYNfUW5vzM8S81J9weiBdiNZ2MpCaANeP4jonpCODEFHAyNxEbgvz1ZUqfDtJkcEr0OPACfLizweNgRcxlQwuyXrX5+xBZ5NDGeripzw8e/hKDnPFP62cveUs3Wj8sxnwb4OUprOasc/8RUbOqKnxTx+fCsvgvNIQ0xWh4BZb2zlrGEkSGzwRKRX8zYh+f3U8uTrT8qFQb38zkY+8Br/zZcE3H5IkLAzoC6/z/hVU/+j1iImzAO45pYudMYrXCp1rMVsWdlBfQ4CO67I7SDpt X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49754669-1f02-4a7d-3ab1-08dab012b984 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 07:39:29.7977 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q7zTplxcey6Y0SJbvDiUvvU4efq7PDfg9PFjZ8HDsLJO4uGjuraFxJ79p7TxFrU7IA0aRIW2+swg6/h7CW6Flg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8296 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221017_003932_823072_B568D61F X-CRM114-Status: GOOD ( 21.00 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Freescale i.MX8qxp pixel link MSI bus is a simple memory-mapped bus. It is used to access peripherals in i.MX8qm/qxp imaging, LVDS, MIPI DSI and HDMI TX subsystems, like I2C controller, PWM controller, MIPI DSI controller and Control and Status Registers (CSR) module. Reference simple-pm-bus bindings and add Freescale i.MX8qxp pixel link MSI bus specific bindings. Reviewed-by: Rob Herring Signed-off-by: Liu Ying --- v3->v4: * Add child nodes in the example MSI bus node of the MSI bus dt-binding. (Krzysztof) * Resend v4 to imply this patch is based on v6.0-rc1 so that there are not any dependencies. (Rob) * Resend v4 based on v6.1-rc1. (Greg) * Add Rob's R-b tag. v2->v3: * Add a pattern property to allow child nodes. (Rob) v1->v2: Address Krzysztof's comments: * Add a select to explicitly select the MSI bus dt-binding. * List 'simple-pm-bus' explicitly as one item of compatible strings. * Require compatible and reg properties. * Put reg property just after compatible property in example. .../bus/fsl,imx8qxp-pixel-link-msi-bus.yaml | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml diff --git a/Documentation/devicetree/bindings/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml b/Documentation/devicetree/bindings/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml new file mode 100644 index 000000000000..b568d0ce438d --- /dev/null +++ b/Documentation/devicetree/bindings/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml @@ -0,0 +1,232 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8qxp Pixel Link Medium Speed Interconnect (MSI) Bus + +maintainers: + - Liu Ying + +description: | + i.MX8qxp pixel link MSI bus is used to control settings of PHYs, I/Os + sitting together with the PHYs. It is not the same as the MSI bus coming + from i.MX8 System Controller Unit (SCU) which is used to control power, + clock and reset through the i.MX8 Distributed Slave System Controller (DSC). + + i.MX8qxp pixel link MSI bus is a simple memory-mapped bus. Two input clocks, + that is, MSI clock and AHB clock, need to be enabled so that peripherals + connected to the bus can be accessed. Also, the bus is part of a power + domain. The power domain needs to be enabled before the peripherals can + be accessed. + + Peripherals in i.MX8qm/qxp imaging, LVDS, MIPI DSI and HDMI TX subsystems, + like I2C controller, PWM controller, MIPI DSI controller and Control and + Status Registers (CSR) module, are accessed through the bus. + + The i.MX System Controller Firmware (SCFW) owns and uses the i.MX8qm/qxp + pixel link MSI bus controller and does not allow SCFW user to control it. + So, the controller's registers cannot be accessed by SCFW user. Hence, + the interrupts generated by the controller don't make any sense from SCFW + user's point of view. + +allOf: + - $ref: simple-pm-bus.yaml# + +# We need a select here so we don't match all nodes with 'simple-pm-bus'. +select: + properties: + compatible: + contains: + enum: + - fsl,imx8qxp-display-pixel-link-msi-bus + - fsl,imx8qm-display-pixel-link-msi-bus + required: + - compatible + +properties: + compatible: + items: + - enum: + - fsl,imx8qxp-display-pixel-link-msi-bus + - fsl,imx8qm-display-pixel-link-msi-bus + - const: simple-pm-bus + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: master gated clock from system + - description: AHB clock + + clock-names: + items: + - const: msi + - const: ahb + +patternProperties: + "^.*@[0-9a-f]+$": + description: Devices attached to the bus + type: object + properties: + reg: + maxItems: 1 + + required: + - reg + +required: + - compatible + - reg + - clocks + - clock-names + - power-domains + +unevaluatedProperties: false + +examples: + - | + #include + #include + bus@56200000 { + compatible = "fsl,imx8qxp-display-pixel-link-msi-bus", "simple-pm-bus"; + reg = <0x56200000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&dc0_irqsteer>; + interrupts = <320>; + ranges; + clocks = <&dc0_disp_ctrl_link_mst0_lpcg IMX_LPCG_CLK_4>, + <&dc0_disp_ctrl_link_mst0_lpcg IMX_LPCG_CLK_4>; + clock-names = "msi", "ahb"; + power-domains = <&pd IMX_SC_R_DC_0>; + + syscon@56221000 { + compatible = "fsl,imx8qxp-mipi-lvds-csr", "syscon", "simple-mfd"; + reg = <0x56221000 0x1000>; + clocks = <&mipi_lvds_0_di_mipi_lvds_regs_lpcg IMX_LPCG_CLK_4>; + clock-names = "ipg"; + + pxl2dpi { + compatible = "fsl,imx8qxp-pxl2dpi"; + fsl,sc-resource = ; + power-domains = <&pd IMX_SC_R_MIPI_0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_lvds_0_pxl2dpi_dc0_pixel_link0: endpoint@0 { + reg = <0>; + remote-endpoint = <&dc0_pixel_link0_mipi_lvds_0_pxl2dpi>; + }; + + mipi_lvds_0_pxl2dpi_dc0_pixel_link1: endpoint@1 { + reg = <1>; + remote-endpoint = <&dc0_pixel_link1_mipi_lvds_0_pxl2dpi>; + }; + }; + + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch0: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_lvds_0_ldb_ch0_mipi_lvds_0_pxl2dpi>; + }; + + mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch1: endpoint@1 { + reg = <1>; + remote-endpoint = <&mipi_lvds_0_ldb_ch1_mipi_lvds_0_pxl2dpi>; + }; + }; + }; + }; + + ldb { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx8qxp-ldb"; + clocks = <&clk IMX_SC_R_LVDS_0 IMX_SC_PM_CLK_MISC2>, + <&clk IMX_SC_R_LVDS_0 IMX_SC_PM_CLK_BYPASS>; + clock-names = "pixel", "bypass"; + power-domains = <&pd IMX_SC_R_LVDS_0>; + + channel@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + phys = <&mipi_lvds_0_phy>; + phy-names = "lvds_phy"; + + port@0 { + reg = <0>; + + mipi_lvds_0_ldb_ch0_mipi_lvds_0_pxl2dpi: endpoint { + remote-endpoint = <&mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch0>; + }; + }; + + port@1 { + reg = <1>; + + /* ... */ + }; + }; + + channel@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + phys = <&mipi_lvds_0_phy>; + phy-names = "lvds_phy"; + + port@0 { + reg = <0>; + + mipi_lvds_0_ldb_ch1_mipi_lvds_0_pxl2dpi: endpoint { + remote-endpoint = <&mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch1>; + }; + }; + + port@1 { + reg = <1>; + + /* ... */ + }; + }; + }; + }; + + clock-controller@56223004 { + compatible = "fsl,imx8qxp-lpcg"; + reg = <0x56223004 0x4>; + #clock-cells = <1>; + clocks = <&mipi_lvds_0_ipg_clk>; + clock-indices = ; + clock-output-names = "mipi_lvds_0_di_mipi_lvds_regs_lpcg_ipg_clk"; + power-domains = <&pd IMX_SC_R_MIPI_0>; + }; + + phy@56228300 { + compatible = "fsl,imx8qxp-mipi-dphy"; + reg = <0x56228300 0x100>; + clocks = <&clk IMX_SC_R_LVDS_0 IMX_SC_PM_CLK_PHY>; + clock-names = "phy_ref"; + #phy-cells = <0>; + fsl,syscon = <&mipi_lvds_0_csr>; + power-domains = <&pd IMX_SC_R_MIPI_0>; + }; + };