[iMX8QM-MEK]device file registration order

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

[iMX8QM-MEK]device file registration order

405 Views
sushi_happy
Contributor III

Please tell me about device files.

The default device file is below.

mek_8q:/ $ cd dev
mek_8q:/dev $ ls -l

crw------- 1 root root 89, 1 2022-11-08 08:09 i2c-1
crw------- 1 root root 89, 2 2022-11-08 08:09 i2c-2
crw------- 1 root root 89, 3 2022-11-08 08:09 i2c-3
crw------- 1 root root 89, 4 2022-11-08 08:09 i2c-4
crw------- 1 root root 89, 5 2022-11-08 08:09 i2c-5
crw------- 1 root root 89, 6 2022-11-08 08:09 i2c-6
crw------- 1 root root 89, 7 2022-11-08 08:09 i2c-7


I edited the device tree and made i2c4 status="okay".

imx8qm-ss-dma.dtsi

 

 

&dma_subsys {
	i2c4: i2c@5a840000 {
		compatible = "fsl,imx8qm-lpi2c", "fsl,imx7ulp-lpi2c";
		reg = <0x5a840000 0x4000>;
		status = "okay";
	};

 

 

imx8qm-mek.dts

 

 

&iomuxc {
	pinctrl_i2c4: i2c4grp {
		fsl,pins = <
			IMX8QM_ENET1_MDC_DMA_I2C4_SCL 		0x06000021
			IMX8QM_ENET1_MDIO_DMA_I2C4_SDA 		0x06000021
		>;
	};

 

 


Then the device file is:

mek_8q:/ $ cd dev
mek_8q:/dev $ ls -l

crw------- 1 root root 89, 1 2022-10-21 08:55 i2c-1
crw------- 1 root root 89, 2 2022-10-21 08:55 i2c-2
crw------- 1 root root 89, 3 2022-10-21 08:55 i2c-3
crw------- 1 root root 89, 4 2022-10-21 08:55 i2c-4
crw------- 1 root root 89, 5 2022-10-21 08:55 i2c-5
crw------- 1 root root 89, 6 2022-10-21 08:57 i2c-6
crw------- 1 root root 89, 7 2022-10-21 08:57 i2c-7
crw------- 1 root root 89, 8 2022-10-21 08:57 i2c-8

=> Which device is the added node (i2c4)? Is it i2c-8?

 

 

On the other hand, I also set i2c4=&i2c4 in the device tree aliases.

imx8qm.dtsi

 

 

/ {
	aliases {
		i2c0 = &i2c_rpbus_0;
		i2c1 = &i2c_rpbus_1;
		i2c4 = &i2c4;
	};

 

 


Then the device file is:

mek_8q:/ $ cd dev
mek_8q:/dev $ ls -l

crw------- 1 root root 89, 1 2022-10-21 12:26 i2c-1
crw------- 1 root root 89, 4 2022-10-21 12:26 i2c-4
crw------- 1 root root 89, 5 2022-10-21 12:26 i2c-5
crw------- 1 root root 89, 6 2022-10-21 12:26 i2c-6
crw------- 1 root root 89, 7 2022-10-21 12:26 i2c-7
crw------- 1 root root 89, 8 2022-10-21 12:28 i2c-8
crw------- 1 root root 89, 9 2022-10-21 12:28 i2c-9
crw------- 1 root root 89, 10 2022-10-21 12:28 i2c-10

=> Which device is the added node (i2c4)? Is it i2c-4?
     What are your other devices?
     How are these numbered?

0 Kudos
2 Replies

377 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

You can use i2cdetect to detect the base address of these i2c nodes.

0 Kudos

344 Views
sushi_happy
Contributor III

@Zhiming_Liu 

I found the address by using i2cdetect.
thank you.

mek_8q:/ # i2cdetect -l
i2c-10  i2c    58246000.i2c            I2C Adapter
i2c-1    i2c    i2c-rpmsg-adapter    I2C Adapter
i2c-8    i2c    57247000.i2c            I2C Adapter
i2c-6    i2c    5a810000.i2c            I2C Adapter
i2c-4    i2c    5a840000.i2c            I2C Adapter
i2c-9    i2c    58226000.i2c            I2C Adapter
i2c-7    i2c    56247000.i2c            I2C Adapter
i2c-5    i2c    5a800000.i2c            I2C Adapter

 

but I don't know why they are numbered in this order.
Are there any numbering rules?

0 Kudos