Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Reinhard Meyer
Hello Heiko,

I try to understand how the relocation process could handle pointers (to
functions or other data) in const or data sections.
Your code cannot know what is data and what is a pointer that needs
adjustment?

Best Regards,
Reinhard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Albert ARIBAUD
Le 02/10/2010 09:15, Reinhard Meyer a écrit :
> Hello Heiko,
>
> I try to understand how the relocation process could handle pointers (to
> functions or other data) in const or data sections.
> Your code cannot know what is data and what is a pointer that needs
> adjustment?
>
> Best Regards,
> Reinhard

Hi Reinhart,

Short answer - the relocation process does not handle pointers inside 
data structures.

And yes, this means the content arrays of pointers such as init_sequence 
is not relocated. Been there, done that, can give you one of the 
tee-shirts I got :)

ATM I have not found a way to fix this, except making the code which 
uses the pointers aware that the are location-sensitive and fix them 
when using them.

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Reinhard Meyer
Dear Albert ARIBAUD,
>> I try to understand how the relocation process could handle pointers (to
>> functions or other data) in const or data sections.
>> Your code cannot know what is data and what is a pointer that needs
>> adjustment?
>>
>> Best Regards,
>> Reinhard
>
> Hi Reinhart,
>
> Short answer - the relocation process does not handle pointers inside
> data structures.
>
> And yes, this means the content arrays of pointers such as init_sequence
> is not relocated. Been there, done that, can give you one of the
> tee-shirts I got :)
>
> ATM I have not found a way to fix this, except making the code which
> uses the pointers aware that the are location-sensitive and fix them
> when using them.

That means that things like this cannot work (with relocation),
unless adding the relocation offset before using the pointer:

const struct {
const u8 shift;
const u8 idcode;
struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
} flashes[] = {
#ifdef CONFIG_SPI_FLASH_SPANSION
{ 0, 0x01, spi_flash_probe_spansion, },
#endif
#ifdef CONFIG_SPI_FLASH_ATMEL
{ 0, 0x1F, spi_flash_probe_atmel, },
#endif
#ifdef CONFIG_SPI_FLASH_MACRONIX
{ 0, 0xc2, spi_flash_probe_macronix, },
#endif
#ifdef CONFIG_SPI_FLASH_WINBOND
{ 0, 0xef, spi_flash_probe_winbond, },
#endif
#ifdef CONFIG_SPI_FLASH_STMICRO
{ 0, 0x20, spi_flash_probe_stmicro, },
{ 0, 0xff, spi_flash_probe_stmicro, },
#endif
#ifdef CONFIG_SPI_FLASH_SST
{ 0, 0xBF, spi_flash_probe_sst, },
#endif
#ifdef CONFIG_SPI_FRAM_RAMTRON
{ 6, 0xc2, spi_fram_probe_ramtron, },
# ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
{ 0, 0xff, spi_fram_probe_ramtron, },
# endif
# undef IDBUF_LEN
# define IDBUF_LEN 9 /* we need to read 6+3 bytes */
#endif
};

And I think there are more places of this type in u-boot...

Best Regards,
Reinhard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Albert ARIBAUD
Le 02/10/2010 10:10, Reinhard Meyer a écrit :
> Dear Albert ARIBAUD,
>>> I try to understand how the relocation process could handle pointers (to
>>> functions or other data) in const or data sections.
>>> Your code cannot know what is data and what is a pointer that needs
>>> adjustment?
>>>
>>> Best Regards,
>>> Reinhard
>>
>> Hi Reinhart,
>>
>> Short answer - the relocation process does not handle pointers inside
>> data structures.
>>
>> And yes, this means the content arrays of pointers such as init_sequence
>> is not relocated. Been there, done that, can give you one of the
>> tee-shirts I got :)
>>
>> ATM I have not found a way to fix this, except making the code which
>> uses the pointers aware that the are location-sensitive and fix them
>> when using them.
>
> That means that things like this cannot work (with relocation),
> unless adding the relocation offset before using the pointer:
>
> const struct {
> const u8 shift;
> const u8 idcode;
> struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
> } flashes[] = {
> #ifdef CONFIG_SPI_FLASH_SPANSION
> { 0, 0x01, spi_flash_probe_spansion, },
> #endif
> #ifdef CONFIG_SPI_FLASH_ATMEL
> { 0, 0x1F, spi_flash_probe_atmel, },
> #endif
> #ifdef CONFIG_SPI_FLASH_MACRONIX
> { 0, 0xc2, spi_flash_probe_macronix, },
> #endif
> #ifdef CONFIG_SPI_FLASH_WINBOND
> { 0, 0xef, spi_flash_probe_winbond, },
> #endif
> #ifdef CONFIG_SPI_FLASH_STMICRO
> { 0, 0x20, spi_flash_probe_stmicro, },
> { 0, 0xff, spi_flash_probe_stmicro, },
> #endif
> #ifdef CONFIG_SPI_FLASH_SST
> { 0, 0xBF, spi_flash_probe_sst, },
> #endif
> #ifdef CONFIG_SPI_FRAM_RAMTRON
> { 6, 0xc2, spi_fram_probe_ramtron, },
> # ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
> { 0, 0xff, spi_fram_probe_ramtron, },
> # endif
> # undef IDBUF_LEN
> # define IDBUF_LEN 9 /* we need to read 6+3 bytes */
> #endif
> };
>
> And I think there are more places of this type in u-boot...
>
> Best Regards,
> Reinhard

If this code is intended to execute after relocation [1] then no, it 
will not work.

There are two ways to fix that:

The first one is to make the variable non-const and, after relocation 
but before use, run a fixup loop specifically for this variable. Then 
you can call the (now fixed) functions.

The second one is to fix on-the-fly: provide a field in gd which 
contains the relocation offset in gd (if not done already); in the code 
which calls function pointers, DECLARE_GLOBAL_DATA_PTR and call the 
function through a global macro (defined in some general u-boot header), 
e.g. FIX_RELOCATED_FUNCTION_POINTER(fp), which would offset fp to its 
correct location.

Thus in the code, instead of x = fp(args) you'd have x = 
FIX_RELOCATED_FUNCTION_POINTER(fp)(args).

[1] or, in my case, before relocation but not from the location 
specified at link time. This is a slightly different issue, which the 
first solution fails to address but the second does.

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, probably trivial mistake - back to original problem

2010-10-02 Thread Heiko Schocher
Hello Wolfgang, Reinhard,

Wolfgang Denk wrote:
> Dear Reinhard Meyer,
> 
> In message <4ca5d857.5010...@emk-elektronik.de> you wrote:
>> The environment issues still persist. I am at a loss
>> there now.
>>
>> Observation: the old style commands "setenv", "printenv", etc.
>> work, but any "env" command except for "env" alone crashes.
> 
> OK. If "printenv" works and "env print" fails then it has nothing to
> do with the environment code itself, as both call the same function.
> 
> It must have something to do with the implementation of subcommands
> then. See do_env() in "common/cmd_nvedit.c"; check if the command
> table address for find_cmd_tbl() is OK.
> 
> Eventually other commands with subcommands fail as well (i2c ?) ?

Yep, I think thats the direction. i2c should work, because the
subcommands get fixed in board_init_r() through i2c_reloc()

For fixing commandtable (and subcommands) I made a common
function fixup_cmdtable() in common/command.c see also
commit 620f1f6a64095ed558e68d37f1965d015cd49b02

Note: For powerpc this fixups are not needed, so
CONFIG_RELOC_FIXUP_WORKS is defined for powerpc ... don;t
sure, how exactly this work on powerpc ...

bye,
Heiko

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, probably trivial mistake - back to original problem

2010-10-02 Thread Heiko Schocher
Hello Reinhard,

Reinhard Meyer wrote:
> Dear Wolfgang Denk,
>>> The environment issues still persist. I am at a loss
>>> there now.
>>>
>>> Observation: the old style commands "setenv", "printenv", etc.
>>> work, but any "env" command except for "env" alone crashes.
>> OK. If "printenv" works and "env print" fails then it has nothing to
>> do with the environment code itself, as both call the same function.
>>
>> It must have something to do with the implementation of subcommands
>> then. See do_env() in "common/cmd_nvedit.c"; check if the command
>> table address for find_cmd_tbl() is OK.
>>
>> Eventually other commands with subcommands fail as well (i2c ?) ?
> 
> Nope, other commands with subcommands work fine. I did not test ALL
> but mmc, i2c, nand behave normally.

nand and mmc don;t use a command subtable, so they work. i2c do
the needed fixups for subcommandtables ...

And I see in common/cmd_nvedit.c there is a "static cmd_tbl_t cmd_env_sub"
definition, so this must be fixed too (not only for arm, it should
also don;t work on avr32, mips, m68k and sparc, because this
plattforms also need relocation fixups because CONFIG_RELOC_FIXUP_WORKS
is not defined for them ...

> I suspect something to do with a 256k boundary maybe, u-boot.bin is
> short of 256k. I changed the initial bootstrap to load 496k
> yesterday (before that the unrelocated version did fail in some
> commands).
> 
> I'll keep investigating.

Please try my above idea ...

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] board_init_r: Removed unused cmdtp variable

2010-10-02 Thread Heiko Schocher
Hello Richard,

Richard Retanubun wrote:
> From 38c6ceb464f63d3705d30d6603624e7d0933f428 Mon Sep 17 00:00:00 2001
> From: Richard Retanubun 
> Date: Fri, 1 Oct 2010 10:17:26 -0400
> Subject: [PATCH] board_init_r: Removed unused cmdtp variable
> 
> Follow up to commit 620f1f6a64095ed558e68d37f1965d015cd49b02
> removed compiler warning for (now) unused cmd_tbl_t* cmdtp
> ---
> 
> Hi Heiko,
> 
> Not sure if you caught this one already, just a simple unused variable
> cleanup

Thanks, but already fixed in arch/arm/lib/board.c

bye,
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Heiko Schocher
Hello Reinhard,

Reinhard Meyer wrote:
> Dear Albert ARIBAUD,
>>> I try to understand how the relocation process could handle pointers (to
>>> functions or other data) in const or data sections.
>>> Your code cannot know what is data and what is a pointer that needs
>>> adjustment?
>>>
>>> Best Regards,
>>> Reinhard
>> Hi Reinhart,
>>
>> Short answer - the relocation process does not handle pointers inside
>> data structures.
>>
>> And yes, this means the content arrays of pointers such as init_sequence
>> is not relocated. Been there, done that, can give you one of the

The init_sequence should not called anymore after relocation, as it is
the init_sequence ... or?

>> tee-shirts I got :)
>>
>> ATM I have not found a way to fix this, except making the code which
>> uses the pointers aware that the are location-sensitive and fix them
>> when using them.
> 
> That means that things like this cannot work (with relocation),
> unless adding the relocation offset before using the pointer:

Yep, you have to fix these pointers after relocation ...

> const struct {
>   const u8 shift;
>   const u8 idcode;
>   struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
> } flashes[] = {
> #ifdef CONFIG_SPI_FLASH_SPANSION
>   { 0, 0x01, spi_flash_probe_spansion, },
> #endif
[...]
> #ifdef CONFIG_SPI_FRAM_RAMTRON
>   { 6, 0xc2, spi_fram_probe_ramtron, },
> # ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
>   { 0, 0xff, spi_fram_probe_ramtron, },
> # endif
> # undef IDBUF_LEN
> # define IDBUF_LEN 9 /* we need to read 6+3 bytes */
> #endif
> };
> 
> And I think there are more places of this type in u-boot...

Yes, maybe. But relocation as I did for arm, also works
on m68k, sparc, mips, avr32 and they must do also this
fixups, so for common functions (except the new env handling,
which I think got never tested on this architectures?) should
work ...

As I just searching in code: there is a env_relocate()
function (which get called from arch/arm/lib/board.c board_init_r()),
but it did not the necessary work for subcommandtable fixup...
I think this should be the right place to do this ... or?

bye,
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Albert ARIBAUD
Le 02/10/2010 11:08, Heiko Schocher a écrit :

>>> Short answer - the relocation process does not handle pointers inside
>>> data structures.
>>>
>>> And yes, this means the content arrays of pointers such as init_sequence
>>> is not relocated. Been there, done that, can give you one of the
>
> The init_sequence should not called anymore after relocation, as it is
> the init_sequence ... or?

... or you may want to have an u-boot binary which is truly 
position-independent. I'd like to have that, but the init_sequence table 
issue makes it difficult.

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Joakim Tjernlund
> Hello Reinhard,
>
> Reinhard Meyer wrote:
> > Dear Albert ARIBAUD,
> >>> I try to understand how the relocation process could handle pointers (to
> >>> functions or other data) in const or data sections.
> >>> Your code cannot know what is data and what is a pointer that needs
> >>> adjustment?
> >>>
> >>> Best Regards,
> >>> Reinhard
> >> Hi Reinhart,
> >>
> >> Short answer - the relocation process does not handle pointers inside
> >> data structures.
> >>
> >> And yes, this means the content arrays of pointers such as init_sequence
> >> is not relocated. Been there, done that, can give you one of the
>
> The init_sequence should not called anymore after relocation, as it is
> the init_sequence ... or?
>
> >> tee-shirts I got :)
> >>
> >> ATM I have not found a way to fix this, except making the code which
> >> uses the pointers aware that the are location-sensitive and fix them
> >> when using them.
> >
> > That means that things like this cannot work (with relocation),
> > unless adding the relocation offset before using the pointer:
>
> Yep, you have to fix these pointers after relocation ...
>
> > const struct {
> >const u8 shift;
> >const u8 idcode;
> >struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
> > } flashes[] = {
> > #ifdef CONFIG_SPI_FLASH_SPANSION
> >{ 0, 0x01, spi_flash_probe_spansion, },
> > #endif
> [...]
> > #ifdef CONFIG_SPI_FRAM_RAMTRON
> >{ 6, 0xc2, spi_fram_probe_ramtron, },
> > # ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
> >{ 0, 0xff, spi_fram_probe_ramtron, },
> > # endif
> > # undef IDBUF_LEN
> > # define IDBUF_LEN 9 /* we need to read 6+3 bytes */
> > #endif
> > };
> >
> > And I think there are more places of this type in u-boot...
>
> Yes, maybe. But relocation as I did for arm, also works
> on m68k, sparc, mips, avr32 and they must do also this
> fixups, so for common functions (except the new env handling,
> which I think got never tested on this architectures?) should
> work ...

This pointer problem is solved with the fixup relocs on ppc and
should work without manual relocation. I think this is a ppc
only extension but I might be wrong.
I believe that the other alternative is to do it as x86 does
which I think is the general way which should work on any arch.
Graem Russ would know better.

 Jocke

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Guaranteed loan offer**APPLY NOW**contact via email**bt48hrsfinancerdesk...@gmail.com**

2010-10-02 Thread Kara Duggan
We are currently giving out loans to any part of the world at 2% interest 
rate. If interested, send your name, Resident country and Phone number to Mr. 
Bernard Thompson with the email address bellow Email: 
48hrsfinancerdesk...@gmail.com or call: 
+447024053959

Regards
B&T 48HRS FINANCE LOAN
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Add new NAND flash

2010-10-02 Thread Matthias Weißer
Hi Scott

Am 01.10.2010 21:52, schrieb Scott Wood:
> On Fri, 1 Oct 2010 16:31:40 +0200
>> MT29F16G08CBABA
>> The NAND is connected (8 bit wide) to an iMX25 which is booting from 
>> NOR. So the NAND is only a mass storage device. I am able to read the ID 
>> of the chip.
>>
>> 2Ch 48h 04h 46h 85h
>>
> 
> According to http://patchwork.ozlabs.org/patch/60042/, this chip
> is supposed to have ID: 2C 48 00 26 89

Take a closer look at the table in the link. There is a MT29F16G08ABABA
with ID: "2C 48 00 26 89" and a MT29F16G08CBABA with ID: "2C 48 04 46
85". The second one is the one I have here. I have also a datasheet of
the chip here from where I copy & pasted the above ID. The ID gets read
correctly from the chip by u-boot NAND subsystem.

> Do you have a datasheet that says what it's supposed to be?
> 
> The bytes may be getting corrupted.  If you hack up the code to
> override the ID bytes with good ones, do you see any problems doing
> real I/O?

I tried that. If I run a "nand bad" command then it never returns and
keeps performing some actions on the NAND device as I can see with an
oscilloscope.

-- 
Matthias Weißer

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] x-loader question

2010-10-02 Thread Steve Sakoman
On Fri, Oct 1, 2010 at 10:59 PM, John Tobias  wrote:
> Hi Steve,
> Thanks for the response. The processor is OMAP4 and I am in the last stage
> of bringing up the board. I took the source code from the omapzoom git tree.
> How do I know if pre or post relocation changes?

If you took the code from the omap4-dev branches of omapzoom then the
recent relocation changes are not an issue, since that code is based
on a u-boot release from 4 years ago!

Given that, folks here on the u-boot list aren't too likely to be the
right resource for help on such an old code base.  If you want to
stick with that code, then TI's E2E site is probably your best bet for
support.

However, I recommend you switch to mainline u-boot v2010.09, released
just this week.  I have added support for the OMAP4 Panda and SDP4430,
so these should serve as good examples for your board.

Steve
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] OneNAND: Destaticize largepage_memorybased

2010-10-02 Thread Marek Vasut
This moves "struct nand_bbt_descr largepage_memorybased" into .data.rel, which
allows it to be PIC with current U-Boot infrastructure for relocation.

Also, I squished the ff_patternt into the structure.

Signed-off-by: Marek Vasut 
---
 drivers/mtd/onenand/onenand_bbt.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_bbt.c 
b/drivers/mtd/onenand/onenand_bbt.c
index 1354877..c6d1dc9 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -231,13 +231,11 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct 
nand_bbt_descr *bd)
  * Define some generic bad / good block scan pattern which are used
  * while scanning a device for factory marked good / bad blocks.
  */
-static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-
-static struct nand_bbt_descr largepage_memorybased = {
+struct nand_bbt_descr largepage_memorybased = {
.options = 0,
.offs = 0,
.len = 2,
-   .pattern = scan_ff_pattern,
+   .pattern = { 0xff, 0xff },
 };
 
 /**
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] OneNAND: Destaticize largepage_memorybased

2010-10-02 Thread Marek Vasut
Dne So 2. října 2010 16:26:07 Marek Vasut napsal(a):
> This moves "struct nand_bbt_descr largepage_memorybased" into .data.rel,
> which allows it to be PIC with current U-Boot infrastructure for
> relocation.
> 
> Also, I squished the ff_patternt into the structure.

Please ignore this one, the linker is playing weird games with me ...
> 
> Signed-off-by: Marek Vasut 
> ---
>  drivers/mtd/onenand/onenand_bbt.c |6 ++
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/onenand_bbt.c
> b/drivers/mtd/onenand/onenand_bbt.c index 1354877..c6d1dc9 100644
> --- a/drivers/mtd/onenand/onenand_bbt.c
> +++ b/drivers/mtd/onenand/onenand_bbt.c
> @@ -231,13 +231,11 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct
> nand_bbt_descr *bd) * Define some generic bad / good block scan pattern
> which are used * while scanning a device for factory marked good / bad
> blocks.
>   */
> -static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
> -
> -static struct nand_bbt_descr largepage_memorybased = {
> +struct nand_bbt_descr largepage_memorybased = {
>   .options = 0,
>   .offs = 0,
>   .len = 2,
> - .pattern = scan_ff_pattern,
> + .pattern = { 0xff, 0xff },
>  };
> 
>  /**
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] strcmp UBoot command

2010-10-02 Thread Michal Schulz
Hello. let me introduce myself.

I'm low-level developer working on AROS (AROS Research Operating
System, http://www.aros.org/). Currently I'm working for Genesi
company where I'm responsible for e.g. UBoot port for the EfikaMX
Smarttop and smartbook ARM-based machines. See
http://www.genesi-usa.com/products for more details.

Working on the UBoot for EfikaMX I found out, that the minimalistic
shell is not able to compare two strings. Therefore I have added a new
uboot command, strcmp, which takes three arguments - two strings to
compare and the compare operator. The function can be used in
combination with "if" command as follows:

if strcmp foo <= bar; then ...; fi

The allowed operators are ==, !=, <, <=, >, >=. The two strings are
compared up to the length of shorter one, different size does not
count to the comparison. This feature is used in script which performs
automatic update of uboot only if there is a newer version available.
In order to do that I have defined a timestamp variable:

$(TIMESTAMP_FILE):
@date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
@date +'#define U_BOOT_TIME "%T"' >> $@
@date +'#define U_BOOT_TIMESTAMP "%Y%m%d%H%M%S"' >> $@

where U_BOOT_TIMESTAMP is available as environment variable
$firmware_version. Thanks to the partial comparison, I can use
following statement in my script:

if strcmp ${firmware_version} < 20101001; then .; fi;

Here, commands will be executed if firmware timestamp is older than
October, 1st, 2010.


Could this strcmp command be useful for anyone else? If so, I would be
pleased to add it to the main uboot repository.

With best regards,
Michal Schulz.

--
Michal Schulz
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread J. William Campbell

 On 10/2/2010 3:17 AM, Joakim Tjernlund wrote:

Hello Reinhard,

Reinhard Meyer wrote:

Dear Albert ARIBAUD,

I try to understand how the relocation process could handle pointers (to
functions or other data) in const or data sections.
Your code cannot know what is data and what is a pointer that needs
adjustment?

Best Regards,
Reinhard

Hi Reinhart,

Short answer - the relocation process does not handle pointers inside
data structures.

And yes, this means the content arrays of pointers such as init_sequence
is not relocated. Been there, done that, can give you one of the

The init_sequence should not called anymore after relocation, as it is
the init_sequence ... or?


tee-shirts I got :)

ATM I have not found a way to fix this, except making the code which
uses the pointers aware that the are location-sensitive and fix them
when using them.

That means that things like this cannot work (with relocation),
unless adding the relocation offset before using the pointer:

Yep, you have to fix these pointers after relocation ...


const struct {
const u8 shift;
const u8 idcode;
struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
} flashes[] = {
#ifdef CONFIG_SPI_FLASH_SPANSION
{ 0, 0x01, spi_flash_probe_spansion, },
#endif

[...]

#ifdef CONFIG_SPI_FRAM_RAMTRON
{ 6, 0xc2, spi_fram_probe_ramtron, },
# ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
{ 0, 0xff, spi_fram_probe_ramtron, },
# endif
# undef IDBUF_LEN
# define IDBUF_LEN 9 /* we need to read 6+3 bytes */
#endif
};

And I think there are more places of this type in u-boot...

Yes, maybe. But relocation as I did for arm, also works
on m68k, sparc, mips, avr32 and they must do also this
fixups, so for common functions (except the new env handling,
which I think got never tested on this architectures?) should
work ...

This pointer problem is solved with the fixup relocs on ppc and
should work without manual relocation. I think this is a ppc
only extension but I might be wrong.


Hi All,
  You are correct that this is a ppc only extension. As such, it is 
not a good candidate for "general" use.



I believe that the other alternative is to do it as x86 does
which I think is the general way which should work on any arch.
Graem Russ would know better.

Almost exactly a year ago, this was all pretty much presented by Graeme 
in the threads

Relocation size penalty calculation (October 14, 2009)
i386 Relocation (November 24, 2009)

Using the full relocation scheme eliminates the need for all these 
"fixups" in u-boot C code. I think this is a very desirable result.
It is also not clear to me that hard coding in the relocation as several 
C routines will produce a  u-boot that is "smaller" than the one 
produced by using normal ELF relocation. However, using full relocation 
creates an environment that is true "C" and does not rely on people 
remembering that they may have to fix up some parts of their code. It is 
hard to see much downside in using the full relocation capability 
provided by Graeme's code.
FWIW, the relocation code and data does not have to be moved into ram if 
space is at a premium.


Best Regards,
Bill Campbell


  Jocke

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot




___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/4] OneNAND: Move largepage_memorybased

2010-10-02 Thread Marek Vasut
This moves "struct nand_bbt_descr largepage_memorybased" into
"onenand_default_bbt" as that's the only place where this is used.

This also removes an entry from .data section. (For me, this section disappears
after relocation).

Signed-off-by: Marek Vasut 
---
 drivers/mtd/onenand/onenand_bbt.c |   25 -
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_bbt.c 
b/drivers/mtd/onenand/onenand_bbt.c
index 1354877..c5d3905 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -227,19 +227,6 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct 
nand_bbt_descr *bd)
return ret;
 }
 
-/*
- * Define some generic bad / good block scan pattern which are used
- * while scanning a device for factory marked good / bad blocks.
- */
-static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-
-static struct nand_bbt_descr largepage_memorybased = {
-   .options = 0,
-   .offs = 0,
-   .len = 2,
-   .pattern = scan_ff_pattern,
-};
-
 /**
  * onenand_default_bbt - [OneNAND Interface] Select a default bad block table 
for the device
  * @param mtd  MTD device structure
@@ -252,6 +239,18 @@ int onenand_default_bbt(struct mtd_info *mtd)
struct onenand_chip *this = mtd->priv;
struct bbm_info *bbm;
 
+   /*
+* Define some generic bad / good block scan pattern which are used
+* while scanning a device for factory marked good / bad blocks.
+*/
+   uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+   struct nand_bbt_descr largepage_memorybased = {
+   .options = 0,
+   .offs = 0,
+   .len = 2,
+   .pattern = scan_ff_pattern,
+   };
+
this->bbm = malloc(sizeof(struct bbm_info));
if (!this->bbm)
return -ENOMEM;
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/4] OneNAND: Introduce CONFIG_SYS_IPL_LOAD_ADDR

2010-10-02 Thread Marek Vasut
This allows to specify where the OneNAND IPL should load the U-Boot binary. The
purpose of CONFIG_SYS_LOAD_ADDR is different I believe.

On PXA, this is needed with OneNAND memories that expose only first 1kb of data,
which is insufficient for SDRAM init. U-Boot can then be copied into SRAM.

Signed-off-by: Marek Vasut 
---
 include/configs/apollon.h  |1 +
 onenand_ipl/onenand_boot.c |4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index c1295de..d34e24d 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -199,6 +199,7 @@
 
 /* default load address */
 #defineCONFIG_SYS_LOAD_ADDR(OMAP2420_SDRC_CS0)
+#defineCONFIG_SYS_IPL_LOAD_ADDR(OMAP2420_SDRC_CS0)
 
 /* The 2420 has 12 GP timers, they can be driven by the SysClk (12/13/19.2)
  * or by 32KHz clk, or from external sig. This rate is divided by a local
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index 22baebb..2a0c7ce 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -33,11 +33,11 @@ void start_oneboot(void)
 {
uchar *buf;
 
-   buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
+   buf = (uchar *) CONFIG_SYS_IPL_LOAD_ADDR;
 
onenand_read_block(buf);
 
-   ((init_fnc_t *)CONFIG_SYS_LOAD_ADDR)();
+   ((init_fnc_t *)CONFIG_SYS_IPL_LOAD_ADDR)();
 
/* should never come here */
 }
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4] OneNAND: Use generic_onenand_read_page in IPL

2010-10-02 Thread Marek Vasut
There apparantly is no reason for having "onenand_read_page" abstracted.
Besides, it's static data which causes trouble.

Signed-off-by: Marek Vasut 
---
 onenand_ipl/onenand_read.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 8d0df81..008d73a 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -37,8 +37,6 @@
 extern void *memcpy32(void *dest, void *src, int size);
 #endif
 
-int (*onenand_read_page)(ulong block, ulong page, u_char *buf, int pagesize);
-
 /* read a page with ECC */
 static int generic_onenand_read_page(ulong block, ulong page,
u_char * buf, int pagesize)
@@ -122,8 +120,6 @@ int onenand_read_block(unsigned char *buf)
int pagesize, erasesize, erase_shift;
int page_is_4KiB = 0;
 
-   onenand_read_page = generic_onenand_read_page;
-
onenand_generic_init(&page_is_4KiB, &page);
 
if (page_is_4KiB) {
@@ -139,10 +135,11 @@ int onenand_read_block(unsigned char *buf)
 
/* NOTE: you must read page from page 1 of block 0 */
/* read the block page by page */
+
for (block = 0; block < nblocks; block++) {
for (; page < ONENAND_PAGES_PER_BLOCK; page++) {
-   if (onenand_read_page(block, page, buf + offset,
-   pagesize)) {
+   if (generic_onenand_read_page(block, page,
+   buf + offset, pagesize)) {
/* This block is bad. Skip it
 * and read next block */
offset -= page * pagesize;
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/4] OneNAND: Fixup command table on reloc

2010-10-02 Thread Marek Vasut
Signed-off-by: Marek Vasut 
---
 arch/arm/lib/board.c |6 ++
 common/cmd_onenand.c |6 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 5f2dfd0..07995ba 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -695,6 +695,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #if defined(CONFIG_CMD_I2C)
extern void i2c_reloc(void);
 #endif
+#if defined(CONFIG_CMD_ONENAND)
+   extern void onenand_reloc(void);
+#endif
 #endif
 
gd = id;
@@ -724,6 +727,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #if defined(CONFIG_CMD_I2C)
i2c_reloc();
 #endif
+#if defined(CONFIG_CMD_ONENAND)
+   onenand_reloc();
+#endif
 #endif /* !defined(CONFIG_RELOC_FIXUP_WORKS) */
 
 #ifdef CONFIG_LOGBUFFER
diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
index 83d967b..fe84c3b 100644
--- a/common/cmd_onenand.c
+++ b/common/cmd_onenand.c
@@ -525,6 +525,12 @@ static cmd_tbl_t cmd_onenand_sub[] = {
U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, 
"", ""),
 };
 
+#ifndef CONFIG_RELOC_FIXUP_WORKS
+void onenand_reloc(void) {
+   fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
+}
+#endif
+
 static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const 
argv[])
 {
cmd_tbl_t *c;
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] OneNAND: Fixup command table on reloc

2010-10-02 Thread Minkyu Kang
Dear Vasut,

On 3 October 2010 02:33, Marek Vasut  wrote:
> Signed-off-by: Marek Vasut 
> ---
>  arch/arm/lib/board.c |    6 ++
>  common/cmd_onenand.c |    6 ++
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 5f2dfd0..07995ba 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -695,6 +695,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
>  #if defined(CONFIG_CMD_I2C)
>        extern void i2c_reloc(void);
>  #endif
> +#if defined(CONFIG_CMD_ONENAND)
> +       extern void onenand_reloc(void);
> +#endif
>  #endif
>
>        gd = id;
> @@ -724,6 +727,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
>  #if defined(CONFIG_CMD_I2C)
>        i2c_reloc();
>  #endif
> +#if defined(CONFIG_CMD_ONENAND)
> +       onenand_reloc();
> +#endif
>  #endif /* !defined(CONFIG_RELOC_FIXUP_WORKS) */
>
>  #ifdef CONFIG_LOGBUFFER
> diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
> index 83d967b..fe84c3b 100644
> --- a/common/cmd_onenand.c
> +++ b/common/cmd_onenand.c
> @@ -525,6 +525,12 @@ static cmd_tbl_t cmd_onenand_sub[] = {
>        U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, 
> "", ""),
>  };
>
> +#ifndef CONFIG_RELOC_FIXUP_WORKS
> +void onenand_reloc(void) {
> +       fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
> +}
> +#endif
> +
>  static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const 
> argv[])
>  {
>        cmd_tbl_t *c;
> --
> 1.7.1
>

I've prepared same patch. :)

Acked-by: Minkyu Kang 

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Reinhard Meyer
Dear all,

thanks for all the info.

My AT91 boards will not use relocation for the time being, and if
relocation is god-like enforced I will find a way not to use it.
I don't need to spend 10% more code for all that trouble.

Reinhard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Would somebody block this please?

2010-10-02 Thread Sergey Kubushyn
It is already 5th or more same spam email in a row. Does anybody care?

---
**
*  k...@homeKOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
**

-- Forwarded message --
Date: Fri, 1 Oct 2010 19:48:28
From: Kara Duggan 
To: undisclosed-recipients:  ;
Subject: [U-Boot] Guaranteed loan offer**APPLY NOW**contact via
 email**bt48hrsfinancerdesk...@gmail.com**

We are currently giving out loans to any part of the world at 2% interest
rate. If interested, send your name, Resident country and Phone number to Mr.
Bernard Thompson with the email address bellow Email:
48hrsfinancerdesk...@gmail.com or call:
+447024053959

Regards
B&T 48HRS FINANCE LOAN
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] OneNAND: Fixup command table on reloc

2010-10-02 Thread Marek Vasut
Dne So 2. října 2010 20:28:19 Minkyu Kang napsal(a):
> Dear Vasut,
> 
> On 3 October 2010 02:33, Marek Vasut  wrote:
> > Signed-off-by: Marek Vasut 
> > ---
> >  arch/arm/lib/board.c |6 ++
> >  common/cmd_onenand.c |6 ++
> >  2 files changed, 12 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> > index 5f2dfd0..07995ba 100644
> > --- a/arch/arm/lib/board.c
> > +++ b/arch/arm/lib/board.c
> > @@ -695,6 +695,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
> >  #if defined(CONFIG_CMD_I2C)
> >extern void i2c_reloc(void);
> >  #endif
> > +#if defined(CONFIG_CMD_ONENAND)
> > +   extern void onenand_reloc(void);
> > +#endif
> >  #endif
> > 
> >gd = id;
> > @@ -724,6 +727,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
> >  #if defined(CONFIG_CMD_I2C)
> >i2c_reloc();
> >  #endif
> > +#if defined(CONFIG_CMD_ONENAND)
> > +   onenand_reloc();
> > +#endif
> >  #endif /* !defined(CONFIG_RELOC_FIXUP_WORKS) */
> > 
> >  #ifdef CONFIG_LOGBUFFER
> > diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
> > index 83d967b..fe84c3b 100644
> > --- a/common/cmd_onenand.c
> > +++ b/common/cmd_onenand.c
> > @@ -525,6 +525,12 @@ static cmd_tbl_t cmd_onenand_sub[] = {
> >U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0,
> > do_onenand_markbad, "", ""), };
> > 
> > +#ifndef CONFIG_RELOC_FIXUP_WORKS
> > +void onenand_reloc(void) {
> > +   fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
> > +}
> > +#endif
> > +
> >  static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *
> > const argv[]) {
> >cmd_tbl_t *c;
> > --
> > 1.7.1
> 
> I've prepared same patch. :)

Oh, I'm sorry, I haven't noticed. Please merge whichever you find more suitable.

Cheers
> 
> Acked-by: Minkyu Kang 
> 
> Thanks
> Minkyu Kang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] OneNAND: Fixup command table on reloc

2010-10-02 Thread Minkyu Kang
Dear Marek Vasut,

On 3 October 2010 03:59, Marek Vasut  wrote:
> Dne So 2. října 2010 20:28:19 Minkyu Kang napsal(a):
>> Dear Vasut,
>>
>> On 3 October 2010 02:33, Marek Vasut  wrote:
>> > Signed-off-by: Marek Vasut 
>> > ---
>> >  arch/arm/lib/board.c |    6 ++
>> >  common/cmd_onenand.c |    6 ++
>> >  2 files changed, 12 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
>> > index 5f2dfd0..07995ba 100644
>> > --- a/arch/arm/lib/board.c
>> > +++ b/arch/arm/lib/board.c
>> > @@ -695,6 +695,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
>> >  #if defined(CONFIG_CMD_I2C)
>> >        extern void i2c_reloc(void);
>> >  #endif
>> > +#if defined(CONFIG_CMD_ONENAND)
>> > +       extern void onenand_reloc(void);
>> > +#endif
>> >  #endif
>> >
>> >        gd = id;
>> > @@ -724,6 +727,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
>> >  #if defined(CONFIG_CMD_I2C)
>> >        i2c_reloc();
>> >  #endif
>> > +#if defined(CONFIG_CMD_ONENAND)
>> > +       onenand_reloc();
>> > +#endif
>> >  #endif /* !defined(CONFIG_RELOC_FIXUP_WORKS) */
>> >
>> >  #ifdef CONFIG_LOGBUFFER
>> > diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
>> > index 83d967b..fe84c3b 100644
>> > --- a/common/cmd_onenand.c
>> > +++ b/common/cmd_onenand.c
>> > @@ -525,6 +525,12 @@ static cmd_tbl_t cmd_onenand_sub[] = {
>> >        U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0,
>> > do_onenand_markbad, "", ""), };
>> >
>> > +#ifndef CONFIG_RELOC_FIXUP_WORKS
>> > +void onenand_reloc(void) {
>> > +       fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
>> > +}
>> > +#endif
>> > +
>> >  static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *
>> > const argv[]) {
>> >        cmd_tbl_t *c;
>> > --
>> > 1.7.1
>>
>> I've prepared same patch. :)
>
> Oh, I'm sorry, I haven't noticed. Please merge whichever you find more 
> suitable.
>

No No.. I mean.. prepared at my local tree.
I didn't send it to mailing list.
I just acked your patch :)

Thanks.
Minkyu Kang.
-- 
from. prom.
www.promsoft.net
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] cmd_elf: add an option for loading ELFs according to PHDRs

2010-10-02 Thread Mike Frysinger
The current ELF loading function does a lot of work above and beyond a
simple "loading".  It ignores the real load addresses and loads things
into their virtual (runtime) address.  This is undesirable when we just
want it to load an ELF and let the ELF do the actual C runtime init.

So add a command line option to let people choose to load via either the
program or section headers.  I'd prefer to have program header loading
be the default, but this would break historical behavior, so I'll leave
section header loading as the norm.

Signed-off-by: Mike Frysinger 
---
 common/cmd_elf.c |   62 ++---
 1 files changed, 53 insertions(+), 9 deletions(-)

diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 104d6e6..bf32612 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -25,7 +25,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 int valid_elf_image (unsigned long addr);
-unsigned long load_elf_image (unsigned long addr);
+static unsigned long load_elf_image_phdr(unsigned long addr);
+static unsigned long load_elf_image_shdr(unsigned long addr);
 
 /* Allow ports to override the default behavior */
 __attribute__((weak))
@@ -61,19 +62,34 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 {
unsigned long addr; /* Address of the ELF image */
unsigned long rc;   /* Return value from user code  */
+   char *sload, *saddr;
 
/* -- */
int rcode = 0;
 
-   if (argc < 2)
-   addr = load_addr;
+   sload = saddr = NULL;
+   if (argc == 3) {
+   sload = argv[1];
+   saddr = argv[2];
+   } else if (argc == 2) {
+   if (argv[1][0] == '-')
+   sload = argv[1];
+   else
+   saddr = argv[1];
+   }
+
+   if (saddr)
+   addr = simple_strtoul(saddr, NULL, 16);
else
-   addr = simple_strtoul (argv[1], NULL, 16);
+   addr = load_addr;
 
if (!valid_elf_image (addr))
return 1;
 
-   addr = load_elf_image (addr);
+   if (sload && sload[1] == 'p')
+   addr = load_elf_image_phdr(addr);
+   else
+   addr = load_elf_image_shdr(addr);
 
printf ("## Starting application at 0x%08lx ...\n", addr);
 
@@ -204,7 +220,7 @@ int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 */
 
if (valid_elf_image (addr)) {
-   addr = load_elf_image (addr);
+   addr = load_elf_image_shdr (addr);
} else {
puts ("## Not an ELF image, assuming binary\n");
/* leave addr as load_addr */
@@ -258,7 +274,33 @@ int valid_elf_image (unsigned long addr)
  * A very simple elf loader, assumes the image is valid, returns the
  * entry point address.
  * == */
-unsigned long load_elf_image (unsigned long addr)
+static unsigned long load_elf_image_phdr(unsigned long addr)
+{
+   Elf32_Ehdr *ehdr;   /* Elf header structure pointer */
+   Elf32_Phdr *phdr;   /* Program header structure pointer */
+   int i;
+
+   ehdr = (Elf32_Ehdr *) addr;
+   phdr = (Elf32_Phdr *) (addr + ehdr->e_phoff);
+
+   /* Load each program header */
+   for (i = 0; i < ehdr->e_phnum; ++i) {
+   void *dst = (void *) phdr->p_paddr;
+   void *src = (void *) addr + phdr->p_offset;
+   debug("Loading phdr %i to 0x%p (%i bytes)\n",
+   i, dst, phdr->p_filesz);
+   if (phdr->p_filesz)
+   memcpy(dst, src, phdr->p_filesz);
+   if (phdr->p_filesz != phdr->p_memsz)
+   memset(dst + phdr->p_filesz, 0x00, phdr->p_memsz - 
phdr->p_filesz);
+   flush_cache((unsigned long)dst, phdr->p_filesz);
+   ++phdr;
+   }
+
+   return ehdr->e_entry;
+}
+
+static unsigned long load_elf_image_shdr(unsigned long addr)
 {
Elf32_Ehdr *ehdr;   /* Elf header structure pointer */
Elf32_Shdr *shdr;   /* Section header structure pointer */
@@ -312,9 +354,11 @@ unsigned long load_elf_image (unsigned long addr)
 
 /* == */
 U_BOOT_CMD(
-   bootelf,  2,  0,  do_bootelf,
+   bootelf,  3,  0,  do_bootelf,
"Boot from an ELF image in memory",
-   " [address] - load address of ELF image."
+   "[-p|-s] [address]\n"
+   "\t- load ELF image at [address] via program headers (-p)\n"
+   "\t  or via section headers (-s)"
 );
 
 U_BOOT_CMD(
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH 1/2 v2] nand: allow delayed initialization

2010-10-02 Thread Mike Frysinger
Many people like the current nand_init() behavior where it is always
initialized during boot and the flash size shown, but there are cases
where we are willing to forgo this niceness for speed/functionality.
So rather than change the default, introduce a delayed config option
people may enable.  This way the nand is only poked when someone tries
to actually use it.

Signed-off-by: Mike Frysinger 
---
v2
- update to current mainline

 common/cmd_nand.c   |2 ++
 common/env_nand.c   |8 
 drivers/mtd/nand/nand.c |9 +
 include/nand.h  |5 +
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 3f1d077..5409382 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -309,6 +309,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * 
const argv[])
if (argc < 2)
goto usage;
 
+   nand_delayed_init();
+
if (quiet_str)
quiet = simple_strtoul(quiet_str, NULL, 0) != 0;
 
diff --git a/common/env_nand.c b/common/env_nand.c
index 4e8307a..3d80510 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -359,6 +359,8 @@ void env_relocate_spec(void)
return;
}
 
+   nand_delayed_init();
+
if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1))
puts("No Valid Environment Area found\n");
 
@@ -404,6 +406,8 @@ void env_relocate_spec(void)
free(tmp_env1);
free(tmp_env2);
 
+#else
+   nand_delayed_init();
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #else /* ! CONFIG_ENV_OFFSET_REDUND */
@@ -418,6 +422,8 @@ void env_relocate_spec (void)
int ret;
char buf[CONFIG_ENV_SIZE];
 
+   nand_delayed_init();
+
 #if defined(CONFIG_ENV_OFFSET_OOB)
ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);
/*
@@ -439,6 +445,8 @@ void env_relocate_spec (void)
}
 
env_import(buf, 1);
+#else
+   nand_delayed_init();
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #endif /* CONFIG_ENV_OFFSET_REDUND */
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
index 47d6872..42ec40a 100644
--- a/drivers/mtd/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
@@ -81,6 +81,15 @@ void nand_init(void)
 {
int i;
unsigned int size = 0;
+
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+   static uint8_t initialized;
+   if (initialized)
+   return;
+   initialized = 1;
+   printf("Delayed NAND init: ");
+#endif
+
for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
nand_init_chip(&nand_info[i], &nand_chip[i], base_address[i]);
size += nand_info[i].size / 1024;
diff --git a/include/nand.h b/include/nand.h
index 8bdf419..74ef73f 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -25,6 +25,11 @@
 #define _NAND_H_
 
 extern void nand_init(void);
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+# define nand_delayed_init() nand_init()
+#else
+# define nand_delayed_init() do { } while (0)
+#endif
 
 #include 
 #include 
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 00/37] Blackfin updates for v2010.12-rc1

2010-10-02 Thread Mike Frysinger
The big highlight here are major cleanups of the Blackfin MMR headers.
People in the past (mostly Wolfgang ;]) have complained about the amount
of duplication seen in these files, so I spent a lot of time unifying
them and punting unused crap.  I'm still not done, but I'm at least to a
"stable" point where I can take a breather and merge the work thus far.

The downside is that these patches are significantly larger than the
100KB limit on the mailing list (170KB - 3MB).  Breaking them up into
smaller pieces doesn't make much sense as in many cases, I'd have to
split up the deletion of a single file to fit.  So if you want to view
them, you'll have to check out my git tree:
http://git.denx.de/?p=u-boot/u-boot-blackfin.git;a=summary
But considering they're by & large "delete code" patches, I'm not sure
people will find them interesting.

The other notable pieces are the new board ports and DMA RX support for
the Blackfin SPI bus.

Mike Frysinger (34):
  Blackfin: add support for BF538/BF539 processors
  Blackfin: add support for BF51x parts
  Blackfin: bfin_spi: add optional DMA support
  Blackfin: bfin_sdh: clean up send_cmd
  Blackfin: unify gpio cfi implementations
  Blackfin: punt headers for non-existent BF541
  Blackfin: bfin_mac: convert from old style MMR macros
  Blackfin: bf537-stamp: post: update old MMR style macros
  Blackfin: bf527-ezkit: video: convert from old style MMR macros
  Blackfin: bf548-ezkit: video: convert from old style MMR macros
  Blackfin: cm-bf548: video: convert from old style MMR macros
  Blackfin: bf527-ad7160-eval: convert from old style MMR macros
  Blackfin: punt old *p style volatile MMR defines
  Blackfin: bf537: unify arch header duplication
  Blackfin: bf52x: unify arch header duplication
  Blackfin: unify core MMRs
  Blackfin: bf533: merge headers
  Blackfin: bf561: merge headers
  Blackfin: move CONFIG_BFIN_CPU to board config.mk
  Blackfin: cmd_gpio: document/extend input sub-option
  Blackfin: adi config: add an "all spi flashes" option to unify board
lists
  Blackfin: adi config: add a hook for boards to append the env
  Blackfin: bf527-sdp: new board port
  Blackfin: cmd_gpio: return gpio value to caller
  Blackfin: adi config: allow boards to tweak a little more
  Blackfin: adi config: enable nand lock/unlock support
  Blackfin: bf526-ezbrd: enable BootROM-OOB layout when booting from
NAND
  Blackfin: cmd_gpio: accept upper case pin names
  Blackfin: propagate target cpu defines when building embedded env
  Blackfin: fix MMC init output alignment
  Blackfin: bf548-ezkit: bump SPI flash size up
  Blackfin: bf527-ad7160-eval: fix GPIO CS define
  Blackfin: bf537-pnav: increase monitor len
  Blackfin: otp: fix build after constification of args[]

Peter Meerwald (2):
  Blackfin: support a 3rd gpio cfi pin
  Blackfin: bct-brettl2: new board port

Wojtek Skulski (1):
  Blackfin: blackvme: new board port

 MAINTAINERS|   10 +-
 arch/blackfin/config.mk|7 +-
 arch/blackfin/cpu/cmd_gpio.c   |   34 +-
 arch/blackfin/include/asm/blackfin_cdef.h  |   19 +-
 arch/blackfin/include/asm/blackfin_def.h   |   33 +-
 arch/blackfin/include/asm/config.h |5 -
 arch/blackfin/include/asm/dma.h|   75 +
 arch/blackfin/include/asm/mach-bf518/BF512_cdef.h  | 1000 ++
 arch/blackfin/include/asm/mach-bf518/BF512_def.h   |  523 +
 arch/blackfin/include/asm/mach-bf518/BF514_cdef.h  |   68 +
 arch/blackfin/include/asm/mach-bf518/BF514_def.h   |   40 +
 arch/blackfin/include/asm/mach-bf518/BF516_cdef.h  |  170 ++
 arch/blackfin/include/asm/mach-bf518/BF516_def.h   |   91 +
 arch/blackfin/include/asm/mach-bf518/BF518_cdef.h  |   58 +
 arch/blackfin/include/asm/mach-bf518/BF518_def.h   |   35 +
 arch/blackfin/include/asm/mach-bf518/anomaly.h |  158 ++
 arch/blackfin/include/asm/mach-bf518/def_local.h   |5 +
 arch/blackfin/include/asm/mach-bf518/gpio.h|   58 +
 arch/blackfin/include/asm/mach-bf518/portmux.h |  201 ++
 arch/blackfin/include/asm/mach-bf518/ports.h   |   59 +
 .../asm/mach-bf527/ADSP-EDN-BF52x-extended_cdef.h  |  511 -
 .../asm/mach-bf527/ADSP-EDN-BF52x-extended_def.h   |6 -
 arch/blackfin/include/asm/mach-bf527/BF522_cdef.h  |  311 ---
 arch/blackfin/include/asm/mach-bf527/BF522_def.h   |  101 -
 arch/blackfin/include/asm/mach-bf527/BF523_cdef.h  |  342 +
 arch/blackfin/include/asm/mach-bf527/BF523_def.h   |  124 +--
 arch/blackfin/include/asm/mach-bf527/BF524_cdef.h  |  480 -
 arch/blackfin/include/asm/mach-bf527/BF524_def.h   |  101 -
 arch/blackfin/include/asm/mach-bf527/BF525_cdef.h  |  849 +
 arch/blackfin/include/asm/mach-bf527/BF525_def.h   |  293 +---
 arch/blackfin/include/asm/mach-bf527/BF526_cdef.h  |  559 --
 arch/blackfin/include/asm/mach-bf527/BF526_def.h   |  101 -
 arch/blackfin/include/asm/mach-bf527/BF527_cdef.h  | 1086 +---
 arch/bl

[U-Boot] [PATCH 04/37] Blackfin: bfin_sdh: clean up send_cmd

2010-10-02 Thread Mike Frysinger
Simplify the command setup and status checking steps, and add a proper
timeout to the status polling code to avoid possible infinite hangs.

Signed-off-by: Mike Frysinger 
---
 drivers/mmc/bfin_sdh.c |   25 +++--
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/bfin_sdh.c b/drivers/mmc/bfin_sdh.c
index 4a9..27d9bf6 100644
--- a/drivers/mmc/bfin_sdh.c
+++ b/drivers/mmc/bfin_sdh.c
@@ -58,27 +58,29 @@
 static int
 sdh_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
 {
-   unsigned int sdh_cmd;
-   unsigned int status;
+   unsigned int status, timeout;
int cmd = mmc_cmd->cmdidx;
int flags = mmc_cmd->resp_type;
int arg = mmc_cmd->cmdarg;
-   int ret = 0;
-   sdh_cmd = 0;
-
-   sdh_cmd |= cmd;
+   int ret;
+   u16 sdh_cmd;
 
+   sdh_cmd = cmd | CMD_E;
if (flags & MMC_RSP_PRESENT)
sdh_cmd |= CMD_RSP;
-
if (flags & MMC_RSP_136)
sdh_cmd |= CMD_L_RSP;
 
bfin_write_SDH_ARGUMENT(arg);
-   bfin_write_SDH_COMMAND(sdh_cmd | CMD_E);
+   bfin_write_SDH_COMMAND(sdh_cmd);
 
/* wait for a while */
+   timeout = 0;
do {
+   if (++timeout > 100) {
+   status = CMD_TIME_OUT;
+   break;
+   }
udelay(1);
status = bfin_read_SDH_STATUS();
} while (!(status & (CMD_SENT | CMD_RESP_END | CMD_TIME_OUT |
@@ -94,12 +96,15 @@ sdh_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
}
 
if (status & CMD_TIME_OUT)
-   ret |= TIMEOUT;
+   ret = TIMEOUT;
else if (status & CMD_CRC_FAIL && flags & MMC_RSP_CRC)
-   ret |= COMM_ERR;
+   ret = COMM_ERR;
+   else
+   ret = 0;
 
bfin_write_SDH_STATUS_CLR(CMD_SENT_STAT | CMD_RESP_END_STAT |
CMD_TIMEOUT_STAT | CMD_CRC_FAIL_STAT);
+
return ret;
 }
 
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 03/37] Blackfin: bfin_spi: add optional DMA support

2010-10-02 Thread Mike Frysinger
This moves the last piece from the old spi_flash driver to the new SPI
framework -- optional DMA RX support.  This typically cuts speeds by ~40%
at the cost of additional ~300 bytes.

Signed-off-by: Mike Frysinger 
---
 arch/blackfin/include/asm/dma.h |   75 +++
 drivers/spi/bfin_spi.c  |  155 ---
 2 files changed, 203 insertions(+), 27 deletions(-)
 create mode 100644 arch/blackfin/include/asm/dma.h

diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
new file mode 100644
index 000..21ff1cf
--- /dev/null
+++ b/arch/blackfin/include/asm/dma.h
@@ -0,0 +1,75 @@
+/*
+ * dma.h - Blackfin DMA defines/structures/etc...
+ *
+ * Copyright 2004-2008 Analog Devices Inc.
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef _BLACKFIN_DMA_H_
+#define _BLACKFIN_DMA_H_
+
+#include 
+
+struct dmasg_large {
+   void *next_desc_addr;
+   unsigned long start_addr;
+   unsigned short cfg;
+   unsigned short x_count;
+   short x_modify;
+   unsigned short y_count;
+   short y_modify;
+} __attribute__((packed));
+
+struct dmasg {
+   unsigned long start_addr;
+   unsigned short cfg;
+   unsigned short x_count;
+   short x_modify;
+   unsigned short y_count;
+   short y_modify;
+} __attribute__((packed));
+
+struct dma_register {
+   void *next_desc_ptr;/* DMA Next Descriptor Pointer register */
+   unsigned long start_addr;   /* DMA Start address  register */
+
+   unsigned short cfg; /* DMA Configuration register */
+   unsigned short dummy1;  /* DMA Configuration register */
+
+   unsigned long reserved;
+
+   unsigned short x_count; /* DMA x_count register */
+   unsigned short dummy2;
+
+   short x_modify; /* DMA x_modify register */
+   unsigned short dummy3;
+
+   unsigned short y_count; /* DMA y_count register */
+   unsigned short dummy4;
+
+   short y_modify; /* DMA y_modify register */
+   unsigned short dummy5;
+
+   void *curr_desc_ptr;/* DMA Current Descriptor Pointer
+  register */
+   unsigned long curr_addr_ptr;/* DMA Current Address Pointer
+  register */
+   unsigned short irq_status;  /* DMA irq status register */
+   unsigned short dummy6;
+
+   unsigned short peripheral_map;  /* DMA peripheral map register */
+   unsigned short dummy7;
+
+   unsigned short curr_x_count;/* DMA Current x-count register */
+   unsigned short dummy8;
+
+   unsigned long reserved2;
+
+   unsigned short curr_y_count;/* DMA Current y-count register */
+   unsigned short dummy9;
+
+   unsigned long reserved3;
+
+};
+
+#endif
diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c
index 556b97a..d7e1474 100644
--- a/drivers/spi/bfin_spi.c
+++ b/drivers/spi/bfin_spi.c
@@ -1,7 +1,7 @@
 /*
  * Driver for Blackfin On-Chip SPI device
  *
- * Copyright (c) 2005-2008 Analog Devices Inc.
+ * Copyright (c) 2005-2010 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -13,6 +13,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -237,10 +238,131 @@ void spi_release_bus(struct spi_slave *slave)
SSYNC();
 }
 
+#ifdef __ADSPBF54x__
+# define SPI_DMA_BASE DMA4_NEXT_DESC_PTR
+#elif defined(__ADSPBF533__) || defined(__ADSPBF532__) || 
defined(__ADSPBF531__) || \
+  defined(__ADSPBF538__) || defined(__ADSPBF539__)
+# define SPI_DMA_BASE DMA5_NEXT_DESC_PTR
+#elif defined(__ADSPBF561__)
+# define SPI_DMA_BASE DMA2_4_NEXT_DESC_PTR
+#elif defined(__ADSPBF537__) || defined(__ADSPBF536__) || 
defined(__ADSPBF534__) || \
+  defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
+# define SPI_DMA_BASE DMA7_NEXT_DESC_PTR
+#else
+# error "Please provide SPI DMA channel defines"
+#endif
+static volatile struct dma_register *dma = (void *)SPI_DMA_BASE;
+
 #ifndef CONFIG_BFIN_SPI_IDLE_VAL
 # define CONFIG_BFIN_SPI_IDLE_VAL 0xff
 #endif
 
+#ifdef CONFIG_BFIN_SPI_NO_DMA
+# define SPI_DMA 0
+#else
+# define SPI_DMA 1
+#endif
+
+static int spi_dma_xfer(struct bfin_spi_slave *bss, const u8 *tx, u8 *rx,
+   uint bytes)
+{
+   int ret = -1;
+   u16 ndsize, spi_config, dma_config;
+   struct dmasg dmasg[2];
+   const u8 *buf;
+
+   if (tx) {
+   debug("%s: doing half duplex TX\n", __func__);
+   buf = tx;
+   spi_config = TDBR_DMA;
+   dma_config = 0;
+   } else {
+   debug("%s: doing half duplex RX\n", __func__);
+   buf = rx;
+   spi_config = RDBR_DMA;
+   dma_config = WNR;
+   }
+
+   dmasg[0].start_addr = (unsigned long)buf;
+   dmasg[0].x_modify = 1;
+   dma_config |= WDSIZE_8 | DMAEN;
+   if (bytes <= 65536) {
+   blackfin_dcache_flush_invalidate_range(buf, buf + bytes);
+

[U-Boot] [PATCH 05/37] Blackfin: unify gpio cfi implementations

2010-10-02 Thread Mike Frysinger
Signed-off-by: Mike Frysinger 
---
 board/cm-bf527/cm-bf527.c|2 +-
 board/cm-bf527/gpio_cfi_flash.c  |   63 ++
 board/cm-bf527/gpio_cfi_flash.h  |   10 --
 board/cm-bf537e/gpio_cfi_flash.c |   20 +---
 board/cm-bf537u/cm-bf537u.c  |2 +-
 board/cm-bf537u/gpio_cfi_flash.c |   60 +---
 board/cm-bf537u/gpio_cfi_flash.h |   10 --
 board/tcm-bf537/gpio_cfi_flash.c |   63 ++
 board/tcm-bf537/gpio_cfi_flash.h |   10 --
 board/tcm-bf537/tcm-bf537.c  |2 +-
 10 files changed, 26 insertions(+), 216 deletions(-)
 delete mode 100644 board/cm-bf527/gpio_cfi_flash.h
 delete mode 100644 board/cm-bf537u/gpio_cfi_flash.h
 delete mode 100644 board/tcm-bf537/gpio_cfi_flash.h

diff --git a/board/cm-bf527/cm-bf527.c b/board/cm-bf527/cm-bf527.c
index b6815b1..a5f70a4 100644
--- a/board/cm-bf527/cm-bf527.c
+++ b/board/cm-bf527/cm-bf527.c
@@ -13,7 +13,7 @@
 #include 
 #include 
 #include 
-#include "gpio_cfi_flash.h"
+#include "../cm-bf537e/gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/cm-bf527/gpio_cfi_flash.c b/board/cm-bf527/gpio_cfi_flash.c
index f8ccc07..6e62fff 100644
--- a/board/cm-bf527/gpio_cfi_flash.c
+++ b/board/cm-bf527/gpio_cfi_flash.c
@@ -1,60 +1,3 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include "gpio_cfi_flash.h"
-
-#define GPIO_PIN_1  GPIO_PH9
-#define GPIO_MASK_1 (1 << 21)
-#define GPIO_PIN_2  GPIO_PG11
-#define GPIO_MASK_2 (1 << 22)
-#define GPIO_MASK   (GPIO_MASK_1 | GPIO_MASK_2)
-
-void *gpio_cfi_flash_swizzle(void *vaddr)
-{
-   unsigned long addr = (unsigned long)vaddr;
-
-   gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
-
-#ifdef GPIO_MASK_2
-   gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
-#endif
-
-   SSYNC();
-
-   return (void *)(addr & ~GPIO_MASK);
-}
-
-#define __raw_writeq(value, addr) *(volatile u64 *)addr = value
-#define __raw_readq(addr) *(volatile u64 *)addr
-
-#define MAKE_FLASH(size, sfx) \
-void flash_write##size(u##size value, void *addr) \
-{ \
-   __raw_write##sfx(value, gpio_cfi_flash_swizzle(addr)); \
-} \
-u##size flash_read##size(void *addr) \
-{ \
-   return __raw_read##sfx(gpio_cfi_flash_swizzle(addr)); \
-}
-MAKE_FLASH(8, b)  /* flash_write8()  flash_read8() */
-MAKE_FLASH(16, w) /* flash_write16() flash_read16() */
-MAKE_FLASH(32, l) /* flash_write32() flash_read32() */
-MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
-
-void gpio_cfi_flash_init(void)
-{
-   gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
-#ifdef GPIO_MASK_2
-   gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
-#endif
-   gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
-}
+#define GPIO_PIN_1 GPIO_PH9
+#define GPIO_PIN_2 GPIO_PG11
+#include "../cm-bf537e/gpio_cfi_flash.c"
diff --git a/board/cm-bf527/gpio_cfi_flash.h b/board/cm-bf527/gpio_cfi_flash.h
deleted file mode 100644
index 5211e97..000
--- a/board/cm-bf527/gpio_cfi_flash.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-void *gpio_cfi_flash_swizzle(void *vaddr);
-void gpio_cfi_flash_init(void);
diff --git a/board/cm-bf537e/gpio_cfi_flash.c b/board/cm-bf537e/gpio_cfi_flash.c
index 79ee844..ab6af81 100644
--- a/board/cm-bf537e/gpio_cfi_flash.c
+++ b/board/cm-bf537e/gpio_cfi_flash.c
@@ -1,7 +1,7 @@
 /*
  * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
  *
- * Copyright (c) 2009 Analog Devices Inc.
+ * Copyright (c) 2009-2010 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -12,9 +12,17 @@
 #include 
 #include "gpio_cfi_flash.h"
 
+/* Allow this driver to be shared among boards */
+#ifndef GPIO_PIN_1
 #define GPIO_PIN_1  GPIO_PF4
+#endif
 #define GPIO_MASK_1 (1 << 21)
-#define GPIO_MASK   (GPIO_MASK_1)
+#ifndef GPIO_PIN_2
+#define GPIO_MASK_2 (0)
+#else
+#define GPIO_MASK_2 (1 << 22)
+#endif
+#define GPIO_MASK   (GPIO_MASK_1 | GPIO_MASK_2)
 
 void *gpio_cfi_flash_swizzle(void *vaddr)
 {
@@ -22,11 +30,12 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
 
gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
 
-#ifdef GPIO_MASK_2
+#ifdef GPIO_PIN_2
gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
 #endif
 
SSYNC();
+   udelay(1);
 
return (void *)(addr & ~GPIO_MASK);
 }
@@ -51,8 +60,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
 void gpio_cfi_flash_init(void)
 {
gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
-#ifdef GPIO_MASK_2
+   gpio_direction_output(GPIO_PIN_1, 0);
+#ifdef GPIO_PIN_2
gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+   gpio_direction_output(GPIO_PIN_2, 0);
 #endif
-   gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
 }
diff --git a

[U-Boot] [PATCH 06/37] Blackfin: punt headers for non-existent BF541

2010-10-02 Thread Mike Frysinger
There is no BF541 processor variant, so punt headers for it.

Signed-off-by: Mike Frysinger 
---
 arch/blackfin/include/asm/blackfin_cdef.h |3 -
 arch/blackfin/include/asm/blackfin_def.h  |5 -
 arch/blackfin/include/asm/mach-bf548/BF541_cdef.h |  323 -
 arch/blackfin/include/asm/mach-bf548/BF541_def.h  |  117 
 4 files changed, 0 insertions(+), 448 deletions(-)
 delete mode 100644 arch/blackfin/include/asm/mach-bf548/BF541_cdef.h
 delete mode 100644 arch/blackfin/include/asm/mach-bf548/BF541_def.h

diff --git a/arch/blackfin/include/asm/blackfin_cdef.h 
b/arch/blackfin/include/asm/blackfin_cdef.h
index 600349f..952444e 100644
--- a/arch/blackfin/include/asm/blackfin_cdef.h
+++ b/arch/blackfin/include/asm/blackfin_cdef.h
@@ -60,9 +60,6 @@
 #ifdef __ADSPBF539__
 # include "mach-bf538/BF539_cdef.h"
 #endif
-#ifdef __ADSPBF541__
-# include "mach-bf548/BF541_cdef.h"
-#endif
 #ifdef __ADSPBF542__
 # include "mach-bf548/BF542_cdef.h"
 #endif
diff --git a/arch/blackfin/include/asm/blackfin_def.h 
b/arch/blackfin/include/asm/blackfin_def.h
index a7539dd..385966a 100644
--- a/arch/blackfin/include/asm/blackfin_def.h
+++ b/arch/blackfin/include/asm/blackfin_def.h
@@ -96,11 +96,6 @@
 # include "mach-bf538/anomaly.h"
 # include "mach-bf538/def_local.h"
 #endif
-#ifdef __ADSPBF541__
-# include "mach-bf548/BF541_def.h"
-# include "mach-bf548/anomaly.h"
-# include "mach-bf548/def_local.h"
-#endif
 #ifdef __ADSPBF542__
 # include "mach-bf548/BF542_def.h"
 # include "mach-bf548/anomaly.h"
diff --git a/arch/blackfin/include/asm/mach-bf548/BF541_cdef.h 
b/arch/blackfin/include/asm/mach-bf548/BF541_cdef.h
deleted file mode 100644
index 1b8c79b..000
--- a/arch/blackfin/include/asm/mach-bf548/BF541_cdef.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/* DO NOT EDIT THIS FILE
- * Automatically generated by generate-cdef-headers.xsl
- * DO NOT EDIT THIS FILE
- */
-
-#ifndef __BFIN_CDEF_ADSP_BF541_proc__
-#define __BFIN_CDEF_ADSP_BF541_proc__
-
-#include "../mach-common/ADSP-EDN-core_cdef.h"
-
-#include "ADSP-EDN-BF542-extended_cdef.h"
-
-#define pCHIPID((uint32_t volatile *)CHIPID)
-#define bfin_read_CHIPID() bfin_read32(CHIPID)
-#define bfin_write_CHIPID(val) bfin_write32(CHIPID, val)
-#define pSWRST ((uint16_t volatile *)SWRST) /* 
Software Reset Register */
-#define bfin_read_SWRST()  bfin_read16(SWRST)
-#define bfin_write_SWRST(val)  bfin_write16(SWRST, val)
-#define pSYSCR ((uint16_t volatile *)SYSCR) /* System 
Configuration register */
-#define bfin_read_SYSCR()  bfin_read16(SYSCR)
-#define bfin_write_SYSCR(val)  bfin_write16(SYSCR, val)
-#define pSRAM_BASE_ADDR((void * volatile *)SRAM_BASE_ADDR) /* 
SRAM Base Address (Read Only) */
-#define bfin_read_SRAM_BASE_ADDR() bfin_readPTR(SRAM_BASE_ADDR)
-#define bfin_write_SRAM_BASE_ADDR(val) bfin_writePTR(SRAM_BASE_ADDR, val)
-#define pDMEM_CONTROL  ((uint32_t volatile *)DMEM_CONTROL) /* 
Data memory control */
-#define bfin_read_DMEM_CONTROL()   bfin_read32(DMEM_CONTROL)
-#define bfin_write_DMEM_CONTROL(val)   bfin_write32(DMEM_CONTROL, val)
-#define pDCPLB_STATUS  ((uint32_t volatile *)DCPLB_STATUS) /* 
Data Cache Programmable Look-Aside Buffer Status */
-#define bfin_read_DCPLB_STATUS()   bfin_read32(DCPLB_STATUS)
-#define bfin_write_DCPLB_STATUS(val)   bfin_write32(DCPLB_STATUS, val)
-#define pDCPLB_FAULT_ADDR  ((void * volatile *)DCPLB_FAULT_ADDR) 
/* Data Cache Programmable Look-Aside Buffer Fault Address */
-#define bfin_read_DCPLB_FAULT_ADDR()   bfin_readPTR(DCPLB_FAULT_ADDR)
-#define bfin_write_DCPLB_FAULT_ADDR(val) bfin_writePTR(DCPLB_FAULT_ADDR, val)
-#define pDCPLB_ADDR0   ((void * volatile *)DCPLB_ADDR0) /* 
Data Cache Protection Lookaside Buffer 0 */
-#define bfin_read_DCPLB_ADDR0()bfin_readPTR(DCPLB_ADDR0)
-#define bfin_write_DCPLB_ADDR0(val)bfin_writePTR(DCPLB_ADDR0, val)
-#define pDCPLB_ADDR1   ((void * volatile *)DCPLB_ADDR1) /* 
Data Cache Protection Lookaside Buffer 1 */
-#define bfin_read_DCPLB_ADDR1()bfin_readPTR(DCPLB_ADDR1)
-#define bfin_write_DCPLB_ADDR1(val)bfin_writePTR(DCPLB_ADDR1, val)
-#define pDCPLB_ADDR2   ((void * volatile *)DCPLB_ADDR2) /* 
Data Cache Protection Lookaside Buffer 2 */
-#define bfin_read_DCPLB_ADDR2()bfin_readPTR(DCPLB_ADDR2)
-#define bfin_write_DCPLB_ADDR2(val)bfin_writePTR(DCPLB_ADDR2, val)
-#define pDCPLB_ADDR3   ((void * volatile *)DCPLB_ADDR3) /* 
Data Cache Protection Lookaside Buffer 3 */
-#define bfin_read_DCPLB_ADDR3()bfin_readPTR(DCPLB_ADDR3)
-#define bfin_write_DCPLB_ADDR3(val)bfin_writePTR(DCPLB_ADDR3, val)
-#define pDCPLB_ADDR4   ((void * volatile *)DCPLB_ADDR4) /* 
Data Cache Protection Lookaside Buffer 4 */
-#define bfin_read_DCPLB_ADDR4()bf

[U-Boot] [PATCH 08/37] Blackfin: bf537-stamp: post: update old MMR style macros

2010-10-02 Thread Mike Frysinger
The old MMR defines are being scrubbed, so convert the driver to use the
new standard helper macros.

For the GPIO MMR usage, convert to the new GPIO framework.

Signed-off-by: Mike Frysinger 
---
 board/bf537-stamp/post-memory.c |   54 +++---
 board/bf537-stamp/post.c|  152 --
 2 files changed, 75 insertions(+), 131 deletions(-)

diff --git a/board/bf537-stamp/post-memory.c b/board/bf537-stamp/post-memory.c
index 4daea62..49022dc 100644
--- a/board/bf537-stamp/post-memory.c
+++ b/board/bf537-stamp/post-memory.c
@@ -97,19 +97,19 @@ void post_init_uart(int sclk)
for (divisor = 0; sclk > 0; divisor++)
sclk -= 57600 * 16;
 
-   *pPORTF_FER = 0x000F;
-   *pPORTH_FER = 0x;
+   bfin_write_PORTF_FER(0x000F);
+   bfin_write_PORTH_FER(0x);
 
-   *pUART_GCTL = 0x00;
-   *pUART_LCR = 0x83;
+   bfin_write_UART_GCTL(0x00);
+   bfin_write_UART_LCR(0x83);
SSYNC();
-   *pUART_DLL = (divisor & 0xFF);
+   bfin_write_UART_DLL(divisor & 0xFF);
SSYNC();
-   *pUART_DLH = ((divisor >> 8) & 0xFF);
+   bfin_write_UART_DLH((divisor >> 8) & 0xFF);
SSYNC();
-   *pUART_LCR = 0x03;
+   bfin_write_UART_LCR(0x03);
SSYNC();
-   *pUART_GCTL = 0x01;
+   bfin_write_UART_GCTL(0x01);
SSYNC();
 }
 
@@ -121,8 +121,8 @@ void post_out_buff(char *buff)
;
i = 0;
while ((buff[i] != '\0') && (i != 100)) {
-   while (!(*pUART_LSR & 0x20)) ;
-   *pUART_THR = buff[i];
+   while (!(bfin_read_pUART_LSR() & 0x20)) ;
+   bfin_write_UART_THR(buff[i]);
SSYNC();
i++;
}
@@ -138,15 +138,15 @@ int post_key_pressed(void)
int i, n;
unsigned short value;
 
-   *pPORTF_FER &= ~PF5;
-   *pPORTFIO_DIR &= ~PF5;
-   *pPORTFIO_INEN |= PF5;
+   bfin_write_PORTF_FER(bfin_read_PORTF_FER() & ~PF5);
+   bfin_write_PORTFIO_DIR(bfin_read_PORTFIO_DIR() & ~PF5);
+   bfin_write_PORTFIO_INEN(bfin_read_PORTFIO_INEN() | PF5);
SSYNC();
 
post_out_buff("Press SW10 to enter Memory POST: 3\0");
for (i = 0; i < KEY_LOOP; i++) {
-   value = *pPORTFIO & PF5;
-   if (*pUART0_RBR == 0x0D) {
+   value = bfin_read_PORTFIO() & PF5;
+   if (bfin_read_UART0_RBR() == 0x0D) {
value = 0;
goto key_pressed;
}
@@ -158,8 +158,8 @@ int post_key_pressed(void)
post_out_buff("\b2\0");
 
for (i = 0; i < KEY_LOOP; i++) {
-   value = *pPORTFIO & PF5;
-   if (*pUART0_RBR == 0x0D) {
+   value = bfin_read_PORTFIO() & PF5;
+   if (bfin_read_UART0_RBR() == 0x0D) {
value = 0;
goto key_pressed;
}
@@ -171,8 +171,8 @@ int post_key_pressed(void)
post_out_buff("\b1\0");
 
for (i = 0; i < KEY_LOOP; i++) {
-   value = *pPORTFIO & PF5;
-   if (*pUART0_RBR == 0x0D) {
+   value = bfin_read_PORTFIO() & PF5;
+   if (bfin_read_UART0_RBR() == 0x0D) {
value = 0;
goto key_pressed;
}
@@ -193,13 +193,13 @@ int post_key_pressed(void)
 void post_init_pll(int mult, int div)
 {
 
-   *pSIC_IWR = 0x01;
-   *pPLL_CTL = (mult << 9);
-   *pPLL_DIV = div;
+   bfin_write_SIC_IWR(0x01);
+   bfin_write_PLL_CTL((mult << 9));
+   bfin_write_PLL_DIV(div);
asm("CLI R2;");
asm("IDLE;");
asm("STI R2;");
-   while (!(*pPLL_STAT & 0x20)) ;
+   while (!(bfin_read_PLL_STAT() & 0x20)) ;
 }
 
 int post_init_sdram(int sclk)
@@ -302,15 +302,15 @@ int post_init_sdram(int sclk)
 
SSYNC();
 
-   *pEBIU_SDGCTL |= 0x100;
+   bfin_write_EBIU_SDGCTL(bfin_write_EBIU_SDGCTL() | 0x100);
/* Set the SDRAM Refresh Rate control register based on SSCLK value */
-   *pEBIU_SDRRC = mem_SDRRC;
+   bfin_write_EBIU_SDRRC(mem_SDRRC);
 
/* SDRAM Memory Bank Control Register */
-   *pEBIU_SDBCTL = mem_SDBCTL;
+   bfin_write_EBIU_SDBCTL(mem_SDBCTL);
 
/* SDRAM Memory Global Control Register */
-   *pEBIU_SDGCTL = mem_SDGCTL;
+   bfin_write_EBIU_SDGCTL(mem_SDGCTL);
SSYNC();
return mem_SDRRC;
 }
diff --git a/board/bf537-stamp/post.c b/board/bf537-stamp/post.c
index c546ab6..60eed5f 100644
--- a/board/bf537-stamp/post.c
+++ b/board/bf537-stamp/post.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Using sw10-PF5 as the hotkey */
 int post_hotkeys_pressed(void)
@@ -20,14 +21,13 @@ int post_hotkeys_pressed(void)
int i;
unsigned short value;
 
-   *pPORTF_FER &= ~PF5;
-   *pPORTFIO_DIR &= ~PF5;
-   *pPORTFIO_INEN |= PF5;
+   gpio_request(GPIO_PF5, "post");
+

[U-Boot] [PATCH 09/37] Blackfin: bf527-ezkit: video: convert from old style MMR macros

2010-10-02 Thread Mike Frysinger
The old MMR defines are being scrubbed, so convert the driver to use the
new standard helper macros.

Signed-off-by: Mike Frysinger 
---
 board/bf527-ezkit/video.c |   76 +++-
 1 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c
index 51bdf02..87e7658 100644
--- a/board/bf527-ezkit/video.c
+++ b/board/bf527-ezkit/video.c
@@ -162,12 +162,12 @@ static int lq035q1_control(unsigned char reg, unsigned 
short value)
 /* enable and disable PPI functions */
 void EnablePPI(void)
 {
-   *pPPI_CONTROL |= PORT_EN;
+   bfin_write_PPI_CONTROL(bfin_read_PPI_CONTROL() | PORT_EN);
 }
 
 void DisablePPI(void)
 {
-   *pPPI_CONTROL &= ~PORT_EN;
+   bfin_write_PPI_CONTROL(bfin_read_PPI_CONTROL() & ~PORT_EN);
 }
 
 void Init_Ports(void)
@@ -182,119 +182,123 @@ void Init_Ports(void)
 void Init_PPI(void)
 {
 
-   *pPPI_DELAY = H_START;
-   *pPPI_COUNT = (H_ACTPIX-1);
-   *pPPI_FRAME = V_LINES;
+   bfin_write_PPI_DELAY(H_START);
+   bfin_write_PPI_COUNT(H_ACTPIX - 1);
+   bfin_write_PPI_FRAME(V_LINES);
 
/* PPI control, to be replaced with definitions */
-   *pPPI_CONTROL = PPI_TX_MODE |   /* output mode , 
PORT_DIR */
+   bfin_write_PPI_CONTROL(
+   PPI_TX_MODE |   /* output mode , 
PORT_DIR */
PPI_XFER_TYPE_11|   /* sync mode XFR_TYPE */
PPI_PORT_CFG_01 |   /* two frame sync 
PORT_CFG */
PPI_PACK_EN |   /* packing enabled 
PACK_EN */
-   PPI_POLS_1; /* faling edge syncs 
POLS */
+   PPI_POLS_1  /* faling edge syncs 
POLS */
+   );
 }
 
 void Init_DMA(void *dst)
 {
-   *pDMA0_START_ADDR = dst;
+   bfin_write_DMA0_START_ADDR(dst);
 
/* X count */
-   *pDMA0_X_COUNT = H_ACTPIX / 2;
-   *pDMA0_X_MODIFY = DMA_BUS_SIZE / 8;
+   bfin_write_DMA0_X_COUNT(H_ACTPIX / 2);
+   bfin_write_DMA0_X_MODIFY(DMA_BUS_SIZE / 8);
 
/* Y count */
-   *pDMA0_Y_COUNT = V_LINES;
-   *pDMA0_Y_MODIFY = DMA_BUS_SIZE / 8;
+   bfin_write_DMA0_Y_COUNT(V_LINES);
+   bfin_write_DMA0_Y_MODIFY(DMA_BUS_SIZE / 8);
 
/* DMA Config */
-   *pDMA0_CONFIG =
+   bfin_write_DMA0_CONFIG(
WDSIZE_16   |   /* 16 bit DMA */
DMA2D   |   /* 2D DMA */
-   FLOW_AUTO;  /* autobuffer mode */
+   FLOW_AUTO   /* autobuffer mode */
+   );
 }
 
-
 void EnableDMA(void)
 {
-   *pDMA0_CONFIG |= DMAEN;
+   bfin_write_DMA0_CONFIG(bfin_read_DMA0_CONFIG() | DMAEN);
 }
 
 void DisableDMA(void)
 {
-   *pDMA0_CONFIG &= ~DMAEN;
+   bfin_write_DMA0_CONFIG(bfin_read_DMA0_CONFIG() & ~DMAEN);
 }
 
-
 /* Init TIMER0 as Frame Sync 1 generator */
 void InitTIMER0(void)
 {
-   *pTIMER_DISABLE |= TIMDIS0; /* disable Timer */
+   bfin_write_TIMER_DISABLE(TIMDIS0);  /* disable 
Timer */
SSYNC();
-   *pTIMER_STATUS  |= TIMIL0 | TOVF_ERR0 | TRUN0;  /* clear status */
+   bfin_write_TIMER_STATUS(TIMIL0 | TOVF_ERR0 | TRUN0);/* clear status 
*/
SSYNC();
 
-   *pTIMER0_PERIOD  = H_PERIOD;
+   bfin_write_TIMER0_PERIOD(H_PERIOD);
SSYNC();
-   *pTIMER0_WIDTH   = H_PULSE;
+   bfin_write_TIMER0_WIDTH(H_PULSE);
SSYNC();
 
-   *pTIMER0_CONFIG  = PWM_OUT |
+   bfin_write_TIMER0_CONFIG(
+   PWM_OUT |
PERIOD_CNT   |
TIN_SEL  |
CLK_SEL  |
-   EMU_RUN;
+   EMU_RUN
+   );
SSYNC();
 }
 
 void EnableTIMER0(void)
 {
-   *pTIMER_ENABLE  |= TIMEN0;
+   bfin_write_TIMER_ENABLE(TIMEN0);
SSYNC();
 }
 
 void DisableTIMER0(void)
 {
-   *pTIMER_DISABLE  |= TIMDIS0;
+   bfin_write_TIMER_DISABLE(TIMDIS0);
SSYNC();
 }
 
 
 void InitTIMER1(void)
 {
-   *pTIMER_DISABLE |= TIMDIS1; /* disable Timer */
+   bfin_write_TIMER_DISABLE(TIMDIS1);  /* disable 
Timer */
SSYNC();
-   *pTIMER_STATUS  |= TIMIL1 | TOVF_ERR1 | TRUN1;  /* clear status */
+   bfin_write_TIMER_STATUS(TIMIL1 | TOVF_ERR1 | TRUN1);/* clear status 
*/
SSYNC();
 
-
-   *pTIMER1_PERIOD  = V_PERIOD;
+   bfin_write_TIMER1_PERIOD(V_PERIOD);
SSYNC();
-   *pTIMER1_WIDTH   = V_PULSE;
+   bfin_write_TIMER1_WIDTH(V_PULSE);
SSYNC();
 
-   *pTIMER1_CONFIG  = PWM_OUT |
+   bfin_write_TIMER1_CONFIG(
+   PWM_OUT |
PERIOD_CNT   |
TIN_SEL  |

[U-Boot] [PATCH 10/37] Blackfin: bf548-ezkit: video: convert from old style MMR macros

2010-10-02 Thread Mike Frysinger
The old MMR defines are being scrubbed, so convert the driver to use the
new standard helper macros.

Signed-off-by: Mike Frysinger 
---
 board/bf548-ezkit/video.c |   21 +++--
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c
index cde877a..9bcf935 100644
--- a/board/bf548-ezkit/video.c
+++ b/board/bf548-ezkit/video.c
@@ -153,24 +153,25 @@ void Init_DMA(void *dst)
 {
 
 #if defined(CONFIG_DEB_DMA_URGENT)
-   *pEBIU_DDRQUE |= DEB2_URGENT;
+   bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() | DEB2_URGENT);
 #endif
 
-   *pDMA12_START_ADDR = dst;
+   bfin_write_DMA12_START_ADDR(dst);
 
/* X count */
-   *pDMA12_X_COUNT = (LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE;
-   *pDMA12_X_MODIFY = DMA_BUS_SIZE / 8;
+   bfin_write_DMA12_X_COUNT((LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE);
+   bfin_write_DMA12_X_MODIFY(DMA_BUS_SIZE / 8);
 
/* Y count */
-   *pDMA12_Y_COUNT = LCD_Y_RES;
-   *pDMA12_Y_MODIFY = DMA_BUS_SIZE / 8;
+   bfin_write_DMA12_Y_COUNT(LCD_Y_RES);
+   bfin_write_DMA12_Y_MODIFY(DMA_BUS_SIZE / 8);
 
/* DMA Config */
-   *pDMA12_CONFIG =
+   bfin_write_DMA12_CONFIG(
WDSIZE_32   |   /* 32 bit DMA */
DMA2D   |   /* 2D DMA */
-   FLOW_AUTO;  /* autobuffer mode */
+   FLOW_AUTO   /* autobuffer mode */
+   );
 }
 
 void Init_Ports(void)
@@ -194,12 +195,12 @@ void Init_Ports(void)
 
 void EnableDMA(void)
 {
-   *pDMA12_CONFIG |= DMAEN;
+   bfin_write_DMA12_CONFIG(bfin_read_DMA12_CONFIG() | DMAEN);
 }
 
 void DisableDMA(void)
 {
-   *pDMA12_CONFIG &= ~DMAEN;
+   bfin_write_DMA12_CONFIG(bfin_read_DMA12_CONFIG() & ~DMAEN);
 }
 
 /* enable and disable PPI functions */
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 11/37] Blackfin: cm-bf548: video: convert from old style MMR macros

2010-10-02 Thread Mike Frysinger
The old MMR defines are being scrubbed, so convert the driver to use the
new standard helper macros.

Signed-off-by: Mike Frysinger 
---
 board/cm-bf548/video.c |   23 ---
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c
index c501697..4703098 100644
--- a/board/cm-bf548/video.c
+++ b/board/cm-bf548/video.c
@@ -153,25 +153,26 @@ void Init_PPI(void)
 
 void Init_DMA(void *dst)
 {
-
 #if defined(CONFIG_DEB_DMA_URGENT)
-   *pEBIU_DDRQUE |= DEB2_URGENT;
+   bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() | DEB2_URGENT);
 #endif
 
-   *pDMA12_START_ADDR = dst;
+   bfin_write_DMA12_START_ADDR(dst);
 
/* X count */
-   *pDMA12_X_COUNT = (LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE;
-   *pDMA12_X_MODIFY = DMA_BUS_SIZE / 8;
+   bfin_write_DMA12_X_COUNT((LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE);
+   bfin_write_DMA12_X_MODIFY(DMA_BUS_SIZE / 8);
 
/* Y count */
-   *pDMA12_Y_COUNT = LCD_Y_RES;
-   *pDMA12_Y_MODIFY = DMA_BUS_SIZE / 8;
+   bfin_write_DMA12_Y_COUNT(LCD_Y_RES);
+   bfin_write_DMA12_Y_MODIFY(DMA_BUS_SIZE / 8);
 
/* DMA Config */
-   *pDMA12_CONFIG = WDSIZE_32 |/* 32 bit DMA */
+   bfin_write_DMA12_CONFIG(
+   WDSIZE_32 | /* 32 bit DMA */
DMA2D | /* 2D DMA */
-   FLOW_AUTO;  /* autobuffer mode */
+   FLOW_AUTO   /* autobuffer mode */
+   );
 }
 
 void Init_Ports(void)
@@ -195,12 +196,12 @@ void Init_Ports(void)
 
 void EnableDMA(void)
 {
-   *pDMA12_CONFIG |= DMAEN;
+   bfin_write_DMA12_CONFIG(bfin_read_DMA12_CONFIG() | DMAEN);
 }
 
 void DisableDMA(void)
 {
-   *pDMA12_CONFIG &= ~DMAEN;
+   bfin_write_DMA12_CONFIG(bfin_read_DMA12_CONFIG() & ~DMAEN);
 }
 
 /* enable and disable PPI functions */
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 07/37] Blackfin: bfin_mac: convert from old style MMR macros

2010-10-02 Thread Mike Frysinger
The old MMR defines are being scrubbed, so convert the driver to use the
new standard helper macros.

Signed-off-by: Mike Frysinger 
---
 drivers/net/bfin_mac.c |   68 +--
 1 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 36d4046..dcc781a 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -131,12 +131,12 @@ static int bfin_EMAC_send(struct eth_device *dev, 
volatile void *packet,
goto out;
}
 
-   if ((*pDMA2_IRQ_STATUS & DMA_ERR) != 0) {
+   if (bfin_read_DMA2_IRQ_STATUS() & DMA_ERR) {
printf("Ethernet: tx DMA error\n");
goto out;
}
 
-   for (i = 0; (*pDMA2_IRQ_STATUS & DMA_RUN) != 0; i++) {
+   for (i = 0; (bfin_read_DMA2_IRQ_STATUS() & DMA_RUN); ++i) {
if (i > TOUT_LOOP) {
puts("Ethernet: tx time out\n");
goto out;
@@ -145,9 +145,9 @@ static int bfin_EMAC_send(struct eth_device *dev, volatile 
void *packet,
txbuf[txIdx]->FrmData->NoBytes = length;
memcpy(txbuf[txIdx]->FrmData->Dest, (void *)packet, length);
txbuf[txIdx]->Dma[0].START_ADDR = (u32) txbuf[txIdx]->FrmData;
-   *pDMA2_NEXT_DESC_PTR = txbuf[txIdx]->Dma;
-   *pDMA2_CONFIG = txdmacfg.data;
-   *pEMAC_OPMODE |= TE;
+   bfin_write_DMA2_NEXT_DESC_PTR(txbuf[txIdx]->Dma);
+   bfin_write_DMA2_CONFIG(txdmacfg.data);
+   bfin_write_EMAC_OPMODE(bfin_read_EMAC_OPMODE() | TE);
 
for (i = 0; (txbuf[txIdx]->StatusWord & TX_COMP) == 0; i++) {
if (i > TOUT_LOOP) {
@@ -194,7 +194,7 @@ static int bfin_EMAC_recv(struct eth_device *dev)
NetRxPackets[rxIdx] =
(volatile uchar *)(rxbuf[rxIdx]->FrmData->Dest);
NetReceive(NetRxPackets[rxIdx], length - 4);
-   *pDMA1_IRQ_STATUS |= DMA_DONE | DMA_ERR;
+   bfin_write_DMA1_IRQ_STATUS(DMA_DONE | DMA_ERR);
rxbuf[rxIdx]->StatusWord = 0x;
if ((rxIdx + 1) >= PKTBUFSRX)
rxIdx = 0;
@@ -229,7 +229,7 @@ static int bfin_miiphy_init(struct eth_device *dev, int 
*opmode)
size_t count;
 
/* Enable PHY output */
-   *pVR_CTL |= CLKBUFOE;
+   bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE);
 
/* Set all the pins to peripheral mode */
peripheral_request_list(pins, "bfin_mac");
@@ -265,30 +265,32 @@ static int bfin_miiphy_init(struct eth_device *dev, int 
*opmode)
bfin_write_EMAC_MMC_CTL(RSTC | CROLL);
 
/* Initialize the TX DMA channel registers */
-   *pDMA2_X_COUNT = 0;
-   *pDMA2_X_MODIFY = 4;
-   *pDMA2_Y_COUNT = 0;
-   *pDMA2_Y_MODIFY = 0;
+   bfin_write_DMA2_X_COUNT(0);
+   bfin_write_DMA2_X_MODIFY(4);
+   bfin_write_DMA2_Y_COUNT(0);
+   bfin_write_DMA2_Y_MODIFY(0);
 
/* Initialize the RX DMA channel registers */
-   *pDMA1_X_COUNT = 0;
-   *pDMA1_X_MODIFY = 4;
-   *pDMA1_Y_COUNT = 0;
-   *pDMA1_Y_MODIFY = 0;
+   bfin_write_DMA1_X_COUNT(0);
+   bfin_write_DMA1_X_MODIFY(4);
+   bfin_write_DMA1_Y_COUNT(0);
+   bfin_write_DMA1_Y_MODIFY(0);
 
return 0;
 }
 
 static int bfin_EMAC_setup_addr(struct eth_device *dev)
 {
-   *pEMAC_ADDRLO =
+   bfin_write_EMAC_ADDRLO(
dev->enetaddr[0] |
dev->enetaddr[1] << 8 |
dev->enetaddr[2] << 16 |
-   dev->enetaddr[3] << 24;
-   *pEMAC_ADDRHI =
+   dev->enetaddr[3] << 24
+   );
+   bfin_write_EMAC_ADDRHI(
dev->enetaddr[4] |
-   dev->enetaddr[5] << 8;
+   dev->enetaddr[5] << 8
+   );
return 0;
 }
 
@@ -328,8 +330,8 @@ static int bfin_EMAC_init(struct eth_device *dev, bd_t *bd)
}
 
/* Set RX DMA */
-   *pDMA1_NEXT_DESC_PTR = rxbuf[0]->Dma;
-   *pDMA1_CONFIG = rxbuf[0]->Dma[0].CONFIG_DATA;
+   bfin_write_DMA1_NEXT_DESC_PTR(rxbuf[0]->Dma);
+   bfin_write_DMA1_CONFIG(rxbuf[0]->Dma[0].CONFIG_DATA);
 
/* Wait MII done */
bfin_miiphy_wait();
@@ -350,7 +352,7 @@ static int bfin_EMAC_init(struct eth_device *dev, bd_t *bd)
opmode |= TE | RMII;
 #endif
/* Turn on the EMAC */
-   *pEMAC_OPMODE = opmode;
+   bfin_write_EMAC_OPMODE(opmode);
return 0;
 }
 
@@ -358,11 +360,10 @@ static void bfin_EMAC_halt(struct eth_device *dev)
 {
debug("Eth_halt: ..\n");
/* Turn off the EMAC */
-   *pEMAC_OPMODE = 0x;
+   bfin_write_EMAC_OPMODE(0);
/* Turn off the EMAC RX DMA */
-   *pDMA1_CONFIG = 0x;
-   *pDMA2_CONFIG = 0x;
-
+   bfin_write_DMA1_CONFIG(0);
+   bfin_write_DMA2_CONFIG(0);
 }
 
 ADI_ETHER_BUFFER *SetupRxBuffer(int no)
@@ -443,16 +444,19 @@ int ether_post_test(int flags)
uchar buf[64];
int i, value = 0;
 

[U-Boot] [PATCH 12/37] Blackfin: bf527-ad7160-eval: convert from old style MMR macros

2010-10-02 Thread Mike Frysinger
The old MMR defines are being scrubbed, so convert the driver to use the
new standard helper macros.

Signed-off-by: Mike Frysinger 
---
 board/bf527-ad7160-eval/bf527-ad7160-eval.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/board/bf527-ad7160-eval/bf527-ad7160-eval.c 
b/board/bf527-ad7160-eval/bf527-ad7160-eval.c
index b06d5ab..ea405b6 100644
--- a/board/bf527-ad7160-eval/bf527-ad7160-eval.c
+++ b/board/bf527-ad7160-eval/bf527-ad7160-eval.c
@@ -20,6 +20,6 @@ int checkboard(void)
 int misc_init_r(void)
 {
/* CLKIN Buffer Output Enable */
-   *pVR_CTL |= CLKBUFOE;
+   bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE);
return 0;
 }
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 14/37] Blackfin: bf537: unify arch header duplication

2010-10-02 Thread Mike Frysinger
Signed-off-by: Mike Frysinger 
---
 arch/blackfin/include/asm/mach-bf537/BF534_def.h  |2 +
 arch/blackfin/include/asm/mach-bf537/BF536_cdef.h |4 +-
 arch/blackfin/include/asm/mach-bf537/BF536_def.h  |   13 +--
 arch/blackfin/include/asm/mach-bf537/BF537_cdef.h |  173 +
 arch/blackfin/include/asm/mach-bf537/BF537_def.h  |  109 +-
 5 files changed, 6 insertions(+), 295 deletions(-)

diff --git a/arch/blackfin/include/asm/mach-bf537/BF534_def.h 
b/arch/blackfin/include/asm/mach-bf537/BF534_def.h
index 5f0437b..e04676c 100644
--- a/arch/blackfin/include/asm/mach-bf537/BF534_def.h
+++ b/arch/blackfin/include/asm/mach-bf537/BF534_def.h
@@ -10,12 +10,14 @@
 
 #include "ADSP-EDN-BF534-extended_def.h"
 
+#if defined(__BFIN_DEF_ADSP_BF537_proc__) || 
!defined(__BFIN_DEF_ADSP_BF536_proc__)
 #define L1_DATA_A_SRAM 0xFF80 /* 0xFF80 -> 0xFF803FFF Data Bank A SRAM 
*/
 #define L1_DATA_A_SRAM_SIZE (0xFF803FFF - 0xFF80 + 1)
 #define L1_DATA_A_SRAM_END (L1_DATA_A_SRAM + L1_DATA_A_SRAM_SIZE)
 #define L1_DATA_B_SRAM 0xFF90 /* 0xFF90 -> 0xFF903FFF Data Bank B SRAM 
*/
 #define L1_DATA_B_SRAM_SIZE (0xFF903FFF - 0xFF90 + 1)
 #define L1_DATA_B_SRAM_END (L1_DATA_B_SRAM + L1_DATA_B_SRAM_SIZE)
+#endif
 #define L1_INST_SRAM 0xFFA0 /* 0xFFA0 -> 0xFFA07FFF Instruction Bank A 
SRAM */
 #define L1_INST_SRAM_SIZE (0xFFA07FFF - 0xFFA0 + 1)
 #define L1_INST_SRAM_END (L1_INST_SRAM + L1_INST_SRAM_SIZE)
diff --git a/arch/blackfin/include/asm/mach-bf537/BF536_cdef.h 
b/arch/blackfin/include/asm/mach-bf537/BF536_cdef.h
index 6116298..ccf57c8 100644
--- a/arch/blackfin/include/asm/mach-bf537/BF536_cdef.h
+++ b/arch/blackfin/include/asm/mach-bf537/BF536_cdef.h
@@ -6,9 +6,7 @@
 #ifndef __BFIN_CDEF_ADSP_BF536_proc__
 #define __BFIN_CDEF_ADSP_BF536_proc__
 
-#include "../mach-common/ADSP-EDN-core_cdef.h"
-
-#include "ADSP-EDN-BF534-extended_cdef.h"
+#include "BF534_cdef.h"
 
 #define bfin_read_EMAC_OPMODE()bfin_read32(EMAC_OPMODE)
 #define bfin_write_EMAC_OPMODE(val)bfin_write32(EMAC_OPMODE, val)
diff --git a/arch/blackfin/include/asm/mach-bf537/BF536_def.h 
b/arch/blackfin/include/asm/mach-bf537/BF536_def.h
index 810fe91..9d8d00a 100644
--- a/arch/blackfin/include/asm/mach-bf537/BF536_def.h
+++ b/arch/blackfin/include/asm/mach-bf537/BF536_def.h
@@ -6,9 +6,7 @@
 #ifndef __BFIN_DEF_ADSP_BF536_proc__
 #define __BFIN_DEF_ADSP_BF536_proc__
 
-#include "../mach-common/ADSP-EDN-core_def.h"
-
-#include "ADSP-EDN-BF534-extended_def.h"
+#include "BF534_def.h"
 
 #define EMAC_OPMODE0xFFC03000 /* Operating Mode Register */
 #define EMAC_ADDRLO0xFFC03004 /* Address Low (32 LSBs) 
Register */
@@ -89,14 +87,5 @@
 #define EMAC_TXC_LT10240xFFC031D0 /* Good TX Frame Count - 
Byte Count 512 <= x < 1024 */
 #define EMAC_TXC_GE10240xFFC031D4 /* Good TX Frame Count - 
Byte Count x >= 1024 */
 #define EMAC_TXC_ABORT 0xFFC031D8 /* Total TX Frames Aborted 
Count */
-#define L1_INST_SRAM 0xFFA0 /* 0xFFA0 -> 0xFFA07FFF Instruction Bank A 
SRAM */
-#define L1_INST_SRAM_SIZE (0xFFA07FFF - 0xFFA0 + 1)
-#define L1_INST_SRAM_END (L1_INST_SRAM + L1_INST_SRAM_SIZE)
-#define L1_SRAM_SCRATCH 0xFFB0 /* 0xFFB0 -> 0xFFB00FFF Scratchpad SRAM 
*/
-#define L1_SRAM_SCRATCH_SIZE (0xFFB00FFF - 0xFFB0 + 1)
-#define L1_SRAM_SCRATCH_END (L1_SRAM_SCRATCH + L1_SRAM_SCRATCH_SIZE)
-#define SYSMMR_BASE 0xFFC0 /* 0xFFC0 -> 0x MMR registers */
-#define SYSMMR_BASE_SIZE (0x - 0xFFC0 + 1)
-#define SYSMMR_BASE_END (SYSMMR_BASE + SYSMMR_BASE_SIZE)
 
 #endif /* __BFIN_DEF_ADSP_BF536_proc__ */
diff --git a/arch/blackfin/include/asm/mach-bf537/BF537_cdef.h 
b/arch/blackfin/include/asm/mach-bf537/BF537_cdef.h
index 8723b57..958363b 100644
--- a/arch/blackfin/include/asm/mach-bf537/BF537_cdef.h
+++ b/arch/blackfin/include/asm/mach-bf537/BF537_cdef.h
@@ -1,172 +1 @@
-/* DO NOT EDIT THIS FILE
- * Automatically generated by generate-cdef-headers.xsl
- * DO NOT EDIT THIS FILE
- */
-
-#ifndef __BFIN_CDEF_ADSP_BF537_proc__
-#define __BFIN_CDEF_ADSP_BF537_proc__
-
-#include "../mach-common/ADSP-EDN-core_cdef.h"
-
-#include "ADSP-EDN-BF534-extended_cdef.h"
-
-#define bfin_read_EMAC_OPMODE()bfin_read32(EMAC_OPMODE)
-#define bfin_write_EMAC_OPMODE(val)bfin_write32(EMAC_OPMODE, val)
-#define bfin_read_EMAC_ADDRLO()bfin_read32(EMAC_ADDRLO)
-#define bfin_write_EMAC_ADDRLO(val)bfin_write32(EMAC_ADDRLO, val)
-#define bfin_read_EMAC_ADDRHI()bfin_read32(EMAC_ADDRHI)
-#define bfin_write_EMAC_ADDRHI(val)bfin_write32(EMAC_ADDRHI, val)
-#define bfin_read_EMAC_HASHLO()bfin_read32(EMAC_HASHLO)
-#define bfin_write_EMAC_HASHLO(val)bfin_write32(EMAC_HASHLO, val)
-#define bfin_read_EMAC_HASHHI()bfin_read32(EMAC_HASHHI)
-#define bfin_write_EMAC_HASHHI(val)bfin_write32(EMAC_HASHHI, val)
-#define bfin_read_EMAC_STAADD()bfin_read32(EMAC_STAADD)
-#defin

[U-Boot] [PATCH 19/37] Blackfin: move CONFIG_BFIN_CPU to board config.mk

2010-10-02 Thread Mike Frysinger
The CONFIG_BFIN_CPU option is largely used in the build system, so move
it out of the board config.h and into the board config.mk.  It'd be nice
to keep everything in the config.h, but the patch to extract that value
early was rejected.

Signed-off-by: Mike Frysinger 
---
 arch/blackfin/config.mk |4 +---
 arch/blackfin/include/asm/config.h  |5 -
 arch/blackfin/lib/board.c   |2 +-
 board/bf518f-ezbrd/config.mk|2 ++
 board/bf526-ezbrd/config.mk |2 ++
 board/bf527-ad7160-eval/config.mk   |2 ++
 board/bf527-ezkit/config.mk |2 ++
 board/bf533-ezkit/config.mk |2 ++
 board/bf533-stamp/config.mk |2 ++
 board/bf537-minotaur/config.mk  |2 ++
 board/bf537-pnav/config.mk  |2 ++
 board/bf537-srv1/config.mk  |2 ++
 board/bf537-stamp/config.mk |2 ++
 board/bf538f-ezkit/config.mk|2 ++
 board/bf548-ezkit/config.mk |2 ++
 board/bf561-acvilon/config.mk   |2 ++
 board/bf561-ezkit/config.mk |2 ++
 board/blackstamp/config.mk  |2 ++
 board/cm-bf527/config.mk|2 ++
 board/cm-bf533/config.mk|2 ++
 board/cm-bf537e/config.mk   |2 ++
 board/cm-bf537u/config.mk   |2 ++
 board/cm-bf548/config.mk|2 ++
 board/cm-bf561/config.mk|2 ++
 board/ibf-dsp561/config.mk  |2 ++
 board/ip04/config.mk|2 ++
 board/tcm-bf518/config.mk   |2 ++
 board/tcm-bf537/config.mk   |2 ++
 include/configs/bf518f-ezbrd.h  |1 -
 include/configs/bf526-ezbrd.h   |1 -
 include/configs/bf527-ad7160-eval.h |1 -
 include/configs/bf527-ezkit.h   |1 -
 include/configs/bf533-ezkit.h   |1 -
 include/configs/bf533-stamp.h   |1 -
 include/configs/bf537-minotaur.h|1 -
 include/configs/bf537-pnav.h|1 -
 include/configs/bf537-srv1.h|1 -
 include/configs/bf537-stamp.h   |1 -
 include/configs/bf538f-ezkit.h  |1 -
 include/configs/bf548-ezkit.h   |1 -
 include/configs/bf561-acvilon.h |1 -
 include/configs/bf561-ezkit.h   |1 -
 include/configs/blackstamp.h|1 -
 include/configs/cm-bf527.h  |1 -
 include/configs/cm-bf533.h  |1 -
 include/configs/cm-bf537e.h |1 -
 include/configs/cm-bf537u.h |1 -
 include/configs/cm-bf548.h  |1 -
 include/configs/cm-bf561.h  |1 -
 include/configs/ibf-dsp561.h|1 -
 include/configs/ip04.h  |1 -
 include/configs/tcm-bf518.h |1 -
 include/configs/tcm-bf537.h |1 -
 53 files changed, 52 insertions(+), 34 deletions(-)

diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 137834e..e531edb 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -25,7 +25,6 @@ CROSS_COMPILE ?= bfin-uclinux-
 
 STANDALONE_LOAD_ADDR = 0x1000 -m elf32bfin
 
-CONFIG_BFIN_CPU := $(strip $(subst ",,$(CONFIG_BFIN_CPU)))
 CONFIG_BFIN_BOOT_MODE := $(strip $(subst ",,$(CONFIG_BFIN_BOOT_MODE)))
 CONFIG_ENV_OFFSET := $(strip $(subst ",,$(CONFIG_ENV_OFFSET)))
 CONFIG_ENV_SIZE := $(strip $(subst ",,$(CONFIG_ENV_SIZE)))
@@ -36,9 +35,8 @@ PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
 LDFLAGS += --gc-sections -m elf32bfin
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 
-ifneq (,$(CONFIG_BFIN_CPU))
+PLATFORM_CPPFLAGS += -DBFIN_CPU='"$(CONFIG_BFIN_CPU)"'
 PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU)
-endif
 
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
 ALL += $(obj)u-boot.ldr
diff --git a/arch/blackfin/include/asm/config.h 
b/arch/blackfin/include/asm/config.h
index 7455685..215e0f2 100644
--- a/arch/blackfin/include/asm/config.h
+++ b/arch/blackfin/include/asm/config.h
@@ -9,11 +9,6 @@
 #ifndef __ASM_BLACKFIN_CONFIG_POST_H__
 #define __ASM_BLACKFIN_CONFIG_POST_H__
 
-/* Sanity check CONFIG_BFIN_CPU */
-#ifndef CONFIG_BFIN_CPU
-# error CONFIG_BFIN_CPU: your board config needs to define this
-#endif
-
 #ifndef CONFIG_BFIN_SCRATCH_REG
 # define CONFIG_BFIN_SCRATCH_REG retn
 #endif
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index 7643250..94fbbfe 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -254,7 +254,7 @@ void board_init_f(ulong bootflag)
memset((void *)bd, 0, sizeof(bd_t));
 
bd->bi_r_version = version_string;
-   bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
+   bd->bi_cpu = BFIN_CPU;
bd->bi_board_name = BFIN_BOARD_NAME;
bd->bi_vco = get_vco();
bd->bi_cclk = get_cclk();
diff --git a/board/bf518f-ezbrd/config.mk b/board/bf518f-ezbrd/config.mk
index 3f9d41f..30b92a3 100644
--- a/board/bf518f-ezbrd/config.mk
+++ b/board/bf518f-ezbrd/config.mk
@@ -26,6 +26,8 @@
 # This is not actually used for Blackfin boards so do not change it
 #TEXT_BASE = do-not-use-me
 
+CONFIG_BFIN_CPU = bf518-0

[U-Boot] [PATCH 22/37] Blackfin: adi config: add an "all spi flashes" option to unify board lists

2010-10-02 Thread Mike Frysinger
Signed-off-by: Mike Frysinger 
---
 include/configs/bf533-stamp.h |5 +
 include/configs/bf537-stamp.h |5 +
 include/configs/bf538f-ezkit.h|5 +
 include/configs/bfin_adi_common.h |   12 
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
index b8cea99..03bc811 100644
--- a/include/configs/bf533-stamp.h
+++ b/include/configs/bf533-stamp.h
@@ -92,10 +92,7 @@
 #define CONFIG_ENV_SPI_MAX_HZ  3000
 #define CONFIG_SF_DEFAULT_SPEED3000
 #define CONFIG_SPI_FLASH
-#define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SPI_FLASH_SPANSION
-#define CONFIG_SPI_FLASH_STMICRO
-#define CONFIG_SPI_FLASH_WINBOND
+#define CONFIG_SPI_FLASH_ALL
 
 
 /*
diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h
index 60087da..22d3150 100644
--- a/include/configs/bf537-stamp.h
+++ b/include/configs/bf537-stamp.h
@@ -88,10 +88,7 @@
 #define CONFIG_ENV_SPI_MAX_HZ  3000
 #define CONFIG_SF_DEFAULT_SPEED3000
 #define CONFIG_SPI_FLASH
-#define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SPI_FLASH_SPANSION
-#define CONFIG_SPI_FLASH_STMICRO
-#define CONFIG_SPI_FLASH_WINBOND
+#define CONFIG_SPI_FLASH_ALL
 
 
 /*
diff --git a/include/configs/bf538f-ezkit.h b/include/configs/bf538f-ezkit.h
index 1d47564..04ba210 100644
--- a/include/configs/bf538f-ezkit.h
+++ b/include/configs/bf538f-ezkit.h
@@ -85,10 +85,7 @@
 #define CONFIG_ENV_SPI_MAX_HZ  3000
 #define CONFIG_SF_DEFAULT_SPEED3000
 #define CONFIG_SPI_FLASH
-#define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SPI_FLASH_SPANSION
-#define CONFIG_SPI_FLASH_STMICRO
-#define CONFIG_SPI_FLASH_WINBOND
+#define CONFIG_SPI_FLASH_ALL
 
 
 /*
diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 91dcacc..bf3952c 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -255,6 +255,18 @@
 #endif
 
 /*
+ * SPI Settings
+ */
+#ifdef CONFIG_SPI_FLASH_ALL
+# define CONFIG_SPI_FLASH_ATMEL
+# define CONFIG_SPI_FLASH_MACRONIX
+# define CONFIG_SPI_FLASH_SPANSION
+# define CONFIG_SPI_FLASH_SST
+# define CONFIG_SPI_FLASH_STMICRO
+# define CONFIG_SPI_FLASH_WINBOND
+#endif
+
+/*
  * I2C Settings
  */
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 20/37] Blackfin: cmd_gpio: document/extend input sub-option

2010-10-02 Thread Mike Frysinger
The input sub command was missing from the help text, and it didn't show
the actual value currently read on the GPIO.  This allows people to read
the value of input pins.

Signed-off-by: Mike Frysinger 
---
 arch/blackfin/cpu/cmd_gpio.c |   27 +--
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/blackfin/cpu/cmd_gpio.c b/arch/blackfin/cpu/cmd_gpio.c
index 4430c90..5988da7 100644
--- a/arch/blackfin/cpu/cmd_gpio.c
+++ b/arch/blackfin/cpu/cmd_gpio.c
@@ -90,20 +90,19 @@ int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
gpio_request(gpio, "cmd_gpio");
 
/* finally, let's do it: set direction and exec command */
+   ulong value;
if (sub_cmd == GPIO_INPUT) {
gpio_direction_input(gpio);
-   printf("gpio: pin %lu on port %c set to input\n", pin, 
*str_pin);
-   return 0;
-   }
-
-   ulong value;
-   switch (sub_cmd) {
-   case GPIO_SET:value = 1; break;
-   case GPIO_CLEAR:  value = 0; break;
-   case GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
-   default:  goto show_usage;
+   value = gpio_get_value(gpio);
+   } else {
+   switch (sub_cmd) {
+   case GPIO_SET:value = 1; break;
+   case GPIO_CLEAR:  value = 0; break;
+   case GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
+   default:  goto show_usage;
+   }
+   gpio_direction_output(gpio, value);
}
-   gpio_direction_output(gpio, value);
printf("gpio: pin %lu on port %c (gpio %lu) value is %lu\n",
pin, *str_pin, gpio, value);
 
@@ -113,6 +112,6 @@ int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 }
 
 U_BOOT_CMD(gpio, 3, 0, do_gpio,
-   "set/clear/toggle gpio output pins",
-   " \n"
-   "- set/clear/toggle the specified pin (e.g. PF10)");
+   "input/set/clear/toggle gpio output pins",
+   " \n"
+   "- input/set/clear/toggle the specified pin (e.g. PF10)");
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 25/37] Blackfin: cmd_gpio: return gpio value to caller

2010-10-02 Thread Mike Frysinger
Make the GPIO command usable in a scripting environment by returning
the GPIO value rather than always 0.

Signed-off-by: Mike Frysinger 
---
 arch/blackfin/cpu/cmd_gpio.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/cpu/cmd_gpio.c b/arch/blackfin/cpu/cmd_gpio.c
index 5988da7..3e7ba0a 100644
--- a/arch/blackfin/cpu/cmd_gpio.c
+++ b/arch/blackfin/cpu/cmd_gpio.c
@@ -108,7 +108,7 @@ int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
gpio_free(gpio);
 
-   return 0;
+   return value;
 }
 
 U_BOOT_CMD(gpio, 3, 0, do_gpio,
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 24/37] Blackfin: bf527-sdp: new board port

2010-10-02 Thread Mike Frysinger
Support for the Blackfin System Development Platform (SDP) base module.

Signed-off-by: Mike Frysinger 
---
 MAINTAINERS |1 +
 board/bf527-sdp/Makefile|   54 +++
 board/bf527-sdp/bf527-sdp.c |   32 +++
 board/bf527-sdp/config.mk   |   36 +
 boards.cfg  |1 +
 include/configs/bf527-sdp.h |  121 +++
 6 files changed, 245 insertions(+), 0 deletions(-)
 create mode 100644 board/bf527-sdp/Makefile
 create mode 100644 board/bf527-sdp/bf527-sdp.c
 create mode 100644 board/bf527-sdp/config.mk
 create mode 100644 include/configs/bf527-sdp.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 2cf29dd..b0cc825 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -993,6 +993,7 @@ Blackfin Team 
BF526-EZBRD BF526
BF527-EZKIT BF527
BF527-EZKIT-V2  BF527
+   BF527-SDP   BF527
BF533-EZKIT BF533
BF533-STAMP BF533
BF537-PNAV  BF537
diff --git a/board/bf527-sdp/Makefile b/board/bf527-sdp/Makefile
new file mode 100644
index 000..f2bd2c2
--- /dev/null
+++ b/board/bf527-sdp/Makefile
@@ -0,0 +1,54 @@
+#
+# U-boot - Makefile
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS-y:= $(BOARD).o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/bf527-sdp/bf527-sdp.c b/board/bf527-sdp/bf527-sdp.c
new file mode 100644
index 000..504869d
--- /dev/null
+++ b/board/bf527-sdp/bf527-sdp.c
@@ -0,0 +1,32 @@
+/*
+ * U-boot - main board file
+ *
+ * Copyright (c) 2010 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int checkboard(void)
+{
+   printf("Board: ADI BF527 SDP board\n");
+   printf("   Support: http://blackfin.uclinux.org/\n";);
+
+   /* Enable access to parallel flash */
+   gpio_request(GPIO_PG0, "parallel-flash");
+   gpio_direction_output(GPIO_PG0, 0);
+
+   return 0;
+}
+
+int misc_init_r(void)
+{
+   /* CLKIN Buffer Output Enable */
+   bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE);
+
+   return 0;
+}
diff --git a/board/bf527-sdp/config.mk b/board/bf527-sdp/config.mk
new file mode 100644
index 000..744e7a5
--- /dev/null
+++ b/board/bf527-sdp/config.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+# This is not actually used for Blackfin boards so do not change it
+#TEXT_BASE = do-not-use-me
+
+CONFIG_BFIN_CPU = bf527-0.2
+
+CFLAGS_lib_generic += -O2
+CFLAGS_lzma += -O2
+
+# Set some default LDR flags based on boot mode.
+LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 

[U-Boot] [PATCH 23/37] Blackfin: adi config: add a hook for boards to append the env

2010-10-02 Thread Mike Frysinger
Signed-off-by: Mike Frysinger 
---
 include/configs/bfin_adi_common.h |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index bf3952c..55b8b0b 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -231,10 +231,14 @@
 #else
 # define NETWORK_ENV_SETTINGS
 #endif
+#ifndef BOARD_ENV_SETTINGS
+# define BOARD_ENV_SETTINGS
+#endif
 #define CONFIG_EXTRA_ENV_SETTINGS \
NAND_ENV_SETTINGS \
NETWORK_ENV_SETTINGS \
-   FLASHBOOT_ENV_SETTINGS
+   FLASHBOOT_ENV_SETTINGS \
+   BOARD_ENV_SETTINGS
 
 /*
  * Network Settings
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 26/37] Blackfin: adi config: allow boards to tweak a little more

2010-10-02 Thread Mike Frysinger
Let people easily override bootdelay and network settings.

Signed-off-by: Mike Frysinger 
---
 include/configs/bfin_adi_common.h |   22 ++
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 55b8b0b..22312f5 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -119,10 +119,12 @@
 /*
  * Env Settings
  */
-#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART)
-# define CONFIG_BOOTDELAY  -1
-#else
-# define CONFIG_BOOTDELAY  5
+#ifndef CONFIG_BOOTDELAY
+# if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART)
+#  define CONFIG_BOOTDELAY -1
+# else
+#  define CONFIG_BOOTDELAY 5
+# endif
 #endif
 #ifndef CONFIG_BOOTCOMMAND
 # define CONFIG_BOOTCOMMAND"run ramboot"
@@ -244,11 +246,15 @@
  * Network Settings
  */
 #ifdef CONFIG_CMD_NET
-# define CONFIG_IPADDR 192.168.0.15
 # define CONFIG_NETMASK255.255.255.0
-# define CONFIG_GATEWAYIP  192.168.0.1
-# define CONFIG_SERVERIP   192.168.0.2
-# define CONFIG_ROOTPATH   /romfs
+# ifndef CONFIG_IPADDR
+#  define CONFIG_IPADDR192.168.0.15
+#  define CONFIG_GATEWAYIP 192.168.0.1
+#  define CONFIG_SERVERIP  192.168.0.2
+# endif
+# ifndef CONFIG_ROOTPATH
+#  define CONFIG_ROOTPATH  /romfs
+# endif
 # ifdef CONFIG_CMD_DHCP
 #  ifndef CONFIG_SYS_AUTOLOAD
 #   define CONFIG_SYS_AUTOLOAD "no"
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 21/37] Blackfin: support a 3rd gpio cfi pin

2010-10-02 Thread Mike Frysinger
From: Peter Meerwald 

Signed-off-by: Peter Meerwald 
Signed-off-by: Mike Frysinger 
---
 board/cm-bf537e/gpio_cfi_flash.c |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/board/cm-bf537e/gpio_cfi_flash.c b/board/cm-bf537e/gpio_cfi_flash.c
index ab6af81..1075cc4 100644
--- a/board/cm-bf537e/gpio_cfi_flash.c
+++ b/board/cm-bf537e/gpio_cfi_flash.c
@@ -22,7 +22,12 @@
 #else
 #define GPIO_MASK_2 (1 << 22)
 #endif
-#define GPIO_MASK   (GPIO_MASK_1 | GPIO_MASK_2)
+#ifndef GPIO_PIN_3
+#define GPIO_MASK_3 (0)
+#else
+#define GPIO_MASK_3 (1 << 23)
+#endif
+#define GPIO_MASK   (GPIO_MASK_1 | GPIO_MASK_2 | GPIO_MASK_3)
 
 void *gpio_cfi_flash_swizzle(void *vaddr)
 {
@@ -34,6 +39,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
 #endif
 
+#ifdef GPIO_PIN_3
+   gpio_set_value(GPIO_PIN_3, addr & GPIO_MASK_3);
+#endif
+
SSYNC();
udelay(1);
 
@@ -65,4 +74,8 @@ void gpio_cfi_flash_init(void)
gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
gpio_direction_output(GPIO_PIN_2, 0);
 #endif
+#ifdef GPIO_PIN_3
+   gpio_request(GPIO_PIN_3, "gpio_cfi_flash");
+   gpio_direction_output(GPIO_PIN_3, 0);
+#endif
 }
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 27/37] Blackfin: bct-brettl2: new board port

2010-10-02 Thread Mike Frysinger
From: Peter Meerwald 

Signed-off-by: Peter Meerwald 
Signed-off-by: Mike Frysinger 
---
 MAINTAINERS|4 +
 board/bct-brettl2/Makefile |   51 +++
 board/bct-brettl2/bct-brettl2.c|  123 +
 board/bct-brettl2/cled.c   |   32 +++
 board/bct-brettl2/config.mk|   35 +++
 board/bct-brettl2/gpio_cfi_flash.c |4 +
 board/bct-brettl2/smsc9303.c   |  176 
 board/bct-brettl2/smsc9303.h   |9 ++
 boards.cfg |1 +
 include/configs/bct-brettl2.h  |  155 +++
 10 files changed, 590 insertions(+), 0 deletions(-)
 create mode 100644 board/bct-brettl2/Makefile
 create mode 100644 board/bct-brettl2/bct-brettl2.c
 create mode 100644 board/bct-brettl2/cled.c
 create mode 100644 board/bct-brettl2/config.mk
 create mode 100644 board/bct-brettl2/gpio_cfi_flash.c
 create mode 100644 board/bct-brettl2/smsc9303.c
 create mode 100644 board/bct-brettl2/smsc9303.h
 create mode 100644 include/configs/bct-brettl2.h

diff --git a/MAINTAINERS b/MAINTAINERS
index b0cc825..d6a701d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1041,6 +1041,10 @@ Brent Kandetzki 
 
IP04BF532
 
+Peter Meerwald 
+
+   bct-brettl2 BF536
+
 #
 # End of MAINTAINERS list  #
 #
diff --git a/board/bct-brettl2/Makefile b/board/bct-brettl2/Makefile
new file mode 100644
index 000..cf99d29
--- /dev/null
+++ b/board/bct-brettl2/Makefile
@@ -0,0 +1,51 @@
+#
+# U-boot - Makefile
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS-y:= $(BOARD).o gpio_cfi_flash.o cled.o
+COBJS-$(CONFIG_BFIN_MAC) += smsc9303.o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
diff --git a/board/bct-brettl2/bct-brettl2.c b/board/bct-brettl2/bct-brettl2.c
new file mode 100644
index 000..de5b9ff
--- /dev/null
+++ b/board/bct-brettl2/bct-brettl2.c
@@ -0,0 +1,123 @@
+/*
+ * U-boot - main board file for BCT brettl2
+ *
+ * Copyright (c) 2010 BCT Electronic GmbH
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "../cm-bf537e/gpio_cfi_flash.h"
+#include "smsc9303.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int checkboard(void)
+{
+   printf("Board: bct-brettl2 board\n");
+   printf("   Support: http://www.bct-electronic.com/\n";);
+   return 0;
+}
+
+#ifdef CONFIG_BFIN_MAC
+static void board_init_enetaddr(uchar *mac_addr)
+{
+   puts("Warning: Generating 'random' MAC address\n");
+   bfin_gen_rand_mac(mac_addr);
+   eth_setenv_enetaddr("ethaddr", mac_addr);
+}
+
+int board_eth_init(bd_t *bis)
+{
+   int retry = 3;
+   int ret;
+
+   ret = bfin_EMAC_initialize(bis);
+
+   uchar enetaddr[6];
+   if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+   printf("setting MAC %pM\n", enetaddr);
+   }
+   puts("   ");
+
+   puts("initialize SMSC LAN9303i ethernet switch\n");
+
+   while (retry-- > 0) {
+   if (init_smsc9303i_mii())
+   return ret;
+   }
+
+   return ret;
+}
+#endif
+
+static void init_tlv320aic31(void)
+{
+   puts("Audio: setup TIMER0 to enable 16.384 MHz clock for 
tlv320aic31\n");
+   peripheral_request(P_TMR0, "tlv320aic31 clock");
+   bfin_write_TIMER0_CONFIG(0x020d);
+   bfin_write_TIMER0_PERIOD(0x0008);
+   bfin_w

[U-Boot] [PATCH 28/37] Blackfin: adi config: enable nand lock/unlock support

2010-10-02 Thread Mike Frysinger
We use the lock/unlock options in our default nand code, so enabl
support for the options.

Reported-by: Vivi Li 
Signed-off-by: Mike Frysinger 
---
 include/configs/bfin_adi_common.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 22312f5..3e9f3b2 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -47,6 +47,7 @@
 # endif
 # if defined(CONFIG_NAND_PLAT) || defined(CONFIG_DRIVER_NAND_BFIN)
 #  define CONFIG_CMD_NAND
+#  define CONFIG_CMD_NAND_LOCK_UNLOCK
 # endif
 # ifdef CONFIG_POST
 #  define CONFIG_CMD_DIAG
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 29/37] Blackfin: bf526-ezbrd: enable BootROM-OOB layout when booting from NAND

2010-10-02 Thread Mike Frysinger
We need to use the Blackfin BootROM-specific OOB layout when we boot out
of NAND as that is what the on-chip ROM expects.

Also need to increase the monitor size a little to accommodate the extra
NAND code overhead.

Signed-off-by: Mike Frysinger 
---
 include/configs/bf526-ezbrd.h |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h
index eeca9ca..4c30c25 100644
--- a/include/configs/bf526-ezbrd.h
+++ b/include/configs/bf526-ezbrd.h
@@ -52,7 +52,7 @@
 #define CONFIG_EBIU_AMBCTL0_VAL(B1WAT_15 | B1RAT_15 | B1HT_3 | 
B1RDYPOL | B0WAT_15 | B0RAT_15 | B0HT_3 | B0RDYPOL)
 #define CONFIG_EBIU_AMBCTL1_VAL(B3WAT_15 | B3RAT_15 | B3HT_3 | 
B3RDYPOL | B2WAT_15 | B2RAT_15 | B2HT_3 | B2RDYPOL)
 
-#define CONFIG_SYS_MONITOR_LEN (512 * 1024)
+#define CONFIG_SYS_MONITOR_LEN (768 * 1024)
 #define CONFIG_SYS_MALLOC_LEN  (512 * 1024)
 
 
@@ -61,7 +61,8 @@
  * (can't be used same time as ethernet)
  */
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
-#define CONFIG_BFIN_NFC
+# define CONFIG_BFIN_NFC
+# define CONFIG_BFIN_NFC_BOOTROM_ECC
 #endif
 #ifdef CONFIG_BFIN_NFC
 #define CONFIG_BFIN_NFC_CTL_VAL0x0033
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 30/37] Blackfin: cmd_gpio: accept upper case pin names

2010-10-02 Thread Mike Frysinger
The intention all along was to accept pin names irrelevant of their case.
But I guess I forgot to test/implement support for that.

Signed-off-by: Mike Frysinger 
---
 arch/blackfin/cpu/cmd_gpio.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/blackfin/cpu/cmd_gpio.c b/arch/blackfin/cpu/cmd_gpio.c
index 3e7ba0a..e96413b 100644
--- a/arch/blackfin/cpu/cmd_gpio.c
+++ b/arch/blackfin/cpu/cmd_gpio.c
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -45,8 +46,8 @@ int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
/* grab the [p] portion */
ulong port_base;
-   if (*str_pin == 'p') ++str_pin;
-   switch (*str_pin) {
+   if (tolower(*str_pin) == 'p') ++str_pin;
+   switch (tolower(*str_pin)) {
 #ifdef GPIO_PA0
case 'a': port_base = GPIO_PA0; break;
 #endif
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 31/37] Blackfin: propagate target cpu defines when building embedded env

2010-10-02 Thread Mike Frysinger
Since we're no longer extracting the env from the target ELF file (since
upstream wouldn't take that change), we're back to the problem of cpu
defines not properly propagating to the env setup stage.  So the embedded
env built by the host compiler doesn't match the one that is linked into
the u-boot env.

Reported-by: Vivi Li 
Signed-off-by: Mike Frysinger 
---
 arch/blackfin/config.mk |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index e531edb..a330084 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -43,6 +43,9 @@ ALL += $(obj)u-boot.ldr
 endif
 ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y)
 CREATE_LDR_ENV = $(obj)tools/envcrc --binary > $(obj)env-ldr.o
+HOSTCFLAGS_NOPED += \
+   $(shell $(CPP) -dD - -mcpu=$(CONFIG_BFIN_CPU) http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 33/37] Blackfin: fix MMC init output alignment

2010-10-02 Thread Mike Frysinger
Signed-off-by: Mike Frysinger 
---
 arch/blackfin/lib/board.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index 94fbbfe..fcfd174 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -351,7 +351,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
 #endif
 
 #ifdef CONFIG_GENERIC_MMC
-   puts("MMC:  ");
+   puts("MMC:   ");
mmc_initialize(bd);
 #endif
 
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 32/37] Blackfin: blackvme: new board port

2010-10-02 Thread Mike Frysinger
From: Wojtek Skulski 

The board includes:
 * ADSP-BF561 rev. 0.5
 * 32-bit SDRAM (2 * MT48LC16M16A2TG or MT48LC32M16A2TG)
 * Gigabit Ether AX88180 (ASIX) + 88E rev. B2 (Marvell)
 * SPI  boot flash on PF2 (M25P64 8MB, or M25P128 16 MB)
 * FPGA boot flash on PF3 (M25P64 8MB, or M25P128 16 MB)
 * Spartan6-LX150 (memory-mapped; both PPIs also connected)
 * See http://www.skutek.com/

Signed-off-by: Wojtek Skulski 
Signed-off-by: Mike Frysinger 
---
 MAINTAINERS|5 +-
 board/blackvme/Makefile|   54 ++
 board/blackvme/blackvme.c  |   31 ++
 board/blackvme/config.mk   |   32 ++
 boards.cfg |1 +
 include/configs/blackvme.h |  246 
 6 files changed, 368 insertions(+), 1 deletions(-)
 create mode 100644 board/blackvme/Makefile
 create mode 100644 board/blackvme/blackvme.c
 create mode 100644 board/blackvme/config.mk
 create mode 100644 include/configs/blackvme.h

diff --git a/MAINTAINERS b/MAINTAINERS
index d6a701d..4b23c83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1023,9 +1023,12 @@ Blackfin Team 
BF537-srv1  BF537
 
 Wojtek Skulski 
+Wojtek Skulski 
+Blackfin Team 
 Benjamin Matthews 
 
-   BLACKSTAMP  BF532
+   BlackStamp  BF533
+   BlackVMEBF561
 
 I-SYST Micromodule 
 Blackfin Team 
diff --git a/board/blackvme/Makefile b/board/blackvme/Makefile
new file mode 100644
index 000..f2bd2c2
--- /dev/null
+++ b/board/blackvme/Makefile
@@ -0,0 +1,54 @@
+#
+# U-boot - Makefile
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS-y:= $(BOARD).o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/blackvme/blackvme.c b/board/blackvme/blackvme.c
new file mode 100644
index 000..eccdaf3
--- /dev/null
+++ b/board/blackvme/blackvme.c
@@ -0,0 +1,31 @@
+/* U-boot - blackvme.c  board specific routines
+ * (c) Wojtek Skulski 2010 i...@skutek.com
+ * Board info: http://www.skutek.com
+ * Copyright (c) 2005-2009 Analog Devices Inc.
+ *
+ * (C) Copyright 2000-2004
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include 
+#include 
+
+int checkboard(void)
+{
+   printf("Board: BlackVME\n");
+   printf("Support: http://www.skutek.com/\n";);
+   return 0;
+}
+
+#ifdef CONFIG_DRIVER_AX88180
+/*
+ * The ax88180 driver had to be patched to work around a bug
+ * in Marvell 88E B2 silicon. E-mail me for explanations.
+ */
+int board_eth_init(bd_t *bis)
+{
+   return ax88180_initialize(bis);
+}
+#endif /* CONFIG_DRIVER_AX88180 */
diff --git a/board/blackvme/config.mk b/board/blackvme/config.mk
new file mode 100644
index 000..8d0fe39
--- /dev/null
+++ b/board/blackvme/config.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2005-2008 Analog Device Inc.
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have rece

[U-Boot] [PATCH 35/37] Blackfin: bf527-ad7160-eval: fix GPIO CS define

2010-10-02 Thread Mike Frysinger
Rather than use a hardcoded "7", use the new Blackfin global define.

Signed-off-by: Mike Frysinger 
---
 include/configs/bf527-ad7160-eval.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/bf527-ad7160-eval.h 
b/include/configs/bf527-ad7160-eval.h
index fbcf019..14ade1b 100644
--- a/include/configs/bf527-ad7160-eval.h
+++ b/include/configs/bf527-ad7160-eval.h
@@ -129,7 +129,7 @@
 #define CONFIG_MMC
 #define CONFIG_CMD_EXT2
 #define CONFIG_SPI_MMC
-#define CONFIG_SPI_MMC_DEFAULT_CS (7 + GPIO_PH3)
+#define CONFIG_SPI_MMC_DEFAULT_CS (MAX_CTRL_CS + GPIO_PH3)
 
 
 /*
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 36/37] Blackfin: bf537-pnav: increase monitor len

2010-10-02 Thread Mike Frysinger
Building this board for parallel flash fills up the bss section and thus
fails to link, so bump up the monitor size a bit.

Signed-off-by: Mike Frysinger 
---
 include/configs/bf537-pnav.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/bf537-pnav.h b/include/configs/bf537-pnav.h
index 30607d9..730ae27 100644
--- a/include/configs/bf537-pnav.h
+++ b/include/configs/bf537-pnav.h
@@ -51,7 +51,7 @@
 #define CONFIG_EBIU_AMBCTL0_VAL0x7BB033B0
 #define CONFIG_EBIU_AMBCTL1_VAL0xFFC27BB0
 
-#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
+#define CONFIG_SYS_MONITOR_LEN (512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN  (128 * 1024)
 
 
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 34/37] Blackfin: bf548-ezkit: bump SPI flash size up

2010-10-02 Thread Mike Frysinger
The current size used (256KiB) is smaller than the LDR created for
the bf548-ezkit, so 'run update' doesn't work correctly.  So bump
up the size a bit by making this flexible per-board config.

Signed-off-by: Mike Frysinger 
---
 include/configs/bf548-ezkit.h |1 +
 include/configs/bfin_adi_common.h |5 -
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/configs/bf548-ezkit.h b/include/configs/bf548-ezkit.h
index d299dc1..4412177 100644
--- a/include/configs/bf548-ezkit.h
+++ b/include/configs/bf548-ezkit.h
@@ -182,6 +182,7 @@
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE1
+#define CONFIG_BFIN_SPI_IMG_SIZE 0x5
 
 #ifndef __ADSPBF542__
 /* Don't waste time transferring a logo over the UART */
diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 3e9f3b2..608788a 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -172,9 +172,12 @@
 #   define UBOOT_ENV_UPDATE \
"eeprom write $(loadaddr) 0x0 $(filesize)"
 #  else
+#   ifndef CONFIG_BFIN_SPI_IMG_SIZE
+#define CONFIG_BFIN_SPI_IMG_SIZE 0x4
+#   endif
 #   define UBOOT_ENV_UPDATE \
"sf probe " MK_STR(BFIN_BOOT_SPI_SSEL) ";" \
-   "sf erase 0 0x4;" \
+   "sf erase 0 " MK_STR(CONFIG_BFIN_SPI_IMG_SIZE) ";" \
"sf write $(loadaddr) 0 $(filesize)"
 #  endif
 # elif (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 37/37] Blackfin: otp: fix build after constification of args[]

2010-10-02 Thread Mike Frysinger
The OTP code does a little shuffling of arguments that aren't really
necessary, so use a local variable instead to fix build errors now
that the args[] parameter is const.

Signed-off-by: Mike Frysinger 
---
 common/cmd_otp.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/common/cmd_otp.c b/common/cmd_otp.c
index 56f08e0..eb93eb2 100644
--- a/common/cmd_otp.c
+++ b/common/cmd_otp.c
@@ -82,6 +82,7 @@ static void set_otp_timing(bool write)
 
 int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+   char *cmd;
uint32_t ret, base_flags;
bool prompt_user, force_read;
uint32_t (*otp_func)(uint32_t page, uint32_t flags, uint64_t 
*page_content);
@@ -93,21 +94,21 @@ int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
prompt_user = false;
base_flags = 0;
-   if (!strcmp(argv[1], "read"))
+   cmd = argv[1];
+   if (!strcmp(cmd, "read"))
otp_func = bfrom_OtpRead;
-   else if (!strcmp(argv[1], "dump")) {
+   else if (!strcmp(cmd, "dump")) {
otp_func = bfrom_OtpRead;
force_read = true;
-   } else if (!strcmp(argv[1], "write")) {
+   } else if (!strcmp(cmd, "write")) {
otp_func = bfrom_OtpWrite;
base_flags = OTP_CHECK_FOR_PREV_WRITE;
if (!strcmp(argv[2], "--force")) {
-   argv[2] = argv[1];
argv++;
--argc;
} else
prompt_user = false;
-   } else if (!strcmp(argv[1], "lock")) {
+   } else if (!strcmp(cmd, "lock")) {
if (argc != 4)
goto usage;
otp_func = bfrom_OtpWrite;
@@ -175,7 +176,7 @@ int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
}
 
printf("OTP memory %s: addr 0x%p  page 0x%03X  count %zu ... ",
-   argv[1], addr, page, count);
+   cmd, addr, page, count);
 
set_otp_timing(otp_func == bfrom_OtpWrite);
if (otp_func == bfrom_OtpWrite && check_voltage()) {
-- 
1.7.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Reinhard Meyer
Dear J. William Campbell,
> On 10/2/2010 3:17 AM, Joakim Tjernlund wrote:
>>> Hello Reinhard,
>>>
>>> Reinhard Meyer wrote:
 Dear Albert ARIBAUD,
>> I try to understand how the relocation process could handle pointers (to
>> functions or other data) in const or data sections.
>> Your code cannot know what is data and what is a pointer that needs
>> adjustment?
>>
>> Best Regards,
>> Reinhard
> Hi Reinhart,
>
> Short answer - the relocation process does not handle pointers inside
> data structures.
>
> And yes, this means the content arrays of pointers such as init_sequence
> is not relocated. Been there, done that, can give you one of the
>>> The init_sequence should not called anymore after relocation, as it is
>>> the init_sequence ... or?
>>>
> tee-shirts I got :)
>
> ATM I have not found a way to fix this, except making the code which
> uses the pointers aware that the are location-sensitive and fix them
> when using them.
 That means that things like this cannot work (with relocation),
 unless adding the relocation offset before using the pointer:
>>> Yep, you have to fix these pointers after relocation ...
>>>
 const struct {
 const u8 shift;
 const u8 idcode;
 struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
 } flashes[] = {
 #ifdef CONFIG_SPI_FLASH_SPANSION
 { 0, 0x01, spi_flash_probe_spansion, },
 #endif
>>> [...]
 #ifdef CONFIG_SPI_FRAM_RAMTRON
 { 6, 0xc2, spi_fram_probe_ramtron, },
 # ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
 { 0, 0xff, spi_fram_probe_ramtron, },
 # endif
 # undef IDBUF_LEN
 # define IDBUF_LEN 9 /* we need to read 6+3 bytes */
 #endif
 };

 And I think there are more places of this type in u-boot...
>>> Yes, maybe. But relocation as I did for arm, also works
>>> on m68k, sparc, mips, avr32 and they must do also this
>>> fixups, so for common functions (except the new env handling,
>>> which I think got never tested on this architectures?) should
>>> work ...
>> This pointer problem is solved with the fixup relocs on ppc and
>> should work without manual relocation. I think this is a ppc
>> only extension but I might be wrong.
>
> Hi All,
> You are correct that this is a ppc only extension. As such, it is not a good 
> candidate for "general" use.
>
>> I believe that the other alternative is to do it as x86 does
>> which I think is the general way which should work on any arch.
>> Graem Russ would know better.
>>
> Almost exactly a year ago, this was all pretty much presented by Graeme in 
> the threads
> Relocation size penalty calculation (October 14, 2009)
> i386 Relocation (November 24, 2009)
>
> Using the full relocation scheme eliminates the need for all these "fixups" 
> in u-boot C code. I think this is a very desirable result.
> It is also not clear to me that hard coding in the relocation as several C 
> routines will produce a u-boot that is "smaller" than the one produced by 
> using normal ELF relocation. However, using full relocation creates an 
> environment that is true "C" and does not rely on people remembering that 
> they may have to fix up some parts of their code. It is hard to see much 
> downside in using the full relocation capability provided by Graeme's code.
> FWIW, the relocation code and data does not have to be moved into ram if 
> space is at a premium.

I agree here. _If_ relocation, it should work without hand-adding
fixup stuff to all functions using initialized data with pointers.
Even Wolfgang forgot to fixup his 2nd level command table in
cmd_nvedit.c ;)

And, for space concerns in flash, relocation should always be an
option on a board by board basis...

And as an idea, if position independent code is used, only pointers
in initialized data need adjustment. Cannot the linker emit a table
of addresses that need fixing?

Best Regards,
Reinhard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Albert ARIBAUD
Le 02/10/2010 22:39, Reinhard Meyer a écrit :

> And as an idea, if position independent code is used, only pointers
> in initialized data need adjustment. Cannot the linker emit a table
> of addresses that need fixing?

IIU Bill C, yes the linker can emit the information and the startup code 
could use this information instead of relying on hand-provided info; the 
linker file probably needs to be modified in order to provide such info. 
I intend to look into this, but feel free to do too.

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM relocation, question to Heiko

2010-10-02 Thread Graeme Russ
On 03/10/10 08:09, Albert ARIBAUD wrote:
> Le 02/10/2010 22:39, Reinhard Meyer a écrit :
> 
>> And as an idea, if position independent code is used, only pointers
>> in initialized data need adjustment. Cannot the linker emit a table
>> of addresses that need fixing?
> 
> IIU Bill C, yes the linker can emit the information and the startup code 
> could use this information instead of relying on hand-provided info; the 
> linker file probably needs to be modified in order to provide such info. 
> I intend to look into this, but feel free to do too.
> 

As mentioned previously, I have already done this for x86. The linker flags
used are -pic and --emit-relocs. The linker produces a section named
rel.dyn which needs to be processed but not loaded into RAM. rel.dyn
contains a simple list of address (within .text, .data, .rodata etc) each
of which need a simple adjustment equal to the relocation offset.

The size increase of the code + data loaded into RAM is 104012 bytes to
104296 bytes which is only 284 bytes or a mere 0.3% (which is negligible)
with an additional 22424 bytes in rel.dyn (22%) not loaded into RAM

The additional bonus is that .got is not referenced during run-time, so
there is no run-time performance penalty. However, the penalty of
processing 2803 relocation records at startup may not be wholly recovered
during a typical u-boot run-time session.

All this is for x86, and may not apply so neatly to other arches

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Troubles accessing a USB mass storage device

2010-10-02 Thread Ludovic Courtès
l...@gnu.org (Ludovic Courtès) writes:

> However, with a μSD card in, with a valid MS-DOS partition table, it
> apparently fails to read from it:
>
> Marvell>> usb part
> ## Unknown partition table

Further investigation with all the debugging output enabled shows that
it’s the ‘test unit ready’ command (0x0) that fails:

--8<---cut here---start->8---
COMMAND phase
dir 0 lun 0 cmdlen 12 cmd 0065c1c4 datalen 0 pdata 0065c478
cmd[0] 0x0 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x0 cmd[5] 0x0 cmd[6] 0x0 
cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0 
STATUS phase
ptr[0] 0x55 ptr[1] 0x53 ptr[2] 0x42 ptr[3] 0x53 ptr[4] 0x7e ptr[5] 0x0 ptr[6] 
0x0 ptr[7] 0x0 ptr[8] 0x0 ptr[9] 0x0 ptr[10] 0x0 ptr[11] 0x0 ptr[12] 0x1 
FAILED
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 0065c1c4 datalen 18 pdata 0065c1d4
cmd[0] 0x3 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x12 cmd[5] 0x0 cmd[6] 0x0 
cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0 
DATA phase
pdata[0] 0x70 pdata[1] 0x0 pdata[2] 0x2 pdata[3] 0x0 pdata[4] 0x0 pdata[5] 0x0 
pdata[6] 0x0 pdata[7] 0xa pdata[8] 0x0 pdata[9] 0x0 pdata[10] 0x0 pdata[11] 0x0 
pdata[12] 0x3a pdata[13] 0x0 pdata[14] 0x0 pdata[15] 0x0 pdata[16] 0x0 
pdata[17] 0x0 
STATUS phase
ptr[0] 0x55 ptr[1] 0x53 ptr[2] 0x42 ptr[3] 0x53 ptr[4] 0x7f ptr[5] 0x0 ptr[6] 
0x0 ptr[7] 0x0 ptr[8] 0x0 ptr[9] 0x0 ptr[10] 0x0 ptr[11] 0x0 ptr[12] 0x0 
Request Sense returned 02 3A 00
--8<---cut here---end--->8---

The request sense KCQ can be interpreted as ‘Not Ready - Medium Not
Present’, according to
, despite the fact
that the SD card is actually in (and Linux can successfully read from
it.)

The card reader has USB IDs 05e3:0726 (Genesys Logic).

Any idea how to go further?

Besides, ‘usb_request_sense’ and ‘usb_test_unit_ready’ both assume
LUN == 0.  Could it be a problem?

Thanks,
Ludo’.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 32/37] Blackfin: blackvme: new board port

2010-10-02 Thread Wojtek Skulski
Mike:

   thanks a lot.

Wojetk

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] u-boot cannot jump to board_init_f

2010-10-02 Thread sywang
Hi, 

Do you get the following problem while porting the u-boot for CN50XX? 

U-boot cannot jump to board_init_f.  

What reasons can lead to this problem? 

Thanks!
Shuyou

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] OneNAND: Use generic_onenand_read_page in IPL

