Re: [U-Boot] [PATCH v3] at91sam9x5ek: Pass serial and revision tags to Linux

2013-05-13 Thread Julius Hemanth P
Hi Bo,

Thanks for the reference.

On Mon, May 13, 2013 at 8:09 AM, Bo Shen  wrote:
> Hi Julius,
>
>
> On 5/11/2013 13:01, Julius Hemanth P wrote:
>>
>> If Bo doesn't have any code in pipeline as of now, then I shall start
>> working on it.
>
>
> Now, I don't have code in pipeline, you can work this on it.
> Thanks.
>
> BTW, you can take the reference code on github:
> https://github.com/linux4sam/at91bootstrap/blob/master/driver/ds24xx.c. This
> also have Atmel new SoC sama5d3 series support.
>
> Best Regards,
> Bo Shen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] at91sam9x5ek: Pass serial and revision tags to Linux

2013-05-10 Thread Julius Hemanth P
Thanks Andreas.
In this case, I too think its better to drop this particular patch and
right a new one to support reading 1 wire Id chip.

If Bo doesn't have any code in pipeline as of now, then I shall start
working on it.

Regards,
Julius Hemanth P.
On May 10, 2013 7:07 PM, "Andreas Bießmann" 
wrote:

> Hi Julius,
>
> On 05/10/2013 01:40 PM, Julius Hemanth P wrote:
> > Hi Andreas,
> >
> > On Fri, May 10, 2013 at 12:21 PM, Andreas Bießmann
> >  wrote:
> >> Dear Julius Hemanth P,
>
> >> On 09.05.13 19:07, Julius Hemanth P wrote:
>
> 
>
> >>> 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 
> >>>  #include 
> >>>  #include 
> >>> +#include 
> >>>  #include 
> >>>  #include 
> >>>  #include 
> >>> @@ -48,8 +49,34 @@ DECLARE_GLOBAL_DATA_PTR;
> >>>
> >>>  /*
> - */
> >>>  /*
> >>> - * Miscelaneous platform dependent initialisations
> >>> + * Miscellaneous platform dependent initializations
> >>>   */
> >>> +
> >>> +#ifdef CONFIG_LOAD_ONE_WIRE_INFO
> >>
> >> What the hell has this one wire thing to do with reading internal
> GPBR's?
> >> This is a new config parameter (which lacks documentation in this patch)
> >> is not required at all cause it is enabled in any case, or do I miss
> >> something?
> > AT91Bootstrap reads board revision and serial info from 1 wire chip
> > and writes it to GPBR registers. U-boot, in board_init(), reads that
> > info from GPBR and places it in global variables in order to pass it
> > to Linux. At the time of boot_prep_linux(), these info will be read
> > from global variables and passed to linux kernel as ATAGs.
>
> there are a lot of outdated stuff involved ;)
>  * ATAGs will be replaced by FDT
>  * AT91bootstrap should be replaced with u-boot SPL
>
> > The board at91sam9x5ek I came across has this 1 wire chip connected,
> > But I am really not sure if this is true with all at91sam9x5ek boards,
> > hence I made a config parameter so that others can just enable or
> > disable reading rev and serial info from 1 wire chip(in this case from
> > GPBR registers).
>
> We have a single definition for all at91sam9x5ek variants. If there are
> some which do not provide such an 1wire id chip we need to address this
> here (or in at91bootstrap). I think we shouldn't force the user to
> change the board config header to enable different variants. We could
> introduce a new 'board name' (in boards.cfg) to address this, but as
> long as we do not know that we break other boards which do _not_ have
> such an 1wire id chip I think it is ok to not introduce a new config.
>
> If we decide to introduce the config parameter we should document it
> somewhere.
>
> >>> +static u32 system_rev;
> >>> +static u32 system_serial_low;
> >>
> >> Can we please omit these global variables? We could just read the GPBR's
> >> in respective get-functions. This will reduce the .bss and .text size
> >> and is therefore reasonable.
> > May be yes, if we have some place to preserve these info for
> > processing at later stage, As of now I am really not aware of any such
> > struct. If you have any suggestion of one such place, please suggest
> > me so that I can omit these global variables. I too dislike the idea
> > of using global variables.
>
> Well, my first idea was to define these places in GPBR to be
> 'system_rev' and 'system_serial_low', but the provided location does not
> fit current definition of GPBR ...
>
> >>> +
> >>> +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

Re: [U-Boot] [PATCH v3] at91sam9x5ek: Pass serial and revision tags to Linux

