164302024SM Chetan Kumar.. SPDX-License-Identifier: GPL-2.0 264302024SM Chetan Kumar 364302024SM Chetan Kumar==================== 464302024SM Chetan Kumariosm devlink support 564302024SM Chetan Kumar==================== 664302024SM Chetan Kumar 764302024SM Chetan KumarThis document describes the devlink features implemented by the ``iosm`` 864302024SM Chetan Kumardevice driver. 964302024SM Chetan Kumar 1064302024SM Chetan KumarParameters 1164302024SM Chetan Kumar========== 1264302024SM Chetan Kumar 1364302024SM Chetan KumarThe ``iosm`` driver implements the following driver-specific parameters. 1464302024SM Chetan Kumar 1564302024SM Chetan Kumar.. list-table:: Driver-specific parameters implemented 1664302024SM Chetan Kumar :widths: 5 5 5 85 1764302024SM Chetan Kumar 1864302024SM Chetan Kumar * - Name 1964302024SM Chetan Kumar - Type 2064302024SM Chetan Kumar - Mode 2164302024SM Chetan Kumar - Description 2264302024SM Chetan Kumar * - ``erase_full_flash`` 2364302024SM Chetan Kumar - u8 2464302024SM Chetan Kumar - runtime 2564302024SM Chetan Kumar - erase_full_flash parameter is used to check if full erase is required for 2664302024SM Chetan Kumar the device during firmware flashing. 2764302024SM Chetan Kumar If set, Full nand erase command will be sent to the device. By default, 2864302024SM Chetan Kumar only conditional erase support is enabled. 2964302024SM Chetan Kumar 3064302024SM Chetan Kumar 3164302024SM Chetan KumarFlash Update 3264302024SM Chetan Kumar============ 3364302024SM Chetan Kumar 3464302024SM Chetan KumarThe ``iosm`` driver implements support for flash update using the 3564302024SM Chetan Kumar``devlink-flash`` interface. 3664302024SM Chetan Kumar 3764302024SM Chetan KumarIt supports updating the device flash using a combined flash image which contains 3864302024SM Chetan Kumarthe Bootloader images and other modem software images. 3964302024SM Chetan Kumar 4064302024SM Chetan KumarThe driver uses DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT to identify type of 4164302024SM Chetan Kumarfirmware image that need to be flashed as requested by user space application. 4264302024SM Chetan KumarSupported firmware image types. 4364302024SM Chetan Kumar 4464302024SM Chetan Kumar.. list-table:: Firmware Image types 4564302024SM Chetan Kumar :widths: 15 85 4664302024SM Chetan Kumar 4764302024SM Chetan Kumar * - Name 4864302024SM Chetan Kumar - Description 4964302024SM Chetan Kumar * - ``PSI RAM`` 5064302024SM Chetan Kumar - Primary Signed Image 5164302024SM Chetan Kumar * - ``EBL`` 5264302024SM Chetan Kumar - External Bootloader 5364302024SM Chetan Kumar * - ``FLS`` 5464302024SM Chetan Kumar - Modem Software Image 5564302024SM Chetan Kumar 5664302024SM Chetan KumarPSI RAM and EBL are the RAM images which are injected to the device when the 5764302024SM Chetan Kumardevice is in BOOT ROM stage. Once this is successful, the actual modem firmware 5864302024SM Chetan Kumarimage is flashed to the device. The modem software image contains multiple files 5964302024SM Chetan Kumareach having one secure bin file and at least one Loadmap/Region file. For flashing 6064302024SM Chetan Kumarthese files, appropriate commands are sent to the modem device along with the 6164302024SM Chetan Kumardata required for flashing. The data like region count and address of each region 6264302024SM Chetan Kumarhas to be passed to the driver using the devlink param command. 6364302024SM Chetan Kumar 6464302024SM Chetan KumarIf the device has to be fully erased before firmware flashing, user application 6564302024SM Chetan Kumarneed to set the erase_full_flash parameter using devlink param command. 6664302024SM Chetan KumarBy default, conditional erase feature is supported. 6764302024SM Chetan Kumar 6864302024SM Chetan KumarFlash Commands: 6964302024SM Chetan Kumar=============== 7064302024SM Chetan Kumar1) When modem is in Boot ROM stage, user can use below command to inject PSI RAM 7164302024SM Chetan Kumarimage using devlink flash command. 7264302024SM Chetan Kumar 73*b8aa1654SM Chetan Kumar$ devlink dev flash pci/0000:02:00.0 file <PSI_RAM_File_name> 7464302024SM Chetan Kumar 7564302024SM Chetan Kumar2) If user want to do a full erase, below command need to be issued to set the 7664302024SM Chetan Kumarerase full flash param (To be set only if full erase required). 7764302024SM Chetan Kumar 7864302024SM Chetan Kumar$ devlink dev param set pci/0000:02:00.0 name erase_full_flash value true cmode runtime 7964302024SM Chetan Kumar 8064302024SM Chetan Kumar3) Inject EBL after the modem is in PSI stage. 81*b8aa1654SM Chetan Kumar 82*b8aa1654SM Chetan Kumar$ devlink dev flash pci/0000:02:00.0 file <EBL_File_name> 8364302024SM Chetan Kumar 8464302024SM Chetan Kumar4) Once EBL is injected successfully, then the actual firmware flashing takes 8564302024SM Chetan Kumarplace. Below is the sequence of commands used for each of the firmware images. 8664302024SM Chetan Kumar 8764302024SM Chetan Kumara) Flash secure bin file. 88*b8aa1654SM Chetan Kumar 89*b8aa1654SM Chetan Kumar$ devlink dev flash pci/0000:02:00.0 file <Secure_bin_file_name> 9064302024SM Chetan Kumar 9164302024SM Chetan Kumarb) Flashing the Loadmap/Region file 9264302024SM Chetan Kumar 93*b8aa1654SM Chetan Kumar$ devlink dev flash pci/0000:02:00.0 file <Load_map_file_name> 9464302024SM Chetan Kumar 9564302024SM Chetan KumarRegions 9664302024SM Chetan Kumar======= 9764302024SM Chetan Kumar 9864302024SM Chetan KumarThe ``iosm`` driver supports dumping the coredump logs. 9964302024SM Chetan Kumar 10064302024SM Chetan KumarIn case a firmware encounters an exception, a snapshot will be taken by the 10164302024SM Chetan Kumardriver. Following regions are accessed for device internal data. 10264302024SM Chetan Kumar 10364302024SM Chetan Kumar.. list-table:: Regions implemented 10464302024SM Chetan Kumar :widths: 15 85 10564302024SM Chetan Kumar 10664302024SM Chetan Kumar * - Name 10764302024SM Chetan Kumar - Description 10864302024SM Chetan Kumar * - ``report.json`` 10964302024SM Chetan Kumar - The summary of exception details logged as part of this region. 11064302024SM Chetan Kumar * - ``coredump.fcd`` 11164302024SM Chetan Kumar - This region contains the details related to the exception occurred in the 11264302024SM Chetan Kumar device (RAM dump). 11364302024SM Chetan Kumar * - ``cdd.log`` 11464302024SM Chetan Kumar - This region contains the logs related to the modem CDD driver. 11564302024SM Chetan Kumar * - ``eeprom.bin`` 11664302024SM Chetan Kumar - This region contains the eeprom logs. 11764302024SM Chetan Kumar * - ``bootcore_trace.bin`` 11864302024SM Chetan Kumar - This region contains the current instance of bootloader logs. 11964302024SM Chetan Kumar * - ``bootcore_prev_trace.bin`` 12064302024SM Chetan Kumar - This region contains the previous instance of bootloader logs. 12164302024SM Chetan Kumar 12264302024SM Chetan Kumar 12364302024SM Chetan KumarRegion commands 12464302024SM Chetan Kumar=============== 12564302024SM Chetan Kumar 12664302024SM Chetan Kumar$ devlink region show 12764302024SM Chetan Kumar 12864302024SM Chetan Kumar$ devlink region new pci/0000:02:00.0/report.json 12964302024SM Chetan Kumar 13064302024SM Chetan Kumar$ devlink region dump pci/0000:02:00.0/report.json snapshot 0 13164302024SM Chetan Kumar 13264302024SM Chetan Kumar$ devlink region del pci/0000:02:00.0/report.json snapshot 0 13364302024SM Chetan Kumar 13464302024SM Chetan Kumar$ devlink region new pci/0000:02:00.0/coredump.fcd 13564302024SM Chetan Kumar 13664302024SM Chetan Kumar$ devlink region dump pci/0000:02:00.0/coredump.fcd snapshot 1 13764302024SM Chetan Kumar 13864302024SM Chetan Kumar$ devlink region del pci/0000:02:00.0/coredump.fcd snapshot 1 13964302024SM Chetan Kumar 14064302024SM Chetan Kumar$ devlink region new pci/0000:02:00.0/cdd.log 14164302024SM Chetan Kumar 14264302024SM Chetan Kumar$ devlink region dump pci/0000:02:00.0/cdd.log snapshot 2 14364302024SM Chetan Kumar 14464302024SM Chetan Kumar$ devlink region del pci/0000:02:00.0/cdd.log snapshot 2 14564302024SM Chetan Kumar 14664302024SM Chetan Kumar$ devlink region new pci/0000:02:00.0/eeprom.bin 14764302024SM Chetan Kumar 14864302024SM Chetan Kumar$ devlink region dump pci/0000:02:00.0/eeprom.bin snapshot 3 14964302024SM Chetan Kumar 15064302024SM Chetan Kumar$ devlink region del pci/0000:02:00.0/eeprom.bin snapshot 3 15164302024SM Chetan Kumar 15264302024SM Chetan Kumar$ devlink region new pci/0000:02:00.0/bootcore_trace.bin 15364302024SM Chetan Kumar 15464302024SM Chetan Kumar$ devlink region dump pci/0000:02:00.0/bootcore_trace.bin snapshot 4 15564302024SM Chetan Kumar 15664302024SM Chetan Kumar$ devlink region del pci/0000:02:00.0/bootcore_trace.bin snapshot 4 15764302024SM Chetan Kumar 15864302024SM Chetan Kumar$ devlink region new pci/0000:02:00.0/bootcore_prev_trace.bin 15964302024SM Chetan Kumar 16064302024SM Chetan Kumar$ devlink region dump pci/0000:02:00.0/bootcore_prev_trace.bin snapshot 5 16164302024SM Chetan Kumar 16264302024SM Chetan Kumar$ devlink region del pci/0000:02:00.0/bootcore_prev_trace.bin snapshot 5 163