GPIO access problem with R-Car Starter Kit Pro
← Thread:Talk:R-Car/Boards/Yocto-Gen3/GPIO access problem with R-Car Starter Kit Pro
Using R-Car Starterkit Pro, we are now developing a bear metal software which boots directly from ATF. However, we made slight modifications to ATF.
We added the modifications described below when we built the software, where the program will boot in EL2 mode, instead of booting from ATF. Namely, we added modifications to plat/renesas/rcar/platform.mk.
225:# Process RCAR_BL33_EXECUTION_EL flag 226:ifndef RCAR_BL33_EXECUTION_EL 227:RCAR_BL33_EXECUTION_EL := 0 <--- We changed the value "0" to "1" 228:endif 229:$(eval $(call add_define,RCAR_BL33_EXECUTION_EL))
Using the conditions described above, we made codes below.
#define PFC_BASE (0xE6060000U) #define PFC_PMMR (PFC_BASE + 0x0000U) #define PFC_GPSR6 (PFC_BASE + 0x0118U) #define GPIO_INOUTSEL6 (GPIO_BASE + 0x5404U) static inline uint32_t mmio_read_32(uintptr_t addr) { return *(volatile uint32_t*)addr; } static inline void mmio_clrbits_32(uintptr_t addr, uint32_t clear) { mmio_write_32(addr, mmio_read_32(addr) & ~clear); } static inline void mmio_setbits_32(uintptr_t addr, uint32_t set) { mmio_write_32(addr, mmio_read_32(addr) | set); } int main(void) { UINT32_T reg; reg = mmio_read_32(PFC_PMMR); mmio_clrbits_32(PFC_PMMR, (UINT32_T)(1<<11|1<<12|1<<13)); reg = mmio_read_32(PFC_PMMR); reg = mmio_read_32(PFC_GPSR6); mmio_clrbits_32(PFC_GPSR6, (UINT32_T)(1<<11|1<<12|1<<13)); reg = mmio_read_32(PFC_GPSR6); reg = mmio_read_32(PFC_PMMR); reg = mmio_read_32(GPIO_INOUTSEL6); mmio_setbits_32(GPIO_INOUTSEL6, (UINT32_T)(1<<11|1<<12|1<<13)); reg = mmio_read_32(GPIO_INOUTSEL6); return 0; }
This code processes GPIO resister settings. mmio_setbits_32() sets parameter values to GPIO resister. mmio_read_32() reads out GPIO resister values both pre- and post- GPIO resister settings. We got value "0x00013880" readout when we boot from ATF of Yocto ver. 2.12. However, we got value "0x00000000" when we boot from ATF of Yocto ver. 3.9.0. It seems GPIO settings are not properly set when we boot from ATF of Yocto ver. 3.9.0.
We wonder if there are any changes made to accessing methods of GPIO setting resister between Yocto ver. 2.12. and ver. 3.9.0.? Further, how we can properly make GPIO settings in ATF of Yocto ver. 3.9.0.?
Hello,
I noticed that you use old version BSP.
Yocto v3.21.0 is latest BSP.
So, could you update BSP to v3.21.0 from v3.9.0.
It may fix this issue.
Thank you for the reply.
I also tried Yocto v3.21.0.
But I was unable to access GPIO.
Hello,
In generally, we should keep to a correct order of register settings to work correctly.
It is possible to mistake the order, so please try to reverse the order of PFC/GPIO setting.
Sorry, I cannot test it because I don't have verification environment for bare metal application ...
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:R-Car/Boards/Yocto-Gen3/GPIO access problem with R-Car Starter Kit Pro/reply (4).