[PATCH v2 2/6] ARM: at91: xload-mmc: add sama5d3_atmci_start_image() helper

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Apr 23 16:26:21 BST 2021


Hello Oleksij,

On 23.04.21 16:28, Oleksij Rempel wrote:
> +void __noreturn sama5d3_atmci_start_image(u32 boot_src, unsigned int clock,
> +					  unsigned int slot)
> +{
> +	void *buf = (void *)SAMA5_DDRCS;
> +	const struct atmci_instance *instance;
> +	struct pbl_bio bio;
> +	const s8 *pin;
> +	int ret;
> +
> +	ret = sama5_bootsource_instance(boot_src);
> +	if (ret > ARRAY_SIZE(atmci_instances) - 1)
> +		panic("Couldn't determine boot MCI instance\n");
> +
> +	instance = &atmci_instances[boot_src];

What's the difference between slot and instance?
Looks to me like you could drop slot in favor of instance and support
booting from any controller with the same image?

> +
> +	sama5d3_pmc_enable_periph_clock(SAMA5D2_ID_PIOD);
> +	for (pin = instance->pins; *pin >= 0; pin++) {
> +		at91_mux_pio3_pin(IOMEM(SAMA5D3_BASE_PIOD),
> +					 pin_to_mask(*pin), instance->periph, 0);
> +	}
> +
> +	sama5d3_pmc_enable_periph_clock(instance->id);
> +
> +	ret = at91_mci_bio_init(&bio, instance->base, clock, slot);
> +	if (ret)
> +		goto out_panic;
> +
> +	at91_fat_start_image(&bio, buf, SZ_16M, boot_src);
> +
> +out_panic:
> +	panic("FAT chainloading failed\n");
> +}
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list