Re: [U-Boot] [PATCH] OMAP[34]: fix broken timer

2011-06-28 Thread Igor Grinberg
Sandeep, Albert,


Please, apply this patch. It fixes a real issue with timer on omap.


Thanks


On 12/28/10 02:33, John Rigby wrote:

 As implemented now the timer used to implement __udelay counts
 to 0x and then gets stuck there because the the programmed
 reload value is 0x.  This value is not only wrong but
 illegal according to the reference manual.

 One can reproduce the bug by leaving a board at the u-boot prompt
 for sometime then issuing a sleep command.  The sleep will hang
 forever.

 The timer is a count up timer that reloads as it rolls over
 from 0x so the correct load value is 0.

 Change TIMER_LOAD_VAL from 0x to 0 and introduce
 a new constant called TIMER_OVERFLOW_VAL set to 0x.

 Signed-off-by: John Rigby john.ri...@linaro.org

Tested-by: Igor Grinberg grinb...@compulab.co.il

On DM3730, AM3703, OMAP3530.

 ---
  arch/arm/cpu/armv7/omap-common/timer.c |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/arch/arm/cpu/armv7/omap-common/timer.c 
 b/arch/arm/cpu/armv7/omap-common/timer.c
 index 9beebb1..59bbca8 100644
 --- a/arch/arm/cpu/armv7/omap-common/timer.c
 +++ b/arch/arm/cpu/armv7/omap-common/timer.c
 @@ -43,8 +43,9 @@ static struct gptimer *timer_base = (struct gptimer 
 *)CONFIG_SYS_TIMERBASE;
   * Nothing really to do with interrupts, just starts up a counter.
   */
  
 -#define TIMER_CLOCK  (V_SCLK / (2  CONFIG_SYS_PTV))
 -#define TIMER_LOAD_VAL   0x
 +#define TIMER_CLOCK  (V_SCLK / (2  CONFIG_SYS_PTV))
 +#define TIMER_OVERFLOW_VAL   0x
 +#define TIMER_LOAD_VAL   0
  
  int timer_init(void)
  {
 @@ -86,7 +87,7 @@ void __udelay(unsigned long usec)
   while (tmo  0) {
   now = readl(timer_base-tcrr);
   if (last  now) /* count up timer overflow */
 - tmo -= TIMER_LOAD_VAL - last + now;
 + tmo -= TIMER_OVERFLOW_VAL - last + now + 1;
   else
   tmo -= now - last;
   last = now;

-- 
Regards,
Igor.

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


Re: [U-Boot] SPL framework re-design

2011-06-28 Thread Aneesh V
On Tuesday 28 June 2011 02:52 AM, Wolfgang Denk wrote:
 Dear Scott Wood,

 In message20110627161803.16783...@schlenkerla.am.freescale.net  you wrote:

 But if we do not create a new hierarchy of target directories we will
 have the normal and the spl objects in parallel (and I don't want
 to delete one when building the other).

 What's wrong with creating a new hierarchy of target directories?  It
 would be like specifying a different output directory.

 The question came up what we need it for.

 Just seems cleaner to me than jamming it into the file extension.  If we're
 treating it as a separate build, it should go into a separate place.  It's
 not really a different type of file.

 I'm fine with that as well.

I too think this approach is cleaner. This is essentially Daniel's
approach. So, we can use some of his code. There are couple of open 
points though:

1. If there are SPL customized generic files like the
nand_spl/nand_boot.c where do we keep them? I suggest that we keep them
in spl/nand, spl/onenand etc. And for the object file hierarchy let's
have something like spl/obj. How about that?

3. I hope partially linked libraries is fine. Or do you want to link
all object files in a single stage? Is there any advantage in doing
that?

Shall I re-work my series using this framework?

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


[U-Boot] Loan Application.

2011-06-28 Thread Loan Team
We loan at 0.2%, Any interested person,irrespective of your country should 
contact us now Via email for more information.

Contact Email: loansolutiontea...@eb2a.com

Regards,
E-Loan Solution Team.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Loan Application.

2011-06-28 Thread Loan Team
We loan at 0.2%, Any interested person,irrespective of your country should 
contact us now Via email for more information.

Contact Email: loansolutiontea...@eb2a.com

Regards,
E-Loan Solution Team.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH][x86]Minor cleanups

2011-06-28 Thread Graeme Russ
- Make offset into Global Data for Relocation Offset a generated value for
  use in assembler
- Delete unused Global Data offset #defines
- Delete unused sc520 MMCR offset #defines

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/x86/cpu/start.S   |3 ++-
 arch/x86/include/asm/global_data.h |   19 ---
 arch/x86/include/asm/ic/sc520.h|8 
 lib/asm-offsets.c  |3 +++
 4 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 7ccc076..31de0f8 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -30,6 +30,7 @@
 #include version.h
 #include asm/global_data.h
 #include asm/processor-flags.h
+#include asm-offsets.h

 .section .text
 .code32
@@ -114,7 +115,7 @@ relocate_code:

/* Setup call address of in-RAM copy of board_init_r() */
movl$board_init_r, %ebp
-   addl(GD_RELOC_OFF * 4)(%edx), %ebp
+   addl(GENERATED_GD_RELOC_OFF)(%edx), %ebp

/* Setup parameters to board_init_r() */
movl%edx, %eax
diff --git a/arch/x86/include/asm/global_data.h 
b/arch/x86/include/asm/global_data.h
index f8a16d6..f977dbe 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -58,25 +58,6 @@ extern gd_t *gd;

 #endif

-/* Word Offsets into Global Data - MUST match struct gd_t */
-#define GD_BD  0
-#define GD_FLAGS   1
-#define GD_BAUDRATE2
-#define GD_HAVE_CONSOLE3
-#define GD_RELOC_OFF   4
-#define GD_LOAD_OFF5
-#define GD_ENV_ADDR6
-#define GD_ENV_VALID   7
-#define GD_CPU_CLK 8
-#define GD_BUS_CLK 9
-#define GD_RELOC_ADDR  10
-#define GD_START_ADDR_SP   11
-#define GD_RAM_SIZE12
-#define GD_RESET_STATUS13
-#define GD_JT  14
-
-#define GD_SIZE15
-
 /*
  * Global Data Flags
  */
diff --git a/arch/x86/include/asm/ic/sc520.h b/arch/x86/include/asm/ic/sc520.h
index 956c1c2..8b5f47c 100644
--- a/arch/x86/include/asm/ic/sc520.h
+++ b/arch/x86/include/asm/ic/sc520.h
@@ -260,14 +260,6 @@ extern sc520_mmcr_t *sc520_mmcr;
 #define SC520_MMCR_BASE0xfffef000

 /* MMCR Addresses (required for assembler code) */
-#define SC520_DRCCTL   (SC520_MMCR_BASE + 0x010)
-#define SC520_DRCTMCTL (SC520_MMCR_BASE + 0x012)
-#define SC520_DRCCFG   (SC520_MMCR_BASE + 0x014)
-#define SC520_DRCBENDADR   (SC520_MMCR_BASE + 0x018)
-#define SC520_ECCCTL   (SC520_MMCR_BASE + 0x020)
-#define SC520_DBCTL(SC520_MMCR_BASE + 0x040)
-#define SC520_ECCINT   (SC520_MMCR_BASE + 0xd18)
-
 #define SC520_PAR0 (SC520_MMCR_BASE + 0x088)
 #define SC520_PAR1 (SC520_PAR0 + (0x04 * 1))
 #define SC520_PAR2 (SC520_PAR0 + (0x04 * 2))
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index c88f5d4..6ae32dc 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -28,5 +28,8 @@ int main(void)
DEFINE(GENERATED_BD_INFO_SIZE,
(sizeof(struct bd_info) + 15)  ~15);

+   DEFINE(GENERATED_GD_RELOC_OFF,
+   (offsetof(gd_t, reloc_off)));
+
return 0;
 }
--
1.7.5.2.317.g391b14

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


Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Igor Grinberg
Hi Albert,



On 06/28/11 08:39, Albert ARIBAUD wrote:

 Hi Wolfgang,

 The following changes since commit 9623c158f6a5150a21c25026bfba79e7ff7912f5:

Merge branch 'master' of git://git.denx.de/u-boot-arm (2011-06-23 
 15:37:33 +0200)

 are available in the git repository at:

git://git.denx.de/u-boot-arm.git master

 Aneesh V (9):
arm: make default implementation of cache_flush() weakly linked
armv7: cache maintenance operations for armv7
armv7: rename cache related CONFIG flags
armv7: integrate cache maintenance support
arm: minor fixes for cache and mmu handling
armv7: add PL310 support to u-boot
armv7: adapt omap4 to the new cache maintenance framework
armv7: adapt omap3 to the new cache maintenance framework
armv7: adapt s5pc1xx to the new cache maintenance framework

Can these two also be added for 2011.06:

OMAP[34]: fix broken timer:
http://patchwork.ozlabs.org/patch/76803/

arm: omap2: apollon: fix broken build:
http://patchwork.ozlabs.org/patch/101877/

?

Thanks

-- 
Regards,
Igor.

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


Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Igor Grinberg
On 06/28/11 12:52, Igor Grinberg wrote:

 Hi Albert,



 On 06/28/11 08:39, Albert ARIBAUD wrote:

 Hi Wolfgang,

 The following changes since commit 9623c158f6a5150a21c25026bfba79e7ff7912f5:

Merge branch 'master' of git://git.denx.de/u-boot-arm (2011-06-23 
 15:37:33 +0200)

 are available in the git repository at:

git://git.denx.de/u-boot-arm.git master

 Aneesh V (9):
arm: make default implementation of cache_flush() weakly linked
armv7: cache maintenance operations for armv7
armv7: rename cache related CONFIG flags
armv7: integrate cache maintenance support
arm: minor fixes for cache and mmu handling
armv7: add PL310 support to u-boot
armv7: adapt omap4 to the new cache maintenance framework
armv7: adapt omap3 to the new cache maintenance framework
armv7: adapt s5pc1xx to the new cache maintenance framework
 Can these two also be added for 2011.06:

 OMAP[34]: fix broken timer:
 http://patchwork.ozlabs.org/patch/76803/

 arm: omap2: apollon: fix broken build:
 http://patchwork.ozlabs.org/patch/101877/

 ?

Errr, I've just seen 2011.06 already released a couple of hours ago...
I guess it is too late now...

Still, I would be glad if those get into this merge window...

Thanks anyway

-- 
Regards,
Igor.

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


Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Wolfgang Denk
Dear Igor Grinberg,

In message 4e09a476.3010...@compulab.co.il you wrote:
 
 Can these two also be added for 2011.06:

No, they cannot.  v2011.06 was released yesterday, according to
schedule.  I just need to write the summary message...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Remember thee Ay, thou poor ghost while memory holds a seat  In  this
distracted  globe.  Remember  thee!  Yea, from the table of my memory
I'll wipe away all trivial fond  records,  All  saws  of  books,  all
forms,  all  pressures past, That youth and observation copied there.
Hamlet, I : v : 95 William Shakespeare
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [STATUS] v2011.06 release, Merge Window is OPEN

2011-06-28 Thread Wolfgang Denk
Hello all,

U-Boot v2011.06 has been released and is available from the git
repository and the FTP server.


KNOWN ISSUES:

- The cleanup after the reorganization of the ARM code has not been
  completed yet. At the moment, approapprox, 100+ ARM boards are
  *broken* and *do not compile*.

  Board maintainers or other interested parties are requested to
  adapt their boards within the current merge window. All boards that
  have not been fixed within the first week of the merge window are
  considered unmaintained and without interest to the community and
  will be removed.

  This is the last such warning.

- We still have not found a new network custodian yet.  Are there any
  volunteers?

The Merge Window for the next release (v2011.09) is open until
Sat Jul 16, 2011, 23:59:59 CEST = 18 days remaining. 

The next release v2011.09 is scheduled for September 04, 2011. 


A little statistics [1] - changes since release v2011.03:

Processed 678 csets from 135 developers
26 employers found
A total of 48114 lines added, 36696 removed (delta 11418)

Developers with the most changesets
Mike Frysinger  63 (9.3%)
Luca Ceresoli   28 (4.1%)
Heiko Schocher  26 (3.8%)
Fabio Estevam   23 (3.4%)
Andreas Bießmann21 (3.1%)
Kumar Gala  21 (3.1%)
Holger Brunck   20 (2.9%)
Reinhard Meyer  18 (2.7%)
Macpaul Lin 18 (2.7%)
Wolfgang Denk   17 (2.5%)
...

Developers with the most changed lines
Mike Frysinger10802 (16.0%)
Wolfgang Denk 8365 (12.4%)
Andy Fleming  4724 (7.0%)
Heiko Schocher2787 (4.1%)
John Rigby2243 (3.3%)
Luca Ceresoli 1779 (2.6%)
Daniel Schwierzeck1726 (2.6%)
Michael Schwingen 1689 (2.5%)
Chander Kashyap   1671 (2.5%)
Macpaul Lin   1503 (2.2%)
...

Developers with the most lines removed
Wolfgang Denk 7936 (21.6%)
Daniel Schwierzeck1500 (4.1%)
Eric Benard895 (2.4%)
Holger Brunck  545 (1.5%)
Scott Wood 503 (1.4%)
Kumar Gala 496 (1.4%)
David Müller (ELSOFT AG)  377 (1.0%)
Alessandro Rubini  363 (1.0%)
Andreas Bießmann  275 (0.7%)
Reinhard Meyer 159 (0.4%)
...

Developers with the most signoffs (total 282)
Kumar Gala  80 (28.4%)
Sandeep Paulraj 32 (11.3%)
Valentin Longchamp  23 (8.2%)
Holger Brunck   19 (6.7%)
Stefan Roese15 (5.3%)
Mike Frysinger  13 (4.6%)
Andy Fleming12 (4.3%)
Minkyu Kang 11 (3.9%)
Scott Wood   8 (2.8%)
Shinya Kuribayashi   6 (2.1%)
...

Developers with the most reviews (total 0)

Developers with the most test credits (total 10)
Mike Frysinger   1 (10.0%)
Andreas Bießmann1 (10.0%)
Anatolij Gustschin   1 (10.0%)
Fabio Estevam1 (10.0%)
Graeme Russ  1 (10.0%)
Stefano Babic1 (10.0%)
Felix Radensky   1 (10.0%)
Magnus Lilja 1 (10.0%)
Andre Schwarz1 (10.0%)
Sughosh Ganu 1 (10.0%)

Developers who gave the most tested-by credits (total 10)
Fabio Estevam2 (20.0%)
Kim Phillips 2 (20.0%)
Anatolij Gustschin   1 (10.0%)
Stefano Babic1 (10.0%)
Stefan Roese 1 (10.0%)
Scott Wood   1 (10.0%)
Priyanka Jain1 (10.0%)
Jens Scharsig1 (10.0%)

Developers with the most report credits (total 5)
Andre Schwarz1 (20.0%)
Kumar Gala   1 (20.0%)
Wolfgang Denk1 (20.0%)
Michael Weiss1 (20.0%)
Jianxi Fu1 (20.0%)

Developers who gave the most report credits (total 5)
Mike Frysinger   2 (40.0%)
Kim Phillips 1 (20.0%)
Anatolij Gustschin   1 (20.0%)
Peter Tyser  1 (20.0%)

Top changeset contributors by employer
(Unknown)  267 (39.4%)
Freescale  127 (18.7%)
Analog Devices  66 (9.7%)
DENX Software Engineering   63 (9.3%)
Keymile 34 (5.0%)
Texas Instruments   10 (1.5%)
Guntermann  Drunck  9 (1.3%)
CompuLab 9 (1.3%)
Graeme Russ  7 (1.0%)
Samsung  7 (1.0%)
...

Top lines changed by employer
(Unknown) 22719 (33.6%)
Freescale 13914 (20.6%)
Analog Devices12353 (18.3%)
DENX Software Engineering 11824 (17.5%)
Keymile   2635 (3.9%)
Mistral891 (1.3%)
Bluewater Systems  420 (0.6%)
Graeme Russ396 (0.6%)
Universita di Pavia378 (0.6%)
Transmode Systems  323 (0.5%)
...

Employers with the most signoffs (total 282)
Freescale  

[U-Boot] [PATCH v1 (WIP) 04/16] [Timer]Allow reset_timer() only for Nios2

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 drivers/block/mg_disk.c |2 ++
 drivers/mtd/cfi_flash.c |4 
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index b74307a..2198017 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -91,7 +91,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
u32 from, cur, err;
 
err = MG_ERR_NONE;
+#ifdef CONFIG_NIOS2
reset_timer();
+#endif
from = get_timer(0);
 
status = readb(mg_base() + MG_REG_STATUS);
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 6039e1f..3ac6c80 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -573,7 +573,9 @@ static int flash_status_check (flash_info_t * info, 
flash_sect_t sector,
 #endif
 
/* Wait for command completion */
+#ifdef CONFIG_NIOS2
reset_timer();
+#endif
start = get_timer (0);
while (flash_is_busy (info, sector)) {
if (get_timer (start)  tout) {
@@ -662,7 +664,9 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 #endif
 
/* Wait for command completion */
+#ifdef CONFIG_NIOS2
reset_timer();
+#endif
start = get_timer(0);
while (1) {
switch (info-portwidth) {
-- 
1.7.5.2.317.g391b14

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


[U-Boot] [PATCH v1 (WIP) 03/16] [Timer]Remove calls to set_timer in arch/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/arm/cpu/arm1136/mx31/timer.c|5 -
 arch/arm/cpu/arm1136/mx35/timer.c|4 
 arch/arm/cpu/arm1136/omap24xx/timer.c|5 -
 arch/arm/cpu/arm1176/s3c64xx/timer.c |5 -
 arch/arm/cpu/arm1176/tnetv107x/timer.c   |5 -
 arch/arm/cpu/arm720t/interrupts.c|5 -
 arch/arm/cpu/arm920t/a320/timer.c|6 --
 arch/arm/cpu/arm920t/at91/timer.c|5 -
 arch/arm/cpu/arm920t/at91rm9200/timer.c  |5 -
 arch/arm/cpu/arm920t/imx/timer.c |5 -
 arch/arm/cpu/arm920t/ks8695/timer.c  |5 -
 arch/arm/cpu/arm920t/s3c24x0/timer.c |5 -
 arch/arm/cpu/arm925t/timer.c |5 -
 arch/arm/cpu/arm926ejs/armada100/timer.c |5 -
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mx25/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mx27/timer.c  |5 -
 arch/arm/cpu/arm926ejs/omap/timer.c  |5 -
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |5 -
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |5 -
 arch/arm/cpu/arm926ejs/spear/timer.c |5 -
 arch/arm/cpu/arm926ejs/versatile/timer.c |5 -
 arch/arm/cpu/armv7/mx5/timer.c   |5 -
 arch/arm/cpu/armv7/omap-common/timer.c   |5 -
 arch/arm/cpu/armv7/s5p-common/timer.c|5 -
 arch/arm/cpu/armv7/tegra2/timer.c|5 -
 arch/arm/cpu/lh7a40x/timer.c |5 -
 arch/arm/cpu/pxa/timer.c |5 -
 arch/arm/cpu/s3c44b0/timer.c |5 -
 arch/arm/cpu/sa1100/timer.c  |5 -
 arch/avr32/cpu/interrupts.c  |   16 
 arch/m68k/cpu/mcf547x_8x/slicetimer.c|4 
 arch/m68k/lib/board.c|2 --
 arch/m68k/lib/time.c |   16 ++--
 arch/microblaze/cpu/timer.c  |5 -
 arch/mips/cpu/mips32/time.c  |6 --
 arch/nios2/cpu/interrupts.c  |6 --
 arch/powerpc/lib/board.c |2 --
 arch/powerpc/lib/interrupts.c|5 -
 arch/sh/lib/time.c   |7 +--
 arch/sh/lib/time_sh2.c   |9 ++---
 arch/sparc/lib/board.c   |2 --
 arch/sparc/lib/interrupts.c  |5 -
 arch/x86/lib/board.c |2 --
 arch/x86/lib/timer.c |5 -
 board/armltd/integrator/timer.c  |6 --
 include/common.h |1 -
 47 files changed, 5 insertions(+), 244 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c 
b/arch/arm/cpu/arm1136/mx31/timer.c
index c4bc3b3..d51acbb 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -147,11 +147,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-   gd-tbl = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c 
b/arch/arm/cpu/arm1136/mx35/timer.c
index db1e2c9..6dfb63a 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -92,10 +92,6 @@ ulong get_timer(ulong base)
return (tmp / 1000) - base;
 }
 
-void set_timer(ulong t)
-{
-}
-
 /*
  * delay x useconds AND preserve advance timstamp value
  * GPTCNT is now supposed to tick 1 by 1 us.
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c 
b/arch/arm/cpu/arm1136/omap24xx/timer.c
index 228ceba..d6267ba 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -67,11 +67,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-   gd-tbl = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c 
b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index 9768319..8e54060 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -159,11 +159,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-   timestamp = t * (timer_load_val / (100 * CONFIG_SYS_HZ));
-}
-
 void __udelay(unsigned long usec)
 {
unsigned long long tmp;
diff --git a/arch/arm/cpu/arm1176/tnetv107x/timer.c 
b/arch/arm/cpu/arm1176/tnetv107x/timer.c
index a7a400d..c27375c 100644
--- a/arch/arm/cpu/arm1176/tnetv107x/timer.c
+++ b/arch/arm/cpu/arm1176/tnetv107x/timer.c
@@ -88,11 +88,6 @@ ulong get_timer(ulong base)
return (get_timer_raw() / (TIMER_LOAD_VAL / TIM_CLK_DIV)) - base;
 }
 
-void set_timer(ulong t)
-{
-   timestamp = t;
-}
-
 unsigned long long get_ticks(void)
 {
return get_timer(0);
diff --git 

[U-Boot] [PATCH v1 (WIP) 05/16] [Timer]Remove reset_timer() for non-Nios2 arches

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/arm/cpu/arm1136/mx31/timer.c|5 -
 arch/arm/cpu/arm1136/mx35/timer.c|5 -
 arch/arm/cpu/arm1136/omap24xx/timer.c|5 -
 arch/arm/cpu/arm1176/s3c64xx/timer.c |5 -
 arch/arm/cpu/arm1176/tnetv107x/timer.c   |9 -
 arch/arm/cpu/arm720t/interrupts.c|5 -
 arch/arm/cpu/arm920t/a320/timer.c|6 --
 arch/arm/cpu/arm920t/at91/timer.c|6 --
 arch/arm/cpu/arm920t/at91rm9200/timer.c  |6 --
 arch/arm/cpu/arm920t/ep93xx/timer.c  |5 -
 arch/arm/cpu/arm920t/imx/timer.c |6 --
 arch/arm/cpu/arm920t/ks8695/timer.c  |7 +--
 arch/arm/cpu/arm920t/s3c24x0/timer.c |6 --
 arch/arm/cpu/arm925t/timer.c |6 --
 arch/arm/cpu/arm926ejs/armada100/timer.c |5 -
 arch/arm/cpu/arm926ejs/davinci/timer.c   |5 -
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |5 -
 arch/arm/cpu/arm926ejs/mx25/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mx27/timer.c  |5 -
 arch/arm/cpu/arm926ejs/nomadik/timer.c   |   12 +---
 arch/arm/cpu/arm926ejs/omap/timer.c  |6 --
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |5 -
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |5 -
 arch/arm/cpu/arm926ejs/spear/timer.c |6 --
 arch/arm/cpu/arm926ejs/versatile/timer.c |6 --
 arch/arm/cpu/armv7/mx5/timer.c   |5 -
 arch/arm/cpu/armv7/omap-common/timer.c   |5 -
 arch/arm/cpu/armv7/s5p-common/timer.c|5 -
 arch/arm/cpu/armv7/tegra2/timer.c|5 -
 arch/arm/cpu/ixp/timer.c |5 -
 arch/arm/cpu/lh7a40x/timer.c |6 --
 arch/arm/cpu/pxa/timer.c |7 +--
 arch/arm/cpu/s3c44b0/timer.c |6 --
 arch/arm/cpu/sa1100/timer.c  |5 -
 arch/avr32/cpu/interrupts.c  |7 ---
 arch/blackfin/cpu/interrupts.c   |5 -
 arch/m68k/cpu/mcf547x_8x/slicetimer.c|5 -
 arch/m68k/lib/time.c |5 -
 arch/microblaze/cpu/timer.c  |7 +--
 arch/mips/cpu/mips32/time.c  |6 --
 arch/powerpc/lib/interrupts.c|5 -
 arch/sh/lib/time.c   |7 ---
 arch/sh/lib/time_sh2.c   |8 
 arch/sparc/lib/interrupts.c  |7 +--
 arch/x86/lib/timer.c |5 -
 board/armltd/integrator/timer.c  |5 -
 board/armltd/vexpress/ca9x4_ct_vxp.c |5 -
 board/nvidia/common/board.c  |1 -
 49 files changed, 9 insertions(+), 270 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c 
b/arch/arm/cpu/arm1136/mx31/timer.c
index d51acbb..eac4ffb 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -113,11 +113,6 @@ void reset_timer_masked (void)
gd-tbl = 0; /* start advancing time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-   reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
ulong now = GPTCNT; /* current tick value */
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c 
b/arch/arm/cpu/arm1136/mx35/timer.c
index 6dfb63a..80c0675 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -73,11 +73,6 @@ inline ulong get_timer_masked(void)
return val;
 }
 
-void reset_timer(void)
-{
-   reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
ulong tmp;
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c 
b/arch/arm/cpu/arm1136/omap24xx/timer.c
index d6267ba..6f1ebbf 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -57,11 +57,6 @@ int timer_init (void)
 /*
  * timer without interrupts
  */
-void reset_timer (void)
-{
-   reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
return get_timer_masked () - base;
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c 
b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index 8e54060..bc21f86 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -142,11 +142,6 @@ void reset_timer_masked(void)
timestamp = 0;
 }
 
-void reset_timer(void)
-{
-   reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
unsigned long long res = get_ticks();
diff --git a/arch/arm/cpu/arm1176/tnetv107x/timer.c 
b/arch/arm/cpu/arm1176/tnetv107x/timer.c
index c27375c..b3123c5 100644
--- a/arch/arm/cpu/arm1176/tnetv107x/timer.c
+++ b/arch/arm/cpu/arm1176/tnetv107x/timer.c
@@ -60,15 +60,6 @@ int timer_init(void)
return 0;
 }
 
-void reset_timer(void)
-{
-   lastinc = timestamp = 0;
-
-   __raw_writel(0, regs-tcr);
-   __raw_writel(0, regs-tim34);
-   __raw_writel(2  

[U-Boot] [PATCH v1 (WIP) 06/16] [Timer]Fix at91rm9200/spi.c timer usage

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/arm/cpu/arm920t/at91rm9200/spi.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm920t/at91rm9200/spi.c 
b/arch/arm/cpu/arm920t/at91rm9200/spi.c
index f3cb5d8..c70efc6 100644
--- a/arch/arm/cpu/arm920t/at91rm9200/spi.c
+++ b/arch/arm/cpu/arm920t/at91rm9200/spi.c
@@ -108,6 +108,7 @@ void AT91F_SpiEnable(int cs)
 unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
 {
unsigned int timeout;
+   unsigned long start;
 
pDesc-state = BUSY;
 
@@ -132,12 +133,12 @@ unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
}
 
/* arm simple, non interrupt dependent timer */
-   reset_timer_masked();
+   start = get_timer(0);
timeout = 0;
 
AT91C_BASE_SPI-SPI_PTCR = AT91C_PDC_TXTEN + AT91C_PDC_RXTEN;
while(!(AT91C_BASE_SPI-SPI_SR  AT91C_SPI_RXBUFF) 
-   ((timeout = get_timer_masked() )  CONFIG_SYS_SPI_WRITE_TOUT));
+   ((timeout = get_timer(start) )  CONFIG_SYS_SPI_WRITE_TOUT));
AT91C_BASE_SPI-SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS;
pDesc-state = IDLE;
 
-- 
1.7.5.2.317.g391b14

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


[U-Boot] [PATCH v1 (WIP) 07/16] [Timer]Remove reset_timer_masked()

2011-06-28 Thread Graeme Russ
Fold implementation into timer_init() where needed

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/arm/cpu/arm1136/mx31/timer.c|7 ---
 arch/arm/cpu/arm1136/omap24xx/timer.c|   14 +++---
 arch/arm/cpu/arm1176/s3c64xx/timer.c |7 ---
 arch/arm/cpu/arm720t/interrupts.c|7 ---
 arch/arm/cpu/arm920t/at91/timer.c|8 
 arch/arm/cpu/arm920t/at91rm9200/timer.c  |7 ---
 arch/arm/cpu/arm920t/ep93xx/timer.c  |   10 +++---
 arch/arm/cpu/arm920t/imx/timer.c |   10 +++---
 arch/arm/cpu/arm920t/ks8695/timer.c  |   15 +--
 arch/arm/cpu/arm920t/s3c24x0/timer.c |7 ---
 arch/arm/cpu/arm925t/timer.c |   12 +++-
 arch/arm/cpu/arm926ejs/armada100/timer.c |   10 ++
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |   10 ++
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |   14 +++---
 arch/arm/cpu/arm926ejs/mx25/timer.c  |9 -
 arch/arm/cpu/arm926ejs/mx27/timer.c  |9 -
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |   10 ++
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |   10 ++
 arch/arm/cpu/arm926ejs/spear/timer.c |   11 +++
 arch/arm/cpu/armv7/mx5/timer.c   |   10 --
 arch/arm/cpu/armv7/omap-common/timer.c   |   11 +++
 arch/arm/cpu/armv7/tegra2/timer.c|7 ---
 arch/arm/cpu/ixp/timer.c |8 
 arch/arm/cpu/pxa/timer.c |8 +---
 arch/arm/cpu/s3c44b0/timer.c |7 ---
 arch/arm/cpu/sa1100/timer.c  |6 --
 board/armltd/integrator/timer.c  |   13 -
 27 files changed, 47 insertions(+), 210 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c 
b/arch/arm/cpu/arm1136/mx31/timer.c
index eac4ffb..c05a39d 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -106,13 +106,6 @@ int timer_init (void)
return 0;
 }
 
-void reset_timer_masked (void)
-{
-   /* reset time */
-   gd-lastinc = GPTCNT; /* capture current incrementer value time */
-   gd-tbl = 0; /* start advancing time stamp from 0 */
-}
-
 unsigned long long get_ticks (void)
 {
ulong now = GPTCNT; /* current tick value */
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c 
b/arch/arm/cpu/arm1136/omap24xx/timer.c
index 6f1ebbf..73bf4a7 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -41,6 +41,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static void reset_timer_masked (void)
+{
+   /* reset time */
+   gd-lastinc = READ_TIMER;   /* capture current incrementer value 
time */
+   gd-tbl = 0;/* start advancing time stamp from 0 
*/
+}
+
 int timer_init (void)
 {
int32_t val;
@@ -85,13 +92,6 @@ void __udelay (unsigned long usec)
/*NOP*/;
 }
 
-void reset_timer_masked (void)
-{
-   /* reset time */
-   gd-lastinc = READ_TIMER;   /* capture current incrementer value 
time */
-   gd-tbl = 0;/* start advancing time stamp from 0 
*/
-}
-
 ulong get_timer_masked (void)
 {
ulong now = READ_TIMER; /* current tick value */
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c 
b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index bc21f86..f16a37b 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -135,13 +135,6 @@ ulong get_tbclk(void)
return (ulong)(timer_load_val / 100);
 }
 
-void reset_timer_masked(void)
-{
-   /* reset time */
-   lastdec = read_timer();
-   timestamp = 0;
-}
-
 ulong get_timer_masked(void)
 {
unsigned long long res = get_ticks();
diff --git a/arch/arm/cpu/arm720t/interrupts.c 
b/arch/arm/cpu/arm720t/interrupts.c
index 9cd7fee..fa9c5a2 100644
--- a/arch/arm/cpu/arm720t/interrupts.c
+++ b/arch/arm/cpu/arm720t/interrupts.c
@@ -233,13 +233,6 @@ void __udelay (unsigned long usec)
 #endif
 }
 
-void reset_timer_masked (void)
-{
-   /* reset time */
-   lastdec = READ_TIMER;
-   timestamp = 0;
-}
-
 ulong get_timer_masked (void)
 {
ulong now = READ_TIMER;
diff --git a/arch/arm/cpu/arm920t/at91/timer.c 
b/arch/arm/cpu/arm920t/at91/timer.c
index 374cc25..c321e28 100644
--- a/arch/arm/cpu/arm920t/at91/timer.c
+++ b/arch/arm/cpu/arm920t/at91/timer.c
@@ -82,14 +82,6 @@ void __udelay(unsigned long usec)
udelay_masked(usec);
 }
 
-void reset_timer_masked(void)
-{
-   /* reset time */
-   at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
-   gd-lastinc = readl(tc-tc[0].cv)  0x;
-   gd-tbl = 0;
-}
-
 ulong get_timer_raw(void)
 {
at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
diff --git a/arch/arm/cpu/arm920t/at91rm9200/timer.c 
b/arch/arm/cpu/arm920t/at91rm9200/timer.c
index 9a1ae85..fbe74b6 100644
--- a/arch/arm/cpu/arm920t/at91rm9200/timer.c
+++ b/arch/arm/cpu/arm920t/at91rm9200/timer.c
@@ 

[U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 drivers/block/mg_disk.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 2198017..c8cc195 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int 
stat, unsigned err)
 static unsigned int mg_wait (u32 expect, u32 msec)
 {
u8 status;
-   u32 from, cur, err;
+   u32 ts, err;
 
err = MG_ERR_NONE;
 #ifdef CONFIG_NIOS2
reset_timer();
 #endif
-   from = get_timer(0);
+   ts = time_now_ms();
 
status = readb(mg_base() + MG_REG_STATUS);
do {
-   cur = get_timer(from);
if (status  MG_REG_STATUS_BIT_BUSY) {
if (expect == MG_REG_STATUS_BIT_BUSY)
break;
@@ -119,9 +118,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
break;
}
status = readb(mg_base() + MG_REG_STATUS);
-   } while (cur  msec);
+   } while (time_since_ms(ts)  msec);
 
-   if (cur = msec)
+   if (time_since_ms(ts) = msec)
err = MG_ERR_TIMEOUT;
 
return err;
-- 
1.7.5.2.317.g391b14

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


[U-Boot] [PATCH v1 (WIP) 10/16] [Timer]Replace get_timer() usage in driver/mtd and driver/block

2011-06-28 Thread Graeme Russ
This prepares for final removal of reset_timer() from Nios2

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 drivers/mtd/cfi_flash.c |   12 ++--
 drivers/mtd/nand/nand_base.c|   17 +
 drivers/mtd/spi/eeprom_m95xxx.c |6 +++---
 drivers/mtd/spi/spi_flash.c |6 +++---
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 3ac6c80..dad80c5 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -563,7 +563,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t 
sect)
 static int flash_status_check (flash_info_t * info, flash_sect_t sector,
   ulong tout, char *prompt)
 {
-   ulong start;
+   u32 start;
 
 #if CONFIG_SYS_HZ != 1000
if ((ulong)CONFIG_SYS_HZ  10)
@@ -576,9 +576,9 @@ static int flash_status_check (flash_info_t * info, 
flash_sect_t sector,
 #ifdef CONFIG_NIOS2
reset_timer();
 #endif
-   start = get_timer (0);
+   start = time_now_ms();
while (flash_is_busy (info, sector)) {
-   if (get_timer (start)  tout) {
+   if (time_since_ms(start)  tout) {
printf (Flash %s timeout at address %lx data %lx\n,
prompt, info-start[sector],
flash_read_long (info, sector, 0));
@@ -653,7 +653,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 ulong tout, char *prompt)
 {
 #ifdef CONFIG_SYS_CFI_FLASH_STATUS_POLL
-   ulong start;
+   u32 start;
int ready;
 
 #if CONFIG_SYS_HZ != 1000
@@ -667,7 +667,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 #ifdef CONFIG_NIOS2
reset_timer();
 #endif
-   start = get_timer(0);
+   start = time_now_ms();
while (1) {
switch (info-portwidth) {
case FLASH_CFI_8BIT:
@@ -688,7 +688,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
}
if (ready)
break;
-   if (get_timer(start)  tout) {
+   if (time_since_ms(start)  tout) {
printf(Flash %s timeout at address %lx data %lx\n,
   prompt, (ulong)dst, (ulong)flash_read8(dst));
return ERR_TIMOUT;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 52f8575..c838695 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -33,6 +33,7 @@
  */
 
 #include common.h
+#include time.h
 
 #define ENOTSUPP   524 /* Operation is not supported */
 
@@ -439,12 +440,12 @@ void nand_wait_ready(struct mtd_info *mtd)
 {
struct nand_chip *chip = mtd-priv;
u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;
-   u32 time_start;
+   u32 start;
 
-   time_start = get_timer(0);
+   start = time_now_ms();
 
/* wait until command is processed or timeout occures */
-   while (get_timer(time_start)  timeo) {
+   while (time_since_ms(start)  timeo) {
if (chip-dev_ready)
if (chip-dev_ready(mtd))
break;
@@ -705,7 +706,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip 
*this)
 {
unsigned long   timeo;
int state = this-state;
-   u32 time_start;
+   u32 start;
 
if (state == FL_ERASING)
timeo = (CONFIG_SYS_HZ * 400) / 1000;
@@ -717,10 +718,10 @@ static int nand_wait(struct mtd_info *mtd, struct 
nand_chip *this)
else
this-cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
 
-   time_start = get_timer(0);
+   start = time_now_ms();
 
while (1) {
-   if (get_timer(time_start)  timeo) {
+   if (time_since_ms(start)  timeo) {
printf(Timeout!);
return 0x01;
}
@@ -734,8 +735,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip 
*this)
}
}
 #ifdef PPCHAMELON_NAND_TIMER_HACK
-   time_start = get_timer(0);
-   while (get_timer(time_start)  10)
+   start = time_now_ms();
+   while (time_since_ms(start)  10)
;
 #endif /*  PPCHAMELON_NAND_TIMER_HACK */
 
diff --git a/drivers/mtd/spi/eeprom_m95xxx.c b/drivers/mtd/spi/eeprom_m95xxx.c
index ef8ed6f..16b194c 100644
--- a/drivers/mtd/spi/eeprom_m95xxx.c
+++ b/drivers/mtd/spi/eeprom_m95xxx.c
@@ -75,7 +75,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int 
len)
 {
struct spi_slave *slave;
char buf[3];
-   ulong start;
+   u32 start;
 
slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 100,
CONFIG_DEFAULT_SPI_MODE);
@@ -103,7 +103,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, 
int len)

[U-Boot] [PATCH v1 (WIP) 11/16] [Timer]Remove reset_timer() completely

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/nios2/cpu/interrupts.c |   38 --
 drivers/block/mg_disk.c |3 ---
 drivers/mtd/cfi_flash.c |6 --
 3 files changed, 0 insertions(+), 47 deletions(-)

diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c
index 0a97fa6..5603894 100644
--- a/arch/nios2/cpu/interrupts.c
+++ b/arch/nios2/cpu/interrupts.c
@@ -54,44 +54,6 @@ static struct irq_action vecs[32];
 /*/
 volatile ulong timestamp = 0;
 
-void reset_timer (void)
-{
-   nios_timer_t *tmr =(nios_timer_t *)CONFIG_SYS_NIOS_TMRBASE;
-
-   /* From Embedded Peripherals Handbook:
-*
-* When the hardware is configured with Writeable period
-* disabled, writing to one of the period_n registers causes
-* the counter to reset to the fixed Timeout Period specified
-* at system generation time.
-*
-* Here we force a reload to prevent early timeouts from
-* get_timer() when the interrupt period is greater than
-* than 1 msec.
-*
-* Simply write to periodl with its own value to force an
-* internal counter reload, THEN reset the timestamp.
-*/
-   writel (readl (tmr-periodl), tmr-periodl);
-   timestamp = 0;
-
-   /* From Embedded Peripherals Handbook:
-*
-* Writing to one of the period_n registers stops the internal
-* counter, except when the hardware is configured with Start/Stop
-* control bits off. If Start/Stop control bits is off, writing
-* either register does not stop the counter.
-*
-* In order to accomodate either configuration, the control
-* register is re-written. If the counter is stopped, it will
-* be restarted. If it is running, the write is essentially
-* a nop.
-*/
-   writel (NIOS_TIMER_ITO | NIOS_TIMER_CONT | NIOS_TIMER_START,
-   tmr-control);
-
-}
-
 ulong get_timer (ulong base)
 {
WATCHDOG_RESET ();
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index c8cc195..c56adfc 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -91,9 +91,6 @@ static unsigned int mg_wait (u32 expect, u32 msec)
u32 ts, err;
 
err = MG_ERR_NONE;
-#ifdef CONFIG_NIOS2
-   reset_timer();
-#endif
ts = time_now_ms();
 
status = readb(mg_base() + MG_REG_STATUS);
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index dad80c5..9918157 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -573,9 +573,6 @@ static int flash_status_check (flash_info_t * info, 
flash_sect_t sector,
 #endif
 
/* Wait for command completion */
-#ifdef CONFIG_NIOS2
-   reset_timer();
-#endif
start = time_now_ms();
while (flash_is_busy (info, sector)) {
if (time_since_ms(start)  tout) {
@@ -664,9 +661,6 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 #endif
 
/* Wait for command completion */
-#ifdef CONFIG_NIOS2
-   reset_timer();
-#endif
start = time_now_ms();
while (1) {
switch (info-portwidth) {
-- 
1.7.5.2.317.g391b14

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


[U-Boot] [PATCH v1 (WIP) 14/16] [Timer]Replace get_timer() usage in common/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 common/cmd_misc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 061b1bb..40f84d2 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -29,7 +29,7 @@
 
 int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   ulong start = get_timer(0);
+   ulong start = time_now_ms();
ulong delay;
 
if (argc != 2)
@@ -37,7 +37,7 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
 
-   while (get_timer(start)  delay) {
+   while (time_since_ms(start)  delay) {
if (ctrlc ())
return (-1);
 
-- 
1.7.5.2.317.g391b14

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


[U-Boot] [PATCH v1 (WIP) 16/16] [Timer]Replace get_timer() usage in arch/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 arch/blackfin/cpu/jtag-console.c   |4 ++--
 arch/microblaze/lib/time.c |4 ++--
 arch/nios2/cpu/epcs.c  |   12 ++--
 arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c |8 
 arch/powerpc/cpu/mpc8260/ether_fcc.c   |   12 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index e0f2975..97ff1de 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void)
 static bool jtag_write_emudat(uint32_t emudat)
 {
static bool overflowed = false;
-   ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT;
+   ulong start = time_now_ms();
while (bfin_read_DBGSTAT()  0x1) {
if (overflowed)
return overflowed;
-   if (timeout  get_timer(0))
+   if (time_since_ms(start) = CONFIG_JTAG_CONSOLE_TIMEOUT)
overflowed = true;
}
overflowed = false;
diff --git a/arch/microblaze/lib/time.c b/arch/microblaze/lib/time.c
index da016a0..e5ed3bf 100644
--- a/arch/microblaze/lib/time.c
+++ b/arch/microblaze/lib/time.c
@@ -30,8 +30,8 @@
 void __udelay (unsigned long usec)
 {
int i;
-   i = get_timer (0);
-   while ((get_timer (0) - i)  (usec / 1000)) ;
+   i = time_now_ms();
+   while (time_since_ms(i)  (usec / 1000)) ;
 }
 #else
 void __udelay (unsigned long usec)
diff --git a/arch/nios2/cpu/epcs.c b/arch/nios2/cpu/epcs.c
index 2369431..90e5b99 100644
--- a/arch/nios2/cpu/epcs.c
+++ b/arch/nios2/cpu/epcs.c
@@ -88,9 +88,9 @@ static int epcs_cs (int assert)
writel (tmp | NIOS_SPI_SSO, epcs-control);
} else {
/* Let all bits shift out */
-   start = get_timer (0);
+   start = time_now_ms();
while ((readl (epcs-status)  NIOS_SPI_TMT) == 0)
-   if (get_timer (start)  EPCS_TIMEOUT)
+   if (time_since_ms(start)  EPCS_TIMEOUT)
return (-1);
tmp = readl (epcs-control);
writel (tmp  ~NIOS_SPI_SSO, epcs-control);
@@ -102,9 +102,9 @@ static int epcs_tx (unsigned char c)
 {
ulong start;
 
-   start = get_timer (0);
+   start = time_now_ms();
while ((readl (epcs-status)  NIOS_SPI_TRDY) == 0)
-   if (get_timer (start)  EPCS_TIMEOUT)
+   if (time_since_ms(start)  EPCS_TIMEOUT)
return (-1);
writel (c, epcs-txdata);
return (0);
@@ -114,9 +114,9 @@ static int epcs_rx (void)
 {
ulong start;
 
-   start = get_timer (0);
+   start = time_now_ms();
while ((readl (epcs-status)  NIOS_SPI_RRDY) == 0)
-   if (get_timer (start)  EPCS_TIMEOUT)
+   if (time_since_ms(start)  EPCS_TIMEOUT)
return (-1);
return (readl (epcs-rxdata));
 }
diff --git a/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c 
b/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c
index 637ae4c..7822811 100644
--- a/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c
+++ b/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c
@@ -97,10 +97,10 @@ void i2c_init (int speed, int slaveadd)
 
 static __inline__ int i2c_wait4bus (void)
 {
-   ulong timeval = get_timer (0);
+   ulong timeval = time_now_ms();
 
while (readl (I2CCSR)  MPC107_CSR_MBB)
-   if (get_timer (timeval)  TIMEOUT)
+   if (time_since_ms(timeval)  TIMEOUT)
return -1;
 
return 0;
@@ -109,7 +109,7 @@ static __inline__ int i2c_wait4bus (void)
 static __inline__ int i2c_wait (int write)
 {
u32 csr;
-   ulong timeval = get_timer (0);
+   ulong timeval = time_now_ms();
 
do {
csr = readl (I2CCSR);
@@ -141,7 +141,7 @@ static __inline__ int i2c_wait (int write)
}
 
return 0;
-   } while (get_timer (timeval)  TIMEOUT);
+   } while (time_since_ms(timeval)  TIMEOUT);
 
 #ifdef I2CDBG
printf (i2c_wait: timed out\n);
diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c 
b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index c82958d..89703d9 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -887,7 +887,7 @@ eth_loopback_test (void)
 */
 
clear_ctrlc ();
-   runtime = get_timer (0);
+   runtime = time_now_ms();
 
do {
nclosed = 0;
@@ -931,7 +931,7 @@ eth_loopback_test (void)
__asm__ __volatile__ (eieio);
} while (cp-cp_cpcr  CPM_CR_FLG);
 
-   ecp-clstime = get_timer (0);
+   ecp-clstime = 

[U-Boot] [PATCH v1 (WIP) 13/16] [Timer]Replace get_timer() usage in net/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 net/bootp.c |6 +++---
 net/net.c   |   18 +++---
 net/sntp.c  |2 +-
 net/tftp.c  |4 ++--
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index 4db63cb..8c9560d 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -637,7 +637,7 @@ BootpRequest (void)
bp-bp_htype = HWT_ETHER;
bp-bp_hlen = HWL_ETHER;
bp-bp_hops = 0;
-   bp-bp_secs = htons(get_timer(0) / 1000);
+   bp-bp_secs = htons(time_ms_now() / 1000);
NetWriteIP(bp-bp_ciaddr, 0);
NetWriteIP(bp-bp_yiaddr, 0);
NetWriteIP(bp-bp_siaddr, 0);
@@ -660,7 +660,7 @@ BootpRequest (void)
| ((ulong)NetOurEther[3]  16)
| ((ulong)NetOurEther[4]  8)
| (ulong)NetOurEther[5];
-   BootpID += get_timer(0);
+   BootpID += time_now_ms();
BootpID  = htonl(BootpID);
NetCopyLong(bp-bp_id, BootpID);
 
@@ -819,7 +819,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
bp-bp_htype = HWT_ETHER;
bp-bp_hlen = HWL_ETHER;
bp-bp_hops = 0;
-   bp-bp_secs = htons(get_timer(0) / 1000);
+   bp-bp_secs = htons(time_ms_now() / 1000);
/* Do not set the client IP, your IP, or server IP yet, since it hasn't 
been ACK'ed by
 * the server yet */
 
diff --git a/net/net.c b/net/net.c
index 7a60583..b574481 100644
--- a/net/net.c
+++ b/net/net.c
@@ -290,15 +290,11 @@ void ArpRequest(void)
 
 void ArpTimeoutCheck(void)
 {
-   ulong t;
-
if (!NetArpWaitPacketIP)
return;
 
-   t = get_timer(0);
-
/* check for arp timeout */
-   if ((t - NetArpWaitTimerStart)  ARP_TIMEOUT) {
+   if (time_since_ms(NetArpWaitTimerStart)  ARP_TIMEOUT) {
NetArpWaitTry++;
 
if (NetArpWaitTry = ARP_TIMEOUT_COUNT) {
@@ -306,7 +302,7 @@ void ArpTimeoutCheck(void)
NetArpWaitTry = 0;
NetStartAgain();
} else {
-   NetArpWaitTimerStart = t;
+   NetArpWaitTimerStart = time_now_ms();
ArpRequest();
}
}
@@ -535,7 +531,7 @@ restart:
 *  Check for a timeout, and run the timeout handler
 *  if we have one.
 */
-   if (timeHandler  ((get_timer(0) - timeStart)  timeDelta)) {
+   if (timeHandler  (time_since_ms(timeStart)  timeDelta)) {
thand_f *x;
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
@@ -672,7 +668,7 @@ NetSetTimeout(ulong iv, thand_f *f)
timeHandler = (thand_f *)0;
} else {
timeHandler = f;
-   timeStart = get_timer(0);
+   timeStart = time_now_ms();
timeDelta = iv;
}
 }
@@ -721,7 +717,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, 
int sport, int len)
 
/* and do the ARP request */
NetArpWaitTry = 1;
-   NetArpWaitTimerStart = get_timer(0);
+   NetArpWaitTimerStart = time_now_ms();
ArpRequest();
return 1;   /* waiting */
}
@@ -792,7 +788,7 @@ int PingSend(void)
 
/* and do the ARP request */
NetArpWaitTry = 1;
-   NetArpWaitTimerStart = get_timer(0);
+   NetArpWaitTimerStart = time_now_ms();
ArpRequest();
return 1;   /* waiting */
 }
@@ -1960,7 +1956,7 @@ void copy_filename(char *dst, const char *src, int size)
  */
 unsigned int random_port(void)
 {
-   return 1024 + (get_timer(0) % 0x4000);
+   return 1024 + (time_now_ms() % 0x4000);
 }
 #endif
 
diff --git a/net/sntp.c b/net/sntp.c
index 82f2fe6..5bd2425 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -33,7 +33,7 @@ SntpSend (void)
 
memcpy ((char *)NetTxPacket + NetEthHdrSize() + IP_HDR_SIZE, (char 
*)pkt, pktlen);
 
-   SntpOurPort = 1 + (get_timer(0) % 4096);
+   SntpOurPort = 1 + (time_now_ms() % 4096);
sport = NTP_SERVICE_PORT;
 
NetSendUDPPacket (NetServerEther, NetNtpServerIP, sport, SntpOurPort, 
pktlen);
diff --git a/net/tftp.c b/net/tftp.c
index a893e02..52a5ddc 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -338,7 +338,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, 
unsigned src,
debug(Got WRQ\n);
TftpRemoteIP = sip;
TftpRemotePort = src;
-   TftpOurPort = 1024 + (get_timer(0) % 3072);
+   TftpOurPort = 1024 + (time_ms_now() % 3072);
TftpLastBlock = 0;
TftpBlockWrap = 0;
TftpBlockWrapOffset = 0;
@@ -654,7 +654,7 @@ TftpStart(void)
TftpTimeoutCount = 0;
TftpState = STATE_SEND_RRQ;
/* Use a pseudo-random port unless a specific port is set */
-   TftpOurPort = 1024 + (get_timer(0) % 3072);
+   

[U-Boot] [PATCH v1 (WIP) 02/16] [Timer]Remove calls to set_timer outside arch/

2011-06-28 Thread Graeme Russ
There is no need to use set_timer(). Replace with appropriate use of
get_timer()

Signed-off-by: Graeme Russ graeme.r...@gmail.com

---
 board/BuS/EB+MCF-EV123/flash.c |   10 ++
 board/cobra5272/flash.c|   10 ++
 board/idmr/flash.c |   10 ++
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/board/BuS/EB+MCF-EV123/flash.c b/board/BuS/EB+MCF-EV123/flash.c
index 3c36367..8b7f957 100644
--- a/board/BuS/EB+MCF-EV123/flash.c
+++ b/board/BuS/EB+MCF-EV123/flash.c
@@ -157,6 +157,7 @@ int amd_flash_erase_sector(flash_info_t * info, int sector)
 {
int state;
ulong result;
+   ulong start;

volatile u16 *addr =
(volatile u16 *) (info-start[sector]);
@@ -171,13 +172,13 @@ int amd_flash_erase_sector(flash_info_t * info, int 
sector)

/* wait until flash is ready */
state = 0;
-   set_timer (0);
+   start = get_timer(0);

do {
result = *addr;

/* check timeout */
-   if (get_timer (0)  CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start)  CONFIG_SYS_FLASH_ERASE_TOUT) {
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
state = ERR_TIMOUT;
}
@@ -267,6 +268,7 @@ volatile static int amd_write_word (flash_info_t * info, 
ulong dest, u16 data)
ulong result;
int cflag, iflag;
int state;
+   ulong start;

/*
 * Check if Flash is (sufficiently) erased
@@ -295,7 +297,7 @@ volatile static int amd_write_word (flash_info_t * info, 
ulong dest, u16 data)
*addr = data;

/* arm simple, non interrupt dependent timer */
-   set_timer (0);
+   start = get_timer(0);

/* wait until flash is ready */
state = 0;
@@ -303,7 +305,7 @@ volatile static int amd_write_word (flash_info_t * info, 
ulong dest, u16 data)
result = *addr;

/* check timeout */
-   if (get_timer (0)  CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start)  CONFIG_SYS_FLASH_ERASE_TOUT) {
state = ERR_TIMOUT;
}
if (!state  ((result  BIT_RDY_MASK) == (data  
BIT_RDY_MASK)))
diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 33c9361..e8f02eb 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -147,6 +147,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
int iflag, cflag, prot, sect;
int rc = ERR_OK;
int chip1;
+   ulong start;

/* first look for protection bits */

@@ -190,7 +191,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
printf (Erasing sector %2d ... , sect);

/* arm simple, non interrupt dependent timer */
-   set_timer (0);
+   start = get_timer(0);

if (info-protect[sect] == 0) { /* not protected */
volatile u16 *addr =
@@ -211,7 +212,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
result = *addr;

/* check timeout */
-   if (get_timer (0)  
CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start)  
CONFIG_SYS_FLASH_ERASE_TOUT) {
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
chip1 = TMO;
break;
@@ -264,6 +265,7 @@ static int write_word (flash_info_t * info, ulong dest, 
ulong data)
int rc = ERR_OK;
int cflag, iflag;
int chip1;
+   ulong start;

/*
 * Check if Flash is (sufficiently) erased
@@ -291,7 +293,7 @@ static int write_word (flash_info_t * info, ulong dest, 
ulong data)
*addr = data;

/* arm simple, non interrupt dependent timer */
-   set_timer (0);
+   start = get_timer(0);

/* wait until flash is ready */
chip1 = 0;
@@ -299,7 +301,7 @@ static int write_word (flash_info_t * info, ulong dest, 
ulong data)
result = *addr;

/* check timeout */
-   if (get_timer (0)  CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start)  CONFIG_SYS_FLASH_ERASE_TOUT) {
chip1 = ERR | TMO;
break;
}
diff --git a/board/idmr/flash.c b/board/idmr/flash.c
index 57c9948..9f4ff2b 100644
--- a/board/idmr/flash.c
+++ b/board/idmr/flash.c
@@ -130,6 +130,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
int iflag, prot, sect;
int rc = ERR_OK;
int chip1;
+   ulong start;

/* first look for protection bits */

@@ -170,7 +171,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
printf (Erasing sector %2d ... 

[U-Boot] [PATCH v1 (WIP) 08/16] [Timer]Create new userland timer API

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 include/common.h |   36 
 lib/time.c   |   26 ++
 2 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/include/common.h b/include/common.h
index 340e585..9735d47 100644
--- a/include/common.h
+++ b/include/common.h
@@ -584,11 +584,29 @@ void  timer_interrupt(struct pt_regs *);
 void   external_interrupt (struct pt_regs *);
 void   irq_install_handler(int, interrupt_handler_t *, void *);
 void   irq_free_handler   (int);
-void   reset_timer(void);
-ulong  get_timer  (ulong base);
 void   enable_interrupts  (void);
 intdisable_interrupts (void);
 
+/*
+ * Timer API
+ */
+void reset_timer (void);
+ulong get_timer (ulong base);
+u64 get_ticks(void);
+void wait_ticks(unsigned long);
+void __udelay(unsigned long);
+ulong usec2ticks(unsigned long usec);
+ulong ticks2usec(unsigned long ticks);
+int init_timebase(void);
+
+/* lib/time.c */
+void udelay(unsigned long);
+
+u32 time_now_ms(void);
+u32 time_since_ms(u32 from, u32 to);
+u32 time_max_since_ms(u32 from, u32 to);
+u32 time_resolution_ms(void);
+
 /* $(CPU)/.../commproc.c */
 intdpram_init (void);
 uint   dpram_base(void);
@@ -616,17 +634,6 @@ void   flush_cache   (unsigned long, unsigned long);
 void   flush_dcache_range(unsigned long start, unsigned long stop);
 void   invalidate_dcache_range(unsigned long start, unsigned long stop);
 
-
-/* arch/$(ARCH)/lib/ticks.S */
-unsigned long long get_ticks(void);
-void   wait_ticks(unsigned long);
-
-/* arch/$(ARCH)/lib/time.c */
-void   __udelay  (unsigned long);
-ulong  usec2ticks(unsigned long usec);
-ulong  ticks2usec(unsigned long ticks);
-intinit_timebase (void);
-
 /* lib/gunzip.c */
 int gunzip(void *, int, unsigned char *, unsigned long *);
 int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
@@ -644,9 +651,6 @@ void qsort(void *base, size_t nmemb, size_t size,
   int(*compar)(const void *, const void *));
 int strcmp_compar(const void *, const void *);
 
-/* lib/time.c */
-void   udelay(unsigned long);
-
 /* lib/vsprintf.c */
 ulong  simple_strtoul(const char *cp,char **endp,unsigned int base);
 int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
diff --git a/lib/time.c b/lib/time.c
index a309c26..1563507 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -41,3 +41,29 @@ void udelay(unsigned long usec)
usec -= kv;
} while(usec);
 }
+
+u32 time_since_ms(u32 from)
+{
+   u32 delta = time_now_ms() - from;
+
+   /* round down */
+   if (delta  time_ms_resolution())
+   return 0;
+
+   return delta - time_resolution_ms();
+}
+
+u32 time_max_since_ms(u32 from)
+{
+   u32 delta = time_now_ms() - from;
+
+   return delta + time_resolution_ms();
+}
+
+__attribute__((weak))
+u32 time_resolution_ms(void) {return 1;}
+
+u32 time_now_ms(void)
+{
+   return get_timer(0);
+}
-- 
1.7.5.2.317.g391b14

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


[U-Boot] [PATCH v1 (WIP) 12/16] [Timer]Replace get_timer() usage in drivers/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
 drivers/fpga/ACEX1K.c |5 ++-
 drivers/fpga/cyclon2.c|5 ++-
 drivers/fpga/spartan2.c   |   30 +++
 drivers/fpga/spartan3.c   |   32 +
 drivers/fpga/virtex2.c|   20 -
 drivers/i2c/bfin-twi_i2c.c|6 ++--
 drivers/i2c/spr_i2c.c |   28 ++
 drivers/i2c/u8500_i2c.c   |8 ++--
 drivers/input/ps2mult.c   |6 ++--
 drivers/mmc/omap_hsmmc.c  |   57 -
 drivers/mtd/spi/atmel.c   |4 +-
 drivers/net/4xx_enet.c|8 ++---
 drivers/net/bcm570x.c |2 +-
 drivers/net/cs8900.c  |   17 ++-
 drivers/net/dm9000x.c |6 ++--
 drivers/net/ethoc.c   |6 ++--
 drivers/net/fec_mxc.c |   18 ++--
 drivers/net/ftgmac100.c   |6 ++--
 drivers/net/ftmac100.c|6 ++--
 drivers/net/greth.c   |   16 +-
 drivers/net/lan91c96.c|5 ++-
 drivers/net/ne2000_base.c |6 ++--
 drivers/net/netarm_eth.c  |   12 ---
 drivers/net/ns7520_eth.c  |5 ++-
 drivers/net/ns9750_eth.c  |4 +-
 drivers/net/rtl8139.c |6 ++--
 drivers/net/rtl8169.c |   26 -
 drivers/net/smc9.c|4 +-
 drivers/serial/serial_clps7111.c  |6 ++--
 drivers/serial/serial_netarm.c|4 +-
 drivers/spi/atmel_dataflash_spi.c |8 ++---
 drivers/usb/gadget/ether.c|   25 
 drivers/usb/host/ehci-hcd.c   |8 ++--
 drivers/usb/host/sl811-hcd.c  |5 ++-
 34 files changed, 220 insertions(+), 190 deletions(-)

diff --git a/drivers/fpga/ACEX1K.c b/drivers/fpga/ACEX1K.c
index 06b4247..7a8e744 100644
--- a/drivers/fpga/ACEX1K.c
+++ b/drivers/fpga/ACEX1K.c
@@ -156,10 +156,11 @@ static int ACEX1K_ps_load (Altera_desc * desc, void *buf, 
size_t bsize)
udelay(2);  /* T_cf2st1  4us   */
 
/* Wait for nSTATUS to be released (i.e. deasserted) */
-   ts = get_timer (0); /* get current time */
+   ts = timer_ms_now();/* get current time */
do {
CONFIG_FPGA_DELAY ();
-   if (get_timer (ts)  CONFIG_SYS_FPGA_WAIT) {/* 
check the time */
+   if (time_ms_delta_min(ts, timer_ms_now()) 
+   CONFIG_SYS_FPGA_WAIT) { /* check the time */
puts (** Timeout waiting for STATUS to go 
high.\n);
(*fn-abort) (cookie);
return FPGA_FAIL;
diff --git a/drivers/fpga/cyclon2.c b/drivers/fpga/cyclon2.c
index 4622b4e..5dd6cdd 100644
--- a/drivers/fpga/cyclon2.c
+++ b/drivers/fpga/cyclon2.c
@@ -139,10 +139,11 @@ static int CYC2_ps_load (Altera_desc * desc, void *buf, 
size_t bsize)
udelay(2);  /* T_cfg  2us  */
 
/* Wait for nSTATUS to be asserted */
-   ts = get_timer (0); /* get current time */
+   ts = time_now_ms(); /* get current time */
do {
CONFIG_FPGA_DELAY ();
-   if (get_timer (ts)  CONFIG_SYS_FPGA_WAIT) {/* 
check the time */
+   /* check the time */
+   if (time_since_ms(ts)  CONFIG_SYS_FPGA_WAIT) {
puts (** Timeout waiting for STATUS to go 
high.\n);
(*fn-abort) (cookie);
return FPGA_FAIL;
diff --git a/drivers/fpga/spartan2.c b/drivers/fpga/spartan2.c
index cd16a9c..cab68ef 100644
--- a/drivers/fpga/spartan2.c
+++ b/drivers/fpga/spartan2.c
@@ -168,11 +168,12 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void 
*buf, size_t bsize)
CONFIG_FPGA_DELAY ();
(*fn-pgm) (FALSE, TRUE, cookie);   /* Deassert the 
program, commit */
 
-   ts = get_timer (0); /* get current time */
+   ts = time_now_ms(); /* get current time */
/* Now wait for INIT and BUSY to go high */
do {
CONFIG_FPGA_DELAY ();
-   if (get_timer (ts)  CONFIG_SYS_FPGA_WAIT) {/* 
check the time */
+   /* check the time */
+   if (time_sine_ms(ts)  CONFIG_SYS_FPGA_WAIT) {
puts (** Timeout waiting for INIT to 
clear.\n);
(*fn-abort) (cookie);  /* abort the burn */
return FPGA_FAIL;
@@ -195,7 +196,7 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, 
size_t bsize)

Re: [U-Boot] [PATCH v1 (WIP) 01/16] [Timer]Fix misuse of ARM *timer_masked() functions outside arch/arm

2011-06-28 Thread Andreas Bießmann
Dear Graeme Russ,

Am 28.06.2011 13:40, schrieb Graeme Russ:
 
 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
..
  board/atmel/at91rm9200dk/flash.c |   10 ++

don't mind at91rm9200dk, it uses deprecated arm920t/at91rm9200 api and
will therefore removed in this merge window.

regards

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


Re: [U-Boot] [PATCH v1 (WIP) 12/16] [Timer]Replace get_timer() usage in drivers/

2011-06-28 Thread Vitaly Kuzmichev
Hello Graeme,

Graeme Russ wrote:
[...]
 diff --git a/drivers/fpga/spartan3.c b/drivers/fpga/spartan3.c
 index 1dd6f26..8282a23 100644
 --- a/drivers/fpga/spartan3.c
 +++ b/drivers/fpga/spartan3.c
[...]
 @@ -233,7 +235,7 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void 
 *buf, size_t bsize)
  #endif
  
   /* now check for done signal */
 - ts = get_timer (0); /* get current time */
 + ts = time_since_ms();   /* get current time */

Shouldn't time_now_ms() be here?


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


Re: [U-Boot] [PATCH v1 (WIP) 06/16] [Timer]Fix at91rm9200/spi.c timer usage

2011-06-28 Thread Andreas Bießmann
Dear Graeme Russ,

Am 28.06.2011 13:40, schrieb Graeme Russ:
 
 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/arm/cpu/arm920t/at91rm9200/spi.c |5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

don't mind arm920t/at91rm9200, it will be removed in this merge window
(see end of doc/README.at91-soc and various discussion threads).

regards

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


[U-Boot] [PATCH] avr32: add grasshopper (ICnova AP7000) board

2011-06-28 Thread Andreas Bießmann
The grasshopper board is a neat avr32 evaluation kit produced by In-Circuit
GmbH.
See http://www.ic-board.de/product_info.php?info=p75_ICnova-AP7000-Base.html
for detailed information about this device.

Signed-off-by: Andreas Bießmann biessm...@corscience.de
---
 board/in-circuit/grasshopper/Makefile  |   45 +++
 board/in-circuit/grasshopper/grasshopper.c |  105 +++
 boards.cfg |1 +
 include/configs/grasshopper.h  |  197 
 4 files changed, 348 insertions(+), 0 deletions(-)
 create mode 100644 board/in-circuit/grasshopper/Makefile
 create mode 100644 board/in-circuit/grasshopper/grasshopper.c
 create mode 100644 include/configs/grasshopper.h

diff --git a/board/in-circuit/grasshopper/Makefile 
b/board/in-circuit/grasshopper/Makefile
new file mode 100644
index 000..a6c36c7
--- /dev/null
+++ b/board/in-circuit/grasshopper/Makefile
@@ -0,0 +1,45 @@
+#
+# (C) Copyright 2001-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# Copyright (C) 2011
+# Corscience GmbH  Co.KG, Andreas Bießmann biessm...@corscience.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).o
+
+COBJS-y += $(BOARD).o
+
+SRCS:= $(COBJS-y:.o=.c)
+OBJS:= $(addprefix $(obj),$(COBJS-y))
+
+$(LIB): $(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/in-circuit/grasshopper/grasshopper.c 
b/board/in-circuit/grasshopper/grasshopper.c
new file mode 100644
index 000..d020c29
--- /dev/null
+++ b/board/in-circuit/grasshopper/grasshopper.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2011
+ * Corscience GmbH  Co.KG, Andreas Bießmann biessm...@corscience.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 common.h
+
+#include asm/io.h
+#include asm/sdram.h
+#include asm/arch/clk.h
+#include asm/arch/hmatrix.h
+#include asm/arch/mmu.h
+#include asm/arch/portmux.h
+#include netdev.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct mmu_vm_range mmu_vmr_table[CONFIG_SYS_NR_VM_REGIONS] = {
+{
+.virt_pgno  = CONFIG_SYS_FLASH_BASE  PAGE_SHIFT,
+.nr_pages   = CONFIG_SYS_FLASH_SIZE  PAGE_SHIFT,
+.phys   = (CONFIG_SYS_FLASH_BASE  PAGE_SHIFT)
+| MMU_VMR_CACHE_NONE,
+}, {
+.virt_pgno  = CONFIG_SYS_SDRAM_BASE  PAGE_SHIFT,
+.nr_pages   = EBI_SDRAM_SIZE  PAGE_SHIFT,
+.phys   = (CONFIG_SYS_SDRAM_BASE  PAGE_SHIFT)
+| MMU_VMR_CACHE_WRBACK,
+},
+};
+
+static const struct sdram_config sdram_config = {
+/* Dual MT48LC16M16A2-7E (or equal) */
+.data_bits  = SDRAM_DATA_32BIT,
+.row_bits   = 13,
+.col_bits   = 9,
+.bank_bits  = 2,
+.cas= 2,
+.twr= 2,
+.trc= 7,
+.trp= 2,
+.trcd   = 2,
+.tras   = 4,
+.txsr   = 7,
+/* 7.81 us */
+.refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 10,
+};
+
+int board_early_init_f(void)
+{
+/* Enable SDRAM in the EBI mux */
+hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE));
+
+portmux_enable_ebi(SDRAM_DATA_32BIT, 23, 0, 

[U-Boot] [PATCH] atstk100x: switch to common cfi driver

2011-06-28 Thread Andreas Bießmann
This patch removes the board implemenatation for flash driver which can now
safely switched to the common cfi driver.

Compile tested for all atstk100x boards, runtime tested on atstk1002.

Signed-off-by: Andreas Bießmann biessm...@corscience.de
---
 board/atmel/atstk1000/Makefile |1 -
 board/atmel/atstk1000/flash.c  |  232 
 include/configs/atstk1002.h|9 +--
 include/configs/atstk1003.h|9 +--
 include/configs/atstk1004.h|9 +--
 include/configs/atstk1006.h|9 +--
 6 files changed, 8 insertions(+), 261 deletions(-)
 delete mode 100644 board/atmel/atstk1000/flash.c

diff --git a/board/atmel/atstk1000/Makefile b/board/atmel/atstk1000/Makefile
index ae47396..a02ccf1 100644
--- a/board/atmel/atstk1000/Makefile
+++ b/board/atmel/atstk1000/Makefile
@@ -27,7 +27,6 @@ include $(TOPDIR)/config.mk
 LIB:= $(obj)lib$(BOARD).o
 
 COBJS-y+= $(BOARD).o
-COBJS-y+= flash.o
 
 SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/board/atmel/atstk1000/flash.c b/board/atmel/atstk1000/flash.c
deleted file mode 100644
index 0ba06dd..000
--- a/board/atmel/atstk1000/flash.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) 2005-2006 Atmel Corporation
- *
- * 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 common.h
-
-#ifdef CONFIG_ATSTK1000_EXT_FLASH
-#include asm/arch/cacheflush.h
-#include asm/io.h
-#include asm/sections.h
-
-DECLARE_GLOBAL_DATA_PTR;
-
-flash_info_t flash_info[1];
-
-static void flash_identify(uint16_t *flash, flash_info_t *info)
-{
-   unsigned long flags;
-
-   flags = disable_interrupts();
-
-   dcache_flush_unlocked();
-
-   writew(0xaa, flash + 0x555);
-   writew(0x55, flash + 0xaaa);
-   writew(0x90, flash + 0x555);
-   info-flash_id = readl(flash);
-   writew(0xff, flash);
-
-   readw(flash);
-
-   if (flags)
-   enable_interrupts();
-}
-
-unsigned long flash_init(void)
-{
-   unsigned long addr;
-   unsigned int i;
-
-   flash_info[0].size = CONFIG_SYS_FLASH_SIZE;
-   flash_info[0].sector_count = 135;
-
-   flash_identify(uncached((void *)CONFIG_SYS_FLASH_BASE), flash_info[0]);
-
-   for (i = 0, addr = 0; i  8; i++, addr += 0x2000)
-   flash_info[0].start[i] = addr;
-   for (; i  flash_info[0].sector_count; i++, addr += 0x1)
-   flash_info[0].start[i] = addr;
-
-   return CONFIG_SYS_FLASH_SIZE;
-}
-
-void flash_print_info(flash_info_t *info)
-{
-   printf(Flash: Vendor ID: 0x%02lx, Product ID: 0x%02lx\n,
-  info-flash_id  16, info-flash_id  0x);
-   printf(Size: %ld MB in %d sectors\n,
-  info-size  10, info-sector_count);
-}
-
-int flash_erase(flash_info_t *info, int s_first, int s_last)
-{
-   unsigned long flags;
-   unsigned long start_time;
-   uint16_t *fb, *sb;
-   unsigned int i;
-   int ret;
-   uint16_t status;
-
-   if ((s_first  0) || (s_first  s_last)
-   || (s_last = info-sector_count)) {
-   puts(Error: first and/or last sector out of range\n);
-   return ERR_INVAL;
-   }
-
-   for (i = s_first; i  s_last; i++)
-   if (info-protect[i]) {
-   printf(Error: sector %d is protected\n, i);
-   return ERR_PROTECTED;
-   }
-
-   fb = (uint16_t *)uncached(info-start[0]);
-
-   dcache_flush_unlocked();
-
-   for (i = s_first; (i = s_last)  !ctrlc(); i++) {
-   printf(Erasing sector %3d..., i);
-
-   sb = (uint16_t *)uncached(info-start[i]);
-
-   flags = disable_interrupts();
-
-   start_time = get_timer(0);
-
-   /* Unlock sector */
-   writew(0xaa, fb + 0x555);
-   writew(0x70, sb);
-
-   /* Erase sector */
-   writew(0xaa, fb + 0x555);
-   writew(0x55, fb + 0xaaa);
-   writew(0x80, fb + 0x555);
-   writew(0xaa, fb + 0x555);
-   writew(0x55, fb + 0xaaa);
- 

[U-Boot] [2/5]devkit8000 nand_spl: omap3 support nand_spl boot

2011-06-28 Thread simonschwarzcor
Deactivates caching in SPL. Add call to preloader_console_init for early 
console output.

Signed-off-by: Simon Schwarz schw...@corscience.de
--

diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 6c2a132..bb38289 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -37,6 +37,7 @@
 #include asm/arch/sys_proto.h
 #include asm/arch/mem.h
 #include asm/cache.h
+#include asm/omap_common.h
 
 extern omap3_sysinfo sysinfo;
 
@@ -166,10 +167,15 @@ void s_init(void)
 
try_unlock_memory();
 
+#ifdef CONFIG_PRELOADER
+   v7_flush_cache_all();
+#endif
+
/*
 * Right now flushing at low MPU speed.
 * Need to move after clock init
 */
+#ifndef CONFIG_PRELOADER
invalidate_dcache(get_device_type());
 #ifndef CONFIG_ICACHE_OFF
icache_enable();
@@ -187,13 +193,15 @@ void s_init(void)
 */
if (get_device_type() == GP_DEVICE)
setup_auxcr();
-
+#endif /*CONFIG_PRELOADER*/
set_muxconf_regs();
delay(100);
 
prcm_init();
-
per_clocks_enable();
+#ifdef CONFIG_PRELOADER
+   preloader_console_init();
+#endif
 
if (!in_sdram)
mem_init();
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
new file mode 100644
index 000..375938b
--- /dev/null
+++ b/arch/arm/include/asm/omap_common.h
@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2010
+ * Texas Instruments, www.ti.com
+ *
+ * Aneesh V ane...@ti.com
+ *
+ * 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
+ */
+#ifndef_OMAP_COMMON_H_
+#define_OMAP_COMMON_H_
+
+void preloader_console_init(void);
+
+#endif /* _OMAP_COMMON_H_ */
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [5/5]devkit8000 nand_spl: add nand_spl support

2011-06-28 Thread simonschwarzcor
Adds the board config for devkit8000 nand_spl. Adds SPL specific defines to 
board configuration. Adds the nand_spl Makefile for devkit8000. Adds the main 
spl implementation to nand_spl including early console init. Adds nand_spl 
linker script.

Signed-off-by: Simon Schwarz schw...@corscience.de
--

diff --git a/boards.cfg b/boards.cfg
index dfefc3f..bdc4136 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -74,15 +74,6 @@ omap1510inn  arm arm925t -   
ti
 aspenite arm arm926ejs   -   
Marvellarmada100
 afeb9260 arm arm926ejs   -   - 
 at91
 at91cap9adk  arm arm926ejs   -   atmel 
 at91
-at91sam9260ek_nandflash  arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9260,SYS_USE_NANDFLASH
-at91sam9260ek_dataflash_cs0  arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9260,SYS_USE_DATAFLASH_CS0
-at91sam9260ek_dataflash_cs1  arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9260,SYS_USE_DATAFLASH_CS1
-at91sam9g20ek_nandflash  arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9G20,SYS_USE_NANDFLASH
-at91sam9g20ek_dataflash_cs0  arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS0
-at91sam9g20ek_dataflash_cs1  arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS1
-at91sam9xeek_nandflash   arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
-at91sam9xeek_dataflash_cs0   arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
-at91sam9xeek_dataflash_cs1   arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
 snapper9260  arm arm926ejs   -   
bluewater  at91snapper9260:AT91SAM9260
 snapper9g20  arm arm926ejs   snapper9260 
bluewater  at91snapper9260:AT91SAM9G20
 cpu9260  arm arm926ejs   cpu9260 
eukrea at91cpu9260:CPU9260
@@ -117,7 +108,7 @@ davinci_sffsdr   arm arm926ejs   sffsdr 
 davinci
 davinci_sonata   arm arm926ejs   sonata  
davincidavinci
 suen3arm arm926ejs   km_arm  
keymilekirkwood
 suen8arm arm926ejs   km_arm  
keymilekirkwood
-mgcoge3unarm arm926ejs   km_arm  
keymilekirkwood
+mgcoge2unarm arm926ejs   km_arm  
keymilekirkwood
 guruplug arm arm926ejs   -   
Marvellkirkwood
 mv88f6281gtw_ge  arm arm926ejs   -   
Marvellkirkwood
 openrd_base  arm arm926ejs   openrd  
Marvellkirkwoodopenrd:BOARD_IS_OPENRD_BASE
@@ -135,12 +126,10 @@ omap5912osk  arm arm926ejs   -
   ti
 edminiv2 arm arm926ejs   -   LaCie 
 orion5x
 dkb arm arm926ejs   -   
Marvellpantheon
 ca9x4_ct_vxp arm armv7   vexpressarmltd
-efikamx  arm armv7   efikamx - 
 mx5mx51evk:IMX_CONFIG=board/efikamx/imximage.cfg
+efikamx  arm armv7   efikamx - 
 mx5
 mx51evk  arm armv7   mx51evk 
freescale  mx5
mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg
 mx53evk  arm armv7   mx53evk 
freescale  mx5
mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
-mx53loco arm armv7   mx53loco
freescale  mx5
mx53loco:IMX_CONFIG=board/freescale/mx53loco/imximage.cfg
-mx53smd  arm armv7   mx53smd 
freescale  mx5
mx53smd:IMX_CONFIG=board/freescale/mx53smd/imximage.cfg
-vision2  arm armv7   vision2 
ttcontrol  mx5
vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg
+vision2  arm armv7   vision2 
ttcontrol  mx5
 cm_t35   arm 

[U-Boot] [3/5]devkit8000 nand_spl: Add RAM configuration independent of x-loader or CH

2011-06-28 Thread simonschwarzcor
OMAP3 relied on the memory config done by X-loader or Configuration Header. 
This has to be reworked for the implementation of a SPL. This patch configures 
RAM bank 0 if CONFIG_PRELOADER is set. Settings for Micron-RAM used by 
devkit8000 are added to mem.h

Signed-off-by: Simon Schwarz schw...@corscience.de
--

diff --git a/arch/arm/cpu/armv7/omap3/sdrc.c b/arch/arm/cpu/armv7/omap3/sdrc.c
index 2a7970b..d9e7313 100644
--- a/arch/arm/cpu/armv7/omap3/sdrc.c
+++ b/arch/arm/cpu/armv7/omap3/sdrc.c
@@ -8,6 +8,9 @@
  * Copyright (C) 2004-2010
  * Texas Instruments Incorporated - http://www.ti.com/
  *
+ * Copyright (C) 2011
+ * Corscience GmbH  Co. KG - Simon Schwarz schw...@corscience.de
+ *
  * Author :
  * Vaibhav Hiremath hvaib...@ti.com
  *
@@ -36,6 +39,7 @@
 #include asm/io.h
 #include asm/arch/mem.h
 #include asm/arch/sys_proto.h
+#include asm/utils.h
 
 DECLARE_GLOBAL_DATA_PTR;
 extern omap3_sysinfo sysinfo;
@@ -133,13 +137,38 @@ void do_sdrc_init(u32 cs, u32 early)
sdelay(0x2);
}
 
+#ifdef CONFIG_PRELOADER
+   /* If we use a SPL there is no x-loader nor config header so we have
+* to do the job ourselfs
+*/
+   if (cs == CS0) {
+   sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE;
+
+   /* General SDRC config */
+   writel(V_MCFG, sdrc_base-cs[cs].mcfg);
+   writel(V_RFR_CTRL, sdrc_base-cs[cs].rfr_ctrl);
+
+   /* AC timings */
+   writel(V_ACTIMA_165, sdrc_actim_base0-ctrla);
+   writel(V_ACTIMB_165, sdrc_actim_base0-ctrlb);
+
+   /* Initialize */
+   writel(CMD_NOP, sdrc_base-cs[cs].manual);
+   writel(CMD_PRECHARGE, sdrc_base-cs[cs].manual);
+   writel(CMD_AUTOREFRESH, sdrc_base-cs[cs].manual);
+   writel(CMD_AUTOREFRESH, sdrc_base-cs[cs].manual);
+
+   writel(V_MR, sdrc_base-cs[cs].mr);
+   }
+#endif
+
/*
 * SDRC timings are set up by x-load or config header
 * We don't need to redo them here.
 * Older x-loads configure only CS0
 * configure CS1 to handle this ommission
 */
-   if (cs) {
+   if (cs == CS1) {
sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE;
sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE;
writel(readl(sdrc_base-cs[CS0].mcfg),
@@ -163,8 +192,11 @@ void do_sdrc_init(u32 cs, u32 early)
 * Test ram in this bank
 * Disable if bad or not present
 */
-   if (!mem_ok(cs))
+   if (!mem_ok(cs)) {
+   spl_debug(RAM test: FAILED!\n);
writel(0, sdrc_base-cs[cs].mcfg);
+   }
+   spl_debug(RAM test: PASSED!\n);
 }
 
 /*
diff --git a/arch/arm/include/asm/arch-omap3/mem.h 
b/arch/arm/include/asm/arch-omap3/mem.h
index f165949..8b39745 100644
--- a/arch/arm/include/asm/arch-omap3/mem.h
+++ b/arch/arm/include/asm/arch-omap3/mem.h
@@ -128,6 +128,33 @@ enum {
(MICRON_XSR_165  0) | (MICRON_TXP_165  8) | \
(MICRON_TWTR_165  16))
 
+#define MICRON_RAMTYPE 0x1
+#define MICRON_DDRTYPE 0x0
+#define MICRON_DEEPPD  0x1
+#define MICRON_B32NOT160x1
+#define MICRON_BANKALLOCATION  0x2
+#define MICRON_RAMSIZE ((PHYS_SDRAM_1_SIZE/(1024*1024))/2)
+#define MICRON_ADDRMUXLEGACY   0x1
+#define MICRON_CASWIDTH0x5
+#define MICRON_RASWIDTH0x2
+#define MICRON_LOCKSTATUS  0x0
+#define MICRON_V_MCFG ((MICRON_LOCKSTATUS  30) | (MICRON_RASWIDTH  24) | \
+   (MICRON_CASWIDTH  20) | (MICRON_ADDRMUXLEGACY  19) | \
+   (MICRON_RAMSIZE  8) | (MICRON_BANKALLOCATION  6) | \
+   (MICRON_B32NOT16  4) | (MICRON_DEEPPD  3) | \
+   (MICRON_DDRTYPE  2) | (MICRON_RAMTYPE))
+
+#define MICRON_ARCV2030
+#define MICRON_ARE 0x1
+#define MICRON_V_RFR_CTRL ((MICRON_ARCV  8) | (MICRON_ARE))
+
+#define MICRON_BL  0x2
+#define MICRON_SIL 0x0
+#define MICRON_CASL0x3
+#define MICRON_WBST0x0
+#define MICRON_V_MR ((MICRON_WBST  9) | (MICRON_CASL  4) | \
+   (MICRON_SIL  3) | (MICRON_BL))
+
 /*
  * NUMONYX part of IGEP v2 (165MHz optimized) 6.06ns
  *   ACTIMA
@@ -171,10 +198,15 @@ enum {
 #define V_ACTIMA_165 INFINEON_V_ACTIMA_165
 #define V_ACTIMB_165 INFINEON_V_ACTIMB_165
 #endif
+
 #ifdef CONFIG_OMAP3_MICRON_DDR
-#define V_ACTIMA_165 MICRON_V_ACTIMA_165
-#define V_ACTIMB_165 MICRON_V_ACTIMB_165
+#define V_ACTIMA_165   MICRON_V_ACTIMA_165
+#define V_ACTIMB_165   MICRON_V_ACTIMB_165
+#define V_MCFG MICRON_V_MCFG
+#define V_RFR_CTRL MICRON_V_RFR_CTRL
+#define V_MR   MICRON_V_MR
 #endif
+
 #ifdef CONFIG_OMAP3_NUMONYX_DDR
 #define 

[U-Boot] [4/5]devkit8000 nand_spl: Add SPL NAND support to omap_gpmc driver

2011-06-28 Thread simonschwarzcor
Add support for NAND_SPL to omap gpmc driver. This means adding nand_read_buf16 
to read from GPMC 32bit buffer (16 here means 16bit bus!) and adding 
omap_dev_ready as indicator if the GPMC is ready.  

Signed-off-by: Simon Schwarz schw...@corscience.de
--

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index 99b9cef..7dfb05d 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -29,6 +29,9 @@
 #include linux/mtd/nand_ecc.h
 #include nand.h
 
+
+#define GPMC_WAIT0_PIN_ACTIVE (1  8)
+
 static uint8_t cs;
 static struct nand_ecclayout hw_nand_oob = GPMC_NAND_HW_ECC_LAYOUT;
 
@@ -61,6 +64,37 @@ static void omap_nand_hwcontrol(struct mtd_info *mtd, 
int32_t cmd,
writeb(cmd, this-IO_ADDR_W);
 }
 
+/* Check wait pin as dev ready indicator */
+int omap_dev_ready(struct mtd_info *mtd)
+{
+   return gpmc_cfg-status  GPMC_WAIT0_PIN_ACTIVE;
+}
+
+#ifdef CONFIG_PRELOADER
+
+/**
+ * nand_read_buf16 - [DEFAULT] read chip data into buffer
+ * @mtd:MTD device structure
+ * @buf:buffer to store date
+ * @len:number of bytes to read
+ *
+ * Default read function for 16bit buswith
+ *
+ * This function is based on nand_read_buf16 from nand_base.c. This version
+ * reads 32bit not 16bit although the bus only has 16bit.
+ */
+static void gpmc_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
+{
+   int i;
+   struct nand_chip *chip = mtd-priv;
+   u32 *p = (u32 *) buf;
+   len = 2;
+
+   for (i = 0; i  len; i++)
+   p[i] = readl(chip-IO_ADDR_R);
+}
+#endif
+
 /*
  * omap_hwecc_init - Initialize the Hardware ECC for NAND flash in
  *   GPMC controller
@@ -278,7 +312,9 @@ void omap_nand_switch_ecc(int32_t hardware)
/* Update NAND handling after ECC mode switch */
nand_scan_tail(mtd);
 
+   #ifndef CONFIG_SPL
nand-options = ~NAND_OWN_BUFFERS;
+   #endif
 }
 
 /*
@@ -337,8 +373,23 @@ int board_nand_init(struct nand_chip *nand)
nand-options |= NAND_BUSWIDTH_16;
 
nand-chip_delay = 100;
+   nand-dev_ready = omap_dev_ready;
/* Default ECC mode */
+#ifndef CONFIG_PRELOADER
nand-ecc.mode = NAND_ECC_SOFT;
+#else
+   nand-ecc.mode = NAND_ECC_HW;
+   nand-ecc.layout = hw_nand_oob;
+   nand-ecc.size = 512;
+   nand-ecc.bytes = 24;
+   nand-ecc.hwctl = omap_enable_hwecc;
+   nand-ecc.correct = omap_correct_data;
+   nand-ecc.calculate = omap_calculate_ecc;
+   nand-read_buf = gpmc_read_buf16;
+   omap_hwecc_init(nand);
+#endif
 
return 0;
 }
+
+
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [5/5]devkit8000 nand_spl: add nand_spl support

2011-06-28 Thread Andreas Bießmann
Dear Simon Schwarz,

Am 28.06.2011 16:14, schrieb simonschwarz...@googlemail.com:

snip long line

 Signed-off-by: Simon Schwarz schw...@corscience.de
 --
 
 diff --git a/boards.cfg b/boards.cfg
 index dfefc3f..bdc4136 100644
 --- a/boards.cfg
 +++ b/boards.cfg
 @@ -74,15 +74,6 @@ omap1510inn  arm arm925t - 
   ti
  aspenite arm arm926ejs   -   
 Marvellarmada100
  afeb9260 arm arm926ejs   -   -   
at91
  at91cap9adk  arm arm926ejs   -   
 atmel  at91
 -at91sam9260ek_nandflash  arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9260,SYS_USE_NANDFLASH
 -at91sam9260ek_dataflash_cs0  arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9260,SYS_USE_DATAFLASH_CS0
 -at91sam9260ek_dataflash_cs1  arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9260,SYS_USE_DATAFLASH_CS1
 -at91sam9g20ek_nandflash  arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9G20,SYS_USE_NANDFLASH
 -at91sam9g20ek_dataflash_cs0  arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS0
 -at91sam9g20ek_dataflash_cs1  arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS1
 -at91sam9xeek_nandflash   arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
 -at91sam9xeek_dataflash_cs0   arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
 -at91sam9xeek_dataflash_cs1   arm arm926ejs   at91sam9260ek   
 atmel  at91at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1

don't touch this ..

  snapper9260  arm arm926ejs   -   
 bluewater  at91snapper9260:AT91SAM9260
  snapper9g20  arm arm926ejs   snapper9260 
 bluewater  at91snapper9260:AT91SAM9G20
  cpu9260  arm arm926ejs   cpu9260 
 eukrea at91cpu9260:CPU9260
 @@ -117,7 +108,7 @@ davinci_sffsdr   arm arm926ejs   
 sffsdr  davinci
  davinci_sonata   arm arm926ejs   sonata  
 davincidavinci
  suen3arm arm926ejs   km_arm  
 keymilekirkwood
  suen8arm arm926ejs   km_arm  
 keymilekirkwood
 -mgcoge3unarm arm926ejs   km_arm  
 keymilekirkwood
 +mgcoge2unarm arm926ejs   km_arm  
 keymilekirkwood

and that .. and some more places

  guruplug arm arm926ejs   -   
 Marvellkirkwood
  mv88f6281gtw_ge  arm arm926ejs   -   
 Marvellkirkwood
  openrd_base  arm arm926ejs   openrd  
 Marvellkirkwoodopenrd:BOARD_IS_OPENRD_BASE
 @@ -135,12 +126,10 @@ omap5912osk  arm arm926ejs   -  
  ti
  edminiv2 arm arm926ejs   -   
 LaCie  orion5x
  dkb   arm arm926ejs   -   
 Marvellpantheon
  ca9x4_ct_vxp arm armv7   vexpress
 armltd
 -efikamx  arm armv7   efikamx -   
mx5  mx51evk:IMX_CONFIG=board/efikamx/imximage.cfg
 +efikamx  arm armv7   efikamx -   
mx5
  mx51evk  arm armv7   mx51evk 
 freescale  mx5  
 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg
  mx53evk  arm armv7   mx53evk 
 freescale  mx5  
 mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
 -mx53loco arm armv7   mx53loco
 freescale  mx5  
 mx53loco:IMX_CONFIG=board/freescale/mx53loco/imximage.cfg
 -mx53smd  arm armv7   mx53smd 
 freescale  mx5  
 mx53smd:IMX_CONFIG=board/freescale/mx53smd/imximage.cfg
 -vision2  arm armv7   vision2 
 ttcontrol  mx5  
 vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg
 +vision2  arm armv7   vision2 
 ttcontrol  mx5
  cm_t35   arm armv7   cm_t35 

Re: [U-Boot] [STATUS] v2011.06 release, Merge Window is OPEN

2011-06-28 Thread Loïc Minier
On Tue, Jun 28, 2011, Wolfgang Denk wrote:
 - The cleanup after the reorganization of the ARM code has not been
   completed yet. At the moment, approapprox, 100+ ARM boards are
   *broken* and *do not compile*.
 
   Board maintainers or other interested parties are requested to
   adapt their boards within the current merge window. All boards that
   have not been fixed within the first week of the merge window are
   considered unmaintained and without interest to the community and
   will be removed.

 It's funny how this reminds me of package build failures in Debian; in
 such cases, we start by publishing the list of affected packages
 ideally with links to build logs and the name of corresponding
 maintainers.  After a while, we actually start Cc:ing the maintainers
 or filing bug reports against each failing package.

 Would it make sense to publish such a list of broken boards and
 corresponding maintainers?  (Maybe some makeall + scripts magic?)

 This is a sample list of Debian packages not declaring the upstream
 Homepage properly:
http://lists.debian.org/debian-devel/2011/02/msg00367.html

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


[U-Boot] [PATCH v4 0/6] Add Highbank platform

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

This series enables non-PCI AHCI controllers and adds support for Calxeda
Highbank platform which uses the AHCI changes. 

Changes from v3:
- Added Highbank to MAINTAINERS
- Added back patch to fix CONFIG_SKIP_LOWLEVEL_INIT (mistakenly dropped
from v2)

Wolfgang, Albert,

Can you apply these to your trees for v2011.09? All review comments have been
addressed.

Rob


Rob Herring (6):
  ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7
  ARM: Add Calxeda Highbank platform
  arm: add __ilog2 function
  scsi/ahci: ata id little endian fix
  scsi/ahci: add support for non-PCI controllers
  ARM: highbank: Add AHCI support

 MAINTAINERS   |4 +
 arch/arm/cpu/armv7/highbank/Makefile  |   46 
 arch/arm/cpu/armv7/highbank/config.mk |4 +
 arch/arm/cpu/armv7/highbank/timer.c   |  124 +
 arch/arm/cpu/armv7/start.S|2 +
 arch/arm/include/asm/bitops.h |9 +++
 board/highbank/Makefile   |   49 +
 board/highbank/highbank.c |   58 +++
 boards.cfg|1 +
 common/cmd_scsi.c |6 +-
 drivers/block/ahci.c  |   72 ---
 include/ahci.h|4 +
 include/configs/highbank.h|  112 +
 include/scsi.h|1 +
 14 files changed, 480 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/highbank/Makefile
 create mode 100644 arch/arm/cpu/armv7/highbank/config.mk
 create mode 100644 arch/arm/cpu/armv7/highbank/timer.c
 create mode 100644 board/highbank/Makefile
 create mode 100644 board/highbank/highbank.c
 create mode 100644 include/configs/highbank.h

-- 
1.7.4.1

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


[U-Boot] [PATCH 1/6] ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

cpu_init_crit can be skipped, but the code is still enabled requiring a
platform to supply lowlevel_init.

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: Albert ARIBAUD albert.arib...@free.fr
---
 arch/arm/cpu/armv7/start.S |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index d91ae12..ec54125 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -275,6 +275,7 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
.word __dynsym_start - _start
 
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
 /*
  *
  * CPU_init_critical registers
@@ -311,6 +312,7 @@ cpu_init_crit:
bl  lowlevel_init   @ go setup pll,mux,memory
mov lr, ip  @ restore link
mov pc, lr  @ back to my caller
+#endif
 /*
  *
  *
-- 
1.7.4.1

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


[U-Boot] [PATCH 3/6] arm: add __ilog2 function

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

Add __ilog2 function for ARM. Needed for ahci.c

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: Albert ARIBAUD albert.arib...@free.fr
---
 arch/arm/include/asm/bitops.h |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 270f163..0420182 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr)
 return ((unsigned char *) addr)[nr  3]  (1U  (nr  7));
 }
 
+extern __inline__ int __ilog2(unsigned int x)
+{
+   int ret;
+
+   asm(clz\t%0, %1 : =r (ret) : r (x));
+   ret = 31 - ret;
+   return ret;
+}
+
 /*
  * ffz = Find First Zero in word. Undefined if no zero exists,
  * so code should check against ~0UL first..
-- 
1.7.4.1

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


[U-Boot] [PATCH 4/6] scsi/ahci: ata id little endian fix

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

The ata id string always needs swapping, not just on BE machines.

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: Wolfgang Denk w...@denx.de
---
 drivers/block/ahci.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index a3ca2dc..d431c5a 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -468,7 +468,7 @@ static char *ata_id_strcpy(u16 *target, u16 *src, int len)
 {
int i;
for (i = 0; i  len / 2; i++)
-   target[i] = le16_to_cpu(src[i]);
+   target[i] = swab16(src[i]);
return (char *)target;
 }
 
-- 
1.7.4.1

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


[U-Boot] [PATCH 5/6] scsi/ahci: add support for non-PCI controllers

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

Add support for AHCI controllers that are not PCI based.

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: Wolfgang Denk w...@denx.de
---
 common/cmd_scsi.c|6 +++-
 drivers/block/ahci.c |   70 +++--
 include/ahci.h   |4 +++
 include/scsi.h   |1 +
 4 files changed, 70 insertions(+), 11 deletions(-)

diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index be4fe74..25a8299 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -47,7 +47,8 @@
 #define SCSI_DEV_ID  0x5288
 
 #else
-#error no scsi device defined
+#define SCSI_VEND_ID 0
+#define SCSI_DEV_ID  0
 #endif
 
 
@@ -174,7 +175,7 @@ removable:
scsi_curr_dev = -1;
 }
 
-
+#ifdef CONFIG_PCI
 void scsi_init(void)
 {
int busdevfunc;
@@ -192,6 +193,7 @@ void scsi_init(void)
scsi_low_level_init(busdevfunc);
scsi_scan(1);
 }
+#endif
 
 block_dev_desc_t * scsi_get_dev(int dev)
 {
diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index d431c5a..d12cb71 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -78,13 +78,15 @@ static int waiting_for_cmd_completed(volatile u8 *offset,
 
 static int ahci_host_init(struct ahci_probe_ent *probe_ent)
 {
+#ifdef CONFIG_PCI
pci_dev_t pdev = probe_ent-dev;
+   u16 tmp16;
+   unsigned short vendor;
+#endif
volatile u8 *mmio = (volatile u8 *)probe_ent-mmio_base;
u32 tmp, cap_save;
-   u16 tmp16;
int i, j;
volatile u8 *port_mmio;
-   unsigned short vendor;
 
cap_save = readl(mmio + HOST_CAP);
cap_save = ((1  28) | (1  17));
@@ -110,6 +112,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
writel(cap_save, mmio + HOST_CAP);
writel_with_flush(0xf, mmio + HOST_PORTS_IMPL);
 
+#ifdef CONFIG_PCI
pci_read_config_word(pdev, PCI_VENDOR_ID, vendor);
 
if (vendor == PCI_VENDOR_ID_INTEL) {
@@ -118,7 +121,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
tmp16 |= 0xf;
pci_write_config_word(pdev, 0x92, tmp16);
}
-
+#endif
probe_ent-cap = readl(mmio + HOST_CAP);
probe_ent-port_map = readl(mmio + HOST_PORTS_IMPL);
probe_ent-n_ports = (probe_ent-cap  0x1f) + 1;
@@ -183,22 +186,24 @@ static int ahci_host_init(struct ahci_probe_ent 
*probe_ent)
writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL);
tmp = readl(mmio + HOST_CTL);
debug(HOST_CTL 0x%x\n, tmp);
-
+#ifdef CONFIG_PCI
pci_read_config_word(pdev, PCI_COMMAND, tmp16);
tmp |= PCI_COMMAND_MASTER;
pci_write_config_word(pdev, PCI_COMMAND, tmp16);
-
+#endif
return 0;
 }
 
 
 static void ahci_print_info(struct ahci_probe_ent *probe_ent)
 {
+#ifdef CONFIG_PCI
pci_dev_t pdev = probe_ent-dev;
+   u16 cc;
+#endif
volatile u8 *mmio = (volatile u8 *)probe_ent-mmio_base;
u32 vers, cap, impl, speed;
const char *speed_s;
-   u16 cc;
const char *scc_s;
 
vers = readl(mmio + HOST_VERSION);
@@ -212,7 +217,7 @@ static void ahci_print_info(struct ahci_probe_ent 
*probe_ent)
speed_s = 3;
else
speed_s = ?;
-
+#ifdef CONFIG_PCI
pci_read_config_word(pdev, 0x0a, cc);
if (cc == 0x0101)
scc_s = IDE;
@@ -222,7 +227,9 @@ static void ahci_print_info(struct ahci_probe_ent 
*probe_ent)
scc_s = RAID;
else
scc_s = unknown;
-
+#else
+   scc_s = SATA;
+#endif
printf(AHCI %02x%02x.%02x%02x 
   %u slots %u ports %s Gbps 0x%x impl %s mode\n,
   (vers  24)  0xff,
@@ -249,6 +256,7 @@ static void ahci_print_info(struct ahci_probe_ent 
*probe_ent)
   cap  (1  13) ? part  : );
 }
 
+#ifdef CONFIG_PCI
 static int ahci_init_one(pci_dev_t pdev)
 {
u16 vendor;
@@ -291,7 +299,7 @@ static int ahci_init_one(pci_dev_t pdev)
   err_out:
return rc;
 }
-
+#endif
 
 #define MAX_DATA_BYTE_COUNT  (4*1024*1024)
 
@@ -667,7 +675,9 @@ void scsi_low_level_init(int busdevfunc)
int i;
u32 linkmap;
 
+#ifdef CONFIG_PCI
ahci_init_one(busdevfunc);
+#endif
 
linkmap = probe_ent-link_port_map;
 
@@ -682,6 +692,48 @@ void scsi_low_level_init(int busdevfunc)
}
 }
 
+int ahci_init(u32 base)
+{
+   int i, rc = 0;
+   u32 linkmap;
+
+   memset(ataid, 0, sizeof(ataid));
+
+   probe_ent = malloc(sizeof(struct ahci_probe_ent));
+   memset(probe_ent, 0, sizeof(struct ahci_probe_ent));
+
+   probe_ent-host_flags = ATA_FLAG_SATA
+   | ATA_FLAG_NO_LEGACY
+   | ATA_FLAG_MMIO
+   | ATA_FLAG_PIO_DMA
+   | ATA_FLAG_NO_ATAPI;
+   probe_ent-pio_mask = 0x1f;
+   probe_ent-udma_mask = 0x7f;/*Fixme,assume to support UDMA6 */
+
+   

[U-Boot] [PATCH 6/6] ARM: highbank: Add AHCI support

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

This enables the AHCI driver on highbank platforms.

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: Wolfgang Denk w...@denx.de
Cc: Albert ARIBAUD albert.arib...@free.fr
---
 board/highbank/highbank.c  |9 +
 include/configs/highbank.h |   11 +++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 9a0fc19..bec3d2f 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -16,6 +16,8 @@
  */
 
 #include common.h
+#include ahci.h
+#include scsi.h
 
 #include asm/sizes.h
 
@@ -31,6 +33,13 @@ int board_init(void)
return 0;
 }
 
+int misc_init_r(void)
+{
+   ahci_init(0xffe08000);
+   scsi_scan(1);
+   return 0;
+}
+
 int dram_init(void)
 {
gd-ram_size = SZ_512M;
diff --git a/include/configs/highbank.h b/include/configs/highbank.h
index 6e26848..0ae198d 100644
--- a/include/configs/highbank.h
+++ b/include/configs/highbank.h
@@ -41,6 +41,15 @@
 #define CONFIG_BAUDRATE38400
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
 
+#define CONFIG_MISC_INIT_R
+#define CONFIG_SCSI_AHCI
+#define CONFIG_SYS_SCSI_MAX_SCSI_ID5
+#define CONFIG_SYS_SCSI_MAX_LUN1
+#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
+   CONFIG_SYS_SCSI_MAX_LUN)
+
+#define CONFIG_DOS_PARTITION
+
 /*
  * Command line configuration.
  */
@@ -52,6 +61,8 @@
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_LOADS
+#define CONFIG_CMD_SCSI
+#define CONFIG_CMD_EXT2
 
 #define CONFIG_BOOTDELAY   2
 /*
-- 
1.7.4.1

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


[U-Boot] [PATCH 2/6] ARM: Add Calxeda Highbank platform

2011-06-28 Thread Rob Herring
From: Rob Herring rob.herr...@calxeda.com

Add basic support for Calxeda Highbank platform. Only minimal support to boot
is included.

Signed-off-by: Jason Hobbs jason.ho...@calxeda.com
Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: Albert ARIBAUD albert.arib...@free.fr
---
 MAINTAINERS   |4 +
 arch/arm/cpu/armv7/highbank/Makefile  |   46 
 arch/arm/cpu/armv7/highbank/config.mk |4 +
 arch/arm/cpu/armv7/highbank/timer.c   |  124 +
 board/highbank/Makefile   |   49 +
 board/highbank/highbank.c |   49 +
 boards.cfg|1 +
 include/configs/highbank.h|  101 +++
 8 files changed, 378 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/highbank/Makefile
 create mode 100644 arch/arm/cpu/armv7/highbank/config.mk
 create mode 100644 arch/arm/cpu/armv7/highbank/timer.c
 create mode 100644 board/highbank/Makefile
 create mode 100644 board/highbank/highbank.c
 create mode 100644 include/configs/highbank.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 2bba7b4..515347d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -225,6 +225,10 @@ Wolfgang Grandegger w...@denx.de
IPHASE4539  MPC8260
SCM MPC8260
 
+Rob Herring rob.herr...@calxeda.com
+
+   highbankhighbank
+
 Klaus Heydeck heyd...@kieback-peter.de
 
KUP4K   MPC855
diff --git a/arch/arm/cpu/armv7/highbank/Makefile 
b/arch/arm/cpu/armv7/highbank/Makefile
new file mode 100644
index 000..76faeb0
--- /dev/null
+++ b/arch/arm/cpu/armv7/highbank/Makefile
@@ -0,0 +1,46 @@
+#
+# (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$(SOC).o
+
+COBJS  := timer.o
+SOBJS  :=
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/arm/cpu/armv7/highbank/config.mk 
b/arch/arm/cpu/armv7/highbank/config.mk
new file mode 100644
index 000..5ed5c39
--- /dev/null
+++ b/arch/arm/cpu/armv7/highbank/config.mk
@@ -0,0 +1,4 @@
+STANDALONE_LOAD_ADDR = 0x10
+
+PLATFORM_CPPFLAGS += -march=armv7-a
+
diff --git a/arch/arm/cpu/armv7/highbank/timer.c 
b/arch/arm/cpu/armv7/highbank/timer.c
new file mode 100644
index 000..263f11a
--- /dev/null
+++ b/arch/arm/cpu/armv7/highbank/timer.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2010-2011 Calxeda, Inc.
+ *
+ * Based on arm926ejs/mx27/timer.c
+ *
+ * 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 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, see http://www.gnu.org/licenses/.
+ */
+
+#include common.h
+#include div64.h
+#include linux/types.h/* for size_t */
+#include linux/stddef.h   /* for NULL */
+#include asm/io.h
+#include asm/arch-armv7/systimer.h
+
+#undef SYSTIMER_BASE
+#define SYSTIMER_BASE  0xFFF34000  /* Timer 0 and 1 base   */
+#define SYSTIMER_RATE  15000
+
+static ulong timestamp;
+static ulong lastinc;
+static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE;
+
+/*
+ * Start the timer
+ */
+int timer_init(void)
+{
+   /*
+* Setup timer0
+*/
+   writel(SYSTIMER_RELOAD, systimer_base-timer0load);
+   writel(SYSTIMER_RELOAD, 

Re: [U-Boot] SPL framework re-design

2011-06-28 Thread Scott Wood
On Tue, 28 Jun 2011 12:24:11 +0530
Aneesh V ane...@ti.com wrote:

 1. If there are SPL customized generic files like the
 nand_spl/nand_boot.c where do we keep them? I suggest that we keep them
 in spl/nand, spl/onenand etc. And for the object file hierarchy let's
 have something like spl/obj. How about that?

How about drivers/nand/generic_spl.c, drivers/nand/fsl_elbc_spl.c, etc.?

-Scott

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


[U-Boot] [PATCH 2/9] sf: macronix: add MX25L4005 and MX25L8005

2011-06-28 Thread Mike Frysinger
From: Macpaul Lin macp...@andestech.com

Add support of MX25L4005 and MX25L8005 according to the datasheet
http://www.mct.net/download/macronix/mx25l8005.pdf

This patch has been tested with MX25L4005 and MX25L8005

Signed-off-by: Macpaul Lin macp...@andestech.com
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/macronix.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index ff66f2a..90aa657 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -71,6 +71,22 @@ static inline struct macronix_spi_flash 
*to_macronix_spi_flash(struct spi_flash
 
 static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
{
+   .idcode = 0x2013,
+   .page_size = 256,
+   .pages_per_sector = 16,
+   .sectors_per_block = 16,
+   .nr_blocks = 8,
+   .name = MX25L4005,
+   },
+   {
+   .idcode = 0x2014,
+   .page_size = 256,
+   .pages_per_sector = 16,
+   .sectors_per_block = 16,
+   .nr_blocks = 16,
+   .name = MX25L8005,
+   },
+   {
.idcode = 0x2015,
.page_size = 256,
.pages_per_sector = 16,
-- 
1.7.5.3

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


[U-Boot] [PATCH 0/9] spi flash updates for v2011.09

2011-06-28 Thread Mike Frysinger
These have all been posted already.  A few part updates, bug fixes,
code unification, and that kind of fun stuff.

Macpaul Lin (1):
  sf: macronix: add MX25L4005 and MX25L8005

Mike Frysinger (6):
  sf: unify write enable commands
  sf: unify write funcs
  sf: kill off now-unused local state
  sf: eon/stmicro: inline useless ID defines
  sf: unify write disable commands
  sf: sst: support newer standardized flashes

Shaohui Xie (1):
  sf: spansion: add support for S25FL129P_64K

Simon Guinot (1):
  sf: macronix: disable write protection when initializing

 drivers/mtd/spi/eon.c|  102 
 drivers/mtd/spi/macronix.c   |  126 +++---
 drivers/mtd/spi/ramtron.c|2 +-
 drivers/mtd/spi/spansion.c   |  107 ++---
 drivers/mtd/spi/spi_flash.c  |   59 -
 drivers/mtd/spi/spi_flash_internal.h |   25 +++
 drivers/mtd/spi/sst.c|   26 ++-
 drivers/mtd/spi/stmicro.c|  124 ++
 drivers/mtd/spi/winbond.c|  104 
 include/spi_flash.h  |5 +-
 10 files changed, 232 insertions(+), 448 deletions(-)

-- 
1.7.5.3

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


[U-Boot] [PATCH 3/9] sf: unify write enable commands

2011-06-28 Thread Mike Frysinger
Every spi flash uses the same write enable command, so unify this in
the common code.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/eon.c|2 +-
 drivers/mtd/spi/macronix.c   |2 +-
 drivers/mtd/spi/ramtron.c|2 +-
 drivers/mtd/spi/spansion.c   |2 +-
 drivers/mtd/spi/spi_flash.c  |2 +-
 drivers/mtd/spi/spi_flash_internal.h |8 
 drivers/mtd/spi/sst.c|2 +-
 drivers/mtd/spi/stmicro.c|2 +-
 drivers/mtd/spi/winbond.c|2 +-
 9 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c
index e3de3aa..6826708 100644
--- a/drivers/mtd/spi/eon.c
+++ b/drivers/mtd/spi/eon.c
@@ -91,7 +91,7 @@ static int eon_write(struct spi_flash *flash,
(PP: 0x%p = cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = 
%d\n,
 buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
 
-   ret = spi_flash_cmd(flash-spi, CMD_EN25Q128_WREN, NULL, 0);
+   ret = spi_flash_cmd_write_enable(flash);
if (ret  0) {
debug(SF: Enabling Write failed\n);
break;
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index 90aa657..f1c2bbb 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -163,7 +163,7 @@ static int macronix_write(struct spi_flash *flash,
(PP: 0x%p = cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = 
%d\n,
 buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
 
-   ret = spi_flash_cmd(flash-spi, CMD_MX25XX_WREN, NULL, 0);
+   ret = spi_flash_cmd_write_enable(flash);
if (ret  0) {
debug(SF: Enabling Write failed\n);
break;
diff --git a/drivers/mtd/spi/ramtron.c b/drivers/mtd/spi/ramtron.c
index 078d16c..27d4039 100644
--- a/drivers/mtd/spi/ramtron.c
+++ b/drivers/mtd/spi/ramtron.c
@@ -198,7 +198,7 @@ static int ramtron_common(struct spi_flash *flash,
 
if (command == CMD_RAMTRON_WRITE) {
/* send WREN */
-   ret = spi_flash_cmd(flash-spi, CMD_RAMTRON_WREN, NULL, 0);
+   ret = spi_flash_cmd_write_enable(flash);
if (ret  0) {
debug(SF: Enabling Write failed\n);
goto releasebus;
diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c
index 8835e96..9dbab5d 100644
--- a/drivers/mtd/spi/spansion.c
+++ b/drivers/mtd/spi/spansion.c
@@ -177,7 +177,7 @@ static int spansion_write(struct spi_flash *flash,
(PP: 0x%p = cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = 
%d\n,
 buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
 
-   ret = spi_flash_cmd(flash-spi, CMD_S25FLXX_WREN, NULL, 0);
+   ret = spi_flash_cmd_write_enable(flash);
if (ret  0) {
debug(SF: Enabling Write failed\n);
break;
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 016b586..3e0d02d 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -163,7 +163,7 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u8 
erase_cmd,
debug(SF: erase %2x %2x %2x %2x (%x)\n, cmd[0], cmd[1],
  cmd[2], cmd[3], offset);
 
-   ret = spi_flash_cmd(flash-spi, CMD_WRITE_ENABLE, NULL, 0);
+   ret = spi_flash_cmd_write_enable(flash);
if (ret)
goto out;
 
diff --git a/drivers/mtd/spi/spi_flash_internal.h 
b/drivers/mtd/spi/spi_flash_internal.h
index fc109ce..6665bed 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -46,6 +46,14 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 
*cmd, size_t cmd_len,
const void *data, size_t data_len);
 
 /*
+ * Enable writing on the SPI flash.
+ */
+static inline int spi_flash_cmd_write_enable(struct spi_flash *flash)
+{
+   return spi_flash_cmd(flash-spi, CMD_WRITE_ENABLE, NULL, 0);
+}
+
+/*
  * Same as spi_flash_cmd_read() except it also claims/releases the SPI
  * bus. Used as common part of the -read() operation.
  */
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index 4dc2db2..6691c1d 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -96,7 +96,7 @@ static const struct sst_spi_flash_params 
sst_spi_flash_table[] = {
 static int
 sst_enable_writing(struct spi_flash *flash)
 {
-   int ret = spi_flash_cmd(flash-spi, CMD_SST_WREN, NULL, 0);
+   int ret = spi_flash_cmd_write_enable(flash);
if (ret)
debug(SF: Enabling Write failed\n);
return ret;
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index a1959ca..80d97b4 100644
--- 

[U-Boot] [PATCH 1/9] sf: spansion: add support for S25FL129P_64K

2011-06-28 Thread Mike Frysinger
From: Shaohui Xie b21...@freescale.com

Signed-off-by: Shaohui Xie b21...@freescale.com
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/spansion.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c
index a3401b3..8835e96 100644
--- a/drivers/mtd/spi/spansion.c
+++ b/drivers/mtd/spi/spansion.c
@@ -53,6 +53,7 @@
 #define SPSN_EXT_ID_S25FL128P_256KB0x0300
 #define SPSN_EXT_ID_S25FL128P_64KB 0x0301
 #define SPSN_EXT_ID_S25FL032P  0x4d00
+#define SPSN_EXT_ID_S25FL129P  0x4d01
 
 struct spansion_spi_flash_params {
u16 idcode1;
@@ -131,6 +132,14 @@ static const struct spansion_spi_flash_params 
spansion_spi_flash_table[] = {
.nr_sectors = 64,
.name = S25FL032P,
},
+   {
+   .idcode1 = SPSN_ID_S25FL128P,
+   .idcode2 = SPSN_EXT_ID_S25FL129P,
+   .page_size = 256,
+   .pages_per_sector = 256,
+   .nr_sectors = 256,
+   .name = S25FL129P_64K,
+   },
 };
 
 static int spansion_write(struct spi_flash *flash,
-- 
1.7.5.3

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


[U-Boot] [PATCH 7/9] sf: unify write disable commands

2011-06-28 Thread Mike Frysinger
Every spi flash uses the same write disnable command, so unify this in
the common code.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/spi_flash_internal.h |9 +
 drivers/mtd/spi/sst.c|2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash_internal.h 
b/drivers/mtd/spi/spi_flash_internal.h
index f80f717..91e036a 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -20,6 +20,7 @@
 #define CMD_READ_ARRAY_LEGACY  0xe8
 
 #define CMD_PAGE_PROGRAM   0x02
+#define CMD_WRITE_DISABLE  0x04
 #define CMD_READ_STATUS0x05
 #define CMD_WRITE_ENABLE   0x06
 
@@ -62,6 +63,14 @@ static inline int spi_flash_cmd_write_enable(struct 
spi_flash *flash)
 }
 
 /*
+ * Disable writing on the SPI flash.
+ */
+static inline int spi_flash_cmd_write_disable(struct spi_flash *flash)
+{
+   return spi_flash_cmd(flash-spi, CMD_WRITE_DISABLE, NULL, 0);
+}
+
+/*
  * Same as spi_flash_cmd_read() except it also claims/releases the SPI
  * bus. Used as common part of the -read() operation.
  */
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index 6691c1d..d1e8a93 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -105,7 +105,7 @@ sst_enable_writing(struct spi_flash *flash)
 static int
 sst_disable_writing(struct spi_flash *flash)
 {
-   int ret = spi_flash_cmd(flash-spi, CMD_SST_WRDI, NULL, 0);
+   int ret = spi_flash_cmd_write_disable(flash);
if (ret)
debug(SF: Disabling Write failed\n);
return ret;
-- 
1.7.5.3

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


[U-Boot] [PATCH 4/9] sf: unify write funcs

2011-06-28 Thread Mike Frysinger
Once we add a new page_size field for write lengths, we can unify the
write methods for most of the spi flash drivers.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/eon.c|   66 +--
 drivers/mtd/spi/macronix.c   |   66 +--
 drivers/mtd/spi/spansion.c   |   66 +--
 drivers/mtd/spi/spi_flash.c  |   57 +++
 drivers/mtd/spi/spi_flash_internal.h |8 
 drivers/mtd/spi/stmicro.c|   66 +--
 drivers/mtd/spi/winbond.c|   71 +
 include/spi_flash.h  |5 ++-
 8 files changed, 80 insertions(+), 325 deletions(-)

diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c
index 6826708..036855b 100644
--- a/drivers/mtd/spi/eon.c
+++ b/drivers/mtd/spi/eon.c
@@ -56,69 +56,6 @@ static const struct eon_spi_flash_params 
eon_spi_flash_table[] = {
},
 };
 
-static int eon_write(struct spi_flash *flash,
-u32 offset, size_t len, const void *buf)
-{
-   struct eon_spi_flash *eon = to_eon_spi_flash(flash);
-   unsigned long page_addr;
-   unsigned long byte_addr;
-   unsigned long page_size;
-   size_t chunk_len;
-   size_t actual;
-   int ret;
-   u8 cmd[4];
-
-   page_size = eon-params-page_size;
-   page_addr = offset / page_size;
-   byte_addr = offset % page_size;
-
-   ret = spi_claim_bus(flash-spi);
-   if (ret) {
-   debug(SF: Unable to claim SPI bus\n);
-   return ret;
-   }
-
-   ret = 0;
-   for (actual = 0; actual  len; actual += chunk_len) {
-   chunk_len = min(len - actual, page_size - byte_addr);
-
-   cmd[0] = CMD_EN25Q128_PP;
-   cmd[1] = page_addr  8;
-   cmd[2] = page_addr;
-   cmd[3] = byte_addr;
-
-   debug
-   (PP: 0x%p = cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = 
%d\n,
-buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-
-   ret = spi_flash_cmd_write_enable(flash);
-   if (ret  0) {
-   debug(SF: Enabling Write failed\n);
-   break;
-   }
-
-   ret = spi_flash_cmd_write(flash-spi, cmd, 4,
- buf + actual, chunk_len);
-   if (ret  0) {
-   debug(SF: EON Page Program failed\n);
-   break;
-   }
-
-   ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
-   if (ret)
-   break;
-
-   page_addr++;
-   byte_addr = 0;
-   }
-
-   debug(SF: EON: Successfully programmed %u bytes @ 0x%x\n,
- len, offset);
-
-   spi_release_bus(flash-spi);
-   return ret;
-}
-
 static int eon_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
return spi_flash_cmd_erase(flash, CMD_EN25Q128_BE, offset, len);
@@ -151,9 +88,10 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave 
*spi, u8 *idcode)
eon-flash.spi = spi;
eon-flash.name = params-name;
 
-   eon-flash.write = eon_write;
+   eon-flash.write = spi_flash_cmd_write_multi;
eon-flash.erase = eon_erase;
eon-flash.read = spi_flash_cmd_read_fast;
+   eon-flash.page_size = params-page_size;
eon-flash.sector_size = params-page_size * params-pages_per_sector
* params-sectors_per_block;
eon-flash.size = params-page_size * params-pages_per_sector
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index f1c2bbb..cb06476 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -128,69 +128,6 @@ static const struct macronix_spi_flash_params 
macronix_spi_flash_table[] = {
},
 };
 
-static int macronix_write(struct spi_flash *flash,
- u32 offset, size_t len, const void *buf)
-{
-   struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
-   unsigned long page_addr;
-   unsigned long byte_addr;
-   unsigned long page_size;
-   size_t chunk_len;
-   size_t actual;
-   int ret;
-   u8 cmd[4];
-
-   page_size = mcx-params-page_size;
-   page_addr = offset / page_size;
-   byte_addr = offset % page_size;
-
-   ret = spi_claim_bus(flash-spi);
-   if (ret) {
-   debug(SF: Unable to claim SPI bus\n);
-   return ret;
-   }
-
-   ret = 0;
-   for (actual = 0; actual  len; actual += chunk_len) {
-   chunk_len = min(len - actual, page_size - byte_addr);
-
-   cmd[0] = CMD_MX25XX_PP;
-   cmd[1] = page_addr  8;
-   cmd[2] = page_addr;
-   cmd[3] = byte_addr;
-
-   debug
-   

[U-Boot] [PATCH 9/9] sf: macronix: disable write protection when initializing

2011-06-28 Thread Mike Frysinger
From: Simon Guinot sgui...@lacie.com

Signed-off-by: Simon Guinot sgui...@lacie.com
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/macronix.c |   42 ++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index 96fd5f0..dacbc28 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -117,6 +117,45 @@ static const struct macronix_spi_flash_params 
macronix_spi_flash_table[] = {
},
 };
 
+static int macronix_write_status(struct spi_flash *flash, u8 sr)
+{
+   u8 cmd;
+   int ret;
+
+   ret = spi_flash_cmd_write_enable(flash);
+   if (ret  0) {
+   debug(SF: enabling write failed\n);
+   return ret;
+   }
+
+   cmd = CMD_MX25XX_WRSR;
+   ret = spi_flash_cmd_write(flash-spi, cmd, 1, sr, 1);
+   if (ret) {
+   debug(SF: fail to write status register\n);
+   return ret;
+   }
+
+   ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+   if (ret  0) {
+   debug(SF: write status register timed out\n);
+   return ret;
+   }
+
+   return 0;
+}
+
+static int macronix_unlock(struct spi_flash *flash)
+{
+   int ret;
+
+   /* Enable status register writing and clear BP# bits */
+   ret = macronix_write_status(flash, 0);
+   if (ret)
+   debug(SF: fail to disable write protection\n);
+
+   return ret;
+}
+
 static int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
return spi_flash_cmd_erase(flash, CMD_MX25XX_BE, offset, len);
@@ -157,5 +196,8 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave 
*spi, u8 *idcode)
* params-sectors_per_block;
flash-size = flash-sector_size * params-nr_blocks;
 
+   /* Clear BP# bits for read-only flash */
+   macronix_unlock(flash);
+
return flash;
 }
-- 
1.7.5.3

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


[U-Boot] [PATCH 6/9] sf: eon/stmicro: inline useless ID defines

2011-06-28 Thread Mike Frysinger
These defines are used in only one place, so just inline them.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/eon.c |4 +---
 drivers/mtd/spi/stmicro.c |   25 -
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c
index 5937b61..806b44e 100644
--- a/drivers/mtd/spi/eon.c
+++ b/drivers/mtd/spi/eon.c
@@ -23,8 +23,6 @@
 #define CMD_EN25Q128_DP0xb9/* Deep Power-down */
 #define CMD_EN25Q128_RES   0xab/* Release from DP, and Read Signature 
*/
 
-#define EON_ID_EN25Q1280x18
-
 struct eon_spi_flash_params {
u8 idcode1;
u16 page_size;
@@ -36,7 +34,7 @@ struct eon_spi_flash_params {
 
 static const struct eon_spi_flash_params eon_spi_flash_table[] = {
{
-   .idcode1 = EON_ID_EN25Q128,
+   .idcode1 = 0x18,
.page_size = 256,
.pages_per_sector = 16,
.sectors_per_block = 16,
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 9a9d3d4..a9b33cf 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -46,15 +46,6 @@
 #define CMD_M25PXX_DP  0xb9/* Deep Power-down */
 #define CMD_M25PXX_RES 0xab/* Release from DP, and Read Signature 
*/
 
-#define STM_ID_M25P10  0x11
-#define STM_ID_M25P16  0x15
-#define STM_ID_M25P20  0x12
-#define STM_ID_M25P32  0x16
-#define STM_ID_M25P40  0x13
-#define STM_ID_M25P64  0x17
-#define STM_ID_M25P80  0x14
-#define STM_ID_M25P128 0x18
-
 struct stmicro_spi_flash_params {
u8 idcode1;
u16 page_size;
@@ -65,56 +56,56 @@ struct stmicro_spi_flash_params {
 
 static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
{
-   .idcode1 = STM_ID_M25P10,
+   .idcode1 = 0x11,
.page_size = 256,
.pages_per_sector = 128,
.nr_sectors = 4,
.name = M25P10,
},
{
-   .idcode1 = STM_ID_M25P16,
+   .idcode1 = 0x15,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 32,
.name = M25P16,
},
{
-   .idcode1 = STM_ID_M25P20,
+   .idcode1 = 0x12,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 4,
.name = M25P20,
},
{
-   .idcode1 = STM_ID_M25P32,
+   .idcode1 = 0x16,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = M25P32,
},
{
-   .idcode1 = STM_ID_M25P40,
+   .idcode1 = 0x13,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 8,
.name = M25P40,
},
{
-   .idcode1 = STM_ID_M25P64,
+   .idcode1 = 0x17,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 128,
.name = M25P64,
},
{
-   .idcode1 = STM_ID_M25P80,
+   .idcode1 = 0x14,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 16,
.name = M25P80,
},
{
-   .idcode1 = STM_ID_M25P128,
+   .idcode1 = 0x18,
.page_size = 256,
.pages_per_sector = 1024,
.nr_sectors = 64,
-- 
1.7.5.3

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


[U-Boot] [PATCH 8/9] sf: sst: support newer standardized flashes

2011-06-28 Thread Mike Frysinger
Newer SST flashes have dropped the Auto Address Increment (AAI) word
programming (WP) modes in favor of the standard page programming mode
that most flashes now support.  So add a flags field to the different
flashes to support both modes with new and old styles.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/sst.c |   22 --
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index d1e8a93..9559c80 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -36,8 +36,12 @@
 #define SST_SR_AAI (1  6)/* Addressing mode */
 #define SST_SR_BPL (1  7)/* BP bits lock */
 
+#define SST_FEAT_WP(1  0)/* Supports AAI word program */
+#define SST_FEAT_MBP   (1  1)/* Supports multibyte program */
+
 struct sst_spi_flash_params {
u8 idcode1;
+   u8 flags;
u16 nr_sectors;
const char *name;
 };
@@ -53,41 +57,51 @@ static inline struct sst_spi_flash *to_sst_spi_flash(struct 
spi_flash *flash)
 }
 
 #define SST_SECTOR_SIZE (4 * 1024)
+#define SST_PAGE_SIZE   256
 static const struct sst_spi_flash_params sst_spi_flash_table[] = {
{
.idcode1 = 0x8d,
+   .flags = SST_FEAT_WP,
.nr_sectors = 128,
.name = SST25VF040B,
},{
.idcode1 = 0x8e,
+   .flags = SST_FEAT_WP,
.nr_sectors = 256,
.name = SST25VF080B,
},{
.idcode1 = 0x41,
+   .flags = SST_FEAT_WP,
.nr_sectors = 512,
.name = SST25VF016B,
},{
.idcode1 = 0x4a,
+   .flags = SST_FEAT_WP,
.nr_sectors = 1024,
.name = SST25VF032B,
},{
.idcode1 = 0x4b,
+   .flags = SST_FEAT_MBP,
.nr_sectors = 2048,
.name = SST25VF064C,
},{
.idcode1 = 0x01,
+   .flags = SST_FEAT_WP,
.nr_sectors = 16,
.name = SST25WF512,
},{
.idcode1 = 0x02,
+   .flags = SST_FEAT_WP,
.nr_sectors = 32,
.name = SST25WF010,
},{
.idcode1 = 0x03,
+   .flags = SST_FEAT_WP,
.nr_sectors = 64,
.name = SST25WF020,
},{
.idcode1 = 0x04,
+   .flags = SST_FEAT_WP,
.nr_sectors = 128,
.name = SST25WF040,
},
@@ -137,7 +151,7 @@ sst_byte_write(struct spi_flash *flash, u32 offset, const 
void *buf)
 }
 
 static int
-sst_write(struct spi_flash *flash, u32 offset, size_t len, const void *buf)
+sst_write_wp(struct spi_flash *flash, u32 offset, size_t len, const void *buf)
 {
size_t actual, cmd_len;
int ret;
@@ -257,9 +271,13 @@ spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode)
stm-flash.spi = spi;
stm-flash.name = params-name;
 
-   stm-flash.write = sst_write;
+   if (stm-params-flags  SST_FEAT_WP)
+   stm-flash.write = sst_write_wp;
+   else
+   stm-flash.write = spi_flash_cmd_write_multi;
stm-flash.erase = sst_erase;
stm-flash.read = spi_flash_cmd_read_fast;
+   stm-flash.page_size = SST_PAGE_SIZE;
stm-flash.sector_size = SST_SECTOR_SIZE;
stm-flash.size = stm-flash.sector_size * params-nr_sectors;
 
-- 
1.7.5.3

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


[U-Boot] [PATCH 5/9] sf: kill off now-unused local state

2011-06-28 Thread Mike Frysinger
Now that the common spi_flash structure tracks all the info that these
drivers need, kill off their local state indirection and use just what
the common code provides.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 drivers/mtd/spi/eon.c  |   36 
 drivers/mtd/spi/macronix.c |   36 
 drivers/mtd/spi/spansion.c |   36 
 drivers/mtd/spi/stmicro.c  |   37 -
 drivers/mtd/spi/winbond.c  |   39 +--
 5 files changed, 61 insertions(+), 123 deletions(-)

diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c
index 036855b..5937b61 100644
--- a/drivers/mtd/spi/eon.c
+++ b/drivers/mtd/spi/eon.c
@@ -34,17 +34,6 @@ struct eon_spi_flash_params {
const char *name;
 };
 
-/* spi_flash needs to be first so upper layers can free() it */
-struct eon_spi_flash {
-   struct spi_flash flash;
-   const struct eon_spi_flash_params *params;
-};
-
-static inline struct eon_spi_flash *to_eon_spi_flash(struct spi_flash *flash)
-{
-   return container_of(flash, struct eon_spi_flash, flash);
-}
-
 static const struct eon_spi_flash_params eon_spi_flash_table[] = {
{
.idcode1 = EON_ID_EN25Q128,
@@ -64,7 +53,7 @@ static int eon_erase(struct spi_flash *flash, u32 offset, 
size_t len)
 struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)
 {
const struct eon_spi_flash_params *params;
-   struct eon_spi_flash *eon;
+   struct spi_flash *flash;
unsigned int i;
 
for (i = 0; i  ARRAY_SIZE(eon_spi_flash_table); ++i) {
@@ -78,24 +67,23 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave 
*spi, u8 *idcode)
return NULL;
}
 
-   eon = malloc(sizeof(*eon));
-   if (!eon) {
+   flash = malloc(sizeof(*flash));
+   if (!flash) {
debug(SF: Failed to allocate memory\n);
return NULL;
}
 
-   eon-params = params;
-   eon-flash.spi = spi;
-   eon-flash.name = params-name;
+   flash-spi = spi;
+   flash-name = params-name;
 
-   eon-flash.write = spi_flash_cmd_write_multi;
-   eon-flash.erase = eon_erase;
-   eon-flash.read = spi_flash_cmd_read_fast;
-   eon-flash.page_size = params-page_size;
-   eon-flash.sector_size = params-page_size * params-pages_per_sector
+   flash-write = spi_flash_cmd_write_multi;
+   flash-erase = eon_erase;
+   flash-read = spi_flash_cmd_read_fast;
+   flash-page_size = params-page_size;
+   flash-sector_size = params-page_size * params-pages_per_sector
* params-sectors_per_block;
-   eon-flash.size = params-page_size * params-pages_per_sector
+   flash-size = params-page_size * params-pages_per_sector
* params-nr_sectors;
 
-   return eon-flash;
+   return flash;
 }
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index cb06476..96fd5f0 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -58,17 +58,6 @@ struct macronix_spi_flash_params {
const char *name;
 };
 
-struct macronix_spi_flash {
-   struct spi_flash flash;
-   const struct macronix_spi_flash_params *params;
-};
-
-static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash
-  *flash)
-{
-   return container_of(flash, struct macronix_spi_flash, flash);
-}
-
 static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
{
.idcode = 0x2013,
@@ -136,7 +125,7 @@ static int macronix_erase(struct spi_flash *flash, u32 
offset, size_t len)
 struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 {
const struct macronix_spi_flash_params *params;
-   struct macronix_spi_flash *mcx;
+   struct spi_flash *flash;
unsigned int i;
u16 id = idcode[2] | idcode[1]  8;
 
@@ -151,23 +140,22 @@ struct spi_flash *spi_flash_probe_macronix(struct 
spi_slave *spi, u8 *idcode)
return NULL;
}
 
-   mcx = malloc(sizeof(*mcx));
-   if (!mcx) {
+   flash = malloc(sizeof(*flash));
+   if (!flash) {
debug(SF: Failed to allocate memory\n);
return NULL;
}
 
-   mcx-params = params;
-   mcx-flash.spi = spi;
-   mcx-flash.name = params-name;
+   flash-spi = spi;
+   flash-name = params-name;
 
-   mcx-flash.write = spi_flash_cmd_write_multi;
-   mcx-flash.erase = macronix_erase;
-   mcx-flash.read = spi_flash_cmd_read_fast;
-   mcx-flash.page_size = params-page_size;
-   mcx-flash.sector_size = params-page_size * params-pages_per_sector
+   flash-write = spi_flash_cmd_write_multi;
+   flash-erase = macronix_erase;
+   flash-read = spi_flash_cmd_read_fast;
+   

[U-Boot] Pull request u-boot-blackfin.git (sf branch)

2011-06-28 Thread Mike Frysinger
The following changes since commit b1af6f532e0d348b153d5c148369229d24af361a:

  Prepare v2011.06 (2011-06-27 22:22:42 +0200)

are available in the git repository at:
  git://www.denx.de/git/u-boot-blackfin.git sf

Macpaul Lin (1):
  sf: macronix: add MX25L4005 and MX25L8005

Mike Frysinger (6):
  sf: unify write enable commands
  sf: unify write funcs
  sf: kill off now-unused local state
  sf: eon/stmicro: inline useless ID defines
  sf: unify write disable commands
  sf: sst: support newer standardized flashes

Shaohui Xie (1):
  sf: spansion: add support for S25FL129P_64K

Simon Guinot (1):
  sf: macronix: disable write protection when initializing

 drivers/mtd/spi/eon.c|  102 
 drivers/mtd/spi/macronix.c   |  126 +++---
 drivers/mtd/spi/ramtron.c|2 +-
 drivers/mtd/spi/spansion.c   |  107 ++---
 drivers/mtd/spi/spi_flash.c  |   59 -
 drivers/mtd/spi/spi_flash_internal.h |   25 +++
 drivers/mtd/spi/sst.c|   26 ++-
 drivers/mtd/spi/stmicro.c|  124 ++
 drivers/mtd/spi/winbond.c|  104 
 include/spi_flash.h  |5 +-
 10 files changed, 232 insertions(+), 448 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] strawman Fastboot in U-Boot Design Doc

2011-06-28 Thread John Rigby
Zach, I did go one more round with WD on the fastboot with a strawman
proposal.  I never followed up because I was not sure that the resources
were commited to do it in Linaro.

Forwarded conversation
Subject: [U-Boot] strawman Fastboot in U-Boot Design Doc


From: *John Rigby* john.ri...@linaro.org
Date: Thu, Apr 28, 2011 at 7:07 PM
To: u-boot@lists.denx.de, Wolfgang Denk w...@denx.de


Here a first draft design doc.  It is based in part on the Fastboot
implementation in the rowboat git repo (pointer below).

As always, comments welcome.
John

Purpose
===

Mainline support for Android Fastboot would be useful.  Arguing the merits
of Fastboot vs DFU is not in the scope of this document.  This document
is to discuss design goals/requirements of an implementation of
Fastboot in U-Boot.

Background
==

See the Android Fastboot page in Omappedia for an example of how
Fastboot is used to flash nand partitions on an Android device.
http://www.omappedia.org/wiki/Android_Fastboot

A description of the Fastboot protocol is available in the gitorious
rowboat git repo.
http://gitorious.org/rowboat/bootable-bootloader-legacy/blobs/master/fastboot_protocol.txt

Hooks into U-Boot
=

Fastboot gets access to the USB subsystem via the same interfaces as
USB_TTY,
namely the udc_* api's:
   udc_init
   udc_startup_events
   udc_connect
   udc_poll
   udc_setup_ep
   etc.

Startup
===

Fastboot will be started on the target by issuing the fastboot command.
Optionally a board specific startup method may exist.  For example if
a certain combination of keys is pressed on reset then fastboot will be
started immediately.

Shutdown


Once started the fastboot command will continue until:
   CTRL-C is typed on the console
   a continue command is sent from the host
   usb cable is removed
   no commands have been sent from the host for some configurable
timeout

Coexistance With USB_TTY and DFU


One should be able to enable USB_TTY, DFU and Fastboot at compile time
and chose one at runtime.

Questions


Should a Fastboot host program be included in the U-Boot source?
Could Fastboot be implemented as an extension to USB_TTY?
Could Fastboot, DFU and USB_TTY share a layer of code above the
udc_* api's?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

--
From: *Wolfgang Denk* w...@denx.de
Date: Fri, Apr 29, 2011 at 4:48 AM
To: John Rigby john.ri...@linaro.org
Cc: u-boot@lists.denx.de


Dear John Rigby,
Thanks.
Does it make sense to restrict this to USB?  Or should we decouple the
protocol part from the actual transport path?  Maybe it would make
sense to provide the same feature over plain serial line, or over
Ethernet?

Also please keep in mind that there are many ways how a system can
interact with the operator: we have plain old serial console,
netconsole, console over serial over USB, netconsole over Ethernet
over USB, ...

We should make sure that at least on the conceptual level adding
fastboot support will not cause any conflicts.
OK.
This has nothing to do with fastboot, and should be kept as a separate
item.  Normally U-Boot allows, when keys are supported, to map any
combination of key presses to any commands, i. e. this is in no way
restricted to or dependent on fastboot support.
This probably needs configuration.

usb cable is removed probably makes little sense when running
fastboot protocol over a serial port.

Also, this feature would require permanent polling of the USB status.
Is this needed?
I'm not sure what exactly you mean by chose one at runtime. It is
pretty much clear that you don't want to run DFU and fastboot
simultaneously, but it is very likely that we will need USB_TTY (for
console over USB) or even Ethernet over USB for console and then want
to start fastboot.

I think I remember that fastboot may require adjustments of the USB
IDs and such - we will have to make sure that things like that do not
cause conflicts.

An area that raises additional questions is error handling. When
running fastboot over USB and with a serial console it is probably a
very good idea to provide error messages and maybe even status
reports on the console.  Will this still work with USB_TTY or
netconsole over Ethernet over USB?
Seems some peole want it...
I think we should at least split protocol handling and communication
layer.
At least they will have to co-exist with each other.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
A dirty mind is a joy forever.   - Randy Kunkee

--
From: *Detlev Zundel* d...@denx.de
Date: Fri, Apr 29, 2011 at 5:02 AM
To: John Rigby 

Re: [U-Boot] [STATUS] v2011.06 release, Merge Window is OPEN

2011-06-28 Thread Wolfgang Denk
Dear Loïc,

In message 20110628152416.gc31...@bee.dooz.org you wrote:
...
Board maintainers or other interested parties are requested to
adapt their boards within the current merge window. All boards that
have not been fixed within the first week of the merge window are
considered unmaintained and without interest to the community and
will be removed.

  It's funny how this reminds me of package build failures in Debian; in
  such cases, we start by publishing the list of affected packages
  ideally with links to build logs and the name of corresponding
  maintainers.  After a while, we actually start Cc:ing the maintainers
  or filing bug reports against each failing package.

This has started with v2010.09, and deadlines have been made clear.
I have no intentions to discuss this much longer now.  Either it
builds, or it gets removed.

  Would it make sense to publish such a list of broken boards and
  corresponding maintainers?  (Maybe some makeall + scripts magic?)

No kind of script magic is needed. Just run ./MAKEALL arm.

And a list has been posted before. See

06/22 To:u-boot@lists.d  [U-Boot] [STATUS] v2011.06-rc3 released

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/101894


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I have often regretted my speech, never my silence.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] strawman Fastboot in U-Boot Design Doc

2011-06-28 Thread Wolfgang Denk
Dear John,

In message banlktikyx2c9t0aebuqljmgh9fqmmvv...@mail.gmail.com you wrote:

 From: *Wolfgang Denk* w...@denx.de
 Date: Fri, Apr 29, 2011 at 4:48 AM
 To: John Rigby john.ri...@linaro.org
 Cc: u-boot@lists.denx.de
 
 
 Dear John Rigby,
 Thanks.
 Does it make sense to restrict this to USB?  Or should we decouple the
 protocol part from the actual transport path?  Maybe it would make
 sense to provide the same feature over plain serial line, or over
 Ethernet?
 
 Also please keep in mind that there are many ways how a system can
 interact with the operator: we have plain old serial console,
 netconsole, console over serial over USB, netconsole over Ethernet
 over USB, ...
 
 We should make sure that at least on the conceptual level adding
 fastboot support will not cause any conflicts.
 OK.
 This has nothing to do with fastboot, and should be kept as a separate
 item.  Normally U-Boot allows, when keys are supported, to map any
 combination of key presses to any commands, i. e. this is in no way
 restricted to or dependent on fastboot support.
 This probably needs configuration.
 
 usb cable is removed probably makes little sense when running
 fastboot protocol over a serial port.
 
 Also, this feature would require permanent polling of the USB status.
 Is this needed?
 I'm not sure what exactly you mean by chose one at runtime. It is
 pretty much clear that you don't want to run DFU and fastboot
 simultaneously, but it is very likely that we will need USB_TTY (for
 console over USB) or even Ethernet over USB for console and then want
 to start fastboot.

Do you think anybody can make heads or tails from this text where you
removed all references to context without even marking these changes?

It was a very bad idea to edit this text in such a way.  Crippeling my
text in such a way is something which makes me actually really angry.
It gives the words a different meaning, and I will not accept this.


Why don't you simply provide a reference to the respective postings in
the list archives, so everybody can actually understand what you are
talking about?

Here it is:

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/98754/focus=98783


Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
The only time the world beats a path to your door is when you are  in
the bathroom.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/2] ext2: Cleanup and simplify sector access code

2011-06-28 Thread Anton Staaf
I just wanted to check that this patch set hadn't fallen completely off the
radar.  :)  What can I do to help it along?

Thanks,
Anton

On Mon, Jun 13, 2011 at 2:40 PM, Anton Staaf robot...@chromium.org wrote:

 This patch set first cleans up all of the chack patch warnings
 and errors in fs/ext2/dev.c and then cleans up the partial sector
 access logic in the ext2fs_devread function.

 I didn't see a file system or ext2 custodian so I've CC'ed Andy
 the custodian for MMC as that seems closest.  Please let me know
 if I should bring this to someone elses attention.

 Signed-off-by: Anton Staaf robot...@chromium.org
 Cc: Andy Fleming aflem...@freescale.com

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


[U-Boot] Pull request u-boot-blackfin.git (post branch)

2011-06-28 Thread Mike Frysinger
All of thse patches have been posted previously, and no one has
given feedback, so here they are in a handy branch for you to pull.

The following changes since commit b1af6f532e0d348b153d5c148369229d24af361a:

  Prepare v2011.06 (2011-06-27 22:22:42 +0200)

are available in the git repository at:
  git://www.denx.de/git/u-boot-blackfin.git post

Mike Frysinger (5):
  post: fix up I/O helper usage
  post: add gpio hotkey support
  post: use ARRAY_SIZE
  post: new nor flash test
  serial: implement common uart post test

 common/serial.c   |   90 +
 include/post.h|5 +-
 include/serial.h  |5 +
 post/board/lwmon/sysmon.c |2 +-
 post/cpu/mpc8xx/ether.c   |4 +-
 post/cpu/mpc8xx/spr.c |3 +-
 post/cpu/mpc8xx/uart.c|4 +-
 post/cpu/ppc4xx/spr.c |3 +-
 post/drivers/Makefile |2 +-
 post/drivers/flash.c  |  107 +
 post/drivers/memory.c |2 +-
 post/lib_powerpc/andi.c   |3 +-
 post/lib_powerpc/cmp.c|3 +-
 post/lib_powerpc/cmpi.c   |3 +-
 post/lib_powerpc/cr.c |   12 +--
 post/lib_powerpc/fpu/mul-subnormal-single-1.c |2 +-
 post/lib_powerpc/load.c   |3 +-
 post/lib_powerpc/multi.c  |2 +-
 post/lib_powerpc/rlwimi.c |3 +-
 post/lib_powerpc/rlwinm.c |3 +-
 post/lib_powerpc/rlwnm.c  |3 +-
 post/lib_powerpc/srawi.c  |3 +-
 post/lib_powerpc/store.c  |3 +-
 post/lib_powerpc/three.c  |3 +-
 post/lib_powerpc/threei.c |3 +-
 post/lib_powerpc/threex.c |3 +-
 post/lib_powerpc/two.c|3 +-
 post/lib_powerpc/twox.c   |3 +-
 post/post.c   |   23 +-
 post/tests.c  |   17 -
 30 files changed, 269 insertions(+), 56 deletions(-)
 create mode 100644 post/drivers/flash.c
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/5] post: add gpio hotkey support

2011-06-28 Thread Mike Frysinger
Now that we have the generic GPIO layer, we can easily provide a common
implementation for the post_hotkeys_pressed() function based on it.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 post/post.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/post/post.c b/post/post.c
index 1b7f2aa..ecea1e1 100644
--- a/post/post.c
+++ b/post/post.c
@@ -26,6 +26,10 @@
 #include watchdog.h
 #include post.h
 
+#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
+#include asm/gpio.h
+#endif
+
 #ifdef CONFIG_LOGBUFFER
 #include logbuff.h
 #endif
@@ -68,6 +72,23 @@ int post_init_f (void)
  */
 int __post_hotkeys_pressed(void)
 {
+#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
+   int ret;
+   unsigned gpio = CONFIG_SYS_POST_HOTKEYS_GPIO;
+
+   ret = gpio_request(gpio, hotkeys);
+   if (ret) {
+   printf(POST: gpio hotkey request failed\n);
+   return 0;
+   }
+
+   gpio_direction_input(gpio);
+   ret = gpio_get_value(gpio);
+   gpio_free(gpio);
+
+   return ret;
+#endif
+
return 0;   /* No hotkeys supported */
 }
 int post_hotkeys_pressed(void)
-- 
1.7.5.3

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


[U-Boot] [PATCH 1/5] post: fix up I/O helper usage

2011-06-28 Thread Mike Frysinger
The I/O API from Linux defaults to little endian accesses.  In order to
do big endian accesses, there are a be variants.  The le32 variants
are arch-specific and not terribly common, so change it to the normal
Linux API funcs.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 include/post.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/post.h b/include/post.h
index 519cef1..c9ec2f4 100644
--- a/include/post.h
+++ b/include/post.h
@@ -78,12 +78,12 @@
 
 static inline ulong post_word_load (void)
 {
-   return in_le32((volatile void *)(_POST_WORD_ADDR));
+   return inl((volatile void *)(_POST_WORD_ADDR));
 }
 
 static inline void post_word_store (ulong value)
 {
-   out_le32((volatile void *)(_POST_WORD_ADDR), value);
+   outl(value, (volatile void *)(_POST_WORD_ADDR));
 }
 #endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
 #endif /* __ASSEMBLY__ */
-- 
1.7.5.3

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


[U-Boot] [PATCH 3/5] post: use ARRAY_SIZE

2011-06-28 Thread Mike Frysinger
We've got a handy dandy macro already for calculating the number of
elements in an array, so use it.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 post/board/lwmon/sysmon.c |2 +-
 post/cpu/mpc8xx/ether.c   |4 +---
 post/cpu/mpc8xx/spr.c |3 +--
 post/cpu/mpc8xx/uart.c|4 +---
 post/cpu/ppc4xx/spr.c |3 +--
 post/drivers/memory.c |2 +-
 post/lib_powerpc/andi.c   |3 +--
 post/lib_powerpc/cmp.c|3 +--
 post/lib_powerpc/cmpi.c   |3 +--
 post/lib_powerpc/cr.c |   12 
 post/lib_powerpc/fpu/mul-subnormal-single-1.c |2 +-
 post/lib_powerpc/load.c   |3 +--
 post/lib_powerpc/multi.c  |2 +-
 post/lib_powerpc/rlwimi.c |3 +--
 post/lib_powerpc/rlwinm.c |3 +--
 post/lib_powerpc/rlwnm.c  |3 +--
 post/lib_powerpc/srawi.c  |3 +--
 post/lib_powerpc/store.c  |3 +--
 post/lib_powerpc/three.c  |3 +--
 post/lib_powerpc/threei.c |3 +--
 post/lib_powerpc/threex.c |3 +--
 post/lib_powerpc/two.c|3 +--
 post/lib_powerpc/twox.c   |3 +--
 post/post.c   |2 +-
 post/tests.c  |2 +-
 25 files changed, 28 insertions(+), 52 deletions(-)

diff --git a/post/board/lwmon/sysmon.c b/post/board/lwmon/sysmon.c
index fc828b2..72224c6 100644
--- a/post/board/lwmon/sysmon.c
+++ b/post/board/lwmon/sysmon.c
@@ -133,7 +133,7 @@ static sysmon_table_t sysmon_table[] =
 {+ 5 V standby, V, sysmon_pic, NULL, NULL,
  100, 1000, 0, 6040, 0xFF, 0xC8, 0xDE, 0, 0xC8, 0xDE, 0, 0x7C},
 };
-static int sysmon_table_size = sizeof(sysmon_table) / sizeof(sysmon_table[0]);
+static int sysmon_table_size = ARRAY_SIZE(sysmon_table);
 
 static int conversion_done = 0;
 
diff --git a/post/cpu/mpc8xx/ether.c b/post/cpu/mpc8xx/ether.c
index 43ea817..fcbb300 100644
--- a/post/cpu/mpc8xx/ether.c
+++ b/post/cpu/mpc8xx/ether.c
@@ -67,8 +67,6 @@ static int ctlr_list[][2] = { {CTLR_SCC, 1} };
 static int ctlr_list[][2] = { };
 #endif
 
-#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0]))
-
 static struct {
void (*init) (int index);
void (*halt) (int index);
@@ -618,7 +616,7 @@ int ether_post_test (int flags)
ctlr_proc[CTLR_SCC].send = scc_send;
ctlr_proc[CTLR_SCC].recv = scc_recv;
 
-   for (i = 0; i  CTRL_LIST_SIZE; i++) {
+   for (i = 0; i  ARRAY_SIZE(ctlr_list); i++) {
if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) {
res = -1;
}
diff --git a/post/cpu/mpc8xx/spr.c b/post/cpu/mpc8xx/spr.c
index db84dbe..4c1e2af 100644
--- a/post/cpu/mpc8xx/spr.c
+++ b/post/cpu/mpc8xx/spr.c
@@ -108,8 +108,7 @@ static struct
{826,   MD_DBRAM1,0x, 0x},
 };
 
-static int spr_test_list_size =
-   sizeof (spr_test_list) / sizeof (spr_test_list[0]);
+static int spr_test_list_size = ARRAY_SIZE(spr_test_list);
 
 int spr_post_test (int flags)
 {
diff --git a/post/cpu/mpc8xx/uart.c b/post/cpu/mpc8xx/uart.c
index f351ac0..7a7a62a 100644
--- a/post/cpu/mpc8xx/uart.c
+++ b/post/cpu/mpc8xx/uart.c
@@ -61,8 +61,6 @@ static int ctlr_list[][2] =
 static int ctlr_list[][2] = { };
 #endif
 
-#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0]))
-
 static struct {
void (*init) (int index);
void (*halt) (int index);
@@ -540,7 +538,7 @@ int uart_post_test (int flags)
ctlr_proc[CTLR_SCC].putc = scc_putc;
ctlr_proc[CTLR_SCC].getc = scc_getc;
 
-   for (i = 0; i  CTRL_LIST_SIZE; i++) {
+   for (i = 0; i  ARRAY_SIZE(ctlr_list); i++) {
if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) {
res = -1;
}
diff --git a/post/cpu/ppc4xx/spr.c b/post/cpu/ppc4xx/spr.c
index cb18b64..3f5e965 100644
--- a/post/cpu/ppc4xx/spr.c
+++ b/post/cpu/ppc4xx/spr.c
@@ -156,8 +156,7 @@ static struct {
{0x3f3, DBDR, 0x, 0x},
 };
 
-static int spr_test_list_size =
-   sizeof (spr_test_list) / sizeof (spr_test_list[0]);
+static int spr_test_list_size = ARRAY_SIZE(spr_test_list);
 
 int spr_post_test (int flags)
 {
diff --git a/post/drivers/memory.c b/post/drivers/memory.c
index 3f47449..4cca035 100644
--- a/post/drivers/memory.c
+++ b/post/drivers/memory.c
@@ -225,7 +225,7 @@ const unsigned long long otherpattern = 
0x0123456789abcdefULL;
 static int memory_post_dataline(unsigned long long * pmem)
 {
unsigned long long temp64 = 0;
-   int num_patterns = sizeof(pattern)/ 

[U-Boot] [PATCH 4/5] post: new nor flash test

2011-06-28 Thread Mike Frysinger
This adds a simple flash test to automatically verify erasing,
writing, and reading of sectors.  The code is based on existing
Blackfin tests but generalized for everyone to use.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 include/post.h|1 +
 post/drivers/Makefile |2 +-
 post/drivers/flash.c  |  107 +
 post/tests.c  |   15 ++-
 4 files changed, 123 insertions(+), 2 deletions(-)
 create mode 100644 post/drivers/flash.c

diff --git a/include/post.h b/include/post.h
index c9ec2f4..19991de 100644
--- a/include/post.h
+++ b/include/post.h
@@ -186,6 +186,7 @@ extern int post_hotkeys_pressed(void);
 #define CONFIG_SYS_POST_BSPEC5 0x0010
 #define CONFIG_SYS_POST_CODEC  0x0020
 #define CONFIG_SYS_POST_COPROC 0x0040
+#define CONFIG_SYS_POST_FLASH  0x0080
 
 #endif /* CONFIG_POST */
 
diff --git a/post/drivers/Makefile b/post/drivers/Makefile
index 0d87ae0..85d6c03 100644
--- a/post/drivers/Makefile
+++ b/post/drivers/Makefile
@@ -24,6 +24,6 @@ include $(TOPDIR)/config.mk
 
 LIB= libpostdrivers.o
 
-COBJS-$(CONFIG_HAS_POST)   += i2c.o memory.o rtc.o
+COBJS-$(CONFIG_HAS_POST)   += flash.o i2c.o memory.o rtc.o
 
 include $(TOPDIR)/post/rules.mk
diff --git a/post/drivers/flash.c b/post/drivers/flash.c
new file mode 100644
index 000..07eab33
--- /dev/null
+++ b/post/drivers/flash.c
@@ -0,0 +1,107 @@
+/*
+ * Parallel NOR Flash tests
+ *
+ * Copyright (c) 2005-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include common.h
+#include malloc.h
+#include post.h
+#include flash.h
+
+#if CONFIG_POST  CONFIG_SYS_POST_FLASH
+
+/*
+ * This code will walk over the declared sectors erasing them,
+ * then programming them, then verifying the written contents.
+ * Possible future work:
+ *  - verify sectors before/after are not erased/written
+ *  - verify partial writes (e.g. programming only middle of sector)
+ *  - verify the contents of the erased sector
+ *  - better seed pattern than 0x00..0xff
+ */
+
+#ifndef CONFIG_SYS_POST_FLASH_NUM
+# define CONFIG_SYS_POST_FLASH_NUM 0
+#endif
+#if CONFIG_SYS_POST_FLASH_START = CONFIG_SYS_POST_FLASH_END
+# error invalid flash block start/end
+#endif
+
+extern flash_info_t flash_info[];
+
+static void *seed_src_data(void *ptr, ulong *old_len, ulong new_len)
+{
+   unsigned char *p;
+   ulong i;
+
+   p = ptr = realloc(ptr, new_len);
+   if (!ptr)
+   return ptr;
+
+   for (i = *old_len; i  new_len; ++i)
+   p[i] = i;
+
+   *old_len = new_len;
+
+   return ptr;
+}
+
+int flash_post_test(int flags)
+{
+   ulong len;
+   void *src;
+   int ret, n, n_start, n_end;
+   flash_info_t *info;
+
+   /* the output from the common flash layers needs help */
+   puts(\n);
+
+   len = 0;
+   src = NULL;
+   info = flash_info[CONFIG_SYS_POST_FLASH_NUM];
+   n_start = CONFIG_SYS_POST_FLASH_START;
+   n_end = CONFIG_SYS_POST_FLASH_END;
+
+   for (n = n_start; n  n_end; ++n) {
+   ulong s_start, s_len, s_off;
+
+   s_start = info-start[n];
+   s_len = flash_sector_size(info, n);
+   s_off = s_start - info-start[0];
+
+   src = seed_src_data(src, len, s_len);
+   if (!src) {
+   printf(malloc(%#lx) failed\n, s_len);
+   return 1;
+   }
+
+   printf(\tsector %i: %#lx +%#lx, n, s_start, s_len);
+
+   ret = flash_erase(info, n, n + 1);
+   if (ret) {
+   flash_perror(ret);
+   break;
+   }
+
+   ret = write_buff(info, src, s_start, s_len);
+   if (ret) {
+   flash_perror(ret);
+   break;
+   }
+
+   ret = memcmp(src, (void *)s_start, s_len);
+   if (ret) {
+   printf( verify failed with %i\n, ret);
+   break;
+   }
+   }
+
+   free(src);
+
+   return ret;
+}
+
+#endif
diff --git a/post/tests.c b/post/tests.c
index 71437b6..bfb9cb5 100644
--- a/post/tests.c
+++ b/post/tests.c
@@ -46,6 +46,7 @@ extern int sysmon_post_test (int flags);
 extern int dsp_post_test (int flags);
 extern int codec_post_test (int flags);
 extern int ecc_post_test (int flags);
+extern int flash_post_test(int flags);
 
 extern int dspic_init_post_test (int flags);
 extern int dspic_post_test (int flags);
@@ -301,7 +302,19 @@ struct post_test post_list[] =
NULL,
NULL,
CONFIG_SYS_POST_COPROC
-}
+},
+#endif
+#if CONFIG_POST  CONFIG_SYS_POST_FLASH
+{
+   Parallel NOR flash test,
+   flash,
+   This test verifies parallel flash operations.,
+   POST_RAM | POST_SLOWTEST | POST_MANUAL,
+   flash_post_test,
+   NULL,
+   NULL,
+   

[U-Boot] [PATCH 5/5] serial: implement common uart post test

2011-06-28 Thread Mike Frysinger
The current arch/driver specific UART posts basically boil down to setting
the UART to loop back mode, then reading and writing data.  If we ignore
the loop back part, the rest can be built upon the existing common serial
API.  So let's do just that.

First add a call back for serial drivers to implement loop back control.
Then write a post test that walks all of the serial drivers, puts them
into loop back mode, and verifies that reading/writing at all the diff
baud rates is OK.

If a serial driver doesn't support loop back mode (either it can't or
it hasn't done so yet), then skip it.  This should allow for people to
easily migrate to the new post test with existing serial drivers.

I haven't touched the few already existing uart post tests as I don't
the hardware or knowledge of converting them over.  So I've marked the
new test as weak which will allow the existing tests to override the
default until they are converted.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 common/serial.c  |   90 ++
 include/serial.h |5 +++
 2 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 8ebf9a5..27c9b69 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -24,6 +24,8 @@
 #include common.h
 #include serial.h
 #include stdio_dev.h
+#include post.h
+#include linux/compiler.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -291,3 +293,91 @@ void serial_puts (const char *s)
 
serial_current-puts (s);
 }
+
+#if CONFIG_POST  CONFIG_SYS_POST_UART
+static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE;
+
+/* Mark weak until post/cpu/.../uart.c migrate over */
+__weak
+int uart_post_test(int flags)
+{
+   unsigned char c;
+   int ret, saved_baud, b;
+   struct serial_device *saved_dev, *s;
+   bd_t *bd = gd-bd;
+
+   /* Save current serial state */
+   ret = 0;
+   saved_dev = serial_current;
+   saved_baud = bd-bi_baudrate;
+
+   for (s = serial_devices; s; s = s-next) {
+   /* If this driver doesn't support loop back, skip it */
+   if (!s-loop)
+   continue;
+
+   /* Test the next device */
+   serial_current = s;
+
+   ret = serial_init();
+   if (ret)
+   goto done;
+
+   /* Consume anything that happens to be queued */
+   while (serial_tstc())
+   serial_getc();
+
+   /* Enable loop back */
+   s-loop(1);
+
+   /* Test every available baud rate */
+   for (b = 0; b  ARRAY_SIZE(bauds); ++b) {
+   bd-bi_baudrate = bauds[b];
+   serial_setbrg();
+
+   /*
+* Stick to printable chars to avoid issues:
+*  - terminal corruption
+*  - serial program reacting to sequences and sending
+*back random extra data
+*  - most serial drivers add in extra chars (like \r\n)
+*/
+   for (c = 0x20; c  0x7f; ++c) {
+   /* Send it out */
+   serial_putc(c);
+
+   /* Make sure it's the same one */
+   ret = (c != serial_getc());
+   if (ret) {
+   s-loop(0);
+   goto done;
+   }
+
+   /* Clean up the output in case it was sent */
+   serial_putc('\b');
+   ret = ('\b' != serial_getc());
+   if (ret) {
+   s-loop(0);
+   goto done;
+   }
+   }
+   }
+
+   /* Disable loop back */
+   s-loop(0);
+
+   /* XXX: There is no serial_uninit() !? */
+   if (s-uninit)
+   s-uninit();
+   }
+
+ done:
+   /* Restore previous serial state */
+   serial_current = saved_dev;
+   bd-bi_baudrate = saved_baud;
+   serial_reinit_all();
+   serial_setbrg();
+
+   return ret;
+}
+#endif
diff --git a/include/serial.h b/include/serial.h
index f21d961..2230ed0 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -1,6 +1,8 @@
 #ifndef __SERIAL_H__
 #define __SERIAL_H__
 
+#include post.h
+
 #define NAMESIZE 16
 #define CTLRSIZE 8
 
@@ -15,6 +17,9 @@ struct serial_device {
int (*tstc) (void);
void (*putc) (const char c);
void (*puts) (const char *s);
+#if CONFIG_POST  CONFIG_SYS_POST_UART
+   void (*loop) (int);
+#endif
 
struct serial_device *next;
 };
-- 
1.7.5.3


[U-Boot] Pull request u-boot-blackfin.git (serial branch)

2011-06-28 Thread Mike Frysinger
All of thse patches have been posted previously, and no one has
given feedback, so here they are in a handy branch for you to pull.

The following changes since commit b1af6f532e0d348b153d5c148369229d24af361a:

  Prepare v2011.06 (2011-06-27 22:22:42 +0200)

are available in the git repository at:
  git://www.denx.de/git/u-boot-blackfin.git serial

Mike Frysinger (3):
  serial: push default_serial_console to drivers
  serial: drop serial_register return value
  serial: drop useless ctlr field

 arch/powerpc/cpu/mpc512x/serial.c  |   23 ---
 arch/powerpc/cpu/mpc5xxx/serial.c  |8 +++-
 arch/powerpc/cpu/mpc8xx/serial.c   |   18 ++--
 board/logicpd/zoom2/zoom2_serial.c |5 ++
 board/logicpd/zoom2/zoom2_serial.h |2 -
 common/serial.c|   72 +---
 drivers/serial/serial.c|   28 +++---
 drivers/serial/serial_pxa.c|3 -
 drivers/serial/serial_s3c24x0.c|   23 +--
 drivers/serial/serial_s5p.c|   27 ++---
 include/serial.h   |2 -
 11 files changed, 103 insertions(+), 108 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3] serial: drop serial_register return value

2011-06-28 Thread Mike Frysinger
The serial_register function never fails (always return 0), so change it
to a void function to avoid wasting overhead on it.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 common/serial.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 505c2c6..bf77409 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -30,7 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct serial_device *serial_devices = NULL;
 static struct serial_device *serial_current = NULL;
 
-int serial_register (struct serial_device *dev)
+void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
dev-init += gd-reloc_off;
@@ -43,8 +43,6 @@ int serial_register (struct serial_device *dev)
 
dev-next = serial_devices;
serial_devices = dev;
-
-   return 0;
 }
 
 void serial_initialize (void)
-- 
1.7.5.3

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


[U-Boot] [PATCH 1/3] serial: push default_serial_console to drivers

2011-06-28 Thread Mike Frysinger
Rather than sticking arch/board/driver specific logic in the common
serial code, push it all out to the respective drivers.  The serial
drivers declare these funcs weak so that boards can still override
things with their own definition.

Signed-off-by: Mike Frysinger vap...@gentoo.org
CC: Heiko Schocher h...@denx.de
CC: Anatolij Gustschin ag...@denx.de
CC: Tom Rix tom@windriver.com
CC: Minkyu Kang mk7.k...@samsung.com
CC: Craig Nauman cnau...@diagraph.com
CC: Prafulla Wadaskar prafu...@marvell.com
CC: Mahavir Jain mj...@marvell.com
---
 arch/powerpc/cpu/mpc512x/serial.c  |   12 ++
 arch/powerpc/cpu/mpc5xxx/serial.c  |6 +++
 arch/powerpc/cpu/mpc8xx/serial.c   |   10 +
 board/logicpd/zoom2/zoom2_serial.c |5 +++
 common/serial.c|   68 
 drivers/serial/serial.c|   17 +
 drivers/serial/serial_s3c24x0.c|   14 +++
 drivers/serial/serial_s5p.c|   16 
 8 files changed, 80 insertions(+), 68 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c 
b/arch/powerpc/cpu/mpc512x/serial.c
index cb5bbf0..558e4e2 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -30,6 +30,7 @@
  */
 
 #include common.h
+#include linux/compiler.h
 #include asm/io.h
 #include asm/processor.h
 #include serial.h
@@ -354,6 +355,17 @@ struct serial_device serial6_device =
 INIT_PSC_SERIAL_STRUCTURE(6, psc6, UART6);
 #endif
 
+__weak struct serial_device *default_serial_console(void)
+{
+#if (CONFIG_PSC_CONSOLE == 3)
+   return serial3_device;
+#elif (CONFIG_PSC_CONSOLE == 6)
+   return serial6_device;
+#else
+#error invalid CONFIG_PSC_CONSOLE
+#endif
+}
+
 #else
 
 void serial_setbrg(void)
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c 
b/arch/powerpc/cpu/mpc5xxx/serial.c
index 0127065..0e1a8ec 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -34,6 +34,7 @@
  */
 
 #include common.h
+#include linux/compiler.h
 #include mpc5xxx.h
 
 #if defined (CONFIG_SERIAL_MULTI)
@@ -348,6 +349,11 @@ struct serial_device serial0_device =
serial0_puts,
 };
 
+__weak struct serial_device *default_serial_console(void)
+{
+   return serial0_device;
+}
+
 struct serial_device serial1_device =
 {
serial1,
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index 9514c66..21803f5 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -26,6 +26,7 @@
 #include command.h
 #include serial.h
 #include watchdog.h
+#include linux/compiler.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -673,6 +674,15 @@ struct serial_device serial_scc_device =
 
 #endif /* CONFIG_8xx_CONS_SCCx */
 
+__weak struct serial_device *default_serial_console(void)
+{
+#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
+   return serial_smc_device;
+#else
+   return serial_scc_device;
+#endif
+}
+
 #ifdef CONFIG_MODEM_SUPPORT
 void disable_putc(void)
 {
diff --git a/board/logicpd/zoom2/zoom2_serial.c 
b/board/logicpd/zoom2/zoom2_serial.c
index fcfe624..74f165f 100644
--- a/board/logicpd/zoom2/zoom2_serial.c
+++ b/board/logicpd/zoom2/zoom2_serial.c
@@ -132,3 +132,8 @@ QUAD_INIT (0)
 QUAD_INIT (1)
 QUAD_INIT (2)
 QUAD_INIT (3)
+
+struct serial_device *default_serial_console(void)
+{
+   return ZOOM2_DEFAULT_SERIAL_DEVICE;
+}
diff --git a/common/serial.c b/common/serial.c
index 8ebf9a5..505c2c6 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -30,74 +30,6 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct serial_device *serial_devices = NULL;
 static struct serial_device *serial_current = NULL;
 
-#if !defined(CONFIG_LWMON)  !defined(CONFIG_PXA250)  
!defined(CONFIG_PXA27X)
-struct serial_device *__default_serial_console (void)
-{
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
-   return serial_smc_device;
-#elif defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
-   || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-   return serial_scc_device;
-#elif defined(CONFIG_4xx) \
-   || defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) \
-   || defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) \
-   || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) \
-   || defined(CONFIG_TEGRA2)
-#if defined(CONFIG_CONS_INDEX)  defined(CONFIG_SYS_NS16550_SERIAL)
-#if (CONFIG_CONS_INDEX==1)
-   return eserial1_device;
-#elif (CONFIG_CONS_INDEX==2)
-   return eserial2_device;
-#elif (CONFIG_CONS_INDEX==3)
-   return eserial3_device;
-#elif (CONFIG_CONS_INDEX==4)
-   return eserial4_device;
-#else
-#error Bad CONFIG_CONS_INDEX.
-#endif
-#else
-   return serial0_device;
-#endif
-#elif defined(CONFIG_MPC512X)
-#if (CONFIG_PSC_CONSOLE == 3)
-   return serial3_device;
-#elif (CONFIG_PSC_CONSOLE == 6)
-   return serial6_device;
-#else
-#error Bad CONFIG_PSC_CONSOLE.
-#endif
-#elif defined(CONFIG_S3C2410)
-#if 

[U-Boot] [PATCH 3/3] serial: drop useless ctlr field

2011-06-28 Thread Mike Frysinger
The multi serial support has a ctlr field which almost no one uses,
but everyone is forced to set to useless strings.  So punt it.

Funny enough, the only code that actually reads this field (the mpc8xx
driver) has a typo where it meant to look for the SCC driver.  Fix it
while converting the check to use the name field.

Signed-off-by: Mike Frysinger vap...@gentoo.org
CC: Heiko Schocher h...@denx.de
CC: Anatolij Gustschin ag...@denx.de
CC: Tom Rix tom@windriver.com
CC: Minkyu Kang mk7.k...@samsung.com
CC: Craig Nauman cnau...@diagraph.com
CC: Marek Vasut marek.va...@gmail.com
CC: Prafulla Wadaskar prafu...@marvell.com
CC: Mahavir Jain mj...@marvell.com
---
 arch/powerpc/cpu/mpc512x/serial.c  |   11 +--
 arch/powerpc/cpu/mpc5xxx/serial.c  |2 --
 arch/powerpc/cpu/mpc8xx/serial.c   |8 +++-
 board/logicpd/zoom2/zoom2_serial.h |2 --
 drivers/serial/serial.c|   11 +--
 drivers/serial/serial_pxa.c|3 ---
 drivers/serial/serial_s3c24x0.c|9 -
 drivers/serial/serial_s5p.c|   11 +--
 include/serial.h   |2 --
 9 files changed, 22 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c 
b/arch/powerpc/cpu/mpc512x/serial.c
index 558e4e2..5ee9cef 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -319,9 +319,8 @@ int serial_getcts_dev(unsigned int idx)
serial_puts_dev(port, s); \
}
 
-#define INIT_PSC_SERIAL_STRUCTURE(port, name, bus) { \
+#define INIT_PSC_SERIAL_STRUCTURE(port, name) { \
name, \
-   bus, \
serial##port##_init, \
serial##port##_uninit, \
serial##port##_setbrg, \
@@ -334,25 +333,25 @@ int serial_getcts_dev(unsigned int idx)
 #if defined(CONFIG_SYS_PSC1)
 DECLARE_PSC_SERIAL_FUNCTIONS(1);
 struct serial_device serial1_device =
-INIT_PSC_SERIAL_STRUCTURE(1, psc1, UART1);
+INIT_PSC_SERIAL_STRUCTURE(1, psc1);
 #endif
 
 #if defined(CONFIG_SYS_PSC3)
 DECLARE_PSC_SERIAL_FUNCTIONS(3);
 struct serial_device serial3_device =
-INIT_PSC_SERIAL_STRUCTURE(3, psc3, UART3);
+INIT_PSC_SERIAL_STRUCTURE(3, psc3);
 #endif
 
 #if defined(CONFIG_SYS_PSC4)
 DECLARE_PSC_SERIAL_FUNCTIONS(4);
 struct serial_device serial4_device =
-INIT_PSC_SERIAL_STRUCTURE(4, psc4, UART4);
+INIT_PSC_SERIAL_STRUCTURE(4, psc4);
 #endif
 
 #if defined(CONFIG_SYS_PSC6)
 DECLARE_PSC_SERIAL_FUNCTIONS(6);
 struct serial_device serial6_device =
-INIT_PSC_SERIAL_STRUCTURE(6, psc6, UART6);
+INIT_PSC_SERIAL_STRUCTURE(6, psc6);
 #endif
 
 __weak struct serial_device *default_serial_console(void)
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c 
b/arch/powerpc/cpu/mpc5xxx/serial.c
index 0e1a8ec..aa09f67 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -339,7 +339,6 @@ int serial1_tstc(void)
 struct serial_device serial0_device =
 {
serial0,
-   UART0,
serial0_init,
NULL,
serial0_setbrg,
@@ -357,7 +356,6 @@ __weak struct serial_device *default_serial_console(void)
 struct serial_device serial1_device =
 {
serial1,
-   UART1,
serial1_init,
NULL,
serial1_setbrg,
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index 21803f5..9239b24 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -391,7 +391,6 @@ smc_tstc(void)
 struct serial_device serial_smc_device =
 {
serial_smc,
-   SMC,
smc_init,
NULL,
smc_setbrg,
@@ -662,7 +661,6 @@ scc_tstc(void)
 struct serial_device serial_scc_device =
 {
serial_scc,
-   SCC,
scc_init,
NULL,
scc_setbrg,
@@ -702,7 +700,7 @@ kgdb_serial_init(void)
 {
int i = -1;
 
-   if (strcmp(default_serial_console()-ctlr, SMC) == 0)
+   if (strcmp(default_serial_console()-name, serial_smc) == 0)
{
 #if defined(CONFIG_8xx_CONS_SMC1)
i = 1;
@@ -710,7 +708,7 @@ kgdb_serial_init(void)
i = 2;
 #endif
}
-   else if (strcmp(default_serial_console()-ctlr, SMC) == 0)
+   else if (strcmp(default_serial_console()-name, serial_scc) == 0)
{
 #if defined(CONFIG_8xx_CONS_SCC1)
i = 1;
@@ -725,7 +723,7 @@ kgdb_serial_init(void)
 
if (i = 0)
{
-   serial_printf([on %s%d] , default_serial_console()-ctlr, i);
+   serial_printf([on %s%d] , default_serial_console()-name, i);
}
 }
 
diff --git a/board/logicpd/zoom2/zoom2_serial.h 
b/board/logicpd/zoom2/zoom2_serial.h
index a6d2427..4e30587 100644
--- a/board/logicpd/zoom2/zoom2_serial.h
+++ b/board/logicpd/zoom2/zoom2_serial.h
@@ -33,7 +33,6 @@ extern int zoom2_debug_board_connected (void);
 
 #define S(a) #a
 #define N(a) S(quad##a)
-#define U(a) S(UART##a)
 
 #define QUAD_INIT(n)   \
 int quad_init_##n(void)\
@@ -63,7 +62,6 @@ int 

Re: [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts

2011-06-28 Thread Mike Frysinger
On Monday, May 09, 2011 18:33:36 Mike Frysinger wrote:
 For newer STM parts where CFI = 1.1, there is a byte in the extended
 structure that declares the flash layout type (just like the AMD parts),
 so key off of that to find out when we need to reverse the geometry.

ping ...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 04/18] Blackfin: dont reset SWRST on newer bf526 parts

2011-06-28 Thread Mike Frysinger
The bug in the BF526 rom when doing a software reset exists only in older
silicon versions, so don't clear SWRST on newer parts.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/reset.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/cpu/reset.c b/arch/blackfin/cpu/reset.c
index e23dcc7..5567cd0 100644
--- a/arch/blackfin/cpu/reset.c
+++ b/arch/blackfin/cpu/reset.c
@@ -51,7 +51,9 @@ static void bfin_reset(void)
 
/* The BF526 ROM will crash during reset */
 #if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__)
-   bfin_read_SWRST();
+   /* Seems to be fixed with newer parts though ... */
+   if (__SILICON_REVISION__  2  bfin_revid()  2)
+   bfin_read_SWRST();
 #endif
 
/* Wait for the SWRST write to complete.  Cannot rely on SSYNC
-- 
1.7.5.3

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


[U-Boot] [PATCH 00/18] Blackfin updates for v2011.09

2011-06-28 Thread Mike Frysinger
Many of these have been posted already, but some have not.  We've pulled
some updates from the Linux port, added support for multiple serial devs
at the same time, and random tweaks/improvements all over.

Harald Krapfenbauer (2):
  Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update network settings
  Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: enable mmc_spi support

Mike Frysinger (16):
  Blackfin: uart: move debug buffers into local bss
  Blackfin: uart: add multiple serial support
  Blackfin: adi boards: enable multi serial support by default
  Blackfin: dont reset SWRST on newer bf526 parts
  Blackfin: add init.elf helper code
  Blackfin: uart: fix printf warning
  Blackfin: post: setup default CONFIG_SYS_POST_WORD_ADDR
  Blackfin: gpio: optimize free path a little
  Blackfin: sync MMR read/write helpers with Linux
  Blackfin: portmux: allow header to be included in assembly files
  Blackfin: drop unused dma.h header from start code
  Blackfin: adi boards: enable pretty flash progress output
  Blackfin: split out async setup
  Blackfin: serial: convert to bfin_{read,write} helpers
  Blackfin: update anomaly lists to latest public info
  Blackfin: adi boards: also set stderr to nc with helper

 Makefile   |3 +-
 arch/blackfin/cpu/.gitignore   |3 +
 arch/blackfin/cpu/Makefile |7 +-
 arch/blackfin/cpu/cpu.c|   16 +-
 arch/blackfin/cpu/gpio.c   |2 +
 arch/blackfin/cpu/init.S   |9 +
 arch/blackfin/cpu/init.lds.S   |   25 +++
 arch/blackfin/cpu/initcode.c   |   61 ++-
 arch/blackfin/cpu/initcode.h   |   71 +++
 arch/blackfin/cpu/reset.c  |4 +-
 arch/blackfin/cpu/serial.c |  234 ++--
 arch/blackfin/cpu/serial.h |   60 --
 arch/blackfin/cpu/start.S  |1 -
 arch/blackfin/include/asm/blackfin_local.h |   88 +-
 arch/blackfin/include/asm/config.h |3 +
 arch/blackfin/include/asm/gpio.h   |3 +-
 arch/blackfin/include/asm/mach-bf506/anomaly.h |   25 ++-
 arch/blackfin/include/asm/mach-bf518/anomaly.h |   28 ++-
 arch/blackfin/include/asm/mach-bf527/anomaly.h |   38 +++--
 arch/blackfin/include/asm/mach-bf533/anomaly.h |   23 ++-
 arch/blackfin/include/asm/mach-bf537/anomaly.h |   37 +++--
 arch/blackfin/include/asm/mach-bf538/anomaly.h |   42 +++--
 arch/blackfin/include/asm/mach-bf548/anomaly.h |  227 +--
 arch/blackfin/include/asm/mach-bf561/anomaly.h |  136 --
 arch/blackfin/include/asm/portmux.h|4 +
 arch/blackfin/lib/board.c  |4 +
 board/cm-bf537e/cm-bf537e.c|   34 +++--
 board/cm-bf537u/cm-bf537u.c|   39 ++--
 board/tcm-bf537/tcm-bf537.c|   34 +++--
 common/serial.c|3 +
 include/configs/bf537-stamp.h  |1 -
 include/configs/bfin_adi_common.h  |   12 +-
 include/configs/cm-bf537e.h|   20 ++-
 include/configs/cm-bf537u.h|   24 ++-
 include/configs/tcm-bf537.h|   20 ++-
 include/serial.h   |9 +
 36 files changed, 896 insertions(+), 454 deletions(-)
 create mode 100644 arch/blackfin/cpu/init.S
 create mode 100644 arch/blackfin/cpu/init.lds.S
 create mode 100644 arch/blackfin/cpu/initcode.h

-- 
1.7.5.3

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


[U-Boot] [PATCH 01/18] Blackfin: uart: move debug buffers into local bss

2011-06-28 Thread Mike Frysinger
There's no need for these saved buffers to be global symbols, or in
the data section.  So mark them static to move them into the bss.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/serial.c |   11 +++
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 650202e..b15c945 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -49,9 +49,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #include serial.h
 
 #ifdef CONFIG_DEBUG_SERIAL
-uint16_t cached_lsr[256];
-uint16_t cached_rbr[256];
-size_t cache_count;
+static uint16_t cached_lsr[256];
+static uint16_t cached_rbr[256];
+static size_t cache_count;
 
 /* The LSR is read-to-clear on some parts, so we have to make sure status
  * bits aren't inadvertently lost when doing various tests.  This also
@@ -112,11 +112,6 @@ int serial_init(void)
serial_initialize();
serial_setbrg();
uart_lsr_clear();
-#ifdef CONFIG_DEBUG_SERIAL
-   cache_count = 0;
-   memset(cached_lsr, 0x00, sizeof(cached_lsr));
-   memset(cached_rbr, 0x00, sizeof(cached_rbr));
-#endif
return 0;
 }
 
-- 
1.7.5.3

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


[U-Boot] [PATCH 02/18] Blackfin: uart: add multiple serial support

2011-06-28 Thread Mike Frysinger
This brings CONFIG_SERIAL_MULTI support to the Blackfin on-chip UARTs.
Ends up adding only ~512bytes per additional UART.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/initcode.c |   12 ++-
 arch/blackfin/cpu/serial.c   |  205 +-
 arch/blackfin/cpu/serial.h   |   44 +++---
 arch/blackfin/lib/board.c|4 +
 common/serial.c  |3 +
 include/serial.h |9 ++
 6 files changed, 222 insertions(+), 55 deletions(-)

diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c
index 750add0..61dc5ab 100644
--- a/arch/blackfin/cpu/initcode.c
+++ b/arch/blackfin/cpu/initcode.c
@@ -24,6 +24,8 @@
 __attribute__((always_inline))
 static inline void serial_init(void)
 {
+   uint32_t uart_base = UART_DLL;
+
 #ifdef __ADSPBF54x__
 # ifdef BFIN_BOOT_UART_USE_RTS
 #  define BFIN_UART_USE_RTS 1
@@ -65,13 +67,13 @@ static inline void serial_init(void)
 
if (BFIN_DEBUG_EARLY_SERIAL) {
int ucen = bfin_read16(pUART-gctl)  UCEN;
-   serial_early_init();
+   serial_early_init(uart_base);
 
/* If the UART is off, that means we need to program
 * the baud rate ourselves initially.
 */
if (ucen != UCEN)
-   serial_early_set_baud(CONFIG_BAUDRATE);
+   serial_early_set_baud(uart_base, CONFIG_BAUDRATE);
}
 }
 
@@ -79,6 +81,8 @@ __attribute__((always_inline))
 static inline void serial_deinit(void)
 {
 #ifdef __ADSPBF54x__
+   uint32_t uart_base = UART_DLL;
+
if (BFIN_UART_USE_RTS  CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART) {
/* clear forced RTS rather than relying on auto RTS */
bfin_write16(pUART-mcr, bfin_read16(pUART-mcr)  ~FCPOL);
@@ -89,6 +93,8 @@ static inline void serial_deinit(void)
 __attribute__((always_inline))
 static inline void serial_putc(char c)
 {
+   uint32_t uart_base = UART_DLL;
+
if (!BFIN_DEBUG_EARLY_SERIAL)
return;
 
@@ -519,7 +525,7 @@ update_serial_clocks(ADI_BOOT_DATA *bs, uint sdivB, uint 
divB, uint vcoB)
unsigned int quotient;
for (quotient = 0; dividend  0; ++quotient)
dividend -= divisor;
-   serial_early_put_div(quotient - ANOMALY_05000230);
+   serial_early_put_div(UART_DLL, quotient - ANOMALY_05000230);
serial_putc('c');
}
 
diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index b15c945..0252220 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -39,6 +39,8 @@
 
 #include common.h
 #include watchdog.h
+#include serial.h
+#include linux/compiler.h
 #include asm/blackfin.h
 #include asm/mach-common/bits/uart.h
 
@@ -59,14 +61,14 @@ static size_t cache_count;
  * tally of all the status bits.
  */
 static uint16_t uart_lsr_save;
-static uint16_t uart_lsr_read(void)
+static uint16_t uart_lsr_read(uint32_t uart_base)
 {
uint16_t lsr = bfin_read16(pUART-lsr);
uart_lsr_save |= (lsr  (OE|PE|FE|BI));
return lsr | uart_lsr_save;
 }
 /* Just do the clear for everyone since it can't hurt. */
-static void uart_lsr_clear(void)
+static void uart_lsr_clear(uint32_t uart_base)
 {
uart_lsr_save = 0;
bfin_write16(pUART-lsr, bfin_read16(pUART-lsr) | -1);
@@ -76,46 +78,17 @@ static void uart_lsr_clear(void)
  * bits get set/cleared, we don't really care since we don't read them
  * anyways (and thus anomaly 0599 is irrelevant).
  */
-static uint16_t uart_lsr_read(void)
+static inline uint16_t uart_lsr_read(uint32_t uart_base)
 {
return bfin_read16(pUART-lsr);
 }
-static void uart_lsr_clear(void)
+static void uart_lsr_clear(uint32_t uart_base)
 {
bfin_write16(pUART-lsr, bfin_read16(pUART-lsr) | -1);
 }
 #endif
 
-/* Symbol for our assembly to call. */
-void serial_set_baud(uint32_t baud)
-{
-   serial_early_set_baud(baud);
-}
-
-/* Symbol for common u-boot code to call.
- * Setup the baudrate (brg: baudrate generator).
- */
-void serial_setbrg(void)
-{
-   serial_set_baud(gd-baudrate);
-}
-
-/* Symbol for our assembly to call. */
-void serial_initialize(void)
-{
-   serial_early_init();
-}
-
-/* Symbol for common u-boot code to call. */
-int serial_init(void)
-{
-   serial_initialize();
-   serial_setbrg();
-   uart_lsr_clear();
-   return 0;
-}
-
-void serial_putc(const char c)
+static void uart_putc(uint32_t uart_base, const char c)
 {
/* send a \r for compatibility */
if (c == '\n')
@@ -124,7 +97,7 @@ void serial_putc(const char c)
WATCHDOG_RESET();
 
/* wait for the hardware fifo to clear up */
-   while (!(uart_lsr_read()  THRE))
+   while (!(uart_lsr_read(uart_base)  THRE))
continue;
 
/* queue the character for transmission */
@@ -134,18 +107,18 @@ void serial_putc(const char c)
 

[U-Boot] [PATCH 03/18] Blackfin: adi boards: enable multi serial support by default

2011-06-28 Thread Mike Frysinger
Since this only adds less than 3KiB, enable for all ADI boards.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 include/configs/bfin_adi_common.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 3312681..5d78403 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -112,6 +112,10 @@
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE   57600
 #endif
+#ifndef CONFIG_DEBUG_EARLY_SERIAL
+# define CONFIG_SERIAL_MULTI
+# define CONFIG_SYS_BFIN_UART
+#endif
 
 /*
  * Debug Settings
-- 
1.7.5.3

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


[U-Boot] [PATCH 05/18] Blackfin: add init.elf helper code

2011-06-28 Thread Mike Frysinger
This creates a standalone ELF that executes just the Blackfin initcode.
This is useful for people who want to program the low level aspects of
the CPU (memory/clocks/etc...) and can easily be used with JTAG for
quick booting while developing.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 Makefile |3 ++-
 arch/blackfin/cpu/.gitignore |3 +++
 arch/blackfin/cpu/Makefile   |7 ++-
 arch/blackfin/cpu/init.S |9 +
 arch/blackfin/cpu/init.lds.S |   25 +
 5 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 arch/blackfin/cpu/init.S
 create mode 100644 arch/blackfin/cpu/init.lds.S

diff --git a/Makefile b/Makefile
index 3454db6..8dfb174 100644
--- a/Makefile
+++ b/Makefile
@@ -1089,7 +1089,8 @@ clean:
   $(obj)board/voiceblue/eeprom   \
   $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds  \
   $(obj)u-boot.lds   \
-  $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]
+  $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]  \
+  $(obj)arch/blackfin/cpu/init.{lds,elf}
@rm -f $(obj)include/bmp_logo.h
@rm -f $(obj)lib/asm-offsets.s
@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map}
diff --git a/arch/blackfin/cpu/.gitignore b/arch/blackfin/cpu/.gitignore
index 0ec9d56..ba986d8 100644
--- a/arch/blackfin/cpu/.gitignore
+++ b/arch/blackfin/cpu/.gitignore
@@ -1 +1,4 @@
 bootrom-asm-offsets.[chs]
+
+init.lds
+init.elf
diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile
index df10f1b..5deaa9e 100644
--- a/arch/blackfin/cpu/Makefile
+++ b/arch/blackfin/cpu/Makefile
@@ -13,7 +13,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(CPU).o
 
-EXTRA:=
+EXTRA:= init.elf
 CEXTRA   := initcode.o
 SEXTRA   := start.o
 SOBJS:= interrupt.o cache.o
@@ -61,6 +61,11 @@ ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
fi
 endif
 
+$(obj)init.lds: init.lds.S
+   $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
+$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
+   $(LD) $(LDFLAGS) -T $^ -o $@
+
 #
 
 # defines $(obj).depend target
diff --git a/arch/blackfin/cpu/init.S b/arch/blackfin/cpu/init.S
new file mode 100644
index 000..f48c113
--- /dev/null
+++ b/arch/blackfin/cpu/init.S
@@ -0,0 +1,9 @@
+#include asm/blackfin.h
+ENTRY(_start)
+   sp.l = LO(L1_SRAM_SCRATCH_END - 20);
+   sp.h = HI(L1_SRAM_SCRATCH_END - 20);
+   call _initcode;
+1:
+   emuexcpt;
+   jump 1b;
+END(_start)
diff --git a/arch/blackfin/cpu/init.lds.S b/arch/blackfin/cpu/init.lds.S
new file mode 100644
index 000..602e7c8
--- /dev/null
+++ b/arch/blackfin/cpu/init.lds.S
@@ -0,0 +1,25 @@
+/*
+ * linker script for simple init.elf
+ *
+ * Copyright (c) 2005-2011 Analog Device Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include config.h
+#include asm/blackfin.h
+#undef ALIGN
+#undef ENTRY
+
+OUTPUT_ARCH(bfin)
+
+MEMORY
+{
+   l1_code : ORIGIN = L1_INST_SRAM, LENGTH = L1_INST_SRAM_SIZE
+}
+
+ENTRY(_start)
+SECTIONS
+{
+   .text.l1 : { *(.text .text.*) } l1_code
+}
-- 
1.7.5.3

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


[U-Boot] [PATCH 07/18] Blackfin: post: setup default CONFIG_SYS_POST_WORD_ADDR

2011-06-28 Thread Mike Frysinger
Set the default post word location to an L1 data location for all
Blackfin parts so things just work for most people.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/include/asm/config.h |3 +++
 include/configs/bf537-stamp.h  |1 -
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/include/asm/config.h 
b/arch/blackfin/include/asm/config.h
index 89814cd..bc3c252 100644
--- a/arch/blackfin/include/asm/config.h
+++ b/arch/blackfin/include/asm/config.h
@@ -121,6 +121,9 @@
 #ifndef CONFIG_SYS_MEMTEST_END
 # define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
 #endif
+#ifndef CONFIG_SYS_POST_WORD_ADDR
+# define CONFIG_SYS_POST_WORD_ADDR (L1_DATA_B_SRAM + L1_DATA_B_SRAM_SIZE - 4)
+#endif
 
 /* Check to make sure everything fits in external RAM */
 #if CONFIG_SYS_MAX_RAM_SIZE  \
diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h
index c31e914..da14a4f 100644
--- a/include/configs/bf537-stamp.h
+++ b/include/configs/bf537-stamp.h
@@ -260,7 +260,6 @@
 #define FLASH_START_POST_BLOCK 11  /* Should  = 11 */
 #define FLASH_END_POST_BLOCK   71  /* Should  = 71 */
 #endif
-#define CONFIG_SYS_POST_WORD_ADDR  0xFF903FFC
 
 /* These are for board tests */
 #if 0
-- 
1.7.5.3

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


[U-Boot] [PATCH 08/18] Blackfin: gpio: optimize free path a little

2011-06-28 Thread Mike Frysinger
When we aren't doing resource tracking, the gpio_free() function is a
stub that simply returns, so pull this logic up a level and make it an
inline stub in the header.  Now we don't have to waste time at any of
the call sites.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/gpio.c |2 ++
 arch/blackfin/include/asm/gpio.h |3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/cpu/gpio.c b/arch/blackfin/cpu/gpio.c
index cb96721..5674d42 100644
--- a/arch/blackfin/cpu/gpio.c
+++ b/arch/blackfin/cpu/gpio.c
@@ -665,6 +665,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
return 0;
 }
 
+#ifdef CONFIG_BFIN_GPIO_TRACK
 void bfin_gpio_free(unsigned gpio)
 {
if (check_gpio(gpio)  0)
@@ -679,6 +680,7 @@ void bfin_gpio_free(unsigned gpio)
 
set_label(gpio, free);
 }
+#endif
 
 #ifdef BFIN_SPECIAL_GPIO_BANKS
 DECLARE_RESERVED_MAP(special_gpio, gpio_bank(MAX_RESOURCES));
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 9c0e5d1..224688f 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -142,8 +142,10 @@ struct gpio_port_t {
 
 #ifdef CONFIG_BFIN_GPIO_TRACK
 void bfin_gpio_labels(void);
+void bfin_gpio_free(unsigned gpio);
 #else
 #define bfin_gpio_labels()
+#define bfin_gpio_free(gpio)
 #define bfin_gpio_request(gpio, label) bfin_gpio_request(gpio)
 #define bfin_special_gpio_request(gpio, label) bfin_special_gpio_request(gpio)
 #endif
@@ -154,7 +156,6 @@ int bfin_special_gpio_request(unsigned gpio, const char 
*label);
 #endif
 
 int bfin_gpio_request(unsigned gpio, const char *label);
-void bfin_gpio_free(unsigned gpio);
 int bfin_gpio_direction_input(unsigned gpio);
 int bfin_gpio_direction_output(unsigned gpio, int value);
 int bfin_gpio_get_value(unsigned gpio);
-- 
1.7.5.3

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


[U-Boot] [PATCH 06/18] Blackfin: uart: fix printf warning

2011-06-28 Thread Mike Frysinger
The code uses %i to printf a size_t when it should use %zu, otherwise
we get a warning from gcc about it.

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

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 0252220..1124ffd 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -142,7 +142,7 @@ static int uart_getc(uint32_t uart_base)
printf(\tDLL=0x%x DLH=0x%x\n, dll, dlh);
do {
--cache_count;
-   printf(\t%3i: RBR=0x%02x LSR=0x%02x\n, cache_count,
+   printf(\t%3zu: RBR=0x%02x LSR=0x%02x\n, cache_count,
cached_rbr[cache_count], 
cached_lsr[cache_count]);
} while (cache_count  0);
return -1;
-- 
1.7.5.3

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


[U-Boot] [PATCH 09/18] Blackfin: sync MMR read/write helpers with Linux

2011-06-28 Thread Mike Frysinger
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/include/asm/blackfin_local.h |   88 +--
 1 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/arch/blackfin/include/asm/blackfin_local.h 
b/arch/blackfin/include/asm/blackfin_local.h
index 48f793a..27034d3 100644
--- a/arch/blackfin/include/asm/blackfin_local.h
+++ b/arch/blackfin/include/asm/blackfin_local.h
@@ -93,65 +93,61 @@ extern void blackfin_dcache_flush_invalidate_range(const 
void *, const void *);
 # define NOP_PAD_ANOMALY_05000198
 #endif
 
-#define bfin_read8(addr) ({ \
-   uint8_t __v; \
+#define _bfin_readX(addr, size, asm_size, asm_ext) ({ \
+   u32 __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
-   %0 = b[%1] (z); \
+   %0 =  #asm_size [%1] #asm_ext ; \
: =d (__v) \
: a (addr) \
); \
__v; })
-
-#define bfin_read16(addr) ({ \
-   uint16_t __v; \
-   __asm__ __volatile__( \
-   NOP_PAD_ANOMALY_05000198 \
-   %0 = w[%1] (z); \
-   : =d (__v) \
-   : a (addr) \
-   ); \
-   __v; })
-
-#define bfin_read32(addr) ({ \
-   uint32_t __v; \
+#define _bfin_writeX(addr, val, size, asm_size) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
-   %0 = [%1]; \
-   : =d (__v) \
-   : a (addr) \
-   ); \
-   __v; })
-
-#define bfin_readPTR(addr) bfin_read32(addr)
-
-#define bfin_write8(addr, val) \
-   __asm__ __volatile__( \
-   NOP_PAD_ANOMALY_05000198 \
-   b[%0] = %1; \
-   : \
-   : a (addr), d (val) \
-   : memory \
-   )
-
-#define bfin_write16(addr, val) \
-   __asm__ __volatile__( \
-   NOP_PAD_ANOMALY_05000198 \
-   w[%0] = %1; \
+   #asm_size [%0] = %1; \
: \
-   : a (addr), d (val) \
+   : a (addr), d ((u##size)(val)) \
: memory \
)
 
-#define bfin_write32(addr, val) \
-   __asm__ __volatile__( \
-   NOP_PAD_ANOMALY_05000198 \
-   [%0] = %1; \
-   : \
-   : a (addr), d (val) \
-   : memory \
-   )
+#define bfin_read8(addr)  _bfin_readX(addr,  8, b, (z))
+#define bfin_read16(addr) _bfin_readX(addr, 16, w, (z))
+#define bfin_read32(addr) _bfin_readX(addr, 32,  ,)
+#define bfin_write8(addr, val)  _bfin_writeX(addr, val,  8, b)
+#define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w)
+#define bfin_write32(addr, val) _bfin_writeX(addr, val, 32,  )
+
+#define bfin_read(addr) \
+({ \
+   sizeof(*(addr)) == 1 ? bfin_read8(addr)  : \
+   sizeof(*(addr)) == 2 ? bfin_read16(addr) : \
+   sizeof(*(addr)) == 4 ? bfin_read32(addr) : \
+   ({ BUG(); 0; }); \
+})
+#define bfin_write(addr, val) \
+do { \
+   switch (sizeof(*(addr))) { \
+   case 1: bfin_write8(addr, val);  break; \
+   case 2: bfin_write16(addr, val); break; \
+   case 4: bfin_write32(addr, val); break; \
+   default: BUG(); \
+   } \
+} while (0)
+
+#define bfin_write_or(addr, bits) \
+do { \
+   typeof(addr) __addr = (addr); \
+   bfin_write(__addr, bfin_read(__addr) | (bits)); \
+} while (0)
+
+#define bfin_write_and(addr, bits) \
+do { \
+   typeof(addr) __addr = (addr); \
+   bfin_write(__addr, bfin_read(__addr)  (bits)); \
+} while (0)
 
+#define bfin_readPTR(addr) bfin_read32(addr)
 #define bfin_writePTR(addr, val) bfin_write32(addr, val)
 
 /* SSYNC implementation for C file */
-- 
1.7.5.3

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


[U-Boot] [PATCH 10/18] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update network settings

2011-06-28 Thread Mike Frysinger
From: Harald Krapfenbauer harald.krapfenba...@bluetechnix.com

These boards can have an addon card plugged onto them, so enable
support for it.

Signed-off-by: Harald Krapfenbauer harald.krapfenba...@bluetechnix.com
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 board/cm-bf537e/cm-bf537e.c |   34 ++
 board/cm-bf537u/cm-bf537u.c |   39 +--
 board/tcm-bf537/tcm-bf537.c |   34 ++
 include/configs/cm-bf537e.h |3 +++
 include/configs/cm-bf537u.h |8 
 include/configs/tcm-bf537.h |4 +++-
 6 files changed, 75 insertions(+), 47 deletions(-)

diff --git a/board/cm-bf537e/cm-bf537e.c b/board/cm-bf537e/cm-bf537e.c
index 1e350dc..38dbc6e 100644
--- a/board/cm-bf537e/cm-bf537e.c
+++ b/board/cm-bf537e/cm-bf537e.c
@@ -24,27 +24,37 @@ int checkboard(void)
return 0;
 }
 
-#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
+static void board_init_enetaddr(char *var)
 {
-   puts(Warning: Generating 'random' MAC address\n);
-   bfin_gen_rand_mac(mac_addr);
-   eth_setenv_enetaddr(ethaddr, mac_addr);
+#ifdef CONFIG_NET_MULTI
+   uchar enetaddr[6];
+
+   if (eth_getenv_enetaddr(var, enetaddr))
+   return;
+
+   printf(Warning: %s: generating 'random' MAC address\n, var);
+   bfin_gen_rand_mac(enetaddr);
+   eth_setenv_enetaddr(var, enetaddr);
+#endif
 }
 
+#ifndef CONFIG_BFIN_MAC
+# define bfin_EMAC_initialize(x) 1
+#endif
+#ifndef CONFIG_SMC911X
+# define smc911x_initialize(n, x) 1
+#endif
 int board_eth_init(bd_t *bis)
 {
-   return bfin_EMAC_initialize(bis);
+   /* return ok if at least 1 eth device works */
+   return bfin_EMAC_initialize(bis) 
+  smc911x_initialize(0, CONFIG_SMC911X_BASE);
 }
-#endif
 
 int misc_init_r(void)
 {
-#ifdef CONFIG_BFIN_MAC
-   uchar enetaddr[6];
-   if (!eth_getenv_enetaddr(ethaddr, enetaddr))
-   board_init_enetaddr(enetaddr);
-#endif
+   board_init_enetaddr(ethaddr);
+   board_init_enetaddr(eth1addr);
 
gpio_cfi_flash_init();
 
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 4b7e864..a62ddd6 100644
--- a/board/cm-bf537u/cm-bf537u.c
+++ b/board/cm-bf537u/cm-bf537u.c
@@ -24,34 +24,37 @@ int checkboard(void)
return 0;
 }
 
-#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
+static void board_init_enetaddr(char *var)
 {
-   puts(Warning: Generating 'random' MAC address\n);
-   bfin_gen_rand_mac(mac_addr);
-   eth_setenv_enetaddr(ethaddr, mac_addr);
-}
+#ifdef CONFIG_NET_MULTI
+   uchar enetaddr[6];
 
-int board_eth_init(bd_t *bis)
-{
-   return bfin_EMAC_initialize(bis);
-}
+   if (eth_getenv_enetaddr(var, enetaddr))
+   return;
+
+   printf(Warning: %s: generating 'random' MAC address\n, var);
+   bfin_gen_rand_mac(enetaddr);
+   eth_setenv_enetaddr(var, enetaddr);
 #endif
+}
 
-#ifdef CONFIG_SMC911X
+#ifndef CONFIG_BFIN_MAC
+# define bfin_EMAC_initialize(x) 1
+#endif
+#ifndef CONFIG_SMC911X
+# define smc911x_initialize(n, x) 1
+#endif
 int board_eth_init(bd_t *bis)
 {
-   return smc911x_initialize(0, CONFIG_SMC911X_BASE);
+   /* return ok if at least 1 eth device works */
+   return bfin_EMAC_initialize(bis) 
+  smc911x_initialize(0, CONFIG_SMC911X_BASE);
 }
-#endif
 
 int misc_init_r(void)
 {
-#ifdef CONFIG_BFIN_MAC
-   uchar enetaddr[6];
-   if (!eth_getenv_enetaddr(ethaddr, enetaddr))
-   board_init_enetaddr(enetaddr);
-#endif
+   board_init_enetaddr(ethaddr);
+   board_init_enetaddr(eth1addr);
 
gpio_cfi_flash_init();
 
diff --git a/board/tcm-bf537/tcm-bf537.c b/board/tcm-bf537/tcm-bf537.c
index 04d6bdb..004e0d9 100644
--- a/board/tcm-bf537/tcm-bf537.c
+++ b/board/tcm-bf537/tcm-bf537.c
@@ -24,27 +24,37 @@ int checkboard(void)
return 0;
 }
 
-#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
+static void board_init_enetaddr(char *var)
 {
-   puts(Warning: Generating 'random' MAC address\n);
-   bfin_gen_rand_mac(mac_addr);
-   eth_setenv_enetaddr(ethaddr, mac_addr);
+#ifdef CONFIG_NET_MULTI
+   uchar enetaddr[6];
+
+   if (eth_getenv_enetaddr(var, enetaddr))
+   return;
+
+   printf(Warning: %s: generating 'random' MAC address\n, var);
+   bfin_gen_rand_mac(enetaddr);
+   eth_setenv_enetaddr(var, enetaddr);
+#endif
 }
 
+#ifndef CONFIG_BFIN_MAC
+# define bfin_EMAC_initialize(x) 1
+#endif
+#ifndef CONFIG_SMC911X
+# define smc911x_initialize(n, x) 1
+#endif
 int board_eth_init(bd_t *bis)
 {
-   return bfin_EMAC_initialize(bis);
+   /* return ok if at least 1 eth device works */
+   return bfin_EMAC_initialize(bis) 
+  smc911x_initialize(0, CONFIG_SMC911X_BASE);
 }
-#endif
 
 int misc_init_r(void)
 {
-#ifdef CONFIG_BFIN_MAC
-   uchar enetaddr[6];
-   if 

[U-Boot] [PATCH 11/18] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: enable mmc_spi support

2011-06-28 Thread Mike Frysinger
From: Harald Krapfenbauer harald.krapfenba...@bluetechnix.com

These boards have an mmc/sd slot on them connected over SPI, so
enable the driver.

Signed-off-by: Harald Krapfenbauer harald.krapfenba...@bluetechnix.com
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 include/configs/cm-bf537e.h |   17 -
 include/configs/cm-bf537u.h |   16 +++-
 include/configs/tcm-bf537.h |   16 +++-
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/include/configs/cm-bf537e.h b/include/configs/cm-bf537e.h
index 3ee7738..9649e18 100644
--- a/include/configs/cm-bf537e.h
+++ b/include/configs/cm-bf537e.h
@@ -55,7 +55,7 @@
 #define CONFIG_EBIU_AMBCTL0_VAL(B1WAT_7 | B1RAT_11 | B1HT_2 | B1ST_3 | 
B0WAT_7 | B0RAT_11 | B0HT_2 | B0ST_3)
 #define CONFIG_EBIU_AMBCTL1_VAL(B3WAT_7 | B3RAT_11 | B3HT_2 | B3ST_3 | 
B2WAT_7 | B2RAT_11 | B2HT_2 | B2ST_3)
 
-#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
+#define CONFIG_SYS_MONITOR_LEN (512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN  (128 * 1024)
 
 
@@ -89,6 +89,13 @@
 
 
 /*
+ * SPI Settings
+ */
+#define CONFIG_BFIN_SPI
+#define CONFIG_ENV_SPI_MAX_HZ  3000
+
+
+/*
  * Env Storage Settings
  */
 #define CONFIG_ENV_IS_IN_FLASH 1
@@ -121,6 +128,14 @@
 
 
 /*
+ * SPI_MMC Settings
+ */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC_SPI
+
+
+/*
  * Misc Settings
  */
 #define CONFIG_BAUDRATE115200
diff --git a/include/configs/cm-bf537u.h b/include/configs/cm-bf537u.h
index c791926..84846ef 100644
--- a/include/configs/cm-bf537u.h
+++ b/include/configs/cm-bf537u.h
@@ -54,7 +54,7 @@
 #define CONFIG_EBIU_AMBCTL0_VAL(B1WAT_7 | B1RAT_11 | B1HT_2 | B1ST_3 | 
B0WAT_7 | B0RAT_11 | B0HT_2 | B0ST_3)
 #define CONFIG_EBIU_AMBCTL1_VAL(B3WAT_7 | B3RAT_11 | B3HT_2 | B3ST_3 | 
B2WAT_7 | B2RAT_11 | B2HT_2 | B2ST_3)
 
-#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
+#define CONFIG_SYS_MONITOR_LEN (512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN  (128 * 1024)
 
 
@@ -87,6 +87,13 @@
 
 
 /*
+ * SPI Settings
+ */
+#define CONFIG_BFIN_SPI
+#define CONFIG_ENV_SPI_MAX_HZ  3000
+
+
+/*
  * Env Storage Settings
  */
 #define CONFIG_ENV_IS_IN_FLASH 1
@@ -119,6 +126,13 @@
 
 
 /*
+ * SPI_MMC Settings
+ */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC_SPI
+
+/*
  * Misc Settings
  */
 #define CONFIG_BAUDRATE115200
diff --git a/include/configs/tcm-bf537.h b/include/configs/tcm-bf537.h
index f2c5b98..2375fc5 100644
--- a/include/configs/tcm-bf537.h
+++ b/include/configs/tcm-bf537.h
@@ -55,7 +55,7 @@
 #define CONFIG_EBIU_AMBCTL0_VAL(B1WAT_7 | B1RAT_11 | B1HT_2 | B1ST_3 | 
B0WAT_7 | B0RAT_11 | B0HT_2 | B0ST_3)
 #define CONFIG_EBIU_AMBCTL1_VAL(B3WAT_7 | B3RAT_11 | B3HT_2 | B3ST_3 | 
B2WAT_7 | B2RAT_11 | B2HT_2 | B2ST_3)
 
-#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
+#define CONFIG_SYS_MONITOR_LEN (512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN  (128 * 1024)
 
 
@@ -89,6 +89,13 @@
 
 
 /*
+ * SPI Settings
+ */
+#define CONFIG_BFIN_SPI
+#define CONFIG_ENV_SPI_MAX_HZ  3000
+
+
+/*
  * Env Storage Settings
  */
 #define CONFIG_ENV_IS_IN_FLASH 1
@@ -121,6 +128,13 @@
 
 
 /*
+ * SPI_MMC Settings
+ */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC_SPI
+
+/*
  * Misc Settings
  */
 #define CONFIG_BAUDRATE115200
-- 
1.7.5.3

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


[U-Boot] [PATCH 13/18] Blackfin: drop unused dma.h header from start code

2011-06-28 Thread Mike Frysinger
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/start.S |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S
index 15ecb1e..90b4d1a 100644
--- a/arch/blackfin/cpu/start.S
+++ b/arch/blackfin/cpu/start.S
@@ -33,7 +33,6 @@
 #include config.h
 #include asm/blackfin.h
 #include asm/mach-common/bits/core.h
-#include asm/mach-common/bits/dma.h
 #include asm/mach-common/bits/pll.h
 
 #include serial.h
-- 
1.7.5.3

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


[U-Boot] [PATCH 12/18] Blackfin: portmux: allow header to be included in assembly files

2011-06-28 Thread Mike Frysinger
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/include/asm/portmux.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/blackfin/include/asm/portmux.h 
b/arch/blackfin/include/asm/portmux.h
index b17207f..300ef44 100644
--- a/arch/blackfin/include/asm/portmux.h
+++ b/arch/blackfin/include/asm/portmux.h
@@ -22,11 +22,15 @@
 #define peripheral_request_list(per, label) peripheral_request_list(per)
 #endif
 
+#ifndef __ASSEMBLY__
+
 int peripheral_request(unsigned short per, const char *label);
 void peripheral_free(unsigned short per);
 int peripheral_request_list(const unsigned short per[], const char *label);
 void peripheral_free_list(const unsigned short per[]);
 
+#endif
+
 #include asm/blackfin.h
 
 #ifndef P_SPORT2_TFS
-- 
1.7.5.3

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


[U-Boot] [PATCH 14/18] Blackfin: adi boards: enable pretty flash progress output

2011-06-28 Thread Mike Frysinger
For only ~150 bytes increase in size, we can get a nice flash progress
indicator rather than just the boring dots (which don't tell too much
about overall progress).  So enable it for all ADI boards.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 include/configs/bfin_adi_common.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 5d78403..80f8a14 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -277,6 +277,11 @@
 #endif
 
 /*
+ * Flash Settings
+ */
+#define CONFIG_FLASH_SHOW_PROGRESS 45
+
+/*
  * SPI Settings
  */
 #ifdef CONFIG_SPI_FLASH_ALL
-- 
1.7.5.3

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


[U-Boot] [PATCH 15/18] Blackfin: split out async setup

2011-06-28 Thread Mike Frysinger
We really only need to tweak the async banks in the initcode if the
processor is booting out of it, otherwise we can wait until later
on in the CPU booting setup.

This also makes testing in the sim and early bring up over JTAG work
much smoother when the initcode gets bypassed.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/cpu.c  |   16 ++---
 arch/blackfin/cpu/initcode.c |   47 ++--
 arch/blackfin/cpu/initcode.h |   71 ++
 3 files changed, 84 insertions(+), 50 deletions(-)
 create mode 100644 arch/blackfin/cpu/initcode.h

diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c
index 18dbdf7..6a0bcca 100644
--- a/arch/blackfin/cpu/cpu.c
+++ b/arch/blackfin/cpu/cpu.c
@@ -19,6 +19,7 @@
 
 #include cpu.h
 #include serial.h
+#include initcode.h
 
 ulong bfin_poweron_retx;
 
@@ -44,13 +45,16 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
extern char _sdata_l1[], _data_l1_lma[], _data_l1_len[];
memcpy(_sdata_l1, _data_l1_lma, (unsigned long)_data_l1_len);
}
-#if defined(__ADSPBF537__) || defined(__ADSPBF536__) || defined(__ADSPBF534__)
-   /* The BF537 bootrom will reset the EBIU_AMGCTL register on us
-* after it has finished loading the LDR.  So configure it again.
+
+   /*
+* Make sure our async settings are committed.  Some bootroms
+* (like the BF537) will reset some registers on us after it
+* has finished loading the LDR.  Or if we're booting over
+* JTAG, the initcode never got a chance to run.  Or if we
+* aren't booting from parallel flash, the initcode skipped
+* this step completely.
 */
-   else
-   bfin_write_EBIU_AMGCTL(CONFIG_EBIU_AMGCTL_VAL);
-#endif
+   program_async_controller(NULL);
 
/* Save RETX so we can pass it while booting Linux */
bfin_poweron_retx = bootflag;
diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c
index 61dc5ab..917b7f9 100644
--- a/arch/blackfin/cpu/initcode.c
+++ b/arch/blackfin/cpu/initcode.c
@@ -4,7 +4,7 @@
  * cannot make any function calls as it may be executed all by itself by
  * the Blackfin's bootrom in LDR format.
  *
- * Copyright (c) 2004-2008 Analog Devices Inc.
+ * Copyright (c) 2004-2011 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -107,6 +107,8 @@ static inline void serial_putc(char c)
continue;
 }
 
+#include initcode.h
+
 __attribute__((always_inline)) static inline void
 program_nmi_handler(void)
 {
@@ -172,21 +174,6 @@ program_nmi_handler(void)
 # define CONFIG_PLL_CTL_VAL (SPORT_HYST | (CONFIG_VCO_MULT  9) | 
CONFIG_CLKIN_HALF)
 #endif
 
-#ifndef CONFIG_EBIU_RSTCTL_VAL
-# define CONFIG_EBIU_RSTCTL_VAL 0 /* only MDDRENABLE is useful */
-#endif
-#if ((CONFIG_EBIU_RSTCTL_VAL  0xFFC4) != 0)
-# error invalid EBIU_RSTCTL value: must not set reserved bits
-#endif
-
-#ifndef CONFIG_EBIU_MBSCTL_VAL
-# define CONFIG_EBIU_MBSCTL_VAL 0
-#endif
-
-#if defined(CONFIG_EBIU_DDRQUE_VAL)  ((CONFIG_EBIU_DDRQUE_VAL  0x8000) 
!= 0)
-# error invalid EBIU_DDRQUE value: must not set reserved bits
-#endif
-
 /* Make sure our voltage value is sane so we don't blow up! */
 #ifndef CONFIG_VR_CTL_VAL
 # define BFIN_CCLK ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / CONFIG_CCLK_DIV)
@@ -642,34 +629,6 @@ check_hibernation(ADI_BOOT_DATA *bs, u16 vr_ctl, bool 
put_into_srfs)
serial_putc('e');
 }
 
-__attribute__((always_inline)) static inline void
-program_async_controller(ADI_BOOT_DATA *bs)
-{
-   serial_putc('a');
-
-   /* Program the async banks controller. */
-   bfin_write_EBIU_AMBCTL0(CONFIG_EBIU_AMBCTL0_VAL);
-   bfin_write_EBIU_AMBCTL1(CONFIG_EBIU_AMBCTL1_VAL);
-   bfin_write_EBIU_AMGCTL(CONFIG_EBIU_AMGCTL_VAL);
-
-   serial_putc('b');
-
-   /* Not all parts have these additional MMRs. */
-#ifdef EBIU_MBSCTL
-   bfin_write_EBIU_MBSCTL(CONFIG_EBIU_MBSCTL_VAL);
-#endif
-#ifdef EBIU_MODE
-# ifdef CONFIG_EBIU_MODE_VAL
-   bfin_write_EBIU_MODE(CONFIG_EBIU_MODE_VAL);
-# endif
-# ifdef CONFIG_EBIU_FCTL_VAL
-   bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTL_VAL);
-# endif
-#endif
-
-   serial_putc('c');
-}
-
 BOOTROM_CALLED_FUNC_ATTR
 void initcode(ADI_BOOT_DATA *bs)
 {
diff --git a/arch/blackfin/cpu/initcode.h b/arch/blackfin/cpu/initcode.h
new file mode 100644
index 000..e0aad6d
--- /dev/null
+++ b/arch/blackfin/cpu/initcode.h
@@ -0,0 +1,71 @@
+/*
+ * Code for early processor initialization
+ *
+ * Copyright (c) 2004-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __BFIN_INITCODE_H__
+#define __BFIN_INITCODE_H__
+
+#include asm/mach-common/bits/bootrom.h
+
+#ifndef BFIN_IN_INITCODE
+# define serial_putc(c)
+#endif
+
+#ifndef CONFIG_EBIU_RSTCTL_VAL
+# define CONFIG_EBIU_RSTCTL_VAL 0 /* only MDDRENABLE is useful */
+#endif
+#if ((CONFIG_EBIU_RSTCTL_VAL  0xFFC4) != 0)
+# 

[U-Boot] [PATCH 16/18] Blackfin: serial: convert to bfin_{read, write} helpers

2011-06-28 Thread Mike Frysinger
Since the serial struct declares the sizes for us, no need to hardcode
them in the accessor functions.  Let the bfin_{read,write} helpers do
it for us.

Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/cpu/initcode.c |2 ++
 arch/blackfin/cpu/serial.c   |   16 
 arch/blackfin/cpu/serial.h   |   18 +-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c
index 917b7f9..fb3a101 100644
--- a/arch/blackfin/cpu/initcode.c
+++ b/arch/blackfin/cpu/initcode.c
@@ -19,6 +19,8 @@
 #include asm/mach-common/bits/pll.h
 #include asm/mach-common/bits/uart.h
 
+#define BUG() while (1) { asm volatile(emuexcpt;); }
+
 #include serial.h
 
 __attribute__((always_inline))
diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 1124ffd..030160f 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -63,7 +63,7 @@ static size_t cache_count;
 static uint16_t uart_lsr_save;
 static uint16_t uart_lsr_read(uint32_t uart_base)
 {
-   uint16_t lsr = bfin_read16(pUART-lsr);
+   uint16_t lsr = bfin_read(pUART-lsr);
uart_lsr_save |= (lsr  (OE|PE|FE|BI));
return lsr | uart_lsr_save;
 }
@@ -71,7 +71,7 @@ static uint16_t uart_lsr_read(uint32_t uart_base)
 static void uart_lsr_clear(uint32_t uart_base)
 {
uart_lsr_save = 0;
-   bfin_write16(pUART-lsr, bfin_read16(pUART-lsr) | -1);
+   bfin_write(pUART-lsr, bfin_read(pUART-lsr) | -1);
 }
 #else
 /* When debugging is disabled, we only care about the DR bit, so if other
@@ -80,11 +80,11 @@ static void uart_lsr_clear(uint32_t uart_base)
  */
 static inline uint16_t uart_lsr_read(uint32_t uart_base)
 {
-   return bfin_read16(pUART-lsr);
+   return bfin_read(pUART-lsr);
 }
 static void uart_lsr_clear(uint32_t uart_base)
 {
-   bfin_write16(pUART-lsr, bfin_read16(pUART-lsr) | -1);
+   bfin_write(pUART-lsr, bfin_read(pUART-lsr) | -1);
 }
 #endif
 
@@ -101,7 +101,7 @@ static void uart_putc(uint32_t uart_base, const char c)
continue;
 
/* queue the character for transmission */
-   bfin_write16(pUART-thr, c);
+   bfin_write(pUART-thr, c);
SSYNC();
 
WATCHDOG_RESET();
@@ -122,7 +122,7 @@ static int uart_getc(uint32_t uart_base)
continue;
 
/* grab the new byte */
-   uart_rbr_val = bfin_read16(pUART-rbr);
+   uart_rbr_val = bfin_read(pUART-rbr);
 
 #ifdef CONFIG_DEBUG_SERIAL
/* grab  clear the LSR */
@@ -136,8 +136,8 @@ static int uart_getc(uint32_t uart_base)
uint16_t dll, dlh;
printf(\n[SERIAL ERROR]\n);
ACCESS_LATCH();
-   dll = bfin_read16(pUART-dll);
-   dlh = bfin_read16(pUART-dlh);
+   dll = bfin_read(pUART-dll);
+   dlh = bfin_read(pUART-dlh);
ACCESS_PORT_IER();
printf(\tDLL=0x%x DLH=0x%x\n, dll, dlh);
do {
diff --git a/arch/blackfin/cpu/serial.h b/arch/blackfin/cpu/serial.h
index aa5c217..f649e40 100644
--- a/arch/blackfin/cpu/serial.h
+++ b/arch/blackfin/cpu/serial.h
@@ -101,9 +101,9 @@ struct bfin_mmr_serial {
 # define ACCESS_PORT_IER()
 #else
 # define ACCESS_LATCH() \
-   bfin_write16(pUART-lcr, bfin_read16(pUART-lcr) | DLAB)
+   bfin_write(pUART-lcr, bfin_read(pUART-lcr) | DLAB)
 # define ACCESS_PORT_IER() \
-   bfin_write16(pUART-lcr, bfin_read16(pUART-lcr)  ~DLAB)
+   bfin_write(pUART-lcr, bfin_read(pUART-lcr)  ~DLAB)
 #endif
 
 __attribute__((always_inline))
@@ -173,10 +173,10 @@ __attribute__((always_inline))
 static inline int uart_init(uint32_t uart_base)
 {
/* always enable UART -- avoids anomalies 05000309 and 05000350 */
-   bfin_write16(pUART-gctl, UCEN);
+   bfin_write(pUART-gctl, UCEN);
 
/* Set LCR to Word Lengh 8-bit word select */
-   bfin_write16(pUART-lcr, WLS_8);
+   bfin_write(pUART-lcr, WLS_8);
 
SSYNC();
 
@@ -196,7 +196,7 @@ __attribute__((always_inline))
 static inline int serial_early_uninit(uint32_t uart_base)
 {
/* disable the UART by clearing UCEN */
-   bfin_write16(pUART-gctl, 0);
+   bfin_write(pUART-gctl, 0);
 
return 0;
 }
@@ -209,8 +209,8 @@ static inline void serial_early_put_div(uint32_t uart_base, 
uint16_t divisor)
SSYNC();
 
/* Program the divisor to get the baud rate we want */
-   bfin_write16(pUART-dll, LOB(divisor));
-   bfin_write16(pUART-dlh, HIB(divisor));
+   bfin_write(pUART-dll, LOB(divisor));
+   bfin_write(pUART-dlh, HIB(divisor));
SSYNC();
 
/* Clear DLAB in LCR to Access THR RBR IER */
@@ -227,8 +227,8 @@ static inline uint16_t serial_early_get_div(void)
ACCESS_LATCH();
SSYNC();
 
-   uint8_t dll = bfin_read16(pUART-dll);
-   uint8_t dlh = bfin_read16(pUART-dlh);
+   uint8_t dll = bfin_read(pUART-dll);
+   uint8_t dlh = 

[U-Boot] [PATCH 18/18] Blackfin: adi boards: also set stderr to nc with helper

2011-06-28 Thread Mike Frysinger
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 include/configs/bfin_adi_common.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 80f8a14..57d9b97 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -204,7 +204,8 @@
nc= \
set ncip ${serverip}; \
set stdin nc; \
-   set stdout nc \
+   set stdout nc; \
+   set stderr nc \
\0
 # else
 #  define NETCONSOLE_ENV
-- 
1.7.5.3

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


[U-Boot] [PATCH 17/18] Blackfin: update anomaly lists to latest public info

2011-06-28 Thread Mike Frysinger
Signed-off-by: Mike Frysinger vap...@gentoo.org
---
 arch/blackfin/include/asm/mach-bf506/anomaly.h |   25 +++-
 arch/blackfin/include/asm/mach-bf518/anomaly.h |   28 ++-
 arch/blackfin/include/asm/mach-bf527/anomaly.h |   38 +++--
 arch/blackfin/include/asm/mach-bf533/anomaly.h |   23 ++-
 arch/blackfin/include/asm/mach-bf537/anomaly.h |   37 +++--
 arch/blackfin/include/asm/mach-bf538/anomaly.h |   42 +++--
 arch/blackfin/include/asm/mach-bf548/anomaly.h |  227 +---
 arch/blackfin/include/asm/mach-bf561/anomaly.h |  136 ---
 8 files changed, 335 insertions(+), 221 deletions(-)

diff --git a/arch/blackfin/include/asm/mach-bf506/anomaly.h 
b/arch/blackfin/include/asm/mach-bf506/anomaly.h
index e767233..5b3227a 100644
--- a/arch/blackfin/include/asm/mach-bf506/anomaly.h
+++ b/arch/blackfin/include/asm/mach-bf506/anomaly.h
@@ -5,12 +5,13 @@
  * and can be replaced with that version at any time
  * DO NOT EDIT THIS FILE
  *
- * Copyright 2004-2010 Analog Devices Inc.
+ * Copyright 2004-2011 Analog Devices Inc.
  * Licensed under the ADI BSD license.
  *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
  */
 
 /* This file should be up to date with:
+ *  - Revision A, 02/18/2011; ADSP-BF504/BF504F/BF506F Blackfin Processor 
Anomaly List
  */
 
 #if __SILICON_REVISION__  0
@@ -36,8 +37,6 @@
 #define ANOMALY_05000310 (1)
 /* PPI Underflow Error Goes Undetected in ITU-R 656 Mode */
 #define ANOMALY_05000366 (1)
-/* Speculative Fetches Can Cause Undesired External FIFO Operations */
-#define ANOMALY_05000416 (1)
 /* Speculative Fetches of Indirect-Pointer Instructions Can Cause False 
Hardware Errors */
 #define ANOMALY_05000426 (1)
 /* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
@@ -52,12 +51,28 @@
 #define ANOMALY_05000472 (1)
 /* Interrupted SPORT Receive Data Register Read Results In Underflow when SLEN 
 15 */
 #define ANOMALY_05000473 (1)
+/* SPORT0 Data Transmit Error in Multi-Channel Mode with Internal Clock */
+#define ANOMALY_05000476 (1)
 /* TESTSET Instruction Cannot Be Interrupted */
 #define ANOMALY_05000477 (1)
+/* Disabling ACM During an Ongoing Transfer Can Lead to Undefined ACM Behavior 
*/
+#define ANOMALY_05000478 (1)
 /* Reads of ITEST_COMMAND and ITEST_DATA Registers Cause Cache Corruption */
 #define ANOMALY_05000481 (1)
-/* IFLUSH sucks at life */
+/* TWI Vbus Minimum Specification Can Be Violated under Certain Conditions */
+#define ANOMALY_05000486 (1)
+/* SPI Master Boot Can Fail Under Certain Conditions */
+#define ANOMALY_05000490 (1)
+/* Instruction Memory Stalls Can Cause IFLUSH to Fail */
 #define ANOMALY_05000491 (1)
+/* EXCPT Instruction May Be Lost If NMI Happens Simultaneously */
+#define ANOMALY_05000494 (1)
+/* Maximum Idd-deepsleep Specifications Can Be Exceeded under Certain 
Conditions */
+#define ANOMALY_05000495 (1)
+/* CNT_COMMAND Functionality Depends on CNT_IMASK Configuration */
+#define ANOMALY_05000498 (1)
+/* RXS Bit in SPI_STAT May Become Stuck In RX DMA Modes */
+#define ANOMALY_05000501 (1)
 
 /* Anomalies that don't exist on this proc */
 #define ANOMALY_0599 (0)
@@ -109,6 +124,7 @@
 #define ANOMALY_05000364 (0)
 #define ANOMALY_05000371 (0)
 #define ANOMALY_05000380 (0)
+#define ANOMALY_05000383 (0)
 #define ANOMALY_05000386 (0)
 #define ANOMALY_05000389 (0)
 #define ANOMALY_05000400 (0)
@@ -123,6 +139,7 @@
 #define ANOMALY_05000467 (0)
 #define ANOMALY_05000474 (0)
 #define ANOMALY_05000475 (0)
+#define ANOMALY_05000480 (0)
 #define ANOMALY_05000485 (0)
 
 #endif
diff --git a/arch/blackfin/include/asm/mach-bf518/anomaly.h 
b/arch/blackfin/include/asm/mach-bf518/anomaly.h
index 24918c5..56383f7 100644
--- a/arch/blackfin/include/asm/mach-bf518/anomaly.h
+++ b/arch/blackfin/include/asm/mach-bf518/anomaly.h
@@ -5,16 +5,15 @@
  * and can be replaced with that version at any time
  * DO NOT EDIT THIS FILE
  *
- * Copyright 2004-2010 Analog Devices Inc.
+ * Copyright 2004-2011 Analog Devices Inc.
  * Licensed under the ADI BSD license.
  *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
  */
 
 /* This file should be up to date with:
- *  - Revision E, 01/26/2010; ADSP-BF512/BF514/BF516/BF518 Blackfin Processor 
Anomaly List
+ *  - Revision F, 05/23/2011; ADSP-BF512/BF514/BF516/BF518 Blackfin Processor 
Anomaly List
  */
 
-/* We plan on not supporting 0.0 silicon, but 0.1 isn't out yet - sorry */
 #if __SILICON_REVISION__  0
 # error will not work on BF518 silicon version
 #endif
@@ -77,19 +76,29 @@
 /* False Hardware Error when RETI Points to Invalid Memory */
 #define ANOMALY_05000461 (1)
 /* Synchronization Problem at Startup May Cause SPORT Transmit Channels to 
Misalign */
-#define ANOMALY_05000462 (1)
-/* PLL Latches Incorrect Settings During Reset */
-#define ANOMALY_05000469 (1)
+#define ANOMALY_05000462 (__SILICON_REVISION__  2)
 /* Incorrect Default MSEL Value in PLL_CTL */
-#define ANOMALY_05000472 (1)
+#define ANOMALY_05000472 (__SILICON_REVISION__  2)
 /* Interrupted SPORT 

Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Albert ARIBAUD
Hi Igor,

Le 28/06/2011 12:20, Igor Grinberg a écrit :
 On 06/28/11 12:52, Igor Grinberg wrote:

 Hi Albert,



 On 06/28/11 08:39, Albert ARIBAUD wrote:

 Hi Wolfgang,

 The following changes since commit 9623c158f6a5150a21c25026bfba79e7ff7912f5:

 Merge branch 'master' of git://git.denx.de/u-boot-arm (2011-06-23
 15:37:33 +0200)

 are available in the git repository at:

 git://git.denx.de/u-boot-arm.git master

 Aneesh V (9):
 arm: make default implementation of cache_flush() weakly linked
 armv7: cache maintenance operations for armv7
 armv7: rename cache related CONFIG flags
 armv7: integrate cache maintenance support
 arm: minor fixes for cache and mmu handling
 armv7: add PL310 support to u-boot
 armv7: adapt omap4 to the new cache maintenance framework
 armv7: adapt omap3 to the new cache maintenance framework
 armv7: adapt s5pc1xx to the new cache maintenance framework
 Can these two also be added for 2011.06:

 OMAP[34]: fix broken timer:
 http://patchwork.ozlabs.org/patch/76803/

 arm: omap2: apollon: fix broken build:
 http://patchwork.ozlabs.org/patch/101877/

 ?

 Errr, I've just seen 2011.06 already released a couple of hours ago...
 I guess it is too late now...

 Still, I would be glad if those get into this merge window...

Of course I'll add them into u-boot-arm/master along with the current 
content of my 'next' branch.

 Thanks anyway

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


Re: [U-Boot] [PATCH v1 (WIP) 12/16] [Timer]Replace get_timer() usage in drivers/

2011-06-28 Thread Graeme Russ
Hi Vitaly,

On Tue, Jun 28, 2011 at 10:36 PM, Vitaly Kuzmichev
vkuzmic...@mvista.com wrote:
 Hello Graeme,

 Graeme Russ wrote:
 [...]
 diff --git a/drivers/fpga/spartan3.c b/drivers/fpga/spartan3.c
 index 1dd6f26..8282a23 100644
 --- a/drivers/fpga/spartan3.c
 +++ b/drivers/fpga/spartan3.c
 [...]
 @@ -233,7 +235,7 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void 
 *buf, size_t bsize)
  #endif

               /* now check for done signal */
 -             ts = get_timer (0);             /* get current time */
 +             ts = time_since_ms();           /* get current time */

 Shouldn't time_now_ms() be here?

Yes, it should be - Thanks

Regards,

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


[U-Boot] Pull request u-boot-blackfin.git

2011-06-28 Thread Mike Frysinger
The following changes since commit b1af6f532e0d348b153d5c148369229d24af361a:

  Prepare v2011.06 (2011-06-27 22:22:42 +0200)

are available in the git repository at:
  git://www.denx.de/git/u-boot-blackfin.git master

Harald Krapfenbauer (2):
  Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update network settings
  Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: enable mmc_spi support

Mike Frysinger (16):
  Blackfin: uart: move debug buffers into local bss
  Blackfin: uart: add multiple serial support
  Blackfin: adi boards: enable multi serial support by default
  Blackfin: dont reset SWRST on newer bf526 parts
  Blackfin: add init.elf helper code
  Blackfin: uart: fix printf warning
  Blackfin: post: setup default CONFIG_SYS_POST_WORD_ADDR
  Blackfin: gpio: optimize free path a little
  Blackfin: sync MMR read/write helpers with Linux
  Blackfin: portmux: allow header to be included in assembly files
  Blackfin: drop unused dma.h header from start code
  Blackfin: adi boards: enable pretty flash progress output
  Blackfin: split out async setup
  Blackfin: serial: convert to bfin_{read,write} helpers
  Blackfin: update anomaly lists to latest public info
  Blackfin: adi boards: also set stderr to nc with helper

 Makefile   |3 +-
 arch/blackfin/cpu/.gitignore   |3 +
 arch/blackfin/cpu/Makefile |7 +-
 arch/blackfin/cpu/cpu.c|   16 +-
 arch/blackfin/cpu/gpio.c   |2 +
 arch/blackfin/cpu/init.S   |9 +
 arch/blackfin/cpu/init.lds.S   |   25 +++
 arch/blackfin/cpu/initcode.c   |   61 ++-
 arch/blackfin/cpu/initcode.h   |   71 +++
 arch/blackfin/cpu/reset.c  |4 +-
 arch/blackfin/cpu/serial.c |  234 ++--
 arch/blackfin/cpu/serial.h |   60 --
 arch/blackfin/cpu/start.S  |1 -
 arch/blackfin/include/asm/blackfin_local.h |   88 +-
 arch/blackfin/include/asm/config.h |3 +
 arch/blackfin/include/asm/gpio.h   |3 +-
 arch/blackfin/include/asm/mach-bf506/anomaly.h |   25 ++-
 arch/blackfin/include/asm/mach-bf518/anomaly.h |   28 ++-
 arch/blackfin/include/asm/mach-bf527/anomaly.h |   38 +++--
 arch/blackfin/include/asm/mach-bf533/anomaly.h |   23 ++-
 arch/blackfin/include/asm/mach-bf537/anomaly.h |   37 +++--
 arch/blackfin/include/asm/mach-bf538/anomaly.h |   42 +++--
 arch/blackfin/include/asm/mach-bf548/anomaly.h |  227 +--
 arch/blackfin/include/asm/mach-bf561/anomaly.h |  136 --
 arch/blackfin/include/asm/portmux.h|4 +
 arch/blackfin/lib/board.c  |4 +
 board/cm-bf537e/cm-bf537e.c|   34 +++--
 board/cm-bf537u/cm-bf537u.c|   39 ++--
 board/tcm-bf537/tcm-bf537.c|   34 +++--
 common/serial.c|3 +
 include/configs/bf537-stamp.h  |1 -
 include/configs/bfin_adi_common.h  |   12 +-
 include/configs/cm-bf537e.h|   20 ++-
 include/configs/cm-bf537u.h|   24 ++-
 include/configs/tcm-bf537.h|   20 ++-
 include/serial.h   |9 +
 36 files changed, 896 insertions(+), 454 deletions(-)
 create mode 100644 arch/blackfin/cpu/init.S
 create mode 100644 arch/blackfin/cpu/init.lds.S
 create mode 100644 arch/blackfin/cpu/initcode.h
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] MMC: add sdhci generic framework

2011-06-28 Thread Lei Wen
Hi All,

Any comment to this patch set, could it be merged in this open window?

Thanks,
Lei

On Thu, Jun 16, 2011 at 11:17 PM, Lei Wen lei...@marvell.com wrote:
 Nowdays, there are plenty of mmc driver in uboot adopt the sd standard
 host design, aka as sdhci. It is better to centralize the common logic
 together to better maintenance.

 Signed-off-by: Lei Wen lei...@marvell.com
 ---
  drivers/mmc/Makefile |    1 +
  drivers/mmc/sdhci.c  |  433 
 ++
  include/sdhci.h      |  325 +
  3 files changed, 759 insertions(+), 0 deletions(-)
  create mode 100644 drivers/mmc/sdhci.c
  create mode 100644 include/sdhci.h

 diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
 index a8fe17a..50b5117 100644
 --- a/drivers/mmc/Makefile
 +++ b/drivers/mmc/Makefile
 @@ -38,6 +38,7 @@ COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
  COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
  COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o
  COBJS-$(CONFIG_S5P_MMC) += s5p_mmc.o
 +COBJS-$(CONFIG_SDHCI) += sdhci.o

  COBJS  := $(COBJS-y)
  SRCS   := $(COBJS:.o=.c)
 diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
 new file mode 100644
 index 000..9ebd33d
 --- /dev/null
 +++ b/drivers/mmc/sdhci.c
 @@ -0,0 +1,433 @@
 +/*
 + * Copyright 2011, Marvell Semiconductor Inc.
 + * Lei Wen lei...@marvell.com
 + *
 + * 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
 + *
 + * Back ported to the 8xx platform (from the 8260 platform) by
 + * murray.jen...@cmst.csiro.au, 27-Jan-01.
 + */
 +
 +#include common.h
 +#include malloc.h
 +#include mmc.h
 +#include sdhci.h
 +
 +void *aligned_buffer;
 +
 +static void sdhci_reset(struct sdhci_host *host, u8 mask)
 +{
 +       unsigned long timeout;
 +
 +       /* Wait max 100 ms */
 +       timeout = 100;
 +       sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
 +       while (sdhci_readb(host, SDHCI_SOFTWARE_RESET)  mask) {
 +               if (timeout == 0) {
 +                       printf(Reset 0x%x never completed.\n, (int)mask);
 +                       return;
 +               }
 +               timeout--;
 +               udelay(1000);
 +       }
 +}
 +
 +static void sdhci_cmd_done(struct sdhci_host *host, struct mmc_cmd *cmd)
 +{
 +       int i;
 +       if (cmd-resp_type  MMC_RSP_136) {
 +               /* CRC is stripped so we need to do some shifting. */
 +               for (i = 0; i  4; i++) {
 +                       cmd-response[i] = sdhci_readl(host,
 +                                       SDHCI_RESPONSE + (3-i)*4)  8;
 +                       if (i != 3)
 +                               cmd-response[i] |= sdhci_readb(host,
 +                                               SDHCI_RESPONSE + (3-i)*4-1);
 +               }
 +       } else {
 +               cmd-response[0] = sdhci_readl(host, SDHCI_RESPONSE);
 +       }
 +}
 +
 +static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data 
 *data)
 +{
 +       int i;
 +       char *offs;
 +       for (i = 0; i  data-blocksize; i += 4) {
 +               offs = data-dest + i;
 +               if (data-flags == MMC_DATA_READ)
 +                       *(u32 *)offs = sdhci_readl(host, SDHCI_BUFFER);
 +               else
 +                       sdhci_writel(host, *(u32 *)offs, SDHCI_BUFFER);
 +       }
 +}
 +
 +static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data 
 *data,
 +                               unsigned int start_addr)
 +{
 +       unsigned int stat, rdy, mask, block = 0;
 +
 +       rdy = SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_AVAIL;
 +       mask = SDHCI_DATA_AVAILABLE | SDHCI_SPACE_AVAILABLE;
 +       do {
 +               stat = sdhci_readl(host, SDHCI_INT_STATUS);
 +               if (stat  SDHCI_INT_ERROR) {
 +                       printf(Error detected in status(0x%X)!\n, stat);
 +                       return -1;
 +               }
 +               if (stat  rdy) {
 +                       if (!(sdhci_readl(host, SDHCI_PRESENT_STATE)  mask))
 +                               continue;
 +                       sdhci_writel(host, rdy, SDHCI_INT_STATUS);
 +                       sdhci_transfer_pio(host, data);
 +                       data-dest += data-blocksize;
 +       

Re: [U-Boot] [PATCH v1 (WIP) 08/16] [Timer]Create new userland timer API

2011-06-28 Thread Simon Glass
Hi Graeme,

What a mammoth effort and what a fantastic clean up.

I'm a bit unsure of this patch which seems to have two prototypes for
the since functions:

On Tue, Jun 28, 2011 at 4:41 AM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  include/common.h |   36 
  lib/time.c       |   26 ++
  2 files changed, 46 insertions(+), 16 deletions(-)

 diff --git a/include/common.h b/include/common.h
 index 340e585..9735d47 100644
 --- a/include/common.h
 +++ b/include/common.h
 @@ -584,11 +584,29 @@ void      timer_interrupt    (struct pt_regs *);
  void   external_interrupt (struct pt_regs *);
  void   irq_install_handler(int, interrupt_handler_t *, void *);
  void   irq_free_handler   (int);
 -void   reset_timer        (void);
 -ulong  get_timer          (ulong base);
  void   enable_interrupts  (void);
  int    disable_interrupts (void);

 +/*
 + * Timer API
 + */
 +void reset_timer (void);
 +ulong get_timer (ulong base);
 +u64 get_ticks(void);
 +void wait_ticks(unsigned long);
 +void __udelay(unsigned long);
 +ulong usec2ticks(unsigned long usec);
 +ulong ticks2usec(unsigned long ticks);
 +int init_timebase(void);
 +
 +/* lib/time.c */
 +void udelay(unsigned long);
 +
 +u32 time_now_ms(void);
 +u32 time_since_ms(u32 from, u32 to);
 +u32 time_max_since_ms(u32 from, u32 to);

Here they have two parameters

 +u32 time_resolution_ms(void);
 +
  /* $(CPU)/.../commproc.c */
  int    dpram_init (void);
  uint   dpram_base(void);
 @@ -616,17 +634,6 @@ void       flush_cache   (unsigned long, unsigned long);
  void   flush_dcache_range(unsigned long start, unsigned long stop);
  void   invalidate_dcache_range(unsigned long start, unsigned long stop);

 -
 -/* arch/$(ARCH)/lib/ticks.S */
 -unsigned long long get_ticks(void);
 -void   wait_ticks    (unsigned long);
 -
 -/* arch/$(ARCH)/lib/time.c */
 -void   __udelay      (unsigned long);
 -ulong  usec2ticks    (unsigned long usec);
 -ulong  ticks2usec    (unsigned long ticks);
 -int    init_timebase (void);
 -
  /* lib/gunzip.c */
  int gunzip(void *, int, unsigned char *, unsigned long *);
  int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
 @@ -644,9 +651,6 @@ void qsort(void *base, size_t nmemb, size_t size,
           int(*compar)(const void *, const void *));
  int strcmp_compar(const void *, const void *);

 -/* lib/time.c */
 -void   udelay        (unsigned long);
 -
  /* lib/vsprintf.c */
  ulong  simple_strtoul(const char *cp,char **endp,unsigned int base);
  int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
 diff --git a/lib/time.c b/lib/time.c
 index a309c26..1563507 100644
 --- a/lib/time.c
 +++ b/lib/time.c
 @@ -41,3 +41,29 @@ void udelay(unsigned long usec)
                usec -= kv;
        } while(usec);
  }
 +
 +u32 time_since_ms(u32 from)

and here only one (which is what I expect).

Can you please explain what I am missing?

Thanks,
Simon

 +{
 +       u32 delta = time_now_ms() - from;
 +
 +       /* round down */
 +       if (delta  time_ms_resolution())
 +               return 0;
 +
 +       return delta - time_resolution_ms();
 +}
 +
 +u32 time_max_since_ms(u32 from)
 +{
 +       u32 delta = time_now_ms() - from;
 +
 +       return delta + time_resolution_ms();
 +}
 +
 +__attribute__((weak))
 +u32 time_resolution_ms(void) {return 1;}
 +
 +u32 time_now_ms(void)
 +{
 +       return get_timer(0);
 +}
 --
 1.7.5.2.317.g391b14

 ___
 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 v1 (WIP) 08/16] [Timer]Create new userland timer API

2011-06-28 Thread Graeme Russ
Hi Simon,

On Wed, Jun 29, 2011 at 2:31 PM, Simon Glass s...@chromium.org wrote:
 Hi Graeme,

 What a mammoth effort and what a fantastic clean up.

 I'm a bit unsure of this patch which seems to have two prototypes for
 the since functions:


[snip]

 +u32 time_now_ms(void);
 +u32 time_since_ms(u32 from, u32 to);
 +u32 time_max_since_ms(u32 from, u32 to);

 Here they have two parameters


[snip]

 +
 +u32 time_since_ms(u32 from)

 and here only one (which is what I expect).

 Can you please explain what I am missing?

The fact I haven't tried to build it yet ;)

I'll add that to the list of fixes for v2 - Thanks

Regards,

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


Re: [U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/

2011-06-28 Thread Simon Glass
Hi Graeme,

On Tue, Jun 28, 2011 at 4:41 AM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  drivers/block/mg_disk.c |    9 -
  1 files changed, 4 insertions(+), 5 deletions(-)

 diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
 index 2198017..c8cc195 100644
 --- a/drivers/block/mg_disk.c
 +++ b/drivers/block/mg_disk.c
 @@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int 
 stat, unsigned err)
  static unsigned int mg_wait (u32 expect, u32 msec)
  {
        u8 status;
 -       u32 from, cur, err;
 +       u32 ts, err;

        err = MG_ERR_NONE;
  #ifdef CONFIG_NIOS2
        reset_timer();
  #endif
 -       from = get_timer(0);
 +       ts = time_now_ms();

        status = readb(mg_base() + MG_REG_STATUS);
        do {
 -               cur = get_timer(from);
...
 -       } while (cur  msec);
 +       } while (time_since_ms(ts)  msec);


Well I know i have asked this before, but I feel I should ask again
because I didn't like the answer much.

Imagine we change this code to:

ts = time_now_ms() + msec
do {
...
} while (time_since_ms(ts)  0);

That should be legal, right? But I don't think this can work since the
'since' functions return an unsigned.

[aside: this provides for another idiom that I think we talked about:

ts = time_future_ms(msec)
do {
...
} while (!time_passed(ts))

which I am not at all suggesting should be in the API :-)
end aside]

Regards.
Simon


 -       if (cur = msec)
 +       if (time_since_ms(ts) = msec)
                err = MG_ERR_TIMEOUT;

        return err;
 --
 1.7.5.2.317.g391b14

 ___
 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 v1 (WIP) 16/16] [Timer]Replace get_timer() usage in arch/

2011-06-28 Thread Simon Glass
Hi Graeme,

On Tue, Jun 28, 2011 at 4:41 AM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/blackfin/cpu/jtag-console.c           |    4 ++--
  arch/microblaze/lib/time.c                 |    4 ++--
  arch/nios2/cpu/epcs.c                      |   12 ++--
  arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c |    8 
  arch/powerpc/cpu/mpc8260/ether_fcc.c       |   12 ++--
  5 files changed, 20 insertions(+), 20 deletions(-)

 diff --git a/arch/blackfin/cpu/jtag-console.c 
 b/arch/blackfin/cpu/jtag-console.c
 index e0f2975..97ff1de 100644
 --- a/arch/blackfin/cpu/jtag-console.c
 +++ b/arch/blackfin/cpu/jtag-console.c
 @@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void)
  static bool jtag_write_emudat(uint32_t emudat)
  {
        static bool overflowed = false;
 -       ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT;
 +       ulong start = time_now_ms();
        while (bfin_read_DBGSTAT()  0x1) {
                if (overflowed)
                        return overflowed;
 -               if (timeout  get_timer(0))
 +               if (time_since_ms(start) = CONFIG_JTAG_CONSOLE_TIMEOUT)
                        overflowed = true;
        }
        overflowed = false;

Here I think I have found a use of future time. It is true what they
say (or should say) that there is every kind of timeout in U-Boot.

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


Re: [U-Boot] [PATCH v1 (WIP) 08/16] [Timer]Create new userland timer API

2011-06-28 Thread Simon Glass
Hi Graeme,

On Tue, Jun 28, 2011 at 9:36 PM, Graeme Russ graeme.r...@gmail.com wrote:
 Hi Simon,
 Can you please explain what I am missing?

 The fact I haven't tried to build it yet ;)

Oh, OK. That explains the mystery :-) I haven't built it yet either
but it certainly looks good.

Regards,
Simon


 I'll add that to the list of fixes for v2 - Thanks

 Regards,

 Graeme

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


Re: [U-Boot] [PATCH v1 (WIP) 16/16] [Timer]Replace get_timer() usage in arch/

2011-06-28 Thread Graeme Russ
Hi Simon,

On Wed, Jun 29, 2011 at 2:45 PM, Simon Glass s...@chromium.org wrote:
 Hi Graeme,

 On Tue, Jun 28, 2011 at 4:41 AM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/blackfin/cpu/jtag-console.c           |    4 ++--
  arch/microblaze/lib/time.c                 |    4 ++--
  arch/nios2/cpu/epcs.c                      |   12 ++--
  arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c |    8 
  arch/powerpc/cpu/mpc8260/ether_fcc.c       |   12 ++--
  5 files changed, 20 insertions(+), 20 deletions(-)

 diff --git a/arch/blackfin/cpu/jtag-console.c 
 b/arch/blackfin/cpu/jtag-console.c
 index e0f2975..97ff1de 100644
 --- a/arch/blackfin/cpu/jtag-console.c
 +++ b/arch/blackfin/cpu/jtag-console.c
 @@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void)
  static bool jtag_write_emudat(uint32_t emudat)
  {
        static bool overflowed = false;
 -       ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT;
 +       ulong start = time_now_ms();
        while (bfin_read_DBGSTAT()  0x1) {
                if (overflowed)
                        return overflowed;
 -               if (timeout  get_timer(0))
 +               if (time_since_ms(start) = CONFIG_JTAG_CONSOLE_TIMEOUT)
                        overflowed = true;
        }
        overflowed = false;

 Here I think I have found a use of future time. It is true what they
 say (or should say) that there is every kind of timeout in U-Boot.

I personally think that this particular use-case of the timer API is ugly,
but I was not out to change any symantics, just do a blind translation
from the old API to the new API

Hopefully, this will highlight a few dodgy use cases (which I am willing
to apply fixes for as and when others suggest them)

Regards,

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


Re: [U-Boot] [PATCH v1 (WIP) 00/16] [Timer]API Rewrite

2011-06-28 Thread Graeme Russ
Hi All,

[snip]


 Graeme Russ (16):
  [Timer]Fix misuse of ARM *timer_masked() functions outside arch/arm
  [Timer]Remove calls to set_timer outside arch/
  [Timer]Remove calls to set_timer in arch/
  [Timer]Allow reset_timer() only for Nios2
  [Timer]Remove reset_timer() for non-Nios2 arches
  [Timer]Fix at91rm9200/spi.c timer usage
  [Timer]Remove reset_timer_masked()
  [Timer]Create new userland timer API
  [Timer]Replace get_timer() usage in drivers/block/
  [Timer]Replace get_timer() usage in driver/mtd and driver/block
  [Timer]Remove reset_timer() completely
  [Timer]Replace get_timer() usage in drivers/
  [Timer]Replace get_timer() usage in net/
  [Timer]Replace get_timer() usage in common/
  [Timer]Replace get_timer() usage in board/
  [Timer]Replace get_timer() usage in arch/


Patch 15 ([Timer]Replace get_timer() usage in board/) didn't make it
through (too big) - I'll have to split it up (rather that that putting a
lone patch on the wiki)

Regards,

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


Re: [U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/

2011-06-28 Thread Reinhard Meyer
Dear All,
 Well I know i have asked this before, but I feel I should ask again
 because I didn't like the answer much.

 Imagine we change this code to:

 ts = time_now_ms() + msec
 do {
 ...
 } while (time_since_ms(ts)  0);

 That should be legal, right? But I don't think this can work since the
 'since' functions return an unsigned.

 [aside: this provides for another idiom that I think we talked about:

 ts = time_future_ms(msec)
 do {
 ...
 } while (!time_passed(ts))

 which I am not at all suggesting should be in the API :-)
 end aside]

I still vouch for this concept, which is simple, clean, and easy to understand.

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


Re: [U-Boot] [PATCH v1 (WIP) 00/16] [Timer]API Rewrite

2011-06-28 Thread Mike Frysinger
for future reference, could we use the foo:  style in subjects instead of 
[foo].  git likes to eat [...] automatically and i find it hard to quickly 
parse.  it's an abomination on my eyes.

-[PATCH v1 (WIP) 00/16] [Timer]API Rewrite
+[PATCH/WIP 00/16] timer: API Rewrite
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >