Skip to contentSkip to conversation

Update gdsys board support

PATCH New dirk.eibach at gdsys.cc 4 participants 18 messages Oct 29, 2014 – Nov 7, 2014

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

cover Update gdsys board support

From: Dirk Eibach <[email protected]>

Dirk Eibach (6):
board: dlvision: Reduce memory footprint
mtd: Handle 29LV800BT
common: Fix cmd_fpgad addressing
board: dlvision-10g: Compile fix
board: iocon: Fix fpga index in print_fpga_info()
mpc83xx: Add gdsys hrcon board

 arch/powerpc/cpu/mpc83xx/Kconfig |   4 +
 board/gdsys/405ep/iocon.c        | 198 +-----------
 board/gdsys/common/Makefile      |   3 +-
 board/gdsys/common/ihs_mdio.c    |  88 +++++
 board/gdsys/common/ihs_mdio.h    |  18 ++
 board/gdsys/common/osd.c         |   3 +-
 board/gdsys/common/phy.c         | 280 ++++++++++++++++
 board/gdsys/common/phy.h         |  14 +
 board/gdsys/mpc8308/Kconfig      |  12 +
 board/gdsys/mpc8308/MAINTAINERS  |   6 +
 board/gdsys/mpc8308/Makefile     |   9 +
 board/gdsys/mpc8308/hrcon.c      | 677 +++++++++++++++++++++++++++++++++++++++
 board/gdsys/mpc8308/mpc8308.c    | 109 +++++++
 board/gdsys/mpc8308/mpc8308.h    |  10 +
 board/gdsys/mpc8308/sdram.c      |  82 +++++
 common/Makefile                  |   1 +
 common/cmd_fpgad.c               |  32 +-
 common/cmd_ioloop.c              | 295 +++++++++++++++++
 configs/hrcon_defconfig          |   3 +
 drivers/mtd/jedec_flash.c        |  51 +++
 include/configs/dlvision.h       |   9 +-
 include/configs/hrcon.h          | 614 +++++++++++++++++++++++++++++++++++
 include/flash.h                  |   1 +
 include/gdsys_fpga.h             |  64 +++-
 24 files changed, 2373 insertions(+), 210 deletions(-)
 create mode 100644 board/gdsys/common/ihs_mdio.c
 create mode 100644 board/gdsys/common/ihs_mdio.h
 create mode 100644 board/gdsys/common/phy.c
 create mode 100644 board/gdsys/common/phy.h
 create mode 100644 board/gdsys/mpc8308/Kconfig
 create mode 100644 board/gdsys/mpc8308/MAINTAINERS
 create mode 100644 board/gdsys/mpc8308/Makefile
 create mode 100644 board/gdsys/mpc8308/hrcon.c
 create mode 100644 board/gdsys/mpc8308/mpc8308.c
 create mode 100644 board/gdsys/mpc8308/mpc8308.h
 create mode 100644 board/gdsys/mpc8308/sdram.c
 create mode 100644 common/cmd_ioloop.c
 create mode 100644 configs/hrcon_defconfig
 create mode 100644 include/configs/hrcon.h
Signature · 1 line
1.8.3
#1 lore raw

PATCH 1/6 board: dlvision: Reduce memory footprint

From: Dirk Eibach <[email protected]>

Tune dlvision configuration similar to other gdsys boards to reduce memory footprint.

---

 include/configs/dlvision.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
include/configs/dlvision.h +8 -1
index af0d602..a9cfc10 100644
@@ -35,6 +35,7 @@
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */
+#define CONFIG_FIT_DISABLE_SHA256
 
 #define CONFIG_ENV_IS_IN_FLASH	/* use FLASH for environment vars */
 
@@ -59,8 +60,14 @@
 /*
  * Commands additional to the ones defined in amcc-common.h
  */
-#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DTT
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_DIAG
 #undef CONFIG_CMD_EEPROM
+#undef CONFIG_CMD_ELF
+#undef CONFIG_CMD_I2C
+#undef CONFIG_CMD_IRQ
+#undef CONFIG_CMD_NFS
 
 /*
  * SDRAM configuration (please see cpu/ppc/sdram.[ch])
Signature · 1 line
1.8.3
#2 lore raw

PATCH 2/6 mtd: Handle 29LV800BT

In reply to dirk.eibach at gdsys.cc

From: Dirk Eibach <[email protected]>

The device id makes u-boot think that this chip needs cfi_reverse_geometry(), which is not the case. Add it to jedec_flash, so it is handled properly.

---

 drivers/mtd/jedec_flash.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
 include/flash.h           |  1 +
 2 files changed, 52 insertions(+)
drivers/mtd/jedec_flash.c +51 -0
index 593b9b8..ce9af8f 100644
@@ -333,6 +333,57 @@ static const struct amd_flash_info jedec_table[] = {
 		}
 	},
 	{
+		.mfr_id		= (u16)AMD_MANUFACT,
+		.dev_id		= AM29LV800BT,
+		.name		= "AMD AM29LV800BT",
+		.uaddr		= {
+			[1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+		},
+		.DevSize	= SIZE_1MiB,
+		.CmdSet		= CFI_CMDSET_AMD_LEGACY,
+		.NumEraseRegions= 4,
+		.regions	= {
+			ERASEINFO(0x10000, 15),
+			ERASEINFO(0x08000, 1),
+			ERASEINFO(0x02000, 2),
+			ERASEINFO(0x04000, 1),
+		}
+	},
+	{
+		.mfr_id		= (u16)MX_MANUFACT,
+		.dev_id		= AM29LV800BT,
+		.name		= "MXIC MX29LV800BT",
+		.uaddr		= {
+			[1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+		},
+		.DevSize	= SIZE_1MiB,
+		.CmdSet		= CFI_CMDSET_AMD_LEGACY,
+		.NumEraseRegions= 4,
+		.regions	= {
+			ERASEINFO(0x10000, 15),
+			ERASEINFO(0x08000, 1),
+			ERASEINFO(0x02000, 2),
+			ERASEINFO(0x04000, 1),
+		}
+	},
+	{
+		.mfr_id		= (u16)EON_ALT_MANU,
+		.dev_id		= AM29LV800BT,
+		.name		= "EON EN29LV800BT",
+		.uaddr		= {
+			[1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+		},
+		.DevSize	= SIZE_1MiB,
+		.CmdSet		= CFI_CMDSET_AMD_LEGACY,
+		.NumEraseRegions= 4,
+		.regions	= {
+			ERASEINFO(0x10000, 15),
+			ERASEINFO(0x08000, 1),
+			ERASEINFO(0x02000, 2),
+			ERASEINFO(0x04000, 1),
+		}
+	},
+	{
 		.mfr_id		= (u16)STM_MANUFACT,
 		.dev_id		= STM29F400BB,
 		.name		= "ST Micro M29F400BB",
include/flash.h +1 -0
index 5454c9e..30aa080 100644
@@ -158,6 +158,7 @@ extern flash_info_t *flash_get_info(ulong base);
 #define EXCEL_MANUFACT	0x004A004A	/* Excel Semiconductor			*/
 #define AMIC_MANUFACT	0x00370037	/* AMIC    manuf. ID in D23..D16, D7..D0 */
 #define WINB_MANUFACT	0x00DA00DA	/* Winbond manuf. ID in D23..D16, D7..D0 */
+#define EON_ALT_MANU	0x001C001C	/* EON     manuf. ID in D23..D16, D7..D0 */
 
 /* Manufacturers inside bank 1 have ids like 0x01xx01xx */
 #define EON_MANUFACT	0x011C011C	/* EON     manuf. ID in D23..D16, D7..D0 */
Signature · 1 line
1.8.3
#3 lore raw

PATCH 3/6 common: Fix cmd_fpgad addressing

In reply to dirk.eibach at gdsys.cc

From: Dirk Eibach <[email protected]>

Addressing was completely broken for cmd_fpgad.

---

 common/cmd_fpgad.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)
common/cmd_fpgad.c +24 -8
index 1b25ed8..1f1d00f 100644
@@ -31,7 +31,8 @@ int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	unsigned int fpga;
 	ulong	addr, length;
 	int rc = 0;
-	u16	linebuf[DISP_LINE_LEN/sizeof(u16)];
+	u16 linebuf[DISP_LINE_LEN/sizeof(u16)];
+	ulong nbytes;
 
 	/*
 	 * We use the last specified parameters, unless new ones are
@@ -63,13 +64,28 @@ int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			length = simple_strtoul(argv[3], NULL, 16);
 	}
 
-	/* Print the lines. */
-	for (k = 0; k < DISP_LINE_LEN / sizeof(u16); ++k)
-		fpga_get_reg(fpga, (u16 *)fpga_ptr[fpga] + k, k * sizeof(u16),
-			     &linebuf[k]);
-	print_buffer(addr, (void *)linebuf, sizeof(u16),
-		     length, DISP_LINE_LEN / sizeof(u16));
-	addr += sizeof(u16)*length;
+	nbytes = length * sizeof(u16);
+	do {
+		ulong linebytes = (nbytes > DISP_LINE_LEN) ?
+				  DISP_LINE_LEN : nbytes;
+
+		for (k = 0; k < linebytes / sizeof(u16); ++k)
+			fpga_get_reg(fpga,
+				     (u16 *)fpga_ptr[fpga] + addr
+				     / sizeof(u16) + k,
+				     addr + k * sizeof(u16),
+				     &linebuf[k]);
+		print_buffer(addr, (void *)linebuf, sizeof(u16),
+			     linebytes / sizeof(u16),
+			     DISP_LINE_LEN / sizeof(u16));
+
+		nbytes -= linebytes;
+		addr += linebytes;
+		if (ctrlc()) {
+			rc = 1;
+			break;
+		}
+	} while (nbytes > 0);
 
 	dp_last_fpga = fpga;
 	dp_last_addr = addr;
Signature · 1 line
1.8.3
#4 lore raw

PATCH 4/6 board: dlvision-10g: Compile fix

In reply to dirk.eibach at gdsys.cc

From: Dirk Eibach <[email protected]>

---

 board/gdsys/common/osd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
board/gdsys/common/osd.c +1 -2
index 1c765e4..f26b336 100644
@@ -345,8 +345,7 @@ int osd_probe(unsigned screen)
 #ifdef CONFIG_SYS_SIL1178_I2C
 	i2c_set_bus_num(sil1178_i2c[screen]);
 	if (!i2c_probe(SIL1178_SLAVE_I2C_ADDRESS)) {
-		value = i2c_reg_read(SIL1178_SLAVE_I2C_ADDRESS, 0x02);
-		if (value == 0x06) {
+		if (i2c_reg_read(SIL1178_SLAVE_I2C_ADDRESS, 0x02) == 0x06) {
 			/*
 			 * magic initialization sequence,
 			 * adapted from datasheet
Signature · 1 line
1.8.3
#5 lore raw

PATCH 5/6 board: iocon: Fix fpga index in print_fpga_info()

In reply to dirk.eibach at gdsys.cc

From: Dirk Eibach <[email protected]>

---

 board/gdsys/405ep/iocon.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
board/gdsys/405ep/iocon.c +4 -4
index 1bac970..fffed73 100644
@@ -180,11 +180,11 @@ static void print_fpga_info(unsigned int fpga, bool rgmii2_present)
 	unsigned feature_carriers;
 	unsigned feature_video_channels;
 
-	int legacy = get_fpga_state(0) & FPGA_STATE_PLATFORM;
+	int legacy = get_fpga_state(fpga) & FPGA_STATE_PLATFORM;
 
-	FPGA_GET_REG(0, versions, &versions);
-	FPGA_GET_REG(0, fpga_version, &fpga_version);
-	FPGA_GET_REG(0, fpga_features, &fpga_features);
+	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;
 	feature_compression = (fpga_features & 0xe000) >> 13;
Signature · 1 line
1.8.3
#6 lore raw

PATCH 6/6 mpc83xx: Add gdsys hrcon board

In reply to dirk.eibach at gdsys.cc

From: Dirk Eibach <[email protected]>

The gdsys hrcon 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:
- 1x GbE (optional)
- Lattice ECP3 FPGA connected via eLBC and PCIe

---

 arch/powerpc/cpu/mpc83xx/Kconfig |   4 +
 board/gdsys/405ep/iocon.c        | 190 +----------
 board/gdsys/common/Makefile      |   3 +-
 board/gdsys/common/ihs_mdio.c    |  88 +++++
 board/gdsys/common/ihs_mdio.h    |  18 ++
 board/gdsys/common/phy.c         | 280 ++++++++++++++++
 board/gdsys/common/phy.h         |  14 +
 board/gdsys/mpc8308/Kconfig      |  12 +
 board/gdsys/mpc8308/MAINTAINERS  |   6 +
 board/gdsys/mpc8308/Makefile     |   9 +
 board/gdsys/mpc8308/hrcon.c      | 677 +++++++++++++++++++++++++++++++++++++++
 board/gdsys/mpc8308/mpc8308.c    | 109 +++++++
 board/gdsys/mpc8308/mpc8308.h    |  10 +
 board/gdsys/mpc8308/sdram.c      |  82 +++++
 common/Makefile                  |   1 +
 common/cmd_ioloop.c              | 295 +++++++++++++++++
 configs/hrcon_defconfig          |   3 +
 include/configs/hrcon.h          | 614 +++++++++++++++++++++++++++++++++++
 include/gdsys_fpga.h             |  64 +++-
 19 files changed, 2284 insertions(+), 195 deletions(-)
 create mode 100644 board/gdsys/common/ihs_mdio.c
 create mode 100644 board/gdsys/common/ihs_mdio.h
 create mode 100644 board/gdsys/common/phy.c
 create mode 100644 board/gdsys/common/phy.h
 create mode 100644 board/gdsys/mpc8308/Kconfig
 create mode 100644 board/gdsys/mpc8308/MAINTAINERS
 create mode 100644 board/gdsys/mpc8308/Makefile
 create mode 100644 board/gdsys/mpc8308/hrcon.c
 create mode 100644 board/gdsys/mpc8308/mpc8308.c
 create mode 100644 board/gdsys/mpc8308/mpc8308.h
 create mode 100644 board/gdsys/mpc8308/sdram.c
 create mode 100644 common/cmd_ioloop.c
 create mode 100644 configs/hrcon_defconfig
 create mode 100644 include/configs/hrcon.h
arch/powerpc/cpu/mpc83xx/Kconfig +4 -0
index 42e0e29..dadff32 100644
@@ -67,6 +67,9 @@ config TARGET_TUXX1
 config TARGET_TQM834X
 	bool "Support TQM834x"
 
+config TARGET_HRCON
+	bool "Support hrcon"
+
 endchoice
 
 source "board/esd/vme8349/Kconfig"
@@ -87,5 +90,6 @@ source "board/mpc8308_p1m/Kconfig"
 source "board/sbc8349/Kconfig"
 source "board/tqc/tqm834x/Kconfig"
 source "board/ve8313/Kconfig"
+source "board/gdsys/mpc8308/Kconfig"
 
 endmenu
board/gdsys/405ep/iocon.c +1 -189

205 lines not on this page · raw message

board/gdsys/common/Makefile +2 -1
index 7f8b427..4e7b9db 100644
@@ -8,6 +8,7 @@
 obj-$(CONFIG_SYS_FPGA_COMMON) += fpga.o
 obj-$(CONFIG_IO) += miiphybb.o
 obj-$(CONFIG_IO64) += miiphybb.o
-obj-$(CONFIG_IOCON) += osd.o mclink.o dp501.o
+obj-$(CONFIG_IOCON) += osd.o mclink.o dp501.o phy.o
 obj-$(CONFIG_DLVISION_10G) += osd.o
 obj-$(CONFIG_CONTROLCENTERD) += dp501.o
+obj-$(CONFIG_HRCON) += osd.o mclink.o dp501.o phy.o
board/gdsys/common/ihs_mdio.c new file +88 -0

88 lines not on this page · raw message

board/gdsys/common/ihs_mdio.h new file +18 -0
new file mode 100644
index 0000000..64b4049
@@ -0,0 +1,18 @@
+/*
+ * (C) Copyright 2014
+ * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _IHS_MDIO_H_
+#define _IHS_MDIO_H_
+
+struct ihs_mdio_info {
+	u32 fpga;
+	char *name;
+};
+
+int ihs_mdio_init(struct ihs_mdio_info *info);
+
+#endif
board/gdsys/common/phy.c new file +280 -0

280 lines not on this page · raw message

board/gdsys/common/phy.h new file +14 -0
new file mode 100644
index 0000000..afbdc65
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2014
+ * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach at gdsys.cc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _PHY_H_
+#define _PHY_H_
+
+int setup_88e1514(const char *bus, unsigned char addr);
+int setup_88e1518(const char *bus, unsigned char addr);
+
+#endif
board/gdsys/mpc8308/Kconfig new file +12 -0
new file mode 100644
index 0000000..43e1663
@@ -0,0 +1,12 @@
+if TARGET_HRCON
+
+config SYS_BOARD
+	default "mpc8308"
+
+config SYS_VENDOR
+	default "gdsys"
+
+config SYS_CONFIG_NAME
+	default "hrcon"
+
+endif
board/gdsys/mpc8308/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..a7853a5
@@ -0,0 +1,6 @@
+MPC8308 BOARD
+M:	Dirk Eibach <[email protected]>
+S:	Maintained
+F:	board/gdsys/mpc8308/
+F:	include/configs/hrcon.h
+F:	configs/hrcon_defconfig
board/gdsys/mpc8308/Makefile new file +9 -0
new file mode 100644
index 0000000..b5dfdbb
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2014
+# Dirk Eibach,  Guntermann & Drunck GmbH, eibach at gdsys.de
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := mpc8308.o sdram.o
+obj-$(CONFIG_HRCON) += hrcon.o
board/gdsys/mpc8308/hrcon.c new file +677 -0

677 lines not on this page · raw message

board/gdsys/mpc8308/mpc8308.c new file +109 -0

109 lines not on this page · raw message

board/gdsys/mpc8308/mpc8308.h new file +10 -0
new file mode 100644
index 0000000..dc07d56
@@ -0,0 +1,10 @@
+#ifndef __MPC8308_H_
+#define __MPC8308_H_
+
+/* functions to be provided by board implementation */
+void mpc8308_init(void);
+void mpc8308_set_fpga_reset(unsigned state);
+void mpc8308_setup_hw(void);
+int mpc8308_get_fpga_done(unsigned fpga);
+
+#endif /* __MPC8308_H_ */
board/gdsys/mpc8308/sdram.c new file +82 -0

82 lines not on this page · raw message

common/Makefile +1 -0
index b19d379..b5ed9ae 100644
@@ -119,6 +119,7 @@ obj-$(CONFIG_CMD_HASH) += cmd_hash.o
 obj-$(CONFIG_CMD_IDE) += cmd_ide.o
 obj-$(CONFIG_CMD_IMMAP) += cmd_immap.o
 obj-$(CONFIG_CMD_INI) += cmd_ini.o
+COBJS-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o
 obj-$(CONFIG_CMD_IRQ) += cmd_irq.o
 obj-$(CONFIG_CMD_ITEST) += cmd_itest.o
 obj-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
common/cmd_ioloop.c new file +295 -0

295 lines not on this page · raw message

configs/hrcon_defconfig new file +3 -0
new file mode 100644
index 0000000..69c65ba
@@ -0,0 +1,3 @@
+CONFIG_PPC=y
+CONFIG_MPC83xx=y
+CONFIG_TARGET_HRCON=y
include/configs/hrcon.h new file +614 -0

614 lines not on this page · raw message

include/gdsys_fpga.h +59 -5

87 lines not on this page · raw message

Signature · 1 line
1.8.3
#7 lore raw

PATCH 6/6 mpc83xx: Add gdsys hrcon board

Quoted 6 lines · On Wed, 29 Oct 2014 16:03:57 +0100 <[email protected]> wrote:

From: Dirk Eibach <[email protected]>

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

Quoted 6 lines

On board peripherals include:
- 1x GbE (optional)
- Lattice ECP3 FPGA connected via eLBC and PCIe

---

sorry for the delay, I bricked a board when going through my queue lately, and haven't been able to fully recover since.

Quoted 7 lines
 arch/powerpc/cpu/mpc83xx/Kconfig |   4 +
 board/gdsys/405ep/iocon.c        | 190 +----------
 board/gdsys/common/Makefile      |   3 +-
 board/gdsys/common/ihs_mdio.c    |  88 +++++
 board/gdsys/common/ihs_mdio.h    |  18 ++
 board/gdsys/common/phy.c         | 280 ++++++++++++++++
 board/gdsys/common/phy.h         |  14 +

is it me, or should PHY support go under drivers/net/phy/gdsys.c (or something like that)? Even if not immediately ported to the Generic PHY Management layer, still, I think it would be a good idea to get it in the right vicinity.

Taking a closer look, it looks like at least one of the PHYs involved here (the Marvell 88E1518) is already implemented in drivers/phy/marvell.c to a certain degree, so it might be helpful to define CONFIG_PHY_MARVELL as a first step to migrating to the generic PHY subsystem.

Quoted 10 lines
 board/gdsys/mpc8308/Kconfig      |  12 +
 board/gdsys/mpc8308/MAINTAINERS  |   6 +
 board/gdsys/mpc8308/Makefile     |   9 +
 board/gdsys/mpc8308/hrcon.c      | 677 +++++++++++++++++++++++++++++++++++++++
 board/gdsys/mpc8308/mpc8308.c    | 109 +++++++
 board/gdsys/mpc8308/mpc8308.h    |  10 +
 board/gdsys/mpc8308/sdram.c      |  82 +++++
 common/Makefile                  |   1 +
 common/cmd_ioloop.c              | 295 +++++++++++++++++

IDK what this is (FPGA io-endpoint looper/reflector?), but I'm guessing since it's in common/, it should be separated from this board support patch, otherwise it won't get the intended audience's attention.

Quoted 45 lines
board/gdsys/mpc8308/hrcon.c new file +45 -0
+int last_stage_init(void)
+{
+	int slaves;
+	unsigned int k;
+	unsigned int mux_ch;
+	unsigned char mclink_controllers[] = { 0x24, 0x25, 0x26 };
+	u16 fpga_features;
+	bool hw_type_cat = pca9698_get_value(0x20, 20);
+	bool ch0_rgmii2_present = false;
+
+	FPGA_GET_REG(0, fpga_features, &fpga_features);
+
+	/* Turn on Parade DP501 */
+	pca9698_direction_output(0x20, 10, 1);
+
+	ch0_rgmii2_present = !pca9698_get_value(0x20, 30);
+
+	/* wait for FPGA done */
+	for (k = 0; k < ARRAY_SIZE(mclink_controllers); ++k) {
+		unsigned int ctr = 0;
+
+		if (i2c_probe(mclink_controllers[k]))
+			continue;
+
+		while (!(pca953x_get_val(mclink_controllers[k])
+		       & MCFPGA_DONE)) {
+			udelay(100000);
+			if (ctr++ > 5) {
+				printf("no done for mclink_controller %d\n", k);
+				break;
+			}
+		}
+	}
+
+	if (hw_type_cat) {
+		miiphy_register(bb_miiphy_buses[0].name, bb_miiphy_read,
+				bb_miiphy_write);
+		for (mux_ch = 0; mux_ch < MAX_MUX_CHANNELS; ++mux_ch) {
+			if ((mux_ch == 1) && !ch0_rgmii2_present)
+				continue;
+
+			setup_88e1514(bb_miiphy_buses[0].name, mux_ch);
+		}
+	}
+

board/gdsys/mpc8308/hrcon.c line 406

Quoted 10 lines
board/gdsys/mpc8308/hrcon.c new file +10 -0
+	/* give slave-PLLs and Parade DP501 some time to be up and running */
+	udelay(500000);
+
+	mclink_fpgacount = CONFIG_SYS_MCLINK_MAX;
+	slaves = mclink_probe();
+	mclink_fpgacount = 0;
+
+	print_fpga_info(0, ch0_rgmii2_present);
+	osd_probe(0);
+	return 0;

unless this was left in from debugging (in which case it should be removed), it implies the remaining code in the fn..:

Quoted 10 lines
board/gdsys/mpc8308/hrcon.c new file +10 -0
+
+	if (slaves <= 0)
+		return 0;
+
+	mclink_fpgacount = slaves;
+
+	for (k = 1; k <= slaves; ++k) {
+		FPGA_GET_REG(k, fpga_features, &fpga_features);
+
+		print_fpga_info(k, false);

board/gdsys/mpc8308/hrcon.c line 427

Quoted 10 lines
board/gdsys/mpc8308/hrcon.c new file +10 -0
+		osd_probe(k);
+		if (hw_type_cat) {
+			miiphy_register(bb_miiphy_buses[k].name,
+					bb_miiphy_read, bb_miiphy_write);
+			setup_88e1514(bb_miiphy_buses[k].name, 0);
+		}
+	}
+
+	return 0;
+}

..is dead code, and therefore not welcome here.

Quoted 45 lines
board/gdsys/mpc8308/mpc8308.c new file +45 -0
+int board_early_init_r(void)
+{
+	unsigned k;
+	unsigned ctr;
+
+	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
+		gd->arch.fpga_state[k] = 0;
+
+	/*
+	 * reset FPGA
+	 */
+	mpc8308_init();
+
+	mpc8308_set_fpga_reset(1);
+
+	mpc8308_setup_hw();
+
+	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) {
+		ctr = 0;
+		while (!mpc8308_get_fpga_done(k)) {
+			udelay(100000);
+			if (ctr++ > 5) {
+				gd->arch.fpga_state[k] |=
+					FPGA_STATE_DONE_FAILED;
+				break;
+			}
+		}
+	}
+
+	udelay(10);
+
+	mpc8308_set_fpga_reset(0);
+
+	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) {
+		/*
+		 * wait for fpga out of reset
+		 */
+		ctr = 0;
+		while (1) {
+			u16 val;
+
+			FPGA_SET_REG(k, reflection_low, REFLECTION_TESTPATTERN);
+
+			FPGA_GET_REG(k, REFLECTION_TESTREG, &val);
+			if (val == REFLECTION_TESTPATTERN_INV)

board/gdsys/mpc8308/mpc8308.c line 106

Quoted 10 lines
board/gdsys/mpc8308/mpc8308.c new file +10 -0
+				break;
+
+			udelay(100000);
+			if (ctr++ > 5) {
+				gd->arch.fpga_state[k] |=
+					FPGA_STATE_REFLECTION_FAILED;
+				break;
+			}
+		}
+	}

should these functions have timeouts? not sure if there's anything useful to do if they do timeout...

Quoted 5 lines

+/* Fixed sdram init -- doesn't use serial presence detect.
+ *
+ * This is useful for faster booting in configs where the RAM is unlikely
+ * to be changed, or for things like NAND booting where space is tight.
+ */

this is ok if the board has its RAM soldered-on: does it?

common/Makefile obj-$(CONFIG_CMD_HASH) += cmd_hash.o · line 125

Quoted 12 lines
common/Makefile +1 -0
index b19d379..b5ed9ae 100644
@@ -119,6 +119,7 @@ obj-$(CONFIG_CMD_HASH) += cmd_hash.o
 obj-$(CONFIG_CMD_IDE) += cmd_ide.o
 obj-$(CONFIG_CMD_IMMAP) += cmd_immap.o
 obj-$(CONFIG_CMD_INI) += cmd_ini.o
+COBJS-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o
 obj-$(CONFIG_CMD_IRQ) += cmd_irq.o
 obj-$(CONFIG_CMD_ITEST) += cmd_itest.o
 obj-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o

hmm, does obj-$... not work?

Thanks,

Kim

#8 lore raw

PATCH 6/6 mpc83xx: Add gdsys hrcon board

Hi Kim,

2014-11-07 1:18 GMT+01:00 Kim Phillips <[email protected]>:

Quoted 3 lines

...
sorry for the delay, I bricked a board when going through my queue lately, and haven't been able to fully recover since.

no problem, Thanks for the review, I'm very happy we have some progress now.

Quoted 13 lines
Quoted 7 lines
 arch/powerpc/cpu/mpc83xx/Kconfig |   4 +
 board/gdsys/405ep/iocon.c        | 190 +----------
 board/gdsys/common/Makefile      |   3 +-
 board/gdsys/common/ihs_mdio.c    |  88 +++++
 board/gdsys/common/ihs_mdio.h    |  18 ++
 board/gdsys/common/phy.c         | 280 ++++++++++++++++
 board/gdsys/common/phy.h         |  14 +

is it me, or should PHY support go under drivers/net/phy/gdsys.c (or something like that)? Even if not immediately ported to the Generic PHY Management layer, still, I think it would be a good idea to get it in the right vicinity.

Quoted 5 lines

Taking a closer look, it looks like at least one of the PHYs involved here (the Marvell 88E1518) is already implemented in drivers/phy/marvell.c to a certain degree, so it might be helpful to define CONFIG_PHY_MARVELL as a first step to migrating to the generic PHY subsystem.

The first step was to factor out the common PHY code from iocon.c. The next step is merging this with the PHY subsystem.
For the moment I would prefer it going in this way and doing a merge with the PHY subsystem for the next release.
There are more boards coming that use this and I will clean it up alltogether.

Quoted 8 lines
Quoted 7 lines
 board/gdsys/mpc8308/Kconfig      |  12 +
 board/gdsys/mpc8308/MAINTAINERS  |   6 +
 board/gdsys/mpc8308/Makefile     |   9 +
 board/gdsys/mpc8308/hrcon.c      | 677 +++++++++++++++++++++++++++++++++++++++
 board/gdsys/mpc8308/mpc8308.c    | 109 +++++++
 board/gdsys/mpc8308/mpc8308.h    |  10 +
 board/gdsys/mpc8308/sdram.c      |  82 +++++
Quoted 7 lines
Quoted 2 lines
 common/Makefile                  |   1 +
 common/cmd_ioloop.c              | 295 +++++++++++++++++

IDK what this is (FPGA io-endpoint looper/reflector?), but I'm guessing since it's in common/, it should be separated from this board support patch, otherwise it won't get the intended audience's attention.

Since this is very gdsys FPGA specific I should probably move it to our board directory.

Quoted 50 lines
Quoted 50 lines
board/gdsys/mpc8308/hrcon.c new file +50 -0
+int last_stage_init(void)
+{
+     int slaves;
+     unsigned int k;
+     unsigned int mux_ch;
+     unsigned char mclink_controllers[] = { 0x24, 0x25, 0x26 };
+     u16 fpga_features;
+     bool hw_type_cat = pca9698_get_value(0x20, 20);
+     bool ch0_rgmii2_present = false;
+
+     FPGA_GET_REG(0, fpga_features, &fpga_features);
+
+     /* Turn on Parade DP501 */
+     pca9698_direction_output(0x20, 10, 1);
+
+     ch0_rgmii2_present = !pca9698_get_value(0x20, 30);
+
+     /* wait for FPGA done */
+     for (k = 0; k < ARRAY_SIZE(mclink_controllers); ++k) {
+             unsigned int ctr = 0;
+
+             if (i2c_probe(mclink_controllers[k]))
+                     continue;
+
+             while (!(pca953x_get_val(mclink_controllers[k])
+                    & MCFPGA_DONE)) {
+                     udelay(100000);
+                     if (ctr++ > 5) {
+                             printf("no done for mclink_controller %d\n", k);
+                             break;
+                     }
+             }
+     }
+
+     if (hw_type_cat) {
+             miiphy_register(bb_miiphy_buses[0].name, bb_miiphy_read,
+                             bb_miiphy_write);
+             for (mux_ch = 0; mux_ch < MAX_MUX_CHANNELS; ++mux_ch) {
+                     if ((mux_ch == 1) && !ch0_rgmii2_present)
+                             continue;
+
+                     setup_88e1514(bb_miiphy_buses[0].name, mux_ch);
+             }
+     }
+
+     /* give slave-PLLs and Parade DP501 some time to be up and running */
+     udelay(500000);
+
+     mclink_fpgacount = CONFIG_SYS_MCLINK_MAX;
+     slaves = mclink_probe();
Quoted 8 lines

board/gdsys/mpc8308/hrcon.c line 406

Quoted 5 lines
board/gdsys/mpc8308/hrcon.c new file +5 -0
+     mclink_fpgacount = 0;
+
+     print_fpga_info(0, ch0_rgmii2_present);
+     osd_probe(0);
+     return 0;

unless this was left in from debugging (in which case it should be removed), it implies the remaining code in the fn..:

Oops, you are absolutely rigth this is debugcode. Wonder how that crept in...

Quoted 73 lines
Quoted 10 lines
board/gdsys/mpc8308/hrcon.c new file +10 -0
+
+     if (slaves <= 0)
+             return 0;
+
+     mclink_fpgacount = slaves;
+
+     for (k = 1; k <= slaves; ++k) {
+             FPGA_GET_REG(k, fpga_features, &fpga_features);
+
+             print_fpga_info(k, false);

board/gdsys/mpc8308/hrcon.c line 427

Quoted 10 lines
board/gdsys/mpc8308/hrcon.c new file +10 -0
+             osd_probe(k);
+             if (hw_type_cat) {
+                     miiphy_register(bb_miiphy_buses[k].name,
+                                     bb_miiphy_read, bb_miiphy_write);
+                     setup_88e1514(bb_miiphy_buses[k].name, 0);
+             }
+     }
+
+     return 0;
+}

..is dead code, and therefore not welcome here.

Quoted 50 lines
board/gdsys/mpc8308/mpc8308.c new file +50 -0
+int board_early_init_r(void)
+{
+     unsigned k;
+     unsigned ctr;
+
+     for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
+             gd->arch.fpga_state[k] = 0;
+
+     /*
+      * reset FPGA
+      */
+     mpc8308_init();
+
+     mpc8308_set_fpga_reset(1);
+
+     mpc8308_setup_hw();
+
+     for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) {
+             ctr = 0;
+             while (!mpc8308_get_fpga_done(k)) {
+                     udelay(100000);
+                     if (ctr++ > 5) {
+                             gd->arch.fpga_state[k] |=
+                                     FPGA_STATE_DONE_FAILED;
+                             break;
+                     }
+             }
+     }
+
+     udelay(10);
+
+     mpc8308_set_fpga_reset(0);
+
+     for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) {
+             /*
+              * wait for fpga out of reset
+              */
+             ctr = 0;
+             while (1) {
+                     u16 val;
+
+                     FPGA_SET_REG(k, reflection_low, REFLECTION_TESTPATTERN);
+
+                     FPGA_GET_REG(k, REFLECTION_TESTREG, &val);
+                     if (val == REFLECTION_TESTPATTERN_INV)
+                             break;
+
+                     udelay(100000);
+                     if (ctr++ > 5) {
+                             gd->arch.fpga_state[k] |=
Quoted 8 lines

board/gdsys/mpc8308/mpc8308.c line 106

Quoted 5 lines
board/gdsys/mpc8308/mpc8308.c new file +5 -0
+                                     FPGA_STATE_REFLECTION_FAILED;
+                             break;
+                     }
+             }
+     }

should these functions have timeouts? not sure if there's anything useful to do if they do timeout...

In fact the ctr code is meant to be a timeout. Or do you address something different?

Quoted 7 lines
Quoted 5 lines

+/* Fixed sdram init -- doesn't use serial presence detect.
+ *
+ * This is useful for faster booting in configs where the RAM is unlikely
+ * to be changed, or for things like NAND booting where space is tight.
+ */

this is ok if the board has its RAM soldered-on: does it?

It does.

Quoted 6 lines
Quoted 6 lines
common/Makefile +0 -0
index b19d379..b5ed9ae 100644
@@ -119,6 +119,7 @@ obj-$(CONFIG_CMD_HASH) += cmd_hash.o
 obj-$(CONFIG_CMD_IDE) += cmd_ide.o
Quoted 8 lines

common/Makefile obj-$(CONFIG_CMD_HASH) += cmd_hash.o · line 125

Quoted 6 lines
common/Makefile +1 -0
 obj-$(CONFIG_CMD_IMMAP) += cmd_immap.o
 obj-$(CONFIG_CMD_INI) += cmd_ini.o
+COBJS-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o
 obj-$(CONFIG_CMD_IRQ) += cmd_irq.o
 obj-$(CONFIG_CMD_ITEST) += cmd_itest.o
 obj-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o

hmm, does obj-$... not work?

Sometimes git rebase is simply too smart. Will change to obj-$

Cheers
Dirk

#10 lore raw

cover Update gdsys board support

Hi Dirk,

Quoted 2 lines · Dirk Eibach

will you look after this series? I ask because there is also some mpc83xx stuff involved.

Yes, I just looked again. Not sure how we should handle this patch series. I can ack the PPC4xx and CFI flash related patches and someone else can pull this series (Kim for mpc83xx. Or Kim ack's the 83xx patch and I'll pull all and push it forward.

Comments?

Thanks,
Stefan

#11 lore raw

cover Update gdsys board support

Hi Stefan,

2014-11-05 11:43 GMT+01:00 Stefan Roese <[email protected]>:

Quoted 5 lines

...
Yes, I just looked again. Not sure how we should handle this patch series. I can ack the PPC4xx and CFI flash related patches and someone else can pull this series (Kim for mpc83xx. Or Kim ack's the 83xx patch and I'll pull all and push it forward.

Is Kim still active? Last message from him on the list I found was from may.

Cheers
Dirk

#12 lore raw

cover Update gdsys board support

Hi Dirk,

Quoted 6 lines · Dirk Eibach
Quoted 4 lines

Yes, I just looked again. Not sure how we should handle this patch series. I can ack the PPC4xx and CFI flash related patches and someone else can pull this series (Kim for mpc83xx. Or Kim ack's the 83xx patch and I'll pull all and push it forward.

Is Kim still active? Last message from him on the list I found was from may.

Not sure. Lets wait and see if Kim responds...

Thanks,
Stefan

#13 lore raw

cover Update gdsys board support

Hi Stefan,

Quoted 5 lines
Quoted 2 lines

Is Kim still active? Last message from him on the list I found was from may.

Not sure. Lets wait and see if Kim responds...

looks not so good.
I put Scott and York from Freescale to CC. Maybe they can inquire at Freescale.

Cheers
Dirk

#14 lore raw

cover Update gdsys board support

Quoted 11 lines · Dirk Eibach

Hi Stefan,

Quoted 5 lines
Quoted 2 lines

Is Kim still active? Last message from him on the list I found was from may.

Not sure. Lets wait and see if Kim responds...

looks not so good.
I put Scott and York from Freescale to CC. Maybe they can inquire at Freescale.

Kim is still acting as mpc83xx maintainer, but there hasn't been much activities lately.

York

#15 lore raw

cover Update gdsys board support

Quoted 6 lines · On Thu, 6 Nov 2014 10:25:58 -0800 York Sun <[email protected]> wrote:
Quoted 5 lines · Dirk Eibach

Hi Stefan,

Quoted 3 lines
Quoted 2 lines

Is Kim still active? Last message from him on the list I found was from may.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Not sure. Lets wait and see if Kim responds...

looks not so good.
I put Scott and York from Freescale to CC. Maybe they can inquire at Freescale.

Kim is still acting as mpc83xx maintainer, but there hasn't been much activities lately.

Please see my review comments, thanks.

Kim

#16 lore raw

cover Update gdsys board support

In reply to Stefan Roese

Hi Kim,

2014-11-05 11:43 GMT+01:00 Stefan Roese <[email protected]>:

Quoted 8 lines

Hi Dirk,

Quoted 3 lines · Dirk Eibach

will you look after this series? I ask because there is also some mpc83xx stuff involved.

Quoted 6 lines

Yes, I just looked again. Not sure how we should handle this patch series. I can ack the PPC4xx and CFI flash related patches and someone else can pull this series (Kim for mpc83xx. Or Kim ack's the 83xx patch and I'll pull all and push it forward.

Comments?

what way of handling this would you prefer?

Cheers
Dirk

#17 lore raw

cover Update gdsys board support

Quoted 11 lines · On Fri, 7 Nov 2014 13:58:37 +0100 Dirk Eibach <[email protected]> wrote:

Hi Kim,

2014-11-05 11:43 GMT+01:00 Stefan Roese <[email protected]>:

Quoted 8 lines

Hi Dirk,

Quoted 3 lines · Dirk Eibach

will you look after this series? I ask because there is also some mpc83xx stuff involved.

Quoted 8 lines
Quoted 6 lines

Yes, I just looked again. Not sure how we should handle this patch series. I can ack the PPC4xx and CFI flash related patches and someone else can pull this series (Kim for mpc83xx. Or Kim ack's the 83xx patch and I'll pull all and push it forward.

Comments?

what way of handling this would you prefer?

not sure what the problem is exactly, but if you repost after addressing my comments, I can ack the 83xx bits: I just don't like adding stuff to common/ in a board support patch, so please have that separated out.

Kim