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