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,029件の閲覧回数
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 返答(返信)

946件の閲覧回数
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 件の賞賛
返信

933件の閲覧回数
tkwon_werfen
Contributor II

Thanks for the comment.

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

0 件の賞賛
返信