Modifying device tree to add new peripherals

We are building a custom board using the Imx8mp processor and we are using the imx8mp hummingboard pulse as our eval kit.
We are using yocto kirkstone to build the image for the same.
As an example I’m looking at pinmux of the ecspi2 node in dts file of the imx8mp humming board pulse.

&iomuxc {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_hog>;
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX8MP_IOMUXC_ECSPI2_SCLK__ECSPI2_SCLK 0x82
MX8MP_IOMUXC_ECSPI2_MOSI__ECSPI2_MOSI 0x82
MX8MP_IOMUXC_ECSPI2_MISO__ECSPI2_MISO 0x82>;
};

pinctrl_ecspi2_cs: ecspi2cs {
fsl,pins = <MX8MP_IOMUXC_ECSPI2_SS0__GPIO5_IO13 0x40000>;
};

How did These adresses arrive? 0x82 and 0x40000
Why do all the SCLK, MOSI, MISO have same adresses
Why do the adresses of the above 3 and CS look different?
I have also gone through the file dts/freescale/imx8mp-pinfunc.h for finsing these adresses, but to my surprise these adresses dont even match. Is there something I’m missing here.

Also, say i want to reconfigure one of the SAI pins as a GPIO and add the node in my dts, how can i get the adresses? How can i do it? Or more simply put how can i take any pin say SAI pin, or UART pin, or a simple GPIO pin from the processor, get the address from the pinmux, configure it as either an LED or a pushbutton?

Please provide us an elaborate answer as we are facing trouble regarding the same and we don’t have much support…Thanks in advance!

These are not addresses but the configuration of the PIN. You can download the iMX8MP Hardware Reference from NXP’s website for free, and that has all documentation to reference what setting these bits does for a specific pin mux configuration.

To change a pin, you need to use the GPIO mux definition for that pin. For example MX8MP_IOMUXC_ECSPI2_MISO__ECSPI2_MISO would be MX8MP_IOMUXC_ECSPI2_MISO__GPIO5_IO12 and then you need to configure that pin according to the reference manual, setting bits for pull up / down drive strength, hysteresis, open drain, etc.

Just remember you need to remove the old definition when you create a new pin definition or else there will be a collision in definitions.