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,282 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,210 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
%3CLINGO-SUB%20id%3D%22lingo-sub-2160636%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EiMX8MP%3A%20Device%20Tree%20Overlay%20%26amp%3B%20Pinctrl%20on%20NXP%20Kernel%20lf-6.12.20-2.0.0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2160636%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI'm%20trying%20to%20apply%20a%20device%20tree%20overlay%20on%20the%20NXP%20kernel%20version%20lf-6.12.20-2.0.0%20for%20the%20i.MX8MP.%3C%2FP%3E%3CP%3ETo%20apply%20the%20overlay%2C%20I%E2%80%99m%20using%20a%20simple%20kernel%20module%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fikwzm%2Fdtbocfg%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fikwzm%2Fdtbocfg%3C%2FA%3E%3C%2FP%3E%3CP%3EThe%20device%20tree%20is%20loaded%20after%20Linux%20kernel%20is%20started.%3C%2FP%3E%3CP%3EWhen%20I%20try%20to%20activate%20this%20overlay%3A%3C%2FP%3E%3CPRE%3E%2Fdts-v1%2F%3B%3CBR%20%2F%3E%2Fplugin%2F%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%3CDT-BINDINGS%3E%3CBR%20%2F%3E%23include%20%3CDT-BINDINGS%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22..%2Ffreescale%2Fimx8mp-pinfunc.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%2F%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3Ecompatible%20%3D%20%22fsl%2Cimx8mp%22%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%2F%2F%20IOMUX%3CBR%20%2F%3Efragment%40iomuxc%20%7B%3CBR%20%2F%3Etarget%20%3D%20%26lt%3B%26amp%3Biomuxc%26gt%3B%3B%3CBR%20%2F%3E__overlay__%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3Epinctrl_i2c2%3A%20pinctrl_i2c2%20%7B%3CBR%20%2F%3Efsl%2Cpins%20%3D%20%26lt%3B%3CBR%20%2F%3EMX8MP_IOMUXC_SD1_DATA6__I2C2_SCL%200x400001c3%20%2F%2F%20KPAD_BAT_I2C2_SCL%3A%20J2.J78%3CBR%20%2F%3EMX8MP_IOMUXC_SD1_DATA7__I2C2_SDA%200x400001c3%20%2F%2F%20KPAD_BAT_I2C2_SDA%3A%20J2.J80%3CBR%20%2F%3E%26gt%3B%3B%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Efragment%40i2c2%20%7B%3CBR%20%2F%3Etarget%20%3D%20%26lt%3B%26amp%3Bi2c2%26gt%3B%3B%3CBR%20%2F%3E__overlay__%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3Eclock-frequency%20%3D%20%26lt%3B100000%26gt%3B%3B%3CBR%20%2F%3Epinctrl-names%20%3D%20%22default%22%3B%3CBR%20%2F%3Epinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_i2c2%26gt%3B%3B%3CBR%20%2F%3Estatus%20%3D%20%22okay%22%3B%3CBR%20%2F%3E%3CBR%20%2F%3Eeeprom_keypad%3A%20eeprom%4050%20%7B%3CBR%20%2F%3Ecompatible%20%3D%20%22microchip%2C24c02%22%3B%3CBR%20%2F%3Ereg%20%3D%20%26lt%3B0x50%26gt%3B%3B%3CBR%20%2F%3Epagesize%20%3D%20%26lt%3B16%26gt%3B%3B%3CBR%20%2F%3Evcc-supply%20%3D%20%26lt%3B%26amp%3Breg_vref_3v3%26gt%3B%3B%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3B%3C%2FDT-BINDINGS%3E%3C%2FDT-BINDINGS%3E%3C%2FPRE%3E%3CP%3EThe%20following%20error%20message%20is%20shown%3A%3C%2FP%3E%3CPRE%3Eimx8mp-pinctrl%2030330000.pinctrl%3A%20invalid%20group%20%22pinctrl_i2c2%22%20for%20function%20%22pinctrl%22%3C%2FPRE%3E%3CP%3EI%20checked%20the%20phandle%20references%20in%20the%20base%20device%20tree%20(imx8mp.dtsi)%20and%20everything%20looks%20correct.%3CBR%20%2F%3EThis%20issue%20occurs%20only%20with%20pinctrl%20references%3B%20other%20phandle%20references%20work%20fine.%3C%2FP%3E%3CP%3EThe%20device%20overlay%20is%20compiled%20with%20the%20-%40%20option%20for%20dtc.%3C%2FP%3E%3CP%3EA%20similar%20message%20occurs%20on%20the%20mainline%20kernel%206.12.36%3A%3C%2FP%3E%3CPRE%3Eimx8mp-pinctrl%2030330000.pinctrl%3A%20unable%20to%20find%20group%20for%20node%20pinctrl_i2c2%3C%2FPRE%3E%3CP%3ESo%20it%20seems%20that%20pinmuxing%20is%20not%20possible%20when%20provided%20via%20a%20device%20tree%20overlay.%3C%2FP%3E%3CP%3EIs%20there%20a%20solution%20for%20this%3F%3C%2FP%3E%3CP%3EThanks%20for%20your%20help%2C%3CBR%20%2F%3ESven%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2162147%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20iMX8MP%3A%20Device%20Tree%20Overlay%20%26amp%3B%20Pinctrl%20on%20NXP%20Kernel%20lf-6.12.20-2.0.0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2162147%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20error%3A%26nbsp%3B%3CCODE%3Eimx8mp-pinctrl%2030330000.pinctrl%3A%20invalid%20group%20%22pinctrl_i2c2%22%20for%20function%20%22pinctrl%22%3C%2FCODE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3Bindicates%20that%20the%20overlay%20is%20trying%20to%20define%20a%20new%20pinctl%20group%20%22pinctrl_i2c2%22%20that%20the%20pinctl%20driver%20doesn't%20recognize.%3C%2FP%3E%0A%3CP%3EMaybe%20you%20can%20try%20to%20predefine%20the%20pinctrl%20group%20in%20the%20base%20device%20tree.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3C!--ScriptorStartFragment--%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3Epinctrl_i2c2%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%20%3CSPAN%3Epinctrl_i2c2%3C%2FSPAN%3E%20%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3Efsl%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3Epins%3C%2FSPAN%3E%20%3CSPAN%3E%3D%3C%2FSPAN%3E%20%3CSPAN%3E%26lt%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3EMX8MP_IOMUXC_SD1_DATA6__I2C2_SCL%3C%2FSPAN%3E%3CSPAN%3E%200x400001c3%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3EMX8MP_IOMUXC_SD1_DATA7__I2C2_SDA%3C%2FSPAN%3E%3CSPAN%3E%200x400001c3%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3CSPAN%3E%3B%3C!--ScriptorEndFragment--%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CP%3E%3CLI-WRAPPER%3E%3C%2FLI-WRAPPER%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EIn%20your%20overlay%2C%20just%20reference%20it%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3C!--ScriptorStartFragment--%3Epinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_i2c2%26gt%3B%3B%3C!--ScriptorEndFragment--%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3ERegards%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EDaniel%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E