mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] AT91: usb-a926x: switch to machine description
Date: Thu, 21 Nov 2013 08:13:55 +0100	[thread overview]
Message-ID: <1385018035-26300-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1385018035-26300-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/usb-a926x/init.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c
index fd2603f..48c27cf 100644
--- a/arch/arm/boards/usb-a926x/init.c
+++ b/arch/arm/boards/usb-a926x/init.c
@@ -19,6 +19,7 @@
 #include <init.h>
 #include <environment.h>
 #include <asm/armlinux.h>
+#include <asm/mach/arch.h>
 #include <generated/mach-types.h>
 #include <partition.h>
 #include <fs.h>
@@ -32,6 +33,7 @@
 #include <mach/board.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91sam9_sdramc.h>
+#include <mach/cpu.h>
 #include <gpio.h>
 #include <led.h>
 #include <mach/io.h>
@@ -391,7 +393,7 @@ static void usb_a9260_device_dab_mmx(void)
 static void usb_a9260_device_dab_mmx(void) {}
 #endif
 
-static int usb_a9260_devices_init(void)
+static void usb_a9260_devices_init(void)
 {
 	usb_a9260_add_device_nand();
 	usb_a9260_add_device_mci();
@@ -414,13 +416,10 @@ static int usb_a9260_devices_init(void)
 	dev_add_bb_dev("env_raw", "env0");
 	devfs_add_partition("nand0", SZ_512K, SZ_128K, DEVFS_PARTITION_FIXED, "env_raw1");
 	dev_add_bb_dev("env_raw1", "env1");
-
-	return 0;
 }
-device_initcall(usb_a9260_devices_init);
 
 #ifndef CONFIG_CONSOLE_NONE
-static int usb_a9260_console_init(void)
+static void usb_a9260_console_init(void)
 {
 	struct device_d *dev;
 
@@ -443,15 +442,41 @@ static int usb_a9260_console_init(void)
 		dev = at91_register_uart(4, 0);
 		dev_set_param(dev, "active", "");
 	}
+}
+#endif
+
+static int usb_a9260_machine_detect(void)
+{
+	if (cpu_is_at91sam9g20())
+		arm_set_machine(MACH_TYPE_USB_A9G20);
+	else if (cpu_is_at91sam9263())
+		arm_set_machine(MACH_TYPE_USB_A9263);
+	else
+		arm_set_machine(MACH_TYPE_USB_A9260);
 
 	return 0;
 }
-console_initcall(usb_a9260_console_init);
-#endif
+postcore_initcall(usb_a9260_machine_detect);
 
 static int usb_a9260_main_clock(void)
 {
 	at91_set_main_clock(12000000);
+
 	return 0;
 }
 pure_initcall(usb_a9260_main_clock);
+
+MACHINE_START(USB_A9260, "Calao USB-A9260")
+	.init_console = usb_a9260_console_init,
+	.init_machine = usb_a9260_devices_init,
+MACHINE_END
+
+MACHINE_START(USB_A9263, "Calao USB-A9263")
+	.init_console = usb_a9260_console_init,
+	.init_machine = usb_a9260_devices_init,
+MACHINE_END
+
+MACHINE_START(USB_A9G20, "Calao USB-A9G20")
+	.init_console = usb_a9260_console_init,
+	.init_machine = usb_a9260_devices_init,
+MACHINE_END
-- 
1.8.4.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-11-21  7:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  7:12 [RFC] [PATCH 0/3] ARM: machine struct support Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  7:13 ` [PATCH 1/3] ARM: introduce machine description Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  7:13   ` [PATCH 2/3] at91: detect SoC earlier Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  7:13   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-11-21  8:05   ` [PATCH 1/3] ARM: introduce machine description Alexander Aring
2013-11-22  7:42   ` Sascha Hauer
2013-11-23 15:02     ` Jean-Christophe PLAGNIOL-VILLARD

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=1385018035-26300-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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