ARC: nsim_hs38: Add support of Virtio NET & BLK
authorAlexey Brodkin <abrodkin@synopsys.com>
Thu, 26 Dec 2019 11:47:42 +0000 (14:47 +0300)
committerAlexey Brodkin <abrodkin@synopsys.com>
Wed, 12 Feb 2020 17:40:24 +0000 (20:40 +0300)
Given now nsim_hs38 configuration is usable on QEMU and in QEMU
we have Virtio working perfectly fine the next logical step
is to add support of supported & known to work net & bkl to this
config.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
arch/arc/Kconfig
arch/arc/dts/nsim.dts
board/synopsys/Kconfig [deleted file]
board/synopsys/nsim/Kconfig [new file with mode: 0644]
board/synopsys/nsim/MAINTAINERS [new file with mode: 0644]
board/synopsys/nsim/Makefile [new file with mode: 0644]
board/synopsys/nsim/nsim.c [new file with mode: 0644]
configs/nsim_hs38_defconfig

index 0cb97207db4c082a64633486e2a45edb208c6014..545fc3e243cdf0b8c1d05237b84fde3432e2309a 100644 (file)
@@ -160,7 +160,7 @@ config TARGET_TB100
        bool "Support tb100"
 
 config TARGET_NSIM
-       bool "Support standalone nSIM & Free nSIM"
+       bool "Support ARC simulation & prototyping platforms"
 
 config TARGET_AXS101
        bool "Support Synopsys Designware SDP board AXS101"
@@ -184,10 +184,10 @@ config TARGET_IOT_DEVKIT
 endchoice
 
 source "board/abilis/tb100/Kconfig"
-source "board/synopsys/Kconfig"
 source "board/synopsys/axs10x/Kconfig"
 source "board/synopsys/emsdp/Kconfig"
 source "board/synopsys/hsdk/Kconfig"
 source "board/synopsys/iot_devkit/Kconfig"
+source "board/synopsys/nsim/Kconfig"
 
 endmenu
index 43f281dfec08d702d5a6952a5039b0912d2d6b1b..c2899ef2ea64d317e6f4e1692b30e43785775c85 100644 (file)
                clock-frequency = <70000000>;
        };
 
+       virtio0: virtio@f0100000 {
+               compatible = "virtio,mmio";
+               reg = <0xf0100000 0x2000>;
+       };
+
+       virtio1: virtio@f0102000 {
+               compatible = "virtio,mmio";
+               reg = <0xf0102000 0x2000>;
+       };
+
+       virtio2: virtio@f0104000 {
+               compatible = "virtio,mmio";
+               reg = <0xf0104000 0x2000>;
+       };
+
+       virtio3: virtio@f0106000 {
+               compatible = "virtio,mmio";
+               reg = <0xf0106000 0x2000>;
+       };
+
+       virtio4: virtio@f0108000 {
+               compatible = "virtio,mmio";
+               reg = <0xf0108000 0x2000>;
+       };
 };
diff --git a/board/synopsys/Kconfig b/board/synopsys/Kconfig
deleted file mode 100644 (file)
index 27e5509..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-if TARGET_NSIM
-
-config SYS_VENDOR
-       default "synopsys"
-
-config SYS_CONFIG_NAME
-       default "nsim"
-
-endif
diff --git a/board/synopsys/nsim/Kconfig b/board/synopsys/nsim/Kconfig
new file mode 100644 (file)
index 0000000..2228703
--- /dev/null
@@ -0,0 +1,12 @@
+if TARGET_NSIM
+
+config SYS_BOARD
+       default "nsim"
+
+config SYS_VENDOR
+       default "synopsys"
+
+config SYS_CONFIG_NAME
+       default "nsim"
+
+endif
diff --git a/board/synopsys/nsim/MAINTAINERS b/board/synopsys/nsim/MAINTAINERS
new file mode 100644 (file)
index 0000000..ad23c83
--- /dev/null
@@ -0,0 +1,6 @@
+ARC SIMULATION & PROTOTYPING PLATFORMS
+M:     Alexey Brodkin <abrodkin@synopsys.com>
+S:     Maintained
+F:     arch/arc/dts/nsim.dts
+F:     board/synopsys/nsim/
+F:     configs/nsim_*_defconfig
diff --git a/board/synopsys/nsim/Makefile b/board/synopsys/nsim/Makefile
new file mode 100644 (file)
index 0000000..6aaffff
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2020 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y  += nsim.o
diff --git a/board/synopsys/nsim/nsim.c b/board/synopsys/nsim/nsim.c
new file mode 100644 (file)
index 0000000..f384f70
--- /dev/null
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Synopsys, Inc. All rights reserved.
+ */
+
+#include <common.h>
+#include <dm/device.h>
+#include <virtio_types.h>
+#include <virtio.h>
+
+int board_early_init_r(void)
+{
+       /*
+        * Make sure virtio bus is enumerated so that peripherals
+        * on the virtio bus can be discovered by their drivers
+        */
+       virtio_init();
+
+       return 0;
+}
+
+int checkboard(void)
+{
+       printf("Board: ARC virtual or prototyping platform\n");
+       return 0;
+};
index ce68de3251d9b715d8adc800da8dfeeee441f07f..6cd01a505be0622ecd980f8a7052bdd28b0c5ceb 100644 (file)
@@ -9,14 +9,23 @@ CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200n8"
+CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="nsim# "
+CONFIG_CMD_DM=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="nsim"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
+CONFIG_BLK=y
+CONFIG_HAVE_BLOCK_DEVICE=y
+CONFIG_DM_ETH=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_NET=y
+CONFIG_VIRTIO_BLK=y
 CONFIG_USE_PRIVATE_LIBGCC=y