Skip to contentSkip to conversation

mpc83xx: Add esd VME8349 board support

PATCH Superseded Stefan Roese 4 participants 5 messages Jul 24, 2009

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mpc83xx: Add esd VME8349 board support

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.

---
v2:
- respect the original copyright holder(s)
- typedefs in caddy.h removed
- aduc.c removed
- memset used
- converted to use 83XX_GENERIC_PCI code
- CONFIG_SYS_SICRH set to 0
- hardcoded MAC and IP addresses removed

 MAINTAINERS                 |    2 +
 MAKEALL                     |    1 +
 Makefile                    |    2 +
 board/esd/vme8349/Makefile  |   54 ++++
 board/esd/vme8349/caddy.c   |  199 ++++++++++++++
 board/esd/vme8349/caddy.h   |   77 ++++++
 board/esd/vme8349/config.mk |   28 ++
 board/esd/vme8349/pci.c     |  119 ++++++++
 board/esd/vme8349/vme8349.c |  139 ++++++++++
 drivers/pci/pci_auto.c      |    2 +-
 include/configs/vme8349.h   |  638 +++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 1260 insertions(+), 1 deletions(-)
 create mode 100644 board/esd/vme8349/Makefile
 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 17b2f9c..45f5f26 100644
@@ -32,6 +32,8 @@ Reinhard Arlt <[email protected]>
 	mecp5200	MPC5200
 	pf5200		MPC5200
 
+	vme8349		MPC8349
+
 	CPCI750		PPC750FX/GX
 
 Yuli Barcohen <[email protected]>
MAKEALL +1 -0
index d38904a..b3927d5 100755
@@ -362,6 +362,7 @@ LIST_83xx="		\
 	sbc8349		\
 	SIMPC8313_LP	\
 	TQM834x		\
+	vme8349		\
 "
 
 
Makefile +2 -0
index 2320db6..f710b6f 100644
@@ -2371,6 +2371,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 +54 -0

54 lines not on this page · raw message

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

199 lines not on this page · raw message

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

77 lines not on this page · raw message

board/esd/vme8349/config.mk new file +28 -0
new file mode 100644
index 0000000..1ae26ca
@@ -0,0 +1,28 @@
+#
+# (C) Copyright 2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# 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 +119 -0

119 lines not on this page · raw message

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

139 lines not on this page · raw message

drivers/pci/pci_auto.c +1 -1
index 35c82b9..82e4eed 100644
@@ -403,7 +403,7 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 		       PCI_DEV(dev));
 		break;
 #endif
