162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci.. Copyright (C) 2020-21 Intel Corporation
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci.. _iosm_driver_doc:
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci===========================================
862306a36Sopenharmony_ciIOSM Driver for Intel M.2 PCIe based Modems
962306a36Sopenharmony_ci===========================================
1062306a36Sopenharmony_ciThe IOSM (IPC over Shared Memory) driver is a WWAN PCIe host driver developed
1162306a36Sopenharmony_cifor linux or chrome platform for data exchange over PCIe interface between
1262306a36Sopenharmony_ciHost platform & Intel M.2 Modem. The driver exposes interface conforming to the
1362306a36Sopenharmony_ciMBIM protocol [1]. Any front end application ( eg: Modem Manager) could easily
1462306a36Sopenharmony_cimanage the MBIM interface to enable data communication towards WWAN.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciBasic usage
1762306a36Sopenharmony_ci===========
1862306a36Sopenharmony_ciMBIM functions are inactive when unmanaged. The IOSM driver only provides a
1962306a36Sopenharmony_ciuserspace interface MBIM "WWAN PORT" representing MBIM control channel and does
2062306a36Sopenharmony_cinot play any role in managing the functionality. It is the job of a userspace
2162306a36Sopenharmony_ciapplication to detect port enumeration and enable MBIM functionality.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciExamples of few such userspace application are:
2462306a36Sopenharmony_ci- mbimcli (included with the libmbim [2] library), and
2562306a36Sopenharmony_ci- Modem Manager [3]
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciManagement Applications to carry out below required actions for establishing
2862306a36Sopenharmony_ciMBIM IP session:
2962306a36Sopenharmony_ci- open the MBIM control channel
3062306a36Sopenharmony_ci- configure network connection settings
3162306a36Sopenharmony_ci- connect to network
3262306a36Sopenharmony_ci- configure IP network interface
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciManagement application development
3562306a36Sopenharmony_ci==================================
3662306a36Sopenharmony_ciThe driver and userspace interfaces are described below. The MBIM protocol is
3762306a36Sopenharmony_cidescribed in [1] Mobile Broadband Interface Model v1.0 Errata-1.
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciMBIM control channel userspace ABI
4062306a36Sopenharmony_ci----------------------------------
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/dev/wwan0mbim0 character device
4362306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4462306a36Sopenharmony_ciThe driver exposes an MBIM interface to the MBIM function by implementing
4562306a36Sopenharmony_ciMBIM WWAN Port. The userspace end of the control channel pipe is a
4662306a36Sopenharmony_ci/dev/wwan0mbim0 character device. Application shall use this interface for
4762306a36Sopenharmony_ciMBIM protocol communication.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciFragmentation
5062306a36Sopenharmony_ci~~~~~~~~~~~~~
5162306a36Sopenharmony_ciThe userspace application is responsible for all control message fragmentation
5262306a36Sopenharmony_ciand defragmentation as per MBIM specification.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/dev/wwan0mbim0 write()
5562306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~
5662306a36Sopenharmony_ciThe MBIM control messages from the management application must not exceed the
5762306a36Sopenharmony_cinegotiated control message size.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/dev/wwan0mbim0 read()
6062306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~
6162306a36Sopenharmony_ciThe management application must accept control messages of up the negotiated
6262306a36Sopenharmony_cicontrol message size.
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciMBIM data channel userspace ABI
6562306a36Sopenharmony_ci-------------------------------
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciwwan0-X network device
6862306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~
6962306a36Sopenharmony_ciThe IOSM driver exposes IP link interface "wwan0-X" of type "wwan" for IP
7062306a36Sopenharmony_citraffic. Iproute network utility is used for creating "wwan0-X" network
7162306a36Sopenharmony_ciinterface and for associating it with MBIM IP session. The Driver supports
7262306a36Sopenharmony_ciup to 8 IP sessions for simultaneous IP communication.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciThe userspace management application is responsible for creating new IP link
7562306a36Sopenharmony_ciprior to establishing MBIM IP session where the SessionId is greater than 0.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciFor example, creating new IP link for a MBIM IP session with SessionId 1:
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci  ip link add dev wwan0-1 parentdev-name wwan0 type wwan linkid 1
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciThe driver will automatically map the "wwan0-1" network device to MBIM IP
8262306a36Sopenharmony_cisession 1.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ciReferences
8562306a36Sopenharmony_ci==========
8662306a36Sopenharmony_ci[1] "MBIM (Mobile Broadband Interface Model) Errata-1"
8762306a36Sopenharmony_ci      - https://www.usb.org/document-library/
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci[2] libmbim - "a glib-based library for talking to WWAN modems and
9062306a36Sopenharmony_ci      devices which speak the Mobile Interface Broadband Model (MBIM)
9162306a36Sopenharmony_ci      protocol"
9262306a36Sopenharmony_ci      - http://www.freedesktop.org/wiki/Software/libmbim/
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci[3] Modem Manager - "a DBus-activated daemon which controls mobile
9562306a36Sopenharmony_ci      broadband (2G/3G/4G) devices and connections"
9662306a36Sopenharmony_ci      - http://www.freedesktop.org/wiki/Software/ModemManager/
97