HI ,
needs to enable GPS using i2c in the kernel.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Do you have any GPS module in mind you want to use? Usually GPS modules are connected through a serial/UART connection, there are several reference solutions that can be found online.
Andreas
Hi Andreas,
but we are using i2c GPS module.
can u please provide reference node how to configure in dts .
Thanks,
Naresh
Hi ,
inittially we connected GPS through UART1
but that is dedicated to firmware .
so we connected to i2c module
actually we observed that peripherals divided into
1.main domain peripherals . 2.mcu domain peripherals 3. wakeup domain peripherals .
main_UART0
main_UART1 - Reserved
main_UART2
main_UART3
main_UART4
main_UART5
main_UART6
mcu_UART0
wkup_UART0 - reserved
here UART1 is reserved so we connected GPS to i2c
but in virtual file system it showing names as : uart0,urat1 ,urat2,urat3,urat4,urat5,urat6.
how did you find which is main domain ,wakeup ,mcu domain peripherlas by seeing nodes in virtual file system.
one method is we can find by disabling all uarts ...enabling each uart peripherals one by one .
is there any alternative methods ?
Naresh,
you can use the device tree (DTS) files to get an idea which uart is assigned to with domain and which /dev/ttySx.
a0797059@ula0797059:~/git/linux/arch/arm64/boot/dts/ti (ti-linux-5.10.y)
$ grep uart k3-am64*.dtsi
k3-am64.dtsi: serial0 = &mcu_uart0;
k3-am64.dtsi: serial1 = &mcu_uart1;
k3-am64.dtsi: serial2 = &main_uart0;
k3-am64.dtsi: serial3 = &main_uart1;
k3-am64.dtsi: serial4 = &main_uart2;
k3-am64.dtsi: serial5 = &main_uart3;
k3-am64.dtsi: serial6 = &main_uart4;
k3-am64.dtsi: serial7 = &main_uart5;
k3-am64.dtsi: serial8 = &main_uart6;
k3-am64-main.dtsi: main_uart0: serial@2800000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-main.dtsi: main_uart1: serial@2810000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-main.dtsi: main_uart2: serial@2820000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-main.dtsi: main_uart3: serial@2830000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-main.dtsi: main_uart4: serial@2840000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-main.dtsi: main_uart5: serial@2850000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-main.dtsi: main_uart6: serial@2860000 {
k3-am64-main.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-mcu.dtsi: mcu_uart0: serial@4a00000 {
k3-am64-mcu.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
k3-am64-mcu.dtsi: mcu_uart1: serial@4a10000 {
k3-am64-mcu.dtsi: compatible = "ti,am64-uart", "ti,am654-uart";
In the device tree alias section (the first part) the rule pretty much is serialX == /dev/ttySX. For example, on our AM64 demo boards, the "main" UART used for U-Boot/Linux is the MAIN_UART0 peripheral module. And it is aliased as serial2, hence it'll become /dev/ttyS2 in Linux. Note that this is the only UART that is enabled in the TI DTS files. If you want to use other UARTs you need to enable them and also assign the pinmux accordingly. It's not too hard to do, if you search the E2E and look at existing DTS files you can model after that.
If you want to parse the sysfw you can do it like below. First, enumerate all active UART modules (only one here). Note how the base address corresponds to the base address of MAIN_UART0 (see TRM). The inside the platform device you can see how it's associated with 'ttyS2' a.k.a. '/dev/ttyS2'.
root@am62xx-evm:/# ls -al /sys/bus/platform/devices/*.serial lrwxrwxrwx 1 root root 0 Jun 6 19:14 /sys/bus/platform/devices/2800000.serial -> ../../../devices/platform/bus@f0000/2800000.serial root@am62xx-evm:/# ls -al /sys/bus/platform/devices/bus@f0000/2800000.serial drwxr-xr-x 4 root root 0 Jun 6 19:14 . drwxr-xr-x 36 root root 0 Jun 6 19:14 .. lrwxrwxrwx 1 root root 0 Jun 6 19:18 driver -> ../../../../bus/platform/drivers/omap8250 -rw-r--r-- 1 root root 4096 Jun 6 19:18 driver_override -r--r--r-- 1 root root 4096 Jun 6 19:18 modalias lrwxrwxrwx 1 root root 0 Jun 6 19:18 of_node -> ../../../../firmware/devicetree/base/bus@f0000/serial@2800000 drwxr-xr-x 2 root root 0 Jun 6 19:18 power lrwxrwxrwx 1 root root 0 Jun 6 19:14 subsystem -> ../../../../bus/platform drwxr-xr-x 3 root root 0 Jun 6 19:14 tty -rw-r--r-- 1 root root 4096 Jun 6 19:14 uevent root@am62xx-evm:/# ls -al /sys/bus/platform/devices/bus@f0000/2800000.serial/tty drwxr-xr-x 3 root root 0 Jun 6 19:14 . drwxr-xr-x 4 root root 0 Jun 6 19:14 .. drwxr-xr-x 3 root root 0 Jun 6 19:14 ttyS2
Regards, Andreas
Hi ,
Thanks for your explanation with the help of virtual system .
actually i am working on our customer board .
we should work on GPS which is connected to i2c
could you please share steps to enable the GPS in kernel [ kernel configuration & device tree node for gps using i2c ].
Its easy for us to enable GPS using uart but here we are going to enable GPS as a i2c device .
help me provide example nodes , in fast anybody enabled i2c GPS deivce ?
Thanks,
Naresh
Hi Nahresh,
the current upstream Kernel only supports serial and USB-based GPS devices, see drivers/gnss/Kconfig in the Kernel source tree.
If you want to use an I2C-based GPS module you could just use a userspace program to access a suitable /dev/i2c-* device node. There's plenty of examples available online on how to do that basic I2C access from userspace. Then you might want to check with the vendor of your GPS module if they have any example code of any kind (ideally Linux of course) that you can use to extract/parse the GPS data without having to write that parser yourself. However all this is really a bit out of the scope what we can provide/support here via the TI E2E which is mostly focused around things specific to our SoCs.
Regards, Andreas