Skip to contentSkip to conversation

Marvell DB-XC3-24G4XG board support

PATCH Superseded Chris Packham 2 participants 19 messages Feb 15, 2019 – Apr 11, 2019

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Marvell DB-XC3-24G4XG board support

This series adds support for Marvell's Switches with integrated CPUs and the DB-XC3-24G4XG board. The CPU side is similar to the Armada range.

For now the DDR training code needs to come from the Marvell bin_hdr. It's one area where the integrated SoCs differ from the Armada range so neither the Armada-XP nor Armada-38x training code will work as-is. I'm asking Marvell about the possibility of re-licensing the code under a Proprietary/BSD/GPL as they did with Armada-38x.

I also have access to a DB-DXBC2-MM board with a different chip. I'll look at adding support for that as well at some point. It's harder to work with because it has no USB, but other than that it's similar to the DB-XC3.

Changes in v2:
- use CONFIG_ARMADA_MSYS instead of just CONFIG_MSYS
- Disable MBUS Error proagation
- new, split out from Add DB-XC3-24G4XG board with a better explanation
- u-boot specific changes in u-boot.dtsi
- remove unnecessary entries from board config.h
- move some changes to earlier patches

Chris Packham (5):
arm: sync armada-xp dts files from Linux 5.0
arm: mvebu: Add Marvell's integrated CPUs
arm: mvebu: NAND clock support for MSYS devices
tools: kwbimage: don't adjust for image_header for Armada MSYS
arm: mvebu: Add DB-XC3-24G4XG board

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/armada-370-xp.dtsi               | 133 +++----
 arch/arm/dts/armada-xp-98dx3236.dtsi          | 343 ++++++++++++++++++
 arch/arm/dts/armada-xp-98dx3336.dtsi          |  39 ++
 arch/arm/dts/armada-xp-98dx4251.dtsi          |  54 +++
 .../dts/armada-xp-db-xc3-24g4xg-u-boot.dtsi   |  24 ++
 arch/arm/dts/armada-xp-db-xc3-24g4xg.dts      | 110 ++++++
 arch/arm/dts/armada-xp-gp.dts                 | 167 ++++-----
 arch/arm/dts/armada-xp-maxbcm.dts             |  24 +-
 arch/arm/dts/armada-xp-mv78230.dtsi           |  55 +--
 arch/arm/dts/armada-xp-mv78260.dtsi           |  58 +--
 arch/arm/dts/armada-xp-mv78460.dtsi           |  58 +--
 arch/arm/dts/armada-xp-synology-ds414.dts     | 199 +++++-----
 arch/arm/dts/armada-xp-theadorable.dts        |  69 ++--
 arch/arm/dts/armada-xp.dtsi                   | 214 ++++++-----
 arch/arm/mach-mvebu/Kconfig                   |  26 +-
 arch/arm/mach-mvebu/Makefile                  |   1 +
 arch/arm/mach-mvebu/cpu.c                     |  33 +-
 arch/arm/mach-mvebu/include/mach/config.h     |   2 +-
 arch/arm/mach-mvebu/include/mach/cpu.h        |   3 +
 arch/arm/mach-mvebu/include/mach/soc.h        |  31 ++
 arch/arm/mach-mvebu/mbus.c                    |   5 +
 board/Marvell/db-xc3-24g4xg/MAINTAINERS       |   7 +
 board/Marvell/db-xc3-24g4xg/Makefile          |   5 +
 board/Marvell/db-xc3-24g4xg/README            |   4 +
 board/Marvell/db-xc3-24g4xg/binary.0          |  11 +
 board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c   |  68 ++++
 board/Marvell/db-xc3-24g4xg/kwbimage.cfg      |  12 +
 configs/db-xc3-24g4xg_defconfig               |  55 +++
 drivers/ddr/marvell/axp/xor_regs.h            |   4 +
 include/configs/db-xc3-24g4xg.h               |  41 +++
 tools/Makefile                                |   4 +
 tools/kwbimage.c                              |   4 +
 33 files changed, 1319 insertions(+), 547 deletions(-)
 create mode 100644 arch/arm/dts/armada-xp-98dx3236.dtsi
 create mode 100644 arch/arm/dts/armada-xp-98dx3336.dtsi
 create mode 100644 arch/arm/dts/armada-xp-98dx4251.dtsi
 create mode 100644 arch/arm/dts/armada-xp-db-xc3-24g4xg-u-boot.dtsi
 create mode 100644 arch/arm/dts/armada-xp-db-xc3-24g4xg.dts
 create mode 100644 board/Marvell/db-xc3-24g4xg/MAINTAINERS
 create mode 100644 board/Marvell/db-xc3-24g4xg/Makefile
 create mode 100644 board/Marvell/db-xc3-24g4xg/README
 create mode 100644 board/Marvell/db-xc3-24g4xg/binary.0
 create mode 100644 board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c
 create mode 100644 board/Marvell/db-xc3-24g4xg/kwbimage.cfg
 create mode 100644 configs/db-xc3-24g4xg_defconfig
 create mode 100644 include/configs/db-xc3-24g4xg.h
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/5 arm: sync armada-xp dts files from Linux 5.0

Bring in the Armada 370/XP dts/dtsi files from Linux. As U-Boot hasn't got the new NAND driver the updating binding has not been included.

---

Changes in v2: None

 arch/arm/dts/armada-370-xp.dtsi           | 133 ++++++--------
 arch/arm/dts/armada-xp-gp.dts             | 167 +++++++----------
 arch/arm/dts/armada-xp-maxbcm.dts         |  24 +--
 arch/arm/dts/armada-xp-mv78230.dtsi       |  55 ++----
 arch/arm/dts/armada-xp-mv78260.dtsi       |  58 ++----
 arch/arm/dts/armada-xp-mv78460.dtsi       |  58 ++----
 arch/arm/dts/armada-xp-synology-ds414.dts | 199 ++++++++++----------
 arch/arm/dts/armada-xp-theadorable.dts    |  69 +++----
 arch/arm/dts/armada-xp.dtsi               | 214 ++++++++++++----------
 9 files changed, 435 insertions(+), 542 deletions(-)
arch/arm/dts/armada-370-xp.dtsi +57 -76
index 0b2a78d39301..e4c35d4e98f4 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Device Tree Include file for Marvell Armada 370 and Armada XP SoC
  *
@@ -8,50 +9,10 @@
  * Thomas Petazzoni <[email protected]>
  * Ben Dooks <[email protected]>
  *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
- *
  * This file contains the definitions that are common to the Armada
  * 370 and Armada XP SoC.
  */
 
-/include/ "skeleton64.dtsi"
-
 #define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
 
 / {
@@ -86,7 +47,7 @@
 		pcie-mem-aperture = <0xf8000000 0x7e00000>;
 		pcie-io-aperture  = <0xffe00000 0x100000>;
 
-		devbus-bootcs {
+		devbus_bootcs: devbus-bootcs {
 			compatible = "marvell,mvebu-devbus";
 			reg = <MBUS_ID(0xf0, 0x01) 0x10400 0x8>;
 			ranges = <0 MBUS_ID(0x01, 0x2f) 0 0xffffffff>;
@@ -96,7 +57,7 @@
 			status = "disabled";
 		};
 
-		devbus-cs0 {
+		devbus_cs0: devbus-cs0 {
 			compatible = "marvell,mvebu-devbus";
 			reg = <MBUS_ID(0xf0, 0x01) 0x10408 0x8>;
 			ranges = <0 MBUS_ID(0x01, 0x3e) 0 0xffffffff>;
@@ -106,7 +67,7 @@
 			status = "disabled";
 		};
 
-		devbus-cs1 {
+		devbus_cs1: devbus-cs1 {
 			compatible = "marvell,mvebu-devbus";
 			reg = <MBUS_ID(0xf0, 0x01) 0x10410 0x8>;
 			ranges = <0 MBUS_ID(0x01, 0x3d) 0 0xffffffff>;
@@ -116,7 +77,7 @@
 			status = "disabled";
 		};
 
-		devbus-cs2 {
+		devbus_cs2: devbus-cs2 {
 			compatible = "marvell,mvebu-devbus";
 			reg = <MBUS_ID(0xf0, 0x01) 0x10418 0x8>;
 			ranges = <0 MBUS_ID(0x01, 0x3b) 0 0xffffffff>;
@@ -126,7 +87,7 @@
 			status = "disabled";
 		};
 
-		devbus-cs3 {
+		devbus_cs3: devbus-cs3 {
 			compatible = "marvell,mvebu-devbus";
 			reg = <MBUS_ID(0xf0, 0x01) 0x10420 0x8>;
 			ranges = <0 MBUS_ID(0x01, 0x37) 0 0xffffffff>;
@@ -141,34 +102,13 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
-			u-boot,dm-pre-reloc;
 
-			rtc at 10300 {
+			rtc: rtc at 10300 {
 				compatible = "marvell,orion-rtc";
 				reg = <0x10300 0x20>;
 				interrupts = <50>;
 			};
 
-			spi0: spi at 10600 {
-				reg = <0x10600 0x28>;
-				#address-cells = <1>;
-				#size-cells = <0>;
-				cell-index = <0>;
-				interrupts = <30>;
-				clocks = <&coreclk 0>;
-				status = "disabled";
-			};
-
-			spi1: spi at 10680 {
-				reg = <0x10680 0x28>;
-				#address-cells = <1>;
-				#size-cells = <0>;
-				cell-index = <1>;
-				interrupts = <92>;
-				clocks = <&coreclk 0>;
-				status = "disabled";
-			};
-
 			i2c0: i2c at 11000 {
 				compatible = "marvell,mv64xxx-i2c";
 				#address-cells = <1>;
@@ -235,33 +175,38 @@
 				msi-controller;
 			};
 
-			coherency-fabric at 20200 {
+			coherencyfab: coherency-fabric at 20200 {
 				compatible = "marvell,coherency-fabric";
 				reg = <0x20200 0xb0>, <0x21010 0x1c>;
 			};
 
-			timer at 20300 {
+			timer: timer at 20300 {
 				reg = <0x20300 0x30>, <0x21040 0x30>;
 				interrupts = <37>, <38>, <39>, <40>, <5>, <6>;
 			};
 
-			watchdog at 20300 {
+			watchdog: watchdog at 20300 {
 				reg = <0x20300 0x34>, <0x20704 0x4>;
 			};
 
-			pmsu at 22000 {
+			cpurst: cpurst at 20800 {
+				compatible = "marvell,armada-370-cpu-reset";
+				reg = <0x20800 0x8>;
+			};
+
+			pmsu: pmsu at 22000 {
 				compatible = "marvell,armada-370-pmsu";
 				reg = <0x22000 0x1000>;
 			};
 
-			usb at 50000 {
+			usb0: usb at 50000 {
 				compatible = "marvell,orion-ehci";
 				reg = <0x50000 0x500>;
 				interrupts = <45>;
 				status = "disabled";
 			};
 
-			usb at 51000 {
+			usb1: usb at 51000 {
 				compatible = "marvell,orion-ehci";
 				reg = <0x51000 0x500>;
 				interrupts = <46>;
@@ -275,7 +220,7 @@
 				status = "disabled";
 			};
 
-			mdio: mdio {
+			mdio: mdio at 72004 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				compatible = "marvell,orion-mdio";
@@ -290,7 +235,7 @@
 				status = "disabled";
 			};
 
-			sata at a0000 {
+			sata: sata at a0000 {
 				compatible = "marvell,armada-370-sata";
 				reg = <0xa0000 0x5000>;
 				interrupts = <55>;
@@ -309,7 +254,7 @@
 				status = "disabled";
 			};
 
-			mvsdio at d4000 {
+			sdio: mvsdio at d4000 {
 				compatible = "marvell,orion-sdio";
 				reg = <0xd4000 0x200>;
 				interrupts = <54>;
@@ -321,6 +266,42 @@
 				status = "disabled";
 			};
 		};
+
+		spi0: spi at 10600 {
+			reg = <MBUS_ID(0xf0, 0x01) 0x10600 0x28>, /* control */
+			      <MBUS_ID(0x01, 0x1e) 0 0xffffffff>, /* CS0 */
+			      <MBUS_ID(0x01, 0x5e) 0 0xffffffff>, /* CS1 */
+			      <MBUS_ID(0x01, 0x9e) 0 0xffffffff>, /* CS2 */
+			      <MBUS_ID(0x01, 0xde) 0 0xffffffff>, /* CS3 */
+			      <MBUS_ID(0x01, 0x1f) 0 0xffffffff>, /* CS4 */
+			      <MBUS_ID(0x01, 0x5f) 0 0xffffffff>, /* CS5 */
+			      <MBUS_ID(0x01, 0x9f) 0 0xffffffff>, /* CS6 */
+			      <MBUS_ID(0x01, 0xdf) 0 0xffffffff>; /* CS7 */
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <0>;
+			interrupts = <30>;
+			clocks = <&coreclk 0>;
+			status = "disabled";
+		};
+
+		spi1: spi at 10680 {
+			reg = <MBUS_ID(0xf0, 0x01) 0x10680 0x28>, /* control */
+			      <MBUS_ID(0x01, 0x1a) 0 0xffffffff>, /* CS0 */
+			      <MBUS_ID(0x01, 0x5a) 0 0xffffffff>, /* CS1 */
+			      <MBUS_ID(0x01, 0x9a) 0 0xffffffff>, /* CS2 */
+			      <MBUS_ID(0x01, 0xda) 0 0xffffffff>, /* CS3 */
+			      <MBUS_ID(0x01, 0x1b) 0 0xffffffff>, /* CS4 */
+			      <MBUS_ID(0x01, 0x5b) 0 0xffffffff>, /* CS5 */
+			      <MBUS_ID(0x01, 0x9b) 0 0xffffffff>, /* CS6 */
+			      <MBUS_ID(0x01, 0xdb) 0 0xffffffff>; /* CS7 */
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <1>;
+			interrupts = <92>;
+			clocks = <&coreclk 0>;
+			status = "disabled";
+		};
 	};
 
 	clocks {
arch/arm/dts/armada-xp-gp.dts +71 -96

237 lines not on this page · raw message

arch/arm/dts/armada-xp-maxbcm.dts +12 -12
index d7d7f65c85fe..921eb7086254 100644
@@ -225,18 +225,6 @@
 				status = "okay";
 			};
 
-			spi0: spi at 10600 {
-				status = "okay";
-
-				spi-flash at 0 {
-					#address-cells = <1>;
-					#size-cells = <1>;
-					compatible = "n25q128a13", "jedec,spi-nor";
-					reg = <0>; /* Chip select 0 */
-					spi-max-frequency = <108000000>;
-				};
-			};
-
 			nand at d0000 {
 				status = "okay";
 				num-cs = <1>;
@@ -247,3 +235,15 @@
 		};
 	};
 };
+
+&spi0 {
+	status = "okay";
+
+	spi-flash at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "n25q128a13", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+	};
+};
arch/arm/dts/armada-xp-mv78230.dtsi +13 -42

85 lines not on this page · raw message

arch/arm/dts/armada-xp-mv78260.dtsi +15 -43

91 lines not on this page · raw message

arch/arm/dts/armada-xp-mv78460.dtsi +15 -43

91 lines not on this page · raw message

arch/arm/dts/armada-xp-synology-ds414.dts +98 -101

264 lines not on this page · raw message

arch/arm/dts/armada-xp-theadorable.dts +35 -34

81 lines not on this page · raw message

arch/arm/dts/armada-xp.dtsi +119 -95

302 lines not on this page · raw message

Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 2/5 arm: mvebu: Add Marvell's integrated CPUs

In reply to Chris Packham

Marvell's switch chips with integrated CPUs (collectively referred to as MSYS) share common ancestry with the Armada SoCs. Some of the IP blocks (e.g. xor) are located at different addresses and DFX server exists as a separate target on the MBUS (on Armada-38x it's just part of the core complex registers).

---

Changes in v2:
- use CONFIG_ARMADA_MSYS instead of just CONFIG_MSYS
- Disable MBUS Error proagation

 arch/arm/mach-mvebu/Kconfig               | 18 ++++++++++++-
 arch/arm/mach-mvebu/Makefile              |  1 +
 arch/arm/mach-mvebu/cpu.c                 | 31 +++++++++++++++++++++--
 arch/arm/mach-mvebu/include/mach/config.h |  2 +-
 arch/arm/mach-mvebu/include/mach/cpu.h    |  3 +++
 arch/arm/mach-mvebu/include/mach/soc.h    | 20 +++++++++++++++
 arch/arm/mach-mvebu/mbus.c                |  5 ++++
 drivers/ddr/marvell/axp/xor_regs.h        |  4 +++
 8 files changed, 80 insertions(+), 4 deletions(-)
arch/arm/mach-mvebu/Kconfig +17 -1
index 7dda04e0e34e..08c9972f02d7 100644
@@ -46,7 +46,7 @@ config ARMADA_8K
 # Armada PLL frequency (used for NAND clock generation)
 config SYS_MVEBU_PLL_CLOCK
 	int
-	default "2000000000" if ARMADA_XP || ARMADA_3700 || ARMADA_8K
+	default "2000000000" if ARMADA_XP || ARMADA_3700 || ARMADA_8K || ARMADA_MSYS
 	default "1000000000" if ARMADA_38X || ARMADA_375
 
 # Armada XP/38x SoC types...
@@ -63,6 +63,22 @@ config MV78460
 	bool
 	select ARMADA_XP
 
+config ARMADA_MSYS
+	bool
+	select ARMADA_32BIT
+
+config 98DX4251
+	bool
+	select ARMADA_MSYS
+
+config 98DX3336
+	bool
+	select ARMADA_MSYS
+
+config 98DX3236
+	bool
+	select ARMADA_MSYS
+
 config 88F6820
 	bool
 	select ARMADA_38X
arch/arm/mach-mvebu/Makefile +1 -0
index ee2eca913484..2ab7b3c8417e 100644
@@ -24,6 +24,7 @@ ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_ARMADA_375) += ../../../drivers/ddr/marvell/axp/xor.o
 obj-$(CONFIG_ARMADA_38X) += ../../../drivers/ddr/marvell/a38x/xor.o
 obj-$(CONFIG_ARMADA_XP) += ../../../drivers/ddr/marvell/axp/xor.o
+obj-$(CONFIG_ARMADA_MSYS) += ../../../drivers/ddr/marvell/axp/xor.o
 obj-$(CONFIG_MVEBU_EFUSE) += efuse.o
 
 extra-y += kwbimage.cfg
arch/arm/mach-mvebu/cpu.c +29 -2
index 919d05c88c77..61b222a21070 100644
@@ -23,6 +23,11 @@ static struct mbus_win windows[] = {
 	/* NOR */
 	{ MBUS_BOOTROM_BASE, MBUS_BOOTROM_SIZE,
 	  CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_BOOTROM },
+
+#ifdef CONFIG_ARMADA_MSYS
+	/* DFX */
+	{ MBUS_DFX_BASE, MBUS_DFX_SIZE, CPU_TARGET_DFX, 0 },
+#endif
 };
 
 void lowlevel_init(void)
@@ -121,6 +126,14 @@ static const struct sar_freq_modes sar_freq_tab[] = {
 	{ 0x13,  0x0, 2000, 1000, 933 },
 	{ 0xff, 0xff,    0,    0,   0 }	/* 0xff marks end of array */
 };
+#elif defined(CONFIG_ARMADA_MSYS)
+static const struct sar_freq_modes sar_freq_tab[] = {
+	{  0x0,	0x0,  400,  400, 400 },
+	{  0x2, 0x0,  667,  333, 667 },
+	{  0x3, 0x0,  800,  400, 800 },
+	{  0x5, 0x0,  800,  400, 800 },
+	{ 0xff, 0xff,    0,   0,   0 }	/* 0xff marks end of array */
+};
 #else
 /* SAR frequency values for Armada XP */
 static const struct sar_freq_modes sar_freq_tab[] = {
@@ -144,7 +157,7 @@ void get_sar_freq(struct sar_freq_modes *sar_freq)
 	u32 freq;
 	int i;
 
-#if defined(CONFIG_ARMADA_375)
+#if defined(CONFIG_ARMADA_375) || defined(CONFIG_ARMADA_MSYS)
 	val = readl(CONFIG_SAR2_REG);	/* SAR - Sample At Reset */
 #else
 	val = readl(CONFIG_SAR_REG);	/* SAR - Sample At Reset */
@@ -160,7 +173,7 @@ void get_sar_freq(struct sar_freq_modes *sar_freq)
 #endif
 	for (i = 0; sar_freq_tab[i].val != 0xff; i++) {
 		if (sar_freq_tab[i].val == freq) {
-#if defined(CONFIG_ARMADA_375) || defined(CONFIG_ARMADA_38X)
+#if defined(CONFIG_ARMADA_375) || defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_MSYS)
 			*sar_freq = sar_freq_tab[i];
 			return;
 #else
@@ -270,6 +283,20 @@ int print_cpuinfo(void)
 		}
 	}
 
+	if (mvebu_soc_family() == MVEBU_SOC_MSYS) {
+		switch (revid) {
+		case 3:
+			puts("A0");
+			break;
+		case 4:
+			puts("A1");
+			break;
+		default:
+			printf("?? (%x)", revid);
+			break;
+		}
+	}
+
 	get_sar_freq(&sar_freq);
 	printf(" at %d MHz\n", sar_freq.p_clk);
 
arch/arm/mach-mvebu/include/mach/config.h +1 -1
index e3235fc67ecd..a14d1e3836bb 100644
@@ -17,7 +17,7 @@
 #include <asm/arch/soc.h>
 
 #if defined(CONFIG_ARMADA_XP) || defined(CONFIG_ARMADA_375) \
-	|| defined(CONFIG_ARMADA_38X)
+	|| defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_MSYS)
 /*
  * Set this for the common xor register definitions needed in dram.c
  * for A38x as well here.
arch/arm/mach-mvebu/include/mach/cpu.h +3 -0
index 9e23043a4857..b9153d86c669 100644
@@ -34,6 +34,7 @@ enum cpu_target {
 	CPU_TARGET_PCIE02 = 0x4,
 	CPU_TARGET_ETH01 = 0x7,
 	CPU_TARGET_PCIE13 = 0x8,
+	CPU_TARGET_DFX = 0x8,
 	CPU_TARGET_SASRAM = 0x9,
 	CPU_TARGET_SATA01 = 0xa, /* A38X */
 	CPU_TARGET_NAND = 0xd,
@@ -79,6 +80,8 @@ enum {
 #define MBUS_PCI_IO_SIZE	(64 << 10)
 #define MBUS_SPI_BASE		0xF4000000
 #define MBUS_SPI_SIZE		(8 << 20)
+#define MBUS_DFX_BASE		0xF6000000
+#define MBUS_DFX_SIZE		(1 << 20)
 #define MBUS_BOOTROM_BASE	0xF8000000
 #define MBUS_BOOTROM_SIZE	(8 << 20)
 
arch/arm/mach-mvebu/include/mach/soc.h +20 -0
index 01577f469b0e..2d88c410b88c 100644
@@ -76,7 +76,11 @@
 #define MVEBU_NAND_BASE		(MVEBU_REGISTER(0xd0000))
 #define MVEBU_SDIO_BASE		(MVEBU_REGISTER(0xd8000))
 #define MVEBU_LCD_BASE		(MVEBU_REGISTER(0xe0000))
+#ifdef CONFIG_ARMADA_MSYS
+#define MVEBU_DFX_BASE		(MBUS_DFX_BASE)
+#else
 #define MVEBU_DFX_BASE		(MVEBU_REGISTER(0xe4000))
+#endif
 
 #define SOC_COHERENCY_FABRIC_CTRL_REG	(MVEBU_REGISTER(0x20200))
 #define MBUS_ERR_PROP_EN	(1 << 8)
@@ -149,6 +153,22 @@
 #define BOOT_FROM_SPI		0x32
 #define BOOT_FROM_MMC		0x30
 #define BOOT_FROM_MMC_ALT	0x31
+#elif defined(CONFIG_ARMADA_MSYS)
+/* SAR values for MSYS */
+#define CONFIG_SAR_REG		(MBUS_DFX_BASE  + 0xf8200)
+#define CONFIG_SAR2_REG		(MBUS_DFX_BASE  + 0xf8204)
+
+#define SAR_CPU_FREQ_OFFS	18
+#define SAR_CPU_FREQ_MASK	(0x7 << SAR_CPU_FREQ_OFFS)
+#define SAR_BOOT_DEVICE_OFFS	11
+#define SAR_BOOT_DEVICE_MASK	(0x7 << SAR_BOOT_DEVICE_OFFS)
+
+#define BOOT_DEV_SEL_OFFS	11
+#define BOOT_DEV_SEL_MASK	(0x7 << BOOT_DEV_SEL_OFFS)
+
+#define BOOT_FROM_NAND		0x1
+#define BOOT_FROM_UART		0x2
+#define BOOT_FROM_SPI		0x3
 #else
 /* SAR values for Armada XP */
 #define CONFIG_SAR_REG		(MVEBU_REGISTER(0x18230))
arch/arm/mach-mvebu/mbus.c +5 -0
index df4c5cb2d718..3a869e09d3ba 100644
@@ -344,6 +344,11 @@ static void mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus)
 		}
 	}
 	mbus_dram_info.num_cs = cs;
+
+#if defined(CONFIG_ARMADA_MSYS)
+	/* Disable MBUS Err Prop - in order to avoid data aborts */
+	clrbits_le32(mbus->mbuswins_base + 0x200, BIT(8));
+#endif
 }
 
 static const struct mvebu_mbus_soc_data
drivers/ddr/marvell/axp/xor_regs.h +4 -0
index db5c41967393..d779e564189a 100644
@@ -13,7 +13,11 @@
 #define XOR_UNIT(chan)			((chan) >> 1)
 #define XOR_CHAN(chan)			((chan) & 1)
 
+#ifdef CONFIG_ARMADA_MSYS
+#define MV_XOR_REGS_OFFSET(unit)	(0xF0800)
+#else
 #define MV_XOR_REGS_OFFSET(unit)	(0x60900)
+#endif
 #define MV_XOR_REGS_BASE(unit)		(MV_XOR_REGS_OFFSET(unit))
 
 /* XOR Engine Control Register Map */
Signature · 1 line
2.20.1
#6 lore raw

PATCH v2 3/5 arm: mvebu: NAND clock support for MSYS devices

In reply to Chris Packham

One difference with the integrated CPUs is that they use a different clock control block to the Armada devices. Update mvebu_get_nand_clock() accordingly.

---
This could probably be squashed into the previous change. I was trying to separate things to aid review but it's hard to do so and keep bisectability.

Changes in v2: None

 arch/arm/mach-mvebu/cpu.c              |  2 ++
 arch/arm/mach-mvebu/include/mach/soc.h | 11 +++++++++++
 2 files changed, 13 insertions(+)
arch/arm/mach-mvebu/cpu.c +2 -0
index 61b222a21070..5609ee2f9a3b 100644
@@ -499,6 +499,8 @@ u32 mvebu_get_nand_clock(void)
 
 	if (mvebu_soc_family() == MVEBU_SOC_A38X)
 		reg = MVEBU_DFX_DIV_CLK_CTRL(1);
+	else if (mvebu_soc_family() == MVEBU_SOC_MSYS)
+		reg = MVEBU_DFX_DIV_CLK_CTRL(8);
 	else
 		reg = MVEBU_CORE_DIV_CLK_CTRL(1);
 
arch/arm/mach-mvebu/include/mach/soc.h +11 -0
index 2d88c410b88c..f666ee24243b 100644
@@ -100,9 +100,20 @@
 #define SPI_PUP_EN		BIT(5)
 
 #define MVEBU_CORE_DIV_CLK_CTRL(i)	(MVEBU_CLOCK_BASE + ((i) * 0x8))
+#ifdef CONFIG_ARMADA_MSYS
+#define MVEBU_DFX_DIV_CLK_CTRL(i)	(MVEBU_DFX_BASE + 0xf8000 + 0x250 + ((i) * 0x4))
+#define NAND_ECC_DIVCKL_RATIO_OFFS	6
+#define NAND_ECC_DIVCKL_RATIO_MASK	(0xF << NAND_ECC_DIVCKL_RATIO_OFFS)
+#else
 #define MVEBU_DFX_DIV_CLK_CTRL(i)	(MVEBU_DFX_BASE + 0x250 + ((i) * 0x4))
+#endif
+#ifdef CONFIG_ARMADA_MSYS
+#define NAND_ECC_DIVCKL_RATIO_OFFS	6
+#define NAND_ECC_DIVCKL_RATIO_MASK	(0xF << NAND_ECC_DIVCKL_RATIO_OFFS)
+#else
 #define NAND_ECC_DIVCKL_RATIO_OFFS	8
 #define NAND_ECC_DIVCKL_RATIO_MASK	(0x3F << NAND_ECC_DIVCKL_RATIO_OFFS)
+#endif
 
 #define SDRAM_MAX_CS		4
 #define SDRAM_ADDR_MASK		0xFF000000
Signature · 1 line
2.20.1
#8 lore raw

PATCH v2 4/5 tools: kwbimage: don't adjust for image_header for Armada MSYS

In reply to Chris Packham

For the time being the Armada MSYS SoCs need to use the bin_hdr from the Marvell U-Boot. Because of this the binary.0 does not contain the image header that a proper u-boot SPL would so the adjustment introduced by commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.

---

Changes in v2:
- new, split out from Add DB-XC3-24G4XG board with a better explanation

 tools/Makefile   | 4 ++++
 tools/kwbimage.c | 4 ++++
 2 files changed, 8 insertions(+)
tools/Makefile +4 -0
index 081383d7a790..d99098d6167a 100644
@@ -148,6 +148,10 @@ ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
 HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
 endif
 
+ifneq ($(CONFIG_ARMADA_MSYS),)
+HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_DESTADDR_COMPAT
+endif
+
 # MXSImage needs LibSSL
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
 HOSTLOADLIBES_mkimage += \
tools/kwbimage.c +4 -0
index a88a3830c0c8..4c60679fbb53 100644
@@ -1252,8 +1252,12 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 		cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
 	main_hdr->headersz_lsb = cpu_to_le16(headersz & 0xFFFF);
 	main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16;
+#ifdef CONFIG_KWB_DESTADDR_COMPAT
+	main_hdr->destaddr     = cpu_to_le32(params->addr);
+#else
 	main_hdr->destaddr     = cpu_to_le32(params->addr)
 				 - sizeof(image_header_t);
+#endif
 	main_hdr->execaddr     = cpu_to_le32(params->ep);
 	main_hdr->srcaddr      = cpu_to_le32(headersz);
 	main_hdr->ext          = hasext;
Signature · 1 line
2.20.1
#12 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

In reply to Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

---

Changes in v2:
- u-boot specific changes in u-boot.dtsi
- remove unnecessary entries from board config.h
- move some changes to earlier patches

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/armada-xp-98dx3236.dtsi          | 343 ++++++++++++++++++
 arch/arm/dts/armada-xp-98dx3336.dtsi          |  39 ++
 arch/arm/dts/armada-xp-98dx4251.dtsi          |  54 +++
 .../dts/armada-xp-db-xc3-24g4xg-u-boot.dtsi   |  24 ++
 arch/arm/dts/armada-xp-db-xc3-24g4xg.dts      | 110 ++++++
 arch/arm/mach-mvebu/Kconfig                   |   8 +
 board/Marvell/db-xc3-24g4xg/MAINTAINERS       |   7 +
 board/Marvell/db-xc3-24g4xg/Makefile          |   5 +
 board/Marvell/db-xc3-24g4xg/README            |   4 +
 board/Marvell/db-xc3-24g4xg/binary.0          |  11 +
 board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c   |  68 ++++
 board/Marvell/db-xc3-24g4xg/kwbimage.cfg      |  12 +
 configs/db-xc3-24g4xg_defconfig               |  55 +++
 include/configs/db-xc3-24g4xg.h               |  41 +++
 15 files changed, 783 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/armada-xp-98dx3236.dtsi
 create mode 100644 arch/arm/dts/armada-xp-98dx3336.dtsi
 create mode 100644 arch/arm/dts/armada-xp-98dx4251.dtsi
 create mode 100644 arch/arm/dts/armada-xp-db-xc3-24g4xg-u-boot.dtsi
 create mode 100644 arch/arm/dts/armada-xp-db-xc3-24g4xg.dts
 create mode 100644 board/Marvell/db-xc3-24g4xg/MAINTAINERS
 create mode 100644 board/Marvell/db-xc3-24g4xg/Makefile
 create mode 100644 board/Marvell/db-xc3-24g4xg/README
 create mode 100644 board/Marvell/db-xc3-24g4xg/binary.0
 create mode 100644 board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c
 create mode 100644 board/Marvell/db-xc3-24g4xg/kwbimage.cfg
 create mode 100644 configs/db-xc3-24g4xg_defconfig
 create mode 100644 include/configs/db-xc3-24g4xg.h
arch/arm/dts/Makefile +2 -1
index ca5062348087..133f09d8ba63 100644
@@ -113,7 +113,8 @@ dtb-$(CONFIG_ARCH_MVEBU) +=			\
 	armada-xp-theadorable.dtb		\
 	armada-38x-controlcenterdc.dtb		\
 	armada-385-atl-x530.dtb			\
-	armada-385-atl-x530DP.dtb
+	armada-385-atl-x530DP.dtb		\
+	armada-xp-db-xc3-24g4xg.dtb
 
 dtb-$(CONFIG_ARCH_UNIPHIER_LD11) += \
 	uniphier-ld11-global.dtb \
arch/arm/dts/armada-xp-98dx3236.dtsi new file +343 -0

343 lines not on this page · raw message

arch/arm/dts/armada-xp-98dx3336.dtsi new file +39 -0
new file mode 100644
index 000000000000..1d9d8a8ea60c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree Include file for Marvell 98dx3336 family SoC
+ *
+ * Copyright (C) 2016 Allied Telesis Labs
+ *
+ * Contains definitions specific to the 98dx3236 SoC that are not
+ * common to all Armada XP SoCs.
+ */
+
+#include "armada-xp-98dx3236.dtsi"
+
+/ {
+	model = "Marvell 98DX3336 SoC";
+	compatible = "marvell,armadaxp-98dx3336", "marvell,armadaxp-98dx3236", "marvell,armada-370-xp";
+
+	cpus {
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "marvell,sheeva-v7";
+			reg = <1>;
+			clocks = <&cpuclk 1>;
+			clock-latency = <1000000>;
+		};
+	};
+
+	soc {
+		internal-regs {
+			resume at 20980 {
+				compatible = "marvell,98dx3336-resume-ctrl";
+				reg = <0x20980 0x10>;
+			};
+		};
+	};
+};
+
+&pp0 {
+	compatible = "marvell,prestera-98dx3336", "marvell,prestera";
+};
arch/arm/dts/armada-xp-98dx4251.dtsi new file +54 -0

54 lines not on this page · raw message

arch/arm/dts/armada-xp-db-xc3-24g4xg-u-boot.dtsi new file +24 -0
new file mode 100644
index 000000000000..90cad85506d0
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&nand_controller {
+	compatible="marvell,mvebu-pxa3xx-nand";
+	status = "okay";
+	label = "pxa3xx_nand-0";
+	nand-rb = <0>;
+	marvell,nand-keep-config;
+	nand-on-flash-bbt;
+	nand-ecc-strength = <4>;
+	nand-ecc-step-size = <512>;
+};
+
+&spi0 {
+	u-boot,dm-pre-reloc;
+
+	spi-flash at 0 {
+		u-boot,dm-pre-reloc;
+	};
+};
arch/arm/dts/armada-xp-db-xc3-24g4xg.dts new file +110 -0

110 lines not on this page · raw message

arch/arm/mach-mvebu/Kconfig +8 -0
index 08c9972f02d7..cfb464def8a7 100644
@@ -152,6 +152,10 @@ config TARGET_X530
 	bool "Support Allied Telesis x530"
 	select 88F6820
 
+config TARGET_DB_XC3_24G4XG
+	bool "Support DB-XC3-24G4XG"
+	select 98DX3336
+
 endchoice
 
 config SYS_BOARD
@@ -170,6 +174,7 @@ config SYS_BOARD
 	default "theadorable" if TARGET_THEADORABLE
 	default "a38x" if TARGET_CONTROLCENTERDC
 	default "x530" if TARGET_X530
+	default "db-xc3-24g4xg" if TARGET_DB_XC3_24G4XG
 
 config SYS_CONFIG_NAME
 	default "clearfog" if TARGET_CLEARFOG
@@ -187,6 +192,7 @@ config SYS_CONFIG_NAME
 	default "turris_mox" if TARGET_TURRIS_MOX
 	default "controlcenterdc" if TARGET_CONTROLCENTERDC
 	default "x530" if TARGET_X530
+	default "db-xc3-24g4xg" if TARGET_DB_XC3_24G4XG
 
 config SYS_VENDOR
 	default "Marvell" if TARGET_DB_MV784MP_GP
@@ -195,6 +201,8 @@ config SYS_VENDOR
 	default "Marvell" if TARGET_DB_88F6820_GP
 	default "Marvell" if TARGET_DB_88F6820_AMC
 	default "Marvell" if TARGET_MVEBU_ARMADA_8K
+	default "Marvell" if TARGET_DB_XC3_24G4XG
+	default "Marvell" if TARGET_MVEBU_DB_88F7040
 	default "solidrun" if TARGET_CLEARFOG
 	default "kobol" if TARGET_HELIOS4
 	default "Synology" if TARGET_DS414
board/Marvell/db-xc3-24g4xg/MAINTAINERS new file +7 -0
new file mode 100644
index 000000000000..94d4a901783b
@@ -0,0 +1,7 @@
+DB-XC3-24G4XG BOARD
+M:	Chris Packham <[email protected]>
+S:	Maintained
+F:	board/Marvell/db-xc3-24g4xg/
+F:	include/configs/db-xc3-24g4xg.h
+F:	configs/db-xc3-24g4xg-amc_defconfig
+F:	arch/arm/dts/armada-xp-db-xc3-24g4xg.dts
board/Marvell/db-xc3-24g4xg/Makefile new file +5 -0
new file mode 100644
index 000000000000..199837a84fe6
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2015 Stefan Roese <[email protected]>
+
+obj-y	:= db-xc3-24g4xg.o
board/Marvell/db-xc3-24g4xg/README new file +4 -0
new file mode 100644
index 000000000000..5e479b433e4d
@@ -0,0 +1,4 @@
+To generate binary.0 from Marvell's bin_hdr.elf use the following command
+
+    arm-softfloat-linux-gnueabi-objcopy -S -O binary bin_hdr.elf \
+       board/Marvell/db-xc3-24g4xg/binary.0
board/Marvell/db-xc3-24g4xg/binary.0 new file +11 -0
new file mode 100644
index 000000000000..8dd687286a00
@@ -0,0 +1,11 @@
+--------
+WARNING:
+--------
+This file should contain the bin_hdr generated by the original Marvell
+U-Boot implementation. As this is currently not included in this
+U-Boot version, we have added this placeholder, so that the U-Boot
+image can be generated without errors.
+
+If you have a known to be working bin_hdr for your board, then you
+just need to replace this text file here with the binary header
+and recompile U-Boot.
board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c new file +68 -0

68 lines not on this page · raw message

board/Marvell/db-xc3-24g4xg/kwbimage.cfg new file +12 -0
new file mode 100644
index 000000000000..b8bb7a6eb75b
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2014 Stefan Roese <[email protected]>
+#
+
+# Armada XP uses version 1 image format
+VERSION		1
+
+# Boot Media configurations
+BOOT_FROM	spi
+
+# Binary Header (bin_hdr) with DDR3 training code
+BINARY board/Marvell/db-xc3-24g4xg/binary.0 0000005b 00000068
configs/db-xc3-24g4xg_defconfig new file +55 -0

55 lines not on this page · raw message

include/configs/db-xc3-24g4xg.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.20.1
#9 lore raw

PATCH v2 4/5 tools: kwbimage: don't adjust for image_header for Armada MSYS

In reply to Chris Packham

Hi Chris,

Quoted 4 lines · Chris Packham

For the time being the Armada MSYS SoCs need to use the bin_hdr from the Marvell U-Boot. Because of this the binary.0 does not contain the image header that a proper u-boot SPL would so the adjustment introduced by commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.

Thanks for the explanation. I'm wondering if it would be better (if possible) to auto detect this situation of using a bin_hdr from Marvell vs U-Boot SPL instead in this tool. This would help especially if we have full DDR init support in mainline U-Boot for this SoC at some time, as we then need to differentiate between those two options for this SoC.

Would this be possible?

Thanks,
Stefan

Quoted 33 lines

---

Changes in v2:
- new, split out from Add DB-XC3-24G4XG board with a better explanation

  tools/Makefile   | 4 ++++
  tools/kwbimage.c | 4 ++++
  2 files changed, 8 insertions(+)
tools/Makefile +4 -0
index 081383d7a790..d99098d6167a 100644
@@ -148,6 +148,10 @@ ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
  HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
  endif
 
+ifneq ($(CONFIG_ARMADA_MSYS),)
+HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_DESTADDR_COMPAT
+endif
+
  # MXSImage needs LibSSL
  ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
  HOSTLOADLIBES_mkimage += \
tools/kwbimage.c +0 -0
index a88a3830c0c8..4c60679fbb53 100644
@@ -1252,8 +1252,12 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
  		cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
  	main_hdr->headersz_lsb = cpu_to_le16(headersz & 0xFFFF);

tools/kwbimage.c static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, · line 1263

Quoted 10 lines
tools/kwbimage.c +4 -0
  	main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16;
+#ifdef CONFIG_KWB_DESTADDR_COMPAT
+	main_hdr->destaddr     = cpu_to_le32(params->addr);
+#else
  	main_hdr->destaddr     = cpu_to_le32(params->addr)
  				 - sizeof(image_header_t);
+#endif
  	main_hdr->execaddr     = cpu_to_le32(params->ep);
  	main_hdr->srcaddr      = cpu_to_le32(headersz);
  	main_hdr->ext          = hasext;

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#10 lore raw

PATCH v2 4/5 tools: kwbimage: don't adjust for image_header for Armada MSYS

Quoted 9 lines · Stefan Roese

Hi Chris,

Quoted 4 lines · Chris Packham

For the time being the Armada MSYS SoCs need to use the bin_hdr from the Marvell U-Boot. Because of this the binary.0 does not contain the image header that a proper u-boot SPL would so the adjustment introduced by commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.

Quoted 8 lines

Thanks for the explanation. I'm wondering if it would be better (if possible) to auto detect this situation of using a bin_hdr from Marvell vs U-Boot SPL instead in this tool. This would help especially if we have full DDR init support in mainline U-Boot for this SoC at some time, as we then need to differentiate between those two options for this SoC.

Would this be possible?

One way would be to check the filename, binary.0 means don't adjust it whereas u-boot-spl.img does. I also considered modifying the process to create binary.0 to prepend sizeof(image_header_t) bytes to allow it to work but I went with the quickest option for me to implement.

If it's an acceptable solution the filename thing would be quite easy to implement. Adding a flag or parameter in the kwbimage.cfg would also be relatively easy.

Quoted 55 lines

Thanks,
Stefan

Quoted 33 lines

---

Changes in v2:
- new, split out from Add DB-XC3-24G4XG board with a better explanation

  tools/Makefile   | 4 ++++
  tools/kwbimage.c | 4 ++++
  2 files changed, 8 insertions(+)
tools/Makefile +4 -0
index 081383d7a790..d99098d6167a 100644
@@ -148,6 +148,10 @@ ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
  HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
  endif
 
+ifneq ($(CONFIG_ARMADA_MSYS),)
+HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_DESTADDR_COMPAT
+endif
+
  # MXSImage needs LibSSL
  ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
  HOSTLOADLIBES_mkimage += \
tools/kwbimage.c +0 -0
index a88a3830c0c8..4c60679fbb53 100644
@@ -1252,8 +1252,12 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
              cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
      main_hdr->headersz_lsb = cpu_to_le16(headersz & 0xFFFF);

tools/kwbimage.c static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, · line 1263

Quoted 10 lines
tools/kwbimage.c +4 -0
      main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16;
+#ifdef CONFIG_KWB_DESTADDR_COMPAT
+     main_hdr->destaddr     = cpu_to_le32(params->addr);
+#else
      main_hdr->destaddr     = cpu_to_le32(params->addr)
                               - sizeof(image_header_t);
+#endif
      main_hdr->execaddr     = cpu_to_le32(params->ep);
      main_hdr->srcaddr      = cpu_to_le32(headersz);
      main_hdr->ext          = hasext;

Viele Grüße,
Stefan

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

#11 lore raw

PATCH v2 4/5 tools: kwbimage: don't adjust for image_header for Armada MSYS

Hi Chris,

Quoted 19 lines · Chris Packham
Quoted 9 lines · Stefan Roese

Hi Chris,

Quoted 4 lines · Chris Packham

For the time being the Armada MSYS SoCs need to use the bin_hdr from the Marvell U-Boot. Because of this the binary.0 does not contain the image header that a proper u-boot SPL would so the adjustment introduced by commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.

Quoted 8 lines

Thanks for the explanation. I'm wondering if it would be better (if possible) to auto detect this situation of using a bin_hdr from Marvell vs U-Boot SPL instead in this tool. This would help especially if we have full DDR init support in mainline U-Boot for this SoC at some time, as we then need to differentiate between those two options for this SoC.

Would this be possible?

Quoted 8 lines

One way would be to check the filename, binary.0 means don't adjust it whereas u-boot-spl.img does. I also considered modifying the process to create binary.0 to prepend sizeof(image_header_t) bytes to allow it to work but I went with the quickest option for me to implement.

If it's an acceptable solution the filename thing would be quite easy to implement. Adding a flag or parameter in the kwbimage.cfg would also be relatively easy.

I'm okay with using the filename to decide here. Please go ahead with this change and perhaps add a warning / error, if none of the standard names is provided (u-boot-spl.* vs binary.0).

Thanks,
Stefan

#5 lore raw

PATCH v2 2/5 arm: mvebu: Add Marvell's integrated CPUs

In reply to Chris Packham
Quoted 7 lines · Chris Packham

Marvell's switch chips with integrated CPUs (collectively referred to as MSYS) share common ancestry with the Armada SoCs. Some of the IP blocks (e.g. xor) are located at different addresses and DFX server exists as a separate target on the MBUS (on Armada-38x it's just part of the core complex registers).

Thanks,
Stefan

#13 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

In reply to Chris Packham
Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

Thanks,
Stefan

#14 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

In reply to Chris Packham

Hi Chris,

Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

Compiling this with buildman (Travis) leads to this error:

        arm:  +   db-xc3-24g4xg

+Didn't find the file 'board/Marvell/db-xc3-24g4xg/binary.0' in '/home/stefan/git/u-boot/.bm-work/00/build' which is mandatory to generate the image +This file generally contains the DDR3 training code, and should be extracted from an existing bootable
+image for your board. See 'kwbimage -x' to extract it from an existing image.
+Could not create image
+make[1]: *** [u-boot.kwb] Error 1
+make[1]: *** Deleting file 'u-boot.kwb'

The external build output directory seems to be the problem here. Could you please look into this?

Thanks,
Stefan

#15 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

Quoted 26 lines · Stefan Roese

Hi Chris,

Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

Compiling this with buildman (Travis) leads to this error:

        arm:  +   db-xc3-24g4xg
(quoted diff) +6 -0
+Didn't find the file 'board/Marvell/db-xc3-24g4xg/binary.0' in '/home/stefan/git/u-boot/.bm-work/00/build' which is mandatory to generate the image
+This file generally contains the DDR3 training code, and should be extracted from an existing bootable
+image for your board. See 'kwbimage -x' to extract it from an existing image.
+Could not create image
+make[1]: *** [u-boot.kwb] Error 1
+make[1]: *** Deleting file 'u-boot.kwb'
Quoted 2 lines

The external build output directory seems to be the problem here. Could you please look into this?

Yep I'll take a look.

#16 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

Quoted 28 lines · Chris Packham
Quoted 26 lines · Stefan Roese

Hi Chris,

Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

Compiling this with buildman (Travis) leads to this error:

        arm:  +   db-xc3-24g4xg
(quoted diff) +6 -0
+Didn't find the file 'board/Marvell/db-xc3-24g4xg/binary.0' in '/home/stefan/git/u-boot/.bm-work/00/build' which is mandatory to generate the image
+This file generally contains the DDR3 training code, and should be extracted from an existing bootable
+image for your board. See 'kwbimage -x' to extract it from an existing image.
+Could not create image
+make[1]: *** [u-boot.kwb] Error 1
+make[1]: *** Deleting file 'u-boot.kwb'
Quoted 4 lines
Quoted 2 lines

The external build output directory seems to be the problem here. Could you please look into this?

Yep I'll take a look.

There are a two options

1. Add a rule to copy the binary blob to the output directory $(obj)/binary.0: $(src}/binary.0

          cp $^ $@

2. Set CONFIG_BUILD_TARGET to u-boot.bin

Option 1 suits me because I have the required binary blob from Marvell's tree. Option 2 would work for the compile tests and for anyone chain loading the upstream u-boot.

Any preferences?

#17 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

Quoted 34 lines · Chris Packham
Quoted 28 lines · Chris Packham
Quoted 26 lines · Stefan Roese

Hi Chris,

Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

Compiling this with buildman (Travis) leads to this error:

         arm:  +   db-xc3-24g4xg
(quoted diff) +6 -0
+Didn't find the file 'board/Marvell/db-xc3-24g4xg/binary.0' in '/home/stefan/git/u-boot/.bm-work/00/build' which is mandatory to generate the image
+This file generally contains the DDR3 training code, and should be extracted from an existing bootable
+image for your board. See 'kwbimage -x' to extract it from an existing image.
+Could not create image
+make[1]: *** [u-boot.kwb] Error 1
+make[1]: *** Deleting file 'u-boot.kwb'
Quoted 4 lines
Quoted 2 lines

The external build output directory seems to be the problem here. Could you please look into this?

Yep I'll take a look.

Quoted 5 lines

There are a two options

1. Add a rule to copy the binary blob to the output directory $(obj)/binary.0: $(src}/binary.0

           cp $^ $@

This would be in the board directory, right?

Quoted 7 lines

2. Set CONFIG_BUILD_TARGET to u-boot.bin

Option 1 suits me because I have the required binary blob from Marvell's tree. Option 2 would work for the compile tests and for anyone chain loading the upstream u-boot.

Any preferences?

If 1 suits you better, then I don't object. Please continue this way.

Thanks,
Stefan

#18 lore raw

PATCH v2 5/5 arm: mvebu: Add DB-XC3-24G4XG board

Quoted 46 lines · Stefan Roese
Quoted 34 lines · Chris Packham
Quoted 28 lines · Chris Packham
Quoted 26 lines · Stefan Roese

Hi Chris,

Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

The DB-XC3-24G4XG is a switch development board from Marvell. It can either use and external CPU card such as the db-88f6820-amc or the internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB, SPI and NAND peripherals. For now this needs the bin_hdr from the Marvell U-Boot for this board.

Compiling this with buildman (Travis) leads to this error:

         arm:  +   db-xc3-24g4xg
(quoted diff) +6 -0
+Didn't find the file 'board/Marvell/db-xc3-24g4xg/binary.0' in '/home/stefan/git/u-boot/.bm-work/00/build' which is mandatory to generate the image
+This file generally contains the DDR3 training code, and should be extracted from an existing bootable
+image for your board. See 'kwbimage -x' to extract it from an existing image.
+Could not create image
+make[1]: *** [u-boot.kwb] Error 1
+make[1]: *** Deleting file 'u-boot.kwb'
Quoted 4 lines
Quoted 2 lines

The external build output directory seems to be the problem here. Could you please look into this?

Yep I'll take a look.

Quoted 5 lines

There are a two options

1. Add a rule to copy the binary blob to the output directory $(obj)/binary.0: $(src}/binary.0

           cp $^ $@

This would be in the board directory, right?

Quoted 2 lines

2. Set CONFIG_BUILD_TARGET to u-boot.bin

Quoted 8 lines
Quoted 5 lines

Option 1 suits me because I have the required binary blob from Marvell's tree. Option 2 would work for the compile tests and for anyone chain loading the upstream u-boot.

Any preferences?

If 1 suits you better, then I don't object. Please continue this way.

I couldn't get the original option 1 to work due to the circular dependency. But option #3 is to generate the kwbimage.cfg adjusting the path as needed. I'll send a v3 shortly.

#3 lore raw

PATCH v2 1/5 arm: sync armada-xp dts files from Linux 5.0

In reply to Chris Packham
Quoted 7 lines · Chris Packham

Bring in the Armada 370/XP dts/dtsi files from Linux. As U-Boot hasn't got the new NAND driver the updating binding has not been included.

---

Changes in v2: None

Applied to u-boot-marvell/master.

Thanks,
Stefan