From patchwork Tue Aug 1 15:48:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 9874893 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 767F160361 for ; Tue, 1 Aug 2017 15:55:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67B26281C3 for ; Tue, 1 Aug 2017 15:55:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A5C828710; Tue, 1 Aug 2017 15:55:36 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 CFD57281C3 for ; Tue, 1 Aug 2017 15:55:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751862AbdHAPv6 (ORCPT ); Tue, 1 Aug 2017 11:51:58 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:54308 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbdHAPu0 (ORCPT ); Tue, 1 Aug 2017 11:50:26 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v71Fms5I005506; Tue, 1 Aug 2017 10:48:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1501602534; bh=2KV56TowcDecn4g0osYA/I8GsRcOA75fER/8blCjUeo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=w4XnQOeBa1q9Nq4UgtpRJ8aPu1mdiGCvi3RFYY6AbWJe57TBDzo72tCmyvgbHTOXb vH/BWjrISvRWQqR/noBF3bP2SMd60b4DSBc2VrDNw4/ISGCLEafu05imlhnEiYzNA3 MWd2g4hjV8bExb5qV8ABY3mTMYsA5yqlBkhnfKFc= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v71FmnXN029864; Tue, 1 Aug 2017 10:48:49 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Tue, 1 Aug 2017 10:48:48 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v71Fmm5l008467; Tue, 1 Aug 2017 10:48:48 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v71Fmm323830; Tue, 1 Aug 2017 10:48:48 -0500 (CDT) From: Suman Anna To: Bjorn Andersson , Ohad Ben-Cohen , Rob Herring CC: Mark Rutland , , , Sekhar Nori , Robert Tivy , , , Suman Anna Subject: [PATCH v2 4/4] remoteproc/davinci: Add device tree support for OMAP-L138 DSP Date: Tue, 1 Aug 2017 10:48:44 -0500 Message-ID: <20170801154844.24662-5-s-anna@ti.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170801154844.24662-1-s-anna@ti.com> References: <20170801154844.24662-1-s-anna@ti.com> MIME-Version: 1.0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Davinci remoteproc driver currently supports the DSP remoteproc device created in legacy-style on OMAP-L13x SoCs. The driver has been enhanced to support the DSP remoteproc device created through Device Tree now. The current DT support handles the C674x DSP processor subsystem on OMAP-L138 SoCs. Signed-off-by: Suman Anna --- v2: - Add __maybe_unused and of_match_ptr to deal with non-OF builds - Rebased patch after dropping the interrupt management patch from the cleanup series, https://patchwork.kernel.org/patch/9735321/ v1: https://patchwork.kernel.org/patch/9751277/ drivers/remoteproc/da8xx_remoteproc.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index c1cff78de67b..bf3b9034c319 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -261,10 +262,21 @@ static int da8xx_rproc_probe(struct platform_device *pdev) return PTR_ERR(dsp_clk); } + if (dev->of_node) { + ret = of_reserved_mem_device_init(dev); + if (ret) { + dev_err(dev, "device does not have specific CMA pool: %d\n", + ret); + return ret; + } + } + rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name, sizeof(*drproc)); - if (!rproc) - return -ENOMEM; + if (!rproc) { + ret = -ENOMEM; + goto free_mem; + } drproc = rproc->priv; drproc->rproc = rproc; @@ -311,7 +323,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev) free_rproc: rproc_free(rproc); - +free_mem: + if (dev->of_node) + of_reserved_mem_device_release(dev); return ret; } @@ -319,6 +333,7 @@ static int da8xx_rproc_remove(struct platform_device *pdev) { struct rproc *rproc = platform_get_drvdata(pdev); struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv; + struct device *dev = &pdev->dev; /* * The devm subsystem might end up releasing things before @@ -329,15 +344,24 @@ static int da8xx_rproc_remove(struct platform_device *pdev) rproc_del(rproc); rproc_free(rproc); + if (dev->of_node) + of_reserved_mem_device_release(dev); return 0; } +static const struct of_device_id davinci_rproc_of_match[] __maybe_unused = { + { .compatible = "ti,da850-dsp", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, davinci_rproc_of_match); + static struct platform_driver da8xx_rproc_driver = { .probe = da8xx_rproc_probe, .remove = da8xx_rproc_remove, .driver = { .name = "davinci-rproc", + .of_match_table = of_match_ptr(davinci_rproc_of_match), }, };