slimbus.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. ============================
  2. Linux kernel SLIMbus support
  3. ============================
  4. Overview
  5. ========
  6. What is SLIMbus?
  7. ----------------
  8. SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by
  9. MIPI (Mobile Industry Processor Interface) alliance. The bus uses master/slave
  10. configuration, and is a 2-wire multi-drop implementation (clock, and data).
  11. Currently, SLIMbus is used to interface between application processors of SoCs
  12. (System-on-Chip) and peripheral components (typically codec). SLIMbus uses
  13. Time-Division-Multiplexing to accommodate multiple data channels, and
  14. a control channel.
  15. The control channel is used for various control functions such as bus
  16. management, configuration and status updates. These messages can be unicast (e.g.
  17. reading/writing device specific values), or multicast (e.g. data channel
  18. reconfiguration sequence is a broadcast message announced to all devices)
  19. A data channel is used for data-transfer between 2 SLIMbus devices. Data
  20. channel uses dedicated ports on the device.
  21. Hardware description:
  22. ---------------------
  23. SLIMbus specification has different types of device classifications based on
  24. their capabilities.
  25. A manager device is responsible for enumeration, configuration, and dynamic
  26. channel allocation. Every bus has 1 active manager.
  27. A generic device is a device providing application functionality (e.g. codec).
  28. Framer device is responsible for clocking the bus, and transmitting frame-sync
  29. and framing information on the bus.
  30. Each SLIMbus component has an interface device for monitoring physical layer.
  31. Typically each SoC contains SLIMbus component having 1 manager, 1 framer device,
  32. 1 generic device (for data channel support), and 1 interface device.
  33. External peripheral SLIMbus component usually has 1 generic device (for
  34. functionality/data channel support), and an associated interface device.
  35. The generic device's registers are mapped as 'value elements' so that they can
  36. be written/read using SLIMbus control channel exchanging control/status type of
  37. information.
  38. In case there are multiple framer devices on the same bus, manager device is
  39. responsible to select the active-framer for clocking the bus.
  40. Per specification, SLIMbus uses "clock gears" to do power management based on
  41. current frequency and bandwidth requirements. There are 10 clock gears and each
  42. gear changes the SLIMbus frequency to be twice its previous gear.
  43. Each device has a 6-byte enumeration-address and the manager assigns every
  44. device with a 1-byte logical address after the devices report presence on the
  45. bus.
  46. Software description:
  47. ---------------------
  48. There are 2 types of SLIMbus drivers:
  49. slim_controller represents a 'controller' for SLIMbus. This driver should
  50. implement duties needed by the SoC (manager device, associated
  51. interface device for monitoring the layers and reporting errors, default
  52. framer device).
  53. slim_device represents the 'generic device/component' for SLIMbus, and a
  54. slim_driver should implement driver for that slim_device.
  55. Device notifications to the driver:
  56. -----------------------------------
  57. Since SLIMbus devices have mechanisms for reporting their presence, the
  58. framework allows drivers to bind when corresponding devices report their
  59. presence on the bus.
  60. However, it is possible that the driver needs to be probed
  61. first so that it can enable corresponding SLIMbus device (e.g. power it up and/or
  62. take it out of reset). To support that behavior, the framework allows drivers
  63. to probe first as well (e.g. using standard DeviceTree compatibility field).
  64. This creates the necessity for the driver to know when the device is functional
  65. (i.e. reported present). device_up callback is used for that reason when the
  66. device reports present and is assigned a logical address by the controller.
  67. Similarly, SLIMbus devices 'report absent' when they go down. A 'device_down'
  68. callback notifies the driver when the device reports absent and its logical
  69. address assignment is invalidated by the controller.
  70. Another notification "boot_device" is used to notify the slim_driver when
  71. controller resets the bus. This notification allows the driver to take necessary
  72. steps to boot the device so that it's functional after the bus has been reset.
  73. Driver and Controller APIs:
  74. ---------------------------
  75. .. kernel-doc:: include/linux/slimbus.h
  76. :internal:
  77. .. kernel-doc:: drivers/slimbus/slimbus.h
  78. :internal:
  79. .. kernel-doc:: drivers/slimbus/core.c
  80. :export:
  81. Clock-pause:
  82. ------------
  83. SLIMbus mandates that a reconfiguration sequence (known as clock-pause) be
  84. broadcast to all active devices on the bus before the bus can enter low-power
  85. mode. Controller uses this sequence when it decides to enter low-power mode so
  86. that corresponding clocks and/or power-rails can be turned off to save power.
  87. Clock-pause is exited by waking up framer device (if controller driver initiates
  88. exiting low power mode), or by toggling the data line (if a slave device wants
  89. to initiate it).
  90. Clock-pause APIs:
  91. ~~~~~~~~~~~~~~~~~
  92. .. kernel-doc:: drivers/slimbus/sched.c
  93. :export:
  94. Messaging:
  95. ----------
  96. The framework supports regmap and read/write apis to exchange control-information
  97. with a SLIMbus device. APIs can be synchronous or asynchronous.
  98. The header file <linux/slimbus.h> has more documentation about messaging APIs.
  99. Messaging APIs:
  100. ~~~~~~~~~~~~~~~
  101. .. kernel-doc:: drivers/slimbus/messaging.c
  102. :export:
  103. Streaming APIs:
  104. ~~~~~~~~~~~~~~~
  105. .. kernel-doc:: drivers/slimbus/stream.c
  106. :export: