How to read GPIO status in plugin.S in IMX6D Android 7 u-boot ?

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

How to read GPIO status in plugin.S in IMX6D Android 7 u-boot ?

1,032 次查看
tkwon_werfen
Contributor II

Hello,

I am trying to read the status of a GPIO in plugin.S in u-boot.

I have tried the following, but seemed not reading the correct values.

#define GPIO2_DR_ADDR 0x020A0000
#define GPIO2_DIR_ADDR 0x020A0004
#define GPIO2_DIR_CFG 0x00000000

#define IOMUXC_SW_PAD_CTL_PAD_NAND_DATA02_ADDR 0x020E06EC
#define BOARD_0_PAD_CFG 0x3000
#define IOMUXC_SW_MUX_CTL_PAD_NAND_DATA02_ADDR 0x020E0304
#define BOARD_0_ALT_CFG 0x5

 ldr r0, =IOMUXC_SW_PAD_CTL_PAD_NAND_DATA02_ADDR
 ldr r1, =BOARD_0_PAD_CFG
 str r1, [r0]

 ldr r0, =IOMUXC_SW_MUX_CTL_PAD_NAND_DATA02_ADDR
 ldr r1, =BOARD_0_ALT_CFG
 str r1, [r0]

ldr r0, =GPIO2_DIR_ADDR
ldr r1, =GPIO2_DIR_CFG
str r1, [r0]

ldr r0, =GPIO2_DR_ADDR
ldr r1, [r0]

The bit 3 of r1 is expected to have the status of GPIO 34, but it returns always 0. 

I am wondering what are missing and not correct. Is there need any other resources should be configured ? 

Thanks and Regards,

Taehyuk

 

0 项奖励
回复
2 回复数

949 次查看
jimmychan
NXP TechSupport
NXP TechSupport

You could write the code in mx6sabresd.c to read the status of GPIO.

e.g.

https://github.com/nxp-imx/uboot-imx/blob/imx_v2017.03_4.9.88_2.0.0_ga/board/freescale/mx6sabresd/mx...

0 项奖励
回复

936 次查看
tkwon_werfen
Contributor II

Thanks for the comment.

but the functions in the file is called after plugin.S is executed?

0 项奖励
回复