Skip to contentSkip to conversation

Small patch series to add support for VoCore2 board.

PATCH New MCon 3 participants 6 messages Dec 19, 2019 – Dec 20, 2019 MIPS

lore
Share & tools
lore

MCon

author
#0 lore raw

cover Small patch series to add support for VoCore2 board.

Details about this SoM can be found at "https://vocore.io/v2.html". This port is working for me and able to boot Linux v5.0. Some subsystems (notably SD) are not working due to shortcomings of current drivers (e.g.: mtk_sd.c); they work in the booted Linux.

NOTE:
This is my first attempt to use patman; any hint welcome.

MCon (1):
Port to new board "VoCore2"

 arch/mips/dts/Makefile        |  6 ++--
 arch/mips/dts/vocore2.dts     | 62 +++++++++++++++++++++++++++++++++++
 arch/mips/mach-mtmips/Kconfig |  9 +++++
 board/vonger/vocore2/Kconfig  | 11 +++++++
 board/vonger/vocore2/Makefile |  2 ++
 board/vonger/vocore2/board.c  | 35 ++++++++++++++++++++
 configs/vocore2_defconfig     | 61 ++++++++++++++++++++++++++++++++++
 include/configs/vocore2.h     | 57 ++++++++++++++++++++++++++++++++
 8 files changed, 240 insertions(+), 3 deletions(-)
 create mode 100644 arch/mips/dts/vocore2.dts
 create mode 100644 board/vonger/vocore2/Kconfig
 create mode 100644 board/vonger/vocore2/Makefile
 create mode 100644 board/vonger/vocore2/board.c
 create mode 100644 configs/vocore2_defconfig
 create mode 100644 include/configs/vocore2.h
Signature · 1 line
2.24.0
author
#1 lore raw

PATCH 1/1 Port to new board "VoCore2"

modified: arch/mips/dts/Makefile
Add support for creation of vocore2.dtb
move creation of gardena-smart-gateway-mt7688.dtb and
linkit-smart-7688.dtb to more specific setting.

new file:   arch/mips/dts/vocore2.dts
modified:   arch/mips/mach-mtmips/Kconfig
new file:   board/vonger/vocore2/Kconfig

KConfig support for board VoCore2.

new file:   board/vonger/vocore2/Makefile
new file:   board/vonger/vocore2/board.c

Board initialization (largely copied from existing).

new file:   configs/vocore2_defconfig
new file:   include/configs/vocore2.h

Board settings (WIP).

---

 arch/mips/dts/Makefile        |  6 ++--
 arch/mips/dts/vocore2.dts     | 62 +++++++++++++++++++++++++++++++++++
 arch/mips/mach-mtmips/Kconfig |  9 +++++
 board/vonger/vocore2/Kconfig  | 11 +++++++
 board/vonger/vocore2/Makefile |  2 ++
 board/vonger/vocore2/board.c  | 35 ++++++++++++++++++++
 configs/vocore2_defconfig     | 61 ++++++++++++++++++++++++++++++++++
 include/configs/vocore2.h     | 57 ++++++++++++++++++++++++++++++++
 8 files changed, 240 insertions(+), 3 deletions(-)
 create mode 100644 arch/mips/dts/vocore2.dts
 create mode 100644 board/vonger/vocore2/Kconfig
 create mode 100644 board/vonger/vocore2/Makefile
 create mode 100644 board/vonger/vocore2/board.c
 create mode 100644 configs/vocore2_defconfig
 create mode 100644 include/configs/vocore2.h
arch/mips/dts/Makefile +3 -3
index c9d75596f2..664505ee00 100644
@@ -1,8 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 
-dtb-$(CONFIG_ARCH_MTMIPS) += \
-	gardena-smart-gateway-mt7688.dtb \
-	linkit-smart-7688.dtb
 dtb-$(CONFIG_TARGET_AP121) += ap121.dtb
 dtb-$(CONFIG_TARGET_AP143) += ap143.dtb
 dtb-$(CONFIG_TARGET_AP152) += ap152.dtb
@@ -16,12 +13,15 @@ dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) += comtrend,ar-5387un.dtb
 dtb-$(CONFIG_BOARD_COMTREND_CT5361) += comtrend,ct-5361.dtb
 dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb
 dtb-$(CONFIG_BOARD_COMTREND_WAP5813N) += comtrend,wap-5813n.dtb
+dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb
 dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb
+dtb-$(CONFIG_BOARD_LINKIT._SMART_7688) += linkit-smart-7688.dtb
 dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb
 dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb
 dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f at st1704.dtb
 dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb
 dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
+dtb-$(CONFIG_BOARD_VOCORE2) += vocore2.dtb
 dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb
 dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb
 dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb
arch/mips/dts/vocore2.dts new file +62 -0

62 lines not on this page · raw message

arch/mips/mach-mtmips/Kconfig +9 -0
index c8dcf19c0d..5ea260232f 100644
@@ -43,6 +43,14 @@ config BOARD_LINKIT_SMART_7688
 	  ethernet ports, 1 USB port, 1 UART, GPIO buttons and LEDs, and
 	  a MT7688 (PCIe).
 
+config BOARD_VOCORE2
+	bool "VoCore2"
+	depends on SOC_MT7628
+	select SUPPORTS_BOOT_RAM
+	help
+	  Vonger VoCore2 board has a MT7628 SoC with 128 MiB of RAM
+	  and 16 MiB of flash (SPI).
+
 endchoice
 
 choice
@@ -134,5 +142,6 @@ config SUPPORTS_BOOT_RAM
 
 source "board/gardena/smart-gateway-mt7688/Kconfig"
 source "board/seeed/linkit-smart-7688/Kconfig"
+source "board/vonger/vocore2/Kconfig"
 
 endmenu
board/vonger/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..4067973e70
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+	default "vocore2"
+
+config SYS_VENDOR
+	default "vonger"
+
+config SYS_CONFIG_NAME
+	default "vocore2"
+
+endif
board/vonger/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vonger/vocore2/board.c new file +35 -0
new file mode 100644
index 0000000000..1ab430247b
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ *
+ * Note: this is largely copied from:
+ *       board/seeed/linkit_smart_7688/board.c
+ *       Copyright (C) 2018 Stefan Roese <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#define MT76XX_GPIO1_MODE   0x10000060
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void board_debug_uart_init(void)
+{
+	void __iomem *gpio_mode;
+
+	/* Select UART2 mode instead of GPIO mode (default) */
+	gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
+	clrbits_le32(gpio_mode, GENMASK(27, 26));
+}
+
+int board_early_init_f(void)
+{
+	/*
+	 * The pin muxing of UART2 also needs to be done, if debug uart
+	 * is not enabled. So we need to call this function here as well.
+	 */
+	board_debug_uart_init();
+
+	return 0;
+}
configs/vocore2_defconfig new file +61 -0

61 lines not on this page · raw message

include/configs/vocore2.h new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.24.0
#2 lore raw

PATCH 1/1 Port to new board "VoCore2"

Hi Mauro,

Quoted 10 lines · MCon

modified: arch/mips/dts/Makefile
Add support for creation of vocore2.dtb
move creation of gardena-smart-gateway-mt7688.dtb and
linkit-smart-7688.dtb to more specific setting.

new file:   arch/mips/dts/vocore2.dts
modified:   arch/mips/mach-mtmips/Kconfig
new file:   board/vonger/vocore2/Kconfig

KConfig support for board VoCore2.

Quoted 7 lines
new file:   board/vonger/vocore2/Makefile
new file:   board/vonger/vocore2/board.c

Board initialization (largely copied from existing).

new file:   configs/vocore2_defconfig
new file:   include/configs/vocore2.h

Board settings (WIP).

This is a pretty uncommon commit text for a new board port. Please don't add just a summary of which files are changed or added. Better describe the newly added board with its supported (and perhaps not yet supported) features. As an example, here the commit text for the GARDENA board:

The Gardena Smart-Gateway boards have a MT7688 SoC with 128 MiB of RAM and 8 MiB of flash (SPI NOR) and additional 128MiB SPI NAND storage.

This patch also includes 2 targets. One is the target that can be programmed into the SPI NOR flash and a 2nd target "xxx-ram" is added to support loading and booting via an already running U-Boot version. This allows easy development and testing without the need to flash the image each time.

Just an example of course.

Please find some further review comments below inline.

Quoted 1 line

Please use your name with the email address:

Quoted 121 lines

---

  arch/mips/dts/Makefile        |  6 ++--
  arch/mips/dts/vocore2.dts     | 62 +++++++++++++++++++++++++++++++++++
  arch/mips/mach-mtmips/Kconfig |  9 +++++
  board/vonger/vocore2/Kconfig  | 11 +++++++
  board/vonger/vocore2/Makefile |  2 ++
  board/vonger/vocore2/board.c  | 35 ++++++++++++++++++++
  configs/vocore2_defconfig     | 61 ++++++++++++++++++++++++++++++++++
  include/configs/vocore2.h     | 57 ++++++++++++++++++++++++++++++++
  8 files changed, 240 insertions(+), 3 deletions(-)

create mode 100644 arch/mips/dts/vocore2.dts create mode 100644 board/vonger/vocore2/Kconfig create mode 100644 board/vonger/vocore2/Makefile create mode 100644 board/vonger/vocore2/board.c create mode 100644 configs/vocore2_defconfig create mode 100644 include/configs/vocore2.h

arch/mips/dts/Makefile +3 -3
index c9d75596f2..664505ee00 100644
@@ -1,8 +1,5 @@
  # SPDX-License-Identifier: GPL-2.0+
 
-dtb-$(CONFIG_ARCH_MTMIPS) += \
-	gardena-smart-gateway-mt7688.dtb \
-	linkit-smart-7688.dtb
  dtb-$(CONFIG_TARGET_AP121) += ap121.dtb
  dtb-$(CONFIG_TARGET_AP143) += ap143.dtb
  dtb-$(CONFIG_TARGET_AP152) += ap152.dtb
@@ -16,12 +13,15 @@ dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) += comtrend,ar-5387un.dtb
  dtb-$(CONFIG_BOARD_COMTREND_CT5361) += comtrend,ct-5361.dtb
  dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb
  dtb-$(CONFIG_BOARD_COMTREND_WAP5813N) += comtrend,wap-5813n.dtb
+dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb
  dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb
+dtb-$(CONFIG_BOARD_LINKIT._SMART_7688) += linkit-smart-7688.dtb
  dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb
  dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb
  dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f at st1704.dtb
  dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb
  dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
+dtb-$(CONFIG_BOARD_VOCORE2) += vocore2.dtb
  dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb
  dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb
  dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb
arch/mips/dts/vocore2.dts new file +62 -0
new file mode 100644
index 0000000000..cdcd9b4e1d
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ */
+
+/dts-v1/;
+#include "mt7628a.dtsi"
+
+/ {
+	compatible = "vocore,vocore2", "ralink,mt7628a-soc";
+	model = "VoCore2";
+
+	aliases {
+		serial0 = &uart2;
+		spi0 = &spi0;
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x08000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS2,115200";
+		stdout-path = &uart2;
+	};
+};
+
+&pinctrl {
+	state_default: pin_state {
+		p0led {
+			groups = "p0led_a";
+			function = "led";
+		};
+	};
+};
+
+&uart2 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+	nor0: m25p80 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "m25p80";
+		spi-max-frequency = <10000000>;
+		reg = <0x0>;
+		m25p,chunked-io = <32>;
+	};
+};
+
+&eth {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ephy_iot_mode>;
+	mediatek,poll-link-phy = <0>;
+};
+
+&mmc {
+	status = "okay";
+};
arch/mips/mach-mtmips/Kconfig +0 -0
index c8dcf19c0d..5ea260232f 100644
@@ -43,6 +43,14 @@ config BOARD_LINKIT_SMART_7688
  	  ethernet ports, 1 USB port, 1 UART, GPIO buttons and LEDs, and

arch/mips/mach-mtmips/Kconfig config BOARD_LINKIT_SMART_7688 · line 53

Quoted 10 lines
arch/mips/mach-mtmips/Kconfig +8 -0
  	  a MT7688 (PCIe).
 
+config BOARD_VOCORE2
+	bool "VoCore2"
+	depends on SOC_MT7628
+	select SUPPORTS_BOOT_RAM
+	help
+	  Vonger VoCore2 board has a MT7628 SoC with 128 MiB of RAM
+	  and 16 MiB of flash (SPI).
+

Is "Vonger" the name of the vendor / manufacturer of this board? I'm just checking - I don't really know.

Quoted 185 lines
arch/mips/mach-mtmips/Kconfig +1 -0
  endchoice
 
  choice
@@ -134,5 +142,6 @@ config SUPPORTS_BOOT_RAM
 
  source "board/gardena/smart-gateway-mt7688/Kconfig"
  source "board/seeed/linkit-smart-7688/Kconfig"
+source "board/vonger/vocore2/Kconfig"
 
  endmenu
board/vonger/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..4067973e70
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+	default "vocore2"
+
+config SYS_VENDOR
+	default "vonger"
+
+config SYS_CONFIG_NAME
+	default "vocore2"
+
+endif
board/vonger/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vonger/vocore2/board.c new file +35 -0
new file mode 100644
index 0000000000..1ab430247b
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ *
+ * Note: this is largely copied from:
+ *       board/seeed/linkit_smart_7688/board.c
+ *       Copyright (C) 2018 Stefan Roese <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#define MT76XX_GPIO1_MODE   0x10000060
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void board_debug_uart_init(void)
+{
+	void __iomem *gpio_mode;
+
+	/* Select UART2 mode instead of GPIO mode (default) */
+	gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
+	clrbits_le32(gpio_mode, GENMASK(27, 26));
+}
+
+int board_early_init_f(void)
+{
+	/*
+	 * The pin muxing of UART2 also needs to be done, if debug uart
+	 * is not enabled. So we need to call this function here as well.
+	 */
+	board_debug_uart_init();
+
+	return 0;
+}
configs/vocore2_defconfig new file +61 -0
new file mode 100644
index 0000000000..7b09a16fa4
@@ -0,0 +1,61 @@
+CONFIG_MIPS=y
+CONFIG_SYS_TEXT_BASE=0x80010000
+CONFIG_ENV_SIZE=0x00001000
+CONFIG_ENV_OFFSET=0x00FFE000
+CONFIG_ENV_SECT_SIZE=0x00001000
+CONFIG_ARCH_MTMIPS=y
+CONFIG_BOARD_VOCORE2=y
+CONFIG_MIPS_BOOT_FDT=y
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_SYS_BOOT_GET_CMDLINE=y
+CONFIG_SYS_BOOT_GET_KBD=y
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_LOGLEVEL=8
+CONFIG_VERSION_VARIABLE=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_AUTOBOOT is not set
+# CONFIG_BOOTM_NETBSD is not set
+# CONFIG_BOOTM_PLAN9 is not set
+# CONFIG_BOOTM_RTEMS is not set
+# CONFIG_BOOTM_VXWORKS is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
+CONFIG_MTDPARTS_DEFAULT="spi0.0:320k(u-boot),2752k(kernel),13304k(filesystem),4k(env),-(factory)"
+# CONFIG_ISO_PARTITION is not set
+CONFIG_DEFAULT_DEVICE_TREE="vocore2"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x00FFE000
+# CONFIG_NET is not set
+# CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BLK=y
+# CONFIG_INPUT is not set
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+CONFIG_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_MTD=y
+# CONFIG_DM_ETH is not set
+# CONFIG_RAM_ROCKCHIP_DEBUG is not set
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_CONS_INDEX=3
+CONFIG_SPI=y
+CONFIG_MT7621_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_STORAGE=y
+CONFIG_LZMA=y
+CONFIG_LZO=y
include/configs/vocore2.h new file +36 -0
new file mode 100644
index 0000000000..9ee32329f2
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ */
+
+#ifndef __VOCORE2_CONFIG_H__
+#define __VOCORE2_CONFIG_H__
+
+/* CPU */
+#define CONFIG_SYS_MIPS_TIMER_FREQ      290000000
+
+/* RAM */
+#define CONFIG_SYS_SDRAM_BASE          0x80000000
+
+#define CONFIG_SYS_LOAD_ADDR        CONFIG_SYS_SDRAM_BASE + 0x100000
+
+#define CONFIG_SYS_INIT_SP_OFFSET        0x400000
+
+#ifdef CONFIG_BOOT_RAM
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#endif
+
+/* UART */
+#define CONFIG_SYS_BAUDRATE_TABLE   { 9600, 19200, 38400, 57600, \
+					115200, 230400, 460800, 921600 }
+#define CONFIG_BAUDRATE			115200
+
+/* RAM */
+#define CONFIG_SYS_MEMTEST_START       0x80100000
+#define CONFIG_SYS_MEMTEST_END         0x80400000
+
+/* Memory usage */
+#define CONFIG_SYS_MAXARGS                     64
+#define CONFIG_SYS_MALLOC_LEN       (1024 * 1024)
+#define CONFIG_SYS_BOOTPARAMS_LEN    (128 * 1024)
+#define CONFIG_SYS_CBSIZE                     512

include/configs/vocore2.h line 46

Quoted 10 lines
include/configs/vocore2.h new file +10 -0
+
+/* U-Boot */
+#define CONFIG_SYS_MONITOR_BASE     CONFIG_SYS_TEXT_BASE
+
+/* Environment settings */
+#if defined(CONFIG_MTDIDS_DEFAULT) && defined(CONFIG_MTDPARTS_DEFAULT)
+#define CONFIG_EXTRA_ENV_SETTINGS			\
+	"mtdids="   CONFIG_MTDIDS_DEFAULT	"\0"	\
+	"mtdparts=" CONFIG_MTDPARTS_DEFAULT	"\0"
+#endif

Is this needed here? Doesn't it work witout this in this header?

include/configs/vocore2.h line 51

Quoted 5 lines
include/configs/vocore2.h new file +5 -0
+/*
+ * Environment is right behind U-Boot in flash. Make sure U-Boot
+ * doesn't grow into the environment area.
+ */
+//MCon: serve? #define CONFIG_BOARD_SIZE_LIMIT     CONFIG_ENV_OFFSET

???

Please don't add dead code.

include/configs/vocore2.h line 55

Quoted 4 lines
include/configs/vocore2.h new file +4 -0
+
+#define CONFIG_ENV_IS_IN_SPI_FLASH              1
+//#define CONFIG_ENV_OFFSET               0x0FFF000
+//#define CONFIG_ENV_SIZE                 0x0001000

Same here, please don't add dead code.

include/configs/vocore2.h line 57

Quoted 2 lines
include/configs/vocore2.h new file +2 -0
+
+#endif//__VOCORE2_CONFIG_H__

Hmm, I'm pretty sure, that checkpatch will complain about this missing space here. Please run checkpatch over your patch(es) before submitting.

Thanks,
Stefan

#3 lore raw

PATCH 1/1 Port to new board "VoCore2"

Am 19.12.19 um 16:08 schrieb Stefan Roese:

Quoted 37 lines

Hi Mauro,

Quoted 10 lines · MCon

modified:   arch/mips/dts/Makefile
    Add support for creation of vocore2.dtb
    move creation of gardena-smart-gateway-mt7688.dtb and linkit-smart-7688.dtb to more specific setting.

new file:   arch/mips/dts/vocore2.dts
modified:   arch/mips/mach-mtmips/Kconfig
new file:   board/vonger/vocore2/Kconfig
    KConfig support for board VoCore2.

Quoted 7 lines

new file:   board/vonger/vocore2/Makefile
new file:   board/vonger/vocore2/board.c
    Board initialization (largely copied from existing).

new file:   configs/vocore2_defconfig
new file:   include/configs/vocore2.h
    Board settings (WIP).

This is a pretty uncommon commit text for a new board port. Please don't add just a summary of which files are changed or added. Better describe the newly added board with its supported (and perhaps not yet supported) features. As an example, here the commit text for the GARDENA board:

    The Gardena Smart-Gateway boards have a MT7688 SoC with 128 MiB of RAM and 8 MiB of flash (SPI NOR) and additional 128MiB SPI NAND storage. This patch also includes 2 targets. One is the target that can be programmed into the SPI NOR flash and a 2nd target "xxx-ram" is added to support loading and booting via an already running U-Boot version. This allows easy development and testing without the need to flash the image each time.

Just an example of course.

Quoted 7 lines

Please find some further review comments below inline.

Quoted 1 line

Please use your name with the email address:

yes, please also fix your Git config accordingly (git config [--global] user.email "Mauro Condarelli <[email protected]>").

Quoted 32 lines
Quoted 32 lines

---

  arch/mips/dts/Makefile        |  6 ++-- arch/mips/dts/vocore2.dts     | 62 +++++++++++++++++++++++++++++++++++ arch/mips/mach-mtmips/Kconfig |  9 +++++ board/vonger/vocore2/Kconfig  | 11 +++++++ board/vonger/vocore2/Makefile |  2 ++ board/vonger/vocore2/board.c  | 35 ++++++++++++++++++++ configs/vocore2_defconfig     | 61 ++++++++++++++++++++++++++++++++++ include/configs/vocore2.h     | 57 ++++++++++++++++++++++++++++++++

  8 files changed, 240 insertions(+), 3 deletions(-)

  create mode 100644 arch/mips/dts/vocore2.dts create mode 100644 board/vonger/vocore2/Kconfig create mode 100644 board/vonger/vocore2/Makefile create mode 100644 board/vonger/vocore2/board.c create mode 100644 configs/vocore2_defconfig create mode 100644 include/configs/vocore2.h

arch/mips/dts/Makefile +0 -2
index c9d75596f2..664505ee00 100644
@@ -1,8 +1,5 @@
   # SPDX-License-Identifier: GPL-2.0+
   -dtb-$(CONFIG_ARCH_MTMIPS) += \
-    gardena-smart-gateway-mt7688.dtb \
-    linkit-smart-7688.dtb

  dtb-$(CONFIG_TARGET_AP121) += ap121.dtb
  dtb-$(CONFIG_TARGET_AP143) += ap143.dtb
  dtb-$(CONFIG_TARGET_AP152) += ap152.dtb

arch/mips/dts/Makefile +0 -0
@@ -16,12 +13,15 @@ dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) +=
Quoted 8 lines
Quoted 8 lines

comtrend,ar-5387un.dtb dtb-$(CONFIG_BOARD_COMTREND_CT5361) += comtrend,ct-5361.dtb dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb dtb-$(CONFIG_BOARD_COMTREND_WAP5813N) += comtrend,wap-5813n.dtb +dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb +dtb-$(CONFIG_BOARD_LINKIT._SMART_7688) += linkit-smart-7688.dtb

this is an unrelated change and should be removed. I guess this was intentional by Stefan. If not, please submit a separate patch for that.

Quoted 6 lines
Quoted 6 lines

  dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f at st1704.dtb dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb +dtb-$(CONFIG_BOARD_VOCORE2) += vocore2.dtb

you should add the vendor name, e.g.

dtb-$(CONFIG_BOARD_VONGER_VOCORE2) += vonger_vocore2.dtb

Quoted 187 lines
Quoted 79 lines

  dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb

arch/mips/dts/vocore2.dts new file +62 -0
new file mode 100644
index 0000000000..cdcd9b4e1d
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ */
+
+/dts-v1/;
+#include "mt7628a.dtsi"
+
+/ {
+    compatible = "vocore,vocore2", "ralink,mt7628a-soc";
+    model = "VoCore2";
+
+    aliases {
+        serial0 = &uart2;
+        spi0 = &spi0;
+    };
+
+    memory at 0 {
+        device_type = "memory";
+        reg = <0x0 0x08000000>;
+    };
+
+    chosen {
+        bootargs = "console=ttyS2,115200";
+        stdout-path = &uart2;
+    };
+};
+
+&pinctrl {
+    state_default: pin_state {
+        p0led {
+            groups = "p0led_a";
+            function = "led";
+        };
+    };
+};
+
+&uart2 {
+    status = "okay";
+};
+
+&spi0 {
+    status = "okay";
+    nor0: m25p80 at 0 {
+        #address-cells = <1>;
+        #size-cells = <1>;
+        compatible = "m25p80";
+        spi-max-frequency = <10000000>;
+        reg = <0x0>;
+        m25p,chunked-io = <32>;
+    };
+};
+
+&eth {
+    pinctrl-names = "default";
+    pinctrl-0 = <&ephy_iot_mode>;
+    mediatek,poll-link-phy = <0>;
+};
+
+&mmc {
+    status = "okay";
+};
arch/mips/mach-mtmips/Kconfig +0 -0
index c8dcf19c0d..5ea260232f 100644
@@ -43,6 +43,14 @@ config BOARD_LINKIT_SMART_7688

        ethernet ports, 1 USB port, 1 UART, GPIO buttons and LEDs, and a MT7688 (PCIe).

Quoted 8 lines

  +config BOARD_VOCORE2
+    bool "VoCore2"
+    depends on SOC_MT7628
+    select SUPPORTS_BOOT_RAM
+    help
+      Vonger VoCore2 board has a MT7628 SoC with 128 MiB of RAM +      and 16 MiB of flash (SPI).
+

Is "Vonger" the name of the vendor / manufacturer of this board? I'm just checking - I don't really know.

Quoted 96 lines

  endchoice
    choice

arch/mips/mach-mtmips/Kconfig +0 -0
@@ -134,5 +142,6 @@ config SUPPORTS_BOOT_RAM

    source "board/gardena/smart-gateway-mt7688/Kconfig" source "board/seeed/linkit-smart-7688/Kconfig" +source "board/vonger/vocore2/Kconfig"
    endmenu

board/vonger/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..4067973e70
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+    default "vocore2"
+
+config SYS_VENDOR
+    default "vonger"
+
+config SYS_CONFIG_NAME
+    default "vocore2"
+
+endif
board/vonger/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vonger/vocore2/board.c new file +35 -0
new file mode 100644
index 0000000000..1ab430247b
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ *
+ * Note: this is largely copied from:
+ *       board/seeed/linkit_smart_7688/board.c
+ *       Copyright (C) 2018 Stefan Roese <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#define MT76XX_GPIO1_MODE   0x10000060
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void board_debug_uart_init(void)
+{
+    void __iomem *gpio_mode;
+
+    /* Select UART2 mode instead of GPIO mode (default) */
+    gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
+    clrbits_le32(gpio_mode, GENMASK(27, 26));
+}
+
+int board_early_init_f(void)
+{
+    /*
+     * The pin muxing of UART2 also needs to be done, if debug uart
+     * is not enabled. So we need to call this function here as well.
+     */
+    board_debug_uart_init();
+
+    return 0;
+}
configs/vocore2_defconfig new file +16 -0
new file mode 100644
index 0000000000..7b09a16fa4
@@ -0,0 +1,61 @@
+CONFIG_MIPS=y
+CONFIG_SYS_TEXT_BASE=0x80010000
+CONFIG_ENV_SIZE=0x00001000
+CONFIG_ENV_OFFSET=0x00FFE000
+CONFIG_ENV_SECT_SIZE=0x00001000
+CONFIG_ARCH_MTMIPS=y
+CONFIG_BOARD_VOCORE2=y
+CONFIG_MIPS_BOOT_FDT=y
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_SYS_BOOT_GET_CMDLINE=y
+CONFIG_SYS_BOOT_GET_KBD=y
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_LOGLEVEL=8
+CONFIG_VERSION_VARIABLE=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
Quoted 8 lines

configs/vocore2_defconfig line 24

Quoted 8 lines
configs/vocore2_defconfig new file +8 -0
+# CONFIG_AUTOBOOT is not set
+# CONFIG_BOOTM_NETBSD is not set
+# CONFIG_BOOTM_PLAN9 is not set
+# CONFIG_BOOTM_RTEMS is not set
+# CONFIG_BOOTM_VXWORKS is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set

a lot of "is not set" entries. Did you generate this config with "make savedefconfig"?

Quoted 6 lines

configs/vocore2_defconfig line 30

Quoted 6 lines
configs/vocore2_defconfig new file +6 -0
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y

you should not enable features which the patch set don't support yet. I don't know about USB because you didn't mentioned it anywhere. But FAT or block devices are obviously left-overs from your MMC/SD experiments ;)

Quoted 112 lines
Quoted 74 lines
configs/vocore2_defconfig new file +31 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
+CONFIG_MTDPARTS_DEFAULT="spi0.0:320k(u-boot),2752k(kernel),13304k(filesystem),4k(env),-(factory)"
 
+# CONFIG_ISO_PARTITION is not set
+CONFIG_DEFAULT_DEVICE_TREE="vocore2"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x00FFE000
+# CONFIG_NET is not set
+# CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BLK=y
+# CONFIG_INPUT is not set
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+CONFIG_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_MTD=y
+# CONFIG_DM_ETH is not set
+# CONFIG_RAM_ROCKCHIP_DEBUG is not set
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_CONS_INDEX=3
+CONFIG_SPI=y
+CONFIG_MT7621_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_STORAGE=y
+CONFIG_LZMA=y
+CONFIG_LZO=y
include/configs/vocore2.h new file +36 -0
new file mode 100644
index 0000000000..9ee32329f2
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ */
+
+#ifndef __VOCORE2_CONFIG_H__
+#define __VOCORE2_CONFIG_H__
+
+/* CPU */
+#define CONFIG_SYS_MIPS_TIMER_FREQ      290000000
+
+/* RAM */
+#define CONFIG_SYS_SDRAM_BASE          0x80000000
+
+#define CONFIG_SYS_LOAD_ADDR        CONFIG_SYS_SDRAM_BASE + 0x100000
+
+#define CONFIG_SYS_INIT_SP_OFFSET        0x400000
+
+#ifdef CONFIG_BOOT_RAM
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#endif
+
+/* UART */
+#define CONFIG_SYS_BAUDRATE_TABLE   { 9600, 19200, 38400, 57600, \
+                    115200, 230400, 460800, 921600 }
+#define CONFIG_BAUDRATE            115200
+
+/* RAM */
+#define CONFIG_SYS_MEMTEST_START       0x80100000
+#define CONFIG_SYS_MEMTEST_END         0x80400000
+
+/* Memory usage */
+#define CONFIG_SYS_MAXARGS                     64
+#define CONFIG_SYS_MALLOC_LEN       (1024 * 1024)
+#define CONFIG_SYS_BOOTPARAMS_LEN    (128 * 1024)
+#define CONFIG_SYS_CBSIZE                     512

include/configs/vocore2.h line 46

Quoted 10 lines
include/configs/vocore2.h new file +10 -0
+
+/* U-Boot */
+#define CONFIG_SYS_MONITOR_BASE     CONFIG_SYS_TEXT_BASE
+
+/* Environment settings */
+#if defined(CONFIG_MTDIDS_DEFAULT) && defined(CONFIG_MTDPARTS_DEFAULT)
+#define CONFIG_EXTRA_ENV_SETTINGS            \
+    "mtdids="   CONFIG_MTDIDS_DEFAULT    "\0"    \
+    "mtdparts=" CONFIG_MTDPARTS_DEFAULT    "\0"
+#endif

Is this needed here? Doesn't it work witout this in this header?

include/configs/vocore2.h line 51

Quoted 5 lines
include/configs/vocore2.h new file +5 -0
+/*
+ * Environment is right behind U-Boot in flash. Make sure U-Boot
+ * doesn't grow into the environment area.
+ */
+//MCon: serve? #define CONFIG_BOARD_SIZE_LIMIT     CONFIG_ENV_OFFSET

???

Please don't add dead code.

include/configs/vocore2.h line 55

Quoted 4 lines
include/configs/vocore2.h new file +4 -0
+
+#define CONFIG_ENV_IS_IN_SPI_FLASH              1
+//#define CONFIG_ENV_OFFSET               0x0FFF000
+//#define CONFIG_ENV_SIZE                 0x0001000

Same here, please don't add dead code.

include/configs/vocore2.h line 57

Quoted 2 lines
include/configs/vocore2.h new file +2 -0
+
+#endif//__VOCORE2_CONFIG_H__

Hmm, I'm pretty sure, that checkpatch will complain about this missing space here. Please run checkpatch over your patch(es) before submitting.

Thanks,
Stefan

Signature · 1 line
- Daniel
#4 lore raw

PATCH 1/1 Port to new board "VoCore2"

Quoted 38 lines · Daniel Schwierzeck

Am 19.12.19 um 16:08 schrieb Stefan Roese:

Quoted 36 lines

Hi Mauro,

Quoted 10 lines · MCon

modified:   arch/mips/dts/Makefile
    Add support for creation of vocore2.dtb
    move creation of gardena-smart-gateway-mt7688.dtb and linkit-smart-7688.dtb to more specific setting.

new file:   arch/mips/dts/vocore2.dts
modified:   arch/mips/mach-mtmips/Kconfig
new file:   board/vonger/vocore2/Kconfig
    KConfig support for board VoCore2.

Quoted 7 lines

new file:   board/vonger/vocore2/Makefile
new file:   board/vonger/vocore2/board.c
    Board initialization (largely copied from existing).

new file:   configs/vocore2_defconfig
new file:   include/configs/vocore2.h
    Board settings (WIP).

This is a pretty uncommon commit text for a new board port. Please don't add just a summary of which files are changed or added. Better describe the newly added board with its supported (and perhaps not yet supported) features. As an example, here the commit text for the GARDENA board:

    The Gardena Smart-Gateway boards have a MT7688 SoC with 128 MiB of RAM and 8 MiB of flash (SPI NOR) and additional 128MiB SPI NAND storage. This patch also includes 2 targets. One is the target that can be programmed into the SPI NOR flash and a 2nd target "xxx-ram" is added to support loading and booting via an already running U-Boot version. This allows easy development and testing without the need to flash the image each time.

Just an example of course.

Quoted 8 lines
Quoted 6 lines

Please find some further review comments below inline.

Quoted 1 line

Please use your name with the email address:

yes, please also fix your Git config accordingly (git config [--global] user.email "Mauro Condarelli <[email protected]>").

Will do ASAP (probably right after Christmas).
Last thing is strange, though, because git should already be setup right. I'll check.

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines

---

  arch/mips/dts/Makefile        |  6 ++-- arch/mips/dts/vocore2.dts     | 62 +++++++++++++++++++++++++++++++++++ arch/mips/mach-mtmips/Kconfig |  9 +++++ board/vonger/vocore2/Kconfig  | 11 +++++++ board/vonger/vocore2/Makefile |  2 ++ board/vonger/vocore2/board.c  | 35 ++++++++++++++++++++ configs/vocore2_defconfig     | 61 ++++++++++++++++++++++++++++++++++ include/configs/vocore2.h     | 57 ++++++++++++++++++++++++++++++++

  8 files changed, 240 insertions(+), 3 deletions(-)

  create mode 100644 arch/mips/dts/vocore2.dts create mode 100644 board/vonger/vocore2/Kconfig create mode 100644 board/vonger/vocore2/Makefile create mode 100644 board/vonger/vocore2/board.c create mode 100644 configs/vocore2_defconfig create mode 100644 include/configs/vocore2.h

arch/mips/dts/Makefile +0 -2
index c9d75596f2..664505ee00 100644
@@ -1,8 +1,5 @@
   # SPDX-License-Identifier: GPL-2.0+
   -dtb-$(CONFIG_ARCH_MTMIPS) += \
-    gardena-smart-gateway-mt7688.dtb \
-    linkit-smart-7688.dtb

  dtb-$(CONFIG_TARGET_AP121) += ap121.dtb
  dtb-$(CONFIG_TARGET_AP143) += ap143.dtb
  dtb-$(CONFIG_TARGET_AP152) += ap152.dtb

arch/mips/dts/Makefile +0 -0
@@ -16,12 +13,15 @@ dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) +=

comtrend,ar-5387un.dtb dtb-$(CONFIG_BOARD_COMTREND_CT5361) += comtrend,ct-5361.dtb

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

  dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb dtb-$(CONFIG_BOARD_COMTREND_WAP5813N) += comtrend,wap-5813n.dtb +dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb +dtb-$(CONFIG_BOARD_LINKIT._SMART_7688) += linkit-smart-7688.dtb

this is an unrelated change and should be removed. I guess this was intentional by Stefan. If not, please submit a separate patch for that.

Right.
@Stefan: please, could You explain the rationale behind building all DTBs? I failed to understand.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

  dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f at st1704.dtb dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb +dtb-$(CONFIG_BOARD_VOCORE2) += vocore2.dtb

you should add the vendor name, e.g.

dtb-$(CONFIG_BOARD_VONGER_VOCORE2) += vonger_vocore2.dtb

Will do.

Quoted 81 lines
Quoted 81 lines
Quoted 81 lines

  dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb

arch/mips/dts/vocore2.dts new file +62 -0
new file mode 100644
index 0000000000..cdcd9b4e1d
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ */
+
+/dts-v1/;
+#include "mt7628a.dtsi"
+
+/ {
+    compatible = "vocore,vocore2", "ralink,mt7628a-soc";
+    model = "VoCore2";
+
+    aliases {
+        serial0 = &uart2;
+        spi0 = &spi0;
+    };
+
+    memory at 0 {
+        device_type = "memory";
+        reg = <0x0 0x08000000>;
+    };
+
+    chosen {
+        bootargs = "console=ttyS2,115200";
+        stdout-path = &uart2;
+    };
+};
+
+&pinctrl {
+    state_default: pin_state {
+        p0led {
+            groups = "p0led_a";
+            function = "led";
+        };
+    };
+};
+
+&uart2 {
+    status = "okay";
+};
+
+&spi0 {
+    status = "okay";
+    nor0: m25p80 at 0 {
+        #address-cells = <1>;
+        #size-cells = <1>;
+        compatible = "m25p80";
+        spi-max-frequency = <10000000>;
+        reg = <0x0>;
+        m25p,chunked-io = <32>;
+    };
+};
+
+&eth {
+    pinctrl-names = "default";
+    pinctrl-0 = <&ephy_iot_mode>;
+    mediatek,poll-link-phy = <0>;
+};
+
+&mmc {
+    status = "okay";
+};
arch/mips/mach-mtmips/Kconfig +0 -0
index c8dcf19c0d..5ea260232f 100644
@@ -43,6 +43,14 @@ config BOARD_LINKIT_SMART_7688

        ethernet ports, 1 USB port, 1 UART, GPIO buttons and LEDs, and a MT7688 (PCIe).
  +config BOARD_VOCORE2
+    bool "VoCore2"

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

+    depends on SOC_MT7628
+    select SUPPORTS_BOOT_RAM
+    help
+      Vonger VoCore2 board has a MT7628 SoC with 128 MiB of RAM +      and 16 MiB of flash (SPI).
+

Is "Vonger" the name of the vendor / manufacturer of this board? I'm just checking - I don't really know.

I will cross-check.
It was called "Vonger" at the beginning, but now the name disappeared in favour of "vocore".
I'll inquire how they want to be called (it's a very small company).

Quoted 98 lines
Quoted 98 lines
Quoted 98 lines

  endchoice
    choice

arch/mips/mach-mtmips/Kconfig +0 -0
@@ -134,5 +142,6 @@ config SUPPORTS_BOOT_RAM

    source "board/gardena/smart-gateway-mt7688/Kconfig" source "board/seeed/linkit-smart-7688/Kconfig" +source "board/vonger/vocore2/Kconfig"
    endmenu

board/vonger/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..4067973e70
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+    default "vocore2"
+
+config SYS_VENDOR
+    default "vonger"
+
+config SYS_CONFIG_NAME
+    default "vocore2"
+
+endif
board/vonger/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vonger/vocore2/board.c new file +35 -0
new file mode 100644
index 0000000000..1ab430247b
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ *
+ * Note: this is largely copied from:
+ *       board/seeed/linkit_smart_7688/board.c
+ *       Copyright (C) 2018 Stefan Roese <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#define MT76XX_GPIO1_MODE   0x10000060
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void board_debug_uart_init(void)
+{
+    void __iomem *gpio_mode;
+
+    /* Select UART2 mode instead of GPIO mode (default) */
+    gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
+    clrbits_le32(gpio_mode, GENMASK(27, 26));
+}
+
+int board_early_init_f(void)
+{
+    /*
+     * The pin muxing of UART2 also needs to be done, if debug uart
+     * is not enabled. So we need to call this function here as well.
+     */
+    board_debug_uart_init();
+
+    return 0;
+}
configs/vocore2_defconfig new file +18 -0
new file mode 100644
index 0000000000..7b09a16fa4
@@ -0,0 +1,61 @@
+CONFIG_MIPS=y
+CONFIG_SYS_TEXT_BASE=0x80010000
+CONFIG_ENV_SIZE=0x00001000
+CONFIG_ENV_OFFSET=0x00FFE000
+CONFIG_ENV_SECT_SIZE=0x00001000
+CONFIG_ARCH_MTMIPS=y
+CONFIG_BOARD_VOCORE2=y
+CONFIG_MIPS_BOOT_FDT=y
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_SYS_BOOT_GET_CMDLINE=y
+CONFIG_SYS_BOOT_GET_KBD=y
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_LOGLEVEL=8
+CONFIG_VERSION_VARIABLE=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_AUTOBOOT is not set
+# CONFIG_BOOTM_NETBSD is not set
Quoted 8 lines
Quoted 6 lines

configs/vocore2_defconfig line 24

Quoted 6 lines
configs/vocore2_defconfig new file +6 -0
+# CONFIG_BOOTM_PLAN9 is not set
+# CONFIG_BOOTM_RTEMS is not set
+# CONFIG_BOOTM_VXWORKS is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set

a lot of "is not set" entries. Did you generate this config with "make savedefconfig"?

Yes, this is generated by "make savedefconfig".
I will cross-check in next iteration.

Quoted 9 lines
Quoted 6 lines

configs/vocore2_defconfig line 30

Quoted 6 lines
configs/vocore2_defconfig new file +6 -0
+CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y

you should not enable features which the patch set don't support yet. I don't know about USB because you didn't mentioned it anywhere. But FAT or block devices are obviously left-overs from your MMC/SD experiments ;)

No, they are functional.
I am currently testing (mainly) by loading U-Boot from USB (FAT partition). This is to avoid re-flashing each iteration; while I'm trying new things I load
from previous U-Boot with:
    usb start; fatload usb 0 80010000 u-boot.bin; go 80010000

Should I remove this?

Quoted 77 lines
Quoted 77 lines
Quoted 77 lines
configs/vocore2_defconfig new file +31 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
+CONFIG_MTDPARTS_DEFAULT="spi0.0:320k(u-boot),2752k(kernel),13304k(filesystem),4k(env),-(factory)"
 
+# CONFIG_ISO_PARTITION is not set
+CONFIG_DEFAULT_DEVICE_TREE="vocore2"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_ADDR=0x00FFE000
+# CONFIG_NET is not set
+# CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_BLK=y
+# CONFIG_INPUT is not set
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+CONFIG_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_MTD=y
+# CONFIG_DM_ETH is not set
+# CONFIG_RAM_ROCKCHIP_DEBUG is not set
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_CONS_INDEX=3
+CONFIG_SPI=y
+CONFIG_MT7621_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_STORAGE=y
+CONFIG_LZMA=y
+CONFIG_LZO=y
include/configs/vocore2.h new file +39 -0
new file mode 100644
index 0000000000..9ee32329f2
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Mauro Condarelli <[email protected]>
+ */
+
+#ifndef __VOCORE2_CONFIG_H__
+#define __VOCORE2_CONFIG_H__
+
+/* CPU */
+#define CONFIG_SYS_MIPS_TIMER_FREQ      290000000
+
+/* RAM */
+#define CONFIG_SYS_SDRAM_BASE          0x80000000
+
+#define CONFIG_SYS_LOAD_ADDR        CONFIG_SYS_SDRAM_BASE + 0x100000
+
+#define CONFIG_SYS_INIT_SP_OFFSET        0x400000
+
+#ifdef CONFIG_BOOT_RAM
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#endif
+
+/* UART */
+#define CONFIG_SYS_BAUDRATE_TABLE   { 9600, 19200, 38400, 57600, \
+                    115200, 230400, 460800, 921600 }
+#define CONFIG_BAUDRATE            115200
+
+/* RAM */
+#define CONFIG_SYS_MEMTEST_START       0x80100000
+#define CONFIG_SYS_MEMTEST_END         0x80400000
+
+/* Memory usage */
+#define CONFIG_SYS_MAXARGS                     64
+#define CONFIG_SYS_MALLOC_LEN       (1024 * 1024)
+#define CONFIG_SYS_BOOTPARAMS_LEN    (128 * 1024)
+#define CONFIG_SYS_CBSIZE                     512
+
+/* U-Boot */
+#define CONFIG_SYS_MONITOR_BASE     CONFIG_SYS_TEXT_BASE
Quoted 8 lines
Quoted 8 lines

include/configs/vocore2.h line 46

Quoted 7 lines
include/configs/vocore2.h new file +7 -0
+
+/* Environment settings */
+#if defined(CONFIG_MTDIDS_DEFAULT) && defined(CONFIG_MTDPARTS_DEFAULT)
+#define CONFIG_EXTRA_ENV_SETTINGS            \
+    "mtdids="   CONFIG_MTDIDS_DEFAULT    "\0"    \
+    "mtdparts=" CONFIG_MTDPARTS_DEFAULT    "\0"
+#endif

Is this needed here? Doesn't it work witout this in this header?

I am (currently) loading Environment from a Flash at a fixed address, but I would like to switch to partition name (if I manage to understand how it is done).
In general I would like to switch to ENV in MMC/SD (to support boot counting without too much wear on Flash), but that needs MMC/SD working, which is another can of worms.

Quoted 8 lines
Quoted 8 lines

include/configs/vocore2.h line 51

Quoted 5 lines
include/configs/vocore2.h new file +5 -0
+/*
+ * Environment is right behind U-Boot in flash. Make sure U-Boot
+ * doesn't grow into the environment area.
+ */
+//MCon: serve? #define CONFIG_BOARD_SIZE_LIMIT     CONFIG_ENV_OFFSET

???

Please don't add dead code.

This is a leftover.
Removed.

Quoted 5 lines
Quoted 5 lines

include/configs/vocore2.h line 55

Quoted 4 lines
include/configs/vocore2.h new file +4 -0
+
+#define CONFIG_ENV_IS_IN_SPI_FLASH              1
+//#define CONFIG_ENV_OFFSET               0x0FFF000
+//#define CONFIG_ENV_SIZE                 0x0001000

Same here, please don't add dead code.

Ditto.

Quoted 4 lines
Quoted 4 lines

include/configs/vocore2.h line 57

Quoted 2 lines
include/configs/vocore2.h new file +2 -0
+
+#endif//__VOCORE2_CONFIG_H__

Hmm, I'm pretty sure, that checkpatch will complain about this missing space here. Please run checkpatch over your patch(es) before submitting.

Apparently it didn't.
I submitted patches via "patman" which (AFAIK) calls checkpatch internally.

Note: patman complained about:
    <unknown>:0: warning: added, moved or deleted file(s), does MAINTAINERS need updating?

I didn't know how to fix this (I fixed all other complains) so I forced sending with "-i".
What should I do, instead?

Quoted 2 lines
Quoted 2 lines

Thanks,
Stefan

Regards
Mauro

#5 lore raw

cover Small patch series to add support for VoCore2 board.

In reply to MCon

Am 19.12.19 um 12:40 schrieb MCon:

Quoted 8 lines

Details about this SoM can be found at "https://vocore.io/v2.html". This port is working for me and able to boot Linux v5.0. Some subsystems (notably SD) are not working due to shortcomings of current drivers (e.g.: mtk_sd.c); they work in the booted Linux.

NOTE:
This is my first attempt to use patman; any hint welcome.

1. you can omit the "Cover-letter" option if you want to send a single patch only.

2. always run patman with -n/--dry-run before sending the patches out to check for checkpatch.pl errors and fix them if needed

3. always run patman with -m to disable the automatic maintainer detection. This usually bloats the CC list. It's better to specify the relevant maintainers per patch. You could use the aliases from doc/git-mailrc to save some typing, for instance:

to: uboot
cc: danielschwierzeck
cc: stroese

Quoted 21 lines

MCon (1):
Port to new board "VoCore2"

 arch/mips/dts/Makefile        |  6 ++--
 arch/mips/dts/vocore2.dts     | 62 +++++++++++++++++++++++++++++++++++
 arch/mips/mach-mtmips/Kconfig |  9 +++++
 board/vonger/vocore2/Kconfig  | 11 +++++++
 board/vonger/vocore2/Makefile |  2 ++
 board/vonger/vocore2/board.c  | 35 ++++++++++++++++++++
 configs/vocore2_defconfig     | 61 ++++++++++++++++++++++++++++++++++
 include/configs/vocore2.h     | 57 ++++++++++++++++++++++++++++++++
 8 files changed, 240 insertions(+), 3 deletions(-)
 create mode 100644 arch/mips/dts/vocore2.dts
 create mode 100644 board/vonger/vocore2/Kconfig
 create mode 100644 board/vonger/vocore2/Makefile
 create mode 100644 board/vonger/vocore2/board.c
 create mode 100644 configs/vocore2_defconfig
 create mode 100644 include/configs/vocore2.h
Signature · 1 line
- Daniel