xref: /linux/Documentation/networking/device_drivers/wwan/t7xx.rst (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1c9933d49SRicardo Martinez.. SPDX-License-Identifier: GPL-2.0-only
2c9933d49SRicardo Martinez
3c9933d49SRicardo Martinez.. Copyright (C) 2020-21 Intel Corporation
4c9933d49SRicardo Martinez
5c9933d49SRicardo Martinez.. _t7xx_driver_doc:
6c9933d49SRicardo Martinez
7c9933d49SRicardo Martinez============================================
8c9933d49SRicardo Martinezt7xx driver for MTK PCIe based T700 5G modem
9c9933d49SRicardo Martinez============================================
10c9933d49SRicardo MartinezThe t7xx driver is a WWAN PCIe host driver developed for linux or Chrome OS platforms
11c9933d49SRicardo Martinezfor data exchange over PCIe interface between Host platform & MediaTek's T700 5G modem.
12c9933d49SRicardo MartinezThe driver exposes an interface conforming to the MBIM protocol [1]. Any front end
13c9933d49SRicardo Martinezapplication (e.g. Modem Manager) could easily manage the MBIM interface to enable
14c9933d49SRicardo Martinezdata communication towards WWAN. The driver also provides an interface to interact
15c9933d49SRicardo Martinezwith the MediaTek's modem via AT commands.
16c9933d49SRicardo Martinez
17c9933d49SRicardo MartinezBasic usage
18c9933d49SRicardo Martinez===========
19c9933d49SRicardo MartinezMBIM & AT functions are inactive when unmanaged. The t7xx driver provides
20c9933d49SRicardo MartinezWWAN port userspace interfaces representing MBIM & AT control channels and does
21c9933d49SRicardo Martineznot play any role in managing their functionality. It is the job of a userspace
22c9933d49SRicardo Martinezapplication to detect port enumeration and enable MBIM & AT functionalities.
23c9933d49SRicardo Martinez
24c9933d49SRicardo MartinezExamples of few such userspace applications are:
25c9933d49SRicardo Martinez
26c9933d49SRicardo Martinez- mbimcli (included with the libmbim [2] library), and
27c9933d49SRicardo Martinez- Modem Manager [3]
28c9933d49SRicardo Martinez
29c9933d49SRicardo MartinezManagement Applications to carry out below required actions for establishing
30c9933d49SRicardo MartinezMBIM IP session:
31c9933d49SRicardo Martinez
32c9933d49SRicardo Martinez- open the MBIM control channel
33c9933d49SRicardo Martinez- configure network connection settings
34c9933d49SRicardo Martinez- connect to network
35c9933d49SRicardo Martinez- configure IP network interface
36c9933d49SRicardo Martinez
37c9933d49SRicardo MartinezManagement Applications to carry out below required actions for send an AT
38c9933d49SRicardo Martinezcommand and receive response:
39c9933d49SRicardo Martinez
40c9933d49SRicardo Martinez- open the AT control channel using a UART tool or a special user tool
41c9933d49SRicardo Martinez
42409c38d4SJinjian SongSysfs
43409c38d4SJinjian Song=====
44409c38d4SJinjian SongThe driver provides sysfs interfaces to userspace.
45409c38d4SJinjian Song
46409c38d4SJinjian Songt7xx_mode
47409c38d4SJinjian Song---------
48409c38d4SJinjian SongThe sysfs interface provides userspace with access to the device mode, this interface
49409c38d4SJinjian Songsupports read and write operations.
50409c38d4SJinjian Song
51409c38d4SJinjian SongDevice mode:
52409c38d4SJinjian Song
53409c38d4SJinjian Song- ``unknown`` represents that device in unknown status
54409c38d4SJinjian Song- ``ready`` represents that device in ready status
55409c38d4SJinjian Song- ``reset`` represents that device in reset status
56409c38d4SJinjian Song- ``fastboot_switching`` represents that device in fastboot switching status
57409c38d4SJinjian Song- ``fastboot_download`` represents that device in fastboot download status
58409c38d4SJinjian Song- ``fastboot_dump`` represents that device in fastboot dump status
59409c38d4SJinjian Song
60409c38d4SJinjian SongRead from userspace to get the current device mode.
61409c38d4SJinjian Song
62409c38d4SJinjian Song::
63409c38d4SJinjian Song  $ cat /sys/bus/pci/devices/${bdf}/t7xx_mode
64409c38d4SJinjian Song
65409c38d4SJinjian SongWrite from userspace to set the device mode.
66409c38d4SJinjian Song
67409c38d4SJinjian Song::
68409c38d4SJinjian Song  $ echo fastboot_switching > /sys/bus/pci/devices/${bdf}/t7xx_mode
69409c38d4SJinjian Song
70c9933d49SRicardo MartinezManagement application development
71c9933d49SRicardo Martinez==================================
72c9933d49SRicardo MartinezThe driver and userspace interfaces are described below. The MBIM protocol is
73c9933d49SRicardo Martinezdescribed in [1] Mobile Broadband Interface Model v1.0 Errata-1.
74c9933d49SRicardo Martinez
75c9933d49SRicardo MartinezMBIM control channel userspace ABI
76c9933d49SRicardo Martinez----------------------------------
77c9933d49SRicardo Martinez
78c9933d49SRicardo Martinez/dev/wwan0mbim0 character device
79c9933d49SRicardo Martinez~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80c9933d49SRicardo MartinezThe driver exposes an MBIM interface to the MBIM function by implementing
81c9933d49SRicardo MartinezMBIM WWAN Port. The userspace end of the control channel pipe is a
82c9933d49SRicardo Martinez/dev/wwan0mbim0 character device. Application shall use this interface for
83c9933d49SRicardo MartinezMBIM protocol communication.
84c9933d49SRicardo Martinez
85c9933d49SRicardo MartinezFragmentation
86c9933d49SRicardo Martinez~~~~~~~~~~~~~
87c9933d49SRicardo MartinezThe userspace application is responsible for all control message fragmentation
88c9933d49SRicardo Martinezand defragmentation as per MBIM specification.
89c9933d49SRicardo Martinez
90c9933d49SRicardo Martinez/dev/wwan0mbim0 write()
91c9933d49SRicardo Martinez~~~~~~~~~~~~~~~~~~~~~~~
92c9933d49SRicardo MartinezThe MBIM control messages from the management application must not exceed the
93c9933d49SRicardo Martineznegotiated control message size.
94c9933d49SRicardo Martinez
95c9933d49SRicardo Martinez/dev/wwan0mbim0 read()
96c9933d49SRicardo Martinez~~~~~~~~~~~~~~~~~~~~~~
97c9933d49SRicardo MartinezThe management application must accept control messages of up the negotiated
98c9933d49SRicardo Martinezcontrol message size.
99c9933d49SRicardo Martinez
100c9933d49SRicardo MartinezMBIM data channel userspace ABI
101c9933d49SRicardo Martinez-------------------------------
102c9933d49SRicardo Martinez
103c9933d49SRicardo Martinezwwan0-X network device
104c9933d49SRicardo Martinez~~~~~~~~~~~~~~~~~~~~~~
105c9933d49SRicardo MartinezThe t7xx driver exposes IP link interface "wwan0-X" of type "wwan" for IP
106c9933d49SRicardo Martineztraffic. Iproute network utility is used for creating "wwan0-X" network
107c9933d49SRicardo Martinezinterface and for associating it with MBIM IP session.
108c9933d49SRicardo Martinez
109c9933d49SRicardo MartinezThe userspace management application is responsible for creating new IP link
110c9933d49SRicardo Martinezprior to establishing MBIM IP session where the SessionId is greater than 0.
111c9933d49SRicardo Martinez
112c9933d49SRicardo MartinezFor example, creating new IP link for a MBIM IP session with SessionId 1:
113c9933d49SRicardo Martinez
114c9933d49SRicardo Martinez  ip link add dev wwan0-1 parentdev wwan0 type wwan linkid 1
115c9933d49SRicardo Martinez
116c9933d49SRicardo MartinezThe driver will automatically map the "wwan0-1" network device to MBIM IP
117c9933d49SRicardo Martinezsession 1.
118c9933d49SRicardo Martinez
119c9933d49SRicardo MartinezAT port userspace ABI
120c9933d49SRicardo Martinez----------------------------------
121c9933d49SRicardo Martinez
122c9933d49SRicardo Martinez/dev/wwan0at0 character device
123c9933d49SRicardo Martinez~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124c9933d49SRicardo MartinezThe driver exposes an AT port by implementing AT WWAN Port.
125c9933d49SRicardo MartinezThe userspace end of the control port is a /dev/wwan0at0 character
126c9933d49SRicardo Martinezdevice. Application shall use this interface to issue AT commands.
127c9933d49SRicardo Martinez
128*2dac6381SJinjian Songfastboot port userspace ABI
129*2dac6381SJinjian Song---------------------------
130*2dac6381SJinjian Song
131*2dac6381SJinjian Song/dev/wwan0fastboot0 character device
132*2dac6381SJinjian Song~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133*2dac6381SJinjian SongThe driver exposes a fastboot protocol interface by implementing
134*2dac6381SJinjian Songfastboot WWAN Port. The userspace end of the fastboot channel pipe is a
135*2dac6381SJinjian Song/dev/wwan0fastboot0 character device. Application shall use this interface for
136*2dac6381SJinjian Songfastboot protocol communication.
137*2dac6381SJinjian Song
138*2dac6381SJinjian SongPlease note that driver needs to be reloaded to export /dev/wwan0fastboot0
139*2dac6381SJinjian Songport, because device needs a cold reset after enter ``fastboot_switching``
140*2dac6381SJinjian Songmode.
141*2dac6381SJinjian Song
142c9933d49SRicardo MartinezThe MediaTek's T700 modem supports the 3GPP TS 27.007 [4] specification.
143c9933d49SRicardo Martinez
144c9933d49SRicardo MartinezReferences
145c9933d49SRicardo Martinez==========
146c9933d49SRicardo Martinez[1] *MBIM (Mobile Broadband Interface Model) Errata-1*
147c9933d49SRicardo Martinez
148c9933d49SRicardo Martinez- https://www.usb.org/document-library/
149c9933d49SRicardo Martinez
150c9933d49SRicardo Martinez[2] *libmbim "a glib-based library for talking to WWAN modems and devices which
151c9933d49SRicardo Martinezspeak the Mobile Interface Broadband Model (MBIM) protocol"*
152c9933d49SRicardo Martinez
153c9933d49SRicardo Martinez- http://www.freedesktop.org/wiki/Software/libmbim/
154c9933d49SRicardo Martinez
155c9933d49SRicardo Martinez[3] *Modem Manager "a DBus-activated daemon which controls mobile broadband
156c9933d49SRicardo Martinez(2G/3G/4G/5G) devices and connections"*
157c9933d49SRicardo Martinez
158c9933d49SRicardo Martinez- http://www.freedesktop.org/wiki/Software/ModemManager/
159c9933d49SRicardo Martinez
160c9933d49SRicardo Martinez[4] *Specification # 27.007 - 3GPP*
161c9933d49SRicardo Martinez
162c9933d49SRicardo Martinez- https://www.3gpp.org/DynaReport/27007.htm
163*2dac6381SJinjian Song
164*2dac6381SJinjian Song[5] *fastboot "a mechanism for communicating with bootloaders"*
165*2dac6381SJinjian Song
166*2dac6381SJinjian Song- https://android.googlesource.com/platform/system/core/+/refs/heads/main/fastboot/README.md
167