Skip to contentSkip to conversation

[U-Boot] [RFC/PATCH 0/2]

PATCH New Simon Kagstrom 3 participants 8 messages Jul 13, 2009 – Nov 23, 2009

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

cover [U-Boot] [RFC/PATCH 0/2]

Hejsan!

I'm going on vacation for one month on wednesday, so I thought I'd post the OpenRD base patches as they are today. I can fix issues tomorrow as well, but after that I will be offline.

I've tried to integrate the comments posted on the last series (thanks!), although for the split-out-phy support and configure-MAC-for-linux the discussion hasn't really converged yet so I just picked an implementation :-).

Other dependencies:
-------------------

* Fix UBIFS build on arm: http://lists.denx.de/pipermail/u-boot/2009-July/055594.html

* Various Kirkwood egiga fixes: http://lists.denx.de/pipermail/u-boot/2009-July/055724.html
(except the first which is worked around in the board support)

Changes since last patch series:
--------------------------------

* Copyrights have been fixed up: moved functions retain copyrights, attribute originating source where the implementation is based on another file.

* Some MPP pins have been corrected

* The configuration has been extended to include UBIFS support (this is a prototype board after all so I think it makes sense to have a "fat" configuration which can be stripped down)

* I moved mv88e1116.c to drivers/net/phy/ instead. I understand this issue is not settled yet (with generic PHY framework missing etc).

* NAND flash partitions have been corrected

* MPP correction patch has been removed (already applied upstream) and mach-types.h is also untouched.

* Added Maintainer and MAKEALL

* Board ID has been registered at
http://www.arm.linux.org.uk/developer/machines/ (2325), although it's not integrated in Linux yet. This will obviously need to be merged before the OpenRD base board support can go in.

// Simon

#1 lore raw

PATCH 1/2 : Arm: Kirkwood: Split PHY-related initialization to a common file

The mv881116 PHY initialization is split out to a common file to enable code reuse between different boards.

---
 board/Marvell/sheevaplug/sheevaplug.c |   32 +--------------
 board/Marvell/sheevaplug/sheevaplug.h |    8 ----
 drivers/net/phy/Makefile              |    1 +
 drivers/net/phy/mv88e1116.c           |   66 +++++++++++++++++++++++++++++++++
 include/configs/sheevaplug.h          |    1 +
 include/mv88e1116.h                   |   29 ++++++++++++++
 6 files changed, 100 insertions(+), 37 deletions(-)
 create mode 100644 drivers/net/phy/mv88e1116.c
 create mode 100644 include/mv88e1116.h
board/Marvell/sheevaplug/sheevaplug.c +3 -29
index 547126a..2bbbb7a 100644
@@ -27,6 +27,7 @@
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
 #include "sheevaplug.h"
+#include <mv88e1116.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -120,36 +121,9 @@ int dram_init(void)
 }
 
 #ifdef CONFIG_RESET_PHY_R
-/* Configure and enable MV88E1116 PHY */
 void reset_phy(void)
 {
-	u16 reg;
-	u16 devadr;
-	char *name = "egiga0";
-
-	if (miiphy_set_current_dev(name))
-		return;
-
-	/* command to read PHY dev address */
-	if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
-		printf("Err..%s could not read PHY dev address\n",
-			__FUNCTION__);
-		return;
-	}
-
-	/*
-	 * Enable RGMII delay on Tx and Rx for CPU port
-	 * Ref: sec 4.7.2 of chip datasheet
-	 */
-	miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
-	miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, &reg);
-	reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
-	miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
-	miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
-
-	/* reset the phy */
-	miiphy_reset(name, devadr);
-
-	printf("88E1116 Initialized on %s\n", name);
+	/* Configure and enable MV88E1116 PHY */
+	mv881116_reset_phy("egiga0");
 }
 #endif /* CONFIG_RESET_PHY_R */
board/Marvell/sheevaplug/sheevaplug.h +0 -8
index 3ed5b7f..030d64f 100644
@@ -30,12 +30,4 @@
 #define SHEEVAPLUG_OE_VAL_LOW		(1 << 29)	/* USB_PWEN low */
 #define SHEEVAPLUG_OE_VAL_HIGH		(1 << 17)	/* LED pin high */
 
-/* PHY related */
-#define MV88E1116_LED_FCTRL_REG		10
-#define MV88E1116_CPRSP_CR3_REG		21
-#define MV88E1116_MAC_CTRL_REG		21
-#define MV88E1116_PGADR_REG		22
-#define MV88E1116_RGMII_TXTM_CTRL	(1 << 4)
-#define MV88E1116_RGMII_RXTM_CTRL	(1 << 5)
-
 #endif /* __SHEEVAPLUG_H */
drivers/net/phy/Makefile +1 -0
index 3b92614..c6bb894 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libphy.a
 
 COBJS-$(CONFIG_BITBANGMII) += miiphybb.o
 COBJS-$(CONFIG_MV88E61XX_SWITCH) += mv88e61xx.o
+COBJS-$(CONFIG_MV88E1116) += mv88e1116.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/net/phy/mv88e1116.c new file +66 -0

66 lines not on this page · raw message

include/configs/sheevaplug.h +1 -0
index cdd7acd..0acc50c 100644
@@ -44,6 +44,7 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
 #define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
 #define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
+#define CONFIG_MV88E1116		/* Support for the MV88E1116 PHY */
 
 /*
  * CLKs configurations
include/mv88e1116.h new file +29 -0
new file mode 100644
index 0000000..6495ae8
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2009
+ * Net Insight <www.netinsight.net>
+ * Written-by: Simon Kagstrom <[email protected]>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+#ifndef __MV881116_H
+#define __MV881116_H
+
+void mv881116_reset_phy(char *name);
+
+#endif /* __MV881116_H */
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 1/2 : Arm: Kirkwood: Split PHY-related initialization to a common file

Dear Ben,

Quoted 4 lines · In message <[email protected]> Simon Kagstrom wrote:

The mv881116 PHY initialization is split out to a common file to enable code reuse between different boards.

Quoted 10 lines
---
 board/Marvell/sheevaplug/sheevaplug.c |   32 +--------------
 board/Marvell/sheevaplug/sheevaplug.h |    8 ----
 drivers/net/phy/Makefile              |    1 +
 drivers/net/phy/mv88e1116.c           |   66 +++++++++++++++++++++++++++++++++
 include/configs/sheevaplug.h          |    1 +
 include/mv88e1116.h                   |   29 ++++++++++++++
 6 files changed, 100 insertions(+), 37 deletions(-)
 create mode 100644 drivers/net/phy/mv88e1116.c
 create mode 100644 include/mv88e1116.h

Ping...

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
There's no sense in being precise  when  you  don't  even  know  what
you're talking about.                             -- John von Neumann
#3 lore raw

PATCH 1/2 : Arm: Kirkwood: Split PHY-related initialization to a common file

Dear Ben,

Quoted 18 lines · In message <[email protected]> I wrote:

Dear Ben,

Quoted 4 lines · In message <[email protected]> Simon Kagstrom wrote:

The mv881116 PHY initialization is split out to a common file to enable code reuse between different boards.

Quoted 10 lines
---
 board/Marvell/sheevaplug/sheevaplug.c |   32 +--------------
 board/Marvell/sheevaplug/sheevaplug.h |    8 ----
 drivers/net/phy/Makefile              |    1 +
 drivers/net/phy/mv88e1116.c           |   66 +++++++++++++++++++++++++++++++++
 include/configs/sheevaplug.h          |    1 +
 include/mv88e1116.h                   |   29 ++++++++++++++
 6 files changed, 100 insertions(+), 37 deletions(-)
 create mode 100644 drivers/net/phy/mv88e1116.c
 create mode 100644 include/mv88e1116.h
Quoted 1 line

Ping...

Can you please check the status of this patch:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/63590/focus=63591

Thanks.

Best regards,

Wolfgang Denk

Signature · 7 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
Es ist offensichtlich, dass das menschliche Gehirn wie  ein  Computer
funktioniert.  Da  es  keine  dummen Computer gibt, gibt es also auch
keine dummen Menschen. Nur ein paar Leute, die unter DOS laufen.
                                                       -- <unbekannt>
#4 lore raw

PATCH 1/2 : Arm: Kirkwood: Split PHY-related initialization to a common file

