imx93 uboot setting gpio

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx93 uboot setting gpio

Jump to solution
2,757 Views
charleshuang
Senior Contributor II

Hi NXP,

We are using the imx93 11x11 kernel 6.1.36 for our board.
I need to set the GPIO to HIGH during the bootloader stage.
How can I control the GPIO output from the CPU and set the pin to HIGH in U-Boot?
Below is the relevant configuration I found in board/freescale/imx93_evk/imx93_evk.c.
Q1: How is gpio@22_13 configured?
Q2: ret = dm_gpio_request(&desc, "EXT1_PWREN");
How do I set EXT1_PWREN as a GPIO output from the CPU?

Or have other suggestions.

static void board_gpio_init(void)
{
struct gpio_desc desc;
int ret;

/* Enable EXT1_PWREN for PCIE_3.3V */
ret = dm_gpio_lookup_name("gpio@22_13", &desc);
if (ret)
return;

ret = dm_gpio_request(&desc, "EXT1_PWREN");
if (ret)
return;

dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
dm_gpio_set_value(&desc, 1);

/* Deassert SD3_nRST */
ret = dm_gpio_lookup_name("gpio@22_12", &desc);
if (ret)
return;

ret = dm_gpio_request(&desc, "SD3_nRST");
if (ret)
return;

dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
dm_gpio_set_value(&desc, 1);

if (IS_ENABLED(CONFIG_TARGET_IMX93_14X14_EVK)) {
/* Enable I2C_LS_EN levelshift */
ret = dm_gpio_lookup_name("gpio@20_16", &desc);
if (ret)
return;

ret = dm_gpio_request(&desc, "I2C_LS_EN");
if (ret)
return;

dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
dm_gpio_set_value(&desc, 1);
}
}
Thanks,

0 Kudos
Reply
1 Solution
2,737 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @charleshuang!

Thank you for contacting NXP Support!

 

For the u-boot stage, I recommend declaring the gpio in the u-boot device tree.

 

You can take the device tree of iMX8MP as a reference.

 

https://github.com/nxp-imx/uboot-imx/blob/7376547b9e424b2d0f42dfe96394168c781ca297/arch/arm/dts/imx8... 

 

Best Regards!

Chavira

View solution in original post

0 Kudos
Reply
1 Reply
2,738 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @charleshuang!

Thank you for contacting NXP Support!

 

For the u-boot stage, I recommend declaring the gpio in the u-boot device tree.

 

You can take the device tree of iMX8MP as a reference.

 

https://github.com/nxp-imx/uboot-imx/blob/7376547b9e424b2d0f42dfe96394168c781ca297/arch/arm/dts/imx8... 

 

Best Regards!