2013-05-10 Thread Julius Hemanth P
Hi Andreas,

On Fri, May 10, 2013 at 12:21 PM, Andreas Bießmann
 wrote:
> Dear Julius Hemanth P,
>
> first of all, please address Bo's comment about checkpatch:
I am sorry, Its my fault, will address them in next patch.

>
> ---8<---
> andreas@andreas-mbp % ./tools/checkpatch.pl ~/Downloads/\[PATCH\ v3\]\
> at91sam9x5ek_\ Pass\ serial\ and\ revision\ tags\ to\ Linux.eml
> ERROR: DOS line endings
> #70: FILE: board/atmel/at91sam9x5ek/at91sam9x5ek.c:30:
> +#include ^M$
>
> ERROR: patch seems to be corrupt (line wrapped?)
> #75: FILE: board/atmel/at91sam9x5ek/at91sam9x5ek.c:48:
>
> 
>
> total: 38 errors, 7 warnings, 1 checks, 66 lines checked
>
> NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
>   scripts/cleanfile
>
> NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> MULTISTATEMENT_MACRO_USE_DO_WHILE USLEEP_RANGE
>
> /Users/andreas/Downloads/[PATCH v3] at91sam9x5ek_ Pass serial and
> revision tags to Linux.eml has style problems, please review.
>
> If any of these errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
> --->8---
>
> On 09.05.13 19:07, Julius Hemanth P wrote:
>> 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 
>> ---
>> 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 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -48,8 +49,34 @@ DECLARE_GLOBAL_DATA_PTR;
>>
>>  /* 
>> - */
>>  /*
>> - * Miscelaneous platform dependent initialisations
>> + * Miscellaneous platform dependent initializations
>>   */
>> +
>> +#ifdef CONFIG_LOAD_ONE_WIRE_INFO
>
> What the hell has this one wire thing to do with reading internal GPBR's?
> This is a new config parameter (which lacks documentation in this patch)
> is not required at all cause it is enabled in any case, or do I miss
> something?
AT91Bootstrap reads board revision and serial info from 1 wire chip
and writes it to GPBR registers. U-boot, in board_init(), reads that
info from GPBR and places it in global variables in order to pass it
to Linux. At the time of boot_prep_linux(), these info will be read
from global variables and passed to linux kernel as ATAGs.

The board at91sam9x5ek I came across has this 1 wire chip connected,
But I am really not sure if this is true with all at91sam9x5ek boards,
hence I made a config parameter so that others can just enable or
disable reading rev and serial info from 1 wire chip(in this case from
GPBR registers).

>
>> +static u32 system_rev;
>> +static u32 system_serial_low;
>
> Can we please omit these global variables? We could just read the GPBR's
> in respective get-functions. This will reduce the .bss and .text size
> and is therefore reasonable.
May be yes, if we have some place to preserve these info for
processing at later stage, As of now I am really not aware of any such
struct. If you have any suggestion of one such place, please suggest
me so that I can omit these global variables. I too dislike the idea
of using global variables.

>
>> +
>> +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)
>> +{
>&g

Re: [U-Boot] [PATCH v3] at91sam9x5ek:Pass serial and revision tags to Linux

2013-05-09 Thread Julius Hemanth P
Sorry for spam, accidentally sent twice, please ignore this.

On Thu, May 9, 2013 at 10:28 PM, Julius Hemanth P
 wrote:
> 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 
> ---
> 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 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] at91sam9x5ek: Pass serial and revision tags to Linux

2013-05-09 Thread 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

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 
---
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] at91sam9x5ek:Pass serial and revision tags to Linux

2013-05-09 Thread 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

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 
---
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] at91sam9x5ek: Pass serial and revision tags to Linux

2013-05-09 Thread Julius Hemanth P
Thanks Bo, will send updated patch with all corrections.

Regards,
Julius Hemanth P
On May 9, 2013 8:49 AM, "Bo Shen"  wrote:

