Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp158645ybz; Fri, 24 Apr 2020 13:36:16 -0700 (PDT) X-Google-Smtp-Source: APiQypLfSIQ+UGd27yhiK6NI8CtPq1/ZuomPfJ3c4DkdVHRuY8hU0gyc8WmNjQ1TeGGOx2DUOMP9 X-Received: by 2002:a50:c042:: with SMTP id u2mr8999176edd.250.1587760576323; Fri, 24 Apr 2020 13:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587760576; cv=none; d=google.com; s=arc-20160816; b=espidz6YDB+UVoIlFW18wZOTDLhdtQNxRJElOOHNCNsZokOsFkGLc1aiB/ksyx507w O4ci0SUrj1j581rOxqKYVJNevXdAB5wsSKrFT3Y/DW2T0sGUs7g/XhXN0fsqc26sn61f yaYeEwg7YLTi9NZ1uZLYVpQZ+Ijjw5UW2cakcR4QZvBVHmLZuYCWiTKCbTqK/9nM8XaK rVuDfMWim4ePh93QMd1ujzi7hpfr2hZm3SU5Ylo3otHGOX5aTvWxthhM/TE2r/+8bFt3 tapdMVIprTPaO4tiGtlL+xN35jM2dBKU74y4jkhCL+QsaqMrPatTFSGAu+23K0LUnhux bg+g== 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=exYZpvChsSlo7lAJbJWuh/pu5cSD6aiCv7Lp3iIYni8=; b=Oy8appjBqMT85hUgvMmYn5Zc3gA2kVih/yDqa3bpJ2/OzErJt3tceu1TUqVyybJv8v NpHTxTnz4A0qCFNnlrQ2Q8+Wl9fKtDr1Zg6LxptaepL4wbvO/bSwMubobJ2Yyf0aG9Dm XNw+G9N4uOPcqLR4PeHYJzHorc24l3w0oqx93hYNL6pT5rBJ/jEm6SWoSG0BM6/DeUCT wGQo2auG7xtWU5RY878xa+Y3WXGWUPylZvJp5C+Ckzk8E+UtKZxFXLHAH3ZsSNGiUAog Ya1d8UZhEKP0hf2CPyQHINQaAcraPnbiSwr/3RkZrIy8MBy+E4Zr7oMu5H8qZpboaTy+ UWpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iN9Rmvvn; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si3454342edq.119.2020.04.24.13.35.52; Fri, 24 Apr 2020 13:36:16 -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=@linaro.org header.s=google header.b=iN9Rmvvn; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729598AbgDXUZc (ORCPT + 99 others); Fri, 24 Apr 2020 16:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729528AbgDXUZT (ORCPT ); Fri, 24 Apr 2020 16:25:19 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7880CC09B048 for ; Fri, 24 Apr 2020 13:25:18 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id h12so2949323pjz.1 for ; Fri, 24 Apr 2020 13:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=exYZpvChsSlo7lAJbJWuh/pu5cSD6aiCv7Lp3iIYni8=; b=iN9Rmvvnqh92eC4TVhJvXp9LrfV9PydbkGYoRVJklbytnIqLGmkGSkG1lI2zxCRgRF 5M53EDEEzllMIdgoLfs1/dVl8b3pTJfORPir4EQsdGV5FGTSVHYNP6wQ3KcdmPUgPpDH YJvNHFBk/YBKfcyFuLNIun9KsZvifIbnoX14xisIiPXfuVfLDlPu6+PjVy9eWJ0Pun4A 1SmSDGzlNT2UlssN6jOGylFsnYwa8kVifpktDTIW+H/dVnq36Vp+0AuTokOk9ojoWvGi cLVSm+hhmnpYe3VgiFbrN7OgP+GhT8Vp3GSAE0Q0lX+SM/8VROPHvcG/UzE1Le1Sr0m6 TPjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=exYZpvChsSlo7lAJbJWuh/pu5cSD6aiCv7Lp3iIYni8=; b=DwbYdacXn3ADKMWMaz76V4Qc6U3NjwbrkQKY2szGqeYYDFXYzdFLoFFo3Q7U7oIXve fBURAAgZJvkH7DoUEC+P1Sl3wo7pwbj8nBRtWKkercAWQ4IJKbnURqhizdNGqIGdZ6yG WDF9Jv7iLYwLANdfjME1CHH2t3JX4LRMN4yqS37bzLFjixNtn28o95vK+poiLPJjbfvn lgotgtnfoTtHFmVv/4w/OOT4qEM5vMlh6cSHRQ9pZBqSLCwrIlnyxDnKdm5xki39k477 Fz2lhSCDrYrw0m2uhRYpUMi4kbCM/Za6pL8s5iq3yhQRgRqEnA3+a8rSBY0Au2+dMy/u 7SaQ== X-Gm-Message-State: AGi0PuZPkkbbQSOXDeJrNG+NxUhDvadB6SBAlssKGlfJ4Po8w+HOuoAO JOl3/WfOXFX1HTDrAhi8CrYbvg== X-Received: by 2002:a17:90a:1743:: with SMTP id 3mr8488308pjm.106.1587759918032; Fri, 24 Apr 2020 13:25:18 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id c1sm6553245pfc.94.2020.04.24.13.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 13:25:17 -0700 (PDT) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Cc: loic.pallardy@st.com, arnaud.pouliquen@st.com, linux-remoteproc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/12] remoteproc: stm32: Update M4 state in stm32_rproc_stop() Date: Fri, 24 Apr 2020 14:25:02 -0600 Message-Id: <20200424202505.29562-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424202505.29562-1-mathieu.poirier@linaro.org> References: <20200424202505.29562-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update the M4 co-processor state in function stm32_rproc_stop() so that it can be used in synchronisation scenarios. Mainly based on the work published by Arnaud Pouliquen [1]. [1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=239877 Signed-off-by: Mathieu Poirier --- drivers/remoteproc/stm32_rproc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 404f17a97095..86d23c35d805 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -493,6 +493,18 @@ static int stm32_rproc_stop(struct rproc *rproc) } } + /* update coprocessor state to OFF if available */ + if (ddata->m4_state.map) { + err = regmap_update_bits(ddata->m4_state.map, + ddata->m4_state.reg, + ddata->m4_state.mask, + M4_STATE_OFF); + if (err) { + dev_err(&rproc->dev, "failed to set copro state\n"); + return err; + } + } + return 0; } @@ -531,6 +543,7 @@ static struct rproc_ops st_rproc_ops = { static __maybe_unused struct rproc_ops st_rproc_sync_ops = { .start = stm32_rproc_sync_start, + .stop = stm32_rproc_stop, }; static const struct of_device_id stm32_rproc_match[] = { -- 2.20.1