Chavira

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1855547%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx93%20uboot%20setting%20gpio%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1855547%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20NXP%2C%3C%2FP%3E%3CP%3EWe%20are%20using%20the%20imx93%2011x11%20kernel%206.1.36%20for%20our%20board.%3CBR%20%2F%3EI%20need%20to%20set%20the%20GPIO%20to%20HIGH%20during%20the%20bootloader%20stage.%3CBR%20%2F%3EHow%20can%20I%20control%20the%20GPIO%20output%20from%20the%20CPU%20and%20set%20the%20pin%20to%20HIGH%20in%20U-Boot%3F%3CBR%20%2F%3EBelow%20is%20the%20relevant%20configuration%20I%20found%20in%20board%2Ffreescale%2Fimx93_evk%2Fimx93_evk.c.%3CBR%20%2F%3EQ1%3A%20How%20is%20gpio%4022_13%20configured%3F%3CBR%20%2F%3EQ2%3A%20ret%20%3D%20dm_gpio_request(%26amp%3Bdesc%2C%20%22EXT1_PWREN%22)%3B%3CBR%20%2F%3EHow%20do%20I%20set%20EXT1_PWREN%20as%20a%20GPIO%20output%20from%20the%20CPU%3F%3CBR%20%2F%3E%3CBR%20%2F%3EOr%20have%20other%20suggestions.%3C%2FP%3E%3CP%3Estatic%20void%20board_gpio_init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Estruct%20gpio_desc%20desc%3B%3CBR%20%2F%3Eint%20ret%3B%3C%2FP%3E%3CP%3E%2F*%20Enable%20EXT1_PWREN%20for%20PCIE_3.3V%20*%2F%3CBR%20%2F%3Eret%20%3D%20dm_gpio_lookup_name(%22gpio%4022_13%22%2C%20%26amp%3Bdesc)%3B%3CBR%20%2F%3Eif%20(ret)%3CBR%20%2F%3Ereturn%3B%3C%2FP%3E%3CP%3Eret%20%3D%20dm_gpio_request(%26amp%3Bdesc%2C%20%22EXT1_PWREN%22)%3B%3CBR%20%2F%3Eif%20(ret)%3CBR%20%2F%3Ereturn%3B%3C%2FP%3E%3CP%3Edm_gpio_set_dir_flags(%26amp%3Bdesc%2C%20GPIOD_IS_OUT)%3B%3CBR%20%2F%3Edm_gpio_set_value(%26amp%3Bdesc%2C%201)%3B%3C%2FP%3E%3CP%3E%2F*%20Deassert%20SD3_nRST%20*%2F%3CBR%20%2F%3Eret%20%3D%20dm_gpio_lookup_name(%22gpio%4022_12%22%2C%20%26amp%3Bdesc)%3B%3CBR%20%2F%3Eif%20(ret)%3CBR%20%2F%3Ereturn%3B%3C%2FP%3E%3CP%3Eret%20%3D%20dm_gpio_request(%26amp%3Bdesc%2C%20%22SD3_nRST%22)%3B%3CBR%20%2F%3Eif%20(ret)%3CBR%20%2F%3Ereturn%3B%3C%2FP%3E%3CP%3Edm_gpio_set_dir_flags(%26amp%3Bdesc%2C%20GPIOD_IS_OUT)%3B%3CBR%20%2F%3Edm_gpio_set_value(%26amp%3Bdesc%2C%201)%3B%3C%2FP%3E%3CP%3Eif%20(IS_ENABLED(CONFIG_TARGET_IMX93_14X14_EVK))%20%7B%3CBR%20%2F%3E%2F*%20Enable%20I2C_LS_EN%20levelshift%20*%2F%3CBR%20%2F%3Eret%20%3D%20dm_gpio_lookup_name(%22gpio%4020_16%22%2C%20%26amp%3Bdesc)%3B%3CBR%20%2F%3Eif%20(ret)%3CBR%20%2F%3Ereturn%3B%3C%2FP%3E%3CP%3Eret%20%3D%20dm_gpio_request(%26amp%3Bdesc%2C%20%22I2C_LS_EN%22)%3B%3CBR%20%2F%3Eif%20(ret)%3CBR%20%2F%3Ereturn%3B%3C%2FP%3E%3CP%3Edm_gpio_set_dir_flags(%26amp%3Bdesc%2C%20GPIOD_IS_OUT)%3B%3CBR%20%2F%3Edm_gpio_set_value(%26amp%3Bdesc%2C%201)%3B%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3EThanks%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1855788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20imx93%20uboot%20setting%20gpio%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1855788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F43469%22%20target%3D%22_blank%22%3E%40charleshuang%3C%2FA%3E!%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EThank%20you%20for%20contacting%20NXP%20Support!%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EFor%20the%20u-boot%20stage%2C%20I%20recommend%20declaring%20the%20gpio%20in%20the%20u-boot%20device%20tree.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EYou%20can%20take%20the%20device%20tree%20of%26nbsp%3BiMX8MP%20as%20a%20reference.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CA%20class%3D%22editor-rtfLink%22%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx%2Fuboot-imx%2Fblob%2F7376547b9e424b2d0f42dfe96394168c781ca297%2Farch%2Farm%2Fdts%2Fimx8mp-evk.dts%23L20%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-imx%2Fuboot-imx%2Fblob%2F7376547b9e424b2d0f42dfe96394168c781ca297%2Farch%2Farm%2Fdts%2Fimx8mp-evk.dts%23L20%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EBest%20Regards!%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EChavira%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E