From patchwork Mon Aug 22 06:03:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 12950202 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 B33B9C28D13 for ; Mon, 22 Aug 2022 06:03:29 +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=vasxPEsWvEMukmMtX8Zqdy33CFPWjLL6ZB3tLjRNQWU=; b=DRnJaXqYllX4+4 Z0ZkLEN+2dYl3H7rzeegiNeRavfV5o5XSqmiQWJEYyoeIPcDyvq8l5ocGt05YJk7pHYlDT+sxjsaZ ocC1VBhA1FPzZ6NG0E8jDqLxT0TEzO9qO9kaemLmTDVwiEn6M5G/ADArrc0ayA1xuqNgGoWlbjCUF F8ajT0q9HoOmXqm7WWGcoPFA9uo5f5C42vYe0yK7LpmyWrLXNuC2AjpN9kKnQHrmLRrCeavGWBuFd oWQM6tAx4aG0dX3hadSG4HdFxXxghjp40/MbUSf3aL4nor/CIXD/6UT+/2dEQChRZtGAkAByg5PBH ntQK96sPg3K22DM3PX7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ0Vy-005GeK-Pu; Mon, 22 Aug 2022 06:02:22 +0000 Received: from mail-am7eur03on2087.outbound.protection.outlook.com ([40.107.105.87] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ0Vj-005GVn-El for linux-arm-kernel@lists.infradead.org; Mon, 22 Aug 2022 06:02:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Whdgn5CG25N0VQ4CUcxYuJyCq9iE/0Mfg8GF8PJlk8ewxjrhf77OSOJ/cl9PmYE+lvcO6f0fLowrZ+jMwwwjTODf0psdMRMcofO9ohYnSRr5LpWknxR8DT0Y9XEQlnIehSWhzr+Jcx/HP5oymhTINDs3Kegl62G86PmKB5TLw47mh4MsmF6kAY08yDKsittkas/hP8f7ZLbME8bvLikoGRdRTpSfaUv0g6JR2KiCux8naO8bN36v90Fo80g56XSeOEOGjs4Hf+Wc8hr4ruEOmlBrJTBLn8bNebHyjC12MLv3BrHWqTIQSd6aBif4QTFUT7MkeFzEOznIZ8SBnpVPpQ== 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=lAxYOfz3sZc+r6ojdxKXSBJrhK0IXn6bj0q+c+eoq+I=; b=nNABbCiEb0cttG/H2Uh06ht+hPInjwHX6hHzpn/NTZqoVGeML6ZImInA84k/FC7wMLs1PjGa47i7Ew5Sccz+BD1KSE8vEzj8nmJf2Xs3XFsHgP5Z+cjfZ7lmrguC+0iDsWCP+S4KM0TY1ZAabJfYJZ9qNiJLJJL0uzdPIOzfhliHBtdbggUScr9RzE0ePohmtiTxz4rc8uDvEzuGE8p2yftxvt++DAbD3bsrSOzdnDqwcerfiQR6LISdO71wXkqKuqVnSDHnJFCfCtMAU+jkWq7BaZ8m8M3T9louPObuQs8D3fbIyOaPnDA9Ha0Vdc/Q08B4g08oewAmc+BCCNpfOg== 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=lAxYOfz3sZc+r6ojdxKXSBJrhK0IXn6bj0q+c+eoq+I=; b=XTZOzy33Lbz2JOvmKsRPhXSiBNroI+NI6Ymx9jE7WoD2Tpt8ohOYEul1+E3EajkMeskBVQhVXX042Czp/vJlrmZIcxIlnemca1QVjLPg6gUubCIOX8Em26DyWXqB0Aa/cxUqflvYY+H55UPIaMrocA/2ud6ybR6ifNdwQED4+P0= 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 DB7PR04MB4604.eurprd04.prod.outlook.com (2603:10a6:5:35::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Mon, 22 Aug 2022 06:02:03 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::2549:869e:d80b:3a1b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::2549:869e:d80b:3a1b%6]) with mapi id 15.20.5504.027; Mon, 22 Aug 2022 06:02:03 +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 RESEND v4 1/2] drivers: bus: simple-pm-bus: Use clocks Date: Mon, 22 Aug 2022 14:03:22 +0800 Message-Id: <20220822060323.3481384-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220822060323.3481384-1-victor.liu@nxp.com> References: <20220822060323.3481384-1-victor.liu@nxp.com> X-ClientProxiedBy: SG2PR06CA0224.apcprd06.prod.outlook.com (2603:1096:4:68::32) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abfe2cd4-7d7b-49e5-250b-08da8403d5d9 X-MS-TrafficTypeDiagnostic: DB7PR04MB4604:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DWxkYL5N/2rQvjN3dXwsbfF2CrxTe3nrjujZS1G8It+OafXHGv69b1d5jpV/nb5j2uazzzwMJbJ9okkWlaytxzE0rLJqmZd5swiY/H9Q6UACLfUempxo+U1dRQ09u2QlSPJVsrVxqy9/PRcfmBnuAS6fz0qeJT1zhMhCXH9Y0TbdJ6eYeBCfAe/nbZcLlOwCQdqu/uGI/kfpmXl+ZuvVJOvagUZUwRR4Vx32vWFkIijy+8WxX1N8RUtifOxFBIsQMOHIfF2n1Gq/GXMecp7VSmHIDHxrwRzHbQHDTpeJo7Iv4Sfyzpz3Wc3yJiosUnkyMqfyp7ss16MyIGLCRMFV/0LqHQ2YRpD2EGH0UlnzSCGSoxNcYZ/i7sQGR2HKq0tp9lp7iCETPkgjQupa04gXA/V60VFybTussBZFqXwOQIDgZariqFjAbWRvEVwx8eKhulTqdXNZ681KINZiCRSyzr2nUMur0Yx7aPQJJKHnKJ97u9u4jogNgXLh2l7LK8JX/iCtVZbrDcuP4Pbq3lzlqueC9u1v3dsv/6sZt6kyLfpQdKa8L8VE7M0XRJ46EmLcOSBXQ0CWmqVd9hNkcvA68zKySBrJzrF9jsFjn+y5DvfsCRTnbescdWk2LrGh1nQA7sn1eVbWVf/ug7c7axTD6zQIega4TbAn+5uhdsuPW9ZkH9EbQthfSLaEPqH4f78QpQN40SZXdIvDqo7kHLFdGOgy0Ao+pPvAijAb2OhPIljlwmTfDR/vHlAwV2OMJFjMLWDtt5hMxIZPpOp68mXbfg== 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:(13230016)(4636009)(366004)(39860400002)(376002)(136003)(396003)(346002)(86362001)(83380400001)(38100700002)(38350700002)(316002)(8936002)(66556008)(5660300002)(7416002)(66946007)(66476007)(8676002)(2906002)(4326008)(1076003)(2616005)(186003)(41300700001)(478600001)(6486002)(52116002)(6506007)(6512007)(26005)(6666004)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iKIOIiWACpzUG09mPPXQQ3UyD7RXidpIDhTCOt/nSwYI9DbXoo+QcEf63Lvc4DT9LN3Dgy7PI0XdhBcny50cg9ngoZqRclMKcbSer/KQja3RDpE9z71eR8UVvgbmNgmnDXy2j3dIPQaAEL9ZhfqwWS63Fq77/bPftmHddv8+rW1+iiBlLROHKNBo+PNBwRedKWWYLdu0X0hVhE63CTYISZs2Bl5l97kZ2Ljf0RPOY5ebaLR6mdz/1LQGUsnIv9nWIqDX0xlzHq4INyPIId0TgS2XqCQELTWaYdbEhRAlo+Mgp/xJTDVTlp2vZLbdsBpqg4gdJXl3hlcVOplthwx4mGNj63bzCeDuL3Ey1T8GD5cizS6CoWLmWYpwKD+ZUPvQy7OaJAv0UNYfGjUl8ryFJNxNjkQKDvv3QC2U493IgtUYGTLigGDNWC1bR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sw4JUcEXHy3KlQLmHujebxicL8H46JUXTfbo/RLV/V+uFbDo94YTbKJV4i6MEnfw4aWLDi+M6ZZQmWyS9W7nNCkfhenqmi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: abfe2cd4-7d7b-49e5-250b-08da8403d5d9 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2022 06:02:03.6392 (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: J7QIRSFBRNG+TMWo3Glhy2l2oSbpy7TIoNB7210tRGryuUmyIqoyFoibtkKUDLz9fmS9MEVbkI3nGmkh8mNrPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4604 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220821_230207_568907_C5E27315 X-CRM114-Status: GOOD ( 19.44 ) 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. 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 Aug 22 06:03:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 12950203 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 78D29C28D13 for ; Mon, 22 Aug 2022 06:03:40 +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=TH1PfZk6eD/NI9IDVrSwxy3m777n+cpL6ZE7OKoBpJY=; b=ylBB8cFHJvt/g8 SEvURGrIwS8bBZ1HysILHMM/zXfTYadC+sGcHOeRmzZOO4tTrMnc1SAZBpiiNjRlIABgTs81+tINV IAY5Vyb1rWeCanQHBt/zgJZTtEJNPfEp2euh0lEpWVl+sGbVOVJUmQPkvi8iU3pRyT5HSioBBTQ5m BLvywQoIuVp0IER/hg104K65iWrorRgbuBVUPrkEtEKKFwOedehYtnF5a7xrDA1EqgSs/EffQwUY3 T+oMNyMUJHZ8MiQxw0pt0lBGKTkxTsSpM+MyFoET+nljLs5ERPNxmw5E4inaP9clnkgx4RsJSlaDH JPHNJzH0rRw06UsWpgow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ0W8-005Ghr-77; Mon, 22 Aug 2022 06:02:32 +0000 Received: from mail-eopbgr80052.outbound.protection.outlook.com ([40.107.8.52] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ0Vp-005Gan-5b for linux-arm-kernel@lists.infradead.org; Mon, 22 Aug 2022 06:02:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPm/hvk3C8rfbX7hgJuSSV98q7BGlezZwZ9s1qECbWP5of5KQxcv8k+sFJKZjZxZuTbaa/33A2X0vodtbi66p7PXJws35n3jtCpRMFTapY/i89/4WS4ilzDH3c6fd09khCVLhFmTMjTZp3K6Jbt/S/C3FCf60To8U2OczfPD/vXXWH/bbkcEwUVLMYzdvwcq0Lj8+pATqovd0qDPy7EVMK5dGm/o+k8ZHpOnSp+mqk17JlLjJypa+/NqY18XSvmtC1mDjBvHNVIM6VU1rJ8YUOuGkoHJMH0Kk3m96Rp7k/J8iBr73nS+XAGRps3qAZO5mDbdwpdzs5y821G4SB5haQ== 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=G5Qz/xZ9bzxPcMnxHffUArFRPcezeVaXDHcoxVlcbyA=; b=lPOIWDUO7WsuQD3TwnF7wO1f9oVcC8GXtv06nRTZ9oDrndrkNGcB6UT+ogCkJk50y1xcNqHwNDhg9JD3ubaojAiplf7rXmcbIehrY1C2cG3Ld07Ousu3kamnKEeeZEchY3X706E/cTz4aP/gVglEmc6pJcQymjDYneK6hgsWDqCKWv7iRE7xdHkTEwrLWFT63AuytdFKJbbuKhErlczfYHDX0dTT+BmBv0bMipTdPnw/hDuDboi+eabQF3v7stNM8ektDLme1a3uVhBrBdG4z4NPTMypWoT0tDyaceju0bVRGoCizM4ADIzYpzBkXhH0tCi9oJvjnv7e7E+z575ZAA== 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=G5Qz/xZ9bzxPcMnxHffUArFRPcezeVaXDHcoxVlcbyA=; b=P028fCw7Bg4pHmLSTmOSc6sryA3yvCwp7ctt/qon1mXtDTqoFMFs2vyWTdPaQnyaVjFNxG7zcDoMCGp0v4kVtDmq7AizCF2XBz89d1lqxrjk1Nyrq/PQJx9TT815csanl+MYRaWtqHQTNIeNyNtEk9iCAByGaalQfFG1UI2vcR4= 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 VI1PR04MB5135.eurprd04.prod.outlook.com (2603:10a6:803:62::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Mon, 22 Aug 2022 06:02:08 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::2549:869e:d80b:3a1b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::2549:869e:d80b:3a1b%6]) with mapi id 15.20.5504.027; Mon, 22 Aug 2022 06:02:08 +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 RESEND v4 2/2] dt-bindings: bus: Add Freescale i.MX8qxp pixel link MSI bus binding Date: Mon, 22 Aug 2022 14:03:23 +0800 Message-Id: <20220822060323.3481384-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220822060323.3481384-1-victor.liu@nxp.com> References: <20220822060323.3481384-1-victor.liu@nxp.com> X-ClientProxiedBy: SG2PR06CA0224.apcprd06.prod.outlook.com (2603:1096:4:68::32) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f042a092-cfac-4945-4080-08da8403d8e7 X-MS-TrafficTypeDiagnostic: VI1PR04MB5135:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5daS7exzWfOppEjens1wYwdx3F0uin8yUi1yvxIVsOODlWYT4/a/ohAz18w/z3kaTPkY12B1iPL5BJO54HMcAk9RblqnhRxjxsgwfuB0SSUInRU9F031hxZuZRMw/hGrirKBGdPlwhM5Iftx5/zb7ZxIwDiUN90AijPTZX0ngfaj6skF1rSr7o69HyhoInOwZTRvZri9CNsGc4MbOKb7B3JDUmRt5Ol2Dn0zML3HpFg05JH+uZ9CaYEiiT3yHFXofX9X2HoZsK66HXxAmskPaeSGNROLfnxonw6RFvy0EZArZg8TAM61AhtRdY8U4oqoK6IAPRmJErEcdfAijiJeMACVqvyCxF0alHC1osDwUqN8VJ1QOc9nFS0fhYSCRNYOmcAibmyn+dMXn/tdG+F8279fdPZ3tjTvozshj29YDkTY3dCnPNTVynY8ZXM9cVesN/eMt3xbO7kuEFShi/FyVV16IvzSchhIbqdXP8fdr8xogDc2CEN+pDRtij7fJOlfrJPikOKX+DYoIMC1aoHDvVWIVUS8WicfY2cRruLKTwNfUPOv3q8sVY7/u47PA309i4KfurVTw4DzO/SJC/tK2cgI7bneEIao5yH5QFE9365pLJXWTqcu6BkwaJx1ZhIcPK5Pz3e2tGc8+gfYuMBM/9QyXSpcBgVs1s+QCP/tvSbyMUtWYRm5sqA2jOOW/aFL5eRHoRGCVdsdrHJ/ydmPQDNKXX8h7YjYjDhHu/yafzn8Oy6ANlrwBsLNczXHi3Ltnwa5luD3T9JN5Pd8obbh+GL8KDYxZAnHOaf4Gss+Di+2Z52x4+UuvBeAUrAtgided/OPkqXB7884HrdNfO4AJA== 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:(13230016)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(38350700002)(8676002)(316002)(66556008)(66946007)(5660300002)(7416002)(8936002)(2906002)(38100700002)(66476007)(4326008)(86362001)(36756003)(6666004)(41300700001)(6506007)(52116002)(966005)(6486002)(186003)(1076003)(478600001)(83380400001)(26005)(6512007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YquB3eBW35wzSQsKdd9zGVXHI320eou4eaEzrGfS+f3NT51X3nGSFHIJ0tYzvT2eSIgrWPvaQpQN17755+2rZdw6E4uOViT9g/pFfr0EKHZ4B8yfMRfo8bbQPwXyi/a2PlO9uLrP3cNbCHTqTUfAi4lM8MJbDrs6zcs5nWXaq3DqedpjmEc+jtF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1k7ddpRkoYYlc8ZW6iUkPB2RyLwQ4e5VHmiDzMVMq2djIoY/XQK11xyuXaC8GYvZw516wrsmY9ZCQ7QDLuadHo0dXdeoYC7mYrUvLiSiQP17jPqqpt/IzWHWIVkx0HmpdicccsdaAJrqpUiRlKwdYsGIRGIN0t2WjHhaADQPx46VSFtmZUfT1srNu5TjSehSJ1NF2r7PeW5QzJPPAL8empIDUKSuta2T6CShakIYjGuCLcboDMuONFaTVG9eoeU8kKruveC63UWzJAcKFoxINnV9uxBlOHOFNRV5NR4HCL8e6UaYqIU4IFIj8MZz2GMkP16pLyZeiiYdyevUYHFT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f042a092-cfac-4945-4080-08da8403d8e7 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2022 06:02:08.7816 (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: b5K8J3SNOn+S7Om8r7s+WGZ/7epQN00OWr3EwiuNxF+ih75yzYUvtnkTh7VESypFfXfec7rGqM45W6gsT1eudA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5135 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220821_230213_421275_1DEB6712 X-CRM114-Status: GOOD ( 20.75 ) 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. Signed-off-by: Liu Ying Reviewed-by: Rob Herring --- 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) 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>; + }; + };