iMX8MP: Device Tree Overlay & Pinctrl on NXP Kernel lf-6.12.20-2.0.0

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

iMX8MP: Device Tree Overlay & Pinctrl on NXP Kernel lf-6.12.20-2.0.0

2,298 Views
Svenifax
Contributor III

Hello,

I'm trying to apply a device tree overlay on the NXP kernel version lf-6.12.20-2.0.0 for the i.MX8MP.

To apply the overlay, I’m using a simple kernel module: https://github.com/ikwzm/dtbocfg

The device tree is loaded after Linux kernel is started.

When I try to activate this overlay:

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>

#include "../freescale/imx8mp-pinfunc.h"

/ {

compatible = "fsl,imx8mp";

// IOMUX
fragment@iomuxc {
target = <&iomuxc>;
__overlay__ {

pinctrl_i2c2: pinctrl_i2c2 {
fsl,pins = <
MX8MP_IOMUXC_SD1_DATA6__I2C2_SCL 0x400001c3 // KPAD_BAT_I2C2_SCL: J2.J78
MX8MP_IOMUXC_SD1_DATA7__I2C2_SDA 0x400001c3 // KPAD_BAT_I2C2_SDA: J2.J80
>;
};

};

};


fragment@i2c2 {
target = <&i2c2>;
__overlay__ {

clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";

eeprom_keypad: eeprom@50 {
compatible = "microchip,24c02";
reg = <0x50>;
pagesize = <16>;
vcc-supply = <&reg_vref_3v3>;
};

};
};

};

The following error message is shown:

imx8mp-pinctrl 30330000.pinctrl: invalid group "pinctrl_i2c2" for function "pinctrl"

I checked the phandle references in the base device tree (imx8mp.dtsi) and everything looks correct.
This issue occurs only with pinctrl references; other phandle references work fine.

The device overlay is compiled with the -@ option for dtc.

A similar message occurs on the mainline kernel 6.12.36:

imx8mp-pinctrl 30330000.pinctrl: unable to find group for node pinctrl_i2c2

So it seems that pinmuxing is not possible when provided via a device tree overlay.

Is there a solution for this?

Thanks for your help,
Sven

0 Kudos
Reply
1 Reply

2,226 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi 

The error: imx8mp-pinctrl 30330000.pinctrl: invalid group "pinctrl_i2c2" for function "pinctrl"

 indicates that the overlay is trying to define a new pinctl group "pinctrl_i2c2" that the pinctl driver doesn't recognize.

Maybe you can try to predefine the pinctrl group in the base device tree. 

pinctrl_i2c2: pinctrl_i2c2 {
    fsl,pins = <
        MX8MP_IOMUXC_SD1_DATA6__I2C2_SCL 0x400001c3
        MX8MP_IOMUXC_SD1_DATA7__I2C2_SDA 0x400001c3
    >;
};

 

In your overlay, just reference it:

pinctrl-0 = <&pinctrl_i2c2>;

 

Regards

Daniel

0 Kudos
Reply