From patchwork Tue Nov 19 14:16:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 179757 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp698160ilf; Tue, 19 Nov 2019 06:18:01 -0800 (PST) X-Google-Smtp-Source: APXvYqx5uiCMhK8mhtFSTC1tj1wNlHngXMM6ZTTxNhOIn+2eNNnWIf2nJeYDd85GMZ1KZ0YwTgGC X-Received: by 2002:a5d:522e:: with SMTP id i14mr22641578wra.27.1574173081366; Tue, 19 Nov 2019 06:18:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574173081; cv=none; d=google.com; s=arc-20160816; b=oSsjI3h3NXKVW0EE5R27ki5rbf0zeZlKirALEeZuuUo4X08lNQ4oyaJKEslKR+ecgq jQR1Fojz+gU9DqDT0OKATVnOcGnWwBWQkQ5yYAQgkqseblaW1ZKgiYxRqlOvXHP6lcef ci7DlHHaPr71Cgj0nykdBl670Ln1HLjjIfa/2aydPorPGp8QkRNkKrdr70mXls9aHsIm elMBhF/10hP4M/2Hwj1YKybWGtlseHp66NN6uzAm0Hl+SDghdbKtL7vZE7Gnn0prLf+B dvH08Mkz3gyRK23qc0Hg3AqfEXC3jyj2KwlBZtTV1Qg9t4KR1IX4RVxaK6KXLzMKDrYf VItw== 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; bh=AQ0B5jw9HQqxEfttQOLTZY4PnRmM6mThulC0kGIUZ/o=; b=NHU91yZp3IXMInEfo6X7uwb1GE+w19Eb0zcE80pzrKWgUE7d32rmsLK2D8BjhOGMrf Kj9Nz8aL3LjR4aEWgFhj5mmefiCJvYuPVRvMAT05DnmBCSnArwgerNgjtXMVqNVcogQ5 QUhB14+9NUougDVHrlTdBSf8pgsZdjP0PMdABtBm0QgpNGABgTwQ2qc5i3f5stFHyeDh c1zF4xP9EhTgWVMJbMfLqB9M16RWxPMOShpoAUnK8lTINgj6bZclrWA3QgzpXqvkmg95 gmGS8LOVTq/jCMjuKrWI0L9nsTVw3/93oYd3TpZFEu/QvUk4fumKRsyP/ibSFUtXd3wr YAaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=L8sUCCjp; 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 s38si14876719edd.351.2019.11.19.06.18.01; Tue, 19 Nov 2019 06:18:01 -0800 (PST) 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.s=ti-com-17Q1 header.b=L8sUCCjp; 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 S1725904AbfKSORV (ORCPT + 26 others); Tue, 19 Nov 2019 09:17:21 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50538 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728104AbfKSORR (ORCPT ); Tue, 19 Nov 2019 09:17:17 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id xAJEHFYj017634; Tue, 19 Nov 2019 08:17:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574173035; bh=AQ0B5jw9HQqxEfttQOLTZY4PnRmM6mThulC0kGIUZ/o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=L8sUCCjpHI2zs3QNnypYLVzmskKaWo9zFsm4X7jJP/y1eklvM7p5mRstl7rY57/TU +n0vsqJohy/RsU4zS2au5UxzjmlRjyAAlC7Fc7pOFxKYiiF1LHb3/hI/S1QGpF0gVC UFPbrSWpIw9038mz+KX9SYhmOMrzHNx4sgGFee8A= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xAJEHF2e100514 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 Nov 2019 08:17:15 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 19 Nov 2019 08:17:12 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 19 Nov 2019 08:17:11 -0600 Received: from sokoban.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xAJEGvYx027070; Tue, 19 Nov 2019 08:17:10 -0600 From: Tero Kristo To: , , CC: , , , Tero Kristo Subject: [PATCHv2 06/15] remoteproc/omap: Initialize and assign reserved memory node Date: Tue, 19 Nov 2019 16:16:36 +0200 Message-ID: <20191119141645.19777-7-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191119141645.19777-1-t-kristo@ti.com> References: <20191119141645.19777-1-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna The reserved memory nodes are not assigned to platform devices by default in the driver core to avoid the lookup for every platform device and incur a penalty as the real users are expected to be only a few devices. OMAP remoteproc devices fall into the above category and the OMAP remoteproc driver _requires_ specific CMA pools to be assigned for each device at the moment to align on the location of the vrings and vring buffers in the RTOS-side firmware images. So, use the of_reserved_mem_device_init/release() API appropriately to assign the corresponding reserved memory region to the OMAP remoteproc device. Note that only one region per device is allowed by the framework. Signed-off-by: Suman Anna Signed-off-by: Tero Kristo Reviewed-by: Bjorn Andersson --- drivers/remoteproc/omap_remoteproc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index 28f14e24b389..3ad74c4b4071 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -479,14 +480,22 @@ static int omap_rproc_probe(struct platform_device *pdev) if (ret) goto free_rproc; + ret = of_reserved_mem_device_init(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, "device does not have specific CMA pool\n"); + goto free_rproc; + } + platform_set_drvdata(pdev, rproc); ret = rproc_add(rproc); if (ret) - goto free_rproc; + goto release_mem; return 0; +release_mem: + of_reserved_mem_device_release(&pdev->dev); free_rproc: rproc_free(rproc); return ret; @@ -498,6 +507,7 @@ static int omap_rproc_remove(struct platform_device *pdev) rproc_del(rproc); rproc_free(rproc); + of_reserved_mem_device_release(&pdev->dev); return 0; }