Skip to contentSkip to conversation

ppc4xx: Add CATCenter Io 405EP board support

PATCH Superseded Dirk Eibach 4 participants 8 messages Oct 12, 2010 – Oct 13, 2010 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc4xx: Add CATCenter Io 405EP board support

Board support for the Guntermann & Drunck CATCenter Io.

---
 MAKEALL                  |    1 +
 Makefile                 |    3 +
 board/gdsys/io/Makefile  |   51 ++++++++++
 board/gdsys/io/config.mk |   24 +++++
 board/gdsys/io/io.c      |  231 ++++++++++++++++++++++++++++++++++++++++++
 include/configs/io.h     |  251 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 561 insertions(+), 0 deletions(-)
 create mode 100644 board/gdsys/io/Makefile
 create mode 100644 board/gdsys/io/config.mk
 create mode 100644 board/gdsys/io/io.c
 create mode 100644 include/configs/io.h
MAKEALL +1 -0
index 1b506d6..37aeed4 100755
@@ -156,6 +156,7 @@ LIST_4xx="$(boards_by_cpu ppc4xx)
 	haleakala_nand	\
 	hcu4		\
 	hcu5		\
+	io		\
 	intip		\
 	kilauea		\
 	kilauea_nand	\
Makefile +3 -0
index 8df60fa..86f9efa 100644
@@ -1004,6 +1004,9 @@ mcu25_config:  unconfig
 	@mkdir -p $(obj)board/netstal/common
 	@$(MKCONFIG) $@ powerpc ppc4xx $(call lcname,$@) netstal
 
+io_config: unconfig
+	@$(MKCONFIG) $(@:_config=) powerpc ppc4xx io gdsys
+
 # Kilauea & Haleakala images are identical (recognized via PVR)
 kilauea_config \
 haleakala_config: unconfig
board/gdsys/io/Makefile new file +51 -0

51 lines not on this page · raw message

board/gdsys/io/config.mk new file +24 -0
new file mode 100644
index 0000000..1bdf5e4
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# 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
+#
+
+TEXT_BASE = 0xFFFC0000
board/gdsys/io/io.c new file +231 -0

231 lines not on this page · raw message

include/configs/io.h new file +251 -0

251 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 ppc4xx: Add CATCenter Io 405EP board support

Dear Dirk Eibach,

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

Board support for the Guntermann & Drunck CATCenter Io.

---
 MAKEALL                  |    1 +
 Makefile                 |    3 +
 board/gdsys/io/Makefile  |   51 ++++++++++
 board/gdsys/io/config.mk |   24 +++++
 board/gdsys/io/io.c      |  231 ++++++++++++++++++++++++++++++++++++++++++
 include/configs/io.h     |  251 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 561 insertions(+), 0 deletions(-)
 create mode 100644 board/gdsys/io/Makefile
 create mode 100644 board/gdsys/io/config.mk
 create mode 100644 board/gdsys/io/io.c
 create mode 100644 include/configs/io.h

Entry to MAINTAINERS missing.

MAKEALL LIST_4xx="$(boards_by_cpu ppc4xx) · line 162

Quoted 12 lines
MAKEALL +1 -0
index 1b506d6..37aeed4 100755
@@ -156,6 +156,7 @@ LIST_4xx="$(boards_by_cpu ppc4xx)
 	haleakala_nand	\
 	hcu4		\
 	hcu5		\
+	io		\
 	intip		\
 	kilauea		\
 	kilauea_nand	\

Please keep lists sorted.

Makefile mcu25_config: unconfig · line 1009

Quoted 11 lines
Makefile +3 -0
index 8df60fa..86f9efa 100644
@@ -1004,6 +1004,9 @@ mcu25_config:  unconfig
 	@mkdir -p $(obj)board/netstal/common
 	@$(MKCONFIG) $@ powerpc ppc4xx $(call lcname,$@) netstal
 
+io_config: unconfig
+	@$(MKCONFIG) $(@:_config=) powerpc ppc4xx io gdsys
+

NAK. We don't accept entries to Makefile any more. Please add your board description to boards.cfg instead.

And remember to keep lists sorted.

Quoted 6 lines
Makefile +6 -0
+int configure_gbit_phy(unsigned char addr)
+{
+	unsigned short value;
+
+	if (miiphy_write(GBIT_PHY_NAME, addr, 0x16, 0x0002))
+		goto err_out;

Makefile mcu25_config: unconfig

Quoted 10 lines
Makefile +10 -0
+	if (miiphy_write(GBIT_PHY_NAME, addr, 0x1a, 0x800a))
+		goto err_out;
+	if (miiphy_write(GBIT_PHY_NAME, addr, 0x16, 0x0000))
+		goto err_out;
+	if (miiphy_read(GBIT_PHY_NAME, addr, 0x10, &value))
+		goto err_out;
+	if (miiphy_write(GBIT_PHY_NAME, addr, 0x10, value & ~0x0004))
+		goto err_out;
+	if (miiphy_write(GBIT_PHY_NAME, addr, 0x00, 0x9140))
+		goto err_out;

You might want to replace all these magic constants with some #defines, and add some comments what you're actually doing.

Makefile

Quoted 1 line
Makefile +1 -0
+	while (!(in_le16((void *)(CONFIG_SYS_LATCH_BASE + 0x200)) & 0x0010));

Semicolon onnew line, please.

Makefile

Quoted 9 lines
Makefile +9 -0
+	/*
+	 * wait for fpga out of reset
+	 */
+	while (1) {
+		fpga_set_reg(REG_REFELECTION_LOW, REFLECTION_TESTPATTERN);
+		if (fpga_get_reg(REG_REFELECTION_HIGH) ==
+			REFLECTION_TESTPATTERN_INV)
+			break;
+	}

What happens if this loop does not terminate? Maybe a timeout and error message would be helpful?

Makefile

Quoted 8 lines
Makefile +8 -0
+	char *s = getenv("serial#");
+	u16 versions = fpga_get_reg(REG_VERSIONS);
+	u16 fpga_version = fpga_get_reg(REG_FPGA_VERSION);
+	u16 fpga_features = fpga_get_reg(REG_FPGA_FEATURES);
+	unsigned unit_type = (versions & 0xf000) >> 12;
+	unsigned hardware_version = versions & 0x000f;
+	unsigned feature_channels = fpga_features & 0x007f;
+	unsigned feature_expansion = fpga_features & (1<<15);

Please separate declarations and code. A few initializations may be ok, but this is unreadable.

Makefile

Quoted 3 lines
Makefile +3 -0
+	printf(", expansion %ssupported", feature_expansion ? "" : "un");
+
+	puts("\n");

Why not include the newline in the printf() format string ?

include/configs/io.h line 3

Quoted 9 lines
include/configs/io.h new file +3 -0
new file mode 100644
index 0000000..53dce7d
@@ -0,0 +1,251 @@
+/*
+ * (C) Copyright 2009
+ * Dirk Eibach,  Guntermann & Drunck GmbH, eibach at gdsys.de

2009?

+

include/configs/io.h line 71

Quoted 5 lines
include/configs/io.h new file +5 -0
+#define CONFIG_PHY_ADDR		4	/* PHY address			*/
+#define CONFIG_HAS_ETH0
+#define CONFIG_HAS_ETH1
+#define CONFIG_PHY1_ADDR	0xc	/* EMAC1 PHY address		*/
+#define CONFIG_PHY_CLK_FREQ    EMAC_STACR_CLK_66MHZ

Please use TABs for vertical alignment.

include/configs/io.h line 108

Quoted 4 lines
include/configs/io.h new file +4 -0
+/*
+ * I2C stuff
+ */
+#define CONFIG_SYS_I2C_SPEED		100000	/* I2C speed and slave address*/

Comment wrong? I don't see a slave address here.

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
Unix is like a toll road on which you have to stop every 50  feet  to
pay another nickel. But hey! You only feel 5 cents poorer each time.
                 - Larry Wall in <[email protected]>
#2 lore raw

PATCH 1/1 ppc4xx: Add CATCenter Io 405EP board support

In reply to Dirk Eibach

Hi Dirk,

Quoted 1 line · On Tuesday 12 October 2010 15:33:07 Dirk Eibach wrote:

Board support for the Guntermann & Drunck CATCenter Io.

Apart from Wolfgangs comments, some more from myself below.

Quoted 5 lines
include/configs/io.h new file +0 -0
new file mode 100644
index 0000000..53dce7d

<snip>

include/configs/io.h

Quoted 4 lines
include/configs/io.h new file +4 -0
+/* Gbit PHYs */
+#define CONFIG_BITBANGMII		/* bit-bang MII PHY management	*/
+
+#define CONFIG_SYS_MDIO_PIN  (0x80000000 >> 13)	 /* our MDIO is GPIO0 

*/

Quoted 1 line

+#define CONFIG_SYS_MDC_PIN (0x80000000 >> 7) /* our MDC is GPIO7

*/

Quoted 3 lines
include/configs/io.h new file +2 -0
+
+#define MDIO_ACTIVE	out32(GPIO0_TCR, in32(GPIO0_TCR) |

CONFIG_SYS_MDIO_PIN)

Use out_be32() accessors here and below.

Please fix and resubmit. Thanks.

Cheers,
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 ppc4xx: Add CATCenter Io 405EP board support

Quoted 1 line

Hi Dirk,

Hi Stefan,

Quoted 10 lines

...
<snip>

Review

Quoted 2 lines
(quoted diff) +2 -0
+/* Gbit PHYs */
+#define CONFIG_BITBANGMII		/* bit-bang MII PHY 