Quoted 16 lines · On Sun, 22 Nov 2009 21:57:05 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 16 lines
Quoted 14 lines · In message <[email protected]> Simon Kagstrom wrote:

The mv881116 PHY initialization is split out to a common file to enable code reuse between different boards.

---
 board/Marvell/sheevaplug/sheevaplug.c |   32 +--------------
 board/Marvell/sheevaplug/sheevaplug.h |    8 ----
 drivers/net/phy/Makefile              |    1 +
 drivers/net/phy/mv88e1116.c           |   66 +++++++++++++++++++++++++++++++++
 include/configs/sheevaplug.h          |    1 +
 include/mv88e1116.h                   |   29 ++++++++++++++
 6 files changed, 100 insertions(+), 37 deletions(-)
 create mode 100644 drivers/net/phy/mv88e1116.c
 create mode 100644 include/mv88e1116.h
Quoted 4 lines
Quoted 1 line

Ping...

Can you please check the status of this patch:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/63590/focus=63591

I believe Prafulla voted to keep the PHY stuff locally in sheevaplug.c and openrd_base.c until the generic PHY support was added. So I later submitted a patch with the PHY init for OpenRD base in the board-file (like sheevaplug).

So I think this patch should simply be dropped - code reuse will happen in a more generic way later anyway. Perhaps you have some additional comments, Prafulla?

// Simon

#5 lore raw

PATCH 1/2 : Arm: Kirkwood: Split PHY-related initialization to a common file

Quoted 44 lines

-----Original Message-----
From: Simon Kagstrom [mailto:simon.kagstrom at netinsight.net]
Sent: Monday, November 23, 2009 1:04 PM
To: Wolfgang Denk
Cc: Ben Warren; U-Boot ML; Prafulla Wadaskar
Subject: Re: [U-Boot] [RFC/PATCH 1/2]: Arm: Kirkwood: Split PHY-related initialization to a common file

Quoted 1 line · On Sun, 22 Nov 2009 21:57:05 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 1 line

In message <[email protected]>

Quoted 1 line · Simon Kagstrom
Quoted 1 line
Quoted 1 line

The mv881116 PHY initialization is split out to a

common file to enable

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

code reuse between different boards.

---
 board/Marvell/sheevaplug/sheevaplug.c |   32 +--------------
 board/Marvell/sheevaplug/sheevaplug.h |    8 ----
 drivers/net/phy/Makefile              |    1 +
 drivers/net/phy/mv88e1116.c           |   66 

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

Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
 include/configs/sheevaplug.h          |    1 +
 include/mv88e1116.h                   |   29 ++++++++++++++
 6 files changed, 100 insertions(+), 37 deletions(-)
 create mode 100644 drivers/net/phy/mv88e1116.c
 create mode 100644 include/mv88e1116.h

Ping...

Can you please check the status of this patch:

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/63590/f
ocus=63591

I believe Prafulla voted to keep the PHY stuff locally in sheevaplug.c and openrd_base.c until the generic PHY support was added. So I later submitted a patch with the PHY init for OpenRD base in the board-file (like sheevaplug).

Quoted 4 lines

So I think this patch should simply be dropped - code reuse will happen
in a more generic way later anyway. Perhaps you have some additional comments, Prafulla?

I think we should port it in generic way, because there are numerous board in pipeline which will have to use similar support and there will be code duplication.

If I remember correctly, Jean has also put some efforts in this direction. This is call for Ben

Hi Ben and Jean
Is Generic PHY arch is ready to use (even though in bits and patches)? Can we start migrating Marvell Switch/PHY devices for the same?

Regards..
Prafulla . .

Quoted 3 lines

// Simon

#6 lore raw

PATCH 1/2 : Arm: Kirkwood: Split PHY-related initialization to a common file

In reply to Simon Kagstrom

Dear Simon Kagstrom,

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

I believe Prafulla voted to keep the PHY stuff locally in sheevaplug.c and openrd_base.c until the generic PHY support was added. So I later submitted a patch with the PHY init for OpenRD base in the board-file (like sheevaplug).

So I think this patch should simply be dropped - code reuse will happen in a more generic way later anyway. Perhaps you have some additional comments, Prafulla?

