From patchwork Thu Apr 16 16:13:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 11493431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACB141392 for ; Thu, 16 Apr 2020 16:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9484A20771 for ; Thu, 16 Apr 2020 16:15:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="kNxtSLkd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2442914AbgDPQP3 (ORCPT ); Thu, 16 Apr 2020 12:15:29 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:3988 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2636453AbgDPQOZ (ORCPT ); Thu, 16 Apr 2020 12:14:25 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03GGDTiP026461; Thu, 16 Apr 2020 18:14:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=agyR1ppdr+Eyr30Bf9LkTx+EimYHLQAtT1Py/m/yieE=; b=kNxtSLkdGTEkqabTVTr5xwwiOvFr+CK5GzI6NE+TzQjco7oxDNSYUm5VXulS8bF/LNYJ g71gQNxe998zXeac1aIvkW9oqiwoYMXVPtEmlIyCMMTBg73xSfQIXcCaD4esXa0ECkaV x3ejaRAQfE6LLlfl7kW6JNXUG5mVk53S1YLDG+/Io8hQqigBqIQcoTRqyaixOpY4IDta DoWumD8KCW82WtkgSBkF4fSrTdHEKT2XDRCXHB7mFHTiq9R9G0THZ5C7f5LZIxmhOEKc unIbGqS3cuPKhuZoJ4bHG+pxSexDEALtYE4EoEbchvoxZTi7/ZeufaSo1+RMr8gEC6M0 KA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30dn8s3kn4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Apr 2020 18:14:21 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3C2F410002A; Thu, 16 Apr 2020 18:14:21 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2C9A12B2D2A; Thu, 16 Apr 2020 18:14:21 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 16 Apr 2020 18:14:20 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [RFC 10/18] remoteproc: Add capability to populate rproc subnode devices Date: Thu, 16 Apr 2020 18:13:23 +0200 Message-ID: <20200416161331.7606-11-arnaud.pouliquen@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200416161331.7606-1-arnaud.pouliquen@st.com> References: <20200416161331.7606-1-arnaud.pouliquen@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG6NODE2.st.com (10.75.127.17) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-16_06:2020-04-14,2020-04-16 signatures=0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Add the capability to add rproc sub nodes in device tree. Devices declared as rproc sub node will be probed before the remote firmware boot sequence. Signed-off-by: Arnaud Pouliquen --- drivers/remoteproc/remoteproc_core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index c9e07c53ed0c..75f84fd3bd60 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1605,6 +1605,26 @@ static void rproc_crash_handler_work(struct work_struct *work) rproc_trigger_recovery(rproc); } +static int rproc_platform_populate(struct rproc *rproc) +{ + struct device *dev = rproc->dev.parent; + int ret; + + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); + if (ret < 0) { + dev_err(dev, "failed to populate child devices (%d)\n", ret); + + goto depopulate; + } + + return 0; + +depopulate: + of_platform_depopulate(dev); + + return ret; +} + /** * rproc_boot() - boot a remote processor * @rproc: handle of a remote processor @@ -1629,6 +1649,10 @@ int rproc_boot(struct rproc *rproc) dev = &rproc->dev; + ret = rproc_platform_populate(rproc); + if (ret) + return ret; + ret = mutex_lock_interruptible(&rproc->lock); if (ret) { dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret); @@ -1735,6 +1759,7 @@ void rproc_shutdown(struct rproc *rproc) rproc->table_ptr = NULL; out: mutex_unlock(&rproc->lock); + of_platform_depopulate(rproc->dev.parent); } EXPORT_SYMBOL(rproc_shutdown);