Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp794017imm; Fri, 27 Jul 2018 06:17:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdNpSkvATP54YWdAZdd5ckgrvAdMJIYJvV4TYAdT8Lo5y3lp4l1rosSqDMH/PiBY11XntV/ X-Received: by 2002:a17:902:7894:: with SMTP id q20-v6mr6156147pll.3.1532697448056; Fri, 27 Jul 2018 06:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532697448; cv=none; d=google.com; s=arc-20160816; b=zNt4qUaWV1tnUeOEPfFFNvjX8YNh6h8LY5kmLHAeWCVq5CI84ILFh6n+a4GqXSxRJ+ eeolC0V1j+28NDs9/Q8QTpq6qG1fjN3zldiAIM69S2eU9iLsGRAonS1M9zbyQ5HhtyqC j+p/W/fuuCPTF1DS8LvgxkHBY5fhUTTVU0ITfroYs9TFXqycbXCU8qFamXQd/D0isikI nor+qgirAQfTGuYlHPwXiheW2XR4O1g/ko05GRTdLKm3FKhPgQZPLKOHGhm6fRrV04p3 3gQhAdC+Et+mlJHWe8C+SPV1DF+hJOD7NvYxGxLFk/SbF5MniMYfgG3BLDO467QYbo9x qbNA== 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:arc-authentication-results; bh=MvQQcWrSeKYRyeq5FM06IIGX6N1pZtDnLL+eDwWkSII=; b=Gxi6vNxisJ2Y+fMd6nlgrmWTu48fyyAc6yNP3kgI+KkMgPQTLnZG2YAqq1Hrs+CFd5 IDaGiDG03HL5Iu2UncfsntjtgOu65PfC18QNhvpzAwX1enC/Z8wn83PeapwmV8IjMx1C vB30OtMQ1wUNuiYDWmPGaowG8unlO8MUIYrROq66DOyjhS5KbcUKHt6OwZtAxwBgnEq3 zaQyS2LyXJG4Byy38MlNm0tGb12x/dbWhUB/oosWwD4Yl4yoG1MEj0wUw0W4swJrx+Y+ 2JOYWaYuLDTw84aTlnzJjJLGTts2p/hAU98Y2dByaVfPHOpKGrH12yBkA03tILrqLrFH E6bQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62-v6si4197411pfg.165.2018.07.27.06.17.13; Fri, 27 Jul 2018 06:17:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388799AbeG0Ohc (ORCPT + 99 others); Fri, 27 Jul 2018 10:37:32 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:39878 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388746AbeG0Ohb (ORCPT ); Fri, 27 Jul 2018 10:37:31 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w6RDE18u014480; Fri, 27 Jul 2018 15:15:33 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2kg1tj8puj-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 27 Jul 2018 15:15:33 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E53533A; Fri, 27 Jul 2018 13:15:32 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag7node2.st.com [10.75.127.20]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C2B58577E; Fri, 27 Jul 2018 13:15:32 +0000 (GMT) Received: from localhost (10.75.127.50) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 27 Jul 2018 15:15:32 +0200 From: Loic Pallardy To: , CC: , , , , , Loic Pallardy Subject: [PATCH v4 15/17] remoteproc: da8xx: declare reserved memory region for vdev device Date: Fri, 27 Jul 2018 15:14:50 +0200 Message-ID: <1532697292-14272-16-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532697292-14272-1-git-send-email-loic.pallardy@st.com> References: <1532697292-14272-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG2NODE1.st.com (10.75.127.4) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-27_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces da8xx_rproc_parse_fw() to declare a carveout region based on reserved memory for vdev buffer allocation. Signed-off-by: Loic Pallardy --- drivers/remoteproc/da8xx_remoteproc.c | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index b668e32..679a076 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -179,10 +180,47 @@ static void da8xx_rproc_kick(struct rproc *rproc, int vqid) writel(SYSCFG_CHIPSIG2, drproc->chipsig); } +static int da8xx_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) +{ + struct device *dev = rproc->dev.parent; + struct rproc_mem_entry *mem; + struct device_node *node; + struct resource res; + int err; + + node = of_parse_phandle(dev->of_node, "memory-region", 0); + if (!node) { + dev_err(dev, "No memory-region specified\n"); + return -EINVAL; + } + + err = of_address_to_resource(node, 0, &res); + if (err) { + dev_err(dev, "Bad memory-region definition\n"); + return err; + } + + /* Register memory region for vdev buffer allocation */ + mem = rproc_of_resm_mem_entry_init(dev, 0, resource_size(&res), + res.start, "vdev0buffer"); + + if (!mem) + return -ENOMEM; + + rproc_add_carveout(rproc, mem); + + return rproc_elf_load_rsc_table(rproc, fw); +} + static const struct rproc_ops da8xx_rproc_ops = { .start = da8xx_rproc_start, .stop = da8xx_rproc_stop, .kick = da8xx_rproc_kick, + .parse_fw = da8xx_rproc_parse_fw, + .load = rproc_elf_load_segments, + .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, + .sanity_check = rproc_elf_sanity_check, + .get_boot_addr = rproc_elf_get_boot_addr, }; static int da8xx_rproc_get_internal_memories(struct platform_device *pdev, -- 1.9.1