example on How to bind GPIO from kernel 4 syntax to kernel 6

Hello everyone, in my kernel 4.4 gpio are described like that :

&am33xx_pinmux {
bone_audio_cape_audio_pins: pinmux_bone_audio_cape_audio_pins {
pinctrl-single,pins = <
AM33XX_IOPAD( 0x990, PIN_INPUT_PULLDOWN | MUX_MODE0) /* A13 mcasp0_aclkx.mcasp0_aclkx /
AM33XX_IOPAD( 0x994, PIN_INPUT_PULLDOWN | MUX_MODE0) /
B13 mcasp0_fsx.mcasp0_fsx, INPUT /
AM33XX_IOPAD( 0x998, PIN_INPUT_PULLDOWN | MUX_MODE0) /
D12 mcasp0_axr0.mcasp0_axr0 /
AM33XX_IOPAD( 0x99c, PIN_INPUT_PULLDOWN | MUX_MODE2) /
C12 mcasp0_ahclkr.mcasp0_axr2 /
AM33XX_IOPAD( 0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE0) /
A14 MCASP0_AHCLKX → MCASP0_AHCLKX (I2S_MCLK_OUT)- in /
>;
};
i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD( 0x98c, PIN_INPUT | MUX_MODE0 ) /
(C16) I2C0_SCL.I2C0_SCL /
AM33XX_IOPAD( 0x988, PIN_INPUT | MUX_MODE0 ) /
(C17) I2C0_SDA.I2C0_SDA */

		AM33XX_IOPAD( 0x880, PIN_INPUT | MUX_MODE7 )	/* Auto protection  GPIO 1_30	(U9)		/sys/class/gpio/gpio62/	OK*/
		AM33XX_IOPAD( 0x83c, PIN_INPUT | MUX_MODE5 ) 	/* RTC debug 		GPIO 1_15 	(U13) 		gpmc_ad15.pr1_ecap0_ecap_capin_apwm_o */
		AM33XX_IOPAD( 0x898, PIN_INPUT | MUX_MODE7 )	/* Accelerometer 	GPIO 2_4 	(U6)		/sys/class/gpio/gpio68/	OK*/
		AM33XX_IOPAD( 0x82c, PIN_INPUT | MUX_MODE7 )	/* ADC interrupt 	GPIO 0_27 	(U12)		/sys/class/gpio/gpio27 OK*/
		
		AM33XX_IOPAD( 0x834, PIN_INPUT | MUX_MODE7 ) 	/* param1 			GPIO 1_13 	(R12)		gpmc_ad13.gpio1[13] */
		AM33XX_IOPAD( 0x824, PIN_INPUT | MUX_MODE7 ) 	/* param2 			GPIO 0_23 	(T10)		gpmc_ad9.gpio0[23] */
		AM33XX_IOPAD( 0x808, PIN_INPUT | MUX_MODE7 )	/* Param3			GPIO 1_2  	(R8)		/sys/class/gpio/gpio34/ OK*/
		AM33XX_IOPAD( 0x820, PIN_INPUT | MUX_MODE7 )	/* Param4			GPIO 0_22 	(U10)		*/
		AM33XX_IOPAD( 0x810, PIN_INPUT | MUX_MODE7 ) 	/* Param5			GPIO1_4	  	(U8) 		gpmc_ad4.gpio1[4] */
		AM33XX_IOPAD( 0x830, PIN_INPUT | MUX_MODE7 )	/* Param6			GPIO 1_12 	(T12)	 	gpmc_ad12.gpio1[12] */
		AM33XX_IOPAD( 0x87c, PIN_INPUT | MUX_MODE7 ) 	/* Param7			GPIO1_29  	(V6) 		gpmc_csn0.gpio1[29] */
		AM33XX_IOPAD( 0x9a0, PIN_INPUT | MUX_MODE7 ) 	/* Param8			GPIO3_18	(B12) 		mcasp0_aclkr.gpio3[18] */

in the am335x-bone-common.dtsi file

i noticed that in kernel 6, there is a new feature talking about gpio in the base am335x-boneblack.dts file like that :

&gpio0 {
gpio-line-names =
“[mdio_data]”,
“[mdio_clk]”,
“P9_22 [spi0_sclk]”,
“P9_21 [spi0_d0]”,
“P9_18 [spi0_d1]”,
“P9_17 [spi0_cs0]”,
“[mmc0_cd]”,
“P9_42A [ecappwm0]”,
“P8_35 [lcd d12]”,
“P8_33 [lcd d13]”,
“P8_31 [lcd d14]”,
“P8_32 [lcd d15]”,
“P9_20 [i2c2_sda]”,
“P9_19 [i2c2_scl]”,
“P9_26 [uart1_rxd]”,
“P9_24 [uart1_txd]”,
“[rmii1_txd3]”,
“[rmii1_txd2]”,
“[usb0_drvvbus]”,
“[hdmi cec]”,
“P9_41B”,
“[rmii1_txd1]”,
“P8_19 [ehrpwm2a]”,
“P8_13 [ehrpwm2b]”,
“NC”,
“NC”,
“P8_14”,
“P8_17”,
“[rmii1_txd0]”,
“[rmii1_refclk]”,
“P9_11 [uart4_rxd]”,
“P9_13 [uart4_txd]”;
};

&gpio1 {
gpio-line-names =
“P8_25 [mmc1_dat0]”,
“[mmc1_dat1]”,
“P8_5 [mmc1_dat2]”,
“P8_6 [mmc1_dat3]”,
“P8_23 [mmc1_dat4]”,

can anyone explain me how should i convert them to make them usable because at the start of the kernel i have a “invalid gpio 56” … etc list of all my gpio, thanks everyone, it doesnt seems to work like that anymore

I can’t find how declare gpio

You’re saying there’s nothing in the kernel docs explaining how to anymore?

Have you done a search through the sources across all .dts files?

I haven’t had a look recently, are they converting all their .dts’s to .yaml already?

No i didn’t say that, but i cant find a source that explains it on the current kernel, how to convert the gpio i declared in dtsi file in I2C2 bus that were working, into the newer kernel where i see a new added feature in am335x-boneblack.dtsi where gpio are declared here but i don’t know what correspond to it.

According to you i should watch other board gpio declaration ? @lranders I heard a method to declare GPIO dynamically directly in the rootfs using command line like this :
cd /sys/class/gpio/
echo 77 > export
cd gpio77
echo out > direction
echo 1 > value
cat value
1

But i dont know whats the easier solution

Have you looked here:
Files · v6.6.x · BeagleBoard.org / BeagleBoard-DeviceTrees · GitLab

Could you explain what is it exactly ? thanks, i’m not very good at embedded systems sorry, i tried to make and install_arm but i have a modified BB with an additionnal cape so i cannot take the generated am335x-boneblack.dtb file, i tried and it did not work @lranders