Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2011539ybh; Tue, 14 Jul 2020 13:06:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUZdrfPsawly9u50SEhxg+kGLdKt7sD8F9kd+4ALRKncNU7uLxEJiIGROJaxFSm6K+IrQd X-Received: by 2002:a05:6402:8da:: with SMTP id d26mr6367522edz.109.1594757217627; Tue, 14 Jul 2020 13:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594757217; cv=none; d=google.com; s=arc-20160816; b=l5nwGA7iG1wmkbEabmybfh0Zdf8EhtcphuYwXUfx4QnpvwOnYn8qy7BYHVPwSkEJOr PMxjDvJ+d0+VpQ2uGHVPeaqinEWiGTv5UbrOS6AYXEa7MBnbhXXoqiSzyqHYVi4XbqFr EsEqK9obUcS47WOKk3t7uTaX+KVi//ZwQzalSfAM3RS1qWSdkZHlQ9IImqewUW+bvBEX RRdfMHoFDxCB+yx9DiahOqdczO9xfHoJyJxZ+Hdlkosc58AYL6nzFOMegAxgBYp3aXTW lGjAwumg06pTIEAWgqcfxUNVoFTTdSDah/lsnkZxeXg1ZrBZHRoGhZbSo4lOpkzhQpgw C9/w== 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=vHRO/0KjGNxIcLdu4Nprxq06C5XRM7DNFyiZUQDkaSQ=; b=SN7FCJP/KAuv2Zd15jWezewPMc+J5KksaoBQ4r2O81LHMy9Zc8DjkbQpa08t2aA9uT bhiTARAXUq7sDcJDE5En6Jo9omm7J3mEoqMa2lZUWf80GVvPzhlvENsUq4cg0hd2GSeY 7zjx8qU60c34WI1GK3O4MHRj7+Qq51j6ViCPK6jthcnfxCWCVhfSvtJ19StmNtYqq6ut O7k++MHoLykvsWs9V/KxSW0T9nSmcAcLl7wJ8bOWSFc7w+MS1tuZlxSk41sdO3oYBXxJ hfHvd2mNOfTa5V8vW8AU8raPj5sYmchGJ9eP/FphAlp8K9UX9UHcxSCSsorxmWPiNRJQ oE5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HpKSrt/s"; 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 da8si12121087edb.564.2020.07.14.13.06.33; Tue, 14 Jul 2020 13:06:57 -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="HpKSrt/s"; 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 S1730082AbgGNUFO (ORCPT + 99 others); Tue, 14 Jul 2020 16:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729782AbgGNUFC (ORCPT ); Tue, 14 Jul 2020 16:05:02 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E4FEC08C5DB for ; Tue, 14 Jul 2020 13:05:02 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id x9so7482062plr.2 for ; Tue, 14 Jul 2020 13:05:02 -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=vHRO/0KjGNxIcLdu4Nprxq06C5XRM7DNFyiZUQDkaSQ=; b=HpKSrt/sw9Twx4HYSQuRe7qY2HexRKWuCG6/YkmnOA1TfIJTbMVco+HycC/GnXMpqP TZjyyRVe2FYTRm6E0s1cgTTjq+iiCo3g1yeKhd0cWSLw3rA+TxicbTqNBW0/wNK0siox +4ufU5GgjwoozEWZ7ZG+coKhws4dDc1NiLjSoEp6fJFDtEtjlbLGjaJK4nwdHstyPfK0 Ir/2CdmVsKStSv9gbs4F3IEeC5GR7ZYr/BNed2kbgBJWjQO4HqrpjfdjU/HcWhDO1G0u eqQ72tDURayiZEW86/BZcasUcGJL3JXeC8E9ACR7ZQ+INM8BG+R5MIswuWu8usBVk0be FBgg== 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=vHRO/0KjGNxIcLdu4Nprxq06C5XRM7DNFyiZUQDkaSQ=; b=KpdZNwNdKjU9J/puAhBsxRJjSKjB+W4KcSK10x+L+4kgA/p++Ba9S+jU9CHmS5UfIc U/5YPkbClcHfo0O4Bx9EgTIhM6x8oloN5BUR2dsMFlvuA9d7EKgBF39nlHG+XnXiZHI1 z9BCnwROhKOmILi3m9dWMDFMYHKc0xuDTcw4UxPCFPzTTB7hZnpvzz155HV86SkRUU2o 3f/lr7axKXqPaC4pQ69sUg899TFmhrpT6MzOiUBbe4TWjZsKz91apw0EeOyXjg/ojX/+ 7G51KSXj5Uuj8LyuBSlsLUihL4LkeSy2oydOJr/FY6/KESZJFBSBgjF/MhTzLGbYkAqS N1Wg== X-Gm-Message-State: AOAM5329Z43/L9R6CtMEtouLgNPMnnCipuruKOWZngWLVceJR789lQ/O SMmhN8c63F3W0Qsz71v41s5Fbw== X-Received: by 2002:a17:90a:304d:: with SMTP id q13mr6267566pjl.73.1594757101831; Tue, 14 Jul 2020 13:05:01 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t13sm3262959pjs.17.2020.07.14.13.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 13:05:01 -0700 (PDT) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org, loic.pallardy@st.com, arnaud.pouliquen@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v6 11/11] remoteproc: stm32: Update M4 state in stm32_rproc_stop() Date: Tue, 14 Jul 2020 14:04:45 -0600 Message-Id: <20200714200445.1427257-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200714200445.1427257-1-mathieu.poirier@linaro.org> References: <20200714200445.1427257-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 co-processor state in function stm32_rproc_stop() so that it can be used in scenarios where the remoteproc core is attaching to the M4. 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 Reviewed-by: Arnaud Pouliquen --- drivers/remoteproc/stm32_rproc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 7145cd49616e..f4da42fc0eeb 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -504,6 +504,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; } -- 2.25.1