diff options
author | Lee Jones <lee.jones@linaro.org> | 2016-01-12 07:46:17 -0500 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2016-01-29 20:26:48 -0500 |
commit | 69e50479bd6b99a377223104be46f7b894ca4208 (patch) | |
tree | cb71096d5d3abf96fef4f6e4af5406ce238a75e0 /drivers/remoteproc | |
parent | 6cb0e0f6a46a6c2f1d6f9d4a0539f2ed7d8487fb (diff) |
remoteproc: debugfs: Add ability to boot remote processor using debugfs
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 <ludovic.barre@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | drivers/remoteproc/remoteproc_debugfs.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 6fdfa688281a..74a120b6e206 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, | |||
88 | return simple_read_from_buffer(userbuf, count, ppos, buf, i); | 88 | return simple_read_from_buffer(userbuf, count, ppos, buf, i); |
89 | } | 89 | } |
90 | 90 | ||
91 | static ssize_t rproc_state_write(struct file *filp, const char __user *userbuf, | ||
92 | size_t count, loff_t *ppos) | ||
93 | { | ||
94 | struct rproc *rproc = filp->private_data; | ||
95 | char buf[10]; | ||
96 | int ret; | ||
97 | |||
98 | if (count > sizeof(buf) || count <= 0) | ||
99 | return -EINVAL; | ||
100 | |||
101 | ret = copy_from_user(buf, userbuf, count); | ||
102 | if (ret) | ||
103 | return -EFAULT; | ||
104 | |||
105 | if (buf[count - 1] == '\n') | ||
106 | buf[count - 1] = '\0'; | ||
107 | |||
108 | if (!strncmp(buf, "start", count)) { | ||
109 | ret = rproc_boot(rproc); | ||
110 | if (ret) { | ||
111 | dev_err(&rproc->dev, "Boot failed: %d\n", ret); | ||
112 | return ret; | ||
113 | } | ||
114 | } else if (!strncmp(buf, "stop", count)) { | ||
115 | rproc_shutdown(rproc); | ||
116 | } else { | ||
117 | dev_err(&rproc->dev, "Unrecognised option: %s\n", buf); | ||
118 | return -EINVAL; | ||
119 | } | ||
120 | |||
121 | return count; | ||
122 | } | ||
123 | |||
91 | static const struct file_operations rproc_state_ops = { | 124 | static const struct file_operations rproc_state_ops = { |
92 | .read = rproc_state_read, | 125 | .read = rproc_state_read, |
126 | .write = rproc_state_write, | ||
93 | .open = simple_open, | 127 | .open = simple_open, |
94 | .llseek = generic_file_llseek, | 128 | .llseek = generic_file_llseek, |
95 | }; | 129 | }; |