Skip to content

Commit d6fa09b

Browse files
committed
gen_gmsl_dts: updated README.md and added new json configs
Updated the README.md file with additional and clearer instructions Added a few new json config files Signed-off-by: Tudor-Cristea_adi <tudor.cristea@analog.com>
1 parent c08a607 commit d6fa09b

File tree

3 files changed

+152
-30
lines changed

3 files changed

+152
-30
lines changed

arch/arm/boot/dts/overlays/gen_gmsl_dts/README.md

Lines changed: 90 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
- [Overview](#overview)
66
- [Prerequisites](#prerequisites)
7-
- [Usage](#usage)
87
- [JSON Configuration Parameters](#json-configuration-parameters)
98
- [Example Configuration](#example-configuration)
10-
- [Generating the DTS Overlay](#generating-the-dts-overlay)
9+
- [Usage](#usage)
1110
- [Applying the Overlay](#applying-the-overlay)
1211
- [Troubleshooting](#troubleshooting)
1312
- [References](#references)
@@ -22,26 +21,6 @@ The `gen_gmsl_dts` tool automates the generation of Device Tree Source (DTS) ove
2221
- Python 3.x installed on the system.
2322
- Access to the `gen_gmsl_dts` directory within the Analog Devices Linux kernel repository.
2423

25-
## Usage
26-
27-
1. **Navigate to the Tool Directory:**
28-
29-
```bash
30-
cd linux/arch/arm/boot/dts/overlays/gen_gmsl_dts
31-
```
32-
33-
2. **Prepare Your JSON Configuration:**
34-
35-
In `gen_gmsl_dts` folder there are examples of pre defined configuration JSON files for a variety of serializers, deserializers and camera sensors. If none of these suit your usecase one can create a new JSON file (e.g., `gmsl_config.json`). Plsease refer to the [JSON Configuration Parameters](#json-configuration-parameters) section for details.
36-
37-
3. **Generate the DTS Overlay:**
38-
39-
```bash
40-
python3 gen_gmsl_dts.py gmsl_config.json --dtbo --o ../gmsl-overlay.dts
41-
```
42-
43-
This command will generate a DTS overlay file named `gmsl-overlay.dts` based on your configuration.
44-
4524
## JSON Configuration Parameters
4625

4726
The JSON configuration file defines the GMSL setup. Below are the primary parameters:
@@ -67,10 +46,11 @@ The JSON configuration file defines the GMSL setup. Below are the primary parame
6746
- `clock_lanes`: `[0]` for normal or `[5]` alternate clocking mode
6847
- `data_lanes`: `[1, 2]` for 2 lanes | `[1, 2, 3, 4]` for 4 lanes
6948
- **`links`**: List of GMSL links. One entry for every connected serializer
70-
- `name`: Specifies the deserializer model. Can be one of:
49+
- `name`: Specifies the serializer model. Can be one of:
7150
- `"max96717"`, `"max9295a"`, `"max96793"`
7251
- `cameras`: Camera connected to the serializer:
73-
- `name`: camera model can be `"imx219"` or `"ov5640"`
52+
- `name`: Specifies the camera model. Can be one of:
53+
- `"imx219"`, `"ov5640"`, `"imx415"`, `"imx708"`, `"isx021"`
7454
- `"pool_addrs"`: is the range of addresses that the ATC and assign to the camera device
7555

7656
## Example Configuration
@@ -136,29 +116,109 @@ The JSON configuration file defines the GMSL setup. Below are the primary parame
136116
]
137117
```
138118

119+
### **Note:** The following commands can be run either on the **host machine** or on the **Raspberry Pi**
120+
121+
## Usage
122+
123+
1. **Navigate to the Tool Directory:**
124+
125+
```bash
126+
cd linux/arch/arm/boot/dts/overlays/gen_gmsl_dts
127+
```
128+
129+
2. **Prepare Your JSON Configuration:**
130+
131+
In `gen_gmsl_dts` folder there are examples of pre defined configuration JSON files for a variety of serializers, deserializers and camera sensors. If none of these suit your usecase one can create a new JSON file (e.g., `gmsl_config.json`). Plsease refer to the [JSON Configuration Parameters](#json-configuration-parameters) section for details.
132+
133+
3. **Generate the DTS Overlay:**
134+
135+
```bash
136+
python3 gen_gmsl_dts.py gmsl_config.json --dtbo --o ../gmsl-overlay.dts
137+
```
138+
139+
This command will generate a DTS overlay file named `gmsl-overlay.dts` based on your configuration.
140+
139141
## Applying the Overlay
140142

141143
1. **Compile the DTS Overlay:**
142144

145+
a) Running on the **host machine**
146+
147+
Run these from the Linux kernel root directory (i.e., `linux/`):
148+
- For Raspberry Pi 4:
149+
```bash
150+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig
151+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs
152+
```
153+
- For Raspberry Pi 5:
154+
```bash
155+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2712_defconfig
156+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs
157+
```
158+
159+
Alternatively, if the overlay does not contain any dependencies (e.g., `#include` directives), then it can also be compiled, in the `linux/arch/arm/boot/dts/overlays/gen_gmsl_dts` folder, by running:
160+
161+
```bash
162+
dtc -@ -I dts -O dtb -o gmsl.dtbo ../gmsl-overlay.dts
163+
```
164+
165+
b) Running on the **Raspberry Pi**
166+
167+
Run these from the Linux kernel root directory (i.e., `linux/`):
168+
- For Raspberry Pi 4:
169+
```bash
170+
make bcm2711_defconfig
171+
make dtbs
172+
```
173+
- For Raspberry Pi 5:
174+
```bash
175+
make bcm2712_defconfig
176+
make dtbs
177+
```
178+
179+
Alternatively, if [`kdtc`](https://github.com/burtyb/raspberrypi-utils/tree/master/kdtc) is installed on the Raspberry Pi and if the overlay does not contain any dependencies (e.g., `#include` directives), then it can also be compiled, in the `linux/arch/arm/boot/dts/overlays/gen_gmsl_dts` folder, by running:
180+
181+
```bash
182+
kdtc ../gmsl-overlay.dts gmsl.dtbo
183+
```
184+
185+
2. **(Optional) Copy the Overlay from the Host to the Target (Raspberry Pi):**
186+
187+
Run this command only if the overlay was NOT compiled on the Raspberry Pi (and assuming that the current folder is `linux/arch/arm/boot/dts/overlays/gen_gmsl_dts`):
188+
143189
```bash
144-
make dtbs
145-
```
190+
scp gmsl.dtbo <target:path/to/gmsl_dtbo_dir>
191+
```
192+
193+
Example of `<target:path/to/gmsl_dtbo_dir>`: `analog@analog-gmsl:/home/analog/`
194+
195+
### **Note:** The following commands can only be run on the Raspberry Pi
196+
197+
3. **Navigate to the Directory Where `gmsl.dtbo` is Located:**
198+
199+
```bash
200+
cd <path/to/gmsl_dtbo_dir>
201+
```
202+
203+
If step 1.a) was followed, then `<path/to/gmsl_dtbo_dir>` should be `/linux/arch/arm/boot/dts/overlays/gen_gmsl_dts`.
204+
205+
Otherwise, `<path/to/gmsl_dtbo_dir>` is the same path as the one used at step 2.
146206

147-
2. **Copy the Overlay to the Boot Directory:**
207+
4. **Copy the Overlay to the Boot Directory:**
148208

149209
```bash
150210
sudo cp gmsl.dtbo /boot/overlays/
151211
```
152212

153-
3. **Edit the Boot Configuration:**
213+
5. **Edit the Boot Configuration:**
154214

155-
Add the overlay to your `/boot/config.txt` file:
215+
Add the overlay to your `/boot/config.txt` file (for example, by using `nano`):
156216

157217
```ini
158218
dtoverlay=gmsl
159219
```
160220

161-
4. **Reboot the System:**
221+
6. **Reboot the System:**
162222

163223
```bash
164224
sudo reboot
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[
2+
{
3+
"name": "max96716a",
4+
"i2c_bus": "i2c_csi_dsi0",
5+
"platform_cfg": {
6+
"name": "rpi-5-b",
7+
"csi_idx": 0,
8+
"phy_idx": 1
9+
},
10+
"phys": [
11+
{
12+
"phy_idx": 1,
13+
"num_lanes": 4,
14+
"link_frequencies": [750000000],
15+
"clock_lanes": [0],
16+
"data_lanes": [1, 2, 3, 4]
17+
}
18+
],
19+
"links": [
20+
{
21+
"name": "max96717",
22+
"cameras": [
23+
{
24+
"name": "ov5640"
25+
}
26+
],
27+
"pool_addrs": ["0x50", "0x51"]
28+
}
29+
]
30+
}
31+
]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[
2+
{
3+
"name": "max96792a",
4+
"i2c_bus": "i2c_csi_dsi0",
5+
"platform_cfg": {
6+
"name": "rpi-5-b",
7+
"csi_idx": 0,
8+
"phy_idx": 1
9+
},
10+
"phys": [
11+
{
12+
"phy_idx": 1,
13+
"num_lanes": 4,
14+
"link_frequencies": [750000000],
15+
"clock_lanes": [0],
16+
"data_lanes": [1, 2, 3, 4]
17+
}
18+
],
19+
"links": [
20+
{
21+
"name": "max96717",
22+
"cameras": [
23+
{
24+
"name": "ov5640"
25+
}
26+
],
27+
"pool_addrs": ["0x50", "0x51"]
28+
}
29+
]
30+
}
31+
]

0 commit comments

Comments
 (0)