From patchwork Tue Aug 1 15:48:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 109186 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1664619qge; Tue, 1 Aug 2017 08:54:47 -0700 (PDT) X-Received: by 10.98.8.93 with SMTP id c90mr5690725pfd.237.1501602887126; Tue, 01 Aug 2017 08:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501602887; cv=none; d=google.com; s=arc-20160816; b=Pi0UN99uKYAE3rGrqSKpljp/Dm13JT4eh4Kj+nkYcTJK4WdJfE0s4S97Nw5yZTSrm4 jvuAVq0pV5jye9UabGOtBH7NrH36tbU6Ii8XRbyzqkVbuR1//B0wPxkHP1QMA3JKaG84 ClaKFoJJ9/Uql8+YXME33vfXyWAC9TZ/DjfrAj2LvmnAq3pzzDvqi0KFfU5XSUSIFUwJ lZVXa1HD4G1QedNK+4T7owbHHjd3vjnDspsugwuCgvfCtDP+17IgGgD+jbpUpFhyodeh LWvUlx6s2PsrVr9w4N5rnYsKzFOl+RvmhyTljPat0JFv9+c7RpABFDaxZuVnwq7xPqbe p9rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=mkqmhnGdmywWwol9uIX4lDS1P6z/1eCTb32Pw67+IWU=; b=WsamNREC3LokbLC4pwZdttGFmWP73sUoI5bJnmAaFzUVtfpJwRX/vHr059XBFkTg77 PXKx42R/Ig4sz6HmjefNLCiUEuYLCxYWOCZLbuUxSJYmFUIpg7uAqegbfiGNkufVMecI ec/WjRqajCHPKe+hABrWCwKUca48dMzhK8SkNhrfUIuoUH9WZLixZmi/gfe6HQWYXCEz Z4GaVK+1w663zF5ciwrsPwWmkUKyyR2lKodxNrRnnvTNQNdE01drnKwX5Bdj0gBJqPlj J/mqzJIf+urSqCWDv1Lf1dvQkRumVFvzg9bGb/9ad8KHbbtVmMVyYroi5NLaIwdQlToj ozpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.b=NM+zU87W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 60si3951141plb.982.2017.08.01.08.54.46; Tue, 01 Aug 2017 08:54:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.b=NM+zU87W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbdHAPwA (ORCPT + 26 others); Tue, 1 Aug 2017 11:52:00 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:54307 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbdHAPuY (ORCPT ); Tue, 1 Aug 2017 11:50:24 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v71FmrYq005505; Tue, 1 Aug 2017 10:48:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1501602533; bh=rCc3sXx7d6xcZMwHU9flGeh1aR9F+8u/TjVmLksdi80=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NM+zU87WWQLi4OKIrTzV2ANeOfxzw0DmuZfdonB4K67Ozj5LkWGGK2Kgy3JJ4lZTB 20c1832Ta13btdM5lnI7EsHMM6pYoqojNeE8YDjDhVXO+IHZ2jy21WCC1TsqxuPr49 /Zl20pb8OGhjDzHuIHSPgCadLfGAsixfoM/9f7jQ= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v71Fmmmr001096; Tue, 1 Aug 2017 10:48:48 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) 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 dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v71FmmiK020935; 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 v71Fmm323822; 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 2/4] remoteproc/davinci: Add support to parse internal memories Date: Tue, 1 Aug 2017 10:48:42 -0500 Message-ID: <20170801154844.24662-3-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DSP subsystem on OMAP-L13x SoCs has various internal RAM memories that can accessed from the ARM side. These memories can be configured to be used as either RAM or Cache. The Davinci remoteproc driver has been enhanced to parse and store the kernel mappings for these internal RAM memories. These mappings can then be used to support direct loading of text/data into these memories from the remoteproc driver. Signed-off-by: Suman Anna --- v2: No code changes drivers/remoteproc/da8xx_remoteproc.c | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) -- 2.13.1 diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 280b66d4f622..c1cff78de67b 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -38,9 +38,27 @@ MODULE_PARM_DESC(da8xx_fw_name, #define SYSCFG_CHIPSIG3 BIT(3) #define SYSCFG_CHIPSIG4 BIT(4) +#define DA8XX_RPROC_LOCAL_ADDRESS_MASK (SZ_16M - 1) + +/** + * struct da8xx_rproc_mem - internal memory structure + * @cpu_addr: MPU virtual address of the memory region + * @bus_addr: Bus address used to access the memory region + * @dev_addr: Device address of the memory region from DSP view + * @size: Size of the memory region + */ +struct da8xx_rproc_mem { + void __iomem *cpu_addr; + phys_addr_t bus_addr; + u32 dev_addr; + size_t size; +}; + /** * struct da8xx_rproc - da8xx remote processor instance state * @rproc: rproc handle + * @mem: internal memory regions data + * @num_mems: number of internal memory regions * @dsp_clk: placeholder for platform's DSP clk * @ack_fxn: chip-specific ack function for ack'ing irq * @irq_data: ack_fxn function parameter @@ -50,6 +68,8 @@ MODULE_PARM_DESC(da8xx_fw_name, */ struct da8xx_rproc { struct rproc *rproc; + struct da8xx_rproc_mem *mem; + int num_mems; struct clk *dsp_clk; void (*ack_fxn)(struct irq_data *data); struct irq_data *irq_data; @@ -158,6 +178,44 @@ static const struct rproc_ops da8xx_rproc_ops = { .kick = da8xx_rproc_kick, }; +static int da8xx_rproc_get_internal_memories(struct platform_device *pdev, + struct da8xx_rproc *drproc) +{ + static const char * const mem_names[] = {"l2sram", "l1pram", "l1dram"}; + int num_mems = ARRAY_SIZE(mem_names); + struct device *dev = &pdev->dev; + struct resource *res; + int i; + + drproc->mem = devm_kcalloc(dev, num_mems, sizeof(*drproc->mem), + GFP_KERNEL); + if (!drproc->mem) + return -ENOMEM; + + for (i = 0; i < num_mems; i++) { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + mem_names[i]); + drproc->mem[i].cpu_addr = devm_ioremap_resource(dev, res); + if (IS_ERR(drproc->mem[i].cpu_addr)) { + dev_err(dev, "failed to parse and map %s memory\n", + mem_names[i]); + return PTR_ERR(drproc->mem[i].cpu_addr); + } + drproc->mem[i].bus_addr = res->start; + drproc->mem[i].dev_addr = + res->start & DA8XX_RPROC_LOCAL_ADDRESS_MASK; + drproc->mem[i].size = resource_size(res); + + dev_dbg(dev, "memory %8s: bus addr %pa size 0x%x va %p da 0x%x\n", + mem_names[i], &drproc->mem[i].bus_addr, + drproc->mem[i].size, drproc->mem[i].cpu_addr, + drproc->mem[i].dev_addr); + } + drproc->num_mems = num_mems; + + return 0; +} + static int da8xx_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -213,6 +271,10 @@ static int da8xx_rproc_probe(struct platform_device *pdev) drproc->dsp_clk = dsp_clk; rproc->has_iommu = false; + ret = da8xx_rproc_get_internal_memories(pdev, drproc); + if (ret) + goto free_rproc; + platform_set_drvdata(pdev, rproc); /* everything the ISR needs is now setup, so hook it up */ From patchwork Tue Aug 1 15:48:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 109184 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1659141qge; Tue, 1 Aug 2017 08:49:25 -0700 (PDT) X-Received: by 10.99.155.10 with SMTP id r10mr19973906pgd.123.1501602565168; Tue, 01 Aug 2017 08:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501602565; cv=none; d=google.com; s=arc-20160816; b=ndYf29kA1I1KbRmudBXNGjBMyjGpXhzLUGnA4bOrlURc0lQN4KlV4jH5KUbl5Gw7Jp SYFVm88xhBoBHmm6R63AWya6W+Qs0ZOsNs3akQD0SAITCveEiuPwWPNCSN/OCheNEzGG +EtLbLD7VnHN7dFKN2evSWtKryjgvh0k+v/Dz3bLJFSKKpgUASMhLlYA9D1olKASMByr aUNwTRpgL/v8xazl9CzoT9/2XbimkdnCvbC6dHtTPRAcUgPLfeVgVEleL6z4gAH0xrT5 cYxRPFrbpf9Jk5GvxDmJj3CyqAsVyrPem1cx21gq8BBAaxRiFfIFj9GI1CRawP/30u/1 1jsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CSL0vjS8oasQcW77Qd1le+2uD9kdN+nP6MYWleYulKg=; b=IvJJu52/zG09vU7YePZW+S6vMKpjUcaA4L1rF5HuO+fBKdlYQhqWnnqvQRTASkvvbN TllRfxAueDlrTG5pldh7O5eCCG6xL8prwThDsG0Mt7+huJVj0D5ZcgHZEqyz0BkpdrZG Sx0nhz0mOYywL4VbenBqsD6/vTpKrbYywUtJj04klQh2PzopwxmlowJ3wxtVuQGs2KzR 61cEMVoUl9K/RsbB5V4o9rbnZiNASUDBNT5sAnug36v3tsVlk0SRor/lupC0nmEbTZCW 1So7JXVsTv6lDWK7lWM6KtwZiuDMBb7EIPtxXW+L6k8ItVLss81T4Y/Z0mfF8QKhz7CC ve/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.b=IiZXzWs9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p27si2498757pli.332.2017.08.01.08.49.24; Tue, 01 Aug 2017 08:49:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.b=IiZXzWs9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751833AbdHAPtV (ORCPT + 26 others); Tue, 1 Aug 2017 11:49:21 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:32033 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbdHAPtR (ORCPT ); Tue, 1 Aug 2017 11:49:17 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v71FmnWV019439; Tue, 1 Aug 2017 10:48:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1501602529; bh=r5Vgg94VX/fElj/eouRZ5FEaVB2nwsGRm56kbSEiRiE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IiZXzWs9MtgIoaZ0o1wO4gww58TCiyzZseGp8UXnjmHypmq0LhgGcheWxxabedrqS qojkku11VVF6577qaNJfEORKy78a3N4SraAkDkON6qqa1Vj4VG/kunlTUhrk7fhOJA +/jgzqWpsbZkLy2jEqn5yS+4ZjbjzQI3arknlsAM= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v71FmneW001104; Tue, 1 Aug 2017 10:48:49 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) 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 dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v71FmmjZ020938; 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 v71Fmm323826; 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 3/4] dt-bindings: remoteproc: Add bindings for Davinci DSP processors Date: Tue, 1 Aug 2017 10:48:43 -0500 Message-ID: <20170801154844.24662-4-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the device tree bindings document for the DSP processor subsystem devices on TI Davinci DA8xx/OMAP-L13x SoCs. Signed-off-by: Suman Anna --- v2: - Updated the patch header - Revised the binding status statement slightly - Updated the example to address Rob's comments - No changes in properties description themselves v1: https://patchwork.kernel.org/patch/9751269/ .../bindings/remoteproc/ti,davinci-rproc.txt | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,davinci-rproc.txt -- 2.13.1 diff --git a/Documentation/devicetree/bindings/remoteproc/ti,davinci-rproc.txt b/Documentation/devicetree/bindings/remoteproc/ti,davinci-rproc.txt new file mode 100644 index 000000000000..e44a97e21164 --- /dev/null +++ b/Documentation/devicetree/bindings/remoteproc/ti,davinci-rproc.txt @@ -0,0 +1,86 @@ +TI Davinci DSP devices +======================= + +Binding status: Unstable - Subject to changes for DT representation of clocks + and resets + +The TI Davinci family of SoCs usually contains a TI DSP Core sub-system that +is used to offload some of the processor-intensive tasks or algorithms, for +achieving various system level goals. + +The processor cores in the sub-system usually contain additional sub-modules +like L1 and/or L2 caches/SRAMs, an Interrupt Controller, an external memory +controller, a dedicated local power/sleep controller etc. The DSP processor +core used in Davinci SoCs is usually a C674x DSP CPU. + +DSP Device Node: +================ +Each DSP Core sub-system is represented as a single DT node. + +Required properties: +-------------------- +The following are the mandatory properties: + +- compatible: Should be one of the following, + "ti,da850-dsp" for DSPs on OMAP-L138 SoCs + +- reg: Should contain an entry for each value in 'reg-names'. + Each entry should have the memory region's start address + and the size of the region, the representation matching + the parent node's '#address-cells' and '#size-cells' values. + +- reg-names: Should contain strings with the following names, each + representing a specific internal memory region or a + specific register space, + "l2sram", "l1pram", "l1dram", "host1cfg", "chipsig_base" + +- interrupts: Should contain the interrupt number used to receive the + interrupts from the DSP. The value should follow the + interrupt-specifier format as dictated by the + 'interrupt-parent' node. + +- memory-region: phandle to the reserved memory node to be associated + with the remoteproc device. The reserved memory node + can be a CMA memory node, and should be defined as + per the bindings in + Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt + +Optional properties: +-------------------- +- interrupt-parent: phandle to the interrupt controller node. This property + is needed if the device node hierarchy doesn't have an + interrupt controller. + + +Example: +-------- + + /* DSP Reserved Memory node */ + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + dsp_memory_region: dsp-memory@c3000000 { + compatible = "shared-dma-pool"; + reg = <0xc3000000 0x1000000>; + reusable; + }; + }; + + /* DSP node */ + { + dsp: dsp@11800000 { + compatible = "ti,da850-dsp"; + reg = <0x11800000 0x40000>, + <0x11e00000 0x8000>, + <0x11f00000 0x8000>, + <0x01c14044 0x4>, + <0x01c14174 0x8>; + reg-names = "l2sram", "l1pram", "l1dram", "host1cfg", + "chipsig"; + interrupt-parent = <&intc>; + interrupts = <28>; + memory-region = <&dsp_memory_region>; + }; + }; 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: 109187 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1664819qge; Tue, 1 Aug 2017 08:55:01 -0700 (PDT) X-Received: by 10.98.48.69 with SMTP id w66mr19932655pfw.214.1501602901168; Tue, 01 Aug 2017 08:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501602901; cv=none; d=google.com; s=arc-20160816; b=blKSi6IdKbf/7dXvP26q4l/mWdMFwsCENYBhh39MdvwbSivFtG8Ue9dUIKMQjALWcG kCCMCzkBckhmlCv93oQS1KQy3Ke9n4Kedfs1QCgYJDIF5uoJSZQZMNRVKxvOCskpziP/ sirwaXtXaHN14QwPZZxM8BoS6LHMPBMAKc573E9/KTUnK6FR5clpSRUgsIrTCBIjAuTm bhvH9FKsAjTIEbnk7Wj3BS0Lmy3Nn5x3lNNjP3Jc5s/1+vIRGicA+wVfpPvrBtB7F5ac cwKdPb764Gb9yBBQo1vKQMyE9U4ipBnHFUAJg5aqqO89DSHdyu5EsC3gO2RqPIAHWq2W XDOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=FgBgvrqLtoxz0QxVmUQ67Plw7ct4vHYQB+imrZcWvqA=; b=clWvWzKNhD3xMhd6KD7NQ3k1iATkg1ul4fdwlU9NYIWl2iEtLC6Xj3c4Mt0jKGHAsF ZrH7UEMo/B5NAIfYl6753ugvnjy24LlLbpjPIPEfsslPm0sB3MXLBZROoSUINhYJNQuT RhTFdLLgZ8/4yTHTBUtYidGbOKrtbtPRobz13kt82DvJ0WYV2n3HfqqRPOoAPmYUS34I uX+c56G4kyjzbncAcESk9nHnIKnM9WzXmBA9ZgayJb1Wm38V7kAqqPu2vok9tAmFYB5x jOGJBQwu728b2gPVUZmgmsqDHJjyWpL3hUi9SwFdymzNAdIoys/Dg9YuaNe83kmp+Bsu gQVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.b=w4XnQOeB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g28si18087042pfe.534.2017.08.01.08.55.00; Tue, 01 Aug 2017 08:55:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.b=w4XnQOeB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbdHAPv7 (ORCPT + 26 others); Tue, 1 Aug 2017 11:51:59 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.13.1 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), }, };