Skip to contentSkip to conversation

Add GigaDevice gd25q128 128Mbit chip to spi-nor id table.

PATCH New Mauro Condarelli 4 participants 10 messages Dec 27, 2019 – Jan 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Add GigaDevice gd25q128 128Mbit chip to spi-nor id table.

From: MCon <[email protected]>

Tested on VoCore2

---

Changes in v2: None

 drivers/mtd/spi/spi-nor-ids.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mtd/spi/spi-nor-ids.c +5 -0
index d3b84574ac..973b6f86c9 100644
@@ -107,6 +107,11 @@ const struct flash_info spi_nor_ids[] = {
 			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
 			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
 	},
+	{
+		INFO("gd25q128", 0xc84018, 0, 64 * 1024, 256,
+			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+	},
 	{
 		INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256,
 			SECT_4K | SPI_NOR_DUAL_READ |
Signature · 1 line
2.24.1
#1 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

Small patch series to add support for VoCore/VoCore2 board.

VoCore is open hardware and runs OpenWrt/LEDE.
It has WIFI, USB, UART, 20+ GPIOs but is only one inch square. It will help you to make a smart house, study embedded system or even make the tiniest router in the world.

Details about this SoM can be found at "https://vocore.io/v2.html".

---

Changes in v2:
- Removed some dead code
- Changed Author to my full name (no nick)
- Removed unwanted fixup to .dts generation (not my call).
- Fixed commit message
- Fixed various variables/filenames to include Vendor name
- Changed Vendor name (Vonger -> Vocore)

 MAINTAINERS                      |  1 +
 arch/mips/dts/Makefile           |  1 +
 arch/mips/dts/vocore_vocore2.dts | 62 ++++++++++++++++++++++++++++++++
 arch/mips/mach-mtmips/Kconfig    |  9 +++++
 board/vocore/vocore2/Kconfig     | 11 ++++++
 board/vocore/vocore2/Makefile    |  2 ++
 board/vocore/vocore2/board.c     | 35 ++++++++++++++++++
 configs/vocore2_defconfig        | 62 ++++++++++++++++++++++++++++++++
 include/configs/vocore2.h        | 50 ++++++++++++++++++++++++++
 9 files changed, 233 insertions(+)
 create mode 100644 arch/mips/dts/vocore_vocore2.dts
 create mode 100644 board/vocore/vocore2/Kconfig
 create mode 100644 board/vocore/vocore2/Makefile
 create mode 100644 board/vocore/vocore2/board.c
 create mode 100644 configs/vocore2_defconfig
 create mode 100644 include/configs/vocore2.h
MAINTAINERS +1 -0
index 8d588b7d64..8c15deaafe 100644
@@ -1,3 +1,4 @@
+source /home/mcon/.basheditor/remote-debugging-v1.sh localhost 33333 #BASHEDITOR-TMP-REMOTE-DEBUGGING-END|Origin line:
 Descriptions of section entries:
 
 	P: Person (obsolete)
arch/mips/dts/Makefile +1 -0
index c9d75596f2..5ece224511 100644
@@ -22,6 +22,7 @@ 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) += vocore_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/vocore_vocore2.dts new file +62 -0

62 lines not on this page · raw message

arch/mips/mach-mtmips/Kconfig +9 -0
index c8dcf19c0d..57dfaebaec 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
+	  VoCore 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/vocore/vocore2/Kconfig"
 
 endmenu
board/vocore/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..9178c3ab32
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+	default "vocore2"
+
+config SYS_VENDOR
+	default "vocore"
+
+config SYS_CONFIG_NAME
+	default "vocore2"
+
+endif
board/vocore/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vocore/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 +62 -0

62 lines not on this page · raw message

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

50 lines not on this page · raw message

Signature · 1 line
2.24.1
#2 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

Hi Mauro,

Quoted 104 lines · Mauro Condarelli

Small patch series to add support for VoCore/VoCore2 board.

VoCore is open hardware and runs OpenWrt/LEDE.
It has WIFI, USB, UART, 20+ GPIOs but is only one inch square. It will help you to make a smart house, study embedded system or even make the tiniest router in the world.

Details about this SoM can be found at "https://vocore.io/v2.html".

---

Changes in v2:
- Removed some dead code
- Changed Author to my full name (no nick)
- Removed unwanted fixup to .dts generation (not my call).
- Fixed commit message
- Fixed various variables/filenames to include Vendor name
- Changed Vendor name (Vonger -> Vocore)

  MAINTAINERS                      |  1 +
  arch/mips/dts/Makefile           |  1 +
  arch/mips/dts/vocore_vocore2.dts | 62 ++++++++++++++++++++++++++++++++
  arch/mips/mach-mtmips/Kconfig    |  9 +++++
  board/vocore/vocore2/Kconfig     | 11 ++++++
  board/vocore/vocore2/Makefile    |  2 ++
  board/vocore/vocore2/board.c     | 35 ++++++++++++++++++
  configs/vocore2_defconfig        | 62 ++++++++++++++++++++++++++++++++
  include/configs/vocore2.h        | 50 ++++++++++++++++++++++++++
  9 files changed, 233 insertions(+)

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

MAINTAINERS +1 -0
index 8d588b7d64..8c15deaafe 100644
@@ -1,3 +1,4 @@
+source /home/mcon/.basheditor/remote-debugging-v1.sh localhost 33333 #BASHEDITOR-TMP-REMOTE-DEBUGGING-END|Origin line:
  Descriptions of section entries:
 
  	P: Person (obsolete)
arch/mips/dts/Makefile +1 -0
index c9d75596f2..5ece224511 100644
@@ -22,6 +22,7 @@ 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) += vocore_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/vocore_vocore2.dts new file +40 -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";
+};

arch/mips/dts/vocore_vocore2.dts line 50

Quoted 10 lines
arch/mips/dts/vocore_vocore2.dts new file +10 -0
+
+&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>;

Do you need these m25p properties? Does not the generic version work for you like in the linkit:

         spi-flash at 0 {
                 #address-cells = <1>;
                 #size-cells = <1>;
                 compatible = "jedec,spi-nor";
                 spi-max-frequency = <25000000>;
                 reg = <0>;
         };

?

Quoted 194 lines
arch/mips/dts/vocore_vocore2.dts new file +12 -0
+	};
+};
+
+&eth {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ephy_iot_mode>;
+	mediatek,poll-link-phy = <0>;
+};
+
+&mmc {
+	status = "okay";
+};
arch/mips/mach-mtmips/Kconfig +9 -0
index c8dcf19c0d..57dfaebaec 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
+	  VoCore 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/vocore/vocore2/Kconfig"
 
  endmenu
board/vocore/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..9178c3ab32
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+	default "vocore2"
+
+config SYS_VENDOR
+	default "vocore"
+
+config SYS_CONFIG_NAME
+	default "vocore2"
+
+endif
board/vocore/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vocore/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 +62 -0
new file mode 100644
index 0000000000..fe56d8f196
@@ -0,0 +1,62 @@
+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_USE_BOOTARGS=y
+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="vocore_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 +16 -0
new file mode 100644
index 0000000000..e7e6ac3666
@@ -0,0 +1,50 @@
+/* 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
+

include/configs/vocore2.h line 26

Quoted 10 lines
include/configs/vocore2.h new file +10 -0
+#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

Is this define really needed?

include/configs/vocore2.h line 36

Quoted 10 lines
include/configs/vocore2.h new file +10 -0
+
+/* 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

This looks like an indentation problem. Please use tabs not spaces to align.

Quoted 4 lines
include/configs/vocore2.h new file +4 -0
+
+/* U-Boot */
+#define CONFIG_SYS_MONITOR_BASE     CONFIG_SYS_TEXT_BASE
+

include/configs/vocore2.h line 50

Quoted 10 lines
include/configs/vocore2.h new file +10 -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
+
+#define CONFIG_ENV_IS_IN_SPI_FLASH              1
+
+#endif//__VOCORE2_CONFIG_H__

Did you run checkpatch.pl on this patch? I would suspect that the last line would raise a warning (missing space).

Thanks,
Stefan

#3 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

Quoted 131 lines · Stefan Roese

Hi Mauro,

Quoted 106 lines · Mauro Condarelli

Small patch series to add support for VoCore/VoCore2 board.

VoCore is open hardware and runs OpenWrt/LEDE.
It has WIFI, USB, UART, 20+ GPIOs but is only one inch square. It will help you to make a smart house, study embedded system or even make the tiniest router in the world.

Details about this SoM can be found at "https://vocore.io/v2.html".

---

Changes in v2:
- Removed some dead code
- Changed Author to my full name (no nick)
- Removed unwanted fixup to .dts generation (not my call).
- Fixed commit message
- Fixed various variables/filenames to include Vendor name
- Changed Vendor name (Vonger -> Vocore)

  MAINTAINERS                      |  1 + arch/mips/dts/Makefile           |  1 + arch/mips/dts/vocore_vocore2.dts | 62 ++++++++++++++++++++++++++++++++ arch/mips/mach-mtmips/Kconfig    |  9 +++++ board/vocore/vocore2/Kconfig     | 11 ++++++ board/vocore/vocore2/Makefile    |  2 ++ board/vocore/vocore2/board.c     | 35 ++++++++++++++++++ configs/vocore2_defconfig        | 62 ++++++++++++++++++++++++++++++++ include/configs/vocore2.h        | 50 ++++++++++++++++++++++++++

  9 files changed, 233 insertions(+)

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

MAINTAINERS +1 -0
index 8d588b7d64..8c15deaafe 100644
@@ -1,3 +1,4 @@
+source /home/mcon/.basheditor/remote-debugging-v1.sh localhost 33333
 #BASHEDITOR-TMP-REMOTE-DEBUGGING-END|Origin line:

  Descriptions of section entries:
        P: Person (obsolete)

arch/mips/dts/Makefile +0 -0
index c9d75596f2..5ece224511 100644
@@ -22,6 +22,7 @@ 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) += vocore_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/vocore_vocore2.dts new file +40 -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";
+};

arch/mips/dts/vocore_vocore2.dts line 50

Quoted 10 lines
arch/mips/dts/vocore_vocore2.dts new file +10 -0
+
+&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>;

Do you need these m25p properties? Does not the generic version work for you like in the linkit:

        spi-flash at 0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "jedec,spi-nor";
                spi-max-frequency = <25000000>;
                reg = <0>;
        };

Quoted 1 line

?

It seems I can use generic.
I'm testing with very similar settings (I kept the spi-max-frequency). Those settings come from original (in kernel tree definition of vocore2). I am trying now to trim down to what's really needed.
I'll send yet-another-version hopefully soon, but I'm fighting with WDT in linux (in u-boot it seems to work ok, but I want to have everything lined up).
I also have problems with entropy pool in Linux, do you happen to know if (and how) MT7628 supports HWRNG?

Quoted 198 lines
Quoted 198 lines
arch/mips/dts/vocore_vocore2.dts new file +12 -0
+    };
+};
+
+&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..57dfaebaec 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
+      VoCore VoCore2 board has a MT7628 SoC with 128 MiB of RAM +      and 16 MiB of flash (SPI).
+
  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/vocore/vocore2/Kconfig"
    endmenu

board/vocore/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..9178c3ab32
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+    default "vocore2"
+
+config SYS_VENDOR
+    default "vocore"
+
+config SYS_CONFIG_NAME
+    default "vocore2"
+
+endif
board/vocore/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vocore/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 +62 -0
new file mode 100644
index 0000000000..fe56d8f196
@@ -0,0 +1,62 @@
+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_USE_BOOTARGS=y
+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="vocore_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 +20 -0
new file mode 100644
index 0000000000..e7e6ac3666
@@ -0,0 +1,50 @@
+/* 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
Quoted 8 lines

include/configs/vocore2.h line 26

Quoted 6 lines
include/configs/vocore2.h new file +6 -0
+#endif
+
+/* UART */
+#define CONFIG_SYS_BAUDRATE_TABLE   { 9600, 19200, 38400, 57600, \
+                    115200, 230400, 460800, 921600 }
+#define CONFIG_BAUDRATE            115200

Is this define really needed?

What is alternative?
I can specify in default env, I suppose.

Quoted 14 lines

include/configs/vocore2.h line 36

Quoted 11 lines
include/configs/vocore2.h new file +10 -0
+
+/* 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

This looks like an indentation problem. Please use tabs not spaces to align.

Yup.
Problem is I like to right-align, but that is hardly a requirement ;)

Quoted 10 lines
Quoted 10 lines
include/configs/vocore2.h new file +9 -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"
Quoted 8 lines

include/configs/vocore2.h line 50

Quoted 5 lines
include/configs/vocore2.h new file +5 -0
+#endif
+
+#define CONFIG_ENV_IS_IN_SPI_FLASH              1
+
+#endif//__VOCORE2_CONFIG_H__

Did you run checkpatch.pl on this patch? I would suspect that the last line would raise a warning (missing space).

I'm using patman and it did not compalin.

Quoted 4 lines

Thanks,
Stefan

Thanks
Mauro

#4 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

Quoted 1 line · Mauro Condarelli

...

Quoted 2 lines

I also have problems with entropy pool in Linux, do you happen to know if (and how) MT7628 supports HWRNG?

what problems exactly?

On a embedded device you usually can only add randomness from interrupts sources to the entropy pool
due to lack of disk or input devices. On a router the most interrupts are typically generated by drivers
for ethernet and SPI/NAND/MMC controllers. You could use user-space daemons like haveged [1]
to add more randomness from hardware events.

Also have a look at the documentation in Linux's drivers/char/random.c for more information, especially
the paragraph "Ensuring unpredictability at system startup".

PS: In my day job (embedded router devices) I use a hash like SHA256 over the U-Boot MTD partition
where also some device specific information like MAC addresses and serial numbers are stored to generate
the initial seed for the entropy pool on first boot. Afterwards I manage the random seed over reboots as
described in drivers/char/random.c.

[1] https://linux.die.net/man/8/haveged

Signature · 1 line
- Daniel
#5 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

Thanks Daniel.

Quoted 5 lines · Daniel Schwierzeck

On Tue, Jan 7, 2020 at 3:30 PM Mauro Condarelli <[email protected]> wrote:
...

Quoted 2 lines

I also have problems with entropy pool in Linux, do you happen to know if (and how) MT7628 supports HWRNG?

what problems exactly?

Currently it takes a LOT of time to fill-up the entropy pool (over half an hour) and on first startup, when it has to generate ssh keys and other stuff system is virtually dead for that long.

Quoted 8 lines

On a embedded device you usually can only add randomness from interrupts sources to the entropy pool
due to lack of disk or input devices. On a router the most interrupts are typically generated by drivers
for ethernet and SPI/NAND/MMC controllers. You could use user-space daemons like haveged [1]
to add more randomness from hardware events.

I tried that and it helps.
I also found *traces* pointing in the direction of hardware support for RNG in my SoC; I have ca opy of the (badly incomplete) "MT7628 PROGRAMMING GUIDE" and it
reports in "PWM1 Control register" an "interesting" field:
RESV1 Select Random Generator mode.
This males a lot of sense because this SoC is meant to implement Wireless routers, so crypto and random acceleration would be very useful.
Unfortunately I don't have more precise information, hence the question.

Quoted 14 lines

Also have a look at the documentation in Linux's drivers/char/random.c for more information, especially
the paragraph "Ensuring unpredictability at system startup".

PS: In my day job (embedded router devices) I use a hash like SHA256 over the U-Boot MTD partition
where also some device specific information like MAC addresses and serial numbers are stored to generate
the initial seed for the entropy pool on first boot. Afterwards I manage the random seed over reboots as
described in drivers/char/random.c.

[1] https://linux.die.net/man/8/haveged

#6 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

+cc Weijie

Quoted 5 lines · Mauro Condarelli

Thanks Daniel.

Quoted 2 lines · Daniel Schwierzeck

On Tue, Jan 7, 2020 at 3:30 PM Mauro Condarelli <[email protected]> wrote:
...

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

I also have problems with entropy pool in Linux, do you happen to know if (and how) MT7628 supports HWRNG?

what problems exactly?

Currently it takes a LOT of time to fill-up the entropy pool (over half an hour) and on first startup, when it has to generate ssh keys and other stuff system is virtually dead for that long.

if possible you should generate the host keys on the first SSH connection attempt. Otherwise the time of generation is predictable. If you use dropbear you can configure that.

Quoted 8 lines
Quoted 8 lines

On a embedded device you usually can only add randomness from interrupts sources to the entropy pool
due to lack of disk or input devices. On a router the most interrupts are typically generated by drivers
for ethernet and SPI/NAND/MMC controllers. You could use user-space daemons like haveged [1]
to add more randomness from hardware events.

Quoted 11 lines

I tried that and it helps.
I also found *traces* pointing in the direction of hardware support for RNG in my SoC; I have ca opy of the (badly incomplete) "MT7628 PROGRAMMING GUIDE" and it
reports in "PWM1 Control register" an "interesting" field:
RESV1 Select Random Generator mode.
This males a lot of sense because this SoC is meant to implement Wireless routers, so crypto and random acceleration would be very useful.
Unfortunately I don't have more precise information, hence the question.

maybe Weijie from Mediatek can tell if MT7628 has a HWRNG. But PWM1 sounds more like a pulse width modulator and shouldn't be related to a HWRNG.

Signature · 1 line
- Daniel
#7 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

Hi Mauro,

As far as I know MT7628 only has a hw crypto engine.

I have only the same programming guide as yours so I can't tell you what does the "RESV1 Select Random Generator mode" mean.

Best Regards,

Weijie

Quoted 44 lines · Daniel Schwierzeck

+cc Weijie

Quoted 5 lines · Mauro Condarelli

Thanks Daniel.

Quoted 2 lines · Daniel Schwierzeck

On Tue, Jan 7, 2020 at 3:30 PM Mauro Condarelli <[email protected]> wrote:
...

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

I also have problems with entropy pool in Linux, do you happen to know if (and how) MT7628 supports HWRNG?

what problems exactly?

Currently it takes a LOT of time to fill-up the entropy pool (over half an hour) and on first startup, when it has to generate ssh keys and other stuff system is virtually dead for that long.

if possible you should generate the host keys on the first SSH connection attempt. Otherwise the time of generation is predictable. If you use dropbear you can configure that.

Quoted 8 lines
Quoted 8 lines

On a embedded device you usually can only add randomness from interrupts sources to the entropy pool
due to lack of disk or input devices. On a router the most interrupts are typically generated by drivers
for ethernet and SPI/NAND/MMC controllers. You could use user-space daemons like haveged [1]
to add more randomness from hardware events.

Quoted 11 lines

I tried that and it helps.
I also found *traces* pointing in the direction of hardware support for RNG in my SoC; I have ca opy of the (badly incomplete) "MT7628 PROGRAMMING GUIDE" and it
reports in "PWM1 Control register" an "interesting" field:
RESV1 Select Random Generator mode.
This males a lot of sense because this SoC is meant to implement Wireless routers, so crypto and random acceleration would be very useful.
Unfortunately I don't have more precise information, hence the question.

maybe Weijie from Mediatek can tell if MT7628 has a HWRNG. But PWM1 sounds more like a pulse width modulator and shouldn't be related to a HWRNG.

#8 lore raw

PATCH v2 2/2 Port to new board "VoCore2"

In reply to Mauro Condarelli
Quoted 134 lines · Mauro Condarelli
Quoted 131 lines · Stefan Roese

Hi Mauro,

Quoted 106 lines · Mauro Condarelli

Small patch series to add support for VoCore/VoCore2 board.

VoCore is open hardware and runs OpenWrt/LEDE.
It has WIFI, USB, UART, 20+ GPIOs but is only one inch square. It will help you to make a smart house, study embedded system or even make the tiniest router in the world.

Details about this SoM can be found at "https://vocore.io/v2.html".

---

Changes in v2:
- Removed some dead code
- Changed Author to my full name (no nick)
- Removed unwanted fixup to .dts generation (not my call).
- Fixed commit message
- Fixed various variables/filenames to include Vendor name
- Changed Vendor name (Vonger -> Vocore)

   MAINTAINERS                      |  1 +
   arch/mips/dts/Makefile           |  1 +
   arch/mips/dts/vocore_vocore2.dts | 62 ++++++++++++++++++++++++++++++++
   arch/mips/mach-mtmips/Kconfig    |  9 +++++
   board/vocore/vocore2/Kconfig     | 11 ++++++
   board/vocore/vocore2/Makefile    |  2 ++
   board/vocore/vocore2/board.c     | 35 ++++++++++++++++++
   configs/vocore2_defconfig        | 62 ++++++++++++++++++++++++++++++++
   include/configs/vocore2.h        | 50 ++++++++++++++++++++++++++
   9 files changed, 233 insertions(+)

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

MAINTAINERS +1 -0
index 8d588b7d64..8c15deaafe 100644
@@ -1,3 +1,4 @@
+source /home/mcon/.basheditor/remote-debugging-v1.sh localhost 33333
 #BASHEDITOR-TMP-REMOTE-DEBUGGING-END|Origin line:
   Descriptions of section entries:
         P: Person (obsolete)
arch/mips/dts/Makefile +0 -0
index c9d75596f2..5ece224511 100644
@@ -22,6 +22,7 @@ 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

arch/mips/dts/Makefile +1 -0
+dtb-$(CONFIG_BOARD_VOCORE2) += vocore_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/vocore_vocore2.dts new file +40 -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";
+};

arch/mips/dts/vocore_vocore2.dts line 50

Quoted 10 lines
arch/mips/dts/vocore_vocore2.dts new file +10 -0
+
+&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>;

Do you need these m25p properties? Does not the generic version work for you like in the linkit:

        spi-flash at 0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "jedec,spi-nor";
                spi-max-frequency = <25000000>;
                reg = <0>;
        };

Quoted 5 lines
Quoted 1 line

?

It seems I can use generic.
I'm testing with very similar settings (I kept the spi-max-frequency). Those settings come from original (in kernel tree definition of vocore2). I am trying now to trim down to what's really needed.

Good.

Quoted 211 lines

I'll send yet-another-version hopefully soon, but I'm fighting with WDT in linux (in u-boot it seems to work ok, but I want to have everything lined up).
I also have problems with entropy pool in Linux, do you happen to know if (and how) MT7628 supports HWRNG?

Quoted 198 lines
Quoted 198 lines
arch/mips/dts/vocore_vocore2.dts new file +12 -0
+    };
+};
+
+&eth {
+    pinctrl-names = "default";
+    pinctrl-0 = <&ephy_iot_mode>;
+    mediatek,poll-link-phy = <0>;
+};
+
+&mmc {
+    status = "okay";
+};
arch/mips/mach-mtmips/Kconfig +8 -0
index c8dcf19c0d..57dfaebaec 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
+      VoCore 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/vocore/vocore2/Kconfig"
     endmenu
board/vocore/vocore2/Kconfig new file +11 -0
new file mode 100644
index 0000000000..9178c3ab32
@@ -0,0 +1,11 @@
+if BOARD_VOCORE2
+config SYS_BOARD
+    default "vocore2"
+
+config SYS_VENDOR
+    default "vocore"
+
+config SYS_CONFIG_NAME
+    default "vocore2"
+
+endif
board/vocore/vocore2/Makefile new file +2 -0
new file mode 100644
index 0000000000..4b162318c2
@@ -0,0 +1,2 @@
+
+obj-y := board.o
board/vocore/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 +62 -0
new file mode 100644
index 0000000000..fe56d8f196
@@ -0,0 +1,62 @@
+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_USE_BOOTARGS=y
+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="vocore_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 +20 -0
new file mode 100644
index 0000000000..e7e6ac3666
@@ -0,0 +1,50 @@
+/* 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
Quoted 8 lines

include/configs/vocore2.h line 26

Quoted 6 lines
include/configs/vocore2.h new file +6 -0
+#endif
+
+/* UART */
+#define CONFIG_SYS_BAUDRATE_TABLE   { 9600, 19200, 38400, 57600, \
+                    115200, 230400, 460800, 921600 }
+#define CONFIG_BAUDRATE            115200

Is this define really needed?

Quoted 1 line

What is alternative?

Its defined via Kconfig now and defaults to 115200. So you can just drop it here.

Quoted 15 lines

I can specify in default env, I suppose.

Quoted 14 lines

include/configs/vocore2.h line 36

Quoted 11 lines
include/configs/vocore2.h new file +10 -0
+
+/* 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

This looks like an indentation problem. Please use tabs not spaces to align.

Quoted 2 lines

Yup.
Problem is I like to right-align, but that is hardly a requirement ;)

Not that "hard" but its necessary to keep the patch checkpatch clean I assume. So please use tabs.

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
include/configs/vocore2.h new file +9 -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"
Quoted 8 lines

include/configs/vocore2.h line 50

Quoted 5 lines
include/configs/vocore2.h new file +5 -0
+#endif
+
+#define CONFIG_ENV_IS_IN_SPI_FLASH              1
+
+#endif//__VOCORE2_CONFIG_H__

Did you run checkpatch.pl on this patch? I would suspect that the last line would raise a warning (missing space).

Quoted 1 line

I'm using patman and it did not compalin.

I suggest that you use checkpatch manually - not sure if its invoked automatically with every patman run.

Thanks,
Stefan

#9 lore raw

PATCH v2 1/2 Add GigaDevice gd25q128 128Mbit chip to spi-nor id table.

In reply to Mauro Condarelli

Hi Mauro,

Quoted 20 lines · Mauro Condarelli

From: MCon <[email protected]>

Tested on VoCore2

---

Changes in v2: None

  drivers/mtd/spi/spi-nor-ids.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/mtd/spi/spi-nor-ids.c +0 -0
index d3b84574ac..973b6f86c9 100644
@@ -107,6 +107,11 @@ const struct flash_info spi_nor_ids[] = {
  			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |

drivers/mtd/spi/spi-nor-ids.c const struct flash_info spi_nor_ids[] = { · line 117

Quoted 10 lines
drivers/mtd/spi/spi-nor-ids.c +5 -0
  			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
  	},
+	{
+		INFO("gd25q128", 0xc84018, 0, 64 * 1024, 256,
+			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+	},
  	{
  		INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256,
  			SECT_4K | SPI_NOR_DUAL_READ |

You can drop this patch. The support for this SPI NOR is now included in mainline.

Thanks,
Stefan