From patchwork Tue Jan 12 12:46:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 8016901 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 95DF5BEEE5 for ; Tue, 12 Jan 2016 12:49:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B7E9203C1 for ; Tue, 12 Jan 2016 12:49:55 +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 D54A5203C3 for ; Tue, 12 Jan 2016 12:49:54 +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 1aIyNB-0002el-CX; Tue, 12 Jan 2016 12:48:29 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aIyMc-0002RI-6I for linux-arm-kernel@lists.infradead.org; Tue, 12 Jan 2016 12:47:55 +0000 Received: by mail-wm0-x234.google.com with SMTP id f206so318353414wmf.0 for ; Tue, 12 Jan 2016 04:47:34 -0800 (PST) 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; bh=baIoO5QhXd/qohfaZ2K5nb/sx2n4fcNKRMxKygunz/8=; b=TYKIfdlvmehc8xFCIDDEUPdWBLjZftw3WqP1oZtlfMT/na8KpBXMSKvRfUGgjucbSw qQDlJ8B4tDoB8LXXD14BfgnBmORymyTV8wqmU+v5fxz7q4QHtLwduhb5IdmgixIsBWTT TKnZVbyPHy0xOwMA6DOzITigBP6oVaSBSWrKE= 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=baIoO5QhXd/qohfaZ2K5nb/sx2n4fcNKRMxKygunz/8=; b=Fva8MNaVk5IkpSobu4i2a21W+NntglItU8XlzBug59PRzaDEyf25QU87DHUJRq0No2 m09MNR+4wIBFLVYMk6BzhEKxU7aZNl+zn5RpYzKe/vfjiJLNtkimXvz4alQx5OL/j4jM 1MN6b+O2Ou6KsiEqVpLo1zOqB7z2mtEEVU0Vte3DjU/5+R/81NWTxhq1T2gKCif26ccV 3xNQozDpaQaABccIJE3xbrlzArJ5ZQ6Unw/rJQY/+YfAAaPnixBqJQXGuF2Ww28/pyyG AnzeRVEiGi+9R3Kd8Nr2qYx8Yf1V09kBnFWlSFq8tyg5winyW35j0lTdocn+HUQVYnhM VXSg== X-Gm-Message-State: ALoCoQmAIsbI9+7SeHwYBxY1F3amminP5lKKkBg7lTFJtObqWMONCcrJA9jkalFLekbzZOKCZTI7EdVbZvKRmiu500dDuaj+pg== X-Received: by 10.28.105.25 with SMTP id e25mr20842857wmc.62.1452602853776; Tue, 12 Jan 2016 04:47:33 -0800 (PST) Received: from localhost.localdomain ([217.46.108.250]) by smtp.gmail.com with ESMTPSA id uo9sm30240142wjc.49.2016.01.12.04.47.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jan 2016 04:47:33 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/7] remoteproc: debugfs: Add ability to boot remote processor using debugfs Date: Tue, 12 Jan 2016 12:46:17 +0000 Message-Id: <1452602781-22424-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452602781-22424-1-git-send-email-lee.jones@linaro.org> References: <1452602781-22424-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160112_044754_563757_DD444018 X-CRM114-Status: GOOD ( 13.79 ) X-Spam-Score: -2.7 (--) 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@st.com, maxime.coquelin@st.com 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Acked-by: Peter Griffin --- 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 f63464c..2f2ac33 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) || count <= 0) + return -EINVAL; + + 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, };