Skip to contentSkip to conversation

SPARC: Added support for SPARC/LEON2 and SPARC/LEON3 processors

PATCH New Daniel Hellstrom 2 participants 2 messages Mar 13, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 3/8 SPARC: Added support for SPARC/LEON2 and SPARC/LEON3 processors

This patch adds support for SPARC/LEON2 and SPARC/LEON3 to U-Boot. LEON2/3 boards are added with an extra patch, this patch must be applied first (before 8_sparc_boards.patch).

This patch does not support LEON3 SMP system.

Linux for SPARC assumes that there is a Sun Boot prom available. The boot prom is used as monitor to support basic features such as rebooting, printing to the system console (serial terminal in the LEON case) and getting information about the hardware (baudrate, main memory etc.). So, in order to boot SPARC Linux on LEON a standard boot prom is emulated. This is done in cpu/leon?/prom.c.
The boot prom must be placed at a higher address that the stack to avoid that it gets overwritten.

Some chip designs has UHCI and EHI USB. UHCI has been implemented for U-Boot on LEON3 systems.

LEON3 processors is on an extended AMBA bus (with Plug&Play support), whereas LEON2 uses hardcoded addresses since it is on an AMBA bus without Plug&Play.

ABOUT LEON3 and GRLIB
---------------------
LEON3 is an open source (GPL) SPARC V7 and/or V8 processor part of GRLIB. GRLIB is a free comprehensive open source (GPL) Portable IP library (written in
VHDL) featuring cores such as Ethernet 10/100/1000, SpaceWire, PCI, CAN, 1553,
I2C, USB 1.1 and 2.0, SPI, DMA ATA, SVGA, PS/2, UART, Timer, SDRAM, SRAM, SSRAM,
DDR, DDR2, FLASH/PROM, CPU Debug Unit, FPU, GPIO and many more. More info available
at www.gaisler.com.

ABOUT SPARC-ELF COMPILER
------------------------
Compiling u-boot for LEON3 and LEON2 has only been has only been tested with GCC
3.4.4 compiler with added LEON2 and LEON3 support available from www.gaisler.com or ftp://ftp.gaisler.com/gaisler.com/bcc/bin/linux/sparc-elf-3.4.4-1.0.30.tar.bz2,

installation instructions can be found in bcc/doc/bcc.pdf. (extract to /opt/ and
add /opt/sparc-elf-3.4.4/bin to PATH).

U-BOOT support tested
---------------------
- LEON3 (and LEON3FT Fault tolerant version)
- LEON3 Simmulator (GRSIM and TSIM)
- LEON2 Simmulator (GRSIM and TSIM)
- Network (GRETH and SMC91111 and USB)
- USB 1.1 (UHCI)
- Linux and RTEMS booting
- booting UBOOT from RAM and FLASH by changing board/gaisler/xxx/config.mk
- DDR, DDR2, SRAM, FT-SRAM
- UART, IRQ, Timer

Best Regards,
Daniel Hellstrom

 MAKEALL                         |    7 +
 Makefile                        |   16 +-
 README                          |    3 +
 cpu/leon2/Makefile              |   54 ++
 cpu/leon2/config.mk             |   26 +
 cpu/leon2/cpu.c                 |   59 ++
 cpu/leon2/cpu_init.c            |  133 ++++
 cpu/leon2/interrupts.c          |  219 +++++++
 cpu/leon2/prom.c                | 1062 ++++++++++++++++++++++++++++++++
 cpu/leon2/serial.c              |  138 +++++
 cpu/leon2/start.S               |  657 ++++++++++++++++++++
 cpu/leon3/Makefile              |   54 ++
 cpu/leon3/ambapp.c              |  380 ++++++++++++
 cpu/leon3/config.mk             |   26 +
 cpu/leon3/cpu.c                 |   60 ++
 cpu/leon3/cpu_init.c            |  257 ++++++++
 cpu/leon3/interrupts.c          |  222 +++++++
 cpu/leon3/prom.c                | 1099 +++++++++++++++++++++++++++++++++
 cpu/leon3/serial.c              |  145 +++++
 cpu/leon3/start.S               |  616 +++++++++++++++++++
 cpu/leon3/usb_uhci.c            | 1275 
+++++++++++++++++++++++++++++++++++++++
 cpu/leon3/usb_uhci.h            |  184 ++++++
 examples/Makefile               |    3 +
 examples/sparc.lds              |   61 ++
 examples/stubs.c                |   16 +
 include/asm-sparc/asi.h         |  137 +++++
 include/asm-sparc/asmmacro.h    |   45 ++
 include/asm-sparc/atomic.h      |   29 +
 include/asm-sparc/bitops.h      |   32 +
 include/asm-sparc/byteorder.h   |   35 ++
 include/asm-sparc/cache.h       |  113 ++++
 include/asm-sparc/errno.h       |  162 +++++
 include/asm-sparc/global_data.h |   97 +++
 include/asm-sparc/io.h          |   95 +++
 include/asm-sparc/irq.h         |   43 ++
 include/asm-sparc/leon.h        |   37 ++
 include/asm-sparc/leon2.h       |  237 ++++++++
 include/asm-sparc/leon3.h       |   40 ++
 include/asm-sparc/machines.h    |   92 +++
 include/asm-sparc/page.h        |   43 ++
 include/asm-sparc/posix_types.h |  134 ++++
 include/asm-sparc/processor.h   |  118 ++++
 include/asm-sparc/prom.h        |  300 +++++++++
 include/asm-sparc/psr.h         |  109 ++++
 include/asm-sparc/ptrace.h      |  181 ++++++
 include/asm-sparc/srmmu.h       |  311 ++++++++++
 include/asm-sparc/stack.h       |  163 +++++
 include/asm-sparc/string.h      |   55 ++
 include/asm-sparc/types.h       |   71 +++
 include/asm-sparc/u-boot.h      |   74 +++
 include/asm-sparc/winmacro.h    |  151 +++++
 lib_sparc/Makefile              |   45 ++
 lib_sparc/board.c               |  525 ++++++++++++++++
 lib_sparc/cache.c               |   33 +
 lib_sparc/interrupts.c          |  119 ++++
 lib_sparc/sparc_linux.c         |  229 +++++++
 lib_sparc/time.c                |   77 +++
 sparc_config.mk                 |   24 +
 58 files changed, 10727 insertions(+), 1 deletions(-)

The patch is larger than 40Kb, you can find it at ftp://ftp.gaisler.com/gaisler.com/u-boot/patches/3_sparc.patch

#1 lore raw

PATCH 3/8 SPARC: Added support for SPARC/LEON2 and SPARC/LEON3 processors

Quoted 3 lines · In message <[email protected]> you wrote:

This patch adds support for SPARC/LEON2 and SPARC/LEON3 to U-Boot. LEON2/3 boards are added with an extra patch, this patch must be applied first (before 8_sparc_boards.patch).

All your code needs a major coding style cleanup.

There are tons of trailing white spaces, indenation is not in columns of 8 and not by TAB, etc. etc.

Also, please mind the white space policy for "if", "while" etc. constructs.

I recommend to use lindent on your code before resubmitting it.

Quoted 13 lines
 Makefile                        |   16 +-
 README                          |    3 +
 cpu/leon2/Makefile              |   54 ++
 cpu/leon2/config.mk             |   26 +
 cpu/leon2/cpu.c                 |   59 ++
 cpu/leon2/cpu_init.c            |  133 ++++
 cpu/leon2/interrupts.c          |  219 +++++++
 cpu/leon2/prom.c                | 1062 ++++++++++++++++++++++++++++++++
 cpu/leon2/serial.c              |  138 +++++
 cpu/leon2/start.S               |  657 ++++++++++++++++++++
 cpu/leon3/Makefile              |   54 ++
 cpu/leon3/ambapp.c              |  380 ++++++++++++
 cpu/leon3/config.mk             |   26 +
Quoted 8 lines
 cpu/leon3/cpu.c                 |   60 ++
 cpu/leon3/cpu_init.c            |  257 ++++++++
 cpu/leon3/interrupts.c          |  222 +++++++
 cpu/leon3/prom.c                | 1099 +++++++++++++++++++++++++++++++++
 cpu/leon3/serial.c              |  145 +++++
 cpu/leon3/start.S               |  616 +++++++++++++++++++
 cpu/leon3/usb_uhci.c            | 1275 +++++++++++++++++++++++++++++++++++++++
 cpu/leon3/usb_uhci.h            |  184 ++++++

I recommend to split this into separate patcehs, one for leon2, another one for leon3...

Quoted 28 lines
 examples/Makefile               |    3 +
 examples/sparc.lds              |   61 ++
 examples/stubs.c                |   16 +
 include/asm-sparc/asi.h         |  137 +++++
 include/asm-sparc/asmmacro.h    |   45 ++
 include/asm-sparc/atomic.h      |   29 +
 include/asm-sparc/bitops.h      |   32 +
 include/asm-sparc/byteorder.h   |   35 ++
 include/asm-sparc/cache.h       |  113 ++++
 include/asm-sparc/errno.h       |  162 +++++
 include/asm-sparc/global_data.h |   97 +++
 include/asm-sparc/io.h          |   95 +++
 include/asm-sparc/irq.h         |   43 ++
 include/asm-sparc/leon.h        |   37 ++
 include/asm-sparc/leon2.h       |  237 ++++++++
 include/asm-sparc/leon3.h       |   40 ++
 include/asm-sparc/machines.h    |   92 +++
 include/asm-sparc/page.h        |   43 ++
 include/asm-sparc/posix_types.h |  134 ++++
 include/asm-sparc/processor.h   |  118 ++++
 include/asm-sparc/prom.h        |  300 +++++++++
 include/asm-sparc/psr.h         |  109 ++++
 include/asm-sparc/ptrace.h      |  181 ++++++
 include/asm-sparc/srmmu.h       |  311 ++++++++++
 include/asm-sparc/stack.h       |  163 +++++
 include/asm-sparc/string.h      |   55 ++
 include/asm-sparc/types.h       |   71 +++
 include/asm-sparc/u-boot.h      |   74 +++
Quoted 8 lines
 include/asm-sparc/winmacro.h    |  151 +++++
 lib_sparc/Makefile              |   45 ++
 lib_sparc/board.c               |  525 ++++++++++++++++
 lib_sparc/cache.c               |   33 +
 lib_sparc/interrupts.c          |  119 ++++
 lib_sparc/sparc_linux.c         |  229 +++++++
 lib_sparc/time.c                |   77 +++
 sparc_config.mk                 |   24 +

...a 3rd one for the header siles, and a 4th one for the lib_sparc and examples code.

Quoted 2 lines

The patch is larger than 40Kb, you can find it at ftp://ftp.gaisler.com/gaisler.com/u-boot/patches/3_sparc.patch

Given above split, you should be able to make it fit into the 100 kB hard limit.

Best regards,

Wolfgang Denk

Signature · 6 lines
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: wd at denx.de
[Doctors and Bartenders], We both get the same two kinds of customers
-- the living and the dying.
	-- Dr. Boyce, "The Menagerie" ("The Cage"), stardate unknown