2010-10-02 Thread Kyungmin Park
Hi,

No it's used another place. that's reason not static function pointer.
I'll update it soon.

Thank you,
Kyungmin Park

On Sun, Oct 3, 2010 at 2:33 AM, Marek Vasut  wrote:
> There apparantly is no reason for having "onenand_read_page" abstracted.
> Besides, it's static data which causes trouble.
>
> Signed-off-by: Marek Vasut 
> ---
>  onenand_ipl/onenand_read.c |    9 +++--
>  1 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
> index 8d0df81..008d73a 100644
> --- a/onenand_ipl/onenand_read.c
> +++ b/onenand_ipl/onenand_read.c
> @@ -37,8 +37,6 @@
>  extern void *memcpy32(void *dest, void *src, int size);
>  #endif
>
> -int (*onenand_read_page)(ulong block, ulong page, u_char *buf, int pagesize);
> -
>  /* read a page with ECC */
>  static int generic_onenand_read_page(ulong block, ulong page,
>                                u_char * buf, int pagesize)
> @@ -122,8 +120,6 @@ int onenand_read_block(unsigned char *buf)
>        int pagesize, erasesize, erase_shift;
>        int page_is_4KiB = 0;
>
> -       onenand_read_page = generic_onenand_read_page;
> -
>        onenand_generic_init(&page_is_4KiB, &page);
>
>        if (page_is_4KiB) {
> @@ -139,10 +135,11 @@ int onenand_read_block(unsigned char *buf)
>
>        /* NOTE: you must read page from page 1 of block 0 */
>        /* read the block page by page */
> +
>        for (block = 0; block < nblocks; block++) {
>                for (; page < ONENAND_PAGES_PER_BLOCK; page++) {
> -                       if (onenand_read_page(block, page, buf + offset,
> -                                               pagesize)) {
> +                       if (generic_onenand_read_page(block, page,
> +                                       buf + offset, pagesize)) {
>                                /* This block is bad. Skip it
>                                 * and read next block */
>                                offset -= page * pagesize;
> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/4] OneNAND: Introduce CONFIG_SYS_IPL_LOAD_ADDR

2010-10-02 Thread Kyungmin Park
Acked-by: Kyungmin Park 

On Sun, Oct 3, 2010 at 2:33 AM, Marek Vasut  wrote:
> This allows to specify where the OneNAND IPL should load the U-Boot binary. 
> The
> purpose of CONFIG_SYS_LOAD_ADDR is different I believe.
>
> On PXA, this is needed with OneNAND memories that expose only first 1kb of 
> data,
> which is insufficient for SDRAM init. U-Boot can then be copied into SRAM.
>
> Signed-off-by: Marek Vasut 
> ---
>  include/configs/apollon.h  |    1 +
>  onenand_ipl/onenand_boot.c |    4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/configs/apollon.h b/include/configs/apollon.h
> index c1295de..d34e24d 100644
> --- a/include/configs/apollon.h
> +++ b/include/configs/apollon.h
> @@ -199,6 +199,7 @@
>
>  /* default load address */
>  #define        CONFIG_SYS_LOAD_ADDR    (OMAP2420_SDRC_CS0)
> +#define        CONFIG_SYS_IPL_LOAD_ADDR        (OMAP2420_SDRC_CS0)
>
>  /* The 2420 has 12 GP timers, they can be driven by the SysClk (12/13/19.2)
>  * or by 32KHz clk, or from external sig. This rate is divided by a local
> diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
> index 22baebb..2a0c7ce 100644
> --- a/onenand_ipl/onenand_boot.c
> +++ b/onenand_ipl/onenand_boot.c
> @@ -33,11 +33,11 @@ void start_oneboot(void)
>  {
>        uchar *buf;
>
> -       buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
> +       buf = (uchar *) CONFIG_SYS_IPL_LOAD_ADDR;
>
>        onenand_read_block(buf);
>
> -       ((init_fnc_t *)CONFIG_SYS_LOAD_ADDR)();
> +       ((init_fnc_t *)CONFIG_SYS_IPL_LOAD_ADDR)();
>
>        /* should never come here */
>  }
> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot