Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp32563ybh; Tue, 21 Jul 2020 15:37:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK2D9Cgww+zjXMH5lhQSZgxWEFijfVMTeAh4eLa0de4nJzxmepd5yXcHceYRDzyBoOHnax X-Received: by 2002:a17:906:46d1:: with SMTP id k17mr27270266ejs.446.1595371026148; Tue, 21 Jul 2020 15:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595371026; cv=none; d=google.com; s=arc-20160816; b=VWpjiFQje6Q12kXp0vKONfsj2b3HmOjKBRrNsZEg2W6+fQveF2ndtqde1Cvon1EkW+ sJ50EV0uf2mnfWrL2uwouNghKlOodqewOVMfmI0nwZx+9Swg28mJE35Q/QD7RtfXXNoi ZpWvKQHrgF5kdalh1//1SD0QOT3pCHABrWOFZkRO3oQ5UR3FK80n4Jk/nbgu+VMGzKDH SrsEvR3lnqpF4VFx54yw4pT2i7MwvDPuEKz5B2cpb4X74X5mrCrl9rFM8giQ0xWHVtnR TjZ8NADF23L36eokfKQbaK2q1XcsKRs/4VU0KV5hiBXV7CNFTVoDhY3A3HWkjNSq8HXO 5o2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E/a2DHAgAGqQNbUAF6yrH694iVBxAHRORpK7Cq1xHrc=; b=yjF875Ny9Sgj/fKgwoFgVkg1kHPslXjvaKP5USh5I3tkI8cVdAyOYBDdDuwNrO4O3h AcPhCbqDQbM3+ecPyWjGO7QcihLCdIBiD2p2LnsuPHpgbJw41XiIbmns3ybusXujGJMu w2iaW3coTP1oh+Pu2ob/6GaobYmUQvXRDt7JPPB/RDQUQL1aVINtZdCXxrt4VsZcs9k3 y75zZDksZZiYoZTUW1hPr0CNa9Ze+ZJfkn3N2a+eEpF9JqAvsabKjV47gcCa2MOWzbET PSqXn9lz39/bNg2TVZPuMcDSAU/pyoq8PltD7LrdQPPGXUKZu9e7ysd3MJxcBVwDiqdo U87g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=g5wsPeY5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ni2si13324025ejb.480.2020.07.21.15.36.43; Tue, 21 Jul 2020 15:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=g5wsPeY5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1731318AbgGUWga (ORCPT + 99 others); Tue, 21 Jul 2020 18:36:30 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:40902 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbgGUWg1 (ORCPT ); Tue, 21 Jul 2020 18:36:27 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06LMaNQp125601; Tue, 21 Jul 2020 17:36:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1595370983; bh=E/a2DHAgAGqQNbUAF6yrH694iVBxAHRORpK7Cq1xHrc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=g5wsPeY5MeN4Ikaotf2R16czCJGERdMo98PULVACjv1NaogYn369a59+xcxCiFNhX +QhDySGNRwLaU4QFWno0IISr3Q4UcxTUMOSEYRjUYDtP9MkM8kB+BZK21vU0/aIABs ljQn8LCCt3fRXKWbwK9/h6sIn2X+XRD+41yO+vM4= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06LMaNDR047712 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 21 Jul 2020 17:36:23 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 21 Jul 2020 17:36:22 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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.1979.3 via Frontend Transport; Tue, 21 Jul 2020 17:36:22 -0500 Received: from fllv0103.dal.design.ti.com (fllv0103.dal.design.ti.com [10.247.120.73]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06LMaMpT048621; Tue, 21 Jul 2020 17:36:22 -0500 Received: from localhost ([10.250.34.248]) by fllv0103.dal.design.ti.com (8.14.7/8.14.7) with ESMTP id 06LMaMMb080802; Tue, 21 Jul 2020 17:36:22 -0500 From: Suman Anna To: Bjorn Andersson , Rob Herring , Mathieu Poirier CC: Nishanth Menon , Lokesh Vutla , , , , , Suman Anna Subject: [PATCH v5 2/6] remoteproc: Introduce rproc_of_parse_firmware() helper Date: Tue, 21 Jul 2020 17:36:13 -0500 Message-ID: <20200721223617.20312-3-s-anna@ti.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200721223617.20312-1-s-anna@ti.com> References: <20200721223617.20312-1-s-anna@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 Add a new helper function rproc_of_parse_firmware() to the remoteproc core that can be used by various remoteproc drivers to look up the the "firmware-name" property from a rproc device node. This property is already being used by multiple drivers, so this helper can avoid repeating equivalent code in remoteproc drivers. Signed-off-by: Suman Anna Reviewed-by: Bjorn Andersson Reviewed-by: Mathieu Poirier --- v5: No changes, patch reordered v4: https://patchwork.kernel.org/patch/11671447/ - No changes v3: https://patchwork.kernel.org/patch/11602327/ drivers/remoteproc/remoteproc_core.c | 23 +++++++++++++++++++++++ drivers/remoteproc/remoteproc_internal.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 9f04c30c4aaf..c458b218d524 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1034,6 +1034,29 @@ rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len, } EXPORT_SYMBOL(rproc_of_resm_mem_entry_init); +/** + * rproc_of_parse_firmware() - parse and return the firmware-name + * @dev: pointer on device struct representing a rproc + * @index: index to use for the firmware-name retrieval + * @fw_name: pointer to a character string, in which the firmware + * name is returned on success and unmodified otherwise. + * + * This is an OF helper function that parses a device's DT node for + * the "firmware-name" property and returns the firmware name pointer + * in @fw_name on success. + * + * Return: 0 on success, or an appropriate failure. + */ +int rproc_of_parse_firmware(struct device *dev, int index, const char **fw_name) +{ + int ret; + + ret = of_property_read_string_index(dev->of_node, "firmware-name", + index, fw_name); + return ret ? ret : 0; +} +EXPORT_SYMBOL(rproc_of_parse_firmware); + /* * A lookup table for resource handlers. The indices are defined in * enum fw_resource_type. diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 4ba7cb59d3e8..e5341e91d2fc 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -28,6 +28,8 @@ struct rproc_debug_trace { void rproc_release(struct kref *kref); irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id); void rproc_vdev_release(struct kref *ref); +int rproc_of_parse_firmware(struct device *dev, int index, + const char **fw_name); /* from remoteproc_virtio.c */ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id); -- 2.26.0