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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
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@48060000");
+		else
+			dev = of_device_enable_and_register_by_name("mmc@481d8000");
+		break;
+	case BOOTSOURCE_NAND:
+		dev = of_device_enable_and_register_by_name("gpmc@50000000");
+		break;
+	case BOOTSOURCE_SPI:
+		dev = of_device_enable_and_register_by_name("spi@48030000");
+		break;
+	default:
+		/* Use nand fallback */
+		dev = of_device_enable_and_register_by_name("gpmc@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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux