boards: Add GR716-MINI Development Board

GR716A microcontroller evaluation board with features an 80-pin
mezzanine connector. Also supports simulating with TSIM3.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
diff --git a/boards/sparc/gr716a_mini/Kconfig.board b/boards/sparc/gr716a_mini/Kconfig.board
new file mode 100644
index 0000000..e200d61
--- /dev/null
+++ b/boards/sparc/gr716a_mini/Kconfig.board
@@ -0,0 +1,7 @@
+# Copyright (c) 2019-2020 Cobham Gaisler AB
+#
+# SPDX-License-Identifier: Apache-2.0
+
+config BOARD_GR716A_MINI
+	bool "GR716-MINI Development Board"
+	depends on SOC_GR716A
diff --git a/boards/sparc/gr716a_mini/Kconfig.defconfig b/boards/sparc/gr716a_mini/Kconfig.defconfig
new file mode 100644
index 0000000..2106481
--- /dev/null
+++ b/boards/sparc/gr716a_mini/Kconfig.defconfig
@@ -0,0 +1,13 @@
+# Copyright (c) 2019-2020 Cobham Gaisler AB
+#
+# SPDX-License-Identifier: Apache-2.0
+
+if BOARD_GR716A_MINI
+
+config BOARD
+	default "gr716a_mini"
+
+config SYS_CLOCK_HW_CYCLES_PER_SEC
+	default 20000000
+
+endif
diff --git a/boards/sparc/gr716a_mini/board.cmake b/boards/sparc/gr716a_mini/board.cmake
new file mode 100644
index 0000000..5129886
--- /dev/null
+++ b/boards/sparc/gr716a_mini/board.cmake
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+
+set(EMU_PLATFORM tsim)
+
+find_program(TSIM tsim-leon3)
+
+set(TSIM_SYS -freq  20 -gr716)
diff --git a/boards/sparc/gr716a_mini/doc/gr716a_mini.jpg b/boards/sparc/gr716a_mini/doc/gr716a_mini.jpg
new file mode 100644
index 0000000..c14ffe9
--- /dev/null
+++ b/boards/sparc/gr716a_mini/doc/gr716a_mini.jpg
Binary files differ
diff --git a/boards/sparc/gr716a_mini/doc/index.rst b/boards/sparc/gr716a_mini/doc/index.rst
new file mode 100644
index 0000000..87fd929
--- /dev/null
+++ b/boards/sparc/gr716a_mini/doc/index.rst
@@ -0,0 +1,216 @@
+.. _gr716a_mini:
+
+GR716-MINI Development Board
+############################
+
+Overview
+********
+
+The GR716-MINI development board provides:
+
+* GR716 microcontroller
+* SPI Flash PROM, 32 MiB
+* SRAM, 2 MiB
+* FTDI USB interface for UART debug link (AHBUART) and application UART
+  (APBUART).
+* 4x MMCX connectors (2 ADC, 2 DAC)
+* Miniature 80 pin mezzanine connector (bottom side)
+
+.. figure:: gr716a_mini.jpg
+   :width: 543px
+   :align: center
+   :alt: GR716-MINI Development Board
+
+   GR716-MINI Development Board (Credit: Cobham Gaisler AB)
+
+Hardware
+********
+
+Console Output
+==============
+
+By default, the kernel is configured to send console output to the
+first APBUART peripheral (apbuart0). The UART debug forwarding setting,
+if enabled in GRMON, is preserved.
+
+Programming and Debugging
+*************************
+
+Building
+========
+
+Applications for the ``gr716a_mini`` board configuration can be built
+as usual (see :ref:`build_an_application`).
+In order to build the application for ``gr716a_mini``, set the ``BOARD``
+variable to ``gr716a_mini``.
+
+The application is linked to the on-chip tightly coupled memory by
+default.
+
+Running on hardware
+===================
+
+Connect with GRMON, then load and run the application.
+
+.. code-block:: console
+
+    $ grmon -u -cginit 0x00010000 -uart /dev/ttyUSB0
+      GRMON debug monitor v3.2.8
+
+      Copyright (C) 2020 Cobham Gaisler - All rights reserved.
+      For latest updates, go to http://www.gaisler.com/
+      Comments or bug-reports to support@gaisler.com
+
+      Device ID:           0x716
+      GRLIB build version: 4204
+      Detected system:     GR716
+      Detected frequency:  20.0 MHz
+
+      Component                            Vendor
+      AHB-to-AHB Bridge                    Cobham Gaisler
+      MIL-STD-1553B Interface              Cobham Gaisler
+      GRSPW2 SpaceWire Serial Link         Cobham Gaisler
+      SPI to AHB Bridge                    Cobham Gaisler
+      I2C to AHB Bridge                    Cobham Gaisler
+      CAN Controller with DMA              Cobham Gaisler
+      CAN Controller with DMA              Cobham Gaisler
+      AHB Debug UART                       Cobham Gaisler
+      AHB-to-AHB Bridge                    Cobham Gaisler
+      PacketWire Receiver with DMA         Cobham Gaisler
+      PacketWire Transmitter with DMA      Cobham Gaisler
+      GRDMAC DMA Controller                Cobham Gaisler
+      GRDMAC DMA Controller                Cobham Gaisler
+      GRDMAC DMA Controller                Cobham Gaisler
+      GRDMAC DMA Controller                Cobham Gaisler
+      Dual-port SPI Slave                  Cobham Gaisler
+      LEON3FT SPARC V8 Processor           Cobham Gaisler
+      AHB-to-AHB Bridge                    Cobham Gaisler
+      AHB Memory Scrubber                  Cobham Gaisler
+      AHB-to-AHB Bridge                    Cobham Gaisler
+      AHB Debug UART                       Cobham Gaisler
+      Dual-port AHB(/CPU) On-Chip RAM      Cobham Gaisler
+      Dual-port AHB(/CPU) On-Chip RAM      Cobham Gaisler
+      Generic AHB ROM                      Cobham Gaisler
+      Memory controller with EDAC          Cobham Gaisler
+      SPI Memory Controller                Cobham Gaisler
+      SPI Memory Controller                Cobham Gaisler
+      AHB/APB Bridge                       Cobham Gaisler
+      AHB/APB Bridge                       Cobham Gaisler
+      AHB/APB Bridge                       Cobham Gaisler
+      AHB/APB Bridge                       Cobham Gaisler
+      Memory controller with EDAC          Cobham Gaisler
+      LEON3 Debug Support Unit             Cobham Gaisler
+      AHB/APB Bridge                       Cobham Gaisler
+      AMBA Trace Buffer                    Cobham Gaisler
+      Multi-processor Interrupt Ctrl.      Cobham Gaisler
+      Modular Timer Unit                   Cobham Gaisler
+      Modular Timer Unit                   Cobham Gaisler
+      GR716 AMBA Protection unit           Cobham Gaisler
+      Clock gating unit                    Cobham Gaisler
+      Clock gating unit                    Cobham Gaisler
+      General Purpose Register             Cobham Gaisler
+      LEON3 Statistics Unit                Cobham Gaisler
+      AHB Status Register                  Cobham Gaisler
+      CCSDS TDP / SpaceWire I/F            Cobham Gaisler
+      General Purpose Register Bank        Cobham Gaisler
+      General Purpose Register             Cobham Gaisler
+      GR716 AMBA Protection unit           Cobham Gaisler
+      GR716 Bandgap                        Cobham Gaisler
+      GR716 Brownout detector              Cobham Gaisler
+      GR716 Phase-locked loop              Cobham Gaisler
+      Generic UART                         Cobham Gaisler
+      Generic UART                         Cobham Gaisler
+      Generic UART                         Cobham Gaisler
+      Generic UART                         Cobham Gaisler
+      Generic UART                         Cobham Gaisler
+      Generic UART                         Cobham Gaisler
+      AHB Status Register                  Cobham Gaisler
+      ADC / DAC Interface                  Cobham Gaisler
+      SPI Controller                       Cobham Gaisler
+      SPI Controller                       Cobham Gaisler
+      PWM generator                        Cobham Gaisler
+      General Purpose I/O port             Cobham Gaisler
+      General Purpose I/O port             Cobham Gaisler
+      AMBA Wrapper for OC I2C-master       Cobham Gaisler
+      AMBA Wrapper for OC I2C-master       Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Analog-to-Digital Conv         Cobham Gaisler
+      GR716 Digital-to-Analog Conv         Cobham Gaisler
+      GR716 Digital-to-Analog Conv         Cobham Gaisler
+      GR716 Digital-to-Analog Conv         Cobham Gaisler
+      GR716 Digital-to-Analog Conv         Cobham Gaisler
+      I2C Slave                            Cobham Gaisler
+      I2C Slave                            Cobham Gaisler
+      PWM generator                        Cobham Gaisler
+      LEON3 Statistics Unit                Cobham Gaisler
+      General Purpose Register             Cobham Gaisler
+
+      Use command 'info sys' to print a detailed report of attached cores
+
+    grmon3> load zephyr/zephyr.elf
+          31000000 text              16.2kB /  16.2kB   [===============>] 100%
+          300040A8 initlevel           40B              [===============>] 100%
+          300040D0 rodata             484B              [===============>] 100%
+          300042B4 datas               20B              [===============>] 100%
+          300042C8 sw_isr_table       256B              [===============>] 100%
+          300043C8 devices             36B              [===============>] 100%
+      Total size: 16.98kB (1.91Mbit/s)
+      Entry point 0x31000000
+      Image zephyr/zephyr.elf loaded
+
+    grmon3> run
+    *** Booting Zephyr OS build zephyr-v2.4.0-788-gc82a8736a65e  ***
+    Hello World! gr716a_mini
+
+
+Running in simulation
+=====================
+
+The same application binary can be simulated with the TSIM3 LEON3 simulator.
+
+.. code-block:: console
+
+    $ tsim-leon3 -freq 20 -gr716
+
+     TSIM3 LEON3 SPARC simulator, version v3.0.2
+
+     Copyright (C) 2020, Cobham Gaisler - all rights reserved.
+     For latest updates, go to https://www.gaisler.com/
+     Comments or bug-reports to support@gaisler.com
+
+    Number of CPUs: 1
+    register windows: 31
+    system frequency: 20.000 MHz
+    using 64-bit time
+    Allocated 128 KiB local instruction RAM memory at 0x31000000
+    Allocated 64 KiB local data RAM memory at 0x30000000
+    Allocated 4096 KiB SRAM memory, in 1 bank at 0x40000000
+    Allocated 2048 KiB ROM memory at 0x01000000
+    Allocated 16384 KiB SPIM ROM memory at 0x02000000
+    Allocated 16384 KiB SPIM ROM memory at 0x04000000
+
+    tsim> load zephyr/zephyr.elf
+      section: text, addr: 0x31000000, size 16956 bytes
+      section: initlevel, addr: 0x30000000, size 40 bytes
+      section: rodata, addr: 0x30000028, size 484 bytes
+      section: datas, addr: 0x3000020c, size 20 bytes
+      section: sw_isr_table, addr: 0x30000220, size 256 bytes
+      section: devices, addr: 0x30000320, size 36 bytes
+      Read 438 symbols
+    tsim> run
+      Initializing and starting from 0x31000000
+    *** Booting Zephyr OS build zephyr-v2.4.0-788-gc82a8736a65e  ***
+    Hello World! gr716a_mini
+
+
+References
+**********
+* `GR716 Evaluation and Development Boards <https://www.gaisler.com/index.php/products/boards/gr716-boards>`_
+* `TSIM3 LEON3 simulator <https://www.gaisler.com/index.php/products/simulators/tsim3/tsim3-leon3>`_
+* `GRMON3 debug monitor <https://www.gaisler.com/index.php/products/debug-tools/grmon3>`_
diff --git a/boards/sparc/gr716a_mini/gr716a_mini.dts b/boards/sparc/gr716a_mini/gr716a_mini.dts
new file mode 100644
index 0000000..3f3db2a
--- /dev/null
+++ b/boards/sparc/gr716a_mini/gr716a_mini.dts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2019-2020 Cobham Gaisler AB
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/dts-v1/;
+
+#include <gr716a.dtsi>
+
+/ {
+	chosen {
+		zephyr,console = &uart0;
+		zephyr,sram = &dram;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
diff --git a/boards/sparc/gr716a_mini/gr716a_mini.yaml b/boards/sparc/gr716a_mini/gr716a_mini.yaml
new file mode 100644
index 0000000..0931646
--- /dev/null
+++ b/boards/sparc/gr716a_mini/gr716a_mini.yaml
@@ -0,0 +1,11 @@
+identifier: gr716a_mini
+name: GR716-MINI Development Board
+type: mcu
+simulation: tsim
+arch: sparc
+toolchain:
+  - zephyr
+  - xtools
+testing:
+  ignore_tags:
+    - net
diff --git a/boards/sparc/gr716a_mini/gr716a_mini_defconfig b/boards/sparc/gr716a_mini/gr716a_mini_defconfig
new file mode 100644
index 0000000..8fa136f
--- /dev/null
+++ b/boards/sparc/gr716a_mini/gr716a_mini_defconfig
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: Apache-2.0
+
+CONFIG_SOC_GR716A=y
+CONFIG_BOARD_GR716A_MINI=y
+CONFIG_CONSOLE=y
+CONFIG_PRINTK=y
+CONFIG_SERIAL=y
+CONFIG_UART_APBUART=y
+CONFIG_UART_CONSOLE=y
+CONFIG_LEON_GPTIMER=y