Back to home page

OSCL-LXR

 
 

    


0001 ============================
0002 Linux kernel SLIMbus support
0003 ============================
0004 
0005 Overview
0006 ========
0007 
0008 What is SLIMbus?
0009 ----------------
0010 SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by
0011 MIPI (Mobile Industry Processor Interface) alliance. The bus uses master/slave
0012 configuration, and is a 2-wire multi-drop implementation (clock, and data).
0013 
0014 Currently, SLIMbus is used to interface between application processors of SoCs
0015 (System-on-Chip) and peripheral components (typically codec). SLIMbus uses
0016 Time-Division-Multiplexing to accommodate multiple data channels, and
0017 a control channel.
0018 
0019 The control channel is used for various control functions such as bus
0020 management, configuration and status updates. These messages can be unicast (e.g.
0021 reading/writing device specific values), or multicast (e.g. data channel
0022 reconfiguration sequence is a broadcast message announced to all devices)
0023 
0024 A data channel is used for data-transfer between 2 SLIMbus devices. Data
0025 channel uses dedicated ports on the device.
0026 
0027 Hardware description:
0028 ---------------------
0029 SLIMbus specification has different types of device classifications based on
0030 their capabilities.
0031 A manager device is responsible for enumeration, configuration, and dynamic
0032 channel allocation. Every bus has 1 active manager.
0033 
0034 A generic device is a device providing application functionality (e.g. codec).
0035 
0036 Framer device is responsible for clocking the bus, and transmitting frame-sync
0037 and framing information on the bus.
0038 
0039 Each SLIMbus component has an interface device for monitoring physical layer.
0040 
0041 Typically each SoC contains SLIMbus component having 1 manager, 1 framer device,
0042 1 generic device (for data channel support), and 1 interface device.
0043 External peripheral SLIMbus component usually has 1 generic device (for
0044 functionality/data channel support), and an associated interface device.
0045 The generic device's registers are mapped as 'value elements' so that they can
0046 be written/read using SLIMbus control channel exchanging control/status type of
0047 information.
0048 In case there are multiple framer devices on the same bus, manager device is
0049 responsible to select the active-framer for clocking the bus.
0050 
0051 Per specification, SLIMbus uses "clock gears" to do power management based on
0052 current frequency and bandwidth requirements. There are 10 clock gears and each
0053 gear changes the SLIMbus frequency to be twice its previous gear.
0054 
0055 Each device has a 6-byte enumeration-address and the manager assigns every
0056 device with a 1-byte logical address after the devices report presence on the
0057 bus.
0058 
0059 Software description:
0060 ---------------------
0061 There are 2 types of SLIMbus drivers:
0062 
0063 slim_controller represents a 'controller' for SLIMbus. This driver should
0064 implement duties needed by the SoC (manager device, associated
0065 interface device for monitoring the layers and reporting errors, default
0066 framer device).
0067 
0068 slim_device represents the 'generic device/component' for SLIMbus, and a
0069 slim_driver should implement driver for that slim_device.
0070 
0071 Device notifications to the driver:
0072 -----------------------------------
0073 Since SLIMbus devices have mechanisms for reporting their presence, the
0074 framework allows drivers to bind when corresponding devices report their
0075 presence on the bus.
0076 However, it is possible that the driver needs to be probed
0077 first so that it can enable corresponding SLIMbus device (e.g. power it up and/or
0078 take it out of reset). To support that behavior, the framework allows drivers
0079 to probe first as well  (e.g. using standard DeviceTree compatibility field).
0080 This creates the necessity for the driver to know when the device is functional
0081 (i.e. reported present). device_up callback is used for that reason when the
0082 device reports present and is assigned a logical address by the controller.
0083 
0084 Similarly, SLIMbus devices 'report absent' when they go down. A 'device_down'
0085 callback notifies the driver when the device reports absent and its logical
0086 address assignment is invalidated by the controller.
0087 
0088 Another notification "boot_device" is used to notify the slim_driver when
0089 controller resets the bus. This notification allows the driver to take necessary
0090 steps to boot the device so that it's functional after the bus has been reset.
0091 
0092 Driver and Controller APIs:
0093 ---------------------------
0094 .. kernel-doc:: include/linux/slimbus.h
0095    :internal:
0096 
0097 .. kernel-doc:: drivers/slimbus/slimbus.h
0098    :internal:
0099 
0100 .. kernel-doc:: drivers/slimbus/core.c
0101    :export:
0102 
0103 Clock-pause:
0104 ------------
0105 SLIMbus mandates that a reconfiguration sequence (known as clock-pause) be
0106 broadcast to all active devices on the bus before the bus can enter low-power
0107 mode. Controller uses this sequence when it decides to enter low-power mode so
0108 that corresponding clocks and/or power-rails can be turned off to save power.
0109 Clock-pause is exited by waking up framer device (if controller driver initiates
0110 exiting low power mode), or by toggling the data line (if a slave device wants
0111 to initiate it).
0112 
0113 Clock-pause APIs:
0114 ~~~~~~~~~~~~~~~~~
0115 .. kernel-doc:: drivers/slimbus/sched.c
0116    :export:
0117 
0118 Messaging:
0119 ----------
0120 The framework supports regmap and read/write apis to exchange control-information
0121 with a SLIMbus device. APIs can be synchronous or asynchronous.
0122 The header file <linux/slimbus.h> has more documentation about messaging APIs.
0123 
0124 Messaging APIs:
0125 ~~~~~~~~~~~~~~~
0126 .. kernel-doc:: drivers/slimbus/messaging.c
0127    :export:
0128 
0129 Streaming APIs:
0130 ~~~~~~~~~~~~~~~
0131 .. kernel-doc:: drivers/slimbus/stream.c
0132    :export: