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: 52987 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 5A34522DC0 for ; Wed, 2 Sep 2015 15:41:48 +0000 (UTC) Received: by wiclp12 with SMTP id lp12sf7817286wic.0 for ; Wed, 02 Sep 2015 08:41:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=AuHBWu5uPYQn0twUt3Cc2qYA+S8xePlB+20ZK9TP6h8=; b=f5OUJfI7fYc+w7WDueCzfDEE2DcfWW2koDsxA1xBoOOCKp0FNPLzrh9RBTB1qn5uJm Djd/H59Ze1CT5TFKubK8aeti6tSzr4yL8SM7zvZaDAMW57xYbIrKFOApBTHJNgOK+8Pw BFU12+BXQwKdc6m91TB/o5cF2sq8cEdgGtoPrpmj1SWni63WrnmSovaYTwX7Qk6Xgls3 5KHXArdKQww0pUf3LfKQwH+F3YPr6OTMH8CQ7F0JYnbmZP1FBojfRCVhOnws+7lNX0Ok OgaIH/xHZXvvU5HxVOV0157B9OYWXCXH/3xne/QYQneBJvN/SFZdnLQyo6Z9uw84OobA /uZg== X-Gm-Message-State: ALoCoQkEy4NrXR0JJhurcEnsCcyZUqq6nODnvop7gF2F7BDNr1oFgcOu2cOp28lmldgyS/GuKDHp X-Received: by 10.112.138.2 with SMTP id qm2mr9308687lbb.19.1441208507633; Wed, 02 Sep 2015 08:41:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.197 with SMTP id h5ls87504lae.85.gmail; Wed, 02 Sep 2015 08:41:47 -0700 (PDT) X-Received: by 10.152.207.35 with SMTP id lt3mr2165592lac.2.1441208507502; Wed, 02 Sep 2015 08:41:47 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id u2si19990684laj.34.2015.09.02.08.41.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 08:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagj9 with SMTP id j9so10095135lag.2 for ; Wed, 02 Sep 2015 08:41:47 -0700 (PDT) X-Received: by 10.152.18.164 with SMTP id x4mr16490137lad.35.1441208507386; Wed, 02 Sep 2015 08:41:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp662963lbb; Wed, 2 Sep 2015 08:41:46 -0700 (PDT) X-Received: by 10.67.6.164 with SMTP id cv4mr56856201pad.59.1441208502086; Wed, 02 Sep 2015 08:41:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ou3si34156689pbb.11.2015.09.02.08.41.41; Wed, 02 Sep 2015 08:41:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754944AbbIBPlj (ORCPT + 8 others); Wed, 2 Sep 2015 11:41:39 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33167 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755037AbbIBPkY (ORCPT ); Wed, 2 Sep 2015 11:40:24 -0400 Received: by wicmc4 with SMTP id mc4so70610954wic.0 for ; Wed, 02 Sep 2015 08:40:23 -0700 (PDT) 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 Cc: kernel@stlinux.com, ohad@wizery.com, devicetree@vger.kernel.org, Nathan_Lynch@mentor.com, f.fainelli@gmail.com, Lee Jones , Ludovic Barre 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> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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, };