162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci============ 462306a36Sopenharmony_ciMHI Topology 562306a36Sopenharmony_ci============ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThis document provides information about the MHI topology modeling and 862306a36Sopenharmony_cirepresentation in the kernel. 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciMHI Controller 1162306a36Sopenharmony_ci-------------- 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciMHI controller driver manages the interaction with the MHI client devices 1462306a36Sopenharmony_cisuch as the external modems and WiFi chipsets. It is also the MHI bus master 1562306a36Sopenharmony_ciwhich is in charge of managing the physical link between the host and device. 1662306a36Sopenharmony_ciIt is however not involved in the actual data transfer as the data transfer 1762306a36Sopenharmony_ciis taken care by the physical bus such as PCIe. Each controller driver exposes 1862306a36Sopenharmony_cichannels and events based on the client device type. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciBelow are the roles of the MHI controller driver: 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci* Turns on the physical bus and establishes the link to the device 2362306a36Sopenharmony_ci* Configures IRQs, IOMMU, and IOMEM 2462306a36Sopenharmony_ci* Allocates struct mhi_controller and registers with the MHI bus framework 2562306a36Sopenharmony_ci with channel and event configurations using mhi_register_controller. 2662306a36Sopenharmony_ci* Initiates power on and shutdown sequence 2762306a36Sopenharmony_ci* Initiates suspend and resume power management operations of the device. 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciMHI Device 3062306a36Sopenharmony_ci---------- 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciMHI device is the logical device which binds to a maximum of two MHI channels 3362306a36Sopenharmony_cifor bi-directional communication. Once MHI is in powered on state, the MHI 3462306a36Sopenharmony_cicore will create MHI devices based on the channel configuration exposed 3562306a36Sopenharmony_ciby the controller. There can be a single MHI device for each channel or for a 3662306a36Sopenharmony_cicouple of channels. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciEach supported device is enumerated in:: 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci /sys/bus/mhi/devices/ 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciMHI Driver 4362306a36Sopenharmony_ci---------- 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciMHI driver is the client driver which binds to one or more MHI devices. The MHI 4662306a36Sopenharmony_cidriver sends and receives the upper-layer protocol packets like IP packets, 4762306a36Sopenharmony_cimodem control messages, and diagnostics messages over MHI. The MHI core will 4862306a36Sopenharmony_cibind the MHI devices to the MHI driver. 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ciEach supported driver is enumerated in:: 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci /sys/bus/mhi/drivers/ 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciBelow are the roles of the MHI driver: 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci* Registers the driver with the MHI bus framework using mhi_driver_register. 5762306a36Sopenharmony_ci* Prepares the device for transfer by calling mhi_prepare_for_transfer. 5862306a36Sopenharmony_ci* Initiates data transfer by calling mhi_queue_transfer. 5962306a36Sopenharmony_ci* Once the data transfer is finished, calls mhi_unprepare_from_transfer to 6062306a36Sopenharmony_ci end data transfer. 61