GPIO access problem with R-Car Starter Kit Pro

Jump to: navigation, search
Revision as of 3 April 2020 at 07:13.
The highlighted comment was created in this revision.

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/

225:# Process RCAR_BL33_EXECUTION_EL flag
227:RCAR_BL33_EXECUTION_EL := 0      <--- We changed the value "0" to "1"
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.?

    00:53, 2 April 2020


    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.

      00:13, 3 April 2020