drivers/st/ddr/stm32mp1_ram.c
/*******************************************************************************
 * This function checks the DDR size. It has to be run with Data Cache off.
 * This test is run before data have been put in DDR, and is only done for
 * cold boot. The DDR data can then be overwritten, and it is not useful to
 * restore its content.
 * Returns DDR computed size.
 ******************************************************************************/
This function checks the DDR size. It has to be run with Data Cache off.
This test is run before data have been put in DDR, and is only done for
cold boot. The DDR data can then be overwritten, and it is not useful to
restore its content.
Returns DDR computed size.
This function checks the DDR size . It has to be run with Data Cache off . This test is run before data have been put in DDR and is only done for cold boot . The DDR data can then be overwritten and it is not useful to restore its content . Returns DDR computed size .
static uint32_t ddr_check_size(void)
{
	uint32_t offset = sizeof(uint32_t);
	mmio_write_32(STM32MP1_DDR_BASE, DDR_PATTERN);
	while (offset < STM32MP1_DDR_MAX_SIZE) {
		mmio_write_32(STM32MP1_DDR_BASE + offset, DDR_ANTIPATTERN);
		dsb();
		if (mmio_read_32(STM32MP1_DDR_BASE) != DDR_PATTERN) {
			break;
		}
		offset <<= 1;
	}
	INFO("Memory size = 0x%x (%d MB)\n", offset, offset / (1024U * 1024U));
	return offset;
}
static uint32_t ddr_check_size ( void ) { uint32_t offset = sizeof ( uint32_t ) ; mmio_write_32 ( STM32MP1_DDR_BASE , DDR_PATTERN ) ; while ( offset < STM32MP1_DDR_MAX_SIZE ) { mmio_write_32 ( STM32MP1_DDR_BASE + offset , DDR_ANTIPATTERN ) ; dsb ( ) ; if ( mmio_read_32 ( STM32MP1_DDR_BASE ) != DDR_PATTERN ) { break ; } offset <<= 1 ; } INFO ( " \n " , offset , offset / ( 1024U * 1024U ) ) ; return offset ; }
This function checks the DDR size.
This function checks the DDR size .