generic linux drivers for tegra tx1 peripherals

i need to control the tx1 board peripherals i2c spi uart gpio i2s , is theirs any drivers exist open source or free

Part of your question involves finding the Tegra X1 SoC registers, which should be in the Techincal Reference Manual:

The other part is generally Linux kernel knowledge. All of the drivers and support are already included if you Jetson runs L4T (the Linux for Tegra Ubuntu adapted to Jetsons). The way to manipulate this on command line is through export or unexport of the correct gpio number in “/sys/class/gpio/”. Manipulating this in kernel code is through register values. Setting particular values from the boot loader prior to boot is via the “.dtb” file in “/boot” (this is compilation of a “.dts” source file within the kernel source).

Some details might change depending on which L4T version you use.

could you be more vivid in illustrating the way to manipulate those registers
i am really learning from you alot Linuxdev

I don’t have that all memorized, I tend to go to notes when I need it. The TRM (technical reference manual) tells you about which controller to use (there are several GPIO controllers which are identical, but serve subsets of the total number of GPIO pins available). The addresses in the TRM are the addresses you’d use, and the values are explained there. It’s a long bit of reading, it’s hard to learn all of that overnight.

In your boot configuration you will see file “/boot/extlinux/extlinux.conf”. This file tells the boot loader what to load prior to handing off to the kernel, and what to pass to the kernel. Basically a set of KEY/VALUE pairs. The APPEND arguments get passed to the kernel, the firmware which might change boot time GPIO configuration is just prior to that and is the FDT entry. This names the compiled dtb file. That file is a result of compiling files in the kernel tree with the dtc compiler tool. If you want to reverse compile the existing dtb in order to see what’s being set up now, you can find the FDT entry and reverse compile the file via this (you can sometimes install this tool via package manager, and it is always available in kernel source if you choose to build firmware):

dtc -I dtb -O dts -o /somewhere/for/extracted/version/extracted.dts /boot/the_firmware_in_extlinux.dtb

(see “apt search device-tree-compiler”)

The reverse compiled dts does not have the original comments and naming may not be as useful, but you can use this to find specific dts files in the kernel source if desired. Note that for GPIO entries there tends to be a code block with the format “gpio@6000d000”…this is the address from the TRM. Within this are blocks which assign the GPIO to a specific purpose. Often those individual entries have hexadecimal associated with them…this is the register value from the TRM (reading through chapter 2 on the TRM and then the GPIO chapter is really necessary to figure out the scheme).

Remember, the FDT values are set up prior to handing off to the kernel…these do not need to be changed unless those values are required at boot. Often those values can be set up later. When those values are assigned it implies the drivers understand those entries in a generic way, while the entries themselves are hardware specific. Do remember that if something is using a GPIO there may be other steps to consider before just forcing the GPIO to some new purpose.

Whenever you manipulate GPIO via “/sys”, via the FDT, or in kernel drivers directly, you are basically altering registers in the same way…it’s just the timing of the change or the method of accessing the change which differs. One way to see current settings is "cat “/sys/kernel/debug/tegra_pinctrl_reg”. When you see an abbreviation there with a format like “drive_ph6” the “ph6” refers to the abbreviation you match in the TRM. Other abbreviations provide information about an alternate non-general use for the GPIO.

I’d have to look it up, but the kernel source Documentation subdirectory contains “Documentation/DocBook/device-drivers.tmpl”…I think this can be turned into a PDF file with information on the topic, but you’d have to look at that doc directory for the instructions and perhaps install some DocBook tools.

The site has a lot of useful information as well. Although the Jetson TK1 has some differences to the TX1, the method of dealing with GPIO is the same. Going from one Tegra series SoC to the next you will find that as more of some function is required (like more GPIO pins) that more controllers are added without altering the base controller architecture…much of what you might read about an older Tegra chip applies to the newer ones…some of the controller addresses and values used will even match from chips which are very old versus the JTX1.

thaaaaaaaannnnnnnnnnnnnnnnnnnnnnnnnnnkkkkkkkkkkkkkkssssssssss linuxdev