OK, so I drop this patch. Thanks.

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
Every program has at least one bug and can be shortened by  at  least
one  instruction  --  from  which,  by induction, one can deduce that
every program can be reduced to one instruction which doesn't work.
#7 lore raw

PATCH 2/2 : Arm: Kirkwood: Support for the OpenRD base board

In reply to Simon Kagstrom

The implementation is borrowed from the sheevaplug board and the Marvell 1.1.4 code and likely to be a bit incomplete. GPIO pins are configured, but much of it is not really tested.

---
 MAINTAINERS                             |    4 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/Marvell/openrd_base/Makefile      |   51 +++++++
 board/Marvell/openrd_base/config.mk     |   25 ++++
 board/Marvell/openrd_base/openrd_base.c |  137 ++++++++++++++++++
 board/Marvell/openrd_base/openrd_base.h |   38 +++++
 drivers/net/phy/mv88e1116.c             |    2 +-
 include/configs/openrd_base.h           |  230 +++++++++++++++++++++++++++++++
 9 files changed, 490 insertions(+), 1 deletions(-)
 create mode 100644 board/Marvell/openrd_base/Makefile
 create mode 100644 board/Marvell/openrd_base/config.mk
 create mode 100644 board/Marvell/openrd_base/openrd_base.c
 create mode 100644 board/Marvell/openrd_base/openrd_base.h
 create mode 100644 include/configs/openrd_base.h
MAINTAINERS +4 -0
index dfdcc2e..6f8cce3 100644
@@ -559,6 +559,10 @@ Gary Jennejohn <[email protected]>
 Konstantin Kletschke <[email protected]>
 	scb9328		ARM920T
 
+Simon Kagstrom <[email protected]>
+
+       openrd_base     ARM926EJS (Kirkwood SoC)
+
 Nishant Kamat <[email protected]>
 
 	omap1610h2	ARM926EJS
MAKEALL +1 -0
index e28df35..ddff76c 100755
@@ -518,6 +518,7 @@ LIST_ARM9="			\
 	omap1610inn		\
 	omap5912osk		\
 	omap730p2		\
+	openrd_base		\
 	sbc2410x		\
 	scb9328			\
 	sheevaplug		\
Makefile +3 -0
index 1515de6..d1ecd1e 100644
@@ -2897,6 +2897,9 @@ omap1610h2_cs_autoboot_config:	unconfig
 omap5912osk_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs omap5912osk NULL omap
 
+openrd_base_config: unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs $(@:_config=) Marvell kirkwood
+
 xtract_omap730p2 = $(subst _cs0boot,,$(subst _cs3boot,, $(subst _config,,$1)))
 
 omap730p2_config \
board/Marvell/openrd_base/Makefile new file +51 -0

51 lines not on this page · raw message

board/Marvell/openrd_base/config.mk new file +25 -0
new file mode 100644
index 0000000..a4ea769
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <[email protected]>
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+TEXT_BASE = 0x00600000
board/Marvell/openrd_base/openrd_base.c new file +137 -0

137 lines not on this page · raw message

board/Marvell/openrd_base/openrd_base.h new file +38 -0
new file mode 100644
index 0000000..bf2abca
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2009
+ * Net Insight <www.netinsight.net>
+ * Written-by: Simon Kagstrom <[email protected]>
+ *
+ * Based on sheevaplug.h:
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <[email protected]>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __OPENRD_BASE_H
+#define __OPENRD_BASE_H
+
+#define OPENRD_OE_LOW		(~(1<<28))        /* RS232 / RS485 */
+#define OPENRD_OE_HIGH		(~(1<<2))         /* SD / UART1 */
+#define OPENRD_OE_VAL_LOW		(0)       /* Sel RS232 */
+#define OPENRD_OE_VAL_HIGH		(1 << 2)  /* Sel SD */
+
+#endif /* __OPENRD_BASE_H */
drivers/net/phy/mv88e1116.c +1 -1
index 37225f3..3562834 100644
@@ -24,7 +24,7 @@
  */
 #include <common.h>
 #include <miiphy.h>
-#include "mv881116.h"
+#include "mv88e1116.h"
 
 /* PHY related */
 #define MV88E1116_LED_FCTRL_REG		10
include/configs/openrd_base.h new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
1.6.0.4