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
You could write the code in mx6sabresd.c to read the status of GPIO.
e.g.
Thanks for the comment.
but the functions in the file is called after plugin.S is executed?