management */

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+#define CONFIG_SYS_MDIO_PIN  (0x80000000 >> 13)	 /* our 

MDIO is GPIO0
*/

Quoted 8 lines
Quoted 1 line

+#define CONFIG_SYS_MDC_PIN (0x80000000 >> 7) /* our

MDC is GPIO7
*/

Quoted 3 lines
(quoted diff) +2 -0
+
+#define MDIO_ACTIVE	out32(GPIO0_TCR, in32(GPIO0_TCR) |

CONFIG_SYS_MDIO_PIN)

Use out_be32() accessors here and below.

Just being curious: why? Has in32() also to be replaced?

Quoted 1 line

Please fix and resubmit. Thanks.

OK.

Quoted 2 lines

Cheers,
Stefan

Cheers
Dirk
--------------------------------------------------------------------------
Guntermann & Drunck GmbH Systementwicklung
Dortmunder Str. 4a
D-57234 Wilnsdorf - Germany
Tel: +49 (0) 27 39 / 89 01 - 100 Fax: +49 (0) 27 39 / 89 01 - 120
E-Mail: mailto:sales at gdsys.de Web: www.gdsys.de
--------------------------------------------------------------------------
Geschaeftsfuehrer:
Udo Guntermann - Martin Drunck - Reiner Ruelmann - Klaus Tocke HRB 2884, Amtsgericht Siegen - WEEE-Reg.-Nr. DE30763240 USt.-Id.-Nr. DE 126575222 - Steuer-Nr. 342 / 5835 / 1041
--------------------------------------------------------------------------
DQS-zertifiziert nach ISO 9001:2000
--------------------------------------------------------------------------

#4 lore raw

PATCH 1/1 ppc4xx: Add CATCenter Io 405EP board support

Hi Dirk,

Quoted 6 lines · Dirk
Quoted 4 lines
Quoted 2 lines

+#define MDIO_ACTIVE out32(GPIO0_TCR, in32(GPIO0_TCR) |
CONFIG_SYS_MDIO_PIN)

Use out_be32() accessors here and below.

Just being curious: why?

Because of the included memory barriers in the in/out_be32() functions. You might run into problems when using the "plain" in/out32() function requiring extra "sync" instructions.

Quoted 1 line

Has in32() also to be replaced?

Yes, of course.

Cheers,
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 ppc4xx: Add CATCenter Io 405EP board support

In reply to Stefan Roese
Quoted 14 lines

...
<snip>

Review

Quoted 2 lines
(quoted diff) +2 -0
+/* Gbit PHYs */
+#define CONFIG_BITBANGMII		/* bit-bang MII PHY 

management */

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+#define CONFIG_SYS_MDIO_PIN  (0x80000000 >> 13)	 /* our 

MDIO is GPIO0
*/

Quoted 1 line

+#define CONFIG_SYS_MDC_PIN (0x80000000 >> 7) /* our

MDC is GPIO7
*/

Quoted 7 lines
Quoted 3 lines
(quoted diff) +2 -0
+
+#define MDIO_ACTIVE	out32(GPIO0_TCR, in32(GPIO0_TCR) |

CONFIG_SYS_MDIO_PIN)

Use out_be32() accessors here and below.

Please fix and resubmit. Thanks.

To make this work, drivers/net/phy/miiphybb.c would have to include asm/io.h somehow. What would be the right way to achieve this?

Quoted 2 lines

Cheers,
Stefan

Cheers
Dirk

#6 lore raw

PATCH 1/1 ppc4xx: Add CATCenter Io 405EP board support

Dear "Eibach, Dirk",

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

To make this work, drivers/net/phy/miiphybb.c would have to include asm/io.h somehow. What would be the right way to achieve this?

This is a pretty clear indication that this processor or even board specific access stuff does not belong into the generic file drivers/net/phy/miiphybb.c - please reconsider the design.

Best regards,

Wolfgang Denk

Signature · 5 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
Where people stand is not as important as which way they face.
        - Terry Pratchett & Stephen Briggs, _The Discworld Companion_
#7 lore raw

PATCH 1/1 ppc4xx: Add CATCenter Io 405EP board support

In reply to Eibach
Quoted 10 lines · Dirk
Quoted 7 lines
Quoted 3 lines
(quoted diff) +2 -0
+
+#define MDIO_ACTIVE	out32(GPIO0_TCR, in32(GPIO0_TCR) |

CONFIG_SYS_MDIO_PIN)

Use out_be32() accessors here and below.

Please fix and resubmit. Thanks.

To make this work, drivers/net/phy/miiphybb.c would have to include asm/io.h somehow. What would be the right way to achieve this?

From looking at the code it seems there is a CONFIG_BITBANGMII_MULTI config option to enable board specific commands for GPIO access. Take a look at doc/README.bitbangMII for more details.

Cheers,
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