1.. SPDX-License-Identifier: GPL-2.0
2
3====================
4iosm devlink support
5====================
6
7This document describes the devlink features implemented by the ``iosm``
8device driver.
9
10Parameters
11==========
12
13The ``iosm`` driver implements the following driver-specific parameters.
14
15.. list-table:: Driver-specific parameters implemented
16   :widths: 5 5 5 85
17
18   * - Name
19     - Type
20     - Mode
21     - Description
22   * - ``erase_full_flash``
23     - u8
24     - runtime
25     - erase_full_flash parameter is used to check if full erase is required for
26       the device during firmware flashing.
27       If set, Full nand erase command will be sent to the device. By default,
28       only conditional erase support is enabled.
29
30
31Flash Update
32============
33
34The ``iosm`` driver implements support for flash update using the
35``devlink-flash`` interface.
36
37It supports updating the device flash using a combined flash image which contains
38the Bootloader images and other modem software images.
39
40The driver uses DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT to identify type of
41firmware image that need to be flashed as requested by user space application.
42Supported firmware image types.
43
44.. list-table:: Firmware Image types
45    :widths: 15 85
46
47    * - Name
48      - Description
49    * - ``PSI RAM``
50      - Primary Signed Image
51    * - ``EBL``
52      - External Bootloader
53    * - ``FLS``
54      - Modem Software Image
55
56PSI RAM and EBL are the RAM images which are injected to the device when the
57device is in BOOT ROM stage. Once this is successful, the actual modem firmware
58image is flashed to the device. The modem software image contains multiple files
59each having one secure bin file and at least one Loadmap/Region file. For flashing
60these files, appropriate commands are sent to the modem device along with the
61data required for flashing. The data like region count and address of each region
62has to be passed to the driver using the devlink param command.
63
64If the device has to be fully erased before firmware flashing, user application
65need to set the erase_full_flash parameter using devlink param command.
66By default, conditional erase feature is supported.
67
68Flash Commands:
69===============
701) When modem is in Boot ROM stage, user can use below command to inject PSI RAM
71image using devlink flash command.
72
73$ devlink dev flash pci/0000:02:00.0 file <PSI_RAM_File_name>
74
752) If user want to do a full erase, below command need to be issued to set the
76erase full flash param (To be set only if full erase required).
77
78$ devlink dev param set pci/0000:02:00.0 name erase_full_flash value true cmode runtime
79
803) Inject EBL after the modem is in PSI stage.
81
82$ devlink dev flash pci/0000:02:00.0 file <EBL_File_name>
83
844) Once EBL is injected successfully, then the actual firmware flashing takes
85place. Below is the sequence of commands used for each of the firmware images.
86
87a) Flash secure bin file.
88
89$ devlink dev flash pci/0000:02:00.0 file <Secure_bin_file_name>
90
91b) Flashing the Loadmap/Region file
92
93$ devlink dev flash pci/0000:02:00.0 file <Load_map_file_name>
94
95Regions
96=======
97
98The ``iosm`` driver supports dumping the coredump logs.
99
100In case a firmware encounters an exception, a snapshot will be taken by the
101driver. Following regions are accessed for device internal data.
102
103.. list-table:: Regions implemented
104    :widths: 15 85
105
106    * - Name
107      - Description
108    * - ``report.json``
109      - The summary of exception details logged as part of this region.
110    * - ``coredump.fcd``
111      - This region contains the details related to the exception occurred in the
112        device (RAM dump).
113    * - ``cdd.log``
114      - This region contains the logs related to the modem CDD driver.
115    * - ``eeprom.bin``
116      - This region contains the eeprom logs.
117    * - ``bootcore_trace.bin``
118      -  This region contains the current instance of bootloader logs.
119    * - ``bootcore_prev_trace.bin``
120      - This region contains the previous instance of bootloader logs.
121
122
123Region commands
124===============
125
126$ devlink region show
127
128$ devlink region new pci/0000:02:00.0/report.json
129
130$ devlink region dump pci/0000:02:00.0/report.json snapshot 0
131
132$ devlink region del pci/0000:02:00.0/report.json snapshot 0
133
134$ devlink region new pci/0000:02:00.0/coredump.fcd
135
136$ devlink region dump pci/0000:02:00.0/coredump.fcd snapshot 1
137
138$ devlink region del pci/0000:02:00.0/coredump.fcd snapshot 1
139
140$ devlink region new pci/0000:02:00.0/cdd.log
141
142$ devlink region dump pci/0000:02:00.0/cdd.log snapshot 2
143
144$ devlink region del pci/0000:02:00.0/cdd.log snapshot 2
145
146$ devlink region new pci/0000:02:00.0/eeprom.bin
147
148$ devlink region dump pci/0000:02:00.0/eeprom.bin snapshot 3
149
150$ devlink region del pci/0000:02:00.0/eeprom.bin snapshot 3
151
152$ devlink region new pci/0000:02:00.0/bootcore_trace.bin
153
154$ devlink region dump pci/0000:02:00.0/bootcore_trace.bin snapshot 4
155
156$ devlink region del pci/0000:02:00.0/bootcore_trace.bin snapshot 4
157
158$ devlink region new pci/0000:02:00.0/bootcore_prev_trace.bin
159
160$ devlink region dump pci/0000:02:00.0/bootcore_prev_trace.bin snapshot 5
161
162$ devlink region del pci/0000:02:00.0/bootcore_prev_trace.bin snapshot 5
163