Skip to contentSkip to conversation

gdsys: phy: Adapt fixup_88e1518() to latest Release Notes

PATCH New Mario Six 1 participant 17 messages Mar 29, 2019 – May 20, 2019 PowerPC

lore
Share & tools
lore

Mario Six

author
#0 lore raw

PATCH 1/16 gdsys: phy: Adapt fixup_88e1518() to latest Release Notes

From: Dirk Eibach <[email protected]>

The initialization sequence in the newest release notes of the 88e1518 phy omits two commands.

Remove them from the sequence.

---
 board/gdsys/common/phy.c | 2 --
 1 file changed, 2 deletions(-)
board/gdsys/common/phy.c +0 -2
index c4b2256da3a..d40c08d9e94 100644
@@ -45,8 +45,6 @@ struct mii_setupcmd fixup_88e1518[] = {
 	{ MIICMD_SET, 16, 0x214d },
 	{ MIICMD_SET, 17, 0xcc0c },
 	{ MIICMD_SET, 16, 0x2159 },
-	{ MIICMD_SET, 22, 0x00fb },
-	{ MIICMD_SET,  7, 0xc00d },
 	{ MIICMD_SET, 22, 0x0000 },
 };
 
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 2/16 gdsys: Post ppc4xx removal cleanup

The ppc4xx architecture was removed, and with it several old gdsys 44x boards, but some "debris" from these purged boards was left over.

This patch removes these remnants (mostly entries in Makefiles, some now superfluous data structures and some now obsolete config variables from the whitelist).

---
 board/gdsys/common/Makefile   |   4 --
 board/gdsys/common/miiphybb.c | 127 ----------------------------------
 include/gdsys_fpga.h          |  96 -------------------------
 3 files changed, 227 deletions(-)
 delete mode 100644 board/gdsys/common/miiphybb.c
board/gdsys/common/Makefile +0 -4
index 9090933e345..ff8d6f49665 100644
@@ -5,10 +5,6 @@
 
 obj-$(CONFIG_SYS_FPGA_COMMON) += fpga.o
 obj-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o
-obj-$(CONFIG_IO) += miiphybb.o
-obj-$(CONFIG_IO64) += miiphybb.o
-obj-$(CONFIG_IOCON) += osd.o mclink.o dp501.o phy.o ch7301.o
-obj-$(CONFIG_DLVISION_10G) += osd.o dp501.o
 obj-$(CONFIG_CONTROLCENTERD) += dp501.o
 obj-$(CONFIG_TARGET_HRCON) += osd.o mclink.o dp501.o phy.o ioep-fpga.o fanctrl.o
 obj-$(CONFIG_TARGET_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o ch7301.o
board/gdsys/common/miiphybb.c deleted +0 -127

127 lines not on this page · raw message

include/gdsys_fpga.h +0 -96

106 lines not on this page · raw message

Signature · 1 line
2.20.1
author
#2 lore raw

PATCH 3/16 gdsys: mpc8308: Fix style violations

In reply to Mario Six

Fix some style violations in the gdsys MPC8308 board files, and make the code more readable.

---
 board/gdsys/mpc8308/hrcon.c   | 55 ++++++++++++++++++-----------------
 board/gdsys/mpc8308/mpc8308.c | 12 ++++----
 board/gdsys/mpc8308/strider.c | 49 ++++++++++++++++---------------
 3 files changed, 59 insertions(+), 57 deletions(-)
board/gdsys/mpc8308/hrcon.c +28 -27
index 2d709dee945..79e3b25de8c 100644
@@ -35,11 +35,11 @@
 #define MAX_MUX_CHANNELS 2
 
 enum {
-	MCFPGA_DONE = 1 << 0,
-	MCFPGA_INIT_N = 1 << 1,
-	MCFPGA_PROGRAM_N = 1 << 2,
-	MCFPGA_UPDATE_ENABLE_N = 1 << 3,
-	MCFPGA_RESET_N = 1 << 4,
+	MCFPGA_DONE = BIT(0),
+	MCFPGA_INIT_N = BIT(1),
+	MCFPGA_PROGRAM_N = BIT(2),
+	MCFPGA_UPDATE_ENABLE_N = BIT(3),
+	MCFPGA_RESET_N = BIT(4),
 };
 
 enum {
@@ -47,7 +47,7 @@ enum {
 	GPIO_MDIO = 1 << 15,
 };
 
-unsigned int mclink_fpgacount;
+uint mclink_fpgacount;
 struct ihs_fpga *fpga_ptr[] = CONFIG_SYS_FPGA_PTR;
 
 struct {
@@ -107,7 +107,7 @@ int checkboard(void)
 
 	printf("HRCon %s", hw_type_cat ? "CAT" : "Fiber");
 
-	if (s != NULL) {
+	if (s) {
 		puts(", serial# ");
 		puts(s);
 	}
@@ -120,12 +120,11 @@ int checkboard(void)
 int last_stage_init(void)
 {
 	int slaves;
-	unsigned int k;
-	unsigned int mux_ch;
-	unsigned char mclink_controllers[] = { 0x3c, 0x3d, 0x3e };
+	uint k;
+	uchar mclink_controllers[] = { 0x3c, 0x3d, 0x3e };
 	u16 fpga_features;
 	bool hw_type_cat = pca9698_get_value(0x20, 20);
-	bool ch0_rgmii2_present = false;
+	bool ch0_rgmii2_present;
 
 	FPGA_GET_REG(0, fpga_features, &fpga_features);
 
@@ -137,16 +136,16 @@ int last_stage_init(void)
 
 	/* wait for FPGA done, then reset FPGA */
 	for (k = 0; k < ARRAY_SIZE(mclink_controllers); ++k) {
-		unsigned int ctr = 0;
+		uint ctr = 0;
 
 		if (i2c_probe(mclink_controllers[k]))
 			continue;
 
 		while (!(pca953x_get_val(mclink_controllers[k])
 		       & MCFPGA_DONE)) {
-			udelay(100000);
+			mdelay(100);
 			if (ctr++ > 5) {
-				printf("no done for mclink_controller %d\n", k);
+				printf("no done for mclink_controller %u\n", k);
 				break;
 			}
 		}
@@ -159,8 +158,10 @@ int last_stage_init(void)
 	}
 
 	if (hw_type_cat) {
+		uint mux_ch;
 		int retval;
 		struct mii_dev *mdiodev = mdio_alloc();
+
 		if (!mdiodev)
 			return -ENOMEM;
 		strncpy(mdiodev->name, bb_miiphy_buses[0].name, MDIO_NAME_LEN);
@@ -179,7 +180,7 @@ int last_stage_init(void)
 	}
 
 	/* give slave-PLLs and Parade DP501 some time to be up and running */
-	udelay(500000);
+	mdelay(500);
 
 	mclink_fpgacount = CONFIG_SYS_MCLINK_MAX;
 	slaves = mclink_probe();
@@ -207,6 +208,7 @@ int last_stage_init(void)
 		if (hw_type_cat) {
 			int retval;
 			struct mii_dev *mdiodev = mdio_alloc();
+
 			if (!mdiodev)
 				return -ENOMEM;
 			strncpy(mdiodev->name, bb_miiphy_buses[k].name,
@@ -233,17 +235,17 @@ int last_stage_init(void)
  * provide access to fpga gpios and controls (for I2C bitbang)
  * (these may look all too simple but make iocon.h much more readable)
  */
-void fpga_gpio_set(unsigned int bus, int pin)
+void fpga_gpio_set(uint bus, int pin)
 {
 	FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, gpio.set, pin);
 }
 
-void fpga_gpio_clear(unsigned int bus, int pin)
+void fpga_gpio_clear(uint bus, int pin)
 {
 	FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, gpio.clear, pin);
 }
 
-int fpga_gpio_get(unsigned int bus, int pin)
+int fpga_gpio_get(uint bus, int pin)
 {
 	u16 val;
 
@@ -252,7 +254,7 @@ int fpga_gpio_get(unsigned int bus, int pin)
 	return val & pin;
 }
 
-void fpga_control_set(unsigned int bus, int pin)
+void fpga_control_set(uint bus, int pin)
 {
 	u16 val;
 
@@ -260,7 +262,7 @@ void fpga_control_set(unsigned int bus, int pin)
 	FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, control, val | pin);
 }
 
-void fpga_control_clear(unsigned int bus, int pin)
+void fpga_control_clear(uint bus, int pin)
 {
 	u16 val;
 
@@ -273,7 +275,7 @@ void mpc8308_init(void)
 	pca9698_direction_output(0x20, 4, 1);
 }
 
-void mpc8308_set_fpga_reset(unsigned state)
+void mpc8308_set_fpga_reset(uint state)
 {
 	pca9698_set_value(0x20, 4, state ? 0 : 1);
 }
@@ -285,11 +287,11 @@ void mpc8308_setup_hw(void)
 	/*
 	 * set "startup-finished"-gpios
 	 */
-	setbits_be32(&immr->gpio[0].dir, (1 << (31-11)) | (1 << (31-12)));
-	setbits_be32(&immr->gpio[0].dat, 1 << (31-12));
+	setbits_be32(&immr->gpio[0].dir, (BIT(31 - 11) | BIT(31 - 12)));
+	setbits_be32(&immr->gpio[0].dat, BIT(31 - 12));
 }
 
-int mpc8308_get_fpga_done(unsigned fpga)
+int mpc8308_get_fpga_done(uint fpga)
 {
 	return pca9698_get_value(0x20, 19);
 }
@@ -367,7 +369,7 @@ int ft_board_setup(void *blob, bd_t *bd)
  */
 
 struct fpga_mii {
-	unsigned fpga;
+	uint fpga;
 	int mdio;
 } fpga_mii[] = {
 	{ 0, 1},
@@ -494,5 +496,4 @@ struct bb_miiphy_bus bb_miiphy_buses[] = {
 	},
 };
 
-int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
-			  sizeof(bb_miiphy_buses[0]);
+int bb_miiphy_buses_num = ARRAY_SIZE(bb_miiphy_buses);
board/gdsys/mpc8308/mpc8308.c +6 -6
index 0112244fc79..9fe1d66c605 100644
@@ -24,14 +24,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int get_fpga_state(unsigned dev)
+int get_fpga_state(uint dev)
 {
 	return gd->arch.fpga_state[dev];
 }
 
 int board_early_init_f(void)
 {
-	unsigned k;
+	uint k;
 
 	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
 		gd->arch.fpga_state[k] = 0;
@@ -41,8 +41,8 @@ int board_early_init_f(void)
 
 int board_early_init_r(void)
 {
-	unsigned k;
-	unsigned ctr;
+	uint k;
+	uint ctr;
 
 	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
 		gd->arch.fpga_state[k] = 0;
@@ -59,7 +59,7 @@ int board_early_init_r(void)
 	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) {
 		ctr = 0;
 		while (!mpc8308_get_fpga_done(k)) {
-			udelay(100000);
+			mdelay(100);
 			if (ctr++ > 5) {
 				gd->arch.fpga_state[k] |=
 					FPGA_STATE_DONE_FAILED;
@@ -86,7 +86,7 @@ int board_early_init_r(void)
 			if (val == REFLECTION_TESTPATTERN_INV)
 				break;
 
-			udelay(100000);
+			mdelay(100);
 			if (ctr++ > 5) {
 				gd->arch.fpga_state[k] |=
 					FPGA_STATE_REFLECTION_FAILED;
board/gdsys/mpc8308/strider.c +25 -24

158 lines not on this page · raw message

Signature · 1 line
2.20.1
author
#3 lore raw

PATCH 4/16 gdsys: mpc8308: Use shadow register for output GPIO values

In reply to Mario Six

Since the gpio output status on MPC8xxx cannot be read back, it has to be buffered locally.

---
 board/gdsys/mpc8308/hrcon.c   |  4 ++--
 board/gdsys/mpc8308/mpc8308.c | 19 +++++++++++++++++++
 board/gdsys/mpc8308/mpc8308.h |  3 +++
 board/gdsys/mpc8308/strider.c |  2 +-
 4 files changed, 25 insertions(+), 3 deletions(-)
board/gdsys/mpc8308/hrcon.c +2 -2
index 79e3b25de8c..d14a28ec94d 100644
@@ -287,8 +287,8 @@ void mpc8308_setup_hw(void)
 	/*
 	 * set "startup-finished"-gpios
 	 */
-	setbits_be32(&immr->gpio[0].dir, (BIT(31 - 11) | BIT(31 - 12)));
-	setbits_be32(&immr->gpio[0].dat, BIT(31 - 12));
+	setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12));
+	setbits_gpio0_out(BIT(31 - 12));
 }
 
 int mpc8308_get_fpga_done(uint fpga)
board/gdsys/mpc8308/mpc8308.c +19 -0
index 9fe1d66c605..a53135b8fd0 100644
@@ -24,6 +24,25 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/* as gpio output status cannot be read back, we have to buffer it locally */
+u32 gpio0_out;
+
+void setbits_gpio0_out(u32 mask)
+{
+	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+
+	gpio0_out |= mask;
+	out_be32(&immr->gpio[0].dat, gpio0_out);
+}
+
+void clrbits_gpio0_out(u32 mask)
+{
+	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+
+	gpio0_out &= ~mask;
+	out_be32(&immr->gpio[0].dat, gpio0_out);
+}
+
 int get_fpga_state(uint dev)
 {
 	return gd->arch.fpga_state[dev];
board/gdsys/mpc8308/mpc8308.h +3 -0
index dc07d564eb5..1e4f24fb2ae 100644
@@ -1,6 +1,9 @@
 #ifndef __MPC8308_H_
 #define __MPC8308_H_
 
+void setbits_gpio0_out(u32 mask);
+void clrbits_gpio0_out(u32 mask);
+
 /* functions to be provided by board implementation */
 void mpc8308_init(void);
 void mpc8308_set_fpga_reset(unsigned state);
board/gdsys/mpc8308/strider.c +1 -1
index b1997f453ae..1fdea675bda 100644
@@ -343,7 +343,7 @@ void mpc8308_setup_hw(void)
 	 * set "startup-finished"-gpios
 	 */
 	setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12));
-	setbits_be32(&immr->gpio[0].dat, BIT(31 - 12));
+	setbits_gpio0_out(BIT(31 - 12));
 }
 
 int mpc8308_get_fpga_done(uint fpga)
Signature · 1 line
2.20.1
author
#4 lore raw

PATCH 5/16 gdsys: mpc8308: Migrate SYS_FPGA{0, 1}_{BASE, SIZE} to Kconfig

In reply to Mario Six

Move CONFIG_SYS_FPGA0_BASE, CONFIG_SYS_FPGA0_SIZE, CONFIG_SYS_FPGA1_BASE, and CONFIG_SYS_FPGA1_SIZE to Kconfig.

---
 board/gdsys/mpc8308/Kconfig | 22 ++++++++++++++++++++++
 include/configs/hrcon.h     |  8 --------
 include/configs/strider.h   |  8 --------
 3 files changed, 22 insertions(+), 16 deletions(-)
board/gdsys/mpc8308/Kconfig +22 -0
index 9d99f686923..cad458ac710 100644
@@ -4,6 +4,28 @@ config GDSYS_LEGACY_OSD_CMDS
 	  Use the 'osdw', 'osdp', and 'osdsize' legacy commands required by
 	  gdsys devices.
 
+config SYS_FPGA0_BASE
+	hex
+	default E0600000
+	help
+	  The base address of the first FPGA's register map.
+
+config SYS_FPGA0_SIZE
+	hex
+	default 1
+	help
+	  The base address of the first FPGA's register map.
+
+config SYS_FPGA1_BASE
+	hex
+	help
+	  The base address of the second FPGA's register map.
+
+config SYS_FPGA1_SIZE
+	hex
+	help
+	  The base address of the second FPGA's register map.
+
 if TARGET_HRCON
 
 config SYS_BOARD
include/configs/hrcon.h +0 -8
index 8029ae9dd75..6e6c1714ce9 100644
@@ -129,14 +129,6 @@
 #define CONFIG_SYS_FLASH_ERASE_TOUT	60000 /* Flash Erase Timeout (ms) */
 #define CONFIG_SYS_FLASH_WRITE_TOUT	500 /* Flash Write Timeout (ms) */
 
-/*
- * FPGA
- */
-#define CONFIG_SYS_FPGA0_BASE		0xE0600000
-#define CONFIG_SYS_FPGA0_SIZE		1 /* FPGA size is 1M */
-
-
-#define CONFIG_SYS_FPGA_BASE(k)		CONFIG_SYS_FPGA0_BASE
 #define CONFIG_SYS_FPGA_DONE(k)		0x0010
 
 #define CONFIG_SYS_FPGA_COUNT		1
include/configs/strider.h +0 -8
index 22d255aabb8..8b942e3446a 100644
@@ -127,14 +127,6 @@
 #define CONFIG_SYS_FLASH_ERASE_TOUT	60000 /* Flash Erase Timeout (ms) */
 #define CONFIG_SYS_FLASH_WRITE_TOUT	500 /* Flash Write Timeout (ms) */
 
-/*
- * FPGA
- */
-#define CONFIG_SYS_FPGA0_BASE		0xE0600000
-#define CONFIG_SYS_FPGA0_SIZE		1 /* FPGA size is 1M */
-
-
-#define CONFIG_SYS_FPGA_BASE(k)		CONFIG_SYS_FPGA0_BASE
 #define CONFIG_SYS_FPGA_DONE(k)		0x0010
 
 #define CONFIG_SYS_FPGA_COUNT		1
Signature · 1 line
2.20.1
author
#5 lore raw

PATCH 6/16 gdsys: mpc8308: Don't use manual RAM config if RAM driver is active

In reply to Mario Six

The "manual" RAM configuration should not be used if the DM RAM driver is active, hence, disable the code if the CONFIG_MPC83XX_SDRAM config variable is defined.

---
 board/gdsys/mpc8308/sdram.c | 4 ++++
 1 file changed, 4 insertions(+)
board/gdsys/mpc8308/sdram.c +4 -0
index 3eb0e37b7b5..2a77fed2702 100644
@@ -11,6 +11,8 @@
  * board\freescale\mpc8315erdb\sdram.c
  */
 
+#ifndef CONFIG_MPC83XX_SDRAM
+
 #include <common.h>
 #include <mpc83xx.h>
 #include <spd_sdram.h>
@@ -81,3 +83,5 @@ int dram_init(void)
 
 	return 0;
 }
+
+#endif /* !CONFIG_MPC83XX_SDRAM */
Signature · 1 line
2.20.1
author
#6 lore raw

PATCH 7/16 gdsys: Introduce GDSYS_LEGACY_DRIVERS

In reply to Mario Six

Future gdsys boards will switch from the legacy drivers in board/gdsys/common to DM-based drivers.

Define a Kconfig option that disables the legacy drivers.

---
 board/gdsys/common/adv7611.c   |  4 ++++
 board/gdsys/common/ch7301.c    |  4 ++++
 board/gdsys/common/dp501.c     |  4 ++++
 board/gdsys/common/fanctrl.c   |  4 ++++
 board/gdsys/common/fpga.c      |  4 ++++
 board/gdsys/common/ioep-fpga.c |  4 ++++
 board/gdsys/common/mclink.c    |  4 ++++
 board/gdsys/common/osd.c       |  4 ++++
 board/gdsys/mpc8308/Kconfig    | 14 ++++++++++++++
 board/gdsys/mpc8308/mpc8308.c  |  2 ++
 board/gdsys/p1022/Kconfig      | 10 ++++++++++
 include/gdsys_fpga.h           |  2 ++
 12 files changed, 60 insertions(+)
board/gdsys/common/adv7611.c +4 -0
index c416bf1dc42..06cdc05825b 100644
@@ -4,6 +4,8 @@
  * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
  */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <i2c.h>
 
@@ -174,3 +176,5 @@ out:
 
 	return res;
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/ch7301.c +4 -0
index 1234149f42c..5e42467651d 100644
@@ -6,6 +6,8 @@
 
 /* Chrontel CH7301C DVI Transmitter */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <asm/io.h>
 #include <errno.h>
@@ -61,3 +63,5 @@ int ch7301_probe(unsigned screen, bool power)
 
 	return 0;
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/dp501.c +4 -0
index 69d4b8c3334..9ca69ebcbbe 100644
@@ -6,6 +6,8 @@
 
 /* Parade Technologies Inc. DP501 DisplayPort DVI/HDMI Transmitter */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <asm/io.h>
 #include <errno.h>
@@ -155,3 +157,5 @@ int dp501_probe(unsigned screen, bool power)
 
 	return 0;
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/fanctrl.c +4 -0
index 5e776831dbb..27c875cbec0 100644
@@ -4,6 +4,8 @@
  * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
  */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <i2c.h>
 
@@ -29,3 +31,5 @@ void init_fan_controller(u8 addr)
 	val = i2c_reg_read(addr, FAN_CONFIG) | 0x04;
 	i2c_reg_write(addr, FAN_CONFIG, val);
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/fpga.c +4 -0
index f189e5fbd11..5ba6613ed56 100644
@@ -4,6 +4,8 @@
  * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
  */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <gdsys_fpga.h>
 
@@ -22,3 +24,5 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 	return 0;
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/ioep-fpga.c +4 -0
index 8e105012479..91eec3ac7c1 100644
@@ -4,6 +4,8 @@
  * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
  */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 
 #include <gdsys_fpga.h>
@@ -234,3 +236,5 @@ void ioep_fpga_print_info(unsigned int fpga)
 
 	printf(", %d video channel(s)\n", feature_video_channels);
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/mclink.c +4 -0
index bf89d4e2920..c43d24b26d4 100644
@@ -4,6 +4,8 @@
  * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
  */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <asm/io.h>
 #include <errno.h>
@@ -134,3 +136,5 @@ int mclink_receive(u8 slave, u16 addr, u16 *data)
 
 	return 0;
 }
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
board/gdsys/common/osd.c +4 -0
index 392d0059da8..10c43291469 100644
@@ -4,6 +4,8 @@
  * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
  */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
+
 #include <common.h>
 #include <i2c.h>
 #include <malloc.h>
@@ -497,3 +499,5 @@ U_BOOT_CMD(
 	"size_x(max. " __stringify(MAX_X_CHARS)
 	") size_y(max. " __stringify(MAX_Y_CHARS) ")\n"
 );
+
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
\ No newline at end of file
board/gdsys/mpc8308/Kconfig +14 -0
index cad458ac710..222ab0d20a3 100644
@@ -4,6 +4,13 @@ config GDSYS_LEGACY_OSD_CMDS
 	  Use the 'osdw', 'osdp', and 'osdsize' legacy commands required by
 	  gdsys devices.
 
+config GDSYS_LEGACY_DRIVERS
+	bool
+	help
+	  Enable the gdsys legacy drivers under board/gdsys/common. If this
+	  option is not set, all relevant DM drivers must be configured for the
+	  device in question.
+
 config SYS_FPGA0_BASE
 	hex
 	default E0600000
@@ -40,6 +47,9 @@ config SYS_CONFIG_NAME
 config GDSYS_LEGACY_OSD_CMDS
 	default y
 
+config GDSYS_LEGACY_DRIVERS
+	default y
+
 endif
 
 if TARGET_STRIDER
@@ -55,6 +65,10 @@ config SYS_CONFIG_NAME
 
 config GDSYS_LEGACY_OSD_CMDS
 	default y
+
+config GDSYS_LEGACY_DRIVERS
+	default y
+
 endif
 
 config CMD_IOLOOP
board/gdsys/mpc8308/mpc8308.c +2 -0
index a53135b8fd0..ae77fc2fd12 100644
@@ -24,6 +24,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 /* as gpio output status cannot be read back, we have to buffer it locally */
 u32 gpio0_out;
 
@@ -116,3 +117,4 @@ int board_early_init_r(void)
 
 	return 0;
 }
+#endif
board/gdsys/p1022/Kconfig +10 -0
index 8514d086b97..f5154271d15 100644
@@ -1,3 +1,10 @@
+config GDSYS_LEGACY_DRIVERS
+	bool
+	help
+	  Enable the gdsys legacy drivers under board/gdsys/common. If this
+	  option is not set, all relevant DM drivers must be configured for the
+	  device in question.
+
 if TARGET_CONTROLCENTERD
 
 config SYS_BOARD
@@ -9,4 +16,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "controlcenterd"
 
+config GDSYS_LEGACY_DRIVERS
+	default y
+
 endif
include/gdsys_fpga.h +2 -0
index eae67012622..6d38a83d903 100644
@@ -7,6 +7,7 @@
 #ifndef __GDSYS_FPGA_H
 #define __GDSYS_FPGA_H
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 int init_func_fpga(void);
 
 enum {
@@ -33,6 +34,7 @@ extern struct ihs_fpga *fpga_ptr[];
 		     &fpga_ptr[ix]->fld, \
 		     offsetof(struct ihs_fpga, fld), \
 		     val)
+#endif
 
 struct ihs_gpio {
 	u16 read;
Signature · 1 line
2.20.1
author
#7 lore raw

PATCH 8/16 gdsys: mpc8308: Add FPGA flavor option

In reply to Mario Six

More recent versions of IHS FPGAs feature a different memory layout.

Add a Kconfig option to differentiate between the legacy layout, and the new layout (which is used on the upcoming "Gazerbeam" and later boards).

---
 board/gdsys/mpc8308/Kconfig | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
board/gdsys/mpc8308/Kconfig +20 -0
index 222ab0d20a3..e6a47960547 100644
@@ -71,7 +71,27 @@ config GDSYS_LEGACY_DRIVERS
 
 endif
 
+if TARGET_HRCON || TARGET_STRIDER
+
+choice
+	prompt "FPGA flavor selection"
+
+config SYS_FPGA_FLAVOR_LEGACY
+	bool "Legacy flavor"
+	help
+	  This enables support for the gdsys pre-Gazerbeam FPGA memory layout.
+
+config SYS_FPGA_FLAVOR_GAZERBEAM
+	bool "Gazerbeam flavor"
+	help
+	  This enables support for the gdsys FPGA memory layout of the
+	  Gazerbeam board.
+
+endchoice
+
 config CMD_IOLOOP
 	bool "Enable 'ioloop' and 'ioreflect' commands"
 	help
 	  These commands provide FPGA tests.
+
+endif
Signature · 1 line
2.20.1
author
#8 lore raw

PATCH 9/16 gdsys: cmd_ioloop: Fix style violations

In reply to Mario Six

Fix some style violations in the ioloop command, and make the code more readable where possible.

---
 board/gdsys/common/cmd_ioloop.c | 78 ++++++++++++++++-----------------
 1 file changed, 38 insertions(+), 40 deletions(-)
board/gdsys/common/cmd_ioloop.c +38 -40
index 8e2f4071ef7..a53c80c0add 100644
@@ -11,33 +11,33 @@
 #include <gdsys_fpga.h>
 
 enum {
-	STATE_TX_PACKET_BUILDING = 1<<0,
-	STATE_TX_TRANSMITTING = 1<<1,
-	STATE_TX_BUFFER_FULL = 1<<2,
-	STATE_TX_ERR = 1<<3,
-	STATE_RECEIVE_TIMEOUT = 1<<4,
-	STATE_PROC_RX_STORE_TIMEOUT = 1<<5,
-	STATE_PROC_RX_RECEIVE_TIMEOUT = 1<<6,
-	STATE_RX_DIST_ERR = 1<<7,
-	STATE_RX_LENGTH_ERR = 1<<8,
-	STATE_RX_FRAME_CTR_ERR = 1<<9,
-	STATE_RX_FCS_ERR = 1<<10,
-	STATE_RX_PACKET_DROPPED = 1<<11,
-	STATE_RX_DATA_LAST = 1<<12,
-	STATE_RX_DATA_FIRST = 1<<13,
-	STATE_RX_DATA_AVAILABLE = 1<<15,
+	STATE_TX_PACKET_BUILDING = BIT(0),
+	STATE_TX_TRANSMITTING = BIT(1),
+	STATE_TX_BUFFER_FULL = BIT(2),
+	STATE_TX_ERR = BIT(3),
+	STATE_RECEIVE_TIMEOUT = BIT(4),
+	STATE_PROC_RX_STORE_TIMEOUT = BIT(5),
+	STATE_PROC_RX_RECEIVE_TIMEOUT = BIT(6),
+	STATE_RX_DIST_ERR = BIT(7),
+	STATE_RX_LENGTH_ERR = BIT(8),
+	STATE_RX_FRAME_CTR_ERR = BIT(9),
+	STATE_RX_FCS_ERR = BIT(10),
+	STATE_RX_PACKET_DROPPED = BIT(11),
+	STATE_RX_DATA_LAST = BIT(12),
+	STATE_RX_DATA_FIRST = BIT(13),
+	STATE_RX_DATA_AVAILABLE = BIT(15),
 };
 
 enum {
-	CTRL_PROC_RECEIVE_ENABLE = 1<<12,
-	CTRL_FLUSH_TRANSMIT_BUFFER = 1<<15,
+	CTRL_PROC_RECEIVE_ENABLE = BIT(12),
+	CTRL_FLUSH_TRANSMIT_BUFFER = BIT(15),
 };
 
 enum {
-	IRQ_CPU_TRANSMITBUFFER_FREE_STATUS = 1<<5,
-	IRQ_CPU_PACKET_TRANSMITTED_EVENT = 1<<6,
-	IRQ_NEW_CPU_PACKET_RECEIVED_EVENT = 1<<7,
-	IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS = 1<<8,
+	IRQ_CPU_TRANSMITBUFFER_FREE_STATUS = BIT(5),
+	IRQ_CPU_PACKET_TRANSMITTED_EVENT = BIT(6),
+	IRQ_NEW_CPU_PACKET_RECEIVED_EVENT = BIT(7),
+	IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS = BIT(8),
 };
 
 struct io_generic_packet {
@@ -52,7 +52,7 @@ unsigned long long rx_ctr;
 unsigned long long tx_ctr;
 unsigned long long err_ctr;
 
-static void io_check_status(unsigned int fpga, u16 status, bool silent)
+static void io_check_status(uint fpga, u16 status, bool silent)
 {
 	u16 mask = STATE_RX_DIST_ERR | STATE_RX_LENGTH_ERR |
 		   STATE_RX_FRAME_CTR_ERR | STATE_RX_FCS_ERR |
@@ -85,9 +85,9 @@ static void io_check_status(unsigned int fpga, u16 status, bool silent)
 		printf("TX_ERR\n");
 }
 
-static void io_send(unsigned int fpga, unsigned int size)
+static void io_send(uint fpga, uint size)
 {
-	unsigned int k;
+	uint k;
 	struct io_generic_packet packet = {
 		.source_address = 1,
 		.packet_type = 1,
@@ -107,9 +107,8 @@ static void io_send(unsigned int fpga, unsigned int size)
 	tx_ctr++;
 }
 
-static void io_receive(unsigned int fpga)
+static void io_receive(uint fpga)
 {
-	unsigned int k = 0;
 	u16 rx_tx_status;
 
 	FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
@@ -123,17 +122,15 @@ static void io_receive(unsigned int fpga)
 		FPGA_GET_REG(fpga, ep.receive_data, &rx);
 
 		FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
-
-		++k;
 	}
 }
 
-static void io_reflect(unsigned int fpga)
+static void io_reflect(uint fpga)
 {
 	u16 buffer[128];
 
-	unsigned int k = 0;
-	unsigned int n;
+	uint k = 0;
+	uint n;
 	u16 rx_tx_status;
 
 	FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
@@ -166,8 +163,8 @@ static void io_reflect(unsigned int fpga)
  */
 int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	unsigned int fpga;
-	unsigned int rate = 0;
+	uint fpga;
+	uint rate = 0;
 	unsigned long long last_seen = 0;
 
 	if (argc < 2)
@@ -181,10 +178,10 @@ int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc > 2)
 		rate = simple_strtoul(argv[2], NULL, 10);
 
-	/* enable receive path */
+	/* Enable receive path */
 	FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
 
-	/* set device address to dummy 1*/
+	/* Set device address to dummy 1*/
 	FPGA_SET_REG(fpga, ep.device_address, 1);
 
 	rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
@@ -215,18 +212,19 @@ int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
+#define DISP_LINE_LEN	16
+
 /*
  * FPGA io-endpoint looptest
  *
  * Syntax:
  *	ioloop {fpga} {size} {rate}
  */
-#define DISP_LINE_LEN	16
 int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	unsigned int fpga;
-	unsigned int size;
-	unsigned int rate = 0;
+	uint fpga;
+	uint size;
+	uint rate = 0;
 
 	if (argc < 3)
 		return CMD_RET_USAGE;
@@ -273,7 +271,7 @@ int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				break;
 			udelay(1000000 / rate);
 			if (!(tx_ctr % rate))
-				printf("d %lld, tx %llu, rx %llu, err %llu\n",
+				printf("d %llu, tx %llu, rx %llu, err %llu\n",
 				       tx_ctr - rx_ctr, tx_ctr, rx_ctr,
 				       err_ctr);
 		}
Signature · 1 line
2.20.1
author
#9 lore raw

PATCH 10/16 gdsys: cmd_ioloop: Introduce commenting enum

In reply to Mario Six

Replace the boolean parameter of io_check_status that controls whether the status is printed or not with a documenting enum.

---
 board/gdsys/common/cmd_ioloop.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
board/gdsys/common/cmd_ioloop.c +9 -4
index a53c80c0add..8f70c1eda22 100644
@@ -10,6 +10,11 @@
 
 #include <gdsys_fpga.h>
 
+enum status_print_type {
+	STATUS_LOUD = 0,
+	STATUS_SILENT = 1,
+};
+
 enum {
 	STATE_TX_PACKET_BUILDING = BIT(0),
 	STATE_TX_TRANSMITTING = BIT(1),
@@ -52,7 +57,7 @@ unsigned long long rx_ctr;
 unsigned long long tx_ctr;
 unsigned long long err_ctr;
 
-static void io_check_status(uint fpga, u16 status, bool silent)
+static void io_check_status(uint fpga, u16 status, enum status_print_type type)
 {
 	u16 mask = STATE_RX_DIST_ERR | STATE_RX_LENGTH_ERR |
 		   STATE_RX_FRAME_CTR_ERR | STATE_RX_FCS_ERR |
@@ -66,7 +71,7 @@ static void io_check_status(uint fpga, u16 status, bool silent)
 	err_ctr++;
 	FPGA_SET_REG(fpga, ep.rx_tx_status, status);
 
-	if (silent)
+	if (type == STATUS_SILENT)
 		return;
 
 	if (status & STATE_RX_PACKET_DROPPED)
@@ -193,7 +198,7 @@ int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		FPGA_GET_REG(fpga, top_interrupt, &top_int);
 		FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
 
-		io_check_status(fpga, rx_tx_status, true);
+		io_check_status(fpga, rx_tx_status, STATUS_SILENT);
 		if ((top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS) &&
 		    (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS))
 			io_reflect(fpga);
@@ -260,7 +265,7 @@ int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		FPGA_GET_REG(fpga, top_interrupt, &top_int);
 		FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
 
-		io_check_status(fpga, rx_tx_status, false);
+		io_check_status(fpga, rx_tx_status, STATUS_LOUD);
 		if (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS)
 			io_send(fpga, size);
 		if (top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS)
Signature · 1 line
2.20.1
author
#10 lore raw

PATCH 11/16 gdsys: cmd_ioloop: Make DM compatible

In reply to Mario Six

Make the ioloop command DM compatible, while keeping the old functionality for not-yet-converted boards.

---
 board/gdsys/common/cmd_ioloop.c | 293 +++++++++++++++++++++++++++++++-
 1 file changed, 288 insertions(+), 5 deletions(-)
board/gdsys/common/cmd_ioloop.c +288 -5
index 8f70c1eda22..05a14ff1038 100644
@@ -10,11 +10,25 @@
 
 #include <gdsys_fpga.h>
 
+#ifndef CONFIG_GDSYS_LEGACY_DRIVERS
+#include <dm.h>
+#include <misc.h>
+#include <regmap.h>
+#include <board.h>
+
+#include "../../../drivers/misc/gdsys_soc.h"
+#include "../../../drivers/misc/gdsys_ioep.h"
+#include "../../../drivers/misc/ihs_fpga.h"
+
+const int HEADER_WORDS = sizeof(struct io_generic_packet) / 2;
+#endif /* !CONFIG_GDSYS_LEGACY_DRIVERS */
+
 enum status_print_type {
 	STATUS_LOUD = 0,
 	STATUS_SILENT = 1,
 };
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 enum {
 	STATE_TX_PACKET_BUILDING = BIT(0),
 	STATE_TX_TRANSMITTING = BIT(1),
@@ -33,11 +47,6 @@ enum {
 	STATE_RX_DATA_AVAILABLE = BIT(15),
 };
 
-enum {
-	CTRL_PROC_RECEIVE_ENABLE = BIT(12),
-	CTRL_FLUSH_TRANSMIT_BUFFER = BIT(15),
-};
-
 enum {
 	IRQ_CPU_TRANSMITBUFFER_FREE_STATUS = BIT(5),
 	IRQ_CPU_PACKET_TRANSMITTED_EVENT = BIT(6),
@@ -45,6 +54,11 @@ enum {
 	IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS = BIT(8),
 };
 
+enum {
+	CTRL_PROC_RECEIVE_ENABLE = BIT(12),
+	CTRL_FLUSH_TRANSMIT_BUFFER = BIT(15),
+};
+
 struct io_generic_packet {
 	u16 target_address;
 	u16 source_address;
@@ -52,11 +66,16 @@ struct io_generic_packet {
 	u8 bc;
 	u16 packet_length;
 } __attribute__((__packed__));
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
 
 unsigned long long rx_ctr;
 unsigned long long tx_ctr;
 unsigned long long err_ctr;
+#ifndef CONFIG_GDSYS_LEGACY_DRIVERS
+struct udevice *dev;
+#endif /* !CONFIG_GDSYS_LEGACY_DRIVERS */
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 static void io_check_status(uint fpga, u16 status, enum status_print_type type)
 {
 	u16 mask = STATE_RX_DIST_ERR | STATE_RX_LENGTH_ERR |
@@ -89,7 +108,39 @@ static void io_check_status(uint fpga, u16 status, enum status_print_type type)
 	if (status & STATE_TX_ERR)
 		printf("TX_ERR\n");
 }
+#else
+static void io_check_status(struct udevice *dev, enum status_print_type type)
+{
+	u16 status = 0;
+	int ret;
 
+	ret = misc_call(dev, 0, NULL, 0, &status, 0);
+	if (!ret)
+		return;
+
+	err_ctr++;
+
+	if (type != STATUS_LOUD)
+		return;
+
+	if (status & STATE_RX_PACKET_DROPPED)
+		printf("RX_PACKET_DROPPED, status %04x\n", status);
+
+	if (status & STATE_RX_DIST_ERR)
+		printf("RX_DIST_ERR\n");
+	if (status & STATE_RX_LENGTH_ERR)
+		printf("RX_LENGTH_ERR\n");
+	if (status & STATE_RX_FRAME_CTR_ERR)
+		printf("RX_FRAME_CTR_ERR\n");
+	if (status & STATE_RX_FCS_ERR)
+		printf("RX_FCS_ERR\n");
+
+	if (status & STATE_TX_ERR)
+		printf("TX_ERR\n");
+}
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
+
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 static void io_send(uint fpga, uint size)
 {
 	uint k;
@@ -111,7 +162,29 @@ static void io_send(uint fpga, uint size)
 
 	tx_ctr++;
 }
+#else
+static void io_send(struct udevice *dev, uint size)
+{
+	uint k;
+	u16 buffer[HEADER_WORDS + 128];
+	struct io_generic_packet header = {
+		.source_address = 1,
+		.packet_type = 1,
+		.packet_length = size,
+	};
+	const uint words = (size + 1) / 2;
+
+	memcpy(buffer, &header, 2 * HEADER_WORDS);
+	for (k = 0; k < words; ++k)
+		buffer[k + HEADER_WORDS] = (2 * k + 1) + ((2 * k) << 8);
 
+	misc_write(dev, 0, buffer, HEADER_WORDS + words);
+
+	tx_ctr++;
+}
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
+
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 static void io_receive(uint fpga)
 {
 	u16 rx_tx_status;
@@ -129,7 +202,17 @@ static void io_receive(uint fpga)
 		FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
 	}
 }
+#else
+static void io_receive(struct udevice *dev)
+{
+	u16 buffer[HEADER_WORDS + 128];
 
+	if (!misc_read(dev, 0, buffer, 0))
+		rx_ctr++;
+}
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
+
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 static void io_reflect(uint fpga)
 {
 	u16 buffer[128];
@@ -159,7 +242,22 @@ static void io_reflect(uint fpga)
 
 	tx_ctr++;
 }
+#else
+static void io_reflect(struct udevice *dev)
+{
+	u16 buffer[HEADER_WORDS + 128];
+	struct io_generic_packet *header;
+
+	if (misc_read(dev, 0, buffer, 0))
+		return;
+
+	header = (struct io_generic_packet *)&buffer;
 
+	misc_write(dev, 0, buffer, HEADER_WORDS + header->packet_length);
+}
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
+
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 /*
  * FPGA io-endpoint reflector
  *
@@ -216,9 +314,60 @@ int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	return 0;
 }
+#else
+/*
+ * FPGA io-endpoint reflector
+ *
+ * Syntax:
+ *	ioreflect {reportrate}
+ */
+int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	struct udevice *fpga;
+	struct regmap *map;
+	uint rate = 0;
+	unsigned long long last_seen = 0;
+
+	if (!dev) {
+		printf("No device selected\n");
+		return 1;
+	}
+
+	gdsys_soc_get_fpga(dev, &fpga);
+	regmap_init_mem(dev_ofnode(dev), &map);
+
+	/* Enable receive path */
+	misc_set_enabled(dev, true);
+
+	rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
+
+	while (1) {
+		uint top_int;
+
+		ihs_fpga_get(map, top_interrupt, &top_int);
+		io_check_status(dev, STATUS_SILENT);
+		if ((top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS) &&
+		    (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS))
+			io_reflect(dev);
+
+		if (rate) {
+			if (!(tx_ctr % rate) && (tx_ctr != last_seen))
+				printf("refl %llu, err %llu\n", tx_ctr,
+				       err_ctr);
+			last_seen = tx_ctr;
+		}
+
+		if (ctrlc())
+			break;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
 
 #define DISP_LINE_LEN	16
 
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 /*
  * FPGA io-endpoint looptest
  *
@@ -284,7 +433,122 @@ int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	return 0;
 }
+#else
+/*
+ * FPGA io-endpoint looptest
+ *
+ * Syntax:
+ *	ioloop {size} {rate}
+ */
+int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	uint size;
+	uint rate = 0;
+	struct udevice *fpga;
+	struct regmap *map;
+
+	if (!dev) {
+		printf("No device selected\n");
+		return 1;
+	}
 
+	gdsys_soc_get_fpga(dev, &fpga);
+	regmap_init_mem(dev_ofnode(dev), &map);
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	/*
+	 * packet size is specified since argc > 1
+	 */
+	size = simple_strtoul(argv[2], NULL, 10);
+
+	/*
+	 * If another parameter, it is the test rate in packets per second.
+	 */
+	if (argc > 2)
+		rate = simple_strtoul(argv[3], NULL, 10);
+
+	/* Enable receive path */
+	misc_set_enabled(dev, true);
+
+	rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
+
+	while (1) {
+		uint top_int;
+
+		if (ctrlc())
+			break;
+
+		ihs_fpga_get(map, top_interrupt, &top_int);
+
+		io_check_status(dev, STATUS_LOUD);
+		if (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS)
+			io_send(dev, size);
+		if (top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS)
+			io_receive(dev);
+
+		if (rate) {
+			udelay(1000000 / rate);
+			if (!(tx_ctr % rate))
+				printf("d %llu, tx %llu, rx %llu, err %llu\n",
+				       tx_ctr - rx_ctr, tx_ctr, rx_ctr,
+				       err_ctr);
+		}
+	}
+	return 0;
+}
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
+
+#ifndef CONFIG_GDSYS_LEGACY_DRIVERS
+int do_iodev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	struct udevice *ioep = NULL;
+	struct udevice *board;
+	char name[8];
+	int ret;
+
+	if (board_get(&board))
+		return CMD_RET_FAILURE;
+
+	if (argc > 1) {
+		int i = simple_strtoul(argv[1], NULL, 10);
+
+		snprintf(name, sizeof(name), "ioep%d", i);
+
+		ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &ioep);
+
+		if (ret || !ioep) {
+			printf("Invalid IOEP %d\n", i);
+			return CMD_RET_FAILURE;
+		}
+
+		dev = ioep;
+	} else {
+		int i = 0;
+
+		while (1) {
+			snprintf(name, sizeof(name), "ioep%d", i);
+
+			ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &ioep);
+
+			if (ret || !ioep)
+				break;
+
+			printf("IOEP %d:\t%s\n", i++, ioep->name);
+		}
+
+		if (dev)
+			printf("\nSelected IOEP: %s\n", dev->name);
+		else
+			puts("\nNo IOEP selected.\n");
+	}
+
+	return 0;
+}
+#endif /* !CONFIG_GDSYS_LEGACY_DRIVERS */
+
+#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 U_BOOT_CMD(
 	ioloop,	4,	0,	do_ioloop,
 	"fpga io-endpoint looptest",
@@ -296,3 +560,22 @@ U_BOOT_CMD(
 	"fpga io-endpoint reflector",
 	"fpga reportrate"
 );
+#else
+U_BOOT_CMD(
+	ioloop,	3,	0,	do_ioloop,
+	"fpga io-endpoint looptest",
+	"packetsize [packets/sec]"
+);
+
+U_BOOT_CMD(
+	ioreflect, 2,	0,	do_ioreflect,
+	"fpga io-endpoint reflector",
+	"reportrate"
+);
+
+U_BOOT_CMD(
+	iodev, 2,	0,	do_iodev,
+	"fpga io-endpoint listing/selection",
+	"[ioep device to select]"
+);
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
Signature · 1 line
2.20.1
author
#11 lore raw

PATCH 12/16 gdsys: ioep-fpga: Switch to gazerbeam-style reporting

In reply to Mario Six

Use a more extensive FPGA feature reporting style in the gdsys ioep-fpga driver.

---
 board/gdsys/common/ioep-fpga.c | 629 +++++++++++++++++++++++++--------
 1 file changed, 489 insertions(+), 140 deletions(-)
board/gdsys/common/ioep-fpga.c +489 -140
index 91eec3ac7c1..066222c563d 100644
@@ -10,231 +10,580 @@
 
 #include <gdsys_fpga.h>
 
-enum {
-	UNITTYPE_MAIN_SERVER = 0,
-	UNITTYPE_MAIN_USER = 1,
-	UNITTYPE_VIDEO_SERVER = 2,
-	UNITTYPE_VIDEO_USER = 3,
+enum pcb_video_type {
+	PCB_DVI_SL,
+	PCB_DP_165MPIX,
+	PCB_DP_300MPIX,
+	PCB_HDMI,
+	PCB_DP_1_2,
+	PCB_HDMI_2_0,
 };
 
-enum {
-	UNITTYPEPCB_DVI = 0,
-	UNITTYPEPCB_DP_165 = 1,
-	UNITTYPEPCB_DP_300 = 2,
-	UNITTYPEPCB_HDMI = 3,
+enum pcb_transmission_type {
+	PCB_CAT_1G,
+	PCB_FIBER_3G,
+	PCB_CAT_10G,
+	PCB_FIBER_10G,
 };
 
-enum {
-	COMPRESSION_NONE = 0,
-	COMPRESSION_TYPE_1 = 1,
-	COMPRESSION_TYPE_1_2 = 3,
-	COMPRESSION_TYPE_1_2_3 = 7,
+enum carrier_speed {
+	CARRIER_SPEED_1G,
+	CARRIER_SPEED_3G,
+	CARRIER_SPEED_2_5G = CARRIER_SPEED_3G,
+	CARRIER_SPEED_10G,
 };
 
-enum {
-	AUDIO_NONE = 0,
-	AUDIO_TX = 1,
-	AUDIO_RX = 2,
-	AUDIO_RXTX = 3,
+enum ram_config {
+	RAM_DDR2_32BIT_295MBPS,
+	RAM_DDR3_32BIT_590MBPS,
+	RAM_DDR3_48BIT_590MBPS,
+	RAM_DDR3_64BIT_1800MBPS,
+	RAM_DDR3_48BIT_1800MBPS,
 };
 
-enum {
-	SYSCLK_147456 = 0,
+enum sysclock {
+	SYSCLK_147456,
 };
 
-enum {
-	RAM_DDR2_32 = 0,
-	RAM_DDR3_32 = 1,
-	RAM_DDR3_48 = 2,
+struct fpga_versions {
+	bool video_channel;
+	bool con_side;
+	enum pcb_video_type pcb_video_type;
+	enum pcb_transmission_type pcb_transmission_type;
+	unsigned int hw_version;
 };
 
-enum {
-	CARRIER_SPEED_1G = 0,
-	CARRIER_SPEED_2_5G = 1,
+struct fpga_features {
+	u8 video_channels;
+	u8 carriers;
+	enum carrier_speed carrier_speed;
+	enum ram_config ram_config;
+	enum sysclock sysclock;
+
+	bool pcm_tx;
+	bool pcm_rx;
+	bool spdif_tx;
+	bool spdif_rx;
+	bool usb2;
+	bool rs232;
+	bool compression_type1;
+	bool compression_type2;
+	bool compression_type3;
+	bool interlace;
+	bool osd;
+	bool compression_pipes;
 };
 
-bool ioep_fpga_has_osd(unsigned int fpga)
+#ifdef CONFIG_SYS_FPGA_FLAVOR_GAZERBEAM
+
+static int get_versions(unsigned int fpga, struct fpga_versions *versions)
 {
-	u16 fpga_features;
-	unsigned feature_osd;
+	enum {
+		VERSIONS_FPGA_VIDEO_CHANNEL = BIT(12),
+		VERSIONS_FPGA_CON_SIDE = BIT(13),
+		VERSIONS_FPGA_SC = BIT(14),
+		VERSIONS_PCB_CON = BIT(9),
+		VERSIONS_PCB_SC = BIT(8),
+		VERSIONS_PCB_VIDEO_MASK = 0x3 << 6,
+		VERSIONS_PCB_VIDEO_DP_1_2 = 0x0 << 6,
+		VERSIONS_PCB_VIDEO_HDMI_2_0 = 0x1 << 6,
+		VERSIONS_PCB_TRANSMISSION_MASK = 0x3 << 4,
+		VERSIONS_PCB_TRANSMISSION_FIBER_10G = 0x0 << 4,
+		VERSIONS_PCB_TRANSMISSION_CAT_10G = 0x1 << 4,
+		VERSIONS_PCB_TRANSMISSION_FIBER_3G = 0x2 << 4,
+		VERSIONS_PCB_TRANSMISSION_CAT_1G = 0x3 << 4,
+		VERSIONS_HW_VER_MASK = 0xf << 0,
+	};
+	u16 raw_versions;
+
+	memset(versions, 0, sizeof(struct fpga_versions));
+
+	FPGA_GET_REG(fpga, versions, &raw_versions);
+
+	versions->video_channel = raw_versions & VERSIONS_FPGA_VIDEO_CHANNEL;
+	versions->con_side = raw_versions & VERSIONS_FPGA_CON_SIDE;
+
+	switch (raw_versions & VERSIONS_PCB_VIDEO_MASK) {
+	case VERSIONS_PCB_VIDEO_DP_1_2:
+		versions->pcb_video_type = PCB_DP_1_2;
+		break;
+
+	case VERSIONS_PCB_VIDEO_HDMI_2_0:
+		versions->pcb_video_type = PCB_HDMI_2_0;
+		break;
+	}
+
+	switch (raw_versions & VERSIONS_PCB_TRANSMISSION_MASK) {
+	case VERSIONS_PCB_TRANSMISSION_FIBER_10G:
+		versions->pcb_transmission_type = PCB_FIBER_10G;
+		break;
+
+	case VERSIONS_PCB_TRANSMISSION_CAT_10G:
+		versions->pcb_transmission_type = PCB_CAT_10G;
+		break;
+
+	case VERSIONS_PCB_TRANSMISSION_FIBER_3G:
+		versions->pcb_transmission_type = PCB_FIBER_3G;
+		break;
+
+	case VERSIONS_PCB_TRANSMISSION_CAT_1G:
+		versions->pcb_transmission_type = PCB_CAT_1G;
+		break;
+
+	}
 
-	FPGA_GET_REG(0, fpga_features, &fpga_features);
-	feature_osd = fpga_features & (1<<11);
+	versions->hw_version = raw_versions & VERSIONS_HW_VER_MASK;
 
-	return feature_osd;
+	return 0;
 }
 
-void ioep_fpga_print_info(unsigned int fpga)
+static int get_features(unsigned int fpga, struct fpga_features *features)
 {
-	u16 versions;
-	u16 fpga_version;
-	u16 fpga_features;
-	unsigned unit_type;
-	unsigned unit_type_pcb_video;
-	unsigned feature_compression;
-	unsigned feature_osd;
-	unsigned feature_audio;
-	unsigned feature_sysclock;
-	unsigned feature_ramconfig;
-	unsigned feature_carrier_speed;
-	unsigned feature_carriers;
-	unsigned feature_video_channels;
-
-	FPGA_GET_REG(fpga, versions, &versions);
-	FPGA_GET_REG(fpga, fpga_version, &fpga_version);
-	FPGA_GET_REG(fpga, fpga_features, &fpga_features);
-
-	unit_type = (versions & 0xf000) >> 12;
-	unit_type_pcb_video = (versions & 0x01c0) >> 6;
-	feature_compression = (fpga_features & 0xe000) >> 13;
-	feature_osd = fpga_features & (1<<11);
-	feature_audio = (fpga_features & 0x0600) >> 9;
-	feature_sysclock = (fpga_features & 0x0180) >> 7;
-	feature_ramconfig = (fpga_features & 0x0060) >> 5;
-	feature_carrier_speed = fpga_features & (1<<4);
-	feature_carriers = (fpga_features & 0x000c) >> 2;
-	feature_video_channels = fpga_features & 0x0003;
-
-	switch (unit_type) {
-	case UNITTYPE_MAIN_SERVER:
-	case UNITTYPE_MAIN_USER:
-		printf("Mainchannel");
+	enum {
+		FEATURE_SPDIF_RX = BIT(15),
+		FEATURE_SPDIF_TX = BIT(14),
+		FEATURE_PCM_RX = BIT(13),
+		FEATURE_PCM_TX = BIT(12),
+		FEATURE_RAM_MASK = GENMASK(11, 8),
+		FEATURE_RAM_DDR2_32BIT_295MBPS = 0x0 << 8,
+		FEATURE_RAM_DDR3_32BIT_590MBPS = 0x1 << 8,
+		FEATURE_RAM_DDR3_48BIT_590MBPS = 0x2 << 8,
+		FEATURE_RAM_DDR3_64BIT_1800MBPS = 0x3 << 8,
+		FEATURE_RAM_DDR3_48BIT_1800MBPS = 0x4 << 8,
+		FEATURE_CARRIER_SPEED_MASK = GENMASK(7, 6),
+		FEATURE_CARRIER_SPEED_1G = 0x0 << 6,
+		FEATURE_CARRIER_SPEED_2_5G = 0x1 << 6,
+		FEATURE_CARRIER_SPEED_10G = 0x2 << 6,
+		FEATURE_CARRIERS_MASK = GENMASK(5, 4),
+		FEATURE_CARRIERS_0 = 0x0 << 4,
+		FEATURE_CARRIERS_1 = 0x1 << 4,
+		FEATURE_CARRIERS_2 = 0x2 << 4,
+		FEATURE_CARRIERS_4 = 0x3 << 4,
+		FEATURE_USB2 = BIT(3),
+		FEATURE_VIDEOCHANNELS_MASK = GENMASK(2, 0),
+		FEATURE_VIDEOCHANNELS_0 = 0x0 << 0,
+		FEATURE_VIDEOCHANNELS_1 = 0x1 << 0,
+		FEATURE_VIDEOCHANNELS_1_1 = 0x2 << 0,
+		FEATURE_VIDEOCHANNELS_2 = 0x3 << 0,
+	};
+
+	enum {
+		EXT_FEATURE_OSD = BIT(15),
+		EXT_FEATURE_ETHERNET = BIT(9),
+		EXT_FEATURE_INTERLACE = BIT(8),
+		EXT_FEATURE_RS232 = BIT(7),
+		EXT_FEATURE_COMPRESSION_PERF_MASK = GENMASK(6, 4),
+		EXT_FEATURE_COMPRESSION_PERF_1X = 0x0 << 4,
+		EXT_FEATURE_COMPRESSION_PERF_2X = 0x1 << 4,
+		EXT_FEATURE_COMPRESSION_PERF_4X = 0x2 << 4,
+		EXT_FEATURE_COMPRESSION_TYPE1 = BIT(0),
+		EXT_FEATURE_COMPRESSION_TYPE2 = BIT(1),
+		EXT_FEATURE_COMPRESSION_TYPE3 = BIT(2),
+	};
+
+	u16 raw_features;
+	u16 raw_extended_features;
+
+	memset(features, 0, sizeof(struct fpga_features));
+
+	FPGA_GET_REG(fpga, fpga_features, &raw_features);
+	FPGA_GET_REG(fpga, fpga_ext_features, &raw_extended_features);
+
+	switch (raw_features & FEATURE_VIDEOCHANNELS_MASK) {
+	case FEATURE_VIDEOCHANNELS_0:
+		features->video_channels = 0;
 		break;
 
-	case UNITTYPE_VIDEO_SERVER:
-	case UNITTYPE_VIDEO_USER:
-		printf("Videochannel");
+	case FEATURE_VIDEOCHANNELS_1:
+		features->video_channels = 1;
 		break;
 
-	default:
-		printf("UnitType %d(not supported)", unit_type);
+	case FEATURE_VIDEOCHANNELS_1_1:
+	case FEATURE_VIDEOCHANNELS_2:
+		features->video_channels = 2;
 		break;
-	}
+	};
 
-	switch (unit_type) {
-	case UNITTYPE_MAIN_SERVER:
-	case UNITTYPE_VIDEO_SERVER:
-		printf(" Server");
-		if (versions & (1<<4))
-			printf(" UC");
+	switch (raw_features & FEATURE_CARRIERS_MASK) {
+	case FEATURE_CARRIERS_0:
+		features->carriers = 0;
 		break;
 
-	case UNITTYPE_MAIN_USER:
-	case UNITTYPE_VIDEO_USER:
-		printf(" User");
+	case FEATURE_CARRIERS_1:
+		features->carriers = 1;
 		break;
 
-	default:
+	case FEATURE_CARRIERS_2:
+		features->carriers = 2;
+		break;
+
+	case FEATURE_CARRIERS_4:
+		features->carriers = 4;
 		break;
 	}
 
-	if (versions & (1<<5))
-		printf(" Fiber");
-	else
-		printf(" CAT");
+	switch (raw_features & FEATURE_CARRIER_SPEED_MASK) {
+	case FEATURE_CARRIER_SPEED_1G:
+		features->carrier_speed = CARRIER_SPEED_1G;
+		break;
+	case FEATURE_CARRIER_SPEED_2_5G:
+		features->carrier_speed = CARRIER_SPEED_2_5G;
+		break;
+	case FEATURE_CARRIER_SPEED_10G:
+		features->carrier_speed = CARRIER_SPEED_10G;
+		break;
+	}
 
-	switch (unit_type_pcb_video) {
-	case UNITTYPEPCB_DVI:
-		printf(" DVI,");
+	switch (raw_features & FEATURE_RAM_MASK) {
+	case FEATURE_RAM_DDR2_32BIT_295MBPS:
+		features->ram_config = RAM_DDR2_32BIT_295MBPS;
 		break;
 
-	case UNITTYPEPCB_DP_165:
-		printf(" DP 165MPix/s,");
+	case FEATURE_RAM_DDR3_32BIT_590MBPS:
+		features->ram_config = RAM_DDR3_32BIT_590MBPS;
 		break;
 
-	case UNITTYPEPCB_DP_300:
-		printf(" DP 300MPix/s,");
+	case FEATURE_RAM_DDR3_48BIT_590MBPS:
+		features->ram_config = RAM_DDR3_48BIT_590MBPS;
 		break;
 
-	case UNITTYPEPCB_HDMI:
-		printf(" HDMI,");
+	case FEATURE_RAM_DDR3_64BIT_1800MBPS:
+		features->ram_config = RAM_DDR3_64BIT_1800MBPS;
+		break;
+
+	case FEATURE_RAM_DDR3_48BIT_1800MBPS:
+		features->ram_config = RAM_DDR3_48BIT_1800MBPS;
 		break;
 	}
 
-	printf(" FPGA V %d.%02d\n       features:",
-	       fpga_version / 100, fpga_version % 100);
+	features->pcm_tx = raw_features & FEATURE_PCM_TX;
+	features->pcm_rx = raw_features & FEATURE_PCM_RX;
+	features->spdif_tx = raw_features & FEATURE_SPDIF_TX;
+	features->spdif_rx = raw_features & FEATURE_SPDIF_RX;
+	features->usb2 = raw_features & FEATURE_USB2;
+	features->rs232 = raw_extended_features & EXT_FEATURE_RS232;
+	features->compression_type1 = raw_extended_features & EXT_FEATURE_COMPRESSION_TYPE1;
+	features->compression_type2 = raw_extended_features & EXT_FEATURE_COMPRESSION_TYPE2;
+	features->compression_type3 = raw_extended_features & EXT_FEATURE_COMPRESSION_TYPE3;
+	features->interlace = raw_extended_features & EXT_FEATURE_INTERLACE;
+	features->osd = raw_extended_features & EXT_FEATURE_OSD;
+	features->compression_pipes = raw_extended_features & EXT_FEATURE_COMPRESSION_PERF_MASK;
+
+	return 0;
+}
+
+#else
+
+static int get_versions(unsigned int fpga, struct fpga_versions *versions)
+{
+	enum {
+		/* HW version encoding is a mess, leave it for the moment */
+		VERSIONS_HW_VER_MASK = 0xf << 0,
+		VERSIONS_PIX_CLOCK_GEN_IDT8N3QV01 = BIT(4),
+		VERSIONS_SFP = BIT(5),
+		VERSIONS_VIDEO_MASK = 0x7 << 6,
+		VERSIONS_VIDEO_DVI = 0x0 << 6,
+		VERSIONS_VIDEO_DP_165 = 0x1 << 6,
+		VERSIONS_VIDEO_DP_300 = 0x2 << 6,
+		VERSIONS_VIDEO_HDMI = 0x3 << 6,
+		VERSIONS_UT_MASK = 0xf << 12,
+		VERSIONS_UT_MAIN_SERVER = 0x0 << 12,
+		VERSIONS_UT_MAIN_USER = 0x1 << 12,
+		VERSIONS_UT_VIDEO_SERVER = 0x2 << 12,
+		VERSIONS_UT_VIDEO_USER = 0x3 << 12,
+	};
+	u16 raw_versions;
+
+	memset(versions, 0, sizeof(struct fpga_versions));
+
+	FPGA_GET_REG(fpga, versions, &raw_versions);
+
+	switch (raw_versions & VERSIONS_UT_MASK) {
+	case VERSIONS_UT_MAIN_SERVER:
+		versions->video_channel = false;
+		versions->con_side = false;
+		break;
+
+	case VERSIONS_UT_MAIN_USER:
+		versions->video_channel = false;
+		versions->con_side = true;
+		break;
 
+	case VERSIONS_UT_VIDEO_SERVER:
+		versions->video_channel = true;
+		versions->con_side = false;
+		break;
 
-	switch (feature_compression) {
-	case COMPRESSION_NONE:
-		printf(" no compression");
+	case VERSIONS_UT_VIDEO_USER:
+		versions->video_channel = true;
+		versions->con_side = true;
 		break;
 
-	case COMPRESSION_TYPE_1:
-		printf(" compression type1(delta)");
+	}
+
+	switch (raw_versions & VERSIONS_VIDEO_MASK) {
+	case VERSIONS_VIDEO_DVI:
+		versions->pcb_video_type = PCB_DVI_SL;
 		break;
 
-	case COMPRESSION_TYPE_1_2:
-		printf(" compression type1(delta), type2(inline)");
+	case VERSIONS_VIDEO_DP_165:
+		versions->pcb_video_type = PCB_DP_165MPIX;
 		break;
 
-	case COMPRESSION_TYPE_1_2_3:
-		printf(" compression type1(delta), type2(inline), type3(intempo)");
+	case VERSIONS_VIDEO_DP_300:
+		versions->pcb_video_type = PCB_DP_300MPIX;
 		break;
 
-	default:
-		printf(" compression %d(not supported)", feature_compression);
+	case VERSIONS_VIDEO_HDMI:
+		versions->pcb_video_type = PCB_HDMI;
 		break;
 	}
 
-	printf(", %sosd", feature_osd ? "" : "no ");
+	versions->hw_version = raw_versions & VERSIONS_HW_VER_MASK;
 
-	switch (feature_audio) {
-	case AUDIO_NONE:
-		printf(", no audio");
+	if (raw_versions & VERSIONS_SFP)
+		versions->pcb_transmission_type = PCB_FIBER_3G;
+	else
+		versions->pcb_transmission_type = PCB_CAT_1G;
+
+	return 0;
+}
+
+static int get_features(unsigned int fpga, struct fpga_features *features)
+{
+	enum {
+		FEATURE_CARRIER_SPEED_2_5 = BIT(4),
+		FEATURE_RAM_MASK = 0x7 << 5,
+		FEATURE_RAM_DDR2_32BIT = 0x0 << 5,
+		FEATURE_RAM_DDR3_32BIT = 0x1 << 5,
+		FEATURE_RAM_DDR3_48BIT = 0x2 << 5,
+		FEATURE_PCM_AUDIO_TX = BIT(9),
+		FEATURE_PCM_AUDIO_RX = BIT(10),
+		FEATURE_OSD = BIT(11),
+		FEATURE_USB20 = BIT(12),
+		FEATURE_COMPRESSION_MASK = 7 << 13,
+		FEATURE_COMPRESSION_TYPE1 = 0x1 << 13,
+		FEATURE_COMPRESSION_TYPE1_TYPE2 = 0x3 << 13,
+		FEATURE_COMPRESSION_TYPE1_TYPE2_TYPE3 = 0x7 << 13,
+	};
+
+	enum {
+		EXTENDED_FEATURE_SPDIF_AUDIO_TX = BIT(0),
+		EXTENDED_FEATURE_SPDIF_AUDIO_RX = BIT(1),
+		EXTENDED_FEATURE_RS232 = BIT(2),
+		EXTENDED_FEATURE_COMPRESSION_PIPES = BIT(3),
+		EXTENDED_FEATURE_INTERLACE = BIT(4),
+	};
+
+	u16 raw_features;
+#ifdef GDSYS_LEGACY_DRIVERS
+	u16 raw_extended_features;
+#endif
+
+	memset(features, 0, sizeof(struct fpga_features));
+
+	FPGA_GET_REG(fpga, fpga_features, &raw_features);
+#ifdef GDSYS_LEGACY_DRIVERS
+	FPGA_GET_REG(fpga, fpga_ext_features, &raw_extended_features);
+#endif
+
+	features->video_channels = raw_features & 0x3;
+	features->carriers = (raw_features >> 2) & 0x3;
+
+	features->carrier_speed = (raw_features & FEATURE_CARRIER_SPEED_2_5)
+		? CARRIER_SPEED_2_5G : CARRIER_SPEED_1G;
+
+	switch (raw_features & FEATURE_RAM_MASK) {
+	case FEATURE_RAM_DDR2_32BIT:
+		features->ram_config = RAM_DDR2_32BIT_295MBPS;
 		break;
 
-	case AUDIO_TX:
-		printf(", audio tx");
+	case FEATURE_RAM_DDR3_32BIT:
+		features->ram_config = RAM_DDR3_32BIT_590MBPS;
 		break;
 
-	case AUDIO_RX:
-		printf(", audio rx");
+	case FEATURE_RAM_DDR3_48BIT:
+		features->ram_config = RAM_DDR3_48BIT_590MBPS;
 		break;
+	}
 
-	case AUDIO_RXTX:
-		printf(", audio rx+tx");
+	features->pcm_tx = raw_features & FEATURE_PCM_AUDIO_TX;
+	features->pcm_rx = raw_features & FEATURE_PCM_AUDIO_RX;
+#ifdef GDSYS_LEGACY_DRIVERS
+	features->spdif_tx = raw_extended_features & EXTENDED_FEATURE_SPDIF_AUDIO_TX;
+	features->spdif_rx = raw_extended_features & EXTENDED_FEATURE_SPDIF_AUDIO_RX;
+#endif
+
+	features->usb2 = raw_features & FEATURE_USB20;
+#ifdef GDSYS_LEGACY_DRIVERS
+	features->rs232 = raw_extended_features & EXTENDED_FEATURE_RS232;
+#endif
+
+	features->compression_type1 = false;
+	features->compression_type2 = false;
+	features->compression_type3 = false;
+	switch (raw_features & FEATURE_COMPRESSION_MASK) {
+	case FEATURE_COMPRESSION_TYPE1_TYPE2_TYPE3:
+		features->compression_type3 = true;
+	case FEATURE_COMPRESSION_TYPE1_TYPE2:
+		features->compression_type2 = true;
+	case FEATURE_COMPRESSION_TYPE1:
+		features->compression_type1 = true;
 		break;
+	}
+
+#ifdef GDSYS_LEGACY_DRIVERS
+	features->interlace = raw_extended_features & EXTENDED_FEATURE_INTERLACE;
+#endif
+	features->osd = raw_features & FEATURE_OSD;
+#ifdef GDSYS_LEGACY_DRIVERS
+	features->compression_pipes = raw_extended_features & EXTENDED_FEATURE_COMPRESSION_PIPES;
+#endif
 
-	default:
-		printf(", audio %d(not supported)", feature_audio);
+	return 0;
+}
+
+#endif
+
+bool ioep_fpga_has_osd(unsigned int fpga)
+{
+	struct fpga_features features;
+
+	get_features(fpga, &features);
+
+	return features.osd;
+}
+
+void ioep_fpga_print_info(unsigned int fpga)
+{
+	u16 fpga_version;
+	struct fpga_versions versions;
+	struct fpga_features features;
+
+	FPGA_GET_REG(fpga, fpga_version, &fpga_version);
+	get_versions(fpga, &versions);
+	get_features(fpga, &features);
+
+	if (versions.video_channel)
+		printf("Videochannel");
+	else
+		printf("Mainchannel");
+
+	if (versions.con_side)
+		printf(" User");
+	else
+		printf(" Server");
+
+// FIXME
+#if 0
+		if (versions & (1<<4))
+			printf(" UC");
+#endif
+
+	switch(versions.pcb_transmission_type) {
+	case PCB_CAT_1G:
+	case PCB_CAT_10G:
+		printf(" CAT");
+		break;
+	case PCB_FIBER_3G:
+	case PCB_FIBER_10G:
+		printf(" Fiber");
+		break;
+	};
+
+	switch (versions.pcb_video_type) {
+	case PCB_DVI_SL:
+		printf(" DVI,");
+		break;
+	case PCB_DP_165MPIX:
+		printf(" DP 165MPix/s,");
+		break;
+	case PCB_DP_300MPIX:
+		printf(" DP 300MPix/s,");
+		break;
+	case PCB_HDMI:
+		printf(" HDMI,");
+		break;
+	case PCB_DP_1_2:
+		printf(" DP 1.2,");
+		break;
+	case PCB_HDMI_2_0:
+		printf(" HDMI 2.0,");
 		break;
 	}
 
+	printf(" FPGA V %d.%02d\n       features: ",
+	       fpga_version / 100, fpga_version % 100);
+
+	if (!features.compression_type1 &&
+	    !features.compression_type2 &&
+	    !features.compression_type3)
+		printf("no compression, ");
+
+	if (features.compression_type1)
+		printf("type1, ");
+
+	if (features.compression_type2)
+		printf("type2, ");
+
+	if (features.compression_type3)
+		printf("type3, ");
+
+	printf("%sosd", features.osd ? "" : "no ");
+
+	if (features.pcm_rx && features.pcm_tx)
+		printf(", pcm rx+tx");
+	else if(features.pcm_rx)
+		printf(", pcm rx");
+	else if(features.pcm_tx)
+		printf(", pcm tx");
+
+	if (features.spdif_rx && features.spdif_tx)
+		printf(", spdif rx+tx");
+	else if(features.spdif_rx)
+		printf(", spdif rx");
+	else if(features.spdif_tx)
+		printf(", spdif tx");
+
 	puts(",\n       ");
 
-	switch (feature_sysclock) {
+	switch (features.sysclock) {
 	case SYSCLK_147456:
 		printf("clock 147.456 MHz");
 		break;
-
-	default:
-		printf("clock %d(not supported)", feature_sysclock);
-		break;
 	}
 
-	switch (feature_ramconfig) {
-	case RAM_DDR2_32:
+	switch (features.ram_config) {
+	case RAM_DDR2_32BIT_295MBPS:
 		printf(", RAM 32 bit DDR2");
 		break;
-
-	case RAM_DDR3_32:
+	case RAM_DDR3_32BIT_590MBPS:
 		printf(", RAM 32 bit DDR3");
 		break;
-
-	case RAM_DDR3_48:
+	case RAM_DDR3_48BIT_590MBPS:
+	case RAM_DDR3_48BIT_1800MBPS:
 		printf(", RAM 48 bit DDR3");
 		break;
-
-	default:
-		printf(", RAM %d(not supported)", feature_ramconfig);
+	case RAM_DDR3_64BIT_1800MBPS:
+		printf(", RAM 64 bit DDR3");
 		break;
 	}
 
-	printf(", %d carrier(s) %s", feature_carriers,
-	       feature_carrier_speed ? "2.5Gbit/s" : "1Gbit/s");
+	printf(", %d carrier(s)", features.carriers);
+
+	switch(features.carrier_speed) {
+	case CARRIER_SPEED_1G:
+		printf(", 1Gbit/s");
+		break;
+	case CARRIER_SPEED_3G:
+		printf(", 3Gbit/s");
+		break;
+	case CARRIER_SPEED_10G:
+		printf(", 10Gbit/s");
+		break;
+	}
 
-	printf(", %d video channel(s)\n", feature_video_channels);
+	printf(", %d video channel(s)\n", features.video_channels);
 }
 
 #endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
Signature · 1 line
2.20.1
author
#12 lore raw

PATCH 13/16 board: gazerbeam: Fix SC detection

In reply to Mario Six

The single channel detection in the gazerbeam board driver was not implemented correctly.

Fix the detection.

---
 drivers/board/gazerbeam.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/board/gazerbeam.c +12 -10
index 481cce8e809..85de4e440ce 100644
@@ -61,7 +61,7 @@ static int _read_board_variant_data(struct udevice *dev)
 	struct udevice *i2c_bus;
 	struct udevice *dummy;
 	char *listname;
-	int mc4, mc2, sc, con;
+	int mc4, mc2, sc, mc2_sc, con;
 	int gpio_num;
 	int res;
 
@@ -78,16 +78,16 @@ static int _read_board_variant_data(struct udevice *dev)
 		return -EIO;
 	}
 
-	mc2 = !dm_i2c_probe(i2c_bus, MC2_EXPANDER_ADDR, 0, &dummy);
+	mc2_sc = !dm_i2c_probe(i2c_bus, MC2_EXPANDER_ADDR, 0, &dummy);
 	mc4 = !dm_i2c_probe(i2c_bus, MC4_EXPANDER_ADDR, 0, &dummy);
 
-	if (mc2 && mc4) {
+	if (mc2_sc && mc4) {
 		debug("%s: Board hardware configuration inconsistent.\n",
 		      dev->name);
 		return -EINVAL;
 	}
 
-	listname = mc2 ? "var-gpios-mc2" : "var-gpios-mc4";
+	listname = mc2_sc ? "var-gpios-mc2" : "var-gpios-mc4";
 
 	gpio_num = gpio_request_list_by_name(dev, listname, priv->var_gpios,
 					     ARRAY_SIZE(priv->var_gpios),
@@ -105,12 +105,7 @@ static int _read_board_variant_data(struct udevice *dev)
 		return sc;
 	}
 
-	con = dm_gpio_get_value(&priv->var_gpios[CON_GPIO_NO]);
-	if (con < 0) {
-		debug("%s: Error while reading 'con' GPIO (err = %d)",
-		      dev->name, con);
-		return con;
-	}
+	mc2 = mc2_sc ? (sc ? 0 : 1) : 0;
 
 	if ((sc && mc2) || (sc && mc4) || (!sc && !mc2 && !mc4)) {
 		debug("%s: Board hardware configuration inconsistent.\n",
@@ -118,6 +113,13 @@ static int _read_board_variant_data(struct udevice *dev)
 		return -EINVAL;
 	}
 
+	con = dm_gpio_get_value(&priv->var_gpios[CON_GPIO_NO]);
+	if (con < 0) {
+		debug("%s: Error while reading 'con' GPIO (err = %d)",
+		      dev->name, con);
+		return con;
+	}
+
 	priv->variant = con ? VAR_CON : VAR_CPU;
 
 	priv->multichannel = mc4 ? 4 : (mc2 ? 2 : (sc ? 1 : 0));
Signature · 1 line
2.20.1
author
#13 lore raw

PATCH 14/16 gazerbeam: Import Linux DT

In reply to Mario Six

Import the Linux device tree for the Gazerbeam board.

---
 arch/powerpc/dts/.gitignore                   |   1 +
 arch/powerpc/dts/Makefile                     |   1 +
 arch/powerpc/dts/gazerbeam.dts                | 600 ++++++++++++++++++
 arch/powerpc/dts/gdsys/gazerbeam-base.dtsi    | 185 ++++++
 arch/powerpc/dts/gdsys/mpc8308.dtsi           | 354 +++++++++++
 .../dts/gdsys/soc/i2c/cirrus-audio-codec.dtsi |   6 +
 .../powerpc/dts/gdsys/soc/i2c/dallas-rtc.dtsi |   6 +
 arch/powerpc/dts/gdsys/soc/lbc/gazerbeam.dtsi |   5 +
 .../gdsys/soc/nor/flash-80k-partition.dtsi    |  20 +
 9 files changed, 1178 insertions(+)
 create mode 100644 arch/powerpc/dts/.gitignore
 create mode 100644 arch/powerpc/dts/gazerbeam.dts
 create mode 100644 arch/powerpc/dts/gdsys/gazerbeam-base.dtsi
 create mode 100644 arch/powerpc/dts/gdsys/mpc8308.dtsi
 create mode 100644 arch/powerpc/dts/gdsys/soc/i2c/cirrus-audio-codec.dtsi
 create mode 100644 arch/powerpc/dts/gdsys/soc/i2c/dallas-rtc.dtsi
 create mode 100644 arch/powerpc/dts/gdsys/soc/lbc/gazerbeam.dtsi
 create mode 100644 arch/powerpc/dts/gdsys/soc/nor/flash-80k-partition.dtsi
arch/powerpc/dts/.gitignore new file +1 -0
new file mode 100644
index 00000000000..b60ed208c77
@@ -0,0 +1 @@
+*.dtb
arch/powerpc/dts/Makefile +1 -0
index f080a968919..6a28f802c24 100644
@@ -2,6 +2,7 @@
 
 dtb-$(CONFIG_TARGET_T2080QDS) += t2080qds.dtb
 dtb-$(CONFIG_TARGET_MCR3000) += mcr3000.dtb
+dtb-$(CONFIG_TARGET_GAZERBEAM) += gazerbeam.dtb
 
 targets += $(dtb-y)
 
arch/powerpc/dts/gazerbeam.dts new file +600 -0

600 lines not on this page · raw message

arch/powerpc/dts/gdsys/gazerbeam-base.dtsi new file +185 -0

185 lines not on this page · raw message

arch/powerpc/dts/gdsys/mpc8308.dtsi new file +354 -0

354 lines not on this page · raw message

arch/powerpc/dts/gdsys/soc/i2c/cirrus-audio-codec.dtsi new file +6 -0
new file mode 100644
index 00000000000..9787e096483
@@ -0,0 +1,6 @@
+&IIC {
+	cs4265 at 4f {
+		compatible = "cirrus,cs4265";
+		reg = <0x0000004f>;
+	};
+};
arch/powerpc/dts/gdsys/soc/i2c/dallas-rtc.dtsi new file +6 -0
new file mode 100644
index 00000000000..336bdcaf2e3
@@ -0,0 +1,6 @@
+&IIC {
+	ds1339 at 68 {
+		compatible = "dallas,ds1339";
+		reg = <0x68>;
+	};
+};
arch/powerpc/dts/gdsys/soc/lbc/gazerbeam.dtsi new file +5 -0
new file mode 100644
index 00000000000..5ff58c28e50
@@ -0,0 +1,5 @@
+&board_lbc {
+	ranges = <0x0 0x0 0xfe000000 0x00800000
+	          0x1 0x0 0xe0600000 0x00003000
+		  0x2 0x0 0xe0700000 0x00003000>;
+};
arch/powerpc/dts/gdsys/soc/nor/flash-80k-partition.dtsi new file +20 -0
new file mode 100644
index 00000000000..c6cc1409e0d
@@ -0,0 +1,20 @@
+&board_lbc {
+	flash at 0,0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "cfi-flash";
+		reg = <0x0 0x0 0x100000>;
+		bank-width = <2>;
+		device-width = <1>;
+
+		u-boot at 0 {
+			reg = <0x0 0x80000>;
+		};
+		env at 80000 {
+			reg = <0x80000 0x10000>;
+		};
+		env1 at 90000 {
+			reg = <0x90000 0x10000>;
+		};
+	};
+};
Signature · 1 line
2.20.1
author
#14 lore raw

PATCH 15/16 gazerbeam: Add u-boot specific dts include file

In reply to Mario Six

Add a U-Boot specific dts file, which encapsulates the needed modifications to the Gazerbeam Linux device tree.

---
 arch/powerpc/dts/gazerbeam.dts              |   2 +
 arch/powerpc/dts/gdsys/gazerbeam-uboot.dtsi | 250 ++++++++++++++++++++
 2 files changed, 252 insertions(+)
 create mode 100644 arch/powerpc/dts/gdsys/gazerbeam-uboot.dtsi
arch/powerpc/dts/gazerbeam.dts +2 -0
index a4408c496c8..5d171519e01 100644
@@ -598,3 +598,5 @@
 	};
 
 };
+
+#include "gdsys/gazerbeam-uboot.dtsi"
arch/powerpc/dts/gdsys/gazerbeam-uboot.dtsi new file +250 -0

250 lines not on this page · raw message

Signature · 1 line
2.20.1
author
#15 lore raw

PATCH 16/16 mpc83xx: Add gazerbeam board

In reply to Mario Six

From: Dirk Eibach <[email protected]>

The gdsys gazerbeam board is based on a Freescale MPC8308 SOC. It boots from NOR-Flash, kernel and rootfs are stored on SD-Card.

On board peripherals include:
- 2x 10/100 Mbit/s Ethernet (optional)

---
 arch/powerpc/cpu/mpc83xx/Kconfig |  19 +++
 arch/powerpc/dts/gazerbeam.dts   |   2 +-
 board/gdsys/common/Makefile      |   1 +
 board/gdsys/mpc8308/Kconfig      |  29 ++++-
 board/gdsys/mpc8308/MAINTAINERS  |   2 +
 board/gdsys/mpc8308/Makefile     |   1 +
 board/gdsys/mpc8308/gazerbeam.c  | 179 ++++++++++++++++++++++++++++
 configs/gazerbeam_defconfig      | 196 +++++++++++++++++++++++++++++++
 include/configs/gazerbeam.h      | 137 +++++++++++++++++++++
 9 files changed, 564 insertions(+), 2 deletions(-)
 create mode 100644 board/gdsys/mpc8308/gazerbeam.c
 create mode 100644 configs/gazerbeam_defconfig
 create mode 100644 include/configs/gazerbeam.h
arch/powerpc/cpu/mpc83xx/Kconfig +19 -0
index fe20e85086b..b99288aa836 100644
@@ -175,6 +175,25 @@ config TARGET_STRIDER
 	select SYS_FSL_ERRATUM_ESDHC111
 	imply CMD_PCA953X
 
+config TARGET_GAZERBEAM
+	bool "Support gazerbeam"
+	select ARCH_MPC8308
+	select SYS_FSL_ERRATUM_ESDHC111
+	imply ENV_IS_IN_FLASH
+	help
+	  The "Gazerbeam" is a modular system by Guntermann & Drunck GmbH
+	  Systementwicklung based on the NXP MPC8308 SoC for usage in KVM
+	  appliances.
+
+	  Features include:
+	  * Two gigabit ethernet ports
+	  * Multiple USB ports (depending on variant)
+	  * Several gigabit ethernet or optical fiber ports (depending on
+	    variant)
+	  * Several display port inputs and outputs, and supporting redrivers
+	    (depending on variant)
+	  * Several FPGAs with custom logic (depending on variant)
+
 endchoice
 
 config MPC83XX_QUICC_ENGINE
arch/powerpc/dts/gazerbeam.dts +1 -1
index 5d171519e01..96c03c77ae8 100644
@@ -10,7 +10,7 @@
  * option) any later version.
  */
 
-/include/ "gdsys/mpc8308.dtsi"
+#include "gdsys/mpc8308.dtsi"
 
 /include/ "gdsys/gazerbeam-base.dtsi"
 
board/gdsys/common/Makefile +1 -0
index ff8d6f49665..7dfe104561a 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_TARGET_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o ch7
 obj-$(CONFIG_TARGET_STRIDER) += fanctrl.o
 obj-$(CONFIG_STRIDER_CON) += osd.o
 obj-$(CONFIG_STRIDER_CON_DP) += osd.o
+obj-$(CONFIG_TARGET_GAZERBEAM) += osd.o ihs_mdio.o ioep-fpga.o
 
 ifdef CONFIG_OSD
 obj-$(CONFIG_GDSYS_LEGACY_OSD_CMDS) += osd_cmd.o
board/gdsys/mpc8308/Kconfig +28 -1
index e6a47960547..30811889fbf 100644
@@ -71,7 +71,28 @@ config GDSYS_LEGACY_DRIVERS
 
 endif
 
-if TARGET_HRCON || TARGET_STRIDER
+if TARGET_GAZERBEAM
+
+config SYS_BOARD
+	default "mpc8308"
+
+config SYS_VENDOR
+	default "gdsys"
+
+config SYS_CONFIG_NAME
+	default "gazerbeam"
+
+config SYS_FPGA1_BASE
+	default E0700000
+
+config SYS_FPGA1_SIZE
+	default 1
+
+config GDSYS_LEGACY_OSD_CMDS
+	default y
+endif
+
+if TARGET_HRCON || TARGET_STRIDER || TARGET_GAZERBEAM
 
 choice
 	prompt "FPGA flavor selection"
@@ -89,6 +110,12 @@ config SYS_FPGA_FLAVOR_GAZERBEAM
 
 endchoice
 
+config EXTENDED_FEATURES
+	bool "FPGA extended features"
+	depends on GDSYS_LEGACY_DRIVERS
+	help
+	  Enable support for the extended features field of the IHS FPGA.
+
 config CMD_IOLOOP
 	bool "Enable 'ioloop' and 'ioreflect' commands"
 	help
board/gdsys/mpc8308/MAINTAINERS +2 -0
index 755b9a23858..ed1b6fa1062 100644
@@ -6,7 +6,9 @@ F:	include/configs/hrcon.h
 F:	configs/hrcon_defconfig
 F:	configs/hrcon_dh_defconfig
 F:	include/configs/strider.h
+F:	configs/strider_defconfig
 F:	configs/strider_cpu_defconfig
 F:	configs/strider_cpu_dp_defconfig
 F:	configs/strider_con_defconfig
 F:	configs/strider_con_dp_defconfig
+F:	configs/gazerbeam_defconfig
board/gdsys/mpc8308/Makefile +1 -0
index dc579479f95..9af5fe04d18 100644
@@ -6,3 +6,4 @@
 obj-y := mpc8308.o sdram.o
 obj-$(CONFIG_TARGET_HRCON) += hrcon.o
 obj-$(CONFIG_TARGET_STRIDER) += strider.o
+obj-$(CONFIG_TARGET_GAZERBEAM) += gazerbeam.o
board/gdsys/mpc8308/gazerbeam.c new file +179 -0

179 lines not on this page · raw message

configs/gazerbeam_defconfig new file +196 -0

196 lines not on this page · raw message

include/configs/gazerbeam.h new file +137 -0

137 lines not on this page · raw message

Signature · 1 line
2.20.1
author
#16 lore raw

PATCH 16/16 mpc83xx: Add gazerbeam board

Quoted 683 lines · Mario Six

From: Dirk Eibach <[email protected]>

The gdsys gazerbeam board is based on a Freescale MPC8308 SOC. It boots from NOR-Flash, kernel and rootfs are stored on SD-Card.

On board peripherals include:
- 2x 10/100 Mbit/s Ethernet (optional)

---
 arch/powerpc/cpu/mpc83xx/Kconfig |  19 +++
 arch/powerpc/dts/gazerbeam.dts   |   2 +-
 board/gdsys/common/Makefile      |   1 +
 board/gdsys/mpc8308/Kconfig      |  29 ++++-
 board/gdsys/mpc8308/MAINTAINERS  |   2 +
 board/gdsys/mpc8308/Makefile     |   1 +
 board/gdsys/mpc8308/gazerbeam.c  | 179 ++++++++++++++++++++++++++++
 configs/gazerbeam_defconfig      | 196 +++++++++++++++++++++++++++++++
 include/configs/gazerbeam.h      | 137 +++++++++++++++++++++
 9 files changed, 564 insertions(+), 2 deletions(-)
 create mode 100644 board/gdsys/mpc8308/gazerbeam.c
 create mode 100644 configs/gazerbeam_defconfig
 create mode 100644 include/configs/gazerbeam.h
arch/powerpc/cpu/mpc83xx/Kconfig +19 -0
index fe20e85086b..b99288aa836 100644
@@ -175,6 +175,25 @@ config TARGET_STRIDER
        select SYS_FSL_ERRATUM_ESDHC111
        imply CMD_PCA953X
 
+config TARGET_GAZERBEAM
+       bool "Support gazerbeam"
+       select ARCH_MPC8308
+       select SYS_FSL_ERRATUM_ESDHC111
+       imply ENV_IS_IN_FLASH
+       help
+         The "Gazerbeam" is a modular system by Guntermann & Drunck GmbH
+         Systementwicklung based on the NXP MPC8308 SoC for usage in KVM
+         appliances.
+
+         Features include:
+         * Two gigabit ethernet ports
+         * Multiple USB ports (depending on variant)
+         * Several gigabit ethernet or optical fiber ports (depending on
+           variant)
+         * Several display port inputs and outputs, and supporting redrivers
+           (depending on variant)
+         * Several FPGAs with custom logic (depending on variant)
+
 endchoice
 
 config MPC83XX_QUICC_ENGINE
arch/powerpc/dts/gazerbeam.dts +1 -1
index 5d171519e01..96c03c77ae8 100644
@@ -10,7 +10,7 @@
  * option) any later version.
  */
 
-/include/ "gdsys/mpc8308.dtsi"
+#include "gdsys/mpc8308.dtsi"
 
 /include/ "gdsys/gazerbeam-base.dtsi"
 
board/gdsys/common/Makefile +1 -0
index ff8d6f49665..7dfe104561a 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_TARGET_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o ch7
 obj-$(CONFIG_TARGET_STRIDER) += fanctrl.o
 obj-$(CONFIG_STRIDER_CON) += osd.o
 obj-$(CONFIG_STRIDER_CON_DP) += osd.o
+obj-$(CONFIG_TARGET_GAZERBEAM) += osd.o ihs_mdio.o ioep-fpga.o
 
 ifdef CONFIG_OSD
 obj-$(CONFIG_GDSYS_LEGACY_OSD_CMDS) += osd_cmd.o
board/gdsys/mpc8308/Kconfig +28 -1
index e6a47960547..30811889fbf 100644
@@ -71,7 +71,28 @@ config GDSYS_LEGACY_DRIVERS
 
 endif
 
-if TARGET_HRCON || TARGET_STRIDER
+if TARGET_GAZERBEAM
+
+config SYS_BOARD
+       default "mpc8308"
+
+config SYS_VENDOR
+       default "gdsys"
+
+config SYS_CONFIG_NAME
+       default "gazerbeam"
+
+config SYS_FPGA1_BASE
+       default E0700000
+
+config SYS_FPGA1_SIZE
+       default 1
+
+config GDSYS_LEGACY_OSD_CMDS
+       default y
+endif
+
+if TARGET_HRCON || TARGET_STRIDER || TARGET_GAZERBEAM
 
 choice
        prompt "FPGA flavor selection"
@@ -89,6 +110,12 @@ config SYS_FPGA_FLAVOR_GAZERBEAM
 
 endchoice
 
+config EXTENDED_FEATURES
+       bool "FPGA extended features"
+       depends on GDSYS_LEGACY_DRIVERS
+       help
+         Enable support for the extended features field of the IHS FPGA.
+
 config CMD_IOLOOP
        bool "Enable 'ioloop' and 'ioreflect' commands"
        help
board/gdsys/mpc8308/MAINTAINERS +2 -0
index 755b9a23858..ed1b6fa1062 100644
@@ -6,7 +6,9 @@ F:      include/configs/hrcon.h
 F:     configs/hrcon_defconfig
 F:     configs/hrcon_dh_defconfig
 F:     include/configs/strider.h
+F:     configs/strider_defconfig
 F:     configs/strider_cpu_defconfig
 F:     configs/strider_cpu_dp_defconfig
 F:     configs/strider_con_defconfig
 F:     configs/strider_con_dp_defconfig
+F:     configs/gazerbeam_defconfig
board/gdsys/mpc8308/Makefile +1 -0
index dc579479f95..9af5fe04d18 100644
@@ -6,3 +6,4 @@
 obj-y := mpc8308.o sdram.o
 obj-$(CONFIG_TARGET_HRCON) += hrcon.o
 obj-$(CONFIG_TARGET_STRIDER) += strider.o
+obj-$(CONFIG_TARGET_GAZERBEAM) += gazerbeam.o
board/gdsys/mpc8308/gazerbeam.c new file +179 -0
new file mode 100644
index 00000000000..cd621744d28
@@ -0,0 +1,179 @@
+/*
+ * (C) Copyright 2015
+ * Dirk Eibach,  Guntermann & Drunck GmbH, eibach at gdsys.de
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <board.h>
+#include <dm.h>
+#include <fdt_support.h>
+#include <fsl_esdhc.h>
+#include <miiphy.h>
+#include <misc.h>
+#include <tpm-v1.h>
+#include <video_osd.h>
+
+#include "../common/ihs_mdio.h"
+#include "../../../drivers/board/gazerbeam.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ihs_mdio_info ihs_mdio_info[] = {
+       { .fpga = NULL, .name = "ihs0", .base = 0x58 },
+       { .fpga = NULL, .name = "ihs1", .base = 0x58 },
+};
+
+static int get_tpm(struct udevice **devp)
+{
+       int rc;
+
+       rc = uclass_first_device_err(UCLASS_TPM, devp);
+       if (rc) {
+               printf("Could not find TPM (ret=%d)\n", rc);
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+int board_early_init_r(void)
+{
+       struct udevice *board;
+       struct udevice *serdes;
+       int mc = 0;
+       int con = 0;
+
+       if (board_get(&board))
+               puts("Could not find board information device.\n");
+
+       /* Initialize serdes */
+       uclass_get_device_by_phandle(UCLASS_MISC, board, "serdes", &serdes);
+
+       if (board_detect(board))
+               puts("Device information detection failed.\n");
+
+       board_get_int(board, BOARD_MULTICHANNEL, &mc);
+       board_get_int(board, BOARD_VARIANT, &con);
+
+       if (mc == 2 || mc == 1)
+               dev_disable_by_path("/immr at e0000000/i2c at 3100/pca9698 at 22");
+
+       if (mc == 4) {
+               dev_disable_by_path("/immr at e0000000/i2c at 3100/pca9698 at 20");
+               dev_enable_by_path("/localbus at e0005000/iocon_uart at 2,0");
+               dev_enable_by_path("/fpga1bus");
+       }
+
+       if (mc == 2 || con == VAR_CON) {
+               dev_enable_by_path("/fpga0bus/fpga0_video1");
+               dev_enable_by_path("/fpga0bus/fpga0_iic_video1");
+               dev_enable_by_path("/fpga0bus/fpga0_axi_video1");
+       }
+
+       if (con == VAR_CON) {
+               dev_enable_by_path("/fpga0bus/fpga0_video0");
+               dev_enable_by_path("/fpga0bus/fpga0_iic_video0");
+               dev_enable_by_path("/fpga0bus/fpga0_axi_video0");
+       }
+
+       return 0;
+}
+
+int checkboard(void)
+{
+       struct udevice *board;
+       char *s = env_get("serial#");
+       int mc = 0;
+       int con = 0;
+
+       if (board_get(&board))
+               puts("Could not find board information device.\n");
+
+       board_get_int(board, BOARD_MULTICHANNEL, &mc);
+       board_get_int(board, BOARD_VARIANT, &con);
+
+       puts("Board: Gazerbeam ");
+       printf("%s ", mc == 4 ? "MC4" : mc == 2 ? "MC2" : "SC");
+       printf("%s", con == VAR_CON ? "CON" : "CPU");
+
+       if (s) {
+               puts(", serial# ");
+               puts(s);
+       }
+
+       puts("\n");
+
+       return 0;
+}
+
+static void display_osd_info(struct udevice *osd,
+                            struct video_osd_info *osd_info)
+{
+       printf("OSD-%s: Digital-OSD version %01d.%02d, %d x %d characters\n",
+              osd->name, osd_info->major_version, osd_info->minor_version,
+              osd_info->width, osd_info->height);
+}
+
+int last_stage_init(void)
+{
+       int fpga_hw_rev = 0;
+       int i;
+       struct udevice *board;
+       struct udevice *osd;
+       struct video_osd_info osd_info;
+       struct udevice *tpm;
+       int ret;
+
+       if (board_get(&board))
+               puts("Could not find board information device.\n");
+
+       if (board) {
+               int res = board_get_int(board, BOARD_HWVERSION, &fpga_hw_rev);
+
+               if (res)
+                       printf("Could not determind FPGA HW revision (res = %d)\n", res);
+       }
+
+       env_set_ulong("fpga_hw_rev", fpga_hw_rev);
+
+       ret = get_tpm(&tpm);
+       if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR) ||
+           tpm_continue_self_test(tpm)) {
+               printf("TPM init failed\n");
+       }
+
+       if (fpga_hw_rev >= 4) {
+               for (i = 0; i < 4; i++) {
+                       struct udevice *rxaui;
+                       char name[8];
+
+                       snprintf(name, sizeof(name), "rxaui%d", i);
+                       /* Disable RXAUI polarity inversion */
+                       ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &rxaui);
+                       if (!ret)
+                               misc_set_enabled(rxaui, false);
+               }
+       }
+
+       for (uclass_first_device(UCLASS_VIDEO_OSD, &osd);
+            osd;
+            uclass_next_device(&osd)) {
+               video_osd_get_info(osd, &osd_info);
+               display_osd_info(osd, &osd_info);
+       }
+
+       return 0;
+}
+
+#if defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+       ft_cpu_setup(blob, bd);
+       fsl_fdt_fixup_dr_usb(blob, bd);
+       fdt_fixup_esdhc(blob, bd);
+
+       return 0;
+}
+#endif
configs/gazerbeam_defconfig new file +196 -0
new file mode 100644
index 00000000000..346b1b2eaa8
@@ -0,0 +1,196 @@
+CONFIG_PPC=y
+CONFIG_SYS_TEXT_BASE=0xFE000000
+CONFIG_SYS_MALLOC_F_LEN=0x600
+CONFIG_IDENT_STRING=" gazerbeam 0.01"
+CONFIG_SYS_CLK_FREQ=33333333
+CONFIG_MPC83xx=y
+CONFIG_TARGET_GAZERBEAM=y
+CONFIG_SYSTEM_PLL_VCO_DIV_2=y
+CONFIG_SYSTEM_PLL_FACTOR_4_1=y
+CONFIG_CORE_PLL_RATIO_3_1=y
+CONFIG_BOOT_ROM_INTERFACE_GPCM_16BIT=y
+CONFIG_TSEC1_MODE_RGMII=y
+CONFIG_TSEC2_MODE_RGMII=y
+CONFIG_BAT0=y
+CONFIG_BAT0_NAME="SDRAM"
+CONFIG_BAT0_BASE=0x00000000
+CONFIG_BAT0_LENGTH_128_MBYTES=y
+CONFIG_BAT0_ACCESS_RW=y
+CONFIG_BAT0_ICACHE_MEMORYCOHERENCE=y
+CONFIG_BAT0_DCACHE_MEMORYCOHERENCE=y
+CONFIG_BAT0_USER_MODE_VALID=y
+CONFIG_BAT0_SUPERVISOR_MODE_VALID=y
+CONFIG_BAT1=y
+CONFIG_BAT1_NAME="IMMR"
+CONFIG_BAT1_BASE=0xE0000000
+CONFIG_BAT1_LENGTH_8_MBYTES=y
+CONFIG_BAT1_ACCESS_RW=y
+CONFIG_BAT1_ICACHE_INHIBITED=y
+CONFIG_BAT1_ICACHE_GUARDED=y
+CONFIG_BAT1_DCACHE_INHIBITED=y
+CONFIG_BAT1_DCACHE_GUARDED=y
+CONFIG_BAT1_USER_MODE_VALID=y
+CONFIG_BAT1_SUPERVISOR_MODE_VALID=y
+CONFIG_BAT2=y
+CONFIG_BAT2_NAME="FLASH"
+CONFIG_BAT2_BASE=0xFE000000
+CONFIG_BAT2_LENGTH_8_MBYTES=y
+CONFIG_BAT2_ACCESS_RW=y
+CONFIG_BAT2_ICACHE_MEMORYCOHERENCE=y
+CONFIG_BAT2_DCACHE_INHIBITED=y
+CONFIG_BAT2_DCACHE_GUARDED=y
+CONFIG_BAT2_USER_MODE_VALID=y
+CONFIG_BAT2_SUPERVISOR_MODE_VALID=y
+CONFIG_BAT3=y
+CONFIG_BAT3_NAME="INIT_RAM"
+CONFIG_BAT3_BASE=0xE6000000
+CONFIG_BAT3_ACCESS_RW=y
+CONFIG_BAT3_USER_MODE_VALID=y
+CONFIG_BAT3_SUPERVISOR_MODE_VALID=y
+CONFIG_LBLAW0=y
+CONFIG_LBLAW0_BASE=0xFE000000
+CONFIG_LBLAW0_NAME="FLASH"
+CONFIG_LBLAW0_LENGTH_8_MBYTES=y
+CONFIG_LBLAW1=y
+CONFIG_LBLAW1_BASE=0xE0600000
+CONFIG_LBLAW1_NAME="FPGA0"
+CONFIG_LBLAW1_LENGTH_1_MBYTES=y
+CONFIG_LBLAW2=y
+CONFIG_LBLAW2_BASE=0xE0700000
+CONFIG_LBLAW2_NAME="FPGA1"
+CONFIG_LBLAW2_LENGTH_1_MBYTES=y
+CONFIG_ELBC_BR0_OR0=y
+CONFIG_BR0_OR0_NAME="FLASH"
+CONFIG_BR0_OR0_BASE=0xFE000000
+CONFIG_BR0_PORTSIZE_16BIT=y
+CONFIG_OR0_AM_8_MBYTES=y
+CONFIG_OR0_SCY_15=y
+CONFIG_OR0_CSNT_EARLIER=y
+CONFIG_OR0_ACS_HALF_CYCLE_EARLIER=y
+CONFIG_OR0_XACS_EXTENDED=y
+CONFIG_OR0_TRLX_RELAXED=y
+CONFIG_OR0_EHTR_8_CYCLE=y
+CONFIG_ELBC_BR1_OR1=y
+CONFIG_BR1_OR1_NAME="FPGA0"
+CONFIG_BR1_OR1_BASE=0xE0600000
+CONFIG_BR1_PORTSIZE_16BIT=y
+CONFIG_OR1_AM_1_MBYTES=y
+CONFIG_OR1_SCY_5=y
+CONFIG_OR1_CSNT_EARLIER=y
+CONFIG_ELBC_BR2_OR2=y
+CONFIG_BR2_OR2_NAME="FPGA1"
+CONFIG_BR2_OR2_BASE=0xE0700000
+CONFIG_BR2_PORTSIZE_16BIT=y
+CONFIG_OR2_AM_1_MBYTES=y
+CONFIG_OR2_SCY_5=y
+CONFIG_OR2_CSNT_EARLIER=y
+CONFIG_HID0_FINAL_EMCP=y
+CONFIG_HID0_FINAL_DPM=y
+CONFIG_HID0_FINAL_ICE=y
+CONFIG_HID2_HBE=y
+CONFIG_SICR_ETSEC1_A_TSEC_GTX_CLK125=y
+CONFIG_SICR_GPIO_A_TSEC2=y
+CONFIG_SICR_GPIO_B_TSEC_GTX_CLK125=y
+CONFIG_SICR_IEEE1588_A_GPIO=y
+CONFIG_SICR_GTM_GPIO=y
+CONFIG_SICR_ETSEC2_GPIO=y
+CONFIG_SICR_GPIOSEL_IEEE1588=y
+CONFIG_SICR_TMSOBI1_2_5_V=y
+CONFIG_SICR_TMSOBI2_2_5_V=y
+CONFIG_ACR_PIPE_DEP_4=y
+CONFIG_ACR_RPTCNT_4=y
+CONFIG_SPCR_TSECEP_3=y
+CONFIG_LCRR_DBYP_PLL_BYPASSED=y
+CONFIG_LCRR_CLKDIV_2=y
+CONFIG_SYS_FPGA_FLAVOR_GAZERBEAM=y
+CONFIG_CMD_IOLOOP=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_STDOUT_VIA_ALIAS=y
+CONFIG_BOOTDELAY=5
+# CONFIG_CONSOLE_MUX is not set
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_DISPLAY_CPUINFO=y
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_LAST_STAGE_INIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_CMD_CPU=y
+CONFIG_CMD_BINOP=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_SYS_ALT_MEMTEST=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_AXI=y
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_MII=y
+CONFIG_CMD_MII_DRIVER=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_TPM=y
+CONFIG_CMD_EXT2=y
+CONFIG_DOS_PARTITION=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="gazerbeam"
+CONFIG_DM=y
+CONFIG_REGMAP=y
+CONFIG_AXI=y
+CONFIG_IHS_AXI=y
+CONFIG_CLK=y
+CONFIG_ICS8N3QV01=y
+CONFIG_CPU=y
+CONFIG_CPU_MPC83XX=y
+CONFIG_BOARD=y
+CONFIG_BOARD_GAZERBEAM=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_PCA953X=y
+CONFIG_MPC8XXX_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_FSL=y
+CONFIG_SYS_I2C_IHS=y
+CONFIG_MISC=y
+CONFIG_GDSYS_RXAUI_CTRL=y
+CONFIG_GDSYS_IOEP=y
+CONFIG_MPC83XX_SERDES=y
+CONFIG_GDSYS_SOC=y
+CONFIG_IHS_FPGA=y
+CONFIG_DM_MMC=y
+CONFIG_FSL_ESDHC=y
+CONFIG_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_FLASH_CFI_DRIVER=y
+CONFIG_CFI_FLASH=y
+CONFIG_SYS_FLASH_PROTECTION=y
+CONFIG_SYS_FLASH_CFI=y
+CONFIG_PHYLIB_10G=y
+CONFIG_PHY_MARVELL=y
+CONFIG_DM_ETH=y
+CONFIG_TSEC_ENET=y
+# CONFIG_PCI is not set
+CONFIG_RAM=y
+CONFIG_MPC83XX_SDRAM=y
+CONFIG_DM_RESET=y
+CONFIG_DM_SERIAL=y
+CONFIG_SYS_NS16550=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_MCP83XX=y
+CONFIG_TIMER=y
+CONFIG_MPC83XX_TIMER=y
+CONFIG_TPM_ATMEL_TWI=y
+CONFIG_TPM_AUTH_SESSIONS=y
+# CONFIG_TPM_V2 is not set
+CONFIG_DM_VIDEO=y
+CONFIG_DISPLAY=y
+CONFIG_LOGICORE_DP_TX=y
+CONFIG_OSD=y
+CONFIG_IHS_VIDEO_OUT=y
+CONFIG_TPM=y
include/configs/gazerbeam.h new file +137 -1
new file mode 100644
index 00000000000..11d367a1519
@@ -0,0 +1,137 @@
+/*
+ * (C) Copyright 2015
+ * Dirk Eibach,  Guntermann & Drunck GmbH, eibach at gdsys.de
+ *
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * DDR Setup
+ */
+#define CONFIG_SYS_SDRAM_BASE          0x00000000 /* DDR is system memory */
+/* TODO: Check: Can this be unified with CONFIG_SYS_SDRAM_BASE? */
+#define CONFIG_SYS_DDR_SDRAM_BASE      CONFIG_SYS_SDRAM_BASE
+
+/*
+ * Memory test
+ * TODO: Migrate!
+ */
+#define CONFIG_SYS_MEMTEST_START       0x00001000 /* memtest region */
+#define CONFIG_SYS_MEMTEST_END         0x07e00000
+
+/*
+ * The reserved memory
+ */
+#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE /* start of monitor */
+
+#define CONFIG_SYS_MONITOR_LEN (512 * 1024) /* Reserve 512 kB for Mon */
+#define CONFIG_SYS_MALLOC_LEN  (512 * 1024) /* Reserved for malloc */
+
+/*
+ * Initial RAM Base Address Setup
+ */
+#define CONFIG_SYS_INIT_RAM_LOCK
+#define CONFIG_SYS_INIT_RAM_ADDR       0xE6000000 /* Initial RAM address */
+#define CONFIG_SYS_INIT_RAM_SIZE       0x1000 /* Size of used area in RAM */
+#define CONFIG_SYS_GBL_DATA_OFFSET     \
+       (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+
+/*
+ * FLASH on the Local Bus
+ */
+#define CONFIG_SYS_FLASH_BASE          0xFE000000 /* FLASH base address */
+#define CONFIG_SYS_FLASH_SIZE          8 /* FLASH size is up to 8M */
+
+#define CONFIG_SYS_MAX_FLASH_BANKS     1 /* number of banks */
+#define CONFIG_SYS_MAX_FLASH_SECT      135
+
+#define CONFIG_SYS_BAUDRATE_TABLE  \
+       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
+
+/*
+ * Environment
+ */
+#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + \
+                                CONFIG_SYS_MONITOR_LEN)
+#define CONFIG_ENV_SECT_SIZE   0x10000 /* 64K(one sector) for env */
+#define CONFIG_ENV_SIZE                0x2000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+#define CONFIG_LOADS_ECHO              /* echo on for serial download */
+#define CONFIG_SYS_LOADS_BAUD_CHANGE   /* allow baudrate change */
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LOAD_ADDR           0x2000000 /* default load address */
+#define CONFIG_SYS_HZ          1000    /* decrementer freq: 1ms ticks */
+
+#define CONFIG_SYS_CBSIZE      1024 /* Console I/O Buffer Size */
+
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS     16      /* max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+
+/*
+ * For booting Linux, the board info and command line data
+ * have to be in the first 256 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ */
+#define CONFIG_SYS_BOOTMAPSZ   (256 << 20) /* Initial Memory map for Linux */
+
+/*
+ * Environment Configuration
+ */
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_HAS_ETH0
+#define CONFIG_HAS_ETH1
+
+#define CONFIG_LOADADDR        800000  /* default location for tftp and bootm */
+
+/* TODO: Turn into string option and migrate to Kconfig */
+#define CONFIG_HOSTNAME                "gazerbeam"
+#define CONFIG_ROOTPATH                "/opt/nfsroot"
+#define CONFIG_BOOTFILE                "uImage"
+
+#define CONFIG_PREBOOT         /* enable preboot variable */
+
+#define CONFIG_EXTRA_ENV_SETTINGS                                      \
+       "netdev=eth0\0"                                                 \
+       "consoledev=ttyS1\0"                                            \
+       "u-boot=u-boot.bin\0"                                           \
+       "kernel_addr=1000000\0"                                 \
+       "fdt_addr=C00000\0"                                             \
+       "fdtfile=hrcon.dtb\0"                           \
+       "load=tftp ${loadaddr} ${u-boot}\0"                             \
+       "update=protect off " __stringify(CONFIG_SYS_MONITOR_BASE)      \
+               " +${filesize};era " __stringify(CONFIG_SYS_MONITOR_BASE)\
+               " +${filesize};cp.b ${fileaddr} "                       \
+               __stringify(CONFIG_SYS_MONITOR_BASE) " ${filesize}\0"   \
+       "upd=run load update\0"                                         \
+
+#define CONFIG_NFSBOOTCOMMAND                                          \
+       "setenv bootargs root=/dev/nfs rw "                             \
+       "nfsroot=$serverip:$rootpath "                                  \
+       "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
+       "console=$consoledev,$baudrate $othbootargs;"                   \
+       "tftp ${kernel_addr} $bootfile;"                                \
+       "tftp ${fdt_addr} $fdtfile;"                                    \
+       "bootm ${kernel_addr} - ${fdt_addr}"
+
+#define CONFIG_MMCBOOTCOMMAND                                          \
+       "setenv bootargs root=/dev/mmcblk0p3 rw rootwait "              \
+       "console=$consoledev,$baudrate $othbootargs;"                   \
+       "ext2load mmc 0:2 ${kernel_addr} $bootfile;"                    \
+       "ext2load mmc 0:2 ${fdt_addr} $fdtfile;"                        \
+       "bootm ${kernel_addr} - ${fdt_addr}"
+
+#define CONFIG_BOOTCOMMAND             CONFIG_MMCBOOTCOMMAND
+
+#endif /* __CONFIG_H */
--
Quoted 2 lines

2.20.1

Whole series applied to u-boot-mpc83xx/next.

Best regards,
Mario