Skip to contentSkip to conversation

sparc: Updates to SPARC architecture in preperation for generic board

PATCH Superseded Francois Retief 2 participants 14 messages Nov 3, 2015 – Nov 12, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover sparc: Updates to SPARC architecture in preperation for generic board

This patch series is a backlog of preparation work for upcomming generic board changes.

I first want to get these reviewed and submitted to mainline before sending out more patches.

Daniel Hellstrom (4):
sparc: leon3: Reimplemented AMBA Plug&Play scanning routines.
sparc: leon3: Added memory controller initialization using new AMBA
PnP routines.
sparc: leon3: Moved GRLIB core header files to common include/grlib
directory
sparc: ambapp: Removed warning and unnecessary printout.

Francois Retief (8):
sparc: Fix broken files during license changes
sparc: Update the maintainer for SPARC architecture
sparc: Add -mcpu= compiler flags for LEON2/LEON3
sparc: Update LEON serial drivers to use readl/writel macros
sparc: Update GRSIM board with memory settings for TSIM eval
sparc: Update startup code to take PIC mode into account
sparc: Kconfig: Move the CMD_AMBAPP command to Kconfig
sparc: leon3: Add debug_uart support to LEON3 serial driver.

 MAINTAINERS                          |   2 +-
 arch/sparc/config.mk                 |  14 +-
 arch/sparc/cpu/leon2/serial.c        | 125 +++---
 arch/sparc/cpu/leon2/start.S         |  60 ++-
 arch/sparc/cpu/leon3/Makefile        |   3 +-
 arch/sparc/cpu/leon3/ambapp.c        | 545 ++++++++++++------------
 arch/sparc/cpu/leon3/ambapp_low.S    | 784 +++++++++++++++++++++++++++++++++++
 arch/sparc/cpu/leon3/ambapp_low_c.S  | 113 +++++
 arch/sparc/cpu/leon3/cpu_init.c      | 199 +++------
 arch/sparc/cpu/leon3/interrupts.c    |   7 +-
 arch/sparc/cpu/leon3/memcfg.c        | 237 +++++++++++
 arch/sparc/cpu/leon3/memcfg.h        |  90 ++++
 arch/sparc/cpu/leon3/memcfg_low.S    | 253 +++++++++++
 arch/sparc/cpu/leon3/prom.c          |  12 +-
 arch/sparc/cpu/leon3/serial.c        | 130 ++++--
 arch/sparc/cpu/leon3/start.S         | 102 ++++-
 arch/sparc/cpu/leon3/usb_uhci.c      |   4 +-
 arch/sparc/include/asm/global_data.h |   1 +
 arch/sparc/include/asm/io.h          |  64 +--
 arch/sparc/include/asm/winmacro.h    | 127 ------
 common/Kconfig                       |  14 +
 common/board_r.c                     |  21 +
 common/cmd_ambapp.c                  | 559 +++++++++++++++++++------
 configs/grsim_defconfig              |   6 +
 drivers/net/greth.c                  |  17 +-
 drivers/serial/Kconfig               |   8 +
 include/ambapp.h                     | 488 ++++++++--------------
 include/ambapp_ids.h                 | 250 +++++++++++
 include/config_cmd_all.h             |   1 -
 include/configs/gr_cpci_ax2000.h     |  35 +-
 include/configs/gr_ep2s60.h          |  40 +-
 include/configs/gr_xc3s_1500.h       |  31 +-
 include/configs/grsim.h              |  88 ++--
 include/configs/grsim_leon2.h        |   5 -
 include/grlib/apbuart.h              |  47 +++
 include/grlib/gptimer.h              |  34 ++
 include/grlib/greth.h                |  87 ++++
 include/grlib/irqmp.h                |  23 +
 38 files changed, 3354 insertions(+), 1272 deletions(-)
 create mode 100644 arch/sparc/cpu/leon3/ambapp_low.S
 create mode 100644 arch/sparc/cpu/leon3/ambapp_low_c.S
 create mode 100644 arch/sparc/cpu/leon3/memcfg.c
 create mode 100644 arch/sparc/cpu/leon3/memcfg.h
 create mode 100644 arch/sparc/cpu/leon3/memcfg_low.S
 create mode 100644 include/ambapp_ids.h
 create mode 100644 include/grlib/apbuart.h
 create mode 100644 include/grlib/gptimer.h
 create mode 100644 include/grlib/greth.h
 create mode 100644 include/grlib/irqmp.h

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#1 lore raw

PATCH 1/12 sparc: Fix broken files during license changes

From: Francois Retief <[email protected]>

Fixes broken search and replaced license changes in files cpu/leon3/start.S and include/asm/winmacro.h from commit 1a4596601fd395f3afb8f82f3f840c5e00bdd57a

---

 arch/sparc/cpu/leon3/start.S      |   3 -
 arch/sparc/include/asm/winmacro.h | 127 --------------------------------------
 2 files changed, 130 deletions(-)
arch/sparc/cpu/leon3/start.S +0 -3
index cf897f6..5f904fa 100644
@@ -2,9 +2,6 @@
  * Copyright (C) 2007,
  * Daniel Hellstrom, daniel at gaisler.com
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
arch/sparc/include/asm/winmacro.h +0 -127

130 lines not on this page · raw message

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#2 lore raw

PATCH 2/12 sparc: Update the maintainer for SPARC architecture

In reply to Francois Retief

---

 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index bf60c67..b3a45cc 100644
@@ -370,7 +370,7 @@ T:  git git://git.denx.de/u-boot-sh.git
 F:     arch/sh/
 
 SPARC
-M:     Daniel Hellstrom <[email protected]>
+M:     Francois Retief <[email protected]>
 S:     Maintained
 T:     git git://git.denx.de/u-boot-sparc.git
 F:     arch/sparc/

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#3 lore raw

PATCH 3/12 sparc: Add -mcpu= compiler flags for LEON2/LEON3

In reply to Francois Retief

---

 arch/sparc/config.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
arch/sparc/config.mk +10 -4
index d615f29..43faad4 100644
@@ -1,19 +1,25 @@
 #
-# (C) Copyright 2007
-# Daniel Hellstrom, Gaisler Research, daniel at gaisler.com
+# (C) Copyright 2015
+# Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com.
 #
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
 ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := sparc-elf-
+CROSS_COMPILE := sparc-linux-
 endif
 
+# This GCC compiler is known to work:
+#  https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/
+
 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \
                               -T $(srctree)/examples/standalone/sparc.lds
 
-PLATFORM_CPPFLAGS += -D__sparc__
+cpuflags-$(CONFIG_LEON2) := -mcpu=leon
+cpuflags-$(CONFIG_LEON3) := -mcpu=leon3
+
+PLATFORM_CPPFLAGS += $(cpuflags-y)
 
 PLATFORM_RELFLAGS += -fPIC

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#4 lore raw

PATCH 4/12 sparc: Update LEON serial drivers to use readl/writel macros

In reply to Francois Retief

Update the LEON2/3 serial driver to make use of the readl and writel macros as well as the WATCHDOG_RESET() macro.

Add readl/writel and friends to the asm/io.h file.

Introduce the gd->arch.uart variable to store register address.

Lastly, remove baudrate scaler macro variables from board config. It is now calculated in the serial driver using the global data variable.

---

 arch/sparc/cpu/leon2/serial.c        | 125 +++++++++++++++++------------------
 arch/sparc/cpu/leon3/prom.c          |   5 +-
 arch/sparc/cpu/leon3/serial.c        | 100 ++++++++++++++++------------
 arch/sparc/include/asm/global_data.h |   1 +
 arch/sparc/include/asm/io.h          |  64 ++++++++++--------
 include/configs/gr_cpci_ax2000.h     |   4 --
 include/configs/gr_ep2s60.h          |   4 --
 include/configs/gr_xc3s_1500.h       |   4 --
 include/configs/grsim.h              |   3 -
 include/configs/grsim_leon2.h        |   5 --
 10 files changed, 157 insertions(+), 158 deletions(-)
arch/sparc/cpu/leon2/serial.c +59 -66
index 5cfbb9e..603364e 100644
@@ -1,72 +1,78 @@
 /* GRLIB APBUART Serial controller driver
  *
- * (C) Copyright 2008
- * Daniel Hellstrom, Gaisler Research, daniel at gaisler.com.
+ * (C) Copyright 2008, 2015
+ * Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com.
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/processor.h>
-#include <asm/leon.h>
+#include <asm/io.h>
 #include <serial.h>
-#include <linux/compiler.h>
+#include <watchdog.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static unsigned leon2_serial_calc_scaler(unsigned freq, unsigned baud)
+{
+       return (((freq*10) / (baud*8)) - 5) / 10;
+}
+
 static int leon2_serial_init(void)
 {
-       LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
+       LEON2_regs *leon2 = (LEON2_regs *)LEON2_PREGS;
        LEON2_Uart_regs *regs;
        unsigned int tmp;
 
-       /* Init LEON2 UART
-        *
-        * Set scaler / baud rate
-        *
-        * Receiver & transmitter enable
-        */
 #if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
+       regs = (LEON2_Uart_regs *)&leon2->UART_Channel_1;
 #else
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
+       regs = (LEON2_Uart_regs *)&leon2->UART_Channel_2;
 #endif
 
-       regs->UART_Scaler = CONFIG_SYS_LEON2_UART1_SCALER;
+       /* Set scaler / baud rate */
+       tmp = leon2_serial_calc_scaler(CONFIG_SYS_CLK_FREQ, CONFIG_BAUDRATE);
+       writel(tmp, &regs->UART_Scaler);
 
        /* Let bit 11 be unchanged (debug bit for GRMON) */
-       tmp = READ_WORD(regs->UART_Control);
+       tmp = readl(&regs->UART_Control) & LEON2_UART_CTRL_DBG;
+       tmp |= (LEON2_UART1_LOOPBACK_ENABLE << 7);
+       tmp |= (LEON2_UART1_FLOWCTRL_ENABLE << 6);
+       tmp |= (LEON2_UART1_PARITY_ENABLE << 5);
+       tmp |= (LEON2_UART1_ODDPAR_ENABLE << 4);
+       /* Receiver & transmitter enable */
+       tmp |= (LEON2_UART_CTRL_RE | LEON2_UART_CTRL_TE);
+       writel(tmp, &regs->UART_Control);
+
+       gd->arch.uart = regs;
+       return 0;
+}
 
-       regs->UART_Control = ((tmp & LEON2_UART_CTRL_DBG) |
-                             (LEON2_UART1_LOOPBACK_ENABLE << 7) |
-                             (LEON2_UART1_FLOWCTRL_ENABLE << 6) |
-                             (LEON2_UART1_PARITY_ENABLE << 5) |
-                             (LEON2_UART1_ODDPAR_ENABLE << 4) |
-                             LEON2_UART_CTRL_RE | LEON2_UART_CTRL_TE);
+static inline LEON2_Uart_regs *leon2_get_uart_regs(void)
+{
+       LEON2_Uart_regs *uart = gd->arch.uart;
 
-       return 0;
+       return uart;
 }
 
 static void leon2_serial_putc_raw(const char c)
 {
-       LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
-       LEON2_Uart_regs *regs;
+       LEON2_Uart_regs *uart = leon2_get_uart_regs();
 
-#if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
-#else
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
-#endif
+       if (!uart)
+               return;
 
        /* Wait for last character to go. */
-       while (!(READ_WORD(regs->UART_Status) & LEON2_UART_STAT_THE)) ;
+       while (!(readl(&uart->UART_Status) & LEON2_UART_STAT_THE))
+               WATCHDOG_RESET();
 
        /* Send data */
-       regs->UART_Channel = c;
+       writel(c, &uart->UART_Channel);
 
 #ifdef LEON_DEBUG
        /* Wait for data to be sent */
-       while (!(READ_WORD(regs->UART_Status) & LEON2_UART_STAT_TSE)) ;
+       while (!(readl(&uart->UART_Status) & LEON2_UART_STAT_TSE))
+               WATCHDOG_RESET();
 #endif
 }
 
@@ -80,56 +86,43 @@ static void leon2_serial_putc(const char c)
 
 static int leon2_serial_getc(void)
 {
-       LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
-       LEON2_Uart_regs *regs;
+       LEON2_Uart_regs *uart = leon2_get_uart_regs();
 
-#if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
-#else
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
-#endif
+       if (!uart)
+               return 0;
 
        /* Wait for a character to arrive. */
-       while (!(READ_WORD(regs->UART_Status) & LEON2_UART_STAT_DR)) ;
+       while (!(readl(&uart->UART_Status) & LEON2_UART_STAT_DR))
+               WATCHDOG_RESET();
 
-       /* read data */
-       return READ_WORD(regs->UART_Channel);
+       /* Read character data */
+       return readl(&uart->UART_Channel);
 }
 
 static int leon2_serial_tstc(void)
 {
-       LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
-       LEON2_Uart_regs *regs;
+       LEON2_Uart_regs *uart = leon2_get_uart_regs();
 
-#if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
-#else
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
-#endif
+       if (!uart)
+               return 0;
 
-       return (READ_WORD(regs->UART_Status) & LEON2_UART_STAT_DR);
+       return readl(&uart->UART_Status) & LEON2_UART_STAT_DR;
 }
 
-/* set baud rate for uart */
 static void leon2_serial_setbrg(void)
 {
-       /* update baud rate settings, read it from gd->baudrate */
+       LEON2_Uart_regs *uart = leon2_get_uart_regs();
        unsigned int scaler;
-       LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
-       LEON2_Uart_regs *regs;
 
-#if LEON2_CONSOLE_SELECT == LEON_CONSOLE_UART1
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_1;
-#else
-       regs = (LEON2_Uart_regs *) & leon2->UART_Channel_2;
-#endif
+       if (!uart)
+               return;
+
+       if (!gd->baudrate)
+               gd->baudrate = CONFIG_BAUDRATE;
+
+       scaler = leon2_serial_calc_scaler(CONFIG_SYS_CLK_FREQ, CONFIG_BAUDRATE);
 
-       if (gd->baudrate > 0) {
-               scaler =
-                   (((CONFIG_SYS_CLK_FREQ * 10) / (gd->baudrate * 8)) -
-                    5) / 10;
-               regs->UART_Scaler = scaler;
-       }
+       writel(scaler, &uart->UART_Scaler);
 }
 
 static struct serial_device leon2_serial_drv = {
arch/sparc/cpu/leon3/prom.c +3 -2
index b83776b..d0f1860 100644
@@ -21,7 +21,8 @@
 #define PRINT_ROM_VEC
 */
 extern struct linux_romvec *kernel_arg_promvec;
-extern ambapp_dev_apbuart *leon3_apbuart;
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #define PROM_PGT __attribute__ ((__section__ (".prom.pgt")))
 #define PROM_TEXT __attribute__ ((__section__ (".prom.text")))
@@ -909,7 +910,7 @@ void leon_prom_init(struct leon_prom_info *pspi)
        pspi->avail.num_bytes = pspi->totphys.num_bytes;
 
        /* Set the pointer to the Console UART in romvec */
-       pspi->reloc_funcs.leon3_apbuart = leon3_apbuart;
+       pspi->reloc_funcs.leon3_apbuart = gd->arch.uart;
 
        {
                int j = 1;
arch/sparc/cpu/leon3/serial.c +56 -44

158 lines not on this page · raw message

arch/sparc/include/asm/global_data.h +1 -0
index 667e7d6..0680a56 100644
@@ -15,6 +15,7 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+       void *uart;
 };
 
 #include <asm-generic/global_data.h>
arch/sparc/include/asm/io.h +38 -26

90 lines not on this page · raw message

include/configs/gr_cpci_ax2000.h +0 -4
index 782746e..060f116 100644
@@ -342,10 +342,6 @@
 #define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
 #define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
 
-/* Calculate scaler register value from default baudrate */
-#define CONFIG_SYS_GRLIB_APBUART_SCALER \
- ((((CONFIG_SYS_CLK_FREQ*10)/(CONFIG_BAUDRATE*8))-5)/10)
-
 /* Identification string */
 #define CONFIG_IDENT_STRING "GAISLER LEON3 GR-CPCI-AX2000"
 
include/configs/gr_ep2s60.h +0 -4
index 5c466f2..005f779 100644
@@ -309,10 +309,6 @@
 #define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
 #define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
 
-/* Calculate scaler register value from default baudrate */
-#define CONFIG_SYS_GRLIB_APBUART_SCALER \
- ((((CONFIG_SYS_CLK_FREQ*10)/(CONFIG_BAUDRATE*8))-5)/10)
-
 /* Identification string */
 #define CONFIG_IDENT_STRING "GAISLER LEON3 EP2S60"
 
include/configs/gr_xc3s_1500.h +0 -4
index e01578c..3523cde 100644
@@ -274,10 +274,6 @@
 #define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
 #define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
 
-/* Calculate scaler register value from default baudrate */
-#define CONFIG_SYS_GRLIB_APBUART_SCALER \
- ((((CONFIG_SYS_CLK_FREQ*10)/(CONFIG_BAUDRATE*8))-5)/10)
-
 /* Identification string */
 #define CONFIG_IDENT_STRING "GAISLER LEON3 GR-XC3S-1500"
 
include/configs/grsim.h +0 -3
index f54919e..8959e33 100644
@@ -280,9 +280,6 @@
 #define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
 #define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
 
-#define CONFIG_SYS_GRLIB_APBUART_SCALER \
- ((((CONFIG_SYS_CLK_FREQ*10)/(CONFIG_BAUDRATE*8))-5)/10)
-
 /* default kernel command line */
 #define CONFIG_DEFAULT_KERNEL_COMMAND_LINE "console=ttyS0,38400\0\0"
 
include/configs/grsim_leon2.h +0 -5
index bd2eaa9..83fd7fa 100644
@@ -264,8 +264,6 @@
 #define CONFIG_SYS_GRLIB_MEMCFG3  0x00136000
 
 /*** LEON2 UART 1 ***/
-#define CONFIG_SYS_LEON2_UART1_SCALER \
-       ((((CONFIG_SYS_CLK_FREQ*10)/(CONFIG_BAUDRATE*8))-5)/10)
 
 /* UART1 Define to 1 or 0 */
 #define LEON2_UART1_LOOPBACK_ENABLE 0
@@ -275,9 +273,6 @@
 
 /*** LEON2 UART 2 ***/
 
-#define CONFIG_SYS_LEON2_UART2_SCALER \
-       ((((CONFIG_SYS_CLK_FREQ*10)/(CONFIG_BAUDRATE*8))-5)/10)
-
 /* UART2 Define to 1 or 0 */
 #define LEON2_UART2_LOOPBACK_ENABLE 0
 #define LEON2_UART2_FLOWCTRL_ENABLE 0

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#5 lore raw

PATCH 5/12 sparc: Update GRSIM board with memory settings for TSIM eval

In reply to Francois Retief

Update the GRSIM board with the memory settings for the evaluation version of TSIM. This free version of TSIM is used for testing.

---

 configs/grsim_defconfig |  1 +
 include/configs/grsim.h | 57 ++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 46 insertions(+), 12 deletions(-)
configs/grsim_defconfig +1 -0
index f0fa23f..b0295f2 100644
@@ -11,4 +11,5 @@ CONFIG_SYS_TEXT_BASE=0x00000000
 # CONFIG_CMD_MEMORY is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
include/configs/grsim.h +45 -12

101 lines not on this page · raw message

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#6 lore raw

PATCH 6/12 sparc: Update startup code to take PIC mode into account

In reply to Francois Retief

---

 arch/sparc/cpu/leon2/start.S | 60 ++++++++++++++++++++++++++++++--------------
 arch/sparc/cpu/leon3/start.S | 60 ++++++++++++++++++++++++++++++--------------
 2 files changed, 82 insertions(+), 38 deletions(-)
arch/sparc/cpu/leon2/start.S +41 -19
index e43097c..974de76 100644
@@ -57,6 +57,27 @@ MINFRAME = (WINDOWSIZE + ARGPUSHSIZE + 4)
 #error Must define number of SPARC register windows, default is 8
 #endif
 
+/* Macros to load address into a register. Uses GOT table for PIC */
+#ifdef __PIC__
+
+#define SPARC_PIC_THUNK_CALL(reg) \
+       sethi   %pc22(_GLOBAL_OFFSET_TABLE_-4), %##reg; \
+       call    __sparc_get_pc_thunk.reg; \
+        add    %##reg, %pc10(_GLOBAL_OFFSET_TABLE_+4), %##reg;
+
+#define SPARC_LOAD_ADDRESS(sym, got, reg) \
+       sethi   %gdop_hix22(sym), %##reg; \
+       xor     %##reg, %gdop_lox10(sym), %##reg; \
+       ld      [%##got + %##reg], %##reg, %gdop(sym);
+
+#else
+
+#define SPARC_PIC_THUNK_CALL(reg)
+#define SPARC_LOAD_ADDRESS(sym, got, tmp) \
+       set     sym, %##reg;
+
+#endif
+
 #define STACK_ALIGN    8
 #define SA(X)  (((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1))
 
@@ -278,7 +299,7 @@ leon2_init_mctrl:
        srl     %g2, 30, %g2
        andcc   %g2, 3, %g6
        bne,a   leon2_init_wim
-       mov     %g0, %asr16             ! clear err_reg
+        mov    %g0, %asr16             ! clear err_reg
 
 leon2_init_wim:
        set     WIM_INIT, %g3
@@ -299,7 +320,7 @@ leon2_init_stackp:
 
 cpu_init_unreloc:
        call    cpu_init_f
-       nop
+        nop
 
 /* un relocated start address of monitor */
 #define TEXT_START _text
@@ -307,9 +328,10 @@ cpu_init_unreloc:
 /* un relocated end address of monitor */
 #define DATA_END __init_end
 
+       SPARC_PIC_THUNK_CALL(l7)
 reloc:
-       set     TEXT_START,%g2
-       set     DATA_END,%g3
+       SPARC_LOAD_ADDRESS(TEXT_START, l7, g2)
+       SPARC_LOAD_ADDRESS(DATA_END, l7, g3)
        set     CONFIG_SYS_RELOC_MONITOR_BASE,%g4
 reloc_loop:
        ldd     [%g2],%l0
@@ -319,7 +341,7 @@ reloc_loop:
        inc     16,%g2
        subcc   %g3,%g2,%g0
        bne     reloc_loop
-       inc     16,%g4
+        inc    16,%g4
 
        clr     %l0
        clr     %l1
@@ -336,8 +358,8 @@ reloc_loop:
 
 clr_bss:
 /* clear bss area (the relocated) */
-       set     __bss_start,%g2
-       set     __bss_end,%g3
+       SPARC_LOAD_ADDRESS(__bss_start, l7, g2)
+       SPARC_LOAD_ADDRESS(__bss_end, l7, g3)
        sub     %g3,%g2,%g3
        add     %g3,%g4,%g3
        clr     %g1     /* std %g0 uses g0 and g1 */
@@ -348,19 +370,19 @@ clr_bss_16:
        inc     16,%g4
        cmp     %g3,%g4
        bne     clr_bss_16
-       nop
+        nop
 
 /* add offsets to GOT table */
 fixup_got:
-       set     __got_start,%g4
-       set     __got_end,%g3
+       SPARC_LOAD_ADDRESS(__got_start, l7, g4)
+       SPARC_LOAD_ADDRESS(__got_end, l7, g3)
 /*
  * new got offset = (old GOT-PTR (read with ld) -
  *   CONFIG_SYS_RELOC_MONITOR_BASE(from define) ) +
  *   Destination Address (from define)
  */
        set     CONFIG_SYS_RELOC_MONITOR_BASE,%g2
-       set     TEXT_START, %g1
+       SPARC_LOAD_ADDRESS(TEXT_START, l7, g1)
        add     %g4,%g2,%g4
        sub     %g4,%g1,%g4
        add     %g3,%g2,%g3
@@ -375,11 +397,11 @@ got_loop:
        inc     4,%g4
        cmp     %g3,%g4
        bne     got_loop
-       nop
+        nop
 
 prom_relocate:
-       set     __prom_start, %g2
-       set     __prom_end, %g3
+       SPARC_LOAD_ADDRESS(__prom_start, l7, g2)
+       SPARC_LOAD_ADDRESS(__prom_end, l7, g3)
        set     CONFIG_SYS_PROM_OFFSET, %g4
 
 prom_relocate_loop:
@@ -390,7 +412,7 @@ prom_relocate_loop:
        inc     16,%g2
        subcc   %g3,%g2,%g0
        bne     prom_relocate_loop
-       inc     16,%g4
+        inc    16,%g4
 
 /* Trap table has been moved, lets tell CPU about
  * the new trap table address
@@ -403,19 +425,19 @@ prom_relocate_loop:
        nop
 /* Call relocated init functions */
 jump:
-       set     cpu_init_f2,%o1
+       SPARC_LOAD_ADDRESS(cpu_init_f2, l7, o1)
        set     CONFIG_SYS_RELOC_MONITOR_BASE,%o2
        add     %o1,%o2,%o1
        sub     %o1,%g1,%o1
        call    %o1
-       clr     %o0
+        clr    %o0
 
-       set     board_init_f,%o1
+       SPARC_LOAD_ADDRESS(board_init_f, l7, o1)
        set     CONFIG_SYS_RELOC_MONITOR_BASE,%o2
        add     %o1,%o2,%o1
        sub     %o1,%g1,%o1
        call    %o1
-       clr     %o0
+        clr    %o0
 
 dead:  ta 0                            ! if call returns...
        nop
arch/sparc/cpu/leon3/start.S +41 -19

141 lines not on this page · raw message

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#7 lore raw

PATCH 7/12 sparc: leon3: Reimplemented AMBA Plug&Play scanning routines.

In reply to Francois Retief

From: Daniel Hellstrom <[email protected]>

---

 arch/sparc/cpu/leon3/Makefile       |   3 +-
 arch/sparc/cpu/leon3/ambapp.c       | 544 ++++++++++++-------------
 arch/sparc/cpu/leon3/ambapp_low.S   | 784 ++++++++++++++++++++++++++++++++++++
 arch/sparc/cpu/leon3/ambapp_low_c.S | 113 ++++++
 arch/sparc/cpu/leon3/cpu_init.c     | 184 +++------
 arch/sparc/cpu/leon3/serial.c       |   8 +-
 arch/sparc/cpu/leon3/usb_uhci.c     |   4 +-
 common/cmd_ambapp.c                 | 542 +++++++++++++++++++------
 drivers/net/greth.c                 |  15 +-
 include/ambapp.h                    | 365 ++++++++---------
 include/ambapp_ids.h                | 239 +++++++++++
 11 files changed, 2070 insertions(+), 731 deletions(-)
 create mode 100644 arch/sparc/cpu/leon3/ambapp_low.S
 create mode 100644 arch/sparc/cpu/leon3/ambapp_low_c.S
 create mode 100644 include/ambapp_ids.h
arch/sparc/cpu/leon3/Makefile +2 -1
index 4f13ec3..c5068a8 100644
@@ -6,4 +6,5 @@
 #
 
 extra-y        = start.o
-obj-y  = cpu_init.o serial.o cpu.o ambapp.o interrupts.o prom.o usb_uhci.o
+obj-y  = cpu_init.o serial.o cpu.o ambapp.o ambapp_low.o ambapp_low_c.o \
+       interrupts.o prom.o usb_uhci.o
arch/sparc/cpu/leon3/ambapp.c +258 -286

601 lines not on this page · raw message

arch/sparc/cpu/leon3/ambapp_low.S new file +784 -0

784 lines not on this page · raw message

arch/sparc/cpu/leon3/ambapp_low_c.S new file +113 -0

113 lines not on this page · raw message

arch/sparc/cpu/leon3/cpu_init.c +59 -125

232 lines not on this page · raw message

arch/sparc/cpu/leon3/serial.c +7 -1
index f1dcab3..c4a49ed 100644
@@ -14,6 +14,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/* Select which UART that will become u-boot console */
+#ifndef CONFIG_SYS_GRLIB_APBUART_INDEX
+#define CONFIG_SYS_GRLIB_APBUART_INDEX 0
+#endif
+
 static int leon3_serial_init(void)
 {
        ambapp_dev_apbuart *uart;
@@ -21,7 +26,8 @@ static int leon3_serial_init(void)
        unsigned int tmp;
 
        /* find UART */
-       if (ambapp_apb_first(VENDOR_GAISLER, GAISLER_APBUART, &apbdev) != 1)
+       if (ambapp_apb_find(&ambapp_plb, VENDOR_GAISLER, GAISLER_APBUART,
+               CONFIG_SYS_GRLIB_APBUART_INDEX, &apbdev) != 1)
                return -1; /* didn't find hardware */
 
        /* found apbuart, let's init .. */
arch/sparc/cpu/leon3/usb_uhci.c +2 -2
index ca7d6e8..1be84c6 100644
@@ -690,11 +690,11 @@ void handle_usb_interrupt(void)
  */
 int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
 {
-       unsigned char temp;
        ambapp_ahbdev ahbdev;
 
        /* Find GRUSB core using AMBA Plug&Play information */
-       if (ambapp_ahbslv_first(VENDOR_GAISLER, GAISLER_UHCI, &ahbdev) != 1) {
+       if (ambapp_ahbslv_find(&ambapp_plb, VENDOR_GAISLER, GAISLER_UHCI,
+               CONFIG_SYS_GRLIB_GRUSB_INDEX, &ahbdev) != 1) {
                printf("USB UHCI: Failed to find GRUSB controller\n");
                return -1;
        }
common/cmd_ambapp.c +418 -124

637 lines not on this page · raw message

drivers/net/greth.c +13 -2
index 9bc8a8d..3756463 100644
@@ -34,6 +34,13 @@
 #define GRETH_PHY_ADR_DEFAULT 0
 #endif
 
+/* Let board select which GRETH to use as network interface, set
+ * this to zero if only one GRETH is available.
+ */
+#ifndef CONFIG_SYS_GRLIB_GRETH_INDEX
+#define CONFIG_SYS_GRLIB_GRETH_INDEX 0
+#endif
+
 /* ByPass Cache when reading regs */
 #define GRETH_REGLOAD(addr)            SPARC_NOCACHE_READ(addr)
 /* Write-through cache ==> no bypassing needed on writes */
@@ -593,8 +600,12 @@ int greth_initialize(bd_t * bis)
 
        debug("Scanning for GRETH\n");
 
-       /* Find Device & IRQ via AMBA Plug&Play information */
-       if (ambapp_apb_first(VENDOR_GAISLER, GAISLER_ETHMAC, &apbdev) != 1) {
+       /* Find Device & IRQ via AMBA Plug&Play information,
+        * CONFIG_SYS_GRLIB_GRETH_INDEX select which GRETH if multiple
+        * GRETHs in system.
+        */
+       if (ambapp_apb_find(&ambapp_plb, VENDOR_GAISLER, GAISLER_ETHMAC,
+                       CONFIG_SYS_GRLIB_GRETH_INDEX, &apbdev) != 1) {
                return -1;      /* GRETH not found */
        }
 
include/ambapp.h +175 -190

414 lines not on this page · raw message

include/ambapp_ids.h new file +239 -0

153 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

Part of the diff is not shown here. View the raw message.

#8 lore raw

PATCH 8/12 sparc: Kconfig: Move the CMD_AMBAPP command to Kconfig

In reply to Francois Retief

Add an initr function in the board_r.c file for the AMBA Plug&Play command. Add a Kconfig entry for the ambapp command and remove all CONFIG_CMD_AMBAPP defines from the board configuration headers.

Add a Kconfig entry to display the AMBA Plug&Play information on startup. This option is off by default. Remove relevent define from board configuration headers.

---

 common/Kconfig                   | 14 ++++++++++++++
 common/board_r.c                 | 21 +++++++++++++++++++++
 configs/grsim_defconfig          |  1 +
 include/config_cmd_all.h         |  1 -
 include/configs/gr_cpci_ax2000.h |  4 ----
 include/configs/gr_ep2s60.h      |  4 ----
 include/configs/gr_xc3s_1500.h   |  4 ----
 include/configs/grsim.h          |  4 ----
 8 files changed, 36 insertions(+), 17 deletions(-)
common/Kconfig +14 -0
index 0388a6c..440cb37 100644
@@ -455,6 +455,20 @@ endmenu
 
 menu "Misc commands"
 
+config CMD_AMBAPP
+       bool "ambapp"
+       depends on LEON3
+       default y
+       help
+         Lists AMBA Plug-n-Play information.
+
+config SYS_AMBAPP_PRINT_ON_STARTUP
+       bool "Show AMBA PnP info on startup"
+       depends on CMD_AMBAPP
+       default n
+       help
+         Show AMBA Plug-n-Play information on startup.
+
 config CMD_TIME
        bool "time"
        help
common/board_r.c +21 -0
index c4fd3ea..32cb4b7 100644
@@ -46,6 +46,9 @@
 #include <stdio_dev.h>
 #include <trace.h>
 #include <watchdog.h>
+#ifdef CONFIG_CMD_AMBAPP
+#include <ambapp.h>
+#endif
 #ifdef CONFIG_ADDR_MAP
 #include <asm/mmu.h>
 #endif
@@ -559,6 +562,18 @@ static int initr_status_led(void)
 }
 #endif
 
+#if defined(CONFIG_CMD_AMBAPP) && defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)
+extern int do_ambapp_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+
+static int initr_ambapp_print(void)
+{
+       puts("AMBA:\n");
+       do_ambapp_print(NULL, 0, 0, NULL);
+
+       return 0;
+}
+#endif
+
 #if defined(CONFIG_CMD_SCSI)
 static int initr_scsi(void)
 {
@@ -851,6 +866,12 @@ init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_BOARD_LATE_INIT
        board_late_init,
 #endif
+#if defined(CONFIG_CMD_AMBAPP)
+       ambapp_init_reloc,
+#if defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)
+       initr_ambapp_print,
+#endif
+#endif
 #ifdef CONFIG_CMD_SCSI
        INIT_FUNC_WATCHDOG_RESET
        initr_scsi,
configs/grsim_defconfig +1 -0
index b0295f2..a5ea7ab 100644
@@ -13,3 +13,4 @@ CONFIG_SYS_TEXT_BASE=0x00000000
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
+CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP=y
include/config_cmd_all.h +0 -1
index 8832552..424721b 100644
@@ -13,7 +13,6 @@
  * Alphabetical list of all possible commands.
  */
 
-#define CONFIG_CMD_AMBAPP      /* AMBA Plug & Play Bus print utility */
 #define CONFIG_CMD_ASKENV      /* ask for env variable         */
 #define CONFIG_CMD_BEDBUG      /* Include BedBug Debugger      */
 #define CONFIG_CMD_BMP         /* BMP support                  */
include/configs/gr_cpci_ax2000.h +0 -4
index 060f116..8461787 100644
@@ -60,7 +60,6 @@
  * Supported commands
  */
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_AMBAPP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_IRQ
@@ -311,9 +310,6 @@
 
 /***** Gaisler GRLIB IP-Cores Config ********/
 
-/* AMBA Plug & Play info display on startup */
-/*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/
-
 #define CONFIG_SYS_GRLIB_SDRAM    0
 
 /* See, GRLIB Docs (grip.pdf) on how to set up
include/configs/gr_ep2s60.h +0 -4
index 005f779..2f953ae 100644
@@ -54,7 +54,6 @@
  * Supported commands
  */
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_AMBAPP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_IRQ
@@ -288,9 +287,6 @@
 
 /***** Gaisler GRLIB IP-Cores Config ********/
 
-/* AMBA Plug & Play info display on startup */
-/*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/
-
 #define CONFIG_SYS_GRLIB_SDRAM    0
 
 /* See, GRLIB Docs (grip.pdf) on how to set up
include/configs/gr_xc3s_1500.h +0 -4
index 3523cde..428b532 100644
@@ -41,7 +41,6 @@
  * Supported commands
  */
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_AMBAPP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_IRQ
@@ -251,9 +250,6 @@
 
 /***** Gaisler GRLIB IP-Cores Config ********/
 
-/* AMBA Plug & Play info display on startup */
-/*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/
-
 #define CONFIG_SYS_GRLIB_SDRAM    0
 
 /* See, GRLIB Docs (grip.pdf) on how to set up
include/configs/grsim.h +0 -4
index a538785..e07b816 100644
@@ -51,7 +51,6 @@
 /*
  * Supported commands
  */
-#define CONFIG_CMD_AMBAPP      /* AMBA Plyg&Play information   */
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_FPGA_LOADMK
 #define CONFIG_CMD_IRQ
@@ -262,9 +261,6 @@
 
 /***** Gaisler GRLIB IP-Cores Config ********/
 
-/* AMBA Plug & Play info display on startup */
-/*#define CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP*/
-
 #define CONFIG_SYS_GRLIB_SDRAM     0
 
 #define CONFIG_SYS_GRLIB_MEMCFG1   (0x000000ff | (1<<11))

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#9 lore raw

PATCH 9/12 sparc: leon3: Added memory controller initialization using new AMBA PnP routines.

In reply to Francois Retief

From: Daniel Hellstrom <[email protected]>

---

 arch/sparc/cpu/leon3/Makefile     |   2 +-
 arch/sparc/cpu/leon3/memcfg.c     | 237 +++++++++++++++++++++++++++++++++++
 arch/sparc/cpu/leon3/memcfg.h     |  90 ++++++++++++++
 arch/sparc/cpu/leon3/memcfg_low.S | 253 ++++++++++++++++++++++++++++++++++++++
 arch/sparc/cpu/leon3/start.S      |  41 +++++-
 include/configs/gr_cpci_ax2000.h  |  27 ++--
 include/configs/gr_ep2s60.h       |  32 +++--
 include/configs/gr_xc3s_1500.h    |  23 ++--
 include/configs/grsim.h           |  26 ++--
 9 files changed, 688 insertions(+), 43 deletions(-)
 create mode 100644 arch/sparc/cpu/leon3/memcfg.c
 create mode 100644 arch/sparc/cpu/leon3/memcfg.h
 create mode 100644 arch/sparc/cpu/leon3/memcfg_low.S
arch/sparc/cpu/leon3/Makefile +1 -1
index c5068a8..f4cf43c 100644
@@ -7,4 +7,4 @@
 
 extra-y        = start.o
 obj-y  = cpu_init.o serial.o cpu.o ambapp.o ambapp_low.o ambapp_low_c.o \
-       interrupts.o prom.o usb_uhci.o
+       interrupts.o prom.o usb_uhci.o memcfg.o memcfg_low.o
arch/sparc/cpu/leon3/memcfg.c new file +237 -0

237 lines not on this page · raw message

arch/sparc/cpu/leon3/memcfg.h new file +90 -0

90 lines not on this page · raw message

arch/sparc/cpu/leon3/memcfg_low.S new file +253 -0

253 lines not on this page · raw message

arch/sparc/cpu/leon3/start.S +40 -1

71 lines not on this page · raw message

include/configs/gr_cpci_ax2000.h +16 -11
index 8461787..5bbf1aa 100644
@@ -312,31 +312,36 @@
 
 #define CONFIG_SYS_GRLIB_SDRAM    0
 
+/* No SDRAM Configuration */
+#undef CONFIG_SYS_GRLIB_GAISLER_SDCTRL1
+
 /* See, GRLIB Docs (grip.pdf) on how to set up
  * These the memory controller registers.
  */
-#define CONFIG_SYS_GRLIB_MEMCFG1   (0x10f800ff | (1<<11))
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG1   (0x10f800ff | (1<<11))
 #if CONFIG_LEON_RAM_SELECT == CONFIG_LEON_RAM_SDRAM_NOSRAM
-#define CONFIG_SYS_GRLIB_MEMCFG2   0x82206000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2   0x82206000
 #else
-#define CONFIG_SYS_GRLIB_MEMCFG2   0x82205260
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2   0x82205260
 #endif
-#define CONFIG_SYS_GRLIB_MEMCFG3   0x0809a000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG3   0x0809a000
 
-#define CONFIG_SYS_GRLIB_FT_MEMCFG1   (0x10f800ff | (1<<11))
+/* GRLIB FT-MCTRL configuration */
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG1   (0x10f800ff | (1<<11))
 #if CONFIG_LEON_RAM_SELECT == CONFIG_LEON_RAM_SDRAM_NOSRAM
-#define CONFIG_SYS_GRLIB_FT_MEMCFG2   0x82206000
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2   0x82206000
 #else
-#define CONFIG_SYS_GRLIB_FT_MEMCFG2   0x82205260
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2   0x82205260
 #endif
-#define CONFIG_SYS_GRLIB_FT_MEMCFG3   0x0809a000
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG3   0x0809a000
 
 /* no DDR controller */
-#define CONFIG_SYS_GRLIB_DDR_CFG   0x00000000
+#undef CONFIG_SYS_GRLIB_GAISLER_DDRSPA1
 
 /* no DDR2 Controller */
-#define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
-#define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
+#undef CONFIG_SYS_GRLIB_GAISLER_DDR2SPA1
 
 /* Identification string */
 #define CONFIG_IDENT_STRING "GAISLER LEON3 GR-CPCI-AX2000"
include/configs/gr_ep2s60.h +20 -12
index 2f953ae..b55ca77 100644
@@ -289,21 +289,29 @@
 
 #define CONFIG_SYS_GRLIB_SDRAM    0
 
+/* No SDRAM Configuration */
+#undef CONFIG_SYS_GRLIB_GAISLER_SDCTRL1
+
 /* See, GRLIB Docs (grip.pdf) on how to set up
  * These the memory controller registers.
  */
-#define CONFIG_SYS_GRLIB_MEMCFG1  (0x10f800ff | (1<<11))
-#define CONFIG_SYS_GRLIB_MEMCFG2  0x00000000
-#define CONFIG_SYS_GRLIB_MEMCFG3  0x00000000
-
-#define CONFIG_SYS_GRLIB_FT_MEMCFG1  (0x10f800ff | (1<<11))
-#define CONFIG_SYS_GRLIB_FT_MEMCFG2  0x00000000
-#define CONFIG_SYS_GRLIB_FT_MEMCFG3  0x00000000
-
-#define CONFIG_SYS_GRLIB_DDR_CFG  0xa900830a
-
-#define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
-#define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG1  (0x10f800ff | (1<<11))
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2  0x00000000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG3  0x00000000
+
+/* GRLIB FT-MCTRL configuration */
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG1  (0x10f800ff | (1<<11))
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2  0x00000000
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG3  0x00000000
+
+/* DDR controller */
+#define CONFIG_SYS_GRLIB_GAISLER_DDRSPA1
+#define CONFIG_SYS_GRLIB_GAISLER_DDRSPA1_CTRL  0xa900830a
+
+/* no DDR2 Controller */
+#undef CONFIG_SYS_GRLIB_GAISLER_DDR2SPA1
 
 /* Identification string */
 #define CONFIG_IDENT_STRING "GAISLER LEON3 EP2S60"
include/configs/gr_xc3s_1500.h +14 -9
index 428b532..d086b69 100644
@@ -252,23 +252,28 @@
 
 #define CONFIG_SYS_GRLIB_SDRAM    0
 
+/* No SDRAM Configuration */
+#undef CONFIG_SYS_GRLIB_GAISLER_SDCTRL1
+
 /* See, GRLIB Docs (grip.pdf) on how to set up
  * These the memory controller registers.
  */
-#define CONFIG_SYS_GRLIB_MEMCFG1   (0x000000ff | (1<<11))
-#define CONFIG_SYS_GRLIB_MEMCFG2   0x82206000
-#define CONFIG_SYS_GRLIB_MEMCFG3   0x00136000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG1   (0x000000ff | (1<<11))
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2   0x82206000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG3   0x00136000
 
-#define CONFIG_SYS_GRLIB_FT_MEMCFG1   (0x000000ff | (1<<11))
-#define CONFIG_SYS_GRLIB_FT_MEMCFG2   0x82206000
-#define CONFIG_SYS_GRLIB_FT_MEMCFG3   0x00136000
+/* GRLIB FT-MCTRL configuration */
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG1   (0x000000ff | (1<<11))
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2   0x82206000
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG3   0x00136000
 
 /* no DDR controller */
-#define CONFIG_SYS_GRLIB_DDR_CFG   0x00000000
+#undef CONFIG_SYS_GRLIB_GAISLER_DDRSPA1
 
 /* no DDR2 Controller */
-#define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
-#define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
+#undef CONFIG_SYS_GRLIB_GAISLER_DDR2SPA1
 
 /* Identification string */
 #define CONFIG_IDENT_STRING "GAISLER LEON3 GR-XC3S-1500"
include/configs/grsim.h +17 -9
index e07b816..e1f7dc3 100644
@@ -264,25 +264,33 @@
 #define CONFIG_SYS_GRLIB_SDRAM     0
 
 #define CONFIG_SYS_GRLIB_MEMCFG1   (0x000000ff | (1<<11))
+
+/* No SDRAM Configuration */
+#undef CONFIG_SYS_GRLIB_GAISLER_SDCTRL1
+
+/* LEON2 MCTRL configuration */
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG1   (0x000000ff | (1<<11))
 #if CONFIG_GRSIM
 /* GRSIM configuration */
-#define CONFIG_SYS_GRLIB_MEMCFG2   0x82206000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2   0x82206000
 #else
 /* TSIM configuration */
-#define CONFIG_SYS_GRLIB_MEMCFG2   0x81805220
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2   0x81805220
 #endif
-#define CONFIG_SYS_GRLIB_MEMCFG3   0x00136000
+#define CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG3   0x00136000
 
-#define CONFIG_SYS_GRLIB_FT_MEMCFG1   (0x000000ff | (1<<11))
-#define CONFIG_SYS_GRLIB_FT_MEMCFG2   0x82206000
-#define CONFIG_SYS_GRLIB_FT_MEMCFG3   0x00136000
+/* GRLIB FT-MCTRL configuration */
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG1   (0x000000ff | (1<<11))
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2   0x82206000
+#define CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG3   0x00136000
 
 /* no DDR controller */
-#define CONFIG_SYS_GRLIB_DDR_CFG   0x00000000
+#undef CONFIG_SYS_GRLIB_GAISLER_DDRSPA1
 
 /* no DDR2 Controller */
-#define CONFIG_SYS_GRLIB_DDR2_CFG1 0x00000000
-#define CONFIG_SYS_GRLIB_DDR2_CFG3 0x00000000
+#undef CONFIG_SYS_GRLIB_GAISLER_DDR2SPA1
 
 /* default kernel command line */
 #define CONFIG_DEFAULT_KERNEL_COMMAND_LINE "console=ttyS0,38400\0\0"

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#10 lore raw

PATCH 10/12 sparc: leon3: Moved GRLIB core header files to common include/grlib directory

In reply to Francois Retief

From: Daniel Hellstrom <[email protected]>

---

 arch/sparc/cpu/leon3/cpu_init.c   |  10 ++-
 arch/sparc/cpu/leon3/interrupts.c |   7 +-
 arch/sparc/cpu/leon3/prom.c       |   7 +-
 arch/sparc/cpu/leon3/serial.c     |  13 ++--
 common/cmd_ambapp.c               |  21 +++++-
 drivers/net/greth.c               |   2 +-
 include/ambapp.h                  | 137 --------------------------------------
 include/ambapp_ids.h              |  11 +++
 include/grlib/apbuart.h           |  47 +++++++++++++
 include/grlib/gptimer.h           |  34 ++++++++++
 include/grlib/greth.h             |  87 ++++++++++++++++++++++++
 include/grlib/irqmp.h             |  23 +++++++
 12 files changed, 242 insertions(+), 157 deletions(-)
 create mode 100644 include/grlib/apbuart.h
 create mode 100644 include/grlib/gptimer.h
 create mode 100644 include/grlib/greth.h
 create mode 100644 include/grlib/irqmp.h
arch/sparc/cpu/leon3/cpu_init.c +4 -6
index f23ecb8..40d1751 100644
@@ -11,6 +11,8 @@
 #include <asm/asi.h>
 #include <asm/leon.h>
 #include <ambapp.h>
+#include <grlib/irqmp.h>
+#include <grlib/gptimer.h>
 
 #include <config.h>
 
@@ -27,11 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /* reset CPU (jump to 0, without reset) */
 void start(void);
 
-/* find & initialize the memory controller */
-int init_memory_ctrl(void);
-
 ambapp_dev_irqmp *irqmp = NULL;
-ambapp_dev_mctrl memctrl;
 ambapp_dev_gptimer *gptimer = NULL;
 unsigned int gptimer_irq = 0;
 int leon3_snooping_avail = 0;
@@ -150,8 +148,8 @@ int timer_interrupt_init_cpu(void)
        gptimer->e[0].val = 0;
        gptimer->e[0].rld = (TIMER_BASE_CLK / CONFIG_SYS_HZ) - 1;
        gptimer->e[0].ctrl =
-           (LEON3_GPTIMER_EN |
-            LEON3_GPTIMER_RL | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN);
+           (GPTIMER_CTRL_EN | GPTIMER_CTRL_RS |
+            GPTIMER_CTRL_LD | GPTIMER_CTRL_IE);
 
        return gptimer_irq;
 }
arch/sparc/cpu/leon3/interrupts.c +4 -3
index a834aa0..2312b58 100644
@@ -23,6 +23,8 @@
 
 #include <asm/leon.h>
 #include <ambapp.h>
+#include <grlib/irqmp.h>
+#include <grlib/gptimer.h>
 
 /* 15 normal irqs and a non maskable interrupt */
 #define NR_IRQS 15
@@ -125,9 +127,8 @@ int interrupt_init_cpu(void)
 /* Handle Timer 0 IRQ */
 void timer_interrupt_cpu(void *arg)
 {
-       gptimer->e[0].ctrl = (LEON3_GPTIMER_EN |
-                             LEON3_GPTIMER_RL |
-                             LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN);
+       gptimer->e[0].ctrl = (GPTIMER_CTRL_EN | GPTIMER_CTRL_RS |
+                             GPTIMER_CTRL_LD | GPTIMER_CTRL_IE);
        /* nothing to do here */
        return;
 }
arch/sparc/cpu/leon3/prom.c +5 -2
index d0f1860..c391be7 100644
@@ -15,6 +15,9 @@
 #include <asm/irq.h>
 #include <asm/leon.h>
 #include <ambapp.h>
+#include <grlib/apbuart.h>
+#include <grlib/irqmp.h>
+#include <grlib/gptimer.h>
 
 #include <config.h>
 /*
@@ -741,14 +744,14 @@ static int PROM_TEXT leon_nbputchar(int c)
 
        /* Wait for last character to go. */
        while (!(SPARC_BYPASS_READ(&uart->status)
-                & LEON_REG_UART_STATUS_THE)) ;
+                & APBUART_STATUS_THE));
 
        /* Send data */
        SPARC_BYPASS_WRITE(&uart->data, c);
 
        /* Wait for data to be sent */
        while (!(SPARC_BYPASS_READ(&uart->status)
-                & LEON_REG_UART_STATUS_TSE)) ;
+                & APBUART_STATUS_TSE));
 
        return 0;
 }
arch/sparc/cpu/leon3/serial.c +7 -6
index c4a49ed..cefb9d2 100644
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <ambapp.h>
+#include <grlib/apbuart.h>
 #include <serial.h>
 #include <watchdog.h>
 
@@ -38,9 +39,9 @@ static int leon3_serial_init(void)
        writel(tmp, &uart->scaler);
 
        /* Let bit 11 be unchanged (debug bit for GRMON) */
-       tmp = readl(&uart->ctrl) & LEON_REG_UART_CTRL_DBG;
+       tmp = readl(&uart->ctrl) & APBUART_CTRL_DBG;
        /* Receiver & transmitter enable */
-       tmp |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
+       tmp |= APBUART_CTRL_RE | APBUART_CTRL_TE;
        writel(tmp, &uart->ctrl);
 
        gd->arch.uart = uart;
@@ -61,7 +62,7 @@ static void leon3_serial_putc_raw(const char c)
                return;
 
        /* Wait for last character to go. */
-       while (!(readl(&uart->status) & LEON_REG_UART_STATUS_THE))
+       while (!(readl(&uart->status) & APBUART_STATUS_THE))
                WATCHDOG_RESET();
 
        /* Send data */
@@ -69,7 +70,7 @@ static void leon3_serial_putc_raw(const char c)
 
 #ifdef LEON_DEBUG
        /* Wait for data to be sent */
-       while (!(readl(&uart->status) & LEON_REG_UART_STATUS_TSE))
+       while (!(readl(&uart->status) & APBUART_STATUS_TSE))
                WATCHDOG_RESET();
 #endif
 }
@@ -90,7 +91,7 @@ static int leon3_serial_getc(void)
                return 0;
 
        /* Wait for a character to arrive. */
-       while (!(readl(&uart->status) & LEON_REG_UART_STATUS_DR))
+       while (!(readl(&uart->status) & APBUART_STATUS_DR))
                WATCHDOG_RESET();
 
        /* Read character data */
@@ -104,7 +105,7 @@ static int leon3_serial_tstc(void)
        if (!uart)
                return 0;
 
-       return readl(&uart->status) & LEON_REG_UART_STATUS_DR;
+       return readl(&uart->status) & APBUART_STATUS_DR;
 }
 
 /* set baud rate for uart */
common/cmd_ambapp.c +19 -2
index b1a8fa8..4b6d174 100644
@@ -96,11 +96,15 @@ static ambapp_device_name GAISLER_devices[] = {
        {GAISLER_ASCS, "ASCS", "ASCS Master"},
        {GAISLER_IPMVBCTRL, "IPMVBCTRL", "IPM-bus/MVBC memory controller"},
        {GAISLER_SPIMCTRL, "SPIMCTRL", "SPI Memory Controller"},
+       {GAISLER_L4STAT, "L4STAT", "Leon4 Statistics Module"},
        {GAISLER_LEON4, "LEON4", "Leon4 SPARC V8 Processor"},
        {GAISLER_LEON4DSU, "LEON4DSU", "Leon4 Debug Support Unit"},
        {GAISLER_PWM, "PWM", "PWM generator"},
        {GAISLER_L2CACHE, "L2CACHE", "L2-Cache Controller"},
-       {GAISLER_SDCTRL64, "SDCTRL64", ""},
+       {GAISLER_SDCTRL64, "SDCTRL64", "64-bit PC133 SDRAM Controller"},
+       {GAISLER_GR1553B, "GR1553B", "MIL-STD-1553B Interface"},
+       {GAISLER_1553TST, "1553TST", "MIL-STD-1553B Test Device"},
+       {GAISLER_GRIOMMU, "GRIOMMU", "I/O Memory Management Unit"},
        {GAISLER_FTAHBRAM, "FTAHBRAM", "Generic FT AHB SRAM module"},
        {GAISLER_FTSRCTRL, "FTSRCTRL", "Simple FT SRAM Controller"},
        {GAISLER_AHBSTAT, "AHBSTAT", "AHB Status Register"},
@@ -108,6 +112,8 @@ static ambapp_device_name GAISLER_devices[] = {
        {GAISLER_FTMCTRL, "FTMCTRL", "Memory controller with EDAC"},
        {GAISLER_FTSDCTRL, "FTSDCTRL", "FT PC133 SDRAM Controller"},
        {GAISLER_FTSRCTRL8, "FTSRCTRL8", "FT 8-bit SRAM/16-bit IO Ctrl"},
+       {GAISLER_MEMSCRUB, "MEMSCRUB", "AHB Memory Scrubber"},
+       {GAISLER_FTSDCTRL64, "FTSDCTRL64", "64-bit FT SDRAM Controller"},
        {GAISLER_APBPS2, "APBPS2", "PS2 interface"},
        {GAISLER_VGACTRL, "VGACTRL", "VGA controller"},
        {GAISLER_LOGAN, "LOGAN", "On chip Logic Analyzer"},
@@ -130,6 +136,7 @@ static ambapp_device_name GAISLER_devices[] = {
        {GAISLER_TEST_1X2, "TEST_1X2", "HAPS TEST_1x2 interface"},
        {GAISLER_WILD2AHB, "WILD2AHB", "WildCard CardBus interface"},
        {GAISLER_BIO1, "BIO1", "Basic I/O board BIO1"},
+       {GAISLER_AESDMA, "AESDMA", "AES 256 DMA"},
        {GAISLER_SATCAN, "SATCAN", "SatCAN controller"},
        {GAISLER_CANMUX, "CANMUX", "CAN Bus multiplexer"},
        {GAISLER_GRTMRX, "GRTMRX", "CCSDS Telemetry Receiver"},
@@ -137,8 +144,11 @@ static ambapp_device_name GAISLER_devices[] = {
        {GAISLER_GRTMDESC, "GRTMDESC", "CCSDS Telemetry Descriptor"},
        {GAISLER_GRTMVC, "GRTMVC", "CCSDS Telemetry VC Generator"},
        {GAISLER_GEFFE, "GEFFE", "Geffe Generator"},
-       {GAISLER_GPREG, "GPREG", ""},
+       {GAISLER_GPREG, "GPREG", "General Purpose Register"},
        {GAISLER_GRTMPAHB, "GRTMPAHB", "CCSDS Telemetry VC AHB Input"},
+       {GAISLER_SPWCUC, "SPWCUC", "CCSDS CUC / SpaceWire I/F"},
+       {GAISLER_SPW2_DMA, "SPW2_DMA", "GRSPW Router DMA interface"},
+       {GAISLER_SPWROUTER, "SPWROUTER", "GRSPW Router"},
        {0, NULL, NULL}
 };
 
@@ -318,6 +328,12 @@ static ambapp_device_name CETON_devices[] = {
 };
 
 
+/** Vendor S3 devices */
+static ambapp_device_name S3_devices[] = {
+       {0, NULL, NULL}
+};
+
+
 /** Vendor ACTEL devices */
 static ambapp_device_name ACTEL_devices[] = {
        {ACTEL_COREMP7, "COREMP7", "CoreMP7 Processor"},
@@ -351,6 +367,7 @@ static ambapp_vendor_devnames vendors[] = {
        {VENDOR_ORBITA, "ORBITA", "Orbita", ORBITA_devices},
        {VENDOR_SYNOPSYS, "SYNOPSYS", "Synopsys Inc.", SYNOPSYS_devices},
        {VENDOR_NASA, "NASA", "NASA", NASA_devices},
+       {VENDOR_S3, "S3", "S3 Group", S3_devices},
        {VENDOR_CAL, "CAL", "", CAL_devices},
        {VENDOR_EMBEDDIT, "EMBEDDIT", "Embedd.it", EMBEDDIT_devices},
        {VENDOR_CETON, "CETON", "Ceton Corporation", CETON_devices},
drivers/net/greth.c +1 -1
index 3756463..0624eb8 100644
@@ -20,7 +20,7 @@
 #include <ambapp.h>
 #include <asm/leon.h>
 
-#include "greth.h"
+#include <grlib/greth.h>
 
 /* Default to 3s timeout on autonegotiation */
 #ifndef GRETH_PHY_TIMEOUT_MS
include/ambapp.h +0 -137

141 lines not on this page · raw message

include/ambapp_ids.h +11 -0
index c010d60..1eae34e 100644
@@ -27,6 +27,7 @@
 #define VENDOR_ORBITA        0x17
 #define VENDOR_SYNOPSYS      0x21
 #define VENDOR_NASA          0x22
+#define VENDOR_S3            0x31
 #define VENDOR_CAL           0xca
 #define VENDOR_EMBEDDIT      0xea
 #define VENDOR_CETON         0xcb
@@ -100,11 +101,15 @@
 #define GAISLER_ASCS         0x043
 #define GAISLER_IPMVBCTRL    0x044
 #define GAISLER_SPIMCTRL     0x045
+#define GAISLER_L4STAT       0x047
 #define GAISLER_LEON4        0x048
 #define GAISLER_LEON4DSU     0x049
 #define GAISLER_PWM          0x04a
 #define GAISLER_L2CACHE      0x04b
 #define GAISLER_SDCTRL64     0x04c
+#define GAISLER_GR1553B      0x04d
+#define GAISLER_1553TST      0x04e
+#define GAISLER_GRIOMMU      0x04f
 #define GAISLER_FTAHBRAM     0x050
 #define GAISLER_FTSRCTRL     0x051
 #define GAISLER_AHBSTAT      0x052
@@ -112,6 +117,8 @@
 #define GAISLER_FTMCTRL      0x054
 #define GAISLER_FTSDCTRL     0x055
 #define GAISLER_FTSRCTRL8    0x056
+#define GAISLER_MEMSCRUB     0x057
+#define GAISLER_FTSDCTRL64   0x058
 #define GAISLER_APBPS2       0x060
 #define GAISLER_VGACTRL      0x061
 #define GAISLER_LOGAN        0x062
@@ -134,6 +141,7 @@
 #define GAISLER_TEST_1X2     0x078
 #define GAISLER_WILD2AHB     0x079
 #define GAISLER_BIO1         0x07a
+#define GAISLER_AESDMA       0x07b
 #define GAISLER_SATCAN       0x080
 #define GAISLER_CANMUX       0x081
 #define GAISLER_GRTMRX       0x082
@@ -143,6 +151,9 @@
 #define GAISLER_GEFFE        0x086
 #define GAISLER_GPREG        0x087
 #define GAISLER_GRTMPAHB     0x088
+#define GAISLER_SPWCUC       0x089
+#define GAISLER_SPW2_DMA     0x08a
+#define GAISLER_SPWROUTER    0x08b
 
 /* European Space Agency device ID defines */
 #define ESA_LEON2            0x002
include/grlib/apbuart.h new file +47 -0

47 lines not on this page · raw message

include/grlib/gptimer.h new file +34 -0
new file mode 100644
index 0000000..8b2b165
@@ -0,0 +1,34 @@
+/* GRLIB GPTIMER (General Purpose Timer) definitions
+ *
+ * (C) Copyright 2010, 2015
+ * Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __GRLIB_GPTIMER_H__
+#define __GRLIB_GPTIMER_H__
+
+typedef struct {
+       volatile unsigned int val;
+       volatile unsigned int rld;
+       volatile unsigned int ctrl;
+       volatile unsigned int unused;
+} ambapp_dev_gptimer_element;
+
+#define GPTIMER_CTRL_EN        0x1     /* Timer enable */
+#define GPTIMER_CTRL_RS        0x2     /* Timer reStart  */
+#define GPTIMER_CTRL_LD        0x4     /* Timer reLoad */
+#define GPTIMER_CTRL_IE        0x8     /* interrupt enable */
+#define GPTIMER_CTRL_IP        0x10    /* interrupt flag/pending */
+#define GPTIMER_CTRL_CH        0x20    /* Chain with previous timer */
+
+typedef struct {
+       volatile unsigned int scalar;
+       volatile unsigned int scalar_reload;
+       volatile unsigned int config;
+       volatile unsigned int unused;
+       volatile ambapp_dev_gptimer_element e[8];
+} ambapp_dev_gptimer;
+
+#endif
include/grlib/greth.h new file +87 -0

87 lines not on this page · raw message

include/grlib/irqmp.h new file +23 -0
new file mode 100644
index 0000000..0354d5c
@@ -0,0 +1,23 @@
+/* GRLIB IRQMP (IRQ Multi-processor controller) definitions
+ *
+ * (C) Copyright 2010, 2015
+ * Daniel Hellstrom, Cobham Gaisler, [email protected]
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __GRLIB_IRQMP_H__
+#define __GRLIB_IRQMP_H__
+
+typedef struct {
+       volatile unsigned int ilevel;
+       volatile unsigned int ipend;
+       volatile unsigned int iforce;
+       volatile unsigned int iclear;
+       volatile unsigned int mstatus;
+       volatile unsigned int notused[11];
+       volatile unsigned int cpu_mask[16];
+       volatile unsigned int cpu_force[16];
+} ambapp_dev_irqmp;
+
+#endif

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#11 lore raw

PATCH 11/12 sparc: ambapp: Removed warning and unnecessary printout.

In reply to Francois Retief

From: Daniel Hellstrom <[email protected]>

---

 arch/sparc/cpu/leon3/ambapp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/sparc/cpu/leon3/ambapp.c +2 -1
index bb81338..b8ac05f 100644
@@ -10,6 +10,7 @@
 /* #define DEBUG */
 
 #include <common.h>
+#include <malloc.h>
 #include <ambapp.h>
 #include <config.h>
 
@@ -257,7 +258,7 @@ unsigned int ambapp_bus_freq(struct ambapp_bus *abus, int ahb_bus_index)
                /* Get I/O area of AHB bus */
                ioarea = abus->ioareas[ahb_bus_index];
 
-               printf("  IOAREA: 0x%08x\n", ioarea);
+               debug("  IOAREA: 0x%08x\n", ioarea);
 
                /* Get parent bus */
                parent = (ioarea & 0x7);

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#12 lore raw

PATCH 12/12 sparc: leon3: Add debug_uart support to LEON3 serial driver.

In reply to Francois Retief

---

 arch/sparc/cpu/leon3/cpu_init.c |  5 ++++-
 arch/sparc/cpu/leon3/serial.c   | 27 ++++++++++++++++++++++++++-
 configs/grsim_defconfig         |  4 ++++
 drivers/serial/Kconfig          |  8 ++++++++
 4 files changed, 42 insertions(+), 2 deletions(-)
arch/sparc/cpu/leon3/cpu_init.c +4 -1
index 40d1751..b140da3 100644
@@ -13,6 +13,7 @@
 #include <ambapp.h>
 #include <grlib/irqmp.h>
 #include <grlib/gptimer.h>
+#include <debug_uart.h>
 
 #include <config.h>
 
@@ -50,7 +51,9 @@ struct {
  */
 void cpu_init_f(void)
 {
-
+#ifdef CONFIG_DEBUG_UART
+       debug_uart_init();
+#endif
 }
 
 /* Routine called from start.S,
arch/sparc/cpu/leon3/serial.c +26 -1
index cefb9d2..66b3773 100644
@@ -28,8 +28,10 @@ static int leon3_serial_init(void)
 
        /* find UART */
        if (ambapp_apb_find(&ambapp_plb, VENDOR_GAISLER, GAISLER_APBUART,
-               CONFIG_SYS_GRLIB_APBUART_INDEX, &apbdev) != 1)
+               CONFIG_SYS_GRLIB_APBUART_INDEX, &apbdev) != 1) {
+               panic("%s: apbuart not found!\n", __func__);
                return -1; /* didn't find hardware */
+       }
 
        /* found apbuart, let's init .. */
        uart = (ambapp_dev_apbuart *) apbdev.address;
@@ -145,3 +147,26 @@ __weak struct serial_device *default_serial_console(void)
 {
        return &leon3_serial_drv;
 }
+
+#ifdef CONFIG_DEBUG_UART_APBUART
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+       ambapp_dev_apbuart *uart = (ambapp_dev_apbuart *)CONFIG_DEBUG_UART_BASE;
+       uart->scaler = (((CONFIG_DEBUG_UART_CLOCK*10) / (CONFIG_BAUDRATE*8)) - 5)/10;
+       uart->ctrl = APBUART_CTRL_RE | APBUART_CTRL_TE;
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+       ambapp_dev_apbuart *uart = (ambapp_dev_apbuart *)CONFIG_DEBUG_UART_BASE;
+       while (!(readl(&uart->status) & APBUART_STATUS_THE))
+               WATCHDOG_RESET();
+       writel(ch, &uart->data);
+}
+
+DEBUG_UART_FUNCS
+
+#endif
configs/grsim_defconfig +4 -0
index a5ea7ab..d2f709f 100644
@@ -14,3 +14,7 @@ CONFIG_SYS_TEXT_BASE=0x00000000
 # CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_APBUART=y
+CONFIG_DEBUG_UART_BASE=0x80000100
+CONFIG_DEBUG_UART_CLOCK=40000000
drivers/serial/Kconfig +8 -0
index 53b4e1b..79e92e8 100644
@@ -91,6 +91,14 @@ config DEBUG_UART_S5P
          will need to provide parameters to make this work. The driver will
          be available until the real driver-model serial is running.
 
+config DEBUG_UART_APBUART
+       depends on LEON3
+       bool "Gaisler APBUART"
+       help
+         Select this to enable a debug UART using the serial_leon3 driver. You
+         will need to provide parameters to make this work. The driver will
+         be available until the real driver model serial is running.
+
 endchoice
 
 config DEBUG_UART_BASE

--
2.4.3

________________________________
Disclaimer and confidentiality note ? refer to our website for further details: www.spaceteq.co.za <http://www.spaceteq.co.za/home/emaildisclaimer/>

#13 lore raw

cover sparc: Updates to SPARC architecture in preperation for generic board

In reply to Francois Retief
Quoted 5 lines · Francois Retief

This patch series is a backlog of preparation work for upcomming generic board changes.

I first want to get these reviewed and submitted to mainline before sending out more patches.

Something seriously broke all of the whitespace in this series :( Please fix and re-send as v2, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151112/c19601c2/attachment.sig>