Skip to contentSkip to conversation

arm: add support for Hisilicon HiSTB family SoCs

PATCH In review Yang Xiwen 3 participants 8 messages Apr 1, 2023 – Jun 14, 2023 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Yang Xiwen

author
#1 lore raw

PATCH 1/4 arm: add support for Hisilicon HiSTB family SoCs

First supported chip is hi3798mv200 (which is similar to Hi3798cv200 used by poplar).

---
 MAINTAINERS                        |  1 +
 arch/arm/Kconfig                   | 12 ++++++++++++
 arch/arm/Makefile                  |  1 +
 arch/arm/mach-histb/Kconfig        | 14 ++++++++++++++
 arch/arm/mach-histb/Makefile       |  4 ++++
 arch/arm/mach-histb/board_common.c | 31 ++++++++++++++++++++++++++++++
 arch/arm/mach-histb/sysmap-histb.c | 31 ++++++++++++++++++++++++++++++
 7 files changed, 94 insertions(+)
 create mode 100644 arch/arm/mach-histb/Kconfig
 create mode 100644 arch/arm/mach-histb/Makefile
 create mode 100644 arch/arm/mach-histb/board_common.c
 create mode 100644 arch/arm/mach-histb/sysmap-histb.c
MAINTAINERS +1 -0
index 91d40ea4b6..ea7bf5e04c 100644
@@ -291,6 +291,7 @@ S:	Maintained
 F:	arch/arm/cpu/armv8/hisilicon
 F:	arch/arm/include/asm/arch-hi6220/
 F:	arch/arm/include/asm/arch-hi3660/
+F:	arch/arm/mach-histb
 
 ARM HPE GXP ARCHITECTURE
 M:	Jean-Marie Verdun <[email protected]>
arch/arm/Kconfig +12 -0
index 8a1e223422..a80322a48a 100644
@@ -578,6 +578,16 @@ config ARCH_DAVINCI
 	help
 	  Support for TI's DaVinci platform.
 
+config ARCH_HISTB
+	bool "Hisilicon HiSTB SoCs"
+	select DM
+	select DM_SERIAL
+	select OF_CONTROL
+	select PL01X_SERIAL
+	imply CMD_DM
+	help
+	  Support for HiSTB SoCs.
+
 config ARCH_KIRKWOOD
 	bool "Marvell Kirkwood"
 	select ARCH_MISC_INIT
@@ -2156,6 +2166,8 @@ source "arch/arm/mach-hpe/gxp/Kconfig"
 
 source "arch/arm/mach-highbank/Kconfig"
 
+source "arch/arm/mach-histb/Kconfig"
+
 source "arch/arm/mach-integrator/Kconfig"
 
 source "arch/arm/mach-ipq40xx/Kconfig"
arch/arm/Makefile +1 -0
index ac602aed9c..5ebe0619d3 100644
@@ -61,6 +61,7 @@ machine-$(CONFIG_ARCH_DAVINCI)		+= davinci
 machine-$(CONFIG_ARCH_EXYNOS)		+= exynos
 machine-$(CONFIG_ARCH_GXP)		+= hpe
 machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
+machine-$(CONFIG_ARCH_HISTB)		+= histb
 machine-$(CONFIG_ARCH_IPQ40XX)		+= ipq40xx
 machine-$(CONFIG_ARCH_K3)		+= k3
 machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
arch/arm/mach-histb/Kconfig new file +14 -0
new file mode 100644
index 0000000000..78d40859a3
@@ -0,0 +1,14 @@
+if ARCH_HISTB
+
+choice
+	prompt "Select a HiSTB SoC"
+
+config ARCH_HI3798MV2X
+	bool "Hi3798M V2XX series SoC"
+	select ARM64
+	help
+	  Support for Hi3798MV2XX series SoCs.
+
+endchoice
+
+endif
arch/arm/mach-histb/Makefile new file +4 -0
new file mode 100644
index 0000000000..7975c0f2a0
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier:	GPL-2.0+
+
+obj-y += sysmap-histb.o
+obj-y += board_common.o
arch/arm/mach-histb/board_common.c new file +31 -0
new file mode 100644
index 0000000000..a26c2066e0
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Board init file for all histb boards
+ *
+ * (C) Copyright 2023 Yang Xiwen <[email protected]>
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <init.h>
+#include <asm/system.h>
+
+int __weak board_init(void)
+{
+	return 0;
+}
+
+int __weak dram_init_banksize(void)
+{
+	return fdtdec_setup_memory_banksize();
+}
+
+int __weak dram_init(void)
+{
+	return fdtdec_setup_mem_size_base();
+}
+
+void __weak reset_cpu(void)
+{
+	psci_system_reset();
+}
arch/arm/mach-histb/sysmap-histb.c new file +31 -0
new file mode 100644
index 0000000000..83a2bb9417
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Hisilicon HiSTB memory map
+ *
+ * (C) Copyright 2023 Yang Xiwen <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+static struct mm_region histb_mem_map[] = {
+	{
+		.virt = 0x0UL, /* DRAM */
+		.phys = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.virt = 0x80000000UL, /* Peripheral block */
+		.phys = 0x80000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* Terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = histb_mem_map;
Signature · 1 line
2.39.1
#2 lore raw
Quoted 4 lines · Yang Xiwen

First supported chip is hi3798mv200 (which is similar to Hi3798cv200 used by poplar).

For the series, applied to u-boot/master, thanks!

Signature · 1 line
Tom
author
#3 lore raw
Quoted 9 lines · Tom Rini
Quoted 4 lines · Yang Xiwen

First supported chip is hi3798mv200 (which is similar to Hi3798cv200 used by poplar).

For the series, applied to u-boot/master, thanks!

Oops, I almost forgot this and had done a lot of updates since then. There are still many things to do and I will send them out when I think it is ready. Anyway, thanks for your reply, Tom. I guess next time I can request for you to pull instead of mailing a series of patches, right?

Signature · 2 lines
Best regards,
Yang Xiwen
#4 lore raw
Quoted 6 lines · Yang Xiwen
Quoted 5 lines · Tom Rini
Quoted 3 lines · Yang Xiwen

First supported chip is hi3798mv200 (which is similar to Hi3798cv200 used by poplar).

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

For the series, applied to u-boot/master, thanks!

Oops, I almost forgot this and had done a lot of updates since then. There are still many things to do and I will send them out when I think it is ready. Anyway, thanks for your reply, Tom. I guess next time I can request for you to pull instead of mailing a series of patches, right?

A series of patches is still the best path forward, thanks.

Signature · 1 line
Tom
author
#5 lore raw

PATCH 2/4 mmc: hi6220_dw_mmc: add compatible for HC2910 support

In reply to a message not in the archive

It adds compatible "hisilicon,hi3798mv200-dw-mshc" for HC2910 SoC Hi3798MV200 to probe this mmc driver.

---
 drivers/mmc/hi6220_dw_mmc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/hi6220_dw_mmc.c +2 -0
index 2cec5b9ae3..71962cd47e 100644
@@ -100,6 +100,8 @@ static const struct udevice_id hi6220_dwmmc_ids[] = {
 	  .data = (ulong)&hi6220_mmc_data },
 	{ .compatible = "hisilicon,hi3798cv200-dw-mshc",
 	  .data = (ulong)&hi6220_mmc_data },
+	{ .compatible = "hisilicon,hi3798mv200-dw-mshc",
+	  .data = (ulong)&hi6220_mmc_data },
 	{ .compatible = "hisilicon,hi3660-dw-mshc",
 	  .data = (ulong)&hi3660_mmc_data },
 	{ }
Signature · 1 line
2.39.1
#6 lore raw

Re: [PATCH 2/4] mmc: hi6220_dw_mmc: add compatible for HC2910 support

Quoted 2 lines · Yang Xiwen

It adds compatible "hisilicon,hi3798mv200-dw-mshc" for HC2910 SoC Hi3798MV200 to probe this mmc driver.

It would be better if you could write more information, about why it reuse the data structure of hi6220_mmc_data.

Regards,
Peng.

Quoted 19 lines
---
  drivers/mmc/hi6220_dw_mmc.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/mmc/hi6220_dw_mmc.c +2 -0
index 2cec5b9ae3..71962cd47e 100644
@@ -100,6 +100,8 @@ static const struct udevice_id hi6220_dwmmc_ids[] = {
  	  .data = (ulong)&hi6220_mmc_data },
  	{ .compatible = "hisilicon,hi3798cv200-dw-mshc",
  	  .data = (ulong)&hi6220_mmc_data },
+	{ .compatible = "hisilicon,hi3798mv200-dw-mshc",
+	  .data = (ulong)&hi6220_mmc_data },
  	{ .compatible = "hisilicon,hi3660-dw-mshc",
  	  .data = (ulong)&hi3660_mmc_data },
  	{ }
author
#7 lore raw

PATCH 3/4 dt-binding: histb-clock: add clocks definition for Hi3798MV200

In reply to a message not in the archive

These clocks are found on Hi3798MV200

---
 include/dt-bindings/clock/histb-clock.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/dt-bindings/clock/histb-clock.h +12 -0
index 136de24733..8a05790d1a 100644
@@ -70,6 +70,18 @@
 #define HISTB_USB3_UTMI_CLK1		48
 #define HISTB_USB3_PIPE_CLK1		49
 #define HISTB_USB3_SUSPEND_CLK1		50
+#define HISTB_SDIO1_BIU_CLK		51
+#define HISTB_SDIO1_CIU_CLK		52
+#define HISTB_SDIO1_DRV_CLK		53
+#define HISTB_SDIO1_SAMPLE_CLK		54
+
+/* Hi3798MV200 specific clocks */
+
+// reuse clocks of histb
+#define HI3798MV200_GMAC_CLK		HISTB_ETH0_MAC_CLK
+#define HI3798MV200_GMACIF_CLK		HISTB_ETH0_MACIF_CLK
+#define HI3798MV200_FEMAC_CLK		HISTB_ETH1_MAC_CLK
+#define HI3798MV200_FEMACIF_CLK		HISTB_ETH1_MACIF_CLK
 
 /* clocks provided by mcu CRG */
 #define HISTB_MCE_CLK			1
Signature · 1 line
2.39.1
author
#8 lore raw

PATCH 4/4 arm: histb: hi3798mv200: add initial support for Hi3798MV200 HC2910-2AGHD05 board

In reply to a message not in the archive

A board with Hi3798MV200 SoC and various peripherals. Details are in the board README.md.

---
 .../hi3798mv200-hc2910-2aghd05-u-boot.dtsi    |   8 +
 arch/arm/dts/hi3798mv200-hc2910-2aghd05.dts   |  71 ++++++
 arch/arm/dts/hi3798mv200-u-boot.dtsi          |  22 ++
 arch/arm/dts/hi3798mv200.dtsi                 | 225 ++++++++++++++++++
 arch/arm/mach-histb/Kconfig                   |  25 ++
 board/skyworth/hc2910-2aghd05/Kconfig         |  15 ++
 board/skyworth/hc2910-2aghd05/MAINTAINERS     |   6 +
 board/skyworth/hc2910-2aghd05/Makefile        |   1 +
 board/skyworth/hc2910-2aghd05/README          |  25 ++
 .../skyworth/hc2910-2aghd05/hc2910-2aghd05.c  |  26 ++
 configs/hc2910_2aghd05_defconfig              |  50 ++++
 include/configs/hc2910-2aghd05.h              |   6 +
 12 files changed, 480 insertions(+)
 create mode 100644 arch/arm/dts/hi3798mv200-hc2910-2aghd05-u-boot.dtsi
 create mode 100644 arch/arm/dts/hi3798mv200-hc2910-2aghd05.dts
 create mode 100644 arch/arm/dts/hi3798mv200-u-boot.dtsi
 create mode 100644 arch/arm/dts/hi3798mv200.dtsi
 create mode 100644 board/skyworth/hc2910-2aghd05/Kconfig
 create mode 100644 board/skyworth/hc2910-2aghd05/MAINTAINERS
 create mode 100644 board/skyworth/hc2910-2aghd05/Makefile
 create mode 100644 board/skyworth/hc2910-2aghd05/README
 create mode 100644 board/skyworth/hc2910-2aghd05/hc2910-2aghd05.c
 create mode 100644 configs/hc2910_2aghd05_defconfig
 create mode 100644 include/configs/hc2910-2aghd05.h
arch/arm/dts/hi3798mv200-hc2910-2aghd05-u-boot.dtsi new file +8 -0
new file mode 100644
index 0000000000..eb320761f2
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include "hi3798mv200-u-boot.dtsi"
+
+/* The clock driver is missing */
+&sd0 {
+	status = "disabled";
+};
arch/arm/dts/hi3798mv200-hc2910-2aghd05.dts new file +71 -0

71 lines not on this page · raw message

arch/arm/dts/hi3798mv200-u-boot.dtsi new file +22 -0
new file mode 100644
index 0000000000..8917bcf33d
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * U-Boot addition to:
+ *  1) use platform data for the console
+ *
+ */
+
+#include <dt-bindings/reset/ti-syscon.h>
+
+/* The driver in U-Boot does not support "snps,dw-mshc" compatible. */
+&sd0 {
+	compatible = "hisilicon,hi3798mv200-dw-mshc";
+};
+
+&sd1 {
+	compatible = "hisilicon,hi3798mv200-dw-mshc";
+};
+
+/* The clock driver is missing */
+&uart0 {
+	clock = <75000000>;
+};
arch/arm/dts/hi3798mv200.dtsi new file +225 -0

225 lines not on this page · raw message

arch/arm/mach-histb/Kconfig +25 -0
index 78d40859a3..012dbfe8bc 100644
@@ -11,4 +11,29 @@ config ARCH_HI3798MV2X
 
 endchoice
 
+if ARCH_HI3798MV2X
+
+choice
+	prompt "Select a Hi3798M V2XX based board"
+
+config TARGET_HC2910_2AGHD05
+	bool "Skyworth HC2910 with board label 2AGHD05"
+	help
+	  Support for Skyworth HC2910 with board label 2AGHD05. This board features:
+	  - Hisilicon Hi3798MV200 SoC (4xCortex-A53, Mali MP-450)
+	  - 2GiB DRAM
+	  - 8GiB eMMC, uSD slot
+	  - Wifi and Bluetooth module
+	  - 1x USB 2.0, 1x USB 3.0 host port
+	  - HDMI
+	  - SCI
+	  - 3 LED - power, Wifi, Lock(?)
+	  - 1x Fast Ethernet Controller, 1x GBe Ethernet Controller
+
+endchoice
+
+endif
+
+source "board/skyworth/hc2910-2aghd05/Kconfig"
+
 endif
board/skyworth/hc2910-2aghd05/Kconfig new file +15 -0
new file mode 100644
index 0000000000..f85f1f2631
@@ -0,0 +1,15 @@
+if TARGET_HC2910_2AGHD05
+
+config SYS_BOARD
+	default "hc2910-2aghd05"
+
+config SYS_VENDOR
+	default "skyworth"
+
+config SYS_SOC
+	default "hi3798mv200"
+
+config SYS_CONFIG_NAME
+	default "hc2910-2aghd05"
+
+endif
board/skyworth/hc2910-2aghd05/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..2c1e750018
@@ -0,0 +1,6 @@
+HC2910 2AGHD05 BOARD
+M: Yang Xiwen <[email protected]>
+S: Maintained
+F: board/skyworth/hc2910-2aghd05
+F: include/configs/hc2910-2aghd05.h
+F: configs/hc2910_2aghd05_defconfig
board/skyworth/hc2910-2aghd05/Makefile new file +1 -0
new file mode 100644
index 0000000000..193fd158fe
@@ -0,0 +1 @@
+obj-y	:= hc2910-2aghd05.o
board/skyworth/hc2910-2aghd05/README new file +25 -0
new file mode 100644
index 0000000000..a838956e59
@@ -0,0 +1,25 @@
+================================================================================
+			Board Information
+================================================================================
+
+The board features the Hi3798M V200 with an integrated quad-core 64-bit ARM
+Cortex A53 processor.
+SOC  Hisilicon Hi3798CV200
+CPU  Quad-core ARM Cortex-A53 64 bit
+DRAM DDR3/3L/4 SDRAM interface, maximum 32-bit data width 2 GB
+USB  1x USB 2.0 ports 1x USB 3.0 ports
+CONSOLE  USB-micro port for console support
+ETHERNET  1 GBe Ethernet, 1 MBe Ethernet
+WIFI  802.11n with Bluebooth
+CONNECTORS  One connector for Smart Card One connector for TSI
+
+
+================================================================================
+			BUILD INSTRUCTIONS
+================================================================================
+
+The U-Boot relies on a modified l-loader and TF-A for Hi3798MV200.
+The source for l-loader can be obtained at: [l-loader](https://github.com/185264646/l-loader)
+The mainline port for TF-A is still under development. For now, you can use the TF-A for poplar directly.
+
+For more information, please refer to <board/hisilicon/poplar/README>.
board/skyworth/hc2910-2aghd05/hc2910-2aghd05.c new file +26 -0
new file mode 100644
index 0000000000..abad5efdaf
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Board init file for Skyworth HC2910 2AGHD05
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <init.h>
+#include <asm/system.h>
+#include <linux/io.h>
+
+#define HI3798MV200_PERI_CTRL_BASE 0xf8a20000
+#define SDIO0_LDO_OFFSET 0x11c
+
+static int sdio0_set_ldo(void)
+{
+	// SDIO LDO bypassed, 3.3V
+	writel(HI3798MV200_PERI_CTRL_BASE + SDIO0_LDO_OFFSET, 0x60);
+	return 0;
+}
+
+int board_init(void)
+{
+	sdio0_set_ldo();
+	return 0;
+}
configs/hc2910_2aghd05_defconfig new file +50 -0

50 lines not on this page · raw message

include/configs/hc2910-2aghd05.h new file +6 -0
new file mode 100644
index 0000000000..3db9a474ec
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __HC2910_2AGHD05_CONFIG_H__
+#define __HC2910_2AGHD05_CONFIG_H__
+
+#endif
Signature · 1 line
2.39.1