remoteproc.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --- old/linux-xlnx-xilinx-v2015.1/drivers/remoteproc/zynq_remoteproc.c
  2. +++ linux-xlnx-xilinx-v2015.1/drivers/remoteproc/zynq_remoteproc.c
  3. @@ -62,6 +62,25 @@ struct zynq_rproc_pdata {
  4. static struct platform_device *remoteprocdev;
  5. static struct work_struct workqueue;
  6. +ssize_t up_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
  7. +{
  8. + struct rproc *rproc = container_of(dev, struct rproc, dev);
  9. + if(buf[0] == '0') { // want to shut down
  10. + rproc_shutdown(rproc);
  11. + } else { // bring up
  12. + rproc_boot(rproc);
  13. + }
  14. + return count;
  15. +}
  16. +
  17. +static ssize_t up_show(struct device *dev, struct device_attribute *attr, char *buf)
  18. +{
  19. + struct rproc *rproc = container_of(dev, struct rproc, dev);
  20. + return sprintf(buf, "%d\n", rproc->state);
  21. +}
  22. +
  23. +static DEVICE_ATTR_RW(up);
  24. +
  25. static void handle_event(struct work_struct *work)
  26. {
  27. struct zynq_rproc_pdata *local = platform_get_drvdata(remoteprocdev);
  28. @@ -308,6 +327,8 @@ static int zynq_remoteproc_probe(struct
  29. goto rproc_fault;
  30. }
  31. + ret = device_create_file(&local->rproc->dev, &dev_attr_up);
  32. +
  33. return ret;
  34. } else
  35. ret = -ENODEV;