How to change dtsi to make M41T93 spi rtc work in maaxboard yocto zeus branch?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change dtsi to make M41T93 spi rtc work in maaxboard yocto zeus branch?

1,160 Views
gonewithwind-peter
Senior Contributor I

hi all:

I use maaxboard board (not mini, not nano)

the M41T93 spi rtc works well in kernel 4.14(yocto sumo branch) , I showed here before: 

https://community.nxp.com/t5/i-MX-Processors/how-to-make-spi-interface-rtc-function-work-for-imx8mq-...

but

I need to add M41T93 spi rtc chip in yocto zeus branch(kernel 5.4) https://github.com/Avnet/meta-maaxboard/tree/zeus ,but I find the maaxboard-extended-gpio.dtsi  is different with maaxboard-nano-extended-gpio.dtsi.

the maaxboard-extended-gpio.dtsi file still keeps the gpio for  old settings , I thought the zeus did not support maaxboard now, so I need to modify it similar to  maaxboard-nano-extended-gpio.dtsi.

so I change the ecspi part as the below  patch file( I change kernel config,I can find the /dev/rtc0, I removed snvs_rtc),but unfortunately the spi rtc still not work!

How to change the dtsi in kernel 5.4? I think maaxboard nano work well, I just follow it to modify maaxboard .dtsi file  similiarly . the spi rtc should work.

 

what is the DTB differeces between kernel 4.14 and 5.4 ? 

 

I posted the same question  here too: https://www.element14.com/community/thread/77817/l/how-to-change-dtsiegmaaxboard-extended-gpiodtsi-t...

Thank you very much.

 

 

 

my full patch file:

 

diff -Naur ori/arch/arm64/boot/dts/freescale/imx8mq.dtsi patches/arch/arm64/boot/dts/freescale/imx8mq.dtsi

--- ori/arch/arm64/boot/dts/freescale/imx8mq.dtsi       2021-04-15 12:55:28.039009295 -0400

+++ patches/arch/arm64/boot/dts/freescale/imx8mq.dtsi   2021-04-15 16:33:48.243133485 -0400

@@ -591,15 +591,6 @@

                                compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";

                                reg = <0x30370000 0x10000>;

 

-                               snvs_rtc: snvs-rtc-lp{

-                                       compatible = "fsl,sec-v4.0-mon-rtc-lp";

-                                       regmap =<&snvs>;

-                                       offset = <0x34>;

-                                       interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,

-                                               <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;

-                                       clocks = <&clk IMX8MQ_CLK_SNVS_ROOT>;

-                                       clock-names = "snvs-rtc";

-                               };

 

                                snvs_pwrkey: snvs-powerkey {

                                        compatible = "fsl,sec-v4.0-pwrkey";

@@ -832,7 +823,7 @@

                                clocks = <&clk IMX8MQ_CLK_ECSPI1_ROOT>,

                                         <&clk IMX8MQ_CLK_ECSPI1_ROOT>;

                                clock-names = "ipg", "per";

-                               status = "disabled";

+                               status = "enabled";

                        };

 

                        ecspi2: spi@30830000 {

diff -Naur ori/arch/arm64/boot/dts/freescale/maaxboard-extended-gpio.dtsi patches/arch/arm64/boot/dts/freescale/maaxboard-extended-gpio.dtsi

--- ori/arch/arm64/boot/dts/freescale/maaxboard-extended-gpio.dtsi      2021-04-08 14:58:09.820015901 -0400

+++ patches/arch/arm64/boot/dts/freescale/maaxboard-extended-gpio.dtsi  2021-04-19 13:57:18.993139208 -0400

@@ -37,10 +37,15 @@

 

                pinctrl_ecspi1: ecspi1grp {

                                fsl,pins = <

-                               MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9               0x16

-                               MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI    0x16

-                               MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO    0x16

-                               MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK    0x1816

+                               MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI    0x82

+                               MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO    0x82

+                               MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK    0x82

+                       >;

+               };

+

+               pinctrl_ecspi1_cs: ecspi1cs {

+                       fsl,pins = <

+                               MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9               0x40000

                        >;

                };

 

@@ -90,10 +95,19 @@

 

&ecspi1{

        fsl,spi-num-chipselects = < 1 >;

-       cs-gpios = <&gpio5 13 0 > ;

+       cs-gpios = <&gpio5 9 0 > ;

        pinctrl-names = "default";

-       pinctrl-0 = <&pinctrl_ecspi1 >;

+       pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;

        status = "okay";

+       #address-cells=<1>;

+       #size-cells=<0>;

+       rtc@0x00{

+       #address-cellss=<1>;

+       #size-cells=<1>;

+       compatible = "rtc-m41t93";

+       spi-max-frequency = <5000000>;

+       reg = <0>;

+    };

};

 

&i2c2 {

0 Kudos
3 Replies

967 Views
Tooght
Contributor III


Hi, I am working DTS files on Maaxboard too but I am stuck and trying to figure out how to edit dts files.  Do you have any suggestions for me, Where should I start dts file editing?

Briefly:

I need to write some devices' drivers, which communicate through the gpio pin on maaxboard and use to only 1 gpio pin. So

1. which dts/dtsi file do I need to edit?

2. DO I need to compile after editing? I found some tutorials about that and tried to compile default dts file but I got a syntax error like below. Do you have any sample dts files that can be compiled? I used "/usr/src/kernel/scripts/dtc/dtc" to compile. Is it correct?

 

root@maax:/usr/src/kernel# scripts/dtc/dtc -I dts -O dtb -o /home/root/maaxboard-dcss-lvds.dtb /usr/src/kernel/arch/arm64/boot/dts/freescale/maaxboard-dcss-lvds.dts
Error: /usr/src/kernel/arch/arm64/boot/dts/freescale/maaxboard.dtsi:17.1-9 syntax error
FATAL ERROR: Unable to parse input tree

 


3. Suppose, let's say I compiled a dts file successfully. Do I need to move dtb file anywhere to be valid?

Warm Regards, Cheers!

0 Kudos

960 Views
gonewithwind-peter
Senior Contributor I

Hi ,

as I know, if you want to add a driver for a special device, you need to change the dts files in the kernel source code,you can find the what dtb file to start up in the boot partition on the sd card image. and modify the source code file (.dts). after that you compile the kernel source code, it will generate the modified dtb file. it will be cross compilation or in yocto project. I think the maaxboard software guide has the the guide to how to run cross-compiling the DTB if you not use yocto project(source code is .dts)

I never try to modify the dts after in the image after boot up on the maaxboard itself.

 

0 Kudos

1,141 Views
jamesbone
NXP TechSupport
NXP TechSupport

I understand that you need the Device Tree Source file to make the changes needed, unfortunately that board it is not an NXP board, so I do not know where you can locate those files,  I can share where are the sources from NXP to take that but you would need to setup as your board required

NXP linux source.codeaurora.org repository

linux-imx - i.MX Linux kernel 

 

0 Kudos