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