From patchwork Wed Sep 2 15:38:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 7112871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 42D4EBEEC1 for ; Wed, 2 Sep 2015 15:42:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83DDF20632 for ; Wed, 2 Sep 2015 15:42:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90D15203C0 for ; Wed, 2 Sep 2015 15:42:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXA9k-0001Iw-JE; Wed, 02 Sep 2015 15:41:00 +0000 Received: from mail-wi0-f173.google.com ([209.85.212.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXA9P-00015o-VC for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2015 15:40:41 +0000 Received: by wicfx3 with SMTP id fx3so23528853wic.0 for ; Wed, 02 Sep 2015 08:40:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mm9Eq48pv4QTn4KC5vVxjj7TEktCEQfzccj4heSIgPk=; b=Zyq7Uku0VNB0P79aLrNFkE0VsK6oCdHbWiM4mKEiQlyVixnQCjAFMk+HTXkv6kgLN9 hJRu8Lq4sVqyzFBrJ93anWLTUqz6RshO0qvGFvJyMoAFSZuE7g1D8dRyIBdY6snBxqQb A0p08NXqYNZ/VFhExpKLcnBZ5VSploz5Ty0F/uTmoUYLy+TNnREK/b26XKN1eqAojtok qjdctbmL9FYXC/tR+VRSir8C5J1rzrpmBiPdno0PItFmRT1ubsROTiDjABIM/wUNcaOC jkXo4wxYpnLcKqprLIgRqhOzjREWCQyXxuE38bx4znGqJz86wmdlltBxLMpGOeKh7/jB NczA== X-Gm-Message-State: ALoCoQnBJMNeIk1fI9pKoRIj/KOs3+mzYVplefJBPxXGyC9ZtQJFFgCwWUSJXQgL860Yu7nWxIGS X-Received: by 10.180.90.198 with SMTP id by6mr5049027wib.82.1441208423154; Wed, 02 Sep 2015 08:40:23 -0700 (PDT) Received: from localhost.localdomain (host81-129-173-206.range81-129.btcentralplus.com. [81.129.173.206]) by smtp.gmail.com with ESMTPSA id x11sm3481257wia.19.2015.09.02.08.40.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Sep 2015 08:40:22 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/6] remoteproc: debugfs: Add ability to boot remote processor using debugfs Date: Wed, 2 Sep 2015 16:38:07 +0100 Message-Id: <1441208289-17330-5-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441208289-17330-1-git-send-email-lee.jones@linaro.org> References: <1441208289-17330-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150902_084040_167538_670BF624 X-CRM114-Status: GOOD ( 14.48 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ohad@wizery.com, devicetree@vger.kernel.org, f.fainelli@gmail.com, kernel@stlinux.com, Nathan_Lynch@mentor.com, Lee Jones , Ludovic Barre MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This functionality is especially useful during the testing phase. When used in conjunction with Mailbox's Test Framework we can trivially conduct end-to-end testing i.e. boot co-processor, send and receive messages to the co-processor, then shut it down again (repeat as required). Signed-off-by: Ludovic Barre Signed-off-by: Lee Jones --- drivers/remoteproc/remoteproc_debugfs.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 9d30809..8113c18 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -88,8 +88,42 @@ static ssize_t rproc_state_read(struct file *filp, char __user *userbuf, return simple_read_from_buffer(userbuf, count, ppos, buf, i); } +static ssize_t rproc_state_write(struct file *filp, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + struct rproc *rproc = filp->private_data; + char buf[10]; + int ret; + + if (count > sizeof(buf)) + return count; + + ret = copy_from_user(buf, userbuf, count); + if (ret) + return -EFAULT; + + if (buf[count - 1] == '\n') + buf[count - 1] = '\0'; + + if (!strncmp(buf, "start", count)) { + ret = rproc_boot(rproc); + if (ret) { + dev_err(&rproc->dev, "Boot failed: %d\n", ret); + return ret; + } + } else if (!strncmp(buf, "stop", count)) { + rproc_shutdown(rproc); + } else { + dev_err(&rproc->dev, "Unrecognised option: %s\n", buf); + return -EINVAL; + } + + return count; +} + static const struct file_operations rproc_state_ops = { .read = rproc_state_read, + .write = rproc_state_write, .open = simple_open, .llseek = generic_file_llseek, };