Skip to main content
Associate II
November 12, 2025
Question

Excluding gpio from Linux

  • November 12, 2025
  • 4 replies
  • 199 views

Hello.

Is there any way to exclude some GPIOs from Linux, when I control them from M4 core and I don't want to give an ability to control them from Linux apps? I would like to exclude e.g. PG12. I tried this, which should be exactly for such use:

&gpiog {
 gpio-reserved-ranges = <12 1>; /* Reserve PG12 for M4 */
};

 
But it doesn't help, still the GPIO is listed and possible to control under Linux.

We use OpenSTLinux custom Yocto build with kernel 5.15.67

Thanks

4 replies

OlivierK
Technical Moderator
November 19, 2025

Hi @Bennny,

 

Have you tried m4_reserved_gpios ?

 

m4_reserved_gpios {

    compatible = "st,m4-reserved-gpios";

    gpio-reserved-ranges = <...>;

};

 

Bear in mind that OpenSTLinux 5.15 is not anymore supported, if possible please point to the latest OSTL release.

 

Regards,

Olivier

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
BennnyAuthor
Associate II
November 19, 2025

Thanks for the reply.
I tried to find any info about the m4-reserved-gpios, but I didn't find any definition of it in docs, source code nor google.
Also the gpio-reserved-ranges = <...>; is in such case counted from GPIOA 0 (so PG12 is 108)?

BennnyAuthor
Associate II
December 3, 2025

Could you please provide the description/documentation of the m4_reserved_gpios and the gpio-reserved-ranges calculation?

BennnyAuthor
Associate II
January 13, 2026

Are these responses AI? Because it's the same thing which ChatGPT gave me before I wrote here on the forum...