Skip to content

Commit

Permalink
Merge tag 'rproc-v4.6' of git://github.com/andersson/remoteproc
Browse files Browse the repository at this point in the history
Pull remoteproc updates from Bjorn Andersson:
 "New driver for controlling ST's remote processors and a couple of
  minor fixes.  Also includes the addition of myself as co-maintainer"

Acked-by: Ohad Ben-Cohen <[email protected]>

* tag 'rproc-v4.6' of git://github.com/andersson/remoteproc:
  MAINTAINERS: Add co-maintainer for remoteproc subsystems
  remoteproc: Supply controller driver for ST's Remote Processors
  remoteproc: debugfs: Add ability to boot remote processor using debugfs
  remoteproc: dt: Provide bindings for ST's Remote Processor Controller driver
  remoteproc: debugfs: Return error on invalid 'count' value
  remoteproc/wkup_m3: Use MODULE_DEVICE_TABLE to export alias
  remoteproc: report error if resource table doesn't exist
  • Loading branch information
torvalds committed Mar 17, 2016
2 parents 37aa731 + 69ae989 commit c7eec38
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 2 deletions.
41 changes: 41 additions & 0 deletions Documentation/devicetree/bindings/remoteproc/st-rproc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
STMicroelectronics Co-Processor Bindings
----------------------------------------

This binding provides support for adjunct processors found on ST SoCs.

Co-processors can be controlled from the bootloader or the primary OS. If
the bootloader starts a co-processor, the primary OS must detect its state
and act accordingly.

Required properties:
- compatible Should be one of:
"st,st231-rproc"
"st,st40-rproc"
- memory-region Reserved memory (See: ../reserved-memory/reserved-memory.txt)
- resets Reset lines (See: ../reset/reset.txt)
- reset-names Must be "sw_reset" and "pwr_reset"
- clocks Clock for co-processor (See: ../clock/clock-bindings.txt)
- clock-frequency Clock frequency to set co-processor at if the bootloader
hasn't already done so
- st,syscfg System configuration register which holds the boot vector
for the co-processor
1st cell: Phandle to syscon block
2nd cell: Boot vector register offset

Example:

audio_reserved: rproc@42000000 {
compatible = "shared-dma-pool";
reg = <0x42000000 0x01000000>;
no-map;
};

st231-audio {
compatible = "st,st231-rproc";
memory-region = <&audio_reserved>;
resets = <&softreset STIH407_ST231_AUD_SOFTRESET>;
reset-names = "sw_reset";
clocks = <&clk_s_c0_flexgen CLK_ST231_AUD_0>;
clock-frequency = <600000000>;
st,syscfg = <&syscfg_core 0x228>;
};
3 changes: 3 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4979,6 +4979,7 @@ F: include/linux/hw_random.h

HARDWARE SPINLOCK CORE
M: Ohad Ben-Cohen <[email protected]>
M: Bjorn Andersson <[email protected]>
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/ohad/hwspinlock.git
F: Documentation/hwspinlock.txt
Expand Down Expand Up @@ -9169,6 +9170,7 @@ F: include/linux/regmap.h

REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM
M: Ohad Ben-Cohen <[email protected]>
M: Bjorn Andersson <[email protected]>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc.git
S: Maintained
F: drivers/remoteproc/
Expand All @@ -9177,6 +9179,7 @@ F: include/linux/remoteproc.h

REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM
M: Ohad Ben-Cohen <[email protected]>
M: Bjorn Andersson <[email protected]>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/ohad/rpmsg.git
S: Maintained
F: drivers/rpmsg/
Expand Down
9 changes: 9 additions & 0 deletions drivers/remoteproc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,13 @@ config DA8XX_REMOTEPROC
It's safe to say n here if you're not interested in multimedia
offloading.

config ST_REMOTEPROC
tristate "ST remoteproc support"
depends on ARCH_STI
select REMOTEPROC
help
Say y here to support ST's adjunct processors via the remote
processor framework.
This can be either built-in or a loadable module.

endmenu
1 change: 1 addition & 0 deletions drivers/remoteproc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o
obj-$(CONFIG_STE_MODEM_RPROC) += ste_modem_rproc.o
obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o
obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
4 changes: 3 additions & 1 deletion drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)

/* look for the resource table */
table = rproc_find_rsc_table(rproc, fw, &tablesz);
if (!table)
if (!table) {
dev_err(dev, "Failed to find resource table\n");
goto clean_up;
}

/* Verify that resource table in loaded fw is unchanged */
if (rproc->table_csum != crc32(0, table, tablesz)) {
Expand Down
36 changes: 35 additions & 1 deletion drivers/remoteproc/remoteproc_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -157,7 +191,7 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf,
int ret;

if (count < 1 || count > sizeof(buf))
return count;
return -EINVAL;

ret = copy_from_user(buf, user_buf, count);
if (ret)
Expand Down
Loading

0 comments on commit c7eec38

Please sign in to comment.