xref: /OK3568_Linux_fs/kernel/Documentation/mhi/topology.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun============
4*4882a593SmuzhiyunMHI Topology
5*4882a593Smuzhiyun============
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThis document provides information about the MHI topology modeling and
8*4882a593Smuzhiyunrepresentation in the kernel.
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunMHI Controller
11*4882a593Smuzhiyun--------------
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunMHI controller driver manages the interaction with the MHI client devices
14*4882a593Smuzhiyunsuch as the external modems and WiFi chipsets. It is also the MHI bus master
15*4882a593Smuzhiyunwhich is in charge of managing the physical link between the host and device.
16*4882a593SmuzhiyunIt is however not involved in the actual data transfer as the data transfer
17*4882a593Smuzhiyunis taken care by the physical bus such as PCIe. Each controller driver exposes
18*4882a593Smuzhiyunchannels and events based on the client device type.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunBelow are the roles of the MHI controller driver:
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun* Turns on the physical bus and establishes the link to the device
23*4882a593Smuzhiyun* Configures IRQs, IOMMU, and IOMEM
24*4882a593Smuzhiyun* Allocates struct mhi_controller and registers with the MHI bus framework
25*4882a593Smuzhiyun  with channel and event configurations using mhi_register_controller.
26*4882a593Smuzhiyun* Initiates power on and shutdown sequence
27*4882a593Smuzhiyun* Initiates suspend and resume power management operations of the device.
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunMHI Device
30*4882a593Smuzhiyun----------
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunMHI device is the logical device which binds to a maximum of two MHI channels
33*4882a593Smuzhiyunfor bi-directional communication. Once MHI is in powered on state, the MHI
34*4882a593Smuzhiyuncore will create MHI devices based on the channel configuration exposed
35*4882a593Smuzhiyunby the controller. There can be a single MHI device for each channel or for a
36*4882a593Smuzhiyuncouple of channels.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunEach supported device is enumerated in::
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun        /sys/bus/mhi/devices/
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunMHI Driver
43*4882a593Smuzhiyun----------
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunMHI driver is the client driver which binds to one or more MHI devices. The MHI
46*4882a593Smuzhiyundriver sends and receives the upper-layer protocol packets like IP packets,
47*4882a593Smuzhiyunmodem control messages, and diagnostics messages over MHI. The MHI core will
48*4882a593Smuzhiyunbind the MHI devices to the MHI driver.
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunEach supported driver is enumerated in::
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun        /sys/bus/mhi/drivers/
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunBelow are the roles of the MHI driver:
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun* Registers the driver with the MHI bus framework using mhi_driver_register.
57*4882a593Smuzhiyun* Prepares the device for transfer by calling mhi_prepare_for_transfer.
58*4882a593Smuzhiyun* Initiates data transfer by calling mhi_queue_transfer.
59*4882a593Smuzhiyun* Once the data transfer is finished, calls mhi_unprepare_from_transfer to
60*4882a593Smuzhiyun  end data transfer.
61