[U-Boot] [PATCH 0/2] Loader script updates for OpenRISC

2013-05-01 Thread Stefan Kristiansson
This set of patches does:

Fix a bug in the openrisc-generic u-boot.lds linker script
that would cause an error due to that no memory region was
specified for u_boot_lists.

And then move the above mentioned file into arch/openrisc/cpu/
to unify the linker script for all openrisc boards (we only have
one board).

Stefan Kristiansson (2):
  openrisc: specify a memory region for u_boot_lists
  openrisc: move board linker script(s) to a common in cpu/

 arch/openrisc/config.mk   | 2 ++
 {board/openrisc/openrisc-generic = arch/openrisc/cpu}/u-boot.lds | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
 rename {board/openrisc/openrisc-generic = arch/openrisc/cpu}/u-boot.lds (98%)

-- 
1.8.1.2

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


[U-Boot] [PATCH 1/2] openrisc: specify a memory region for u_boot_lists

2013-05-01 Thread Stefan Kristiansson
Since there are two memory areas defined, vectors and ram,
the linker will error when neither of them are specified for a
section.

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 board/openrisc/openrisc-generic/u-boot.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/openrisc/openrisc-generic/u-boot.lds 
b/board/openrisc/openrisc-generic/u-boot.lds
index 9024f30..d9bb7b7 100644
--- a/board/openrisc/openrisc-generic/u-boot.lds
+++ b/board/openrisc/openrisc-generic/u-boot.lds
@@ -30,7 +30,7 @@ SECTIONS
 . = ALIGN(4);
 .u_boot_list : {
KEEP(*(SORT(.u_boot_list*)));
-}
+}  ram
 
.rodata : {
*(.rodata);
-- 
1.8.1.2

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


[U-Boot] [PATCH 2/2] openrisc: move board linker script(s) to a common in cpu/

2013-05-01 Thread Stefan Kristiansson
Unifies the openrisc boards linker scripts into a common one.

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/config.mk   | 2 ++
 {board/openrisc/openrisc-generic = arch/openrisc/cpu}/u-boot.lds | 0
 2 files changed, 2 insertions(+)
 rename {board/openrisc/openrisc-generic = arch/openrisc/cpu}/u-boot.lds (100%)

diff --git a/arch/openrisc/config.mk b/arch/openrisc/config.mk
index 521e73a..01c0f77 100644
--- a/arch/openrisc/config.mk
+++ b/arch/openrisc/config.mk
@@ -25,3 +25,5 @@ CROSS_COMPILE ?= or32-elf-
 PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x4
+
+LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
diff --git a/board/openrisc/openrisc-generic/u-boot.lds 
b/arch/openrisc/cpu/u-boot.lds
similarity index 100%
rename from board/openrisc/openrisc-generic/u-boot.lds
rename to arch/openrisc/cpu/u-boot.lds
-- 
1.8.1.2

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


Re: [U-Boot] Custodians, Maintainers and old platforms

2012-09-29 Thread Stefan Kristiansson
On Fri, Sep 21, 2012 at 05:28:18PM -0700, Tom Rini wrote:
 Hey all,
 
 (I had attempted to bcc this to all listed maintainer, but that upset
 Google greatly.  I'll send this out manually instead later).
 
 I'd like to put this out here for custodians and maintainers to
 consider, especially in light of the device model work that's not just
 coming but has already started being posted.
 
 One of the keys to the success of U-Boot has been the number of
 platforms that are supported.  But part of supporting platforms is
 needing people to volunteer to maintain them long term and help with
 testing changes and so forth.  So first of all, I've just tagged
 v2012.10-rc1.  Please give this at least a basic test on whatever
 platforms you're able to.
 
 Second, with this, my next branch is now open and I'd like to start it
 by asking that platforms that people wish to abandon be removed.  With
 the device model, lots of code will need adjusting and while it's
 mechanical in ways, it still needs to be run-time tested.  And it's
 changes that someone must do.  I know others have suggested adding or
 better publicizing our to-remove file.  But one of the advantages of git
 is that it's easy to bring platforms back, should someone later wish to
 bring it back.  But this also requires the removal to be done cleanly.
 
 All of that said, I would like to stress that if you maintain a platform
 and you wish to help with the testing and perhaps even the conversion
 effort, no matter the age of the platform it would be welcome and
 appreciated.
 
 And finally, if everyone really wants to go another direction with old
 platforms, I'm open to discussion of course.  I just want to miminize
 work done on platforms that aren't active and we don't know if they will
 come back.
 

This made me realise that there are two old OpenRISC patches floating
around that hasn't been applied to mainline.

http://patchwork.ozlabs.org/patch/142511/
http://patchwork.ozlabs.org/patch/142510/

Apart from that I'm not experiencing any problems on this arch.

It brings me to another question though,
would it be possible to get a custodian tree for OpenRISC?

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


Re: [U-Boot] [PATCH] EXT4

2012-05-22 Thread Stefan Kristiansson
On Tue, May 22, 2012 at 02:55:57PM +0900, Jorgen Lundman wrote:
 
 ERROR: do not initialise globals to 0 or NULL
 #596: FILE: fs/zfs/zfs.c:33:
 +block_dev_desc_t *zfs_dev_desc = NULL;
 
 That strikes me as dangerous. One lets you fail gracefully (Sorry, X
 has not been initialised) and the other is just a plain crash. I
 find crashes to be very ugly, even if it is only reachable by other
 developers.
 

Globals are per se initialised to 0,
so there is no need to explicitly initialise them.
As a consequence, it is neither dangerous to omit the initialisation.

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


[U-Boot] [PATCH] openrisc/cache: disable icache during invalidation

2012-04-23 Thread Stefan Kristiansson
invalidating the memory area that is being executed
while icache is on is a bit adventurous,
make sure it's turned off during this operation

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/cpu/cache.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/openrisc/cpu/cache.c b/arch/openrisc/cpu/cache.c
index 2a73a4f..fedfd89 100644
--- a/arch/openrisc/cpu/cache.c
+++ b/arch/openrisc/cpu/cache.c
@@ -44,11 +44,15 @@ void invalidate_dcache_range(unsigned long addr, unsigned 
long stop)
 static void invalidate_icache_range(unsigned long addr, unsigned long stop)
 {
ulong block_size = (mfspr(SPR_ICCFGR)  SPR_ICCFGR_CBS) ? 32 : 16;
+   ulong ie = icache_status();
 
+   icache_disable();
while (addr  stop) {
mtspr(SPR_ICBIR, addr);
addr += block_size;
}
+   if (ie)
+   icache_enable();
 }
 
 void flush_cache(unsigned long addr, unsigned long size)
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH 1/2] openrisc/bitops: add hweightX defines

2012-02-22 Thread Stefan Kristiansson
On Wed, Feb 22, 2012 at 07:10:09PM +0200, Stefan Kristiansson wrote:
 Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
 ---
  arch/openrisc/include/asm/bitops.h |4 
  1 files changed, 4 insertions(+), 0 deletions(-)
 
 diff --git a/arch/openrisc/include/asm/bitops.h 
 b/arch/openrisc/include/asm/bitops.h
 index c001a5d..c76a409 100644
 --- a/arch/openrisc/include/asm/bitops.h
 +++ b/arch/openrisc/include/asm/bitops.h
 @@ -25,4 +25,8 @@
  #define PLATFORM_FFS
  #include asm/bitops/ffs.h
  
 +#define hweight32(x) generic_hweight32(x)
 +#define hweight16(x) generic_hweight16(x)
 +#define hweight8(x) generic_hweight8(x)
 +
  #endif /* __ASM_GENERIC_BITOPS_H */
 -- 
 1.7.5.4
 

Sorry, screwed up when I format-patched this,
there is no part 2 to it.

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


[U-Boot] [PATCH 1/2] openrisc/bitops: add hweightX defines

2012-02-22 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/include/asm/bitops.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/openrisc/include/asm/bitops.h 
b/arch/openrisc/include/asm/bitops.h
index c001a5d..c76a409 100644
--- a/arch/openrisc/include/asm/bitops.h
+++ b/arch/openrisc/include/asm/bitops.h
@@ -25,4 +25,8 @@
 #define PLATFORM_FFS
 #include asm/bitops/ffs.h
 
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
 #endif /* __ASM_GENERIC_BITOPS_H */
-- 
1.7.5.4

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


[U-Boot] [PATCH] openrisc: implement get_ticks and get_tbclk

2012-02-22 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/lib/timer.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/openrisc/lib/timer.c b/arch/openrisc/lib/timer.c
index 4e92a31..89e644b 100644
--- a/arch/openrisc/lib/timer.c
+++ b/arch/openrisc/lib/timer.c
@@ -86,6 +86,16 @@ void set_timer(ulong t)
timestamp = t;
 }
 
+unsigned long long get_ticks(void)
+{
+   return get_timer(0);
+}
+
+ulong get_tbclk(void)
+{
+   return CONFIG_SYS_HZ;
+}
+
 void __udelay(ulong usec)
 {
ulong elapsed = 0;
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH v2 3/9] openrisc: Add cpu files

2012-01-06 Thread Stefan Kristiansson
On Thu, Jan 05, 2012 at 06:15:48PM -0500, Mike Frysinger wrote:
 On Thursday 22 December 2011 06:39:32 Stefan Kristiansson wrote:
  On Thu, Dec 22, 2011 at 10:09:30AM +0100, Michal Simek wrote:
   Stefan Kristiansson wrote:
   +
   +void dcache_enable(void)
   +{
   +mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   +asm volatile(l.nop);
   
   This is interesting. Are there 8 nops?
   Is there any reason for that? Is it just any waiting?
   If yes, maybe it will be worth to add any comment.
  
  Yes, the number of nops are kind of arbitrary,
  they are there to add some headroom for the cache
  to startup without any load/stores in flight.
  
  But you are right, a comment about this might be in place.
 
 this is usually why the ISA provides some sort of sync or latch mechanism.  
 that way code is deterministic instead of being unsettling arbitrary (like it 
 is here).

The OpenRISC ISA does provide synch mechanisms, but they are unfortunately
optional and not supported by the (currently) only open implementation (or1200).

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


Re: [U-Boot] [PATCH v2 3/9] openrisc: Add cpu files

2011-12-22 Thread Stefan Kristiansson
On Thu, Dec 22, 2011 at 10:09:30AM +0100, Michal Simek wrote:
 Stefan Kristiansson wrote:
 +
 +void dcache_enable(void)
 +{
 +mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 +asm volatile(l.nop);
 
 This is interesting. Are there 8 nops?
 Is there any reason for that? Is it just any waiting?
 If yes, maybe it will be worth to add any comment.
 

Yes, the number of nops are kind of arbitrary,
they are there to add some headroom for the cache
to startup without any load/stores in flight.

But you are right, a comment about this might be in place.

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


Re: [U-Boot] [PATCH v2 0/9] Add support for the OpenRISC architecture

2011-12-19 Thread Stefan Kristiansson
Hi Wolfgang,

On Sun, Nov 27, 2011 at 07:04:48AM +0200, Stefan Kristiansson wrote:
 This patch series adds support for the OpenRISC 1000 architecture.
 
 The OpenRISC architecture has been around for about a decade and
 has experienced a revival in the last couple of years from the 
 efforts of a small, but dedicated community compound of both
 commercial and independent contributors.
 
 Most of the development takes place on opencores.org/or1k and openrisc.net.
 
 The patches included in this series are also available in the
 'for-upstream' branch in the following git repository:
 
 git://openrisc.net/stefan/u-boot
 
 which is also browsable here:
 
 http://git.openrisc.net/cgit.cgi/stefan/u-boot/?h=for-upstream
 
 NOTE: The openrisc-generic board depends on this pending 
 patch to build properly:
 net/ethoc: use flush_dcache_range instead of flush_dcache
 (http://patchwork.ozlabs.org/patch/123622/)

I have not received any comments (or complaints, depending how
you look at it) on the v2 of those patches.

I saw your message about the next branch, so would you
please consider applying those to that, if nobody has any further
comments or objections?

Thanks

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


Re: [U-Boot] [PATCH] USB: Use (get|put)_unaligned_le16 for accessing wMaxPacketSize

2011-12-14 Thread Stefan Kristiansson
Hi Tom,

after taking a second look at this a couple of things came to mind

On Wed, Dec 14, 2011 at 03:20:03PM -0700, Tom Rini wrote:
 In 9792987721c7980453fe6447c3fa6593b44f8458 Stefan describes a usecase
 where the previous behavior of leaving wMaxPacketSize be unaligned
 caused fatal problems.  The initial fix for this problem was incomplete
 however as it showed another cases of non-aligned access that previously
 worked implicitly.  This switches to making sure that all access of
 wMaxPacketSize are done via (get|put)_unaligned_le16.
 

Why the _le16? Shouldn't it just be (get|put)_unaligned?

 - le16_to_cpus((dev-config.if_desc[ifno].ep_desc[epno].\
 -wMaxPacketSize));
 + ep_wMaxPacketSize = get_unaligned_le16(dev-config.\
 + if_desc[ifno].\
 + ep_desc[epno].\
 + wMaxPacketSize);
 + le16_to_cpus(ep_wMaxPacketSize);
   USB_PRINTF(if %d, ep %d\n, ifno, epno);
   break;
   default:

Since this code is changing the wMaxPacketSize, it should probably be:

ep_wMaxPacketSize = get_unaligned(dev-config.\
if_desc[ifno].\
ep_desc[epno].\
wMaxPacketSize);
put_unaligned(le16_to_cpu(ep_wMaxPacketSize),
dev-config.\
if_desc[ifno].\
ep_desc[epno].\
wMaxPacketSize);

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


Re: [U-Boot] OMAP4 u-boot broken (was [PATCH] usb: align usb_endpoint_descriptor to 16-bit boundary)

2011-12-13 Thread Stefan Kristiansson
Hi Aneesh,
On Tue, Dec 13, 2011 at 06:59:45PM +0530, Aneesh V wrote:
 OMAP4 U-Boot is broken in the mainline. U-Boot wouldn't boot up on any
 OMAP4 platforms. I suspect this will be the case with any ARM platform
 that has enabled USB tty code. I git-bisected the issue to this patch.
 I did some analysis on it and here are my findings.
 
 aligned(2) indeed makes the sizeof(struct usb_endpoint_descriptor) ==
 8. But that doesn't seem to be enough. struct acm_config_desc embeds
 fields of type usb_endpoint_descriptor and has the attribute 'packed'.
 As a result, these usb_endpoint_descriptor structures in
 acm_config_desc may have odd addresses and consequently wMaxPacketSize
 also has odd address. As far as I can see, this is not a new issue. But
 your patch fortunately or unfortunately brought it out. Here is how:
 
 When 'usb_endpoint_descriptor' didn't have the 'aligned' attribute,
 compiler took extra care while accessing wMaxPacketSize. It did it
 using two byte reads and combining them to make a 16-bit half-word.
 When aligned was added compiler replaced it with a 'ldrh' (load
 half-word) instruction that resulted in an abort due the odd address.
 

How unpleasent, nice that you were able to pinpoint where and how it fails
however.

 Now, I am not sure how to solve this problem. I tried the following and
 the boot issue is gone.
 
 diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
 index e2e87fe..2a961e9 100644
 --- a/drivers/serial/usbtty.c
 +++ b/drivers/serial/usbtty.c
 @@ -151,7 +151,7 @@ struct acm_config_desc {
   /* Slave Interface */
   struct usb_interface_descriptor data_class_interface;
   struct usb_endpoint_descriptor data_endpoints[NUM_ENDPOINTS-1];
 -} __attribute__((packed));
 +};
 
  static struct acm_config_desc
 acm_configuration_descriptors[NUM_CONFIGS] = {
   {
 
 I am not a USB expert, so not sure whether this works. Does that
 structure really have to be 'packed'? It will be great if USB experts
 can look into this and come up with a permanent solution at the
 earliest because quite a few platforms will be broken until then.
 

I am neither a USB expert, just the moron that apperantly broke a lot
of OMAP4 boards.

The way I see it there are 3 options at hand here:
1) revert my patch and look over the places where wMaxPacketSize is used
and wrap them in get/set_unaligned() (at least in non-arch specific code)
2) go forward with your approach
3) stop using usb_endpoint_descriptor in arrays

I think option nr 1 is the safest one here, but yes,
input from USB experts would be great.

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


[U-Boot] [PATCH v2 0/9] Add support for the OpenRISC architecture

2011-11-26 Thread Stefan Kristiansson
This patch series adds support for the OpenRISC 1000 architecture.

The OpenRISC architecture has been around for about a decade and
has experienced a revival in the last couple of years from the 
efforts of a small, but dedicated community compound of both
commercial and independent contributors.

Most of the development takes place on opencores.org/or1k and openrisc.net.

The patches included in this series are also available in the
'for-upstream' branch in the following git repository:

git://openrisc.net/stefan/u-boot

which is also browsable here:

http://git.openrisc.net/cgit.cgi/stefan/u-boot/?h=for-upstream

NOTE: The openrisc-generic board depends on this pending 
patch to build properly:
net/ethoc: use flush_dcache_range instead of flush_dcache
(http://patchwork.ozlabs.org/patch/123622/)

Stefan Kristiansson (9):
  openrisc: Add architecture header files
  openrisc: Add architecture image support
  openrisc: Add cpu files
  openrisc: Add library functions
  openrisc: Add board info printout to cmd_bdinfo
  openrisc: Add support for standalone programs
  openrisc: Add openrisc-generic example board
  openrisc: Add architecture to MAKEALL
  openrisc: Add MAINTAINERS entry

 MAINTAINERS|   11 +
 MAKEALL|5 +
 arch/openrisc/config.mk|   27 +
 arch/openrisc/cpu/Makefile |   47 +
 arch/openrisc/cpu/cache.c  |  151 
 arch/openrisc/cpu/cpu.c|  157 
 arch/openrisc/cpu/exceptions.c |   85 ++
 arch/openrisc/cpu/interrupts.c |  121 +++
 arch/openrisc/cpu/start.S  |  335 
 arch/openrisc/include/asm/bitops.h |   28 +
 arch/openrisc/include/asm/bitops/ffs.h |   26 +
 arch/openrisc/include/asm/bitops/fls.h |   26 +
 arch/openrisc/include/asm/byteorder.h  |1 +
 arch/openrisc/include/asm/cache.h  |   35 +
 arch/openrisc/include/asm/config.h |   24 +
 arch/openrisc/include/asm/errno.h  |1 +
 arch/openrisc/include/asm/global_data.h|   74 ++
 arch/openrisc/include/asm/gpio.h   |   84 ++
 arch/openrisc/include/asm/io.h |  112 +++
 arch/openrisc/include/asm/openrisc_exc.h   |   41 +
 arch/openrisc/include/asm/posix_types.h|   72 ++
 arch/openrisc/include/asm/processor.h  |4 +
 arch/openrisc/include/asm/ptrace.h |  131 +++
 arch/openrisc/include/asm/spr-defs.h   |  567 +
 arch/openrisc/include/asm/string.h |4 +
 arch/openrisc/include/asm/system.h |   39 +
 arch/openrisc/include/asm/types.h  |   79 ++
 arch/openrisc/include/asm/u-boot.h |   48 ++
 arch/openrisc/include/asm/unaligned.h  |1 +
 arch/openrisc/lib/Makefile |   47 +
 arch/openrisc/lib/board.c  |  168 
 arch/openrisc/lib/bootm.c  |   84 ++
 arch/openrisc/lib/timer.c  |  104 +++
 board/openrisc/openrisc-generic/Makefile   |   43 +
 board/openrisc/openrisc-generic/config.mk  |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg|  882 
 board/openrisc/openrisc-generic/u-boot.lds |   75 ++
 boards.cfg |1 +
 common/cmd_bdinfo.c|   22 +
 common/image.c |1 +
 examples/standalone/stubs.c|   14 +
 include/configs/openrisc-generic.h |  158 
 include/image.h|1 +
 44 files changed, 4015 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h
 create mode 100644 arch/openrisc/include/asm/cache.h
 create mode 100644 arch/openrisc/include/asm/config.h
 create mode 100644 arch/openrisc/include/asm/errno.h
 create mode 100644 arch/openrisc/include/asm/global_data.h
 create mode 100644 arch/openrisc/include/asm/gpio.h
 create mode 100644 arch/openrisc/include/asm/io.h
 create mode 100644 arch/openrisc/include/asm/openrisc_exc.h
 create mode 100644 arch/openrisc/include/asm

[U-Boot] [PATCH v2 2/9] openrisc: Add architecture image support

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - None

 common/image.c  |1 +
 include/image.h |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/common/image.c b/common/image.c
index 555d9d9..564dee1 100644
--- a/common/image.c
+++ b/common/image.c
@@ -94,6 +94,7 @@ static const table_entry_t uimage_arch[] = {
{   IH_ARCH_BLACKFIN,   blackfin, Blackfin, },
{   IH_ARCH_AVR32,  avr32,AVR32,},
{   IH_ARCH_NDS32,  nds32,NDS32,},
+   {   IH_ARCH_OPENRISC,   or1k, OpenRISC 1000,},
{   -1, , , },
 };
 
diff --git a/include/image.h b/include/image.h
index 6a41c2e..daf9ac8 100644
--- a/include/image.h
+++ b/include/image.h
@@ -108,6 +108,7 @@
 #define IH_ARCH_ST200  18  /* STMicroelectronics ST200  */
 #define IH_ARCH_SANDBOX19  /* Sandbox architecture (test 
only) */
 #define IH_ARCH_NDS32  20  /* ANDES Technology - NDS32  */
+#define IH_ARCH_OPENRISC21 /* OpenRISC 1000  */
 
 /*
  * Image Types
-- 
1.7.5.4

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


[U-Boot] [PATCH v2 3/9] openrisc: Add cpu files

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - Fix missing newline
 - Bugfix for cache line size reading
 - Make l.nop asm statements volatile
 - Fix include order (asm after non-asm)
 - Add static to functions only called locally
 - Make unhandled exception printout into a look-up table

 arch/openrisc/config.mk|   27 
 arch/openrisc/cpu/Makefile |   47 ++
 arch/openrisc/cpu/cache.c  |  151 ++
 arch/openrisc/cpu/cpu.c|  157 +++
 arch/openrisc/cpu/exceptions.c |   85 ++
 arch/openrisc/cpu/interrupts.c |  121 +++
 arch/openrisc/cpu/start.S  |  335 
 7 files changed, 923 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S

diff --git a/arch/openrisc/config.mk b/arch/openrisc/config.mk
new file mode 100644
index 000..521e73a
--- /dev/null
+++ b/arch/openrisc/config.mk
@@ -0,0 +1,27 @@
+#
+# (C) Copyright 2011
+# Julius Baxter jul...@opencores.org
+#
+# 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
+#
+
+CROSS_COMPILE ?= or32-elf-
+
+# r10 used for global object pointer, already set in OR32 GCC but just to be
+# clear
+PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10
+
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x4
diff --git a/arch/openrisc/cpu/Makefile b/arch/openrisc/cpu/Makefile
new file mode 100644
index 000..b3b1a24
--- /dev/null
+++ b/arch/openrisc/cpu/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011
+# Julius Baxter jul...@opencores.org
+#
+# 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$(CPU).o
+
+START  = start.o
+COBJS-y= cache.o cpu.o exceptions.o interrupts.o
+
+SRCS   := $(START:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+START  := $(addprefix $(obj),$(START))
+
+all:   $(obj).depend $(START) $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/openrisc/cpu/cache.c b/arch/openrisc/cpu/cache.c
new file mode 100644
index 000..2a73a4f
--- /dev/null
+++ b/arch/openrisc/cpu/cache.c
@@ -0,0 +1,151 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson stefan.kristians...@saunalahti.fi
+ * (C) Copyright 2011, Julius Baxter jul...@opencores.org
+ *
+ * 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

[U-Boot] [PATCH v2 1/9] openrisc: Add architecture header files

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - Copyright/license information added to headers
 - ptrace.h updated from Linux

 arch/openrisc/include/asm/bitops.h   |   28 ++
 arch/openrisc/include/asm/bitops/ffs.h   |   26 ++
 arch/openrisc/include/asm/bitops/fls.h   |   26 ++
 arch/openrisc/include/asm/byteorder.h|1 +
 arch/openrisc/include/asm/cache.h|   35 ++
 arch/openrisc/include/asm/config.h   |   24 ++
 arch/openrisc/include/asm/errno.h|1 +
 arch/openrisc/include/asm/global_data.h  |   74 
 arch/openrisc/include/asm/gpio.h |   84 +
 arch/openrisc/include/asm/io.h   |  112 ++
 arch/openrisc/include/asm/openrisc_exc.h |   41 +++
 arch/openrisc/include/asm/posix_types.h  |   72 
 arch/openrisc/include/asm/processor.h|4 +
 arch/openrisc/include/asm/ptrace.h   |  131 +++
 arch/openrisc/include/asm/spr-defs.h |  567 ++
 arch/openrisc/include/asm/string.h   |4 +
 arch/openrisc/include/asm/system.h   |   39 ++
 arch/openrisc/include/asm/types.h|   79 
 arch/openrisc/include/asm/u-boot.h   |   48 +++
 arch/openrisc/include/asm/unaligned.h|1 +
 20 files changed, 1397 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h
 create mode 100644 arch/openrisc/include/asm/cache.h
 create mode 100644 arch/openrisc/include/asm/config.h
 create mode 100644 arch/openrisc/include/asm/errno.h
 create mode 100644 arch/openrisc/include/asm/global_data.h
 create mode 100644 arch/openrisc/include/asm/gpio.h
 create mode 100644 arch/openrisc/include/asm/io.h
 create mode 100644 arch/openrisc/include/asm/openrisc_exc.h
 create mode 100644 arch/openrisc/include/asm/posix_types.h
 create mode 100644 arch/openrisc/include/asm/processor.h
 create mode 100644 arch/openrisc/include/asm/ptrace.h
 create mode 100644 arch/openrisc/include/asm/spr-defs.h
 create mode 100644 arch/openrisc/include/asm/string.h
 create mode 100644 arch/openrisc/include/asm/system.h
 create mode 100644 arch/openrisc/include/asm/types.h
 create mode 100644 arch/openrisc/include/asm/u-boot.h
 create mode 100644 arch/openrisc/include/asm/unaligned.h

diff --git a/arch/openrisc/include/asm/bitops.h 
b/arch/openrisc/include/asm/bitops.h
new file mode 100644
index 000..c001a5d
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops.h
@@ -0,0 +1,28 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson stefan.kristians...@saunalahti.fi
+ *
+ * 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 __ASM_OPENRISC_BITOPS_H
+#define __ASM_OPENRISC_BITOPS_H
+
+#define PLATFORM_FLS
+#include asm/bitops/fls.h
+#define PLATFORM_FFS
+#include asm/bitops/ffs.h
+
+#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/arch/openrisc/include/asm/bitops/ffs.h 
b/arch/openrisc/include/asm/bitops/ffs.h
new file mode 100644
index 000..1de5295
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops/ffs.h
@@ -0,0 +1,26 @@
+/*
+ * OpenRISC Linux
+ *
+ * Copyright (C) 2010-2011 Jonas Bonn jo...@southpole.se
+ *
+ * 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.
+ */
+
+#ifndef __ASM_OPENRISC_FFS_H
+#define __ASM_OPENRISC_FFS_H
+
+static inline int ffs(int x)
+{
+   int ret;
+
+   __asm__ (l.ff1 %0,%1
+: =r (ret)
+: r (x));
+
+   return ret;
+}
+
+#endif /* __ASM_OPENRISC_FFS_H */
diff --git a/arch/openrisc/include/asm/bitops/fls.h 
b/arch/openrisc/include/asm/bitops/fls.h
new file mode 100644
index 000..8c77c13
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops/fls.h
@@ -0,0 +1,26 @@
+/*
+ * OpenRISC Linux
+ *
+ * Copyright (C) 2010-2011 Jonas Bonn jo...@southpole.se
+ *
+ * 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

[U-Boot] [PATCH v2 5/9] openrisc: Add board info printout to cmd_bdinfo

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - None

 common/cmd_bdinfo.c |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 688b238..1cd69b5 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -460,6 +460,28 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 0;
 }
 
+#elif defined(CONFIG_OPENRISC)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   bd_t *bd = gd-bd;
+
+   print_num(mem start,  (ulong)bd-bi_memstart);
+   print_lnum(mem size,  (u64)bd-bi_memsize);
+   print_num(flash start,(ulong)bd-bi_flashstart);
+   print_num(flash size, (ulong)bd-bi_flashsize);
+   print_num(flash offset,   (ulong)bd-bi_flashoffset);
+
+#if defined(CONFIG_CMD_NET)
+   print_eth(0);
+   printf(ip_addr = %pI4\n, bd-bi_ip_addr);
+#endif
+
+   printf(baudrate= %ld bps\n, bd-bi_baudrate);
+
+   return 0;
+}
+
 #else
  #error a case for this architecture does not exist!
 #endif
-- 
1.7.5.4

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


[U-Boot] [PATCH v2 4/9] openrisc: Add library functions

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - Remove superfluous extern statements
 - Use ARRAY_SIZE to determine end of function pointer list
 - Remove references to deprecated CONFIG_NET_MULTI
 - Fix include order (asm after non-asm)
 - Remove function pointer typedef
 - Remove simulation specific l.nop

 arch/openrisc/lib/Makefile |   47 
 arch/openrisc/lib/board.c  |  168 
 arch/openrisc/lib/bootm.c  |   84 ++
 arch/openrisc/lib/timer.c  |  104 +++
 4 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/lib/Makefile
 create mode 100644 arch/openrisc/lib/board.c
 create mode 100644 arch/openrisc/lib/bootm.c
 create mode 100644 arch/openrisc/lib/timer.c

diff --git a/arch/openrisc/lib/Makefile b/arch/openrisc/lib/Makefile
new file mode 100644
index 000..db3c657
--- /dev/null
+++ b/arch/openrisc/lib/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2003-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$(ARCH).o
+
+SOBJS-y+=
+
+COBJS-y+= board.o
+COBJS-y+= bootm.o
+COBJS-y+= timer.o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS-y) $(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/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
new file mode 100644
index 000..85aa189
--- /dev/null
+++ b/arch/openrisc/lib/board.c
@@ -0,0 +1,168 @@
+/*
+ * (C) Copyright 2011
+ * Julius Baxter, jul...@opencores.org
+ *
+ * (C) Copyright 2003, Psyent Corporation www.psyent.com
+ * Scott McNutt smcn...@psyent.com
+ *
+ * (C) Copyright 2000-2002
+ * 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 common.h
+#include stdio_dev.h
+#include watchdog.h
+#include malloc.h
+#include mmc.h
+#include net.h
+#ifdef CONFIG_STATUS_LED
+#include status_led.h
+#endif
+#ifdef CONFIG_CMD_NAND
+#include nand.h  /* cannot even include nand.h if it isnt configured */
+#endif
+
+#include timestamp.h
+#include version.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * All attempts to come up with a common initialization sequence
+ * that works for all boards and architectures failed: some of the
+ * requirements are just _too_ different. To get rid of the resulting
+ * mess of board dependend #ifdef'ed code we now make the whole
+ * initialization sequence configurable to the user.
+ *
+ * The requirements for any new initalization function is simple: it
+ * receives a pointer to the global data structure as it's only
+ * argument, and returns an integer return code, where 0 means
+ * continue and != 0 means fatal error, hang the system.
+ */
+
+extern int cache_init(void);
+
+/*
+ * Initialization sequence
+ */
+static int (* const init_sequence[])(void) = {
+   cache_init,
+   timer_init, /* initialize timer */
+   env_init,
+   serial_init,
+   console_init_f,
+   display_options,
+   checkcpu

[U-Boot] [PATCH v2 6/9] openrisc: Add support for standalone programs

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - None

 examples/standalone/stubs.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 11c7565..8b291db 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -180,6 +180,20 @@ gd_t *global_data;
   lwi $r16, [$r16 + (%1)]\n  \
   jr  $r16\n \
: : i(offsetof(gd_t, jt)), i(XF_ ## x * sizeof(void *)) : $r16);
+#elif defined(CONFIG_OPENRISC)
+/*
+ * r10 holds the pointer to the global_data, r13 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+   asm volatile (  \
+  .globl  #x \n\
+#x :\n   \
+  l.lwz   r13, %0(r10)\n \
+  l.lwz   r13, %1(r13)\n \
+  l.jrr13\n  \
+  l.nop\n\
+   : : i(offsetof(gd_t, jt)), i(XF_ ## x * sizeof(void *)) : r13);
 #else
 /*addi$sp, $sp, -24\n\
   br  $r16\n \*/
-- 
1.7.5.4

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


[U-Boot] [PATCH v2 8/9] openrisc: Add architecture to MAKEALL

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - None

 MAKEALL |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 95b7cd3..f45f767 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -416,6 +416,11 @@ LIST_mips_el= \
${LIST_mips5kc_el}  \
${LIST_au1xx0_el}   \
 
+#
+## OpenRISC Systems
+#
+
+LIST_openrisc=$(boards_by_arch openrisc)
 
 #
 ## x86 Systems
-- 
1.7.5.4

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


[U-Boot] [PATCH v2 7/9] openrisc: Add openrisc-generic example board

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - Remove references to deprecated CONFIG_NET_MULTI

 board/openrisc/openrisc-generic/Makefile   |   43 +
 board/openrisc/openrisc-generic/config.mk  |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg|  882 
 board/openrisc/openrisc-generic/u-boot.lds |   75 ++
 boards.cfg |1 +
 include/configs/openrisc-generic.h |  158 
 7 files changed, 1238 insertions(+), 0 deletions(-)
 create mode 100644 board/openrisc/openrisc-generic/Makefile
 create mode 100644 board/openrisc/openrisc-generic/config.mk
 create mode 100644 board/openrisc/openrisc-generic/openrisc-generic.c
 create mode 100644 board/openrisc/openrisc-generic/or1ksim.cfg
 create mode 100644 board/openrisc/openrisc-generic/u-boot.lds
 create mode 100644 include/configs/openrisc-generic.h

diff --git a/board/openrisc/openrisc-generic/Makefile 
b/board/openrisc/openrisc-generic/Makefile
new file mode 100644
index 000..4890aac
--- /dev/null
+++ b/board/openrisc/openrisc-generic/Makefile
@@ -0,0 +1,43 @@
+#
+# (C) Copyright 2001-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).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/openrisc/openrisc-generic/config.mk 
b/board/openrisc/openrisc-generic/config.mk
new file mode 100644
index 000..c3dc232
--- /dev/null
+++ b/board/openrisc/openrisc-generic/config.mk
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2011, Julius Baxter jul...@opencores.org
+#
+# 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
+#
+
+PLATFORM_CPPFLAGS += -mhard-mul -mhard-div
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
diff --git a/board/openrisc/openrisc-generic/openrisc-generic.c 
b/board/openrisc/openrisc-generic/openrisc-generic.c
new file mode 100644
index 000..cdbbfa5
--- /dev/null
+++ b/board/openrisc/openrisc-generic/openrisc-generic.c
@@ -0,0 +1,55 @@
+/*
+ * Based on nios2-generic.c:
+ * (C) Copyright 2005, Psyent Corporation www.psyent.com
+ * Scott McNutt smcn...@psyent.com
+ * (C) Copyright 2010, Thomas Chou tho...@wytron.com.tw
+ *
+ * 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

[U-Boot] [PATCH v2 9/9] openrisc: Add MAINTAINERS entry

2011-11-26 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---

Changes in v2:
 - None

 MAINTAINERS |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f6f6b72..bf144cc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1147,5 +1147,16 @@ Macpaul Lin macp...@andestech.com
ADP-AG101P  N1213 (AG101P XC5 FPGA)
 
 #
+# OpenRISC Systems:#
+#  #
+# Maintainer Name, Email Address   #
+#  Board   CPU #
+#
+
+Stefan Kristiansson stefan.kristians...@saunalahti.fi
+
+   openrisc-genericOpenRISC
+
+#
 # End of MAINTAINERS list  #
 #
-- 
1.7.5.4

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


[U-Boot] [PATCH] Fix clash between IH_ARCH_NDS32 and IH_ARCH_SANDBOX

2011-11-22 Thread Stefan Kristiansson
NDS32 and SANDBOX architecture were sharing the same IH_ARCH number

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 include/image.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/image.h b/include/image.h
index c56a18d..6a41c2e 100644
--- a/include/image.h
+++ b/include/image.h
@@ -107,7 +107,7 @@
 #define IH_ARCH_AVR32  17  /* AVR32*/
 #define IH_ARCH_ST200  18  /* STMicroelectronics ST200  */
 #define IH_ARCH_SANDBOX19  /* Sandbox architecture (test 
only) */
-#define IH_ARCH_NDS32  19  /* ANDES Technology - NDS32  */
+#define IH_ARCH_NDS32  20  /* ANDES Technology - NDS32  */
 
 /*
  * Image Types
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH 3/9] openrisc: Add cpu files

2011-11-21 Thread Stefan Kristiansson
On Mon, Nov 21, 2011 at 11:50:17PM +0100, Marek Vasut wrote:
  +   return (mfspr(SPR_ICCFGR)  SPR_ICCFGR_CBS) ? 32 : 16;
 
 What's mfspr ... if it's some register, then maybe mfspr_read() ?
 

It's an instruction, move from special register,
so I don't think the _read would be appropriate in this case.

  +   printf(CPU:   OpenRISC-%x00 (rev %d) @ %d MHz\n,
  +   ver, rev, (CONFIG_SYS_CLK_FREQ / 100));
 
 The CPU won't tell you it's speed ?
 

Nope.

  +   l.addi  r3,r3,4
  +   l.sfltu r4,r5
  +   l.bf.L_reloc
  +l.addi r4,r4,4 /* delay slot */
 
 The formating here doesn't seem right?
 

The extra space there is to denote that the instruction is
in a delay slot.
I think it brings more readability to the code, but if it
meets too much resistance I'll remove them.

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


Re: [U-Boot] [PATCH 4/9] openrisc: Add library functions

2011-11-21 Thread Stefan Kristiansson
On Mon, Nov 21, 2011 at 11:52:59PM +0100, Marek Vasut wrote:
   create mode 100644 arch/openrisc/lib/timer.c
 
 Timer support isn't a library function but a CPU function, so move it to 3/9.
 

I never quite worked out where the timer functions belongs,
some have them in interupts.c and some in their own file.
Some have them cpu/ and some in lib/

  +   asm(l.nop 0x1); /* Kill any simulation */
 
 Simulation? Oh, it's an FPGA based CPU or what?
 

Well, yes, FPGAs are probably the most common case, but also ASIC
implementations exists.
The extra argument to the nop instruction is ignored by hardware,
but have special meanings when ran in simulation.

  +int timer_init(void)
  +{
  +   /* Install timer exception handler */
  +   exception_install_handler(EXC_TIMER, timer_isr);
  +
  +   /* Set up the timer for the first expiration. */
  +   timestamp = 0;
  +
  +   mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT |
  +   (TIMER_COUNTER_CYCLES  SPR_TTMR_TP));
  +
  +   /* Enable tick timer exception in supervisor register */
  +   mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_TEE);
  +
  +   return 0;
  +}
  +
  +void reset_timer(void)
  +{
  +   timestamp = 0;
  +
  +   mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT |
  +   (TIMER_COUNTER_CYCLES  SPR_TTMR_TP));
  +}
  +
  +/*
  + * The timer value in ms is calculated by taking the
  + * value accumulated by full timer revolutions plus the value
  + * accumulated in this period
  + */
  +ulong get_timer(ulong base)
  +{
  +   return timestamp + mfspr(SPR_TTCR)/TIMER_CYCLES_MS - base;
  +}
  +
  +void set_timer(ulong t)
  +{
  +   reset_timer();
  +   timestamp = t;
  +}
  +
  +void __udelay(ulong usec)
  +{
  +   ulong elapsed = 0;
  +   ulong tick;
  +   ulong last_tick;
  +
  +   last_tick = mfspr(SPR_TTCR);
  +   while ((elapsed / TIMER_CYCLES_US)  usec) {
  +   tick = mfspr(SPR_TTCR);
  +   if (tick = last_tick)
  +   elapsed += (tick - last_tick);
  +   else
  +   elapsed += TIMER_COUNTER_CYCLES - (last_tick - tick);
  +   last_tick = tick;
  +   }
  +}
 
 I'm not sure if this conforms with current timer api, can you cross-check 
 with 
 arch/arm/arm926ejs/mx28/timer.c ? That's the latest addition and should 
 conform.
 

In my opinion it seems to do the same thing as that, what exactly did you
find non-conforming?

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


Re: [U-Boot] [PATCH 5/9] openrisc: Add board info printout to cmd_bdinfo

2011-11-21 Thread Stefan Kristiansson
On Mon, Nov 21, 2011 at 11:53:32PM +0100, Marek Vasut wrote:
  +int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  +{
  +   bd_t *bd = gd-bd;
  +
  +   print_num(mem start,  (ulong)bd-bi_memstart);
  +   print_lnum(mem size,  (u64)bd-bi_memsize);
  +   print_num(flash start,(ulong)bd-bi_flashstart);
  +   print_num(flash size, (ulong)bd-bi_flashsize);
  +   print_num(flash offset,   (ulong)bd-bi_flashoffset);
  +
  +#if defined(CONFIG_CMD_NET)
  +   print_eth(0);
  +   printf(ip_addr = %pI4\n, bd-bi_ip_addr);
  +#endif
  +
  +   printf(baudrate= %ld bps\n, bd-bi_baudrate);
 
 Would consistent format of the printed data be a problem ? ;-)
 

I'm sorry, I don't think I understand what you are referring to here.
When printed, they are all lined up.
If I haven't missed something, every arch does the printing like that.

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


Re: [U-Boot] [PATCH 9/9] openrisc: Add MAINTAINERS entry

2011-11-21 Thread Stefan Kristiansson
On Mon, Nov 21, 2011 at 11:54:51PM +0100, Marek Vasut wrote:
 
 Keep up the good work!
 

I'll do my best ;)
Thanks for taking the time to review our code.

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


Re: [U-Boot] [PATCH 4/9] openrisc: Add library functions

2011-11-21 Thread Stefan Kristiansson
On Tue, Nov 22, 2011 at 05:48:53AM +0100, Marek Vasut wrote:
+   asm(l.nop 0x1); /* Kill any simulation */
   
   Simulation? Oh, it's an FPGA based CPU or what?
  
  Well, yes, FPGAs are probably the most common case, but also ASIC
  implementations exists.
  The extra argument to the nop instruction is ignored by hardware,
  but have special meanings when ran in simulation.
 
 Hmm ... I'm not quite sure this is right.
 

It's not important to have there, I'll just remove it.

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


Re: [U-Boot] [PATCH 3/9] openrisc: Add cpu files

2011-11-21 Thread Stefan Kristiansson
On Tue, Nov 22, 2011 at 05:46:41AM +0100, Marek Vasut wrote:
  On Mon, Nov 21, 2011 at 11:50:17PM +0100, Marek Vasut wrote:
+   printf(CPU:   OpenRISC-%x00 (rev %d) @ %d MHz\n,
+   ver, rev, (CONFIG_SYS_CLK_FREQ / 100));
   
   The CPU won't tell you it's speed ?
  
  Nope.
 
 That's weird, how do you calibrate delay then, using static setup ?
 

You mean in Linux? CPU freq is passed in via the device tree.

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


Re: [U-Boot] [PATCH 3/9] openrisc: Add cpu files

2011-11-19 Thread Stefan Kristiansson
On Sat, Nov 19, 2011 at 12:59:05AM -0500, Mike Frysinger wrote:
 On Saturday 19 November 2011 00:21:32 Stefan Kristiansson wrote:
  --- /dev/null
  +++ b/arch/openrisc/cpu/cache.c
 
  +int checkicache(void)
  +int checkdcache(void)
 
 these should be static
 
  --- /dev/null
  +++ b/arch/openrisc/cpu/cpu.c
 
  +int checkcpu(void)
 
 looks like these should be static
 

They are declared in common.h and are used outside their file scope.

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


[U-Boot] [PATCH 0/9] Add support for the OpenRISC architecture

2011-11-18 Thread Stefan Kristiansson
This patch series adds support for the OpenRISC 1000 architecture.

The OpenRISC architecture has been around for about a decade and
has experienced a revival in the last couple of years from the 
efforts of a small, but dedicated community compound of both
commercial and independent contributors.

Most of our development takes place on opencores.org/or1k and openrisc.net.

Porting U-Boot for OpenRISC is a part of this revival, and we have now
reached a point where we feel that our code is ready to be considered
for inclusion in mainline.
We have tried to keep the code in line with what is our 
understanding of the philosophy and style of U-Boot.
Please take time to review our code and point out for us where
we still might have failed.

The patches included in this series are also availabe in the
'for-upstream' branch in the following git repository:

git://openrisc.net/stefan/u-boot

which is also browsable here:

http://git.openrisc.net/cgit.cgi/stefan/u-boot/?h=for-upstream

NOTE: The openrisc-generic board depends on this pending 
patch to build properly:
net/ethoc: use flush_dcache_range instead of flush_dcache
(http://patchwork.ozlabs.org/patch/123622/)
This however should not need to delay the review of our code.

Stefan Kristiansson (9):
  openrisc: Add architecture header files
  openrisc: Add architecture image support
  openrisc: Add cpu files
  openrisc: Add library functions
  openrisc: Add board info printout to cmd_bdinfo
  openrisc: Add support for standalone programs
  openrisc: Add openrisc-generic example board
  openrisc: Add architecture to MAKEALL
  openrisc: Add MAINTAINERS entry

 MAINTAINERS|   11 +
 MAKEALL|5 +
 arch/openrisc/config.mk|   27 +
 arch/openrisc/cpu/Makefile |   47 +
 arch/openrisc/cpu/cache.c  |  157 
 arch/openrisc/cpu/cpu.c|  157 
 arch/openrisc/cpu/exceptions.c |  109 +++
 arch/openrisc/cpu/interrupts.c |  120 +++
 arch/openrisc/cpu/start.S  |  335 
 arch/openrisc/include/asm/bitops.h |9 +
 arch/openrisc/include/asm/bitops/ffs.h |   26 +
 arch/openrisc/include/asm/bitops/fls.h |   26 +
 arch/openrisc/include/asm/byteorder.h  |6 +
 arch/openrisc/include/asm/cache.h  |   16 +
 arch/openrisc/include/asm/config.h |   24 +
 arch/openrisc/include/asm/errno.h  |1 +
 arch/openrisc/include/asm/global_data.h|   74 ++
 arch/openrisc/include/asm/gpio.h   |   84 ++
 arch/openrisc/include/asm/io.h |   93 ++
 arch/openrisc/include/asm/openrisc_exc.h   |   41 +
 arch/openrisc/include/asm/posix_types.h|   58 ++
 arch/openrisc/include/asm/processor.h  |4 +
 arch/openrisc/include/asm/ptrace.h |   83 ++
 arch/openrisc/include/asm/spr-defs.h   |  567 +
 arch/openrisc/include/asm/string.h |5 +
 arch/openrisc/include/asm/system.h |   20 +
 arch/openrisc/include/asm/types.h  |   60 ++
 arch/openrisc/include/asm/u-boot.h |   48 ++
 arch/openrisc/include/asm/unaligned.h  |1 +
 arch/openrisc/lib/Makefile |   47 +
 arch/openrisc/lib/board.c  |  175 
 arch/openrisc/lib/bootm.c  |   84 ++
 arch/openrisc/lib/timer.c  |  104 +++
 board/openrisc/openrisc-generic/Makefile   |   43 +
 board/openrisc/openrisc-generic/config.mk  |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg|  882 
 board/openrisc/openrisc-generic/u-boot.lds |   75 ++
 boards.cfg |1 +
 common/cmd_bdinfo.c|   22 +
 common/image.c |1 +
 examples/standalone/stubs.c|   14 +
 include/configs/openrisc-generic.h |  159 
 include/image.h|1 +
 44 files changed, 3901 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h

[U-Boot] [PATCH 1/9] openrisc: Add architecture header files

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/include/asm/bitops.h   |9 +
 arch/openrisc/include/asm/bitops/ffs.h   |   26 ++
 arch/openrisc/include/asm/bitops/fls.h   |   26 ++
 arch/openrisc/include/asm/byteorder.h|6 +
 arch/openrisc/include/asm/cache.h|   16 +
 arch/openrisc/include/asm/config.h   |   24 ++
 arch/openrisc/include/asm/errno.h|1 +
 arch/openrisc/include/asm/global_data.h  |   74 
 arch/openrisc/include/asm/gpio.h |   84 +
 arch/openrisc/include/asm/io.h   |   93 +
 arch/openrisc/include/asm/openrisc_exc.h |   41 +++
 arch/openrisc/include/asm/posix_types.h  |   58 +++
 arch/openrisc/include/asm/processor.h|4 +
 arch/openrisc/include/asm/ptrace.h   |   83 +
 arch/openrisc/include/asm/spr-defs.h |  567 ++
 arch/openrisc/include/asm/string.h   |5 +
 arch/openrisc/include/asm/system.h   |   20 +
 arch/openrisc/include/asm/types.h|   60 
 arch/openrisc/include/asm/u-boot.h   |   48 +++
 arch/openrisc/include/asm/unaligned.h|1 +
 20 files changed, 1246 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h
 create mode 100644 arch/openrisc/include/asm/cache.h
 create mode 100644 arch/openrisc/include/asm/config.h
 create mode 100644 arch/openrisc/include/asm/errno.h
 create mode 100644 arch/openrisc/include/asm/global_data.h
 create mode 100644 arch/openrisc/include/asm/gpio.h
 create mode 100644 arch/openrisc/include/asm/io.h
 create mode 100644 arch/openrisc/include/asm/openrisc_exc.h
 create mode 100644 arch/openrisc/include/asm/posix_types.h
 create mode 100644 arch/openrisc/include/asm/processor.h
 create mode 100644 arch/openrisc/include/asm/ptrace.h
 create mode 100644 arch/openrisc/include/asm/spr-defs.h
 create mode 100644 arch/openrisc/include/asm/string.h
 create mode 100644 arch/openrisc/include/asm/system.h
 create mode 100644 arch/openrisc/include/asm/types.h
 create mode 100644 arch/openrisc/include/asm/u-boot.h
 create mode 100644 arch/openrisc/include/asm/unaligned.h

diff --git a/arch/openrisc/include/asm/bitops.h 
b/arch/openrisc/include/asm/bitops.h
new file mode 100644
index 000..5d12a81
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops.h
@@ -0,0 +1,9 @@
+#ifndef __ASM_OPENRISC_BITOPS_H
+#define __ASM_OPENRISC_BITOPS_H
+
+#define PLATFORM_FLS
+#include asm/bitops/fls.h
+#define PLATFORM_FFS
+#include asm/bitops/ffs.h
+
+#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/arch/openrisc/include/asm/bitops/ffs.h 
b/arch/openrisc/include/asm/bitops/ffs.h
new file mode 100644
index 000..1de5295
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops/ffs.h
@@ -0,0 +1,26 @@
+/*
+ * OpenRISC Linux
+ *
+ * Copyright (C) 2010-2011 Jonas Bonn jo...@southpole.se
+ *
+ * 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.
+ */
+
+#ifndef __ASM_OPENRISC_FFS_H
+#define __ASM_OPENRISC_FFS_H
+
+static inline int ffs(int x)
+{
+   int ret;
+
+   __asm__ (l.ff1 %0,%1
+: =r (ret)
+: r (x));
+
+   return ret;
+}
+
+#endif /* __ASM_OPENRISC_FFS_H */
diff --git a/arch/openrisc/include/asm/bitops/fls.h 
b/arch/openrisc/include/asm/bitops/fls.h
new file mode 100644
index 000..8c77c13
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops/fls.h
@@ -0,0 +1,26 @@
+/*
+ * OpenRISC Linux
+ *
+ * Copyright (C) 2010-2011 Jonas Bonn jo...@southpole.se
+ *
+ * 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.
+ */
+
+#ifndef __ASM_OPENRISC_FLS_H
+#define __ASM_OPENRISC_FLS_H
+
+static inline int fls(int x)
+{
+   int ret;
+
+   __asm__ (l.fl1 %0,%1
+: =r (ret)
+: r (x));
+
+   return ret;
+}
+
+#endif /* __ASM_OPENRISC_FLS_H */
diff --git a/arch/openrisc/include/asm/byteorder.h 
b/arch/openrisc/include/asm/byteorder.h
new file mode 100644
index 000..082b83c
--- /dev/null
+++ b/arch/openrisc/include/asm/byteorder.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_OPENRISC_BYTEORDER_H
+#define __ASM_OPENRISC_BYTEORDER_H
+
+#include linux/byteorder/big_endian.h
+
+#endif /* __ASM_OPENRISC_BYTEORDER_H */
diff --git a/arch/openrisc/include/asm/cache.h 
b/arch/openrisc/include/asm/cache.h
new file mode 100644
index 000..a7d4b22
--- /dev/null
+++ b/arch/openrisc/include/asm/cache.h
@@ -0,0 +1,16 @@
+#ifndef __ASM_OPENRISC_CACHE_H_
+#define

[U-Boot] [PATCH 2/9] openrisc: Add architecture image support

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 common/image.c  |1 +
 include/image.h |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/common/image.c b/common/image.c
index 555d9d9..564dee1 100644
--- a/common/image.c
+++ b/common/image.c
@@ -94,6 +94,7 @@ static const table_entry_t uimage_arch[] = {
{   IH_ARCH_BLACKFIN,   blackfin, Blackfin, },
{   IH_ARCH_AVR32,  avr32,AVR32,},
{   IH_ARCH_NDS32,  nds32,NDS32,},
+   {   IH_ARCH_OPENRISC,   or1k, OpenRISC 1000,},
{   -1, , , },
 };
 
diff --git a/include/image.h b/include/image.h
index c56a18d..dffa3cd 100644
--- a/include/image.h
+++ b/include/image.h
@@ -108,6 +108,7 @@
 #define IH_ARCH_ST200  18  /* STMicroelectronics ST200  */
 #define IH_ARCH_SANDBOX19  /* Sandbox architecture (test 
only) */
 #define IH_ARCH_NDS32  19  /* ANDES Technology - NDS32  */
+#define IH_ARCH_OPENRISC21 /* OpenRISC 1000  */
 
 /*
  * Image Types
-- 
1.7.5.4

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


[U-Boot] [PATCH 3/9] openrisc: Add cpu files

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/config.mk|   27 
 arch/openrisc/cpu/Makefile |   47 ++
 arch/openrisc/cpu/cache.c  |  157 +++
 arch/openrisc/cpu/cpu.c|  157 +++
 arch/openrisc/cpu/exceptions.c |  109 +
 arch/openrisc/cpu/interrupts.c |  120 ++
 arch/openrisc/cpu/start.S  |  335 
 7 files changed, 952 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S

diff --git a/arch/openrisc/config.mk b/arch/openrisc/config.mk
new file mode 100644
index 000..bea3d12
--- /dev/null
+++ b/arch/openrisc/config.mk
@@ -0,0 +1,27 @@
+#
+# (C) Copyright 2011
+# Julius Baxter jul...@opencores.org
+#
+# 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
+#
+
+CROSS_COMPILE ?= or32-elf-
+
+# r10 used for global object pointer, already set in OR32 GCC but just to be
+# clear
+PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10
+
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x4
\ No newline at end of file
diff --git a/arch/openrisc/cpu/Makefile b/arch/openrisc/cpu/Makefile
new file mode 100644
index 000..b3b1a24
--- /dev/null
+++ b/arch/openrisc/cpu/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011
+# Julius Baxter jul...@opencores.org
+#
+# 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$(CPU).o
+
+START  = start.o
+COBJS-y= cache.o cpu.o exceptions.o interrupts.o
+
+SRCS   := $(START:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+START  := $(addprefix $(obj),$(START))
+
+all:   $(obj).depend $(START) $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/openrisc/cpu/cache.c b/arch/openrisc/cpu/cache.c
new file mode 100644
index 000..9dd627f
--- /dev/null
+++ b/arch/openrisc/cpu/cache.c
@@ -0,0 +1,157 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson stefan.kristians...@saunalahti.fi
+ * (C) Copyright 2011, Julius Baxter jul...@opencores.org
+ *
+ * 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 asm/system.h
+#include common.h
+
+/* cache line size can be either 16 or 32 bytes */
+static inline unsigned long get_linesize(void)
+{
+   return (mfspr(SPR_ICCFGR)  SPR_ICCFGR_CBS) ? 32 : 16;
+}
+
+void

[U-Boot] [PATCH 5/9] openrisc: Add board info printout to cmd_bdinfo

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 common/cmd_bdinfo.c |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 688b238..1cd69b5 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -460,6 +460,28 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 0;
 }
 
+#elif defined(CONFIG_OPENRISC)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   bd_t *bd = gd-bd;
+
+   print_num(mem start,  (ulong)bd-bi_memstart);
+   print_lnum(mem size,  (u64)bd-bi_memsize);
+   print_num(flash start,(ulong)bd-bi_flashstart);
+   print_num(flash size, (ulong)bd-bi_flashsize);
+   print_num(flash offset,   (ulong)bd-bi_flashoffset);
+
+#if defined(CONFIG_CMD_NET)
+   print_eth(0);
+   printf(ip_addr = %pI4\n, bd-bi_ip_addr);
+#endif
+
+   printf(baudrate= %ld bps\n, bd-bi_baudrate);
+
+   return 0;
+}
+
 #else
  #error a case for this architecture does not exist!
 #endif
-- 
1.7.5.4

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


[U-Boot] [PATCH 4/9] openrisc: Add library functions

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 arch/openrisc/lib/Makefile |   47 
 arch/openrisc/lib/board.c  |  175 
 arch/openrisc/lib/bootm.c  |   84 +
 arch/openrisc/lib/timer.c  |  104 ++
 4 files changed, 410 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/lib/Makefile
 create mode 100644 arch/openrisc/lib/board.c
 create mode 100644 arch/openrisc/lib/bootm.c
 create mode 100644 arch/openrisc/lib/timer.c

diff --git a/arch/openrisc/lib/Makefile b/arch/openrisc/lib/Makefile
new file mode 100644
index 000..db3c657
--- /dev/null
+++ b/arch/openrisc/lib/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2003-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$(ARCH).o
+
+SOBJS-y+=
+
+COBJS-y+= board.o
+COBJS-y+= bootm.o
+COBJS-y+= timer.o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS-y) $(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/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
new file mode 100644
index 000..b033031
--- /dev/null
+++ b/arch/openrisc/lib/board.c
@@ -0,0 +1,175 @@
+/*
+ * (C) Copyright 2011
+ * Julius Baxter, jul...@opencores.org
+ *
+ * (C) Copyright 2003, Psyent Corporation www.psyent.com
+ * Scott McNutt smcn...@psyent.com
+ *
+ * (C) Copyright 2000-2002
+ * 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 common.h
+#include stdio_dev.h
+#include watchdog.h
+#include malloc.h
+#include mmc.h
+#include net.h
+#ifdef CONFIG_STATUS_LED
+#include status_led.h
+#endif
+#ifdef CONFIG_CMD_NAND
+#include nand.h  /* cannot even include nand.h if it isnt configured */
+#endif
+
+#include timestamp.h
+#include version.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * All attempts to come up with a common initialization sequence
+ * that works for all boards and architectures failed: some of the
+ * requirements are just _too_ different. To get rid of the resulting
+ * mess of board dependend #ifdef'ed code we now make the whole
+ * initialization sequence configurable to the user.
+ *
+ * The requirements for any new initalization function is simple: it
+ * receives a pointer to the global data structure as it's only
+ * argument, and returns an integer return code, where 0 means
+ * continue and != 0 means fatal error, hang the system.
+ */
+
+extern int cache_init(void);
+extern int timer_init(void);
+
+typedef int (init_fnc_t)(void);
+
+/*
+ * Initialization sequence
+ */
+
+init_fnc_t *init_sequence[] = {
+   cache_init,
+   timer_init, /* initialize timer */
+   env_init,
+   serial_init,
+   console_init_f,
+   display_options,
+   checkcpu,
+   checkboard,
+   NULL,   /* Terminate this list */
+};
+
+
+/***/
+void board_init(void)
+{
+   bd_t *bd;
+   init_fnc_t

[U-Boot] [PATCH 6/9] openrisc: Add support for standalone programs

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 examples/standalone/stubs.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 11c7565..8b291db 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -180,6 +180,20 @@ gd_t *global_data;
   lwi $r16, [$r16 + (%1)]\n  \
   jr  $r16\n \
: : i(offsetof(gd_t, jt)), i(XF_ ## x * sizeof(void *)) : $r16);
+#elif defined(CONFIG_OPENRISC)
+/*
+ * r10 holds the pointer to the global_data, r13 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+   asm volatile (  \
+  .globl  #x \n\
+#x :\n   \
+  l.lwz   r13, %0(r10)\n \
+  l.lwz   r13, %1(r13)\n \
+  l.jrr13\n  \
+  l.nop\n\
+   : : i(offsetof(gd_t, jt)), i(XF_ ## x * sizeof(void *)) : r13);
 #else
 /*addi$sp, $sp, -24\n\
   br  $r16\n \*/
-- 
1.7.5.4

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


[U-Boot] [PATCH 9/9] openrisc: Add MAINTAINERS entry

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 MAINTAINERS |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f6f6b72..bf144cc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1147,5 +1147,16 @@ Macpaul Lin macp...@andestech.com
ADP-AG101P  N1213 (AG101P XC5 FPGA)
 
 #
+# OpenRISC Systems:#
+#  #
+# Maintainer Name, Email Address   #
+#  Board   CPU #
+#
+
+Stefan Kristiansson stefan.kristians...@saunalahti.fi
+
+   openrisc-genericOpenRISC
+
+#
 # End of MAINTAINERS list  #
 #
-- 
1.7.5.4

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


[U-Boot] [PATCH 8/9] openrisc: Add architecture to MAKEALL

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 MAKEALL |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 95b7cd3..f45f767 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -416,6 +416,11 @@ LIST_mips_el= \
${LIST_mips5kc_el}  \
${LIST_au1xx0_el}   \
 
+#
+## OpenRISC Systems
+#
+
+LIST_openrisc=$(boards_by_arch openrisc)
 
 #
 ## x86 Systems
-- 
1.7.5.4

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


[U-Boot] [PATCH 7/9] openrisc: Add openrisc-generic example board

2011-11-18 Thread Stefan Kristiansson
Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 board/openrisc/openrisc-generic/Makefile   |   43 +
 board/openrisc/openrisc-generic/config.mk  |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg|  882 
 board/openrisc/openrisc-generic/u-boot.lds |   75 ++
 boards.cfg |1 +
 include/configs/openrisc-generic.h |  159 
 7 files changed, 1239 insertions(+), 0 deletions(-)
 create mode 100644 board/openrisc/openrisc-generic/Makefile
 create mode 100644 board/openrisc/openrisc-generic/config.mk
 create mode 100644 board/openrisc/openrisc-generic/openrisc-generic.c
 create mode 100644 board/openrisc/openrisc-generic/or1ksim.cfg
 create mode 100644 board/openrisc/openrisc-generic/u-boot.lds
 create mode 100644 include/configs/openrisc-generic.h

diff --git a/board/openrisc/openrisc-generic/Makefile 
b/board/openrisc/openrisc-generic/Makefile
new file mode 100644
index 000..4890aac
--- /dev/null
+++ b/board/openrisc/openrisc-generic/Makefile
@@ -0,0 +1,43 @@
+#
+# (C) Copyright 2001-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).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/openrisc/openrisc-generic/config.mk 
b/board/openrisc/openrisc-generic/config.mk
new file mode 100644
index 000..c3dc232
--- /dev/null
+++ b/board/openrisc/openrisc-generic/config.mk
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2011, Julius Baxter jul...@opencores.org
+#
+# 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
+#
+
+PLATFORM_CPPFLAGS += -mhard-mul -mhard-div
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
diff --git a/board/openrisc/openrisc-generic/openrisc-generic.c 
b/board/openrisc/openrisc-generic/openrisc-generic.c
new file mode 100644
index 000..cdbbfa5
--- /dev/null
+++ b/board/openrisc/openrisc-generic/openrisc-generic.c
@@ -0,0 +1,55 @@
+/*
+ * Based on nios2-generic.c:
+ * (C) Copyright 2005, Psyent Corporation www.psyent.com
+ * Scott McNutt smcn...@psyent.com
+ * (C) Copyright 2010, Thomas Chou tho...@wytron.com.tw
+ *
+ * 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 netdev.h
+
+int board_early_init_f(void

Re: [U-Boot] [PATCH 0/9] Add support for the OpenRISC architecture

2011-11-18 Thread Stefan Kristiansson
On Sat, Nov 19, 2011 at 01:07:16AM -0500, Mike Frysinger wrote:
 On Saturday 19 November 2011 00:21:29 Stefan Kristiansson wrote:
  This patch series adds support for the OpenRISC 1000 architecture.
 
 do you have a toolchain we can use to build this ?

Yes, instructions how to obtain and build it are
available here: http://opencores.org/or1k/OpenRISC_GNU_tool_chain

Thanks a lot for your review of the individual patches,
I'll incorparate your suggestions in v2.

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


[U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead of flush_dcache

2011-11-04 Thread Stefan Kristiansson
flush_dcache is not declared in the common.h API,
flush_dcache_range however is

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
Cc: Ben Warren biggerbadder...@gmail.com
Cc: Thomas Chou tho...@wytron.com.tw
---
 drivers/net/ethoc.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 7ac9025..cb79753 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -272,7 +272,7 @@ static int ethoc_init_ring(struct eth_device *dev)
if (i == priv-num_rx - 1)
bd.stat |= RX_BD_WRAP;
 
-   flush_dcache(bd.addr, PKTSIZE_ALIGN);
+   flush_dcache_range(bd.addr, bd.addr + PKTSIZE_ALIGN);
ethoc_write_bd(dev, priv-num_tx + i, bd);
}
 
@@ -377,7 +377,7 @@ static int ethoc_rx(struct eth_device *dev, int limit)
}
 
/* clear the buffer descriptor so it can be reused */
-   flush_dcache(bd.addr, PKTSIZE_ALIGN);
+   flush_dcache_range(bd.addr, bd.addr + PKTSIZE_ALIGN);
bd.stat = ~RX_BD_STATS;
bd.stat |= RX_BD_EMPTY;
ethoc_write_bd(dev, entry, bd);
@@ -431,7 +431,7 @@ static int ethoc_send(struct eth_device *dev, volatile void 
*packet, int length)
bd.stat = ~TX_BD_PAD;
bd.addr = (u32)packet;
 
-   flush_dcache(bd.addr, length);
+   flush_dcache_range(bd.addr, bd.addr + length);
bd.stat = ~(TX_BD_STATS | TX_BD_LEN_MASK);
bd.stat |= TX_BD_LEN(length);
ethoc_write_bd(dev, entry, bd);
-- 
1.7.5.4

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


[U-Boot] [PATCH 0/3] Fix conflicting definitions of flush_dcache

2011-11-04 Thread Stefan Kristiansson
nios2 and a couple of network drivers have been using
a non defined API to flush the data cache (flush_dcache(ulong, ulong)), this is
problematic since it conflicts with other architectures definitions of 
flush_dcache.

This series cleans that up by letting the two network drivers use
the defined flush_dcache_range(ulong, ulong) API.
It also adds this function to the nios2 architecture to avoid breakage.

Stefan Kristiansson (3):
  net/ethoc: use flush_dcache_range instead of flush_dcache
  net/altera_tse: use flush_dcache_range instead of flush_dcache
  nios2: add flush_dcache_range function

 arch/nios2/lib/cache.S   |   10 ++
 drivers/net/altera_tse.c |9 ++---
 drivers/net/ethoc.c  |6 +++---
 3 files changed, 19 insertions(+), 6 deletions(-)

-- 
1.7.5.4

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


[U-Boot] [PATCH 2/3] net/altera_tse: use flush_dcache_range instead of flush_dcache

2011-11-04 Thread Stefan Kristiansson
flush_dcache is not declared in the common.h API,
flush_dcache_range however is

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
Cc: Ben Warren biggerbadder...@gmail.com
Cc: Thomas Chou tho...@wytron.com.tw
---
 drivers/net/altera_tse.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 5b00717..0e6aac7 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -268,7 +268,8 @@ static int tse_eth_send(struct eth_device *dev,
volatile struct alt_sgdma_descriptor *tx_desc_cur =
(volatile struct alt_sgdma_descriptor *)tx_desc[0];
 
-   flush_dcache((unsigned long)packet, length);
+   flush_dcache_range((unsigned long)packet,
+   (unsigned long)packet + length);
alt_sgdma_construct_descriptor_burst(
(volatile struct alt_sgdma_descriptor *)tx_desc[0],
(volatile struct alt_sgdma_descriptor *)tx_desc[1],
@@ -306,7 +307,8 @@ static int tse_eth_rx(struct eth_device *dev)
NetReceive(NetRxPackets[0], packet_length);
 
/* start descriptor again */
-   flush_dcache((unsigned long)(NetRxPackets[0]), PKTSIZE_ALIGN);
+   flush_dcache_range((unsigned long)(NetRxPackets[0]),
+   (unsigned long)(NetRxPackets[0]) + PKTSIZE_ALIGN);
alt_sgdma_construct_descriptor_burst(
(volatile struct alt_sgdma_descriptor *)rx_desc[0],
(volatile struct alt_sgdma_descriptor *)rx_desc[1],
@@ -834,7 +836,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)
0x0 /* channel */
);
debug(Configuring rx desc\n);
-   flush_dcache((unsigned long)(NetRxPackets[0]), PKTSIZE_ALIGN);
+   flush_dcache_range((unsigned long)(NetRxPackets[0]),
+   (unsigned long)(NetRxPackets[0]) + PKTSIZE_ALIGN);
alt_sgdma_construct_descriptor_burst(
(volatile struct alt_sgdma_descriptor *)rx_desc[0],
(volatile struct alt_sgdma_descriptor *)rx_desc[1],
-- 
1.7.5.4

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


[U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function

2011-11-04 Thread Stefan Kristiansson
exposes functionality to flush dcache according to
the common.h API

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
Cc: Thomas Chou tho...@wytron.com.tw
---
 arch/nios2/lib/cache.S |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/nios2/lib/cache.S b/arch/nios2/lib/cache.S
index ee3b4b7..b952d0c 100644
--- a/arch/nios2/lib/cache.S
+++ b/arch/nios2/lib/cache.S
@@ -48,6 +48,16 @@ flush_icache:
bltur4, r5, 1b
ret
 
+   .global flush_dcache_range
+
+flush_dcache_range:
+   movhi   r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
+   ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
+0: flushd  0(r4)
+   add r4, r4, r8
+   bltur4, r5, 0b
+   ret
+
.global flush_cache
 
 flush_cache:
-- 
1.7.5.4

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


[U-Boot] Conflicting definitions of flush_dcache

2011-10-31 Thread Stefan Kristiansson
Hi,

I noticed the following dilemma when I tried to enable both
CONFIG_ETHOC and CONFIG_CMD_CACHE:

The ethoc ethernet driver expects:
void flush_dcache(unsigned long start, unsigned long size)
while cmd_cache.c expect it to be:
void flush_dcache(void)

Grepping around the sources, I found that apart from drivers/net/ethoc.c
also drivers/net/altera_tse.c uses flush_dcache with the two ulong parameters.
No architecture apart from nios2 seems to provide flush_dcache like this
and flush_dcache is not declared in common.h,
so my gut feeling is that nios2 and the 2 ethernet drivers should be
changed to use for example flush_dcache_range(?)
Perhaps cmd_cache.c should also be fixed to use flush_dcache_all()?
flush_icache() ofcourse suffer from the same problem.

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


[U-Boot] [PATCH] cmd_cache: use cache/invalidate functions available in common.h

2011-10-31 Thread Stefan Kristiansson
flush_dcache()/flush_icache() aren't defined in common.h,
flush_dcache_all()/invalidate_icache_all() however are.

Let the icache and dcache commands use those instead.

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 common/cmd_cache.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index 9778d3b..360136c 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -30,10 +30,10 @@
 
 static int parse_argv(const char *);
 
-void __weak flush_icache(void)
+void __weak invalidate_icache_all(void)
 {
-   /* please define arch specific flush_icache */
-   puts(No arch specific flush_icache available!\n);
+   /* please define arch specific invalidate_icache_all */
+   puts(No arch specific invalidate_icache_all available!\n);
 }
 
 int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -45,7 +45,7 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
break;
case 1: icache_enable ();
break;
-   case 2: flush_icache();
+   case 2: invalidate_icache_all();
break;
}
/* FALL TROUGH */
@@ -59,10 +59,10 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
return 0;
 }
 
-void __weak flush_dcache(void)
+void __weak flush_dcache_all(void)
 {
-   puts(No arch specific flush_dcache available!\n);
-   /* please define arch specific flush_dcache */
+   puts(No arch specific flush_dcache_all available!\n);
+   /* please define arch specific flush_dcache_all */
 }
 
 int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -74,7 +74,7 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
break;
case 1: dcache_enable ();
break;
-   case 2: flush_dcache();
+   case 2: flush_dcache_all();
break;
}
/* FALL TROUGH */
-- 
1.7.5.4

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


[U-Boot] [PATCH] usb: align usb_endpoint_descriptor to 16-bit boundary

2011-10-20 Thread Stefan Kristiansson
The usb_endpoint_descriptor struct is 7 bytes large and is
defined as an array (ep_desc[USB_MAXENDPOINTS])
in the usb_interface struct in include/usb.h

This fact will result in that every odd index in that
array will start at an uneven address, this in
turn makes accesses to u16 wMaxPacketSize unaligned.
Such accesses are illegal on the OpenRISC architecture
(as well as other architectures) and will render a bus error.

Setting the aligned(2) attribute on usb_endpoint_descriptor
will force wMaxPacketSize to a 16-bit boundary.

Signed-off-by: Stefan Kristiansson stefan.kristians...@saunalahti.fi
---
 include/usbdescriptors.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/usbdescriptors.h b/include/usbdescriptors.h
index 2dec3b9..392fcf5 100644
--- a/include/usbdescriptors.h
+++ b/include/usbdescriptors.h
@@ -199,7 +199,7 @@ struct usb_endpoint_descriptor {
u8 bmAttributes;
u16 wMaxPacketSize;
u8 bInterval;
-} __attribute__ ((packed));
+} __attribute__ ((packed)) __attribute__ ((aligned(2)));
 
 struct usb_interface_descriptor {
u8 bLength;
-- 
1.7.5.4

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