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: 9276183 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 92F80600CB for ; Fri, 12 Aug 2016 00:36:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 773DB287D0 for ; Fri, 12 Aug 2016 00:36:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66E52287D2; Fri, 12 Aug 2016 00:36:03 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B23E4287D0 for ; Fri, 12 Aug 2016 00:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751439AbcHLAgB (ORCPT ); Thu, 11 Aug 2016 20:36:01 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:55283 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbcHLAgB (ORCPT ); Thu, 11 Aug 2016 20:36:01 -0400 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 CC: Bjorn Andersson , Rob Herring , Dave Gerlach , Lee Jones , , , , Suman Anna 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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;