public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3] at91sam9x5ek: Pass serial and revision tags to Linux
@ 2013-05-09 17:07 Julius Hemanth P
  2013-05-10  1:37 ` Bo Shen
  2013-05-10  6:51 ` Andreas Bießmann
  0 siblings, 2 replies; 10+ messages in thread
From: Julius Hemanth P @ 2013-05-09 17:07 UTC (permalink / raw)
  To: u-boot

This code is small snippet from patch
ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2010.06/u-boot-5series_1.0.patch

Linux 2.6.39 (released on www.at91.com/linux4sam) requires serial and
revision ATAGs to detect NAND device.

This patch provides backward compatibility for old Linux 2.6.39 by
passing serial and revision ATAGs to Linux kernel.

Signed-off-by: Julius Hemanth <juliushemanth@gmail.com>
---
Changes for v3:
        - corrected GPBR register access
        - updated commit message

Changes for v2:
        - access GPBR using c structure
        - removed tailing 1 for #define
        - s/Miscelaneous/Miscellaneous
        - s/initialisations/initializations

 board/atmel/at91sam9x5ek/at91sam9x5ek.c | 33 ++++++++++++++++++++++++++++++++-
 include/configs/at91sam9x5ek.h          |  5 +++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 8773e6f..116bd83 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -27,6 +27,7 @@
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
+#include <asm/arch/at91_gpbr.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
 #include <lcd.h>
@@ -48,8 +49,34 @@ DECLARE_GLOBAL_DATA_PTR;

 /* ------------------------------------------------------------------------- */
 /*
- * Miscelaneous platform dependent initialisations
+ * Miscellaneous platform dependent initializations
  */
+
+#ifdef CONFIG_LOAD_ONE_WIRE_INFO
+static u32 system_rev;
+static u32 system_serial_low;
+
+u32 get_board_rev(void)
+{
+       return system_rev;
+}
+
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+       serialnr->high = 0; /* Not used */
+       serialnr->low = system_serial_low;
+}
+
+void load_1wire_info(void)
+{
+       at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR;
+
+       /* serial is in GPBR #2 and revision is in GPBR #3 */
+       system_serial_low = readl(&gpbr->reg[2]);
+       system_rev = readl(&gpbr->reg[3]);
+}
+#endif
+
 #ifdef CONFIG_CMD_NAND
 static void at91sam9x5ek_nand_hw_init(void)
 {
@@ -282,6 +309,10 @@ int board_init(void)
        /* adress of boot parameters */
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;

+#ifdef CONFIG_LOAD_ONE_WIRE_INFO
+       load_1wire_info();
+#endif
+
 #ifdef CONFIG_CMD_NAND
        at91sam9x5ek_nand_hw_init();
 #endif
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index ee6e3fc..995e43b 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -38,6 +38,11 @@
 #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
+
+#define CONFIG_LOAD_ONE_WIRE_INFO
+#define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
+
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_DISPLAY_CPUINFO
--
1.8.2.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v3] at91sam9x5ek:Pass serial and revision tags to Linux
@ 2013-05-09 16:58 Julius Hemanth P
  2013-05-09 17:11 ` Julius Hemanth P
  0 siblings, 1 reply; 10+ messages in thread
From: Julius Hemanth P @ 2013-05-09 16:58 UTC (permalink / raw)
  To: u-boot

This code is small snippet from patch
ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2010.06/u-boot-5series_1.0.patch

Linux 2.6.39 (released on www.at91.com/linux4sam) requires serial and
revision ATAGs to detect NAND device.

This patch provides backward compatibility for old Linux 2.6.39 by
passing serial and revision ATAGs to Linux kernel.

Signed-off-by: Julius Hemanth <juliushemanth@gmail.com>
---
Changes for v3:
        - corrected GPBR register access
        - updated commit message

Changes for v2:
        - access GPBR using c structure
        - removed tailing 1 for #define
        - s/Miscelaneous/Miscellaneous
        - s/initialisations/initializations

board/atmel/at91sam9x5ek/at91sam9x5ek.c | 33 ++++++++++++++++++++++++++++++++-
 include/configs/at91sam9x5ek.h          |  5 +++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 8773e6f..116bd83 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -27,6 +27,7 @@
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
+#include <asm/arch/at91_gpbr.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
 #include <lcd.h>
@@ -48,8 +49,34 @@ DECLARE_GLOBAL_DATA_PTR;

 /* ------------------------------------------------------------------------- */
 /*
- * Miscelaneous platform dependent initialisations
+ * Miscellaneous platform dependent initializations
  */
+
+#ifdef CONFIG_LOAD_ONE_WIRE_INFO
+static u32 system_rev;
+static u32 system_serial_low;
+
+u32 get_board_rev(void)
+{
+       return system_rev;
+}
+
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+       serialnr->high = 0; /* Not used */
+       serialnr->low = system_serial_low;
+}
+
+void load_1wire_info(void)
+{
+       at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR;
+
+       /* serial is in GPBR #2 and revision is in GPBR #3 */
+       system_serial_low = readl(&gpbr->reg[2]);
+       system_rev = readl(&gpbr->reg[3]);
+}
+#endif
+
 #ifdef CONFIG_CMD_NAND
 static void at91sam9x5ek_nand_hw_init(void)
 {
@@ -282,6 +309,10 @@ int board_init(void)
        /* adress of boot parameters */
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;

+#ifdef CONFIG_LOAD_ONE_WIRE_INFO
+       load_1wire_info();
+#endif
+
 #ifdef CONFIG_CMD_NAND
        at91sam9x5ek_nand_hw_init();
 #endif
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index ee6e3fc..995e43b 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -38,6 +38,11 @@
 #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
+
+#define CONFIG_LOAD_ONE_WIRE_INFO
+#define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
+
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_DISPLAY_CPUINFO
--
1.8.2.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-05-13 14:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-09 17:07 [U-Boot] [PATCH v3] at91sam9x5ek: Pass serial and revision tags to Linux Julius Hemanth P
2013-05-10  1:37 ` Bo Shen
2013-05-10  6:51 ` Andreas Bießmann
2013-05-10 11:40   ` Julius Hemanth P
2013-05-10 13:38     ` Andreas Bießmann
2013-05-11  5:01       ` Julius Hemanth P
2013-05-13  2:39         ` Bo Shen
2013-05-13 14:30           ` Julius Hemanth P
  -- strict thread matches above, loose matches on Subject: below --
2013-05-09 16:58 [U-Boot] [PATCH v3] at91sam9x5ek:Pass " Julius Hemanth P
2013-05-09 17:11 ` Julius Hemanth P

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox