Set default state of gpio at boot WP76


I’m wondering what the correct way of setting a gpio’s boot state.

I’m having issues with with a reset pin which needs to be high on boot. I added this to mdm9607-pinctrl.dtsi:

	tlmm_pinmux: pinctrl@1000000 {
		enc28j60_rst_default: enc28j60_rst_default {
			mux {
				pins = "gpio58";
				function = "gpio";
			config {
				pins = "gpio58";
				drive-strength = <16>; /* in mA */

This did not change boot state at all.

Then i read in the AT command reference manual about at+wiocfg command:

bla bla 

<dir> (GPIO direction)
• 0—Input
• 1—Output
<state> (Power-up state for external GPIO configured as an output)
• 0—Output low level
• 1—Output high level

bla bla

So i set the pin config as dir=Output, state=1 which seems to work. Anyone can answer how this all works. Does the WP76XX module override kernel configuration for gpios somehow? And what is the appropriate way of setting the state as this is important to know when going into production.

pin58 = pin8 on the wpXX module, see this for reference : Add ENC28J60 to custom WP7607 board


For the modem GPIOs, the GPIO may either be “owned” by the modem or by linux. If it’s owned by the modem, then I don’t think the device tree settings will have any effect. You need to do at+wiocfg=58,16 to tell the device that you want Linux to have control over the GPIO.


Ok, I will give this a try again. I believe my starting point was that all GPIOs are configured for Linux. And didn’t see expected pin-state after boot.

In the AT command reference there are 3 differents configuration options:
0 - Unallocated
4 - General GPIO
16 - Embedded host

What does the option Unallocated mean?


4 = modem core
16 = linux core
0 = neither has declared ownership