> Hi Julius,
>
> On 5/3/2013 18:54, Julius Hemanth P wrote:
>
>> 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
>> 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 
>> ---
>> 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(-)
>>
>
> 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.c
>> b/board/atmel/at91sam9x5ek/**at91sam9x5ek.c
>> index 8773e6f..c05bdb7 100644
>> --- a/board/atmel/at91sam9x5ek/**at91sam9x5ek.c
>> +++ b/board/atmel/at91sam9x5ek/**at91sam9x5ek.c
>> @@ -27,6 +27,7 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>>   #include 
>>   #include 
>>   #include 
>> @@ -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]);
>> +}
>>
>
> 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
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] at91sam9x5ek: Pass serial and revision tags to Linux

2013-05-03 Thread 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:-
 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 
---
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(-)

diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 8773e6f..c05bdb7 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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.7.0.4
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] at91sam9x5ek: Pass serial and revision tags to Linux

2013-04-26 Thread Julius Hemanth P
Thanks Bo and Tom.
I shall modify patch as suggested and will send it again.


On Fri, Apr 26, 2013 at 7:20 AM, Bo Shen  wrote:
> Hi Julius,
>
>
> On 4/25/2013 13:59, Julius Hemanth P wrote:
>>
>> 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.
>
>
> It won't have issue work with mainline Linux kernel for at91sam9x5.
>
> Actually, this only occur when mainline u-boot work with the Linux kernel we
> released based on 2.6.39 (This is almost two years old). So, for customer we
> suggest them upgrade the Linux kernel.
>
> For compatible issue, add this won't hurt. Temporary, we can accept it. if
> the GPBR will use for other function in future, this will be removed.
>
>
>> 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 
>> ---
>>   board/atmel/at91sam9x5ek/at91sam9x5ek.c |   28
>> 
>>   include/configs/at91sam9x5ek.h  |7 +++
>>   2 files changed, 35 insertions(+)
>>
>> diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
>> b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
>> index 8773e6f..43a55e4 100644
>> --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
>> +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
>> @@ -50,6 +50,30 @@ DECLARE_GLOBAL_DATA_PTR;
>>   /*
>>* Miscelaneous platform dependent initialisations
>>*/
>
>
> s/Miscelaneous/Miscellaneous
> s/initialisations/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)
>> +{
>> +   /* serial is in GPBR #2 and revision is in GPBR #3 */
>> +   system_serial_low = readl(ATMEL_BASE_GPBR + 4 * 2);
>> +   system_rev = readl(ATMEL_BASE_GPBR + 4 * 3);
>
>
> Please use c structure to access it.
>
>
>> +}
>> +#endif
>> +
>>   #ifdef CONFIG_CMD_NAND
>>   static void at91sam9x5ek_nand_hw_init(void)
>>   {
>> @@ -282,6 +306,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..b6236b8 100644
>> --- a/include/configs/at91sam9x5ek.h
>> +++ b/include/configs/at91sam9x5ek.h
>> @@ -38,6 +38,13 @@
>>   #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
>>   #define CONFIG_SETUP_MEMORY_TAGS
>>   #define CONFIG_INITRD_TAG
>> +
>> +#define CONFIG_LOAD_ONE_WIRE_INFO  1
>> +#ifdef CONFIG_LOAD_ONE_WIRE_INFO
>> +#define CONFIG_REVISION_TAG1
>> +#define CONFIG_SERIAL_TAG  1
>> +#endif
>
>
> Address Tom Rini's comments.
>
>> +
>>   #define CONFIG_SKIP_LOWLEVEL_INIT
>>   #define CONFIG_BOARD_EARLY_INIT_F
>>   #define CONFIG_DISPLAY_CPUINFO
>> --
>> 1.7.9.5
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
>
> Best Regards,
> Bo Shen
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] at91sam9x5ek: Pass serial and revision tags to Linux

2013-04-25 Thread 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:-
 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 
---
 board/atmel/at91sam9x5ek/at91sam9x5ek.c |   28 
 include/configs/at91sam9x5ek.h  |7 +++
 2 files changed, 35 insertions(+)

diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 8773e6f..43a55e4 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -50,6 +50,30 @@ DECLARE_GLOBAL_DATA_PTR;
 /*
  * Miscelaneous platform dependent initialisations
  */
+
+#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)
+{
+   /* serial is in GPBR #2 and revision is in GPBR #3 */
+   system_serial_low = readl(ATMEL_BASE_GPBR + 4 * 2);
+   system_rev = readl(ATMEL_BASE_GPBR + 4 * 3);
+}
+#endif
+
 #ifdef CONFIG_CMD_NAND
 static void at91sam9x5ek_nand_hw_init(void)
 {
@@ -282,6 +306,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..b6236b8 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -38,6 +38,13 @@
 #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
+
+#define CONFIG_LOAD_ONE_WIRE_INFO  1
+#ifdef CONFIG_LOAD_ONE_WIRE_INFO
+#define CONFIG_REVISION_TAG1
+#define CONFIG_SERIAL_TAG  1
+#endif
+
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_DISPLAY_CPUINFO
--
1.7.9.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot