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.
 * 1) define PFC_BASE		(0xE6060000U)


 * 1) define PFC_PMMR		(PFC_BASE + 0x0000U)
 * 2) define PFC_GPSR6		(PFC_BASE + 0x0118U)
 * 3) 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.?