Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1446927ybz; Thu, 16 Apr 2020 09:18:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLFfOgay4Q3z727UHy5Y4CqdGjNgfyXel5V29ftIGlbIqb6S97tdUZRjw+gXfBIc+YYUadw X-Received: by 2002:a17:906:4003:: with SMTP id v3mr10379316ejj.144.1587053894413; Thu, 16 Apr 2020 09:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587053894; cv=none; d=google.com; s=arc-20160816; b=eAz34A6GibcDQcfvSE03tosCDyjE0kqre9+qmdzZp8i041UciWfIkWv1sQOXgNITvw MaCNTU7FVtsk3Doe2t41PBA2SiuijPUl+51zX6C+dbshIe4bDWN9QbNRpUTdnyOsGegK a0RowftbB3L+n7wtvjOiAnf4xOeNbuKJiawhRaF1Bmhmjt7PuRsqka2dWqpq/aG0AEfA XrQgU4VcPHkXcTsNj3IEBhi/mavMqjO+HRk/23Z5TrEzjyBeie2uTS+s0SKONDdy8VXS BmvxmIhDxK9T7lBJJHUcfvv6FOhMKWbVmHzKimKSUN/pO1HenCXDp1+Qjhzfjcl2mYoZ my2w== 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=agyR1ppdr+Eyr30Bf9LkTx+EimYHLQAtT1Py/m/yieE=; b=vxYmw+6A+mmtbxkxqhESP1qyo4VdlLDM2jkgqbNQGr6i7RUqGaqJDdh/RnZrtPHu09 KISpqTyzt6XwcKa/sW4LJTpb84Vdspsb5w/MJyzNKm7prYABelDC0+coR7OY3HPk85rk Yqka9hctj9d8EYNqBV0MgF+tN4IahQ68RGuxyaCGRrf3E8zOyLme84ENDLQBayoJCfnT DZ9qQL6UKCGFkxChYaEmujkf8tyxq/ADzmPzFaFkic95Ar4/vnnckDyzBoVidEuL4HIm MZpFWbEF2WGkYlgXWGW3dT2rjnfLPqdoSFpVpXdLEVdWSlSq2CplT/P1zDW79XkmgT7Z FKXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=kNxtSLkd; 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=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si10948549eja.102.2020.04.16.09.17.50; Thu, 16 Apr 2020 09:18:14 -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=@st.com header.s=STMicroelectronics header.b=kNxtSLkd; 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=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2896387AbgDPQPc (ORCPT + 99 others); Thu, 16 Apr 2020 12:15:32 -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 Content-Type: text/plain 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.17.1