remoteproc-framework.txt 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #
  2. # (C) Copyright 2015
  3. # Texas Instruments Incorporated - http://www.ti.com/
  4. # SPDX-License-Identifier: GPL-2.0+
  5. #
  6. Remote Processor Framework
  7. ==========================
  8. TOC:
  9. 1. Introduction
  10. 2. How does it work - The driver
  11. 3. Describing the device using platform data
  12. 4. Describing the device using device tree
  13. 1. Introduction
  14. ===============
  15. This is an introduction to driver-model for Remote Processors found
  16. on various System on Chip(SoCs). The term remote processor is used to
  17. indicate that this is not the processor on which U-Boot is operating
  18. on, instead is yet another processing entity that may be controlled by
  19. the processor on which we are functional.
  20. The simplified model depends on a single UCLASS - UCLASS_REMOTEPROC
  21. UCLASS_REMOTEPROC:
  22. - drivers/remoteproc/rproc-uclass.c
  23. - include/remoteproc.h
  24. Commands:
  25. - common/cmd_remoteproc.c
  26. Configuration:
  27. CONFIG_REMOTEPROC is selected by drivers as needed
  28. CONFIG_CMD_REMOTEPROC for the commands if required.
  29. 2. How does it work - The driver
  30. =================================
  31. Overall, the driver statemachine transitions are typically as follows:
  32. (entry)
  33. +-------+
  34. +---+ init |
  35. | | | <---------------------+
  36. | +-------+ |
  37. | |
  38. | |
  39. | +--------+ |
  40. Load| | reset | |
  41. | | | <----------+ |
  42. | +--------+ | |
  43. | |Load | |
  44. | | | |
  45. | +----v----+ reset | |
  46. +-> | | (opt) | |
  47. | Loaded +-----------+ |
  48. | | |
  49. +----+----+ |
  50. | Start |
  51. +---v-----+ (opt) |
  52. +->| Running | Stop |
  53. Ping +- | +--------------------+
  54. (opt) +---------+
  55. (is_running does not change state)
  56. opt: Optional state transition implemented by driver.
  57. NOTE: It depends on the remote processor as to the exact behavior
  58. of the statemachine, remoteproc core does not intent to implement
  59. statemachine logic. Certain processors may allow start/stop without
  60. reloading the image in the middle, certain other processors may only
  61. allow us to start the processor(image from a EEPROM/OTP) etc.
  62. It is hence the responsibility of the driver to handle the requisite
  63. state transitions of the device as necessary.
  64. Basic design assumptions:
  65. Remote processor can operate on a certain firmware that maybe loaded
  66. and released from reset.
  67. The driver follows a standard UCLASS DM.
  68. in the bare minimum form:
  69. static const struct dm_rproc_ops sandbox_testproc_ops = {
  70. .load = sandbox_testproc_load,
  71. .start = sandbox_testproc_start,
  72. };
  73. static const struct udevice_id sandbox_ids[] = {
  74. {.compatible = "sandbox,test-processor"},
  75. {}
  76. };
  77. U_BOOT_DRIVER(sandbox_testproc) = {
  78. .name = "sandbox_test_proc",
  79. .of_match = sandbox_ids,
  80. .id = UCLASS_REMOTEPROC,
  81. .ops = &sandbox_testproc_ops,
  82. .probe = sandbox_testproc_probe,
  83. };
  84. This allows for the device to be probed as part of the "init" command
  85. or invocation of 'rproc_init()' function as the system dependencies define.
  86. The driver is expected to maintain it's own statemachine which is
  87. appropriate for the device it maintains. It must, at the very least
  88. provide a load and start function. We assume here that the device
  89. needs to be loaded and started, else, there is no real purpose of
  90. using the remoteproc framework.
  91. 3. Describing the device using platform data
  92. ============================================
  93. *IMPORTANT* NOTE: THIS SUPPORT IS NOT MEANT FOR USE WITH NEWER PLATFORM
  94. SUPPORT. THIS IS ONLY FOR LEGACY DEVICES. THIS MODE OF INITIALIZATION
  95. *WILL* BE EVENTUALLY REMOVED ONCE ALL NECESSARY PLATFORMS HAVE MOVED
  96. TO DM/FDT.
  97. Considering that many platforms are yet to move to device-tree model,
  98. a simplified definition of a device is as follows:
  99. struct dm_rproc_uclass_pdata proc_3_test = {
  100. .name = "proc_3_legacy",
  101. .mem_type = RPROC_INTERNAL_MEMORY_MAPPED,
  102. .driver_plat_data = &mydriver_data;
  103. };
  104. U_BOOT_DEVICE(proc_3_demo) = {
  105. .name = "sandbox_test_proc",
  106. .platdata = &proc_3_test,
  107. };
  108. There can be additional data that may be desired depending on the
  109. remoteproc driver specific needs (for example: SoC integration
  110. details such as clock handle or something similar). See appropriate
  111. documentation for specific remoteproc driver for further details.
  112. These are passed via driver_plat_data.
  113. 3. Describing the device using device tree
  114. ==========================================
  115. / {
  116. ...
  117. aliases {
  118. ...
  119. remoteproc0 = &rproc_1;
  120. remoteproc1 = &rproc_2;
  121. };
  122. ...
  123. rproc_1: rproc@1 {
  124. compatible = "sandbox,test-processor";
  125. remoteproc-name = "remoteproc-test-dev1";
  126. };
  127. rproc_2: rproc@2 {
  128. compatible = "sandbox,test-processor";
  129. internal-memory-mapped;
  130. remoteproc-name = "remoteproc-test-dev2";
  131. };
  132. ...
  133. };
  134. aliases usage is optional, but it is usually recommended to ensure the
  135. users have a consistent usage model for a platform.
  136. the compatible string used here is specific to the remoteproc driver involved.