From patchwork Fri Aug 12 00:35:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 9276185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 26EA2600CB for ; Fri, 12 Aug 2016 00:37:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17602287D4 for ; Fri, 12 Aug 2016 00:37:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ACAE287D6; Fri, 12 Aug 2016 00:37:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 80D49287D4 for ; Fri, 12 Aug 2016 00:37:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bY0SC-0002Fe-L9; Fri, 12 Aug 2016 00:36:04 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bY0S6-0002BU-Vn for linux-arm-kernel@lists.infradead.org; Fri, 12 Aug 2016 00:36:00 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u7C0ZXSx018426; Thu, 11 Aug 2016 19:35:33 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u7C0ZWcf003022; Thu, 11 Aug 2016 19:35:32 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Thu, 11 Aug 2016 19:35:31 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u7C0ZVpS028400; Thu, 11 Aug 2016 19:35:31 -0500 Received: from localhost (irmo.am.dhcp.ti.com [128.247.83.68]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id u7C0ZU317581; Thu, 11 Aug 2016 19:35:31 -0500 (CDT) From: Suman Anna To: Santosh Shilimkar , Tony Lindgren Subject: [PATCH] soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure Date: Thu, 11 Aug 2016 19:35:29 -0500 Message-ID: <20160812003529.519-1-s-anna@ti.com> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160811_173559_182169_0528D185 X-CRM114-Status: GOOD ( 13.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dave Gerlach , linux-remoteproc@vger.kernel.org, Bjorn Andersson , Rob Herring , linux-omap@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The wkup_m3_ipc driver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. The wkup_m3_ipc driver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property. The wkup_m3_ipc binding has also been updated accordingly. Signed-off-by: Suman Anna --- This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3]. With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline. regards Suman [1] https://patchwork.kernel.org/patch/9237767/ [2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2 [3] https://patchwork.kernel.org/patch/9276181/ .../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt index 401550487ed6..2ea7dd91acff 100644 --- a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt @@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */ @@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; }; diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index 8823cc81ae45..86085f9bf6a8 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -1,7 +1,7 @@ /* * AMx3 Wkup M3 IPC driver * - * Copyright (C) 2015 Texas Instruments, Inc. + * Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach * @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) struct resource *res; struct task_struct *task; struct wkup_m3_ipc *m3_ipc; + struct property *nprop, *oprop; + const char nprop_name[] = "rprocs"; m3_ipc = devm_kzalloc(dev, sizeof(*m3_ipc), GFP_KERNEL); if (!m3_ipc) @@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) return ret; } + /* provide compatibility for older DTBs using ti,rproc property */ + nprop = of_find_property(dev->of_node, "rprocs", NULL); + if (!nprop) { + oprop = of_find_property(dev->of_node, "ti,rproc", NULL); + if (!oprop) { + dev_err(&pdev->dev, "node is missing ti,rproc property\n"); + return -ENODEV; + } + + nprop = kzalloc(sizeof(*nprop) + sizeof(nprop_name), + GFP_KERNEL); + if (!nprop) + return -ENOMEM; + + nprop->name = (char *)nprop + sizeof(*nprop); + snprintf(nprop->name, sizeof(nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; + of_update_property(dev->of_node, nprop); + of_remove_property(dev->of_node, oprop); + } + m3_ipc->mbox_client.dev = dev; m3_ipc->mbox_client.tx_done = NULL; m3_ipc->mbox_client.tx_prepare = NULL;