Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1978139rwl; Thu, 6 Apr 2023 04:16:37 -0700 (PDT) X-Google-Smtp-Source: AKy350aES8OgePw4f/0RIXzLdtSvHm48ZfPXT7uMsf3eUCCMczC14GikKzNc1woiU4YJFTok+H2y X-Received: by 2002:a17:902:fb0f:b0:1a1:85d4:a775 with SMTP id le15-20020a170902fb0f00b001a185d4a775mr9593684plb.29.1680779796909; Thu, 06 Apr 2023 04:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680779796; cv=none; d=google.com; s=arc-20160816; b=bopf0bGLXabcVuqecBEbTbYez3OqWy6lkVba73IreFevx7Nd4F4g0n3vkyjXnljbng NXIMaQ0BNhPk+wfWfOMuy+2c9EIBti/B2QGAfpRLYqs8YaT4R7TsmPGfLU8Et59fBS5C bcPr2boKSbW9hG2OteC9uNcGxlrS7wTEyB/xQPMO+bFgmcH/578hmYtoRMHjEn6NzMUx nvhyaFbjqVfRMwZm5PC8wrs+PXaH2pUmvPF5mSvYPU4pxv4lhX9qSB63VRYUEw8Jip2i z9SjfxYqUEmgp4NqrienYZxF4WnPl6chQqRAogKvJtlGofnSO2hTv858xtEamhemLQ3r vkUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=lNXQl4ZV/6vn7r3pBuZewXxh3tYHi2TdmaJoMqkDndc=; b=ELJh4EF4p71hGGCImCZgyA+i2B4xx5xamUx4XZtNHZyUtuS/D6244Jd+NDwUCy0nQt Pk8QzPUzqxk1/I/iVNNJILaBfvzvfQ69Xs/g+YI3UtmLzFZUMvN+VtdaAT8wrk4IJh7b /7/QaEd6eT12Lm/ipf+jj30bcJ5ims149na6Q8iTrosGywSMyHRfO0CRKwe084BLz9Po 5xthXCn+cpG0z1NQqPwSJu0gsn8ptl2vLGM2hUTJ5jrbOJ+KtQ6UO/e+LOltpK8NQnAH oMcncz9IWrDFhJZTDFrKpWW0BMaU9dCqdFml+dbVvWLrs0AJ7iudva1yMSbKcIht1V9S Jw0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=30CchlbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v187-20020a632fc4000000b004fae5f0895dsi1138061pgv.45.2023.04.06.04.16.24; Thu, 06 Apr 2023 04:16:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=30CchlbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237523AbjDFLMG (ORCPT + 99 others); Thu, 6 Apr 2023 07:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236782AbjDFLL7 (ORCPT ); Thu, 6 Apr 2023 07:11:59 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC347EE7; Thu, 6 Apr 2023 04:11:55 -0700 (PDT) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 336ATra9030223; Thu, 6 Apr 2023 13:11:42 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=lNXQl4ZV/6vn7r3pBuZewXxh3tYHi2TdmaJoMqkDndc=; b=30CchlbXohzL5uB7KQeLzo1CHO5Bh8K6Dl4BegGtjo6JcZ1qBrDYI2SVFeGEHThbKXK3 oOgleTH1Y8ffgFwDZuhkXyAc/ARlhtZuWEYpFXJJBRQwcDgTYCiIXd4z626ZM7lko5TJ TH+dfe4GYpVHGiXXP8Zf48ogxNfMYQsw5o+zUAfGOAhT4omYDZJZOxz0BoOq2n9fIJr3 yn+akJ9Mzg1ytnmIk+bdgfFyB9qLiunWZ4i6x0r+5XJLqQDztkNF0D416MnI1Z78BfGB 9lfETUEMAn5IzK0DhCy9TzWLPROoLo+zYQQ7Dx9fvJVqR2LWypDZj4+ZiBnlUmIIZPo+ 4Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3psv5xrb6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 13:11:42 +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 1A61010002A; Thu, 6 Apr 2023 13:11:40 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3596121BF53; Thu, 6 Apr 2023 13:11:40 +0200 (CEST) Received: from [10.201.21.178] (10.201.21.178) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Thu, 6 Apr 2023 13:11:37 +0200 Message-ID: <9c87443a-90e6-52d3-859f-2b2eb057049b@foss.st.com> Date: Thu, 6 Apr 2023 13:11:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 4/5] remoteproc: stm32: Allow hold boot management by the SCMI reset controller Content-Language: en-US To: Mathieu Poirier CC: Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Alexandre Torgue , , , , References: <20230331154651.3107173-1-arnaud.pouliquen@foss.st.com> <20230331154651.3107173-5-arnaud.pouliquen@foss.st.com> <20230405180143.GD3812912@p14s> From: Arnaud POULIQUEN Organization: STMicroelectronics In-Reply-To: <20230405180143.GD3812912@p14s> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.201.21.178] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-06_05,2023-04-06_01,2023-02-09_01 X-Spam-Status: No, score=-3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/5/23 20:01, Mathieu Poirier wrote: > On Fri, Mar 31, 2023 at 05:46:50PM +0200, Arnaud Pouliquen wrote: >> The hold boot can be managed by the SCMI controller as a reset. >> If the "hold_boot" reset is defined in the device tree, use it. >> Else use the syscon controller directly to access to the register. >> >> Signed-off-by: Arnaud Pouliquen >> --- >> drivers/remoteproc/stm32_rproc.c | 34 ++++++++++++++++++++++++++------ >> 1 file changed, 28 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c >> index 4be651e734ee..6b0d8f30a5c7 100644 >> --- a/drivers/remoteproc/stm32_rproc.c >> +++ b/drivers/remoteproc/stm32_rproc.c >> @@ -78,6 +78,7 @@ struct stm32_mbox { >> >> struct stm32_rproc { >> struct reset_control *rst; >> + struct reset_control *hold_boot_rst; >> struct stm32_syscon hold_boot; >> struct stm32_syscon pdds; >> struct stm32_syscon m4_state; >> @@ -398,6 +399,14 @@ static int stm32_rproc_set_hold_boot(struct rproc *rproc, bool hold) >> struct stm32_syscon hold_boot = ddata->hold_boot; >> int val, err; >> >> + if (ddata->hold_boot_rst) { >> + /* Use the SCMI reset controller */ >> + if (!hold) >> + return reset_control_deassert(ddata->hold_boot_rst); >> + else >> + return reset_control_assert(ddata->hold_boot_rst); >> + } >> + >> val = hold ? HOLD_BOOT : RELEASE_BOOT; >> >> err = regmap_update_bits(hold_boot.map, hold_boot.reg, >> @@ -693,16 +702,29 @@ static int stm32_rproc_parse_dt(struct platform_device *pdev, >> dev_info(dev, "wdg irq registered\n"); >> } >> >> - ddata->rst = devm_reset_control_get_by_index(dev, 0); >> + ddata->rst = devm_reset_control_get(dev, "mcu_rst"); > > Peng is correct - newer kernels won't be able to boot with older DT. > >> if (IS_ERR(ddata->rst)) >> return dev_err_probe(dev, PTR_ERR(ddata->rst), >> "failed to get mcu_reset\n"); >> >> - err = stm32_rproc_get_syscon(np, "st,syscfg-holdboot", >> - &ddata->hold_boot); >> - if (err) { >> - dev_err(dev, "failed to get hold boot\n"); >> - return err; >> + ddata->hold_boot_rst = devm_reset_control_get(dev, "hold_boot"); >> + if (IS_ERR(ddata->hold_boot_rst)) { >> + if (PTR_ERR(ddata->hold_boot_rst) == -EPROBE_DEFER) >> + return PTR_ERR(ddata->hold_boot_rst); >> + ddata->hold_boot_rst = NULL; >> + } >> + >> + if (!ddata->hold_boot_rst) {Okay, I definitely need to rewrite the patchset. > > Why another if() statement? The code below should be in the above if()... > > This patchset is surprizingly confusing for its size. I suggest paying > attention to the changelogs and adding comments in the code. I definitely need to rewrite this patchset. Thanks for all reviewers Regards Arnaud > > Thanks, > Mathieu > >> + /* >> + * If the hold boot is not managed by the SCMI reset controller, >> + * manage it through the syscon controller >> + */ >> + err = stm32_rproc_get_syscon(np, "st,syscfg-holdboot", >> + &ddata->hold_boot); >> + if (err) { >> + dev_err(dev, "failed to get hold boot\n"); >> + return err; >> + } >> } >> >> err = stm32_rproc_get_syscon(np, "st,syscfg-pdds", &ddata->pdds); >> -- >> 2.25.1 >>