From patchwork Fri Jul 27 13:14:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 143056 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp806947ljj; Fri, 27 Jul 2018 06:15:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfXJjFLYmi4C9fewnxMlTjxr50xZsI3XSxQ97S8apif7iG+GgDqYhBzLkXhGbIdEKjsVnNx X-Received: by 2002:a63:710d:: with SMTP id m13-v6mr6145093pgc.66.1532697341919; Fri, 27 Jul 2018 06:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532697341; cv=none; d=google.com; s=arc-20160816; b=FGiT7GCKcuJhyxml0Jj2e7Pq4Eci2MzhOZWQMgNqKg+VNayhtdluQxkBlM6c/tJqGv Q5615dA5Qhg2VORHkw78HTHsJ+DIAhalh70cJMW2GeAHs2G2LA+gI7ZMuWEIoMDewaR8 Su5YeZPWG4ycO3EifqfztirXibB+sfwHm1BLC4S8SW7iCc5lwZwZrRJTaemZGN4ptpS4 U5UF9vqmfX6b8N66asAdAWSGlf++MoPvFZmUX4xxrZIsfZiZ/HGrZE0SOurU6oegI0wV 74pAxSdoMd3o8WWvRuFl0wjZhHtjDtmWUjHF6bQMBaZJvAfaVeYMI1Mmcs9mcPzonyZi toAA== 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 z4-v6si3391930pgp.580.2018.07.27.06.15.41; Fri, 27 Jul 2018 06:15:41 -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 S2388806AbeG0Ohc (ORCPT + 31 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 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(+) -- 1.9.1 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,