[PATCHv2 2/3] ARM: am335x: Add register of boot devices

Sascha Hauer s.hauer at pengutronix.de
Mon Nov 3 06:45:28 PST 2014


On Mon, Nov 03, 2014 at 01:31:53PM +0100, Teresa Gámez wrote:
> Add support for registering disabled boot devices from oftree.
> Creating a device tree with all bootable devices disabled, makes
> it possible to only enable and register the devices needed to
> load the next stage bootloader.
> 
> Signed-off-by: Teresa Gámez <t.gamez at phytec.de>

Applied all, thanks

Sascha

> ---
> v2:
> - updated of funcion name
> 
>  arch/arm/mach-omap/am33xx_generic.c              | 31 ++++++++++++++++++++++++
>  arch/arm/mach-omap/include/mach/am33xx-generic.h |  1 +
>  2 files changed, 32 insertions(+)
> 
> diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c
> index f293134..b561575 100644
> --- a/arch/arm/mach-omap/am33xx_generic.c
> +++ b/arch/arm/mach-omap/am33xx_generic.c
> @@ -428,3 +428,34 @@ void am335x_sdram_init(int ioctrl, const struct am33xx_cmd_control *cmd_ctrl,
>  
>  	am33xx_config_sdram(emif_regs);
>  }
> +
> +int am33xx_of_register_bootdevice(void)
> +{
> +	struct device_d *dev;
> +
> +	switch (bootsource_get()) {
> +	case BOOTSOURCE_MMC:
> +		if (bootsource_get_instance() == 0)
> +			dev = of_device_enable_and_register_by_name("mmc at 48060000");
> +		else
> +			dev = of_device_enable_and_register_by_name("mmc at 481d8000");
> +		break;
> +	case BOOTSOURCE_NAND:
> +		dev = of_device_enable_and_register_by_name("gpmc at 50000000");
> +		break;
> +	case BOOTSOURCE_SPI:
> +		dev = of_device_enable_and_register_by_name("spi at 48030000");
> +		break;
> +	default:
> +		/* Use nand fallback */
> +		dev = of_device_enable_and_register_by_name("gpmc at 50000000");
> +		break;
> +	}
> +
> +	if (!dev) {
> +		printf("Unable to register boot device\n");
> +		return -ENODEV;
> +	}
> +
> +	return 0;
> +}
> diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h b/arch/arm/mach-omap/include/mach/am33xx-generic.h
> index 6c85d51..7312061 100644
> --- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
> +++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
> @@ -33,5 +33,6 @@ void __noreturn am33xx_reset_cpu(unsigned long addr);
>  void am33xx_enable_per_clocks(void);
>  int am33xx_init(void);
>  int am33xx_devices_init(void);
> +int am33xx_of_register_bootdevice(void);
>  
>  #endif /* __MACH_AM33XX_GENERIC_H */
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list