-#ifdef CONFIG_MPC834x
+#if defined(CONFIG_MPC834x) && !defined(CONFIG_VME8349)
 	case PCI_CLASS_BRIDGE_OTHER:
 		/*
 		 * The host/PCI bridge 1 seems broken in 8349 - it presents
include/configs/vme8349.h new file +638 -0

638 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v2 1/1 mpc83xx: Add esd VME8349 board support

Dear Stefan Roese,

Quoted 9 lines · In message <[email protected]> you wrote:

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 2 lines
board/esd/vme8349/caddy.c new file +2 -0
+int do_caddy(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{

...

board/esd/vme8349/caddy.c line 96

Quoted 10 lines
board/esd/vme8349/caddy.c new file +10 -0
+			switch (caddy_cmd->cmd) {
+			case CADDY_CMD_IO_READ_8:
+				result[0] = in_8((void *)CONFIG_SYS_PCI1_IO_PHYS +
+						 (caddy_cmd->addr & 0x001fffff));
+				generate_answer(caddy_cmd, status, &result[0]);
+				break;
+			case CADDY_CMD_IO_READ_16:
+				result[0] = in_be16((void *)CONFIG_SYS_PCI1_IO_PHYS +
+						    (caddy_cmd->addr & 0x001fffff));
+				generate_answer(caddy_cmd, status, &result[0]);

Can we get rid of these base address plus offset constructs? I would like to get rid of the casts which nullify one of the major benefits of using I/O acessors, i. e. having type checking done by the com- piler.

board/esd/vme8349/caddy.c line 102

Quoted 5 lines
board/esd/vme8349/caddy.c new file +5 -0
+			case CADDY_CMD_IO_READ_32:
+				result[0] = in_be32((void *)CONFIG_SYS_PCI1_IO_PHYS +
+						    (caddy_cmd->addr & 0x001fffff));
+				generate_answer(caddy_cmd, status, &result[0]);
+				break;

Hm... and the code for the CADDY_CMD_IO_READ_*, CADDY_CMD_IO_WRITE_* etc. cases looks always the same, execpt for the access size. Maybe you want to use some macro? Thsi would make the code much easier to read and to maintain.

...

Quoted 6 lines
board/esd/vme8349/vme8349.c new file +0 -0
new file mode 100644
index 0000000..db24a7c
@@ -0,0 +1,139 @@

...

board/esd/vme8349/vme8349.c line 85

Quoted 4 lines
board/esd/vme8349/vme8349.c new file +4 -0
+	im->ddr.sdram_cfg   = 0x63000000;
+	im->ddr.sdram_cfg2  = 0x04061000;
+	im->ddr.sdram_mode  = 0x07940242;
+	im->ddr.sdram_mode2 = 0x00000000;

Maybe you want to use some nice readable constants here instead of hard-coded magic numbers?

Quoted 5 lines
include/configs/vme8349.h new file +0 -0
new file mode 100644
index 0000000..cde98ae

...

include/configs/vme8349.h line 118

Quoted 9 lines
include/configs/vme8349.h new file +9 -0
+#define CONFIG_SYS_DDR_TIMING_0	        0x00220802
+#define CONFIG_SYS_DDR_TIMING_1	        0x39377322
+#define CONFIG_SYS_DDR_TIMING_2	        0x2f9848ca	/* P9-45,may need tuning */
+#define CONFIG_SYS_DDR_TIMING_3	        0x00000000
+#define CONFIG_SYS_DDR_CONTROL		0xc2000000	/* unbuffered,no DYN_PWR */
+#define CONFIG_SYS_DDR_INTERVAL	        0x04060100	/* autocharge,no open page */
+
+/* the default burst length is 4 - for 64-bit data path */
+#define CONFIG_SYS_DDR_MODE		0x00000022	/* DLL,normal,seq,4/2.5, 4 burst len */

Line too long. Please check globally.

Quoted 26 lines
include/configs/vme8349.h new file +26 -0
+#if 1 /*528/264*/
+#define CONFIG_SYS_HRCW_LOW (\
+	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
+	HRCWL_DDR_TO_SCB_CLK_1X1 |\
+	HRCWL_CSB_TO_CLKIN |\
+	HRCWL_VCO_1X2 |\
+	HRCWL_CORE_TO_CSB_2X1)
+#elif 0 /*396/132*/
+#define CONFIG_SYS_HRCW_LOW (\
+	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
+	HRCWL_DDR_TO_SCB_CLK_1X1 |\
+	HRCWL_CSB_TO_CLKIN |\
+	HRCWL_VCO_1X4 |\
+	HRCWL_CORE_TO_CSB_3X1)
+#elif 0 /*264/132*/
+#define CONFIG_SYS_HRCW_LOW (\
+	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
+	HRCWL_DDR_TO_SCB_CLK_1X1 |\
+	HRCWL_CSB_TO_CLKIN |\
+	HRCWL_VCO_1X4 |\
+	HRCWL_CORE_TO_CSB_2X1)
+#elif 0 /*132/132*/
+#define CONFIG_SYS_HRCW_LOW (\
+	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
+	HRCWL_DDR_TO_SCB_CLK_1X1 |\
+	HRCWL_CSB_TO_CLKIN |\

include/configs/vme8349.h line 433

Quoted 10 lines
include/configs/vme8349.h new file +10 -0
+	HRCWL_VCO_1X4 |\
+	HRCWL_CORE_TO_CSB_1X1)
+#elif 0 /*264/264 */
+#define CONFIG_SYS_HRCW_LOW (\
+	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
+	HRCWL_DDR_TO_SCB_CLK_1X1 |\
+	HRCWL_CSB_TO_CLKIN |\
+	HRCWL_VCO_1X4 |\
+	HRCWL_CORE_TO_CSB_1X1)
+#endif

There's a lot of dead code here. Please remove (or move to documentation).

include/configs/vme8349.h line 586

Quoted 3 lines
include/configs/vme8349.h new file +3 -0
+#define CONFIG_SERVERIP		192.168.1.1
+#define CONFIG_GATEWAYIP	192.168.1.1
+#define CONFIG_NETMASK		255.255.255.0

Please do not add network configuration data into the default board config file.

Best regards,

Wolfgang Denk

Signature · 6 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
What is tolerance? -- it is the consequence of humanity. We  are  all
formed  of frailty and error; let us pardon reciprocally each other's
folly -- that is the first law of nature.                  - Voltaire
#2 lore raw

PATCH v2 1/1 mpc83xx: Add esd VME8349 board support

In reply to Stefan Roese
Quoted 8 lines · On Fri, 24 Jul 2009 14:58:16 +0200 Stefan Roese <[email protected]> wrote:

v2:
- respect the original copyright holder(s)
- typedefs in caddy.h removed
- aduc.c removed
- memset used
- converted to use 83XX_GENERIC_PCI code
- CONFIG_SYS_SICRH set to 0
- hardcoded MAC and IP addresses removed

much better, Stefan, thanks, there's WD's comments plus a couple more minor nits below:

board/esd/vme8349/caddy.c line 92

Quoted 11 lines
board/esd/vme8349/caddy.c new file +11 -0
+	while (ctrlc() == 0) {
+		if (caddy_interface->cmd_in != caddy_interface->cmd_out) {
+			memset(result, 0, 5 * sizeof(result[0]));
+			status = 0;
+			caddy_cmd = &caddy_interface->cmd[caddy_interface->cmd_out];
+			switch (caddy_cmd->cmd) {
+			case CADDY_CMD_IO_READ_8:
+				result[0] = in_8((void *)CONFIG_SYS_PCI1_IO_PHYS +
+						 (caddy_cmd->addr & 0x001fffff));
+				generate_answer(caddy_cmd, status, &result[0]);
+				break;

lines too long. WD's suggestions for fixing this up are in order.

board/esd/vme8349/pci.c line 79

Quoted 4 lines
board/esd/vme8349/pci.c new file +4 -0
+	i2c_set_bus_num(1);
+	/* Read the PCI_M66EN jumper setting */
+	if ((i2c_read(CONFIG_SYS_I2C_8574_ADDR2, 0, 0, &reg8, sizeof(reg8)) == 0) ||
+	    (i2c_read(0x38                     , 0, 0, &reg8, sizeof(reg8)) == 0)) {

lines too long.

include/configs/vme8349.h line 279

Quoted 2 lines
include/configs/vme8349.h new file +2 -0
+#define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
+#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057  /* Motorola */

should be Freescale's ID.

Thanks,

Kim

#3 lore raw

PATCH v2 1/1 mpc83xx: Add esd VME8349 board support

Quoted 8 lines · Kim Phillips

include/configs/vme8349.h line 279

Quoted 2 lines · On Fri, 24 Jul 2009 14:58:16 +0200 Stefan Roese <[email protected]> wrote:
include/configs/vme8349.h new file +2 -0
+#define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
+#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057  /* Motorola */

should be Freescale's ID.

Is CONFIG_SYS_PCI_SUBSYS_VENDORID used at all for MPC83XX ports?

Quoted 4 lines

Thanks,

Kim

Best regards,

Reinhard

#4 lore raw

PATCH v2 1/1 mpc83xx: Add esd VME8349 board support

Quoted 11 lines · On Fri, 24 Jul 2009 19:06:04 +0200 Reinhard Arlt…
Quoted 8 lines · Kim Phillips

include/configs/vme8349.h line 279

Quoted 2 lines · On Fri, 24 Jul 2009 14:58:16 +0200 Stefan Roese <[email protected]> wrote:
include/configs/vme8349.h new file +2 -0
+#define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
+#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057  /* Motorola */

should be Freescale's ID.

Is CONFIG_SYS_PCI_SUBSYS_VENDORID used at all for MPC83XX ports?

I thought it were for slave/agent mode, but I see your point. Feel free to omit it completely then.

Kim