[net-next v4 5/5] net: wwan: t7xx: Devlink documentation

From: Jinjian Song
Date: Tue Sep 12 2023 - 05:50:15 EST


From: Jinjian Song <jinjian.song@xxxxxxxxxxx>

Document the t7xx devlink commands usage for firmware flashing &
coredump collection.

Base on the v5 patch version of follow series:
'net: wwan: t7xx: fw flashing & coredump support'
(https://patchwork.kernel.org/project/netdevbpf/patch/f902d4a0cb807a205687f7e693079fba72ca7341.1674307425.git.m.chetan.kumar@xxxxxxxxxxxxxxx/)

Signed-off-by: Jinjian Song <jinjian.song@xxxxxxxxxxx>
---
v4:
* no change
v3:
* supplementary separator '~'
v2:
* no change
---
Documentation/networking/devlink/index.rst | 1 +
Documentation/networking/devlink/t7xx.rst | 232 +++++++++++++++++++++
2 files changed, 233 insertions(+)
create mode 100644 Documentation/networking/devlink/t7xx.rst

diff --git a/Documentation/networking/devlink/index.rst b/Documentation/networking/devlink/index.rst
index b49749e2b9a6..f101781105ca 100644
--- a/Documentation/networking/devlink/index.rst
+++ b/Documentation/networking/devlink/index.rst
@@ -67,3 +67,4 @@ parameters, info versions, and other features it supports.
iosm
octeontx2
sfc
+ mtk_t7xx
diff --git a/Documentation/networking/devlink/t7xx.rst b/Documentation/networking/devlink/t7xx.rst
new file mode 100644
index 000000000000..20057bda3923
--- /dev/null
+++ b/Documentation/networking/devlink/t7xx.rst
@@ -0,0 +1,232 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+====================
+t7xx devlink support
+====================
+
+This document describes the devlink features implemented by the ``t7xx``
+device driver.
+
+Parameters
+==========
+The ``t7xx`` driver implements the following driver-specific parameters.
+
+.. list-table:: Driver-specific parameters
+ :widths: 5 5 5 85
+
+ * - Name
+ - Type
+ - Mode
+ - Description
+ * - ``fastboot``
+ - boolean
+ - driverinit
+ - Set this param to enter fastboot mode.
+
+Flash Update
+============
+
+The ``t7xx`` driver implements the flash update using the ``devlink-flash``
+interface.
+
+The driver uses ``DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK`` to identify the type of
+firmware image that need to be programmed upon the request by user space application.
+
+``t7xx`` driver uses fastboot protocol for firmware flashing. In the firmware
+flashing procedure, fastboot command & response are exchanged between driver
+and wwan device.
+
+::
+
+ $ devlink dev param set pci/0000:bdf name fastboot value 1 cmode driverinit
+
+The devlink param fastboot is set to true via devlink param command, by
+passing name ``fastboot``, value ``1`` and cmode ``driverinit``.
+
+::
+
+ $ devlink dev reload pci/0000:$bdf action driver_reinit
+
+The wwan device is put into fastboot mode via devlink reload command, by
+passing ``driver_reinit`` action.
+
+::
+
+ $ devlink dev reload pci/0000:$bdf action fw_activate
+
+Upon completion of firmware flashing or coredump collection the wwan device is
+reset to normal mode using devlink reload command, by passing ``fw_activate``
+action.
+
+Flash Commands
+--------------
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file preloader_k6880v1_mdot2_datacard.bin component "preloader"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file loader_ext-verified.img component "loader_ext1"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file tee-verified.img component "tee1"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file lk-verified.img component "lk"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file spmfw-verified.img component "spmfw"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file sspm-verified.img component "sspm_1"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file mcupm-verified.img component "mcupm_1"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file dpm-verified.img component "dpm_1"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file boot-verified.img component "boot"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file root.squashfs component "rootfs"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file modem-verified.img component "md1img"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file dsp-verified.bin component "md1dsp"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file OP_OTA.img component "mcf1"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file OEM_OTA.img component "mcf2"
+
+::
+
+ $ devlink dev flash pci/0000:$bdf file DEV_OTA.img component "mcf3"
+
+Note: Component selects the partition type to be programmed.
+
+
+The supported list of firmware image types is described below.
+
+.. list-table:: Firmware Image types
+ :widths: 15 85
+
+ * - Name
+ - Description
+ * - ``preloader``
+ - The first-stage bootloader image
+ * - ``loader_ext1``
+ - Preloader extension image
+ * - ``tee1``
+ - ARM trusted firmware and TEE (Trusted Execution Environment) image
+ * - ``lk``
+ - The second-stage bootloader image
+ * - ``spmfw``
+ - MediaTek in-house ASIC for power management image
+ * - ``sspm_1``
+ - MediaTek in-house ASIC for power management under secure world image
+ * - ``mcupm_1``
+ - MediaTek in-house ASIC for cpu power management image
+ * - ``dpm_1``
+ - MediaTek in-house ASIC for dram power management image
+ * - ``boot``
+ - The kernel and dtb image
+ * - ``rootfs``
+ - Root filesystem image
+ * - ``md1img``
+ - Modem image
+ * - ``md1dsp``
+ - Modem DSP image
+ * - ``mcf1``
+ - Modem OTA image (Modem Configuration Framework) for operators
+ * - ``mcf2``
+ - Modem OTA image (Modem Configuration Framework) for OEM vendors
+ * - ``mcf3``
+ - Modem OTA image (other usage) for OEM configurations
+
+
+Regions
+=======
+
+The ``t7xx`` driver supports core dump collection in exception state and second
+stage bootloader log collection in fastboot mode. The log snapshot is taken by
+the driver using fastboot commands.
+
+Region commands
+---------------
+
+::
+
+ $ devlink region show
+
+This command list the regions implemented by driver. These regions are accessed
+for device internal data. Below table describes the regions.
+
+.. list-table:: Regions
+ :widths: 15 85
+
+ * - Name
+ - Description
+ * - ``mr_dump``
+ - The detailed modem component logs are captured in this region
+ * - ``lk_dump``
+ - This region dumps the current snapshot of lk
+
+Coredump Collection
+~~~~~~~~~~~~~~~~~~~
+
+::
+
+ $ devlink region new mr_dump
+
+::
+
+ $ devlink region read mr_dump snapshot 0 address 0 length $len
+
+::
+
+ $ devlink region del mr_dump snapshot 0
+
+Note: $len is actual len to be dumped.
+
+The userspace application uses these commands for obtaining the modem component
+logs when device encounters an exception.
+
+Second Stage Bootloader dump
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+ $ devlink region new lk_dump
+
+::
+
+ $ devlink region read lk_dump snapshot 0 address 0 length $len
+
+::
+
+ $ devlink region del lk_dump snapshot 0
+
+Note: $len is actual len to be dumped.
+
+In fastboot mode the userspace application uses these commands for obtaining the
+current snapshot of second stage bootloader.
+
--
2.34.1