--- old/linux-xlnx-xilinx-v2015.1/drivers/remoteproc/zynq_remoteproc.c +++ linux-xlnx-xilinx-v2015.1/drivers/remoteproc/zynq_remoteproc.c @@ -62,6 +62,25 @@ struct zynq_rproc_pdata { static struct platform_device *remoteprocdev; static struct work_struct workqueue; +ssize_t up_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct rproc *rproc = container_of(dev, struct rproc, dev); + if(buf[0] == '0') { // want to shut down + rproc_shutdown(rproc); + } else { // bring up + rproc_boot(rproc); + } + return count; +} + +static ssize_t up_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct rproc *rproc = container_of(dev, struct rproc, dev); + return sprintf(buf, "%d\n", rproc->state); +} + +static DEVICE_ATTR_RW(up); + static void handle_event(struct work_struct *work) { struct zynq_rproc_pdata *local = platform_get_drvdata(remoteprocdev); @@ -308,6 +327,8 @@ static int zynq_remoteproc_probe(struct goto rproc_fault; } + ret = device_create_file(&local->rproc->dev, &dev_attr_up); + return ret; } else ret = -ENODEV;