at91sam9x5ek: Pass serial and revision tags to Linux
PATCH v2 1/1 at91sam9x5ek: Pass serial and revision tags to Linux
This code is small snippet from patch ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2010.06/u-boot-5series_1.0.patch
Bug:-
For board at91sam9x5ek, U-boot doesn't pass serial and revision tags
to Linux kernel, hence kernel fails to identify correct revision and assumes as rev-A, resulting in failing to detect NAND device.
This patch enables u-boot to pass serial and revision tags to Linux kernel, which helps Linux to detect NAND device.
---
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 deletions(-)
(quoted diff) +0 -0
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 8773e6f..c05bdb7 100644
board/atmel/at91sam9x5ek/at91sam9x5ek.c +32 -1
@@ -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
include/configs/at91sam9x5ek.h +5 -0
@@ -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.7.0.4
PATCH v2 1/1 at91sam9x5ek: Pass serial and revision tags to Linux
Hi Julius,
Quoted 4 lines · Julius Hemanth P
This code is small snippet from patch ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2010.06/u-boot-5series_1.0.patch
Bug:-
I think this should not report bug, it should for compatible with old kernel (only for Linux 2.6.39 released on www.at91.com/linux4sam).
Quoted 15 lines
For board at91sam9x5ek, U-boot doesn't pass serial and revision tags
to Linux kernel, hence kernel fails to identify correct revision and assumes as rev-A, resulting in failing to detect NAND device.This patch enables u-boot to pass serial and revision tags to Linux kernel, which helps Linux to detect NAND device.
Signed-off-by Julius Hemanth <[email protected]>---
Changes for v2:
- access GPBR using c structure
- removed tailing 1 for #define
- s/Miscelaneous/Miscellaneous
- s/initialisations/initializations
Quoted 3 lines
board/atmel/at91sam9x5ek/at91sam9x5ek.c | 33 ++++++++++++++++++++++++++++++- include/configs/at91sam9x5ek.h | 5 ++++ 2 files changed, 37 insertions(+), 1 deletions(-)
This patch can not be applied based on u-boot master branch or else on u-boot-atmel master branch.
Please re-generate this patch based on u-boot master branch or u-boot-atmel master branch.
Quoted 34 lines
board/atmel/at91sam9x5ek/at91sam9x5ek.c +16
-1@@ -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;
board/atmel/at91sam9x5ek/at91sam9x5ek.c DECLARE_GLOBAL_DATA_PTR; · line 77
Quoted 10 lines
board/atmel/at91sam9x5ek/at91sam9x5ek.c +10
-0+} + +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 ]); +}
This is wrong which will cause u-boot hang up. It should be:
system_serial_low = readl(&gpbr->reg[2]);system_rev = readl(&gpbr->reg[3]);
Best Regards,
Bo Shen
PATCH v2 1/1 at91sam9x5ek: Pass serial and revision tags to Linux
Thanks Bo, will send updated patch with all corrections.
Regards,
Julius Hemanth P
Quoted 97 lines · Bo Shen
Hi Julius,
Quoted 6 lines · Julius Hemanth P
This code is small snippet from patch ftp://ftp.linux4sam.org/pub/**uboot/u-boot-v2010.06/u-boot-** 5series_1.0.patch<ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2010.06/u-boot-5series_1.0.patch>
Bug:-
I think this should not report bug, it should for compatible with old kernel (only for Linux 2.6.39 released on www.at91.com/linux4sam).
For board at91sam9x5ek, U-boot doesn't pass serial and revision tags
Quoted 15 lines
to Linux kernel, hence kernel fails to identify correct revision and assumes
as rev-A, resulting in failing to detect NAND device.This patch enables u-boot to pass serial and revision tags to Linux kernel, which helps Linux to detect NAND device.
Signed-off-by Julius Hemanth <[email protected]>---
Changes for v2:
- access GPBR using c structure
- removed tailing 1 for #define
- s/Miscelaneous/Miscellaneous
- s/initialisations/**initializationsQuoted 5 lines
board/atmel/at91sam9x5ek/**at91sam9x5ek.c | 33 ++++++++++++++++++++++++++++++**- include/configs/at91sam9x5ek.h | 5 ++++ 2 files changed, 37 insertions(+), 1 deletions(-)This patch can not be applied based on u-boot master branch or else on u-boot-atmel master branch.
Please re-generate this patch based on u-boot master branch or u-boot-atmel master branch.
diff --git
a/board/atmel/at91sam9x5ek/**at91sam9x5ek.cQuoted 35 lines
b/board/atmel/at91sam9x5ek/**at91sam9x5ek.c
index 8773e6f..c05bdb7 100644board/atmel/at91sam9x5ek/**at91sam9x5ek.c +17
-1@@ -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; +}board/atmel/at91sam9x5ek/**at91sam9x5ek.c DECLARE_GLOBAL_DATA_PTR; · line 79
Quoted 10 lines
board/atmel/at91sam9x5ek/**at91sam9x5ek.c +9
-0+ +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 ]); +}This is wrong which will cause u-boot hang up. It should be:
system_serial_low=readl(&gpbr->reg[2]);system_rev=readl(&gpbr->reg[3]);Best Regards,
Bo Shen