]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARC: HSDK-4xD: add initial board support
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Tue, 21 Apr 2020 21:33:40 +0000 (00:33 +0300)
committerAlexey Brodkin <abrodkin@synopsys.com>
Mon, 27 Apr 2020 08:20:25 +0000 (11:20 +0300)
Add initial HSDK-4xD board support.
The ARC HS4x/HS4xD Development Kit includes a multicore ARC HS4xD-based
chip that integrates a wide range of interfaces including Ethernet,
HDMI, WiFi, Bluetooth, USB, SDIO, I2C, SPI, UART, I2S, ADC, PWM and
GPIO, as well as a Think Silicon GPU.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
arch/arc/Kconfig
board/synopsys/hsdk/Kconfig
board/synopsys/hsdk/MAINTAINERS
board/synopsys/hsdk/config.mk
board/synopsys/hsdk/hsdk.c
configs/hsdk_4xd_defconfig [new file with mode: 0644]

index 545fc3e243cdf0b8c1d05237b84fde3432e2309a..ea875711e70bbe6428ff406a0dc95d66bae64792 100644 (file)
@@ -175,7 +175,7 @@ config TARGET_EMSDP
        select CPU_ARCEM6
 
 config TARGET_HSDK
-       bool "Support Synpsys HS DevelopmentKit board"
+       bool "Support Synopsys HSDK or HSDK-4xD board"
 
 config TARGET_IOT_DEVKIT
        bool "Synopsys Brite IoT Development kit"
index e8c00a6e7d078a62e288b4981a85e467e4bdc87b..5e23b3229a9fb8d380c998802623fd7a996a1094 100644 (file)
@@ -9,4 +9,21 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "hsdk"
 
+choice
+       prompt "HSDK board type"
+       default BOARD_HSDK
+
+config BOARD_HSDK
+       bool "ARC HS Development Kit"
+       help
+         ARC HS Development Kit based on quard core ARC HS38 processor
+
+config BOARD_HSDK_4XD
+       bool "ARC HS4x/HS4xD Development Kit"
+       help
+         ARC HS4x/HS4xD Development Kit based on quard core ARC HS48/HS47D
+         processor
+
+endchoice
+
 endif
index e22bd1e40b26d5bd3e283e77c90b500c3c6dd14c..d385951048f9f92dfeb879f8f97673291caabb73 100644 (file)
@@ -1,5 +1,6 @@
-HSDK BOARD
+HSDK BOARDs
 M:     Eugeniy Paltsev <paltsev@synopsys.com>
 S:     Maintained
 F:     board/synopsys/hsdk/
 F:     configs/hsdk_defconfig
+F:     configs/hsdk_4xd_defconfig
index 5ae22fa2b75e4233e1d47d97b90fd94cb30f351d..1d01ef50379ba74606473e60e4a5b631dd317739 100644 (file)
@@ -2,9 +2,17 @@
 #
 # Copyright (C) 2018 Synopsys, Inc. All rights reserved.
 
+ifdef CONFIG_BOARD_HSDK
 PLATFORM_CPPFLAGS += -mcpu=hs38_linux -mlittle-endian -matomic -mll64 \
                      -mdiv-rem -mswap -mnorm -mmpy-option=9 -mbarrel-shifter \
                      -mfpu=fpud_all
+endif
+
+ifdef CONFIG_BOARD_HSDK_4XD
+PLATFORM_CPPFLAGS += -mcpu=hs4x_rel31 -mlittle-endian -matomic -mll64 \
+                     -mdiv-rem -mswap -mnorm -mmpy-option=9 -mbarrel-shifter \
+                     -mfpu=fpud_all
+endif
 
 bsp-generate: u-boot u-boot.bin
        $(Q)python3 $(srctree)/board/$(BOARDDIR)/headerize-hsdk.py \
index 67a29e334d7535ca41350d80c999d19efe086c0e..771f7bbf8868b8fcb2d9c147620b03072d3565c2 100644 (file)
@@ -154,6 +154,56 @@ static const struct env_map_percpu env_map_go[] = {
        {}
 };
 
+enum board_type {
+       T_BOARD_NONE,
+       T_BOARD_HSDK,
+       T_BOARD_HSDK_4XD
+};
+
+static inline enum board_type get_board_type_runtime(void)
+{
+       u32 arc_id = read_aux_reg(ARC_AUX_IDENTITY) & 0xFF;
+
+       if (arc_id == 0x52)
+               return T_BOARD_HSDK;
+       else if (arc_id == 0x54)
+               return T_BOARD_HSDK_4XD;
+       else
+               return T_BOARD_NONE;
+}
+
+static inline enum board_type get_board_type_config(void)
+{
+       if (IS_ENABLED(CONFIG_BOARD_HSDK))
+               return T_BOARD_HSDK;
+       else if (IS_ENABLED(CONFIG_BOARD_HSDK_4XD))
+               return T_BOARD_HSDK_4XD;
+       else
+               return T_BOARD_NONE;
+}
+
+static bool is_board_match_runtime(enum board_type type_req)
+{
+       return get_board_type_runtime() == type_req;
+}
+
+static const char * board_name(enum board_type type)
+{
+       switch (type) {
+               case T_BOARD_HSDK:
+                       return "ARC HS Development Kit";
+               case T_BOARD_HSDK_4XD:
+                       return "ARC HS4x/HS4xD Development Kit";
+               default:
+                       return "?";
+       }
+}
+
+static bool board_mismatch(void)
+{
+       return get_board_type_config() != get_board_type_runtime();
+}
+
 static void sync_cross_cpu_data(void)
 {
        u32 value;
@@ -221,7 +271,9 @@ static void init_cluster_nvlim(void)
 
        flush_dcache_all();
        write_aux_reg(ARC_AUX_NON_VOLATILE_LIMIT, val);
-       write_aux_reg(AUX_AUX_CACHE_LIMIT, val);
+       /* AUX_AUX_CACHE_LIMIT reg is missing starting from HS48 */
+       if (is_board_match_runtime(T_BOARD_HSDK))
+               write_aux_reg(AUX_AUX_CACHE_LIMIT, val);
        flush_n_invalidate_dcache_all();
 }
 
@@ -758,6 +810,11 @@ static int do_hsdk_go(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
        int ret;
 
+       if (board_mismatch()) {
+               printf("ERR: U-boot is not configured for this board!\n");
+               return CMD_RET_FAILURE;
+       }
+
        /*
         * Check for 'halt' parameter. 'halt' = enter halt-mode just before
         * starting the application; can be used for debug.
@@ -798,6 +855,11 @@ static int do_hsdk_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]
        static bool done = false;
        int ret;
 
+       if (board_mismatch()) {
+               printf("ERR: U-boot is not configured for this board!\n");
+               return CMD_RET_FAILURE;
+       }
+
        /* hsdk_init can be run only once */
        if (done) {
                printf("HSDK HW is already initialized! Please reset the board if you want to change the configuration.\n");
@@ -1031,6 +1093,11 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-       puts("Board: Synopsys ARC HS Development Kit\n");
+       printf("Board: Synopsys %s\n", board_name(get_board_type_runtime()));
+
+       if (board_mismatch())
+               printf("WARN: U-boot is configured NOT for this board but for %s!\n",
+                      board_name(get_board_type_config()));
+
        return 0;
 };
diff --git a/configs/hsdk_4xd_defconfig b/configs/hsdk_4xd_defconfig
new file mode 100644 (file)
index 0000000..ccce534
--- /dev/null
@@ -0,0 +1,67 @@
+CONFIG_ARC=y
+CONFIG_ISA_ARCV2=y
+CONFIG_TARGET_HSDK=y
+CONFIG_BOARD_HSDK_4XD=y
+CONFIG_SYS_TEXT_BASE=0x81000000
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BASE=0xf0005000
+CONFIG_DEBUG_UART_CLOCK=33333333
+CONFIG_SYS_CLK_FREQ=500000000
+CONFIG_DEBUG_UART=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200n8"
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="hsdk-4xd# "
+CONFIG_CMD_ENV_FLAGS=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_EMBED=y
+CONFIG_DEFAULT_DEVICE_TREE="hsdk"
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_INTERFACE="mmc"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM=y
+CONFIG_CLK_HSDK=y
+CONFIG_HSDK_CREG_GPIO=y
+CONFIG_MMC=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_SNPS=y
+CONFIG_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_SST=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+CONFIG_DM_RESET=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_SYS_NS16550=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_DESIGNWARE_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
+CONFIG_USB_STORAGE=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_PANIC_HANG=y