mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Teresa Gámez" <t.gamez@phytec.de>
To: barebox@lists.infradead.org
Subject: [For next PATCH 2/3] ARM: am335x: Add register of boot devices
Date: Thu, 30 Oct 2014 13:02:51 +0100	[thread overview]
Message-ID: <1414670572-43351-2-git-send-email-t.gamez@phytec.de> (raw)
In-Reply-To: <1414670572-43351-1-git-send-email-t.gamez@phytec.de>

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

  reply	other threads:[~2014-10-30 12:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 12:02 [For next PATCH 1/3] of: Add of_register_disabled_device functions Teresa Gámez
2014-10-30 12:02 ` Teresa Gámez [this message]
2014-10-30 12:02 ` [For next PATCH 3/3] ARM: am335x: phyCORE-AM335x: Create new dts for MLO Teresa Gámez
2014-11-03  7:43 ` [For next PATCH 1/3] of: Add of_register_disabled_device functions Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414670572-43351-2-git-send-email-t.gamez@phytec.de \
    --to=t.gamez@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox