Skip to contentSkip to conversation

mpc83xx: Add esd VME8349 board support

PATCH New Stefan Roese 3 participants 6 messages Jun 10, 2009 – Jul 24, 2009

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

PATCH 1/1 mpc83xx: Add esd VME8349 board support

From: Reinhard Arlt <[email protected]>

From: Reinhard Arlt <[email protected]>

This patch adds support for the esd VME8349 board equipped with the MPC8349. It's a VME PMC carrier board equipped with the Tundra TSI148 VME-bridge.

---
 MAINTAINERS                 |    2 +
 MAKEALL                     |    1 +
 Makefile                    |    2 +
 board/esd/vme8349/Makefile  |   49 ++++
 board/esd/vme8349/aduc.c    |  522 +++++++++++++++++++++++++++++++++++
 board/esd/vme8349/caddy.c   |  203 ++++++++++++++
 board/esd/vme8349/caddy.h   |   78 ++++++
 board/esd/vme8349/config.mk |   27 ++
 board/esd/vme8349/pci.c     |  409 +++++++++++++++++++++++++++
 board/esd/vme8349/vme8349.c |  129 +++++++++
 drivers/pci/pci_auto.c      |    2 +
 include/configs/vme8349.h   |  638 +++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 2062 insertions(+), 0 deletions(-)
 create mode 100644 board/esd/vme8349/Makefile
 create mode 100644 board/esd/vme8349/aduc.c
 create mode 100644 board/esd/vme8349/caddy.c
 create mode 100644 board/esd/vme8349/caddy.h
 create mode 100644 board/esd/vme8349/config.mk
 create mode 100644 board/esd/vme8349/pci.c
 create mode 100644 board/esd/vme8349/vme8349.c
 create mode 100644 include/configs/vme8349.h
MAINTAINERS +2 -0
index bba6ce9..861ff33 100644
@@ -31,6 +31,8 @@ Reinhard Arlt <[email protected]>
 	mecp5200	MPC5200
 	pf5200		MPC5200
 
+	vme8349		MPC8349
+
 	CPCI750		PPC750FX/GX
 
 Yuli Barcohen <[email protected]>
MAKEALL +1 -0
index fd31252..6e139bd 100755
@@ -360,6 +360,7 @@ LIST_83xx="		\
 	sbc8349		\
 	SIMPC8313_LP	\
 	TQM834x		\
+	vme8349		\
 "
 
 
Makefile +2 -0
index 64b7fbd..f6c2181 100644
@@ -2396,6 +2396,8 @@ SIMPC8313_SP_config: unconfig
 TQM834x_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc83xx tqm834x tqc
 
+vme8349_config:		unconfig
+	@$(MKCONFIG) $(@:_config=) ppc mpc83xx vme8349 esd
 
 #########################################################################
 ## MPC85xx Systems
board/esd/vme8349/Makefile new file +49 -0

49 lines not on this page · raw message

board/esd/vme8349/aduc.c new file +522 -0

522 lines not on this page · raw message

board/esd/vme8349/caddy.c new file +203 -0

203 lines not on this page · raw message

board/esd/vme8349/caddy.h new file +78 -0

78 lines not on this page · raw message

board/esd/vme8349/config.mk new file +27 -0
new file mode 100644
index 0000000..db81061
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2009 esd gmbh hannover germany.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# VME8349E
+#
+
+TEXT_BASE  =   0xFFF00000
board/esd/vme8349/pci.c new file +409 -0

409 lines not on this page · raw message

board/esd/vme8349/vme8349.c new file +129 -0

129 lines not on this page · raw message

drivers/pci/pci_auto.c +2 -0
index c20b981..393e44d 100644
@@ -403,6 +403,7 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 		       PCI_DEV(dev));
 		break;
 #endif
+#ifndef CONFIG_VME8349
 #ifdef CONFIG_MPC834X
 	case PCI_CLASS_BRIDGE_OTHER:
 		/*
@@ -415,6 +416,7 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 		pciauto_setup_device(hose, dev, 0, hose->pci_mem, hose->pci_prefetch, hose->pci_io);
 		break;
 #endif
+#endif
 	default:
 		pciauto_setup_device(hose, dev, 6, hose->pci_mem, hose->pci_prefetch, hose->pci_io);
 		break;
include/configs/vme8349.h new file +638 -0

638 lines not on this page · raw message

Signature · 1 line
1.6.3.2
#1 lore raw

PATCH 1/1 mpc83xx: Add esd VME8349 board support

Quoted 10 lines · On Wed, 10 Jun 2009 19:09:48 +0200 Stefan Roese <[email protected]> wrote:

From: Reinhard Arlt <[email protected]>

From: Reinhard Arlt <[email protected]>

This patch adds support for the esd VME8349 board equipped with the MPC8349. It's a VME PMC carrier board equipped with the Tundra TSI148 VME-bridge.

Quoted 13 lines
---
 MAINTAINERS                 |    2 +
 MAKEALL                     |    1 +
 Makefile                    |    2 +
 board/esd/vme8349/Makefile  |   49 ++++
 board/esd/vme8349/aduc.c    |  522 +++++++++++++++++++++++++++++++++++
 board/esd/vme8349/caddy.c   |  203 ++++++++++++++
 board/esd/vme8349/caddy.h   |   78 ++++++
 board/esd/vme8349/config.mk |   27 ++
 board/esd/vme8349/pci.c     |  409 +++++++++++++++++++++++++++
 board/esd/vme8349/vme8349.c |  129 +++++++++
 drivers/pci/pci_auto.c      |    2 +
 include/configs/vme8349.h   |  638 +++++++++++++++++++++++++++++++++++++++++++

might want to add a doc/README.vme8349 at some point.

Review line 2

Quoted 4 lines

+++ b/board/esd/vme8349/Makefile

(quoted diff) +2 -0
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2009 esd gmbh hannover germany.

I sincerely doubt esd wrote this file from scratch - please retain original copyrights.

board/esd/vme8349/aduc.c line 6

Quoted 8 lines
board/esd/vme8349/aduc.c new file +7 -0
+++ b/board/esd/vme8349/aduc.c
@@ -0,0 +1,522 @@
+/*
+ * aduc.c -- esd VME8349 board support for aduc848 monitor.
+ * Copyright (c) 2008-2009 esd gmbh.
+ *
+ * Reinhard Arlt <[email protected]>
+ * Based on board/mpc8349emds/mpc8349emds.c (and previous 834x releases.)

this suggests a similar comment to mine above...and, er...there were no 'previous 834x releases' -- that was the first (it was renamed from ads). Now it'sunder board/freescale, btw.

board/esd/vme8349/aduc.c line 70

Quoted 12 lines
board/esd/vme8349/aduc.c new file +12 -0
+static uint8_t aduc_execute_long(uint8_t par0, uint8_t par1, uint8_t cmd, uint32_t timeout)
+{
+	uint32_t l;
+	unsigned char cmmd[8];
+
+	cmmd[0] = 0;
+	cmmd[1] = 3;
+	cmmd[2] = par0;
+	cmmd[3] = par1;
+	cmmd[4] = cmd;
+
+	if (i2c_write(0x78, 0x40, 1, (unsigned char *)cmmd, 5) != 0) {

too many magic numbers...please use macros to define these constants.

board/esd/vme8349/aduc.c line 73

Quoted 3 lines
board/esd/vme8349/aduc.c new file +3 -0
+		printf("i2c_write cmmd failed\n");
+		I2C_SET_BUS(old_bus);
+		return 0xfe;

ditto

board/esd/vme8349/aduc.c line 75

Quoted 2 lines
board/esd/vme8349/aduc.c new file +2 -0
+	}
+	i2c_read(0x78, 0x40, 1, (unsigned char *)cmmd, 1);

ditto

board/esd/vme8349/aduc.c line 78

Quoted 3 lines
board/esd/vme8349/aduc.c new file +3 -0
+	cmmd[0] = 0x00;
+	for (l = 1; (l < timeout) && (cmmd[0] == 0); l++) {
+		if (i2c_read(0x78, 0x40, 1, (unsigned char *)cmmd, 1) != 0) {

ditto..you get the idea

board/esd/vme8349/aduc.c line 94

Quoted 4 lines
board/esd/vme8349/aduc.c new file +4 -0
+static uint8_t aduc_execute(uint8_t par0, uint8_t par1, uint8_t cmd)
+{
+	return aduc_execute_long(par0, par1, cmd, 600);
+}

don't see the purpose of this - rename aduc_execute_long() to aduc_execute(), after having swallowed the default timeout value?

board/esd/vme8349/aduc.c line 101

Quoted 6 lines
board/esd/vme8349/aduc.c new file +6 -0
+int aduc_download_block(unsigned long addr, unsigned long len)
+{
+	unsigned char buf[10];
+	unsigned long m;
+
+	m      = addr;

m = addr;

add a newline if you feel that it 'looks misaligned' (I don't).

board/esd/vme8349/aduc.c line 137

Quoted 13 lines
board/esd/vme8349/aduc.c new file +13 -0
+	for (m = 0; m < 50; m++) {
+		if (i2c_read(0x78, 0x40, 1, buf, 1) != 0) {
+			printf("i2c_read status failed\n");
+			return 3;
+		}
+		if (buf[0] == 0xff)
+			udelay(100000);
+		else if (buf[0] == 0)
+			return 0;
+		else
+			return 4;
+	}
+	return 5;

not reached? wait, does that loop ever execute more than once? please clean this up.

board/esd/vme8349/aduc.c line 145

Quoted 6 lines
board/esd/vme8349/aduc.c new file +6 -0
+int do_show_aduc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	uchar buf[32];
+	int   old_bus;
+
+	old_bus = I2C_GET_BUS();

can add assignment to declaration above

board/esd/vme8349/aduc.c line 149

Quoted 4 lines
board/esd/vme8349/aduc.c new file +4 -0
+	I2C_SET_BUS(1);
+
+	if (i2c_read(0x78, 0, 1, buf, 32) != 0) {
+		printf("Error reading from ADUC\n");

no error return?

Quoted 15 lines
board/esd/vme8349/aduc.c new file +15 -0
+int do_cmd_aduc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	uint8_t par0, par1, cmd, stat;
+
+	if (argc < 4) {
+		puts("Missing parameter\n");
+		return 1;
+	}
+
+	par0 = simple_strtoul(argv[1], NULL, 16);
+	par1 = simple_strtoul(argv[2], NULL, 16);
+	cmd  = simple_strtoul(argv[3], NULL, 16);
+
+	printf("%02x %02x %02x\n", par0, par1, cmd);
+

board/esd/vme8349/aduc.c line 210

Quoted 10 lines
board/esd/vme8349/aduc.c new file +10 -0
+	old_bus = I2C_GET_BUS();
+	I2C_SET_BUS(1);
+
+	stat = aduc_execute(par0, par1, cmd);
+
+	printf("\n");
+	if (stat != 0x01)
+		printf("Got status %02x\n", stat);
+	I2C_SET_BUS(old_bus);
+	return 0;

blank line before the return please.

did you also want to return stat?

board/esd/vme8349/aduc.c line 90

Quoted 3 lines
board/esd/vme8349/aduc.c new file +3 -0
+}
+
+

take one from here :)

board/esd/vme8349/aduc.c line 221

Quoted 8 lines
board/esd/vme8349/aduc.c new file +8 -0
+int do_fpga_aduc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	uint8_t              stat;
+	uint8_t              buffer[512 + 16];
+	unsigned long        addr;
+	unsigned long        size;
+	const unsigned char *fpgadata;
+	int                  i, index, len;

please don't align declarations like this - if a type is added with a longer name, all lines have to be modified, reducing patch reviewability. Some vars can be regrouped on the same line here, too.

Review line 97

Quoted 2 lines
(quoted diff) +2 -0
+	fpgadata = (const unsigned char *)addr;
+/* display infos on fpgaimage */

alignment. fyi, "infos" is franglais. In English, it's just "info".

board/esd/vme8349/aduc.c line 250

Quoted 8 lines
board/esd/vme8349/aduc.c new file +8 -0
+	index = 15;
+	for (i = 0; i < 4; i++) {
+		len = fpgadata[index];
+		printf("FPGA: %s\n", &(fpgadata[index + 1]));
+		index += len + 3;
+	}
+
+/* search for preamble 0xFFFFFFFF */

alignment

Review line 107

Quoted 2 lines
(quoted diff) +2 -0
+	I2C_SET_BUS(old_bus);
+	return 0;

blank line before return please

board/esd/vme8349/aduc.c line 318

Quoted 1 line
board/esd/vme8349/aduc.c new file +1 -0
+int do_image_aduc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])

there is a lot of code this function has in common with do_fpga_aduc()
- please refactor.

board/esd/vme8349/aduc.c line 482

Quoted 11 lines
board/esd/vme8349/aduc.c new file +11 -0
+int do_load_aduc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	int                  slot;
+	uint8_t              stat;
+
+	slot = simple_strtoul(argv[1], NULL, 16);
+
+	old_bus = I2C_GET_BUS();
+	I2C_SET_BUS(1);
+
+/* Load slot from FLASH to FPGA */

alignment

board/esd/vme8349/aduc.c line 490

Quoted 8 lines
board/esd/vme8349/aduc.c new file +8 -0
+	stat = aduc_execute_long(slot, 0x00, 0x04, 30000);
+	printf("\n");
+	if (stat != 0x01) {
+		printf("Got status at LOAD_SLOT:%02x\n", stat);
+		I2C_SET_BUS(old_bus);
+		return 1;
+	}
+	I2C_SET_BUS(old_bus);

insert blank line here please

Review line 128

Quoted 1 line
(quoted diff) +1 -0
+	return 0;

if aduc_execute returns 0 on success, just make the stat check do the printf, set the bus to the old bus once, and return stat.

board/esd/vme8349/caddy.c line 83

Quoted 10 lines
board/esd/vme8349/caddy.c +8 -0
 
+	while (ctrlc() == 0) {
+		if (caddy_interface->cmd_in != caddy_interface->cmd_out) {
+			CADDY_CMD *caddy_cmd;
+			uint32_t   result[5];
+			uint16_t   data16;
+			uint8_t    data8;
+			uint32_t   status;
+			pci_dev_t  dev;

regroup, don't align.

would it be easier to read if these were at the top level of the function (here and elsewhere)?

board/esd/vme8349/caddy.c line 89

Quoted 5 lines
board/esd/vme8349/caddy.c +5 -0
+			result[0] = 0;
+			result[1] = 0;
+			result[2] = 0;
+			result[3] = 0;
+			result[4] = 0;

memset?

Quoted 42 lines
board/esd/vme8349/caddy.c +5 -0
+U_BOOT_CMD(
+	caddy,	2,	0,	do_caddy,
+	"Start Caddy server.",
+	"Start Caddy server with Data structure a given addr\n"
+	);
board/esd/vme8349/caddy.h +33 -0
 
+typedef enum {
+	CADDY_CMD_IO_READ_8,
+	CADDY_CMD_IO_READ_16,
+	CADDY_CMD_IO_READ_32,
+	CADDY_CMD_IO_WRITE_8,
+	CADDY_CMD_IO_WRITE_16,
+	CADDY_CMD_IO_WRITE_32,
+	CADDY_CMD_CONFIG_READ_8,
+	CADDY_CMD_CONFIG_READ_16,
+	CADDY_CMD_CONFIG_READ_32,
+	CADDY_CMD_CONFIG_WRITE_8,
+	CADDY_CMD_CONFIG_WRITE_16,
+	CADDY_CMD_CONFIG_WRITE_32,
+} CADDY_CMDS;
+
+
+typedef struct {
+	uint32_t cmd;
+	uint32_t issue;
+	uint32_t addr;
+	uint32_t par[5];
+} CADDY_CMD;
+
+typedef struct {
+	uint32_t answer;
+	uint32_t issue;
+	uint32_t status;
+	uint32_t par[5];
+} CADDY_ANSWER;
+
+typedef struct {
+	uint8_t  magic[16];
+	uint32_t cmd_in;

board/esd/vme8349/caddy.h line 76

Quoted 10 lines
board/esd/vme8349/caddy.h +10 -0
+	uint32_t cmd_out;
+	uint32_t heartbeat;
+	uint32_t reserved1;
+	CADDY_CMD cmd[CMD_SIZE];
+	uint32_t answer_in;
+	uint32_t answer_out;
+	uint32_t reserved2;
+	uint32_t reserved3;
+	CADDY_ANSWER answer[CMD_SIZE];
+} CADDY_INTERFACE;

please remove all typedefs (see CodingStyle Ch. 5). Use 'struct xxx' in each instance instead.

board/esd/vme8349/caddy.h line 2

Quoted 4 lines

+++ b/board/esd/vme8349/config.mk

board/esd/vme8349/caddy.h +2 -0
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2009 esd gmbh hannover germany.

please respect the original copyright holder(s).

board/esd/vme8349/pci.c line 47

Quoted 10 lines
board/esd/vme8349/pci.c +8 -0
 
+#ifdef CONFIG_PCI
+
+/* System RAM mapped to PCI space */
+#define CONFIG_PCI_SYS_MEM_BUS	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_PCI_SYS_MEM_PHYS	CONFIG_SYS_SDRAM_BASE
+
+#ifndef CONFIG_PCI_PNP
+static struct pci_config_table pci_mpc8349emds_config_table[] = {

please convert to use 83XX_GENERIC_PCI code.

board/esd/vme8349/vme8349.c line 3

Quoted 9 lines
board/esd/vme8349/vme8349.c new file +3 -0
new file mode 100644
index 0000000..cd3d684
@@ -0,0 +1,129 @@
+/*
+ * vme8349.c -- esd VME8349 board support.
+ * Copyright (c) 2008-2009 esd gmbh.

respect original copyright holders please

drivers/pci/pci_auto.c int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev) · line 407

Quoted 10 lines
drivers/pci/pci_auto.c +1 -0
index c20b981..393e44d 100644
@@ -403,6 +403,7 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 		       PCI_DEV(dev));
 		break;
 #endif
+#ifndef CONFIG_VME8349
 #ifdef CONFIG_MPC834X

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

I don't know - this might need to be changed to ifdef CONFIG_MPC8349EMDS...

drivers/pci/pci_auto.c line 6

Quoted 10 lines
drivers/pci/pci_auto.c +7 -0
 	case PCI_CLASS_BRIDGE_OTHER:
 		/*
+++ b/include/configs/vme8349.h
@@ -0,0 +1,638 @@
+/*
+ * esd vme8349 U-Boot configuration file.
+ * Copyright (c) 2008, 2009 esd gmbh Hannover Germany
+ *
+ * reinhard.arlt at esd-electronics.cd
+ * Based on the MPC8349EMDS config.

right, but you didn't carry the copyrights with the code :(.

drivers/pci/pci_auto.c line 12

Quoted 6 lines
drivers/pci/pci_auto.c +6 -0
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_E300		1	/* E300 Family */
+#define CONFIG_MPC83XX		1	/* MPC83XX family */
+#define CONFIG_MPC834X		1	/* MPC834X family */

this is now CONFIG_MPC83xx. please rebase on top of u-boot-mpc83xx' next branch.

drivers/pci/pci_auto.c line 14

Quoted 2 lines
drivers/pci/pci_auto.c +2 -0
+/* System IO Config */
+#define CONFIG_SYS_SICRH SICRH_TSOBI1

I'm guessing this is copied and should be 0 (see latest commit on mpc83xx' master).

Quoted 4 lines
drivers/pci/pci_auto.c +4 -0
+/*
+ * Environment Configuration
+ */
+#define CONFIG_ENV_OVERWRITE

drivers/pci/pci_auto.c line 28

Quoted 10 lines
drivers/pci/pci_auto.c +10 -0
+
+#if defined(CONFIG_TSEC_ENET)
+#define CONFIG_HAS_ETH0
+#define CONFIG_ETHADDR		00:a0:1e:a0:13:8d
+#define CONFIG_HAS_ETH1
+#define CONFIG_ETH1ADDR		00:a0:1e:a0:13:8e
+#endif
+
+#define CONFIG_IPADDR		192.168.1.234
+

we don't hardcode mac & ip addresses any more - please remove.

Thanks,

Kim

#2 lore raw

PATCH 1/1 mpc83xx: Add esd VME8349 board support

Kim,

Quoted 28 lines · On Thursday 11 June 2009 17:15:48 Kim Phillips wrote:

On Wed, 10 Jun 2009 19:09:48 +0200

Quoted 23 lines · Stefan Roese

From: Reinhard Arlt <[email protected]>

From: Reinhard Arlt <[email protected]>

This patch adds support for the esd VME8349 board equipped with the MPC8349. It's a VME PMC carrier board equipped with the Tundra TSI148 VME-bridge.

---
 MAINTAINERS                 |    2 +
 MAKEALL                     |    1 +
 Makefile                    |    2 +
 board/esd/vme8349/Makefile  |   49 ++++
 board/esd/vme8349/aduc.c    |  522 +++++++++++++++++++++++++++++++++++
 board/esd/vme8349/caddy.c   |  203 ++++++++++++++
 board/esd/vme8349/caddy.h   |   78 ++++++
 board/esd/vme8349/config.mk |   27 ++
 board/esd/vme8349/pci.c     |  409 +++++++++++++++++++++++++++
 board/esd/vme8349/vme8349.c |  129 +++++++++
 drivers/pci/pci_auto.c      |    2 +
 include/configs/vme8349.h   |  638
Quoted 1 line

+++++++++++++++++++++++++++++++++++++++++++

Quoted 1 line

might want to add a doc/README.vme8349 at some point.

Currently not planned. I have to admit that I usually don't add such a readme. It's not an evaluation board after all.

Quoted 7 lines

Review line 2

Quoted 4 lines

+++ b/board/esd/vme8349/Makefile

(quoted diff) +2 -0
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2009 esd gmbh hannover germany.

I sincerely doubt esd wrote this file from scratch - please retain original copyrights.

OK, will do.

Quoted 5 lines
Quoted 5 lines
board/esd/vme8349/aduc.c new file +4 -0
+++ b/board/esd/vme8349/aduc.c
@@ -0,0 +1,522 @@
+/*
+ * aduc.c -- esd VME8349 board support for aduc848 monitor.
+ * Copyright (c) 2008-2009 esd gmbh.
Quoted 8 lines
Quoted 4 lines
board/esd/vme8349/aduc.c new file +3 -0
+ *
+ * Reinhard Arlt <[email protected]>
+ * Based on board/mpc8349emds/mpc8349emds.c (and previous 834x

releases.)

this suggests a similar comment to mine above...and, er...there were no 'previous 834x releases' -- that was the first (it was renamed from ads). Now it'sunder board/freescale, btw.

This file written from scratch. Only the copyright header was copied. I'll clean up the header in the next version.

Quoted 6 lines
Quoted 6 lines

+static uint8_t aduc_execute_long(uint8_t par0, uint8_t par1, uint8_t cmd, uint32_t timeout) +{

board/esd/vme8349/aduc.c new file +4 -0
+	uint32_t l;
+	unsigned char cmmd[8];
+
+	cmmd[0] = 0;
Quoted 8 lines

board/esd/vme8349/aduc.c line 70

Quoted 6 lines
board/esd/vme8349/aduc.c new file +6 -0
+	cmmd[1] = 3;
+	cmmd[2] = par0;
+	cmmd[3] = par1;
+	cmmd[4] = cmd;
+
+	if (i2c_write(0x78, 0x40, 1, (unsigned char *)cmmd, 5) != 0) {

too many magic numbers...please use macros to define these constants.

All your comments to this file are valid remarks. Thanks. This file was work- in-progress at the time I first published the patches. I'll remove this file in the next version. It will be added when its finally finished.

<snip>

Quoted 13 lines

board/esd/vme8349/caddy.c line 83

Quoted 10 lines
board/esd/vme8349/caddy.c +8 -0
 
+	while (ctrlc() == 0) {
+		if (caddy_interface->cmd_in != caddy_interface->cmd_out) {
+			CADDY_CMD *caddy_cmd;
+			uint32_t   result[5];
+			uint16_t   data16;
+			uint8_t    data8;
+			uint32_t   status;
+			pci_dev_t  dev;

regroup, don't align.

Quoted 2 lines

would it be easier to read if these were at the top level of the function (here and elsewhere)?

OK, will change.

Quoted 7 lines

board/esd/vme8349/caddy.c line 89

Quoted 5 lines
board/esd/vme8349/caddy.c +5 -0
+			result[0] = 0;
+			result[1] = 0;
+			result[2] = 0;
+			result[3] = 0;
+			result[4] = 0;

memset?

Yes.

Quoted 47 lines
Quoted 47 lines
board/esd/vme8349/caddy.c +5 -0
+U_BOOT_CMD(
+	caddy,	2,	0,	do_caddy,
+	"Start Caddy server.",
+	"Start Caddy server with Data structure a given addr\n"
+	);
board/esd/vme8349/caddy.h +38 -0
 
+typedef enum {
+	CADDY_CMD_IO_READ_8,
+	CADDY_CMD_IO_READ_16,
+	CADDY_CMD_IO_READ_32,
+	CADDY_CMD_IO_WRITE_8,
+	CADDY_CMD_IO_WRITE_16,
+	CADDY_CMD_IO_WRITE_32,
+	CADDY_CMD_CONFIG_READ_8,
+	CADDY_CMD_CONFIG_READ_16,
+	CADDY_CMD_CONFIG_READ_32,
+	CADDY_CMD_CONFIG_WRITE_8,
+	CADDY_CMD_CONFIG_WRITE_16,
+	CADDY_CMD_CONFIG_WRITE_32,
+} CADDY_CMDS;
+
+
+typedef struct {
+	uint32_t cmd;
+	uint32_t issue;
+	uint32_t addr;
+	uint32_t par[5];
+} CADDY_CMD;
+
+typedef struct {
+	uint32_t answer;
+	uint32_t issue;
+	uint32_t status;
+	uint32_t par[5];
+} CADDY_ANSWER;
+
+typedef struct {
+	uint8_t  magic[16];
+	uint32_t cmd_in;
+	uint32_t cmd_out;
+	uint32_t heartbeat;
+	uint32_t reserved1;
+	CADDY_CMD cmd[CMD_SIZE];
+	uint32_t answer_in;
Quoted 8 lines

board/esd/vme8349/caddy.h line 76

Quoted 5 lines
board/esd/vme8349/caddy.h +5 -0
+	uint32_t answer_out;
+	uint32_t reserved2;
+	uint32_t reserved3;
+	CADDY_ANSWER answer[CMD_SIZE];
+} CADDY_INTERFACE;

please remove all typedefs (see CodingStyle Ch. 5). Use 'struct xxx' in each instance instead.

We really would like to keep these typedefs. The reason for this is that multiple customers already are using this header for their work. And maintaining multiple versions of this file doesn't sound like a good idea.

Quoted 6 lines

board/esd/vme8349/caddy.h line 2

Quoted 4 lines

+++ b/board/esd/vme8349/config.mk

board/esd/vme8349/caddy.h +2 -0
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2009 esd gmbh hannover germany.

please respect the original copyright holder(s).

OK.

Quoted 12 lines

board/esd/vme8349/pci.c line 47

Quoted 10 lines
board/esd/vme8349/pci.c +8 -0
 
+#ifdef CONFIG_PCI
+
+/* System RAM mapped to PCI space */
+#define CONFIG_PCI_SYS_MEM_BUS	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_PCI_SYS_MEM_PHYS	CONFIG_SYS_SDRAM_BASE
+
+#ifndef CONFIG_PCI_PNP
+static struct pci_config_table pci_mpc8349emds_config_table[] = {

please convert to use 83XX_GENERIC_PCI code.

OK, will try in next version.

Quoted 11 lines

board/esd/vme8349/vme8349.c line 3

Quoted 9 lines
board/esd/vme8349/vme8349.c new file +3 -0
new file mode 100644
index 0000000..cd3d684
@@ -0,0 +1,129 @@
+/*
+ * vme8349.c -- esd VME8349 board support.
+ * Copyright (c) 2008-2009 esd gmbh.

respect original copyright holders please

OK.

Quoted 13 lines

drivers/pci/pci_auto.c int pciauto_config_device(struct pci_controller · line 407

Quoted 10 lines
drivers/pci/pci_auto.c +1 -0
index c20b981..393e44d 100644
@@ -403,6 +403,7 @@ int pciauto_config_device(struct pci_controller
 *hose, pci_dev_t dev) PCI_DEV(dev));
 		break;
 #endif
+#ifndef CONFIG_VME8349
 #ifdef CONFIG_MPC834X

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

Quoted 2 lines

I don't know - this might need to be changed to ifdef CONFIG_MPC8349EMDS...

Should I change this to CONFIG_MPC8349EMDS? Or use

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

for now?

Quoted 4 lines
Quoted 4 lines
drivers/pci/pci_auto.c +1 -0
 	case PCI_CLASS_BRIDGE_OTHER:
 		/*
+++ b/include/configs/vme8349.h
@@ -0,0 +1,638 @@
Quoted 8 lines

drivers/pci/pci_auto.c line 6

Quoted 6 lines
drivers/pci/pci_auto.c +6 -0
+/*
+ * esd vme8349 U-Boot configuration file.
+ * Copyright (c) 2008, 2009 esd gmbh Hannover Germany
+ *
+ * reinhard.arlt at esd-electronics.cd
+ * Based on the MPC8349EMDS config.

right, but you didn't carry the copyrights with the code :(.

Will fix.

Quoted 9 lines

drivers/pci/pci_auto.c line 12

Quoted 6 lines
drivers/pci/pci_auto.c +6 -0
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_E300		1	/* E300 Family */
+#define CONFIG_MPC83XX		1	/* MPC83XX family */
+#define CONFIG_MPC834X		1	/* MPC834X family */

this is now CONFIG_MPC83xx. please rebase on top of u-boot-mpc83xx' next branch.

OK.

Quoted 5 lines

drivers/pci/pci_auto.c line 14

Quoted 2 lines
drivers/pci/pci_auto.c +2 -0
+/* System IO Config */
+#define CONFIG_SYS_SICRH SICRH_TSOBI1

I'm guessing this is copied and should be 0 (see latest commit on mpc83xx' master).

I'm guessing as well. Will change.

Quoted 8 lines
Quoted 8 lines
drivers/pci/pci_auto.c +8 -0
+/*
+ * Environment Configuration
+ */
+#define CONFIG_ENV_OVERWRITE
+
+#if defined(CONFIG_TSEC_ENET)
+#define CONFIG_HAS_ETH0
+#define CONFIG_ETHADDR		00:a0:1e:a0:13:8d
Quoted 8 lines

drivers/pci/pci_auto.c line 28

Quoted 6 lines
drivers/pci/pci_auto.c +6 -0
+#define CONFIG_HAS_ETH1
+#define CONFIG_ETH1ADDR		00:a0:1e:a0:13:8e
+#endif
+
+#define CONFIG_IPADDR		192.168.1.234
+

we don't hardcode mac & ip addresses any more - please remove.

Ups. Missed this. Will remove.

Thanks for your review Kim. I'll send a new version soon.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#3 lore raw

PATCH 1/1 mpc83xx: Add esd VME8349 board support

Quoted 4 lines · On Tue, 21 Jul 2009 11:38:31 +0200 Stefan Roese <[email protected]> wrote:
Quoted 1 line

might want to add a doc/README.vme8349 at some point.

Currently not planned. I have to admit that I usually don't add such a readme. It's not an evaluation board after all.

your call - the board will be easier to maintain provided the intended memory map, etc.

Quoted 49 lines
Quoted 40 lines
Quoted 40 lines
board/esd/vme8349/caddy.h +38 -0
 
+typedef enum {
+	CADDY_CMD_IO_READ_8,
+	CADDY_CMD_IO_READ_16,
+	CADDY_CMD_IO_READ_32,
+	CADDY_CMD_IO_WRITE_8,
+	CADDY_CMD_IO_WRITE_16,
+	CADDY_CMD_IO_WRITE_32,
+	CADDY_CMD_CONFIG_READ_8,
+	CADDY_CMD_CONFIG_READ_16,
+	CADDY_CMD_CONFIG_READ_32,
+	CADDY_CMD_CONFIG_WRITE_8,
+	CADDY_CMD_CONFIG_WRITE_16,
+	CADDY_CMD_CONFIG_WRITE_32,
+} CADDY_CMDS;
+
+
+typedef struct {
+	uint32_t cmd;
+	uint32_t issue;
+	uint32_t addr;
+	uint32_t par[5];
+} CADDY_CMD;
+
+typedef struct {
+	uint32_t answer;
+	uint32_t issue;
+	uint32_t status;
+	uint32_t par[5];
+} CADDY_ANSWER;
+
+typedef struct {
+	uint8_t  magic[16];
+	uint32_t cmd_in;
+	uint32_t cmd_out;
+	uint32_t heartbeat;
+	uint32_t reserved1;
+	CADDY_CMD cmd[CMD_SIZE];
+	uint32_t answer_in;
Quoted 8 lines

board/esd/vme8349/caddy.h line 76

Quoted 5 lines
board/esd/vme8349/caddy.h +5 -0
+	uint32_t answer_out;
+	uint32_t reserved2;
+	uint32_t reserved3;
+	CADDY_ANSWER answer[CMD_SIZE];
+} CADDY_INTERFACE;

please remove all typedefs (see CodingStyle Ch. 5). Use 'struct xxx' in each instance instead.

Quoted 3 lines

We really would like to keep these typedefs. The reason for this is that multiple customers already are using this header for their work. And maintaining multiple versions of this file doesn't sound like a good idea.

eh? It's a straight violation of CodingStyle and makes the code hard to read; STUFF_IN_CAPS to me read as defines, and anyway, typedefs, assuming CodingStyle liked them, would be appended with _t. But these need to be defined as 'struct <name>', and used in such a way.

Can't they write a header wrapper for "their work"? Can you make them realize they won't need to be wasting time on such effort if they submit the remainder of their code upstream?

Quoted 13 lines
Quoted 13 lines

drivers/pci/pci_auto.c int pciauto_config_device(struct pci_controller · line 407

Quoted 10 lines
drivers/pci/pci_auto.c +1 -0
index c20b981..393e44d 100644
@@ -403,6 +403,7 @@ int pciauto_config_device(struct pci_controller
 *hose, pci_dev_t dev) PCI_DEV(dev));
 		break;
 #endif
+#ifndef CONFIG_VME8349
 #ifdef CONFIG_MPC834X

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

Quoted 8 lines
Quoted 2 lines

I don't know - this might need to be changed to ifdef CONFIG_MPC8349EMDS...

Should I change this to CONFIG_MPC8349EMDS? Or use

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

for now?

hmm...based on commit 6902df56a0b493f369153b09d11afcd74a580561 "Add PCI support for the TQM834x board.", it should really be ifdef CONFIG_TQM834x...but what does the VME8349 do? does it want to define CONFIG_PCIAUTO_SKIP_HOST_BRIDGE instead?

Kim

#4 lore raw

PATCH 1/1 mpc83xx: Add esd VME8349 board support

Quoted 54 lines · On Tuesday 21 July 2009 21:08:25 Kim Phillips wrote:
Quoted 49 lines
Quoted 40 lines
Quoted 40 lines
board/esd/vme8349/caddy.h +38 -0
 
+typedef enum {
+	CADDY_CMD_IO_READ_8,
+	CADDY_CMD_IO_READ_16,
+	CADDY_CMD_IO_READ_32,
+	CADDY_CMD_IO_WRITE_8,
+	CADDY_CMD_IO_WRITE_16,
+	CADDY_CMD_IO_WRITE_32,
+	CADDY_CMD_CONFIG_READ_8,
+	CADDY_CMD_CONFIG_READ_16,
+	CADDY_CMD_CONFIG_READ_32,
+	CADDY_CMD_CONFIG_WRITE_8,
+	CADDY_CMD_CONFIG_WRITE_16,
+	CADDY_CMD_CONFIG_WRITE_32,
+} CADDY_CMDS;
+
+
+typedef struct {
+	uint32_t cmd;
+	uint32_t issue;
+	uint32_t addr;
+	uint32_t par[5];
+} CADDY_CMD;
+
+typedef struct {
+	uint32_t answer;
+	uint32_t issue;
+	uint32_t status;
+	uint32_t par[5];
+} CADDY_ANSWER;
+
+typedef struct {
+	uint8_t  magic[16];
+	uint32_t cmd_in;
+	uint32_t cmd_out;
+	uint32_t heartbeat;
+	uint32_t reserved1;
+	CADDY_CMD cmd[CMD_SIZE];
+	uint32_t answer_in;
Quoted 8 lines

board/esd/vme8349/caddy.h line 76

Quoted 5 lines
board/esd/vme8349/caddy.h +5 -0
+	uint32_t answer_out;
+	uint32_t reserved2;
+	uint32_t reserved3;
+	CADDY_ANSWER answer[CMD_SIZE];
+} CADDY_INTERFACE;

please remove all typedefs (see CodingStyle Ch. 5). Use 'struct xxx' in each instance instead.

Quoted 4 lines

We really would like to keep these typedefs. The reason for this is that multiple customers already are using this header for their work. And maintaining multiple versions of this file doesn't sound like a good idea.

Quoted 8 lines

eh? It's a straight violation of CodingStyle and makes the code hard to read; STUFF_IN_CAPS to me read as defines, and anyway, typedefs, assuming CodingStyle liked them, would be appended with _t. But these need to be defined as 'struct <name>', and used in such a way.

Can't they write a header wrapper for "their work"? Can you make them realize they won't need to be wasting time on such effort if they submit the remainder of their code upstream?

OK, "typedefs" removed in next patch version.

Quoted 18 lines
Quoted 18 lines
Quoted 13 lines

drivers/pci/pci_auto.c int pciauto_config_device(struct pci_controller · line 407

Quoted 10 lines
drivers/pci/pci_auto.c +1 -0
index c20b981..393e44d 100644
@@ -403,6 +403,7 @@ int pciauto_config_device(struct pci_controller
 *hose, pci_dev_t dev) PCI_DEV(dev));
 		break;
 #endif
+#ifndef CONFIG_VME8349
 #ifdef CONFIG_MPC834X

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

Quoted 2 lines

I don't know - this might need to be changed to ifdef CONFIG_MPC8349EMDS...

Should I change this to CONFIG_MPC8349EMDS? Or use

Quoted 8 lines
Quoted 3 lines

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

for now?

hmm...based on commit 6902df56a0b493f369153b09d11afcd74a580561 "Add PCI support for the TQM834x board.", it should really be ifdef CONFIG_TQM834x...but what does the VME8349 do? does it want to define CONFIG_PCIAUTO_SKIP_HOST_BRIDGE instead?

No. From what I know, this code in question is for some earlier MPC834x chip revisions. The comment in the code also states something like this:

/*
* The host/PCI bridge 1 seems broken in 8349 - it presents
* itself as 'PCI_CLASS_BRIDGE_OTHER' and appears as an _agent_
* device claiming resources io/mem/irq.. we only allow for
* the PIMMR window to be allocated (BAR0 - 1MB size) */

You will probably know this better. If this assumption is correct, it would be best to check for chip revisions and only enable this code for those "buggy" revisions.

Since I can't really tell for sure, and I don't want to change any other 83xx systems, I'll keep

#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)

for now. Otherwise our PCI devices won't get enumerated correctly (e.g. PCI devices with certain PLX bridges).

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#5 lore raw

PATCH 1/1 mpc83xx: Add esd VME8349 board support

In reply to Stefan Roese

Dear Stefan Roese,

In message <[email protected]> you wrote:
...

Quoted 31 lines
Quoted 22 lines
Quoted 22 lines
board/esd/vme8349/caddy.h new file +22 -0
+typedef struct {
+	uint32_t cmd;
+	uint32_t issue;
+	uint32_t addr;
+	uint32_t par[5];
+} CADDY_CMD;
+
+typedef struct {
+	uint32_t answer;
+	uint32_t issue;
+	uint32_t status;
+	uint32_t par[5];
+} CADDY_ANSWER;
+
+typedef struct {
+	uint8_t  magic[16];
+	uint32_t cmd_in;
+	uint32_t cmd_out;
+	uint32_t heartbeat;
+	uint32_t reserved1;
+	CADDY_CMD cmd[CMD_SIZE];
+	uint32_t answer_in;
Quoted 8 lines

board/esd/vme8349/caddy.h line 76

Quoted 5 lines
board/esd/vme8349/caddy.h new file +5 -0
+	uint32_t answer_out;
+	uint32_t reserved2;
+	uint32_t reserved3;
+	CADDY_ANSWER answer[CMD_SIZE];
+} CADDY_INTERFACE;

please remove all typedefs (see CodingStyle Ch. 5). Use 'struct xxx' in each instance instead.

Quoted 3 lines

We really would like to keep these typedefs. The reason for this is that multiple customers already are using this header for their work. And maintaining multiple versions of this file doesn't sound like a good idea.

Kim is right here. The code is violating the Coding Style and needs to be cleaned up.

Eventually you should submit your code for review on the ML before delivering it to customers ;-)

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Why is an average signature file longer than an average Perl script??