From patchwork Fri Aug 28 10:31:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 52784 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 9CA5521569 for ; Fri, 28 Aug 2015 10:34:19 +0000 (UTC) Received: by lbck9 with SMTP id k9sf15493322lbc.0 for ; Fri, 28 Aug 2015 03:34:18 -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=4htVo16wBYhDVpXXknC7m/Yfq5PuOtl6aRAuGFMoSeQ=; b=QN517VlMKfcbccqDhVhC+8RVjtRDlTRmvRI/tQBN33eCpMiELuI9lrkFhCwUiZN0MS Py/Miwv4baQ+ypCxUGOJgiyWKBZTe641CwAsM51cclYCTcOQ9SgBH+TvEMIlyc8knA7b SJukLU5RnwwpLZze5UpG1aszQ1HW5OpV1VB/aQFLMo8x7YXRT113mlSzLmWSiI6PU8Yu D59KkE2POeLPtFxFQ1m9Kxtgba3GG08IEKQjma9sQL6YIADW+Il8iK+O83oJq4j+PTT/ fCKx4OQ4VrvOpv51zqF3jwUX2p0eEKpa1wt+c64O8gaJ78wrcFMoTQQfYnZhiEA+biGg /zhQ== X-Gm-Message-State: ALoCoQlUTjjBrwbU4GiZxvWFwzDb8drVxWs9XcN7o0d6K/diwUHeWF8F64TlrPuTx9fSl6U8523T X-Received: by 10.112.54.166 with SMTP id k6mr2590915lbp.0.1440758058579; Fri, 28 Aug 2015 03:34:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.135 with SMTP id q7ls176966laj.77.gmail; Fri, 28 Aug 2015 03:34:18 -0700 (PDT) X-Received: by 10.152.18.137 with SMTP id w9mr4498097lad.23.1440758058416; Fri, 28 Aug 2015 03:34:18 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id jx2si5362913lbc.124.2015.08.28.03.34.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2015 03:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbsx3 with SMTP id sx3so27579807lbb.0 for ; Fri, 28 Aug 2015 03:34:18 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr4420666laf.112.1440758058293; Fri, 28 Aug 2015 03:34:18 -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.151.194 with SMTP id us2csp436338lbb; Fri, 28 Aug 2015 03:34:17 -0700 (PDT) X-Received: by 10.68.133.167 with SMTP id pd7mr12220256pbb.23.1440758056983; Fri, 28 Aug 2015 03:34:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id at3si8504911pbd.231.2015.08.28.03.34.15; Fri, 28 Aug 2015 03:34:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S1752345AbbH1KeL (ORCPT + 28 others); Fri, 28 Aug 2015 06:34:11 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33538 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbbH1KeA (ORCPT ); Fri, 28 Aug 2015 06:34:00 -0400 Received: by wieo17 with SMTP id o17so10802207wie.0 for ; Fri, 28 Aug 2015 03:33:59 -0700 (PDT) X-Received: by 10.180.100.40 with SMTP id ev8mr3777872wib.14.1440758039264; Fri, 28 Aug 2015 03:33:59 -0700 (PDT) Received: from localhost.localdomain (host81-129-172-123.range81-129.btcentralplus.com. [81.129.172.123]) by smtp.gmail.com with ESMTPSA id r8sm3110296wik.16.2015.08.28.03.33.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Aug 2015 03:33:58 -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, Lee Jones , Ludovic Barre Subject: [PATCH v2 4/4] remoteproc: debugfs: Add ability to boot remote processor using debugfs Date: Fri, 28 Aug 2015 11:31:51 +0100 Message-Id: <1440757911-9120-5-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440757911-9120-1-git-send-email-lee.jones@linaro.org> References: <1440757911-9120-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.217.171 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 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 9d30809..464470d 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -88,8 +88,37 @@ 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[2]; + int ret; + + ret = copy_from_user(buf, userbuf, 1); + if (ret) + return -EFAULT; + + switch (buf[0]) { + case '0': + rproc_shutdown(rproc); + break; + case '1': + ret = rproc_boot(rproc); + if (ret) + dev_warn(&rproc->dev, "Boot failed: %d\n", ret); + break; + default: + dev_err(&rproc->dev, "Unrecognised option: %x\n", buf[1]); + 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, };