i.MX8M Mini Device Tree Syntax

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

i.MX8M Mini Device Tree Syntax

1,942 次查看
oprata
Contributor II

Hello Folks,

I am trying to customize the DT (imx8mm-evk.dts) of imx8mmevk board. I add the block of code below at the imx8mm-evk.dts file.

ledclassRGB {
compatible = "arrow,RGBclassleds";
reg = <0x30240000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_leds>;

red {
label = "red";
};

green {
label = "green";
};

blue {
label = "blue";
linux,default-trigger = "heartbeat";
};
};

After a ran make command to build the kernel with the DT changed I got this message

CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
CHK include/generated/compile.h
DTC arch/arm64/boot/dts/freescale/imx8mm-evk.dtb
arch/arm64/boot/dts/freescale/imx8mm-evk.dts:49.3-22: Warning (reg_format): /ledclassRGB:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
arch/arm64/boot/dts/freescale/imx8mm-evk.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
arch/arm64/boot/dts/freescale/imx8mm-evk.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
arch/arm64/boot/dts/freescale/imx8mm-evk.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'

I think the problem is in the "reg =<0x30240000>". Does anybody know how do I fix it?

According I understand the "reg =" should be like this reg = <[GPIOx_DR Address] [GPIOx_DR value] [GPIOx_GDIR Address] [GPIOx_GDIR value]>. But it doesn't work for my platform_driver class implementation.

Thanks in advance.

 

标签 (1)
0 项奖励
回复
3 回复数

1,908 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

In the device node, reg describes the offset and length of the memory-mapped IO register. The length of the reg attribute address and length of the child node depends on the value of #address-cells and #size-cells corresponding to the parent node.

weidong_sun_0-1613294193201.png

Therefore, you can fill in the value of reg according to its meaning.

 

weidong

0 项奖励
回复

1,938 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

    Are you sure you need the reg member? The use of led is like this: 

leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_led>;

status {
label = "status";
gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;  /* the GPIO you are using*/
default-state = "on";
};
};

 

Have a nice day!

weidong

0 项奖励
回复

1,931 次查看
oprata
Contributor II

Hello Weidong!

I tried to use the "reg" because I intend to build a "device driver" on "/sys/class/leds".

Could you help me with the syntax of  "reg ="?

Thanks in advance.

oprata

0 项奖励
回复