imx93 uboot setting gpio

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx93 uboot setting gpio

跳至解决方案
4,033 次查看
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 项奖励
回复
1 解答
4,013 次查看
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 项奖励
回复
1 回复
4,014 次查看
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 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-1855547%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx93%20uboot%E8%AE%BE%E7%BD%AEgpio%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%3E%E6%88%91%E4%BB%AC%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%20imx93%2011x11%20%E5%86%85%E6%A0%B8%206.1.36%E4%B8%BA%E6%88%91%E4%BB%AC%E7%9A%84%E8%91%A3%E4%BA%8B%E4%BC%9A%E3%80%82%3CBR%20%2F%3E%E6%88%91%E9%9C%80%E8%A6%81%E5%9C%A8%E5%BC%95%E5%AF%BC%E5%8A%A0%E8%BD%BD%E7%A8%8B%E5%BA%8F%E9%98%B6%E6%AE%B5%E5%B0%86%20GPIO%20%E8%AE%BE%E7%BD%AE%E4%B8%BA%20HIGH%E3%80%82%3CBR%20%2F%3E%E5%A6%82%E4%BD%95%E5%9C%A8%20U-Boot%20%E4%B8%AD%E6%8E%A7%E5%88%B6%20CPU%20%E7%9A%84%20GPIO%20%E8%BE%93%E5%87%BA%E5%B9%B6%E5%B0%86%E5%BC%95%E8%84%9A%E8%AE%BE%E7%BD%AE%E4%B8%BA%20HIGH%EF%BC%9F%3CBR%20%2F%3E%E4%B8%8B%E9%9D%A2%E6%98%AF%E6%88%91%E5%9C%A8board%2Ffreescale%2Fimx93_evk%2Fimx93_evk.c%E4%B8%AD%E6%89%BE%E5%88%B0%E7%9A%84%E7%9B%B8%E5%85%B3%E9%85%8D%E7%BD%AE%E3%80%82%3CBR%20%2F%3E%20Q1%EF%BC%9Agpio%4022_13%E5%A6%82%E4%BD%95%E9%85%8D%E7%BD%AE%EF%BC%9F%3CBR%20%2F%3E%E9%97%AE%E9%A2%982%EF%BC%9Aret%20%3D%20dm_gpio_request(%26amp%3Bdesc%2C%20%22EXT1_PWREN%22)%3B%3CBR%20%2F%3E%E5%A6%82%E4%BD%95%E5%B0%86%20EXT1_PWREN%20%E8%AE%BE%E7%BD%AE%E4%B8%BA%20CPU%20%E7%9A%84%20GPIO%20%E8%BE%93%E5%87%BA%EF%BC%9F%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%88%96%E8%80%85%E6%9C%89%E5%85%B6%E4%BB%96%E5%BB%BA%E8%AE%AE%E3%80%82%3C%2FP%3E%3CP%3E%E9%9D%99%E6%80%81void%20board_gpio_init%EF%BC%88void%EF%BC%89%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%E7%BB%93%E6%9E%84gpio_desc%E6%8F%8F%E8%BF%B0%EF%BC%9B%3CBR%20%2F%3E%20int%20ret%3B%3C%2FP%3E%3CP%3E%2F*%20%E4%B8%BA%20PCIE_3.3V%20%E5%90%AF%E7%94%A8%20EXT1_PWREN%20*%2F%3CBR%20%2F%3E%20ret%20%3D%20dm_gpio_lookup_name(%22gpio%4022_13%22%2C%20%26amp%3Bdesc)%3B%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ret%EF%BC%89%3CBR%20%2F%3E%E8%BF%94%E5%9B%9E%3B%3C%2FP%3E%3CP%3Eret%20%3D%20dm_gpio_request%EF%BC%88%26amp%3Bdesc%EF%BC%8C%E2%80%9CEXT1_PWREN%E2%80%9D%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ret%EF%BC%89%3CBR%20%2F%3E%E8%BF%94%E5%9B%9E%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*%20%E5%8F%96%E6%B6%88%E7%BD%AE%E4%BD%8D%20SD3_nRST%20*%2F%3CBR%20%2F%3E%20ret%20%3D%20dm_gpio_lookup_name(%22gpio%4022_12%22%2C%20%26amp%3Bdesc)%3B%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ret%EF%BC%89%3CBR%20%2F%3E%E8%BF%94%E5%9B%9E%3B%3C%2FP%3E%3CP%3Eret%20%3D%20dm_gpio_request%EF%BC%88%26amp%3Bdesc%EF%BC%8C%E2%80%9CSD3_nRST%E2%80%9D%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ret%EF%BC%89%3CBR%20%2F%3E%E8%BF%94%E5%9B%9E%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%E5%A6%82%E6%9E%9C%EF%BC%88IS_ENABLED%EF%BC%88CONFIG_TARGET_IMX93_14X14_EVK%EF%BC%89%EF%BC%89%7B%3CBR%20%2F%3E%20%2F*%20%E5%90%AF%E7%94%A8%20I2C_LS_EN%20%E7%94%B5%E5%B9%B3%E8%BD%AC%E6%8D%A2%20*%2F%3CBR%20%2F%3E%20ret%20%3D%20dm_gpio_lookup_name(%22gpio%4020_16%22%2C%20%26amp%3Bdesc)%3B%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ret%EF%BC%89%3CBR%20%2F%3E%E8%BF%94%E5%9B%9E%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%EF%BC%88%26amp%3Bdesc%EF%BC%8CGPIOD_IS_OUT%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%20dm_gpio_set_value%EF%BC%88%26amp%3Bdesc%EF%BC%8C1%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%E8%B0%A2%E8%B0%A2%EF%BC%8C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1855788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9Aimx93%20uboot%20%E8%AE%BE%E7%BD%AE%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%3E%E5%97%A8%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%20%EF%BC%81%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%E6%84%9F%E8%B0%A2%E6%82%A8%E8%81%94%E7%B3%BB%20NXP%20%E6%94%AF%E6%8C%81%EF%BC%81%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%3E%E5%AF%B9%E4%BA%8E%20u-boot%20%E9%98%B6%E6%AE%B5%EF%BC%8C%E6%88%91%E5%BB%BA%E8%AE%AE%E5%9C%A8%20u-boot%20%E8%AE%BE%E5%A4%87%E6%A0%91%E4%B8%AD%E5%A3%B0%E6%98%8E%20gpio%E3%80%82%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%3E%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%8F%82%E8%80%83iMX8MP%E7%9A%84%E8%AE%BE%E5%A4%87%E6%A0%91%E3%80%82%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%3E%E6%AD%A4%E8%87%B4%EF%BC%81%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