FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5930 Discussions

Does anyone have board and dts files that contain i2c0-mux entry?

Altera_Forum
Honored Contributor II
1,238 Views

Hi, 

 

I'm currently using a DE10-Standard board. I noticed that if I use the Linux Console image and write it to a microSD card, the card will contain four files. 

 

fpga.dtbo 

socfpga.dtb 

u-boot.scr 

zImage 

 

After I've booted and logged in as root, I see that there is an i2c0-mux under the /sys/class/leds directory. This allows me to use HPS_CONTROL_I2C functionality, which is a way to use the HPS to access the onboard ADV7180 Video chip. I can use the C code found in the hps_i2c_switch to read registers contained in the ADV7180. 

 

Even if I remove the fpga.dtbo from the microSD card, I can still boot Linux completely and I still see i2c0-mux in the /sys/class/leds directory. Somehow, the dts file that was used to generate the socfpga.dtb file contains an entry for the i2c0-mux in the device tree. 

 

I would like to use the i2c0-mux in my own projects but I don't know the device tree syntax that is needed to make it work.  

 

I was wondering if anyone in the forum can point me to board info and dts files that allow me to create a dtb file that contains the i2c0-mux entry. 

 

Even better, instructions on how to create the socfpga.dtb file that is part of the Linux Console image. 

 

I've tried some things out myself but I'm not sure if it is complete. My first go was adding this right below hps0_led in the hps_common_board_info.xml file. 

 

 

<DTAppend name="label" type="string" parentlabel="i2c0mux" val="i2c0-mux"/> 

<DTAppend name="gpios" parentlabel="i2c0mux" > 

<val type="phandle">hps_0_gpio1_porta</val> 

<val type="number">19</val> 

<val type="number">0</val> 

</DTAppend> 

 

 

 

I haven't been able to get it to work because my .rbf file somehow prevents HPS I2C access. 

 

Thanks, 

Raul
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
402 Views

I was able to get a response from Terasic support and wanted to share it with others on this forum. Just as it is possible to generate a dtb file from a dts file, it is also possible to generate a dts file from a dtb file. 

 

The instructions from Terasic support was: 

 

Load the embedded_command_shell.sh environment provided by the SoC EDS tools. This environment provides the device tree compiler command dtc. 

 

As you can see the socfpga.dtb in the SD card, please try to use the command: dtc -I dtb -O dts -o socfpga.dts socfpga.dtb to get the original .dts file.  

 

The online guide: https://rocketboards.org/foswiki/documentation/devicetreegenerator131 shows how to generate the device tree, maybe you can take it as a reference. 

 

The fpga.dtbo file is generated by the fpga.dts file in the Demonstration/SoC_FPGA / DE10_Standard_GHRD. The following command is used to generate the fpga.dtbo in the SoC EDS command shell.  

 

dtc -O dtb -o fpga.dtbo -b 0 -@ fpga.dts  

dtc -I dts -O dtb -o soc_system.dtb soc_system.dts 

 

Now, I'm able to see the details of the i2c0mux entry and will possible edit the hps_common_board_info.xml file to see if I can generate the dts file correctly for my own uses.
0 Kudos
Reply