Re: [U-Boot] [PATCH] kirkwood: add support for D-Link DNS-320

2012-05-11 Thread Jamie Lentin
On Wed, 02 May 2012 19:45:15 +0100, Luka Perkov ub...@lukaperkov.net  
wrote:



Hi Jamie,

I know that you have sent newer version of this patch but here is easier
for me to comment... I have also put maintainer of NAS325 board in
CC.


On Thu, Apr 26, 2012 at 11:23:58AM +0100, Jamie Lentin wrote:

This patch adds support for D-Link DNS-320 ShareCenter NAS.


...


+#ifdef CONFIG_RESET_PHY_R
+/* Configure and initialize 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, __func__);
+   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);
+
+   debug(88E1116 Initialized on %s\n, name);
+}
+#endif /* CONFIG_RESET_PHY_R */


Are you sure you need this CONFIG_RESET_PHY_R at all? I mean I have the
same SoC and I do not need this at all. I think this part is left over
from other boards that we do not need anymore. It makes sense to remove
this if you do not need it on your board.

Take a look here:

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=blob;f=board/raidsonic/ib62x0/ib62x0.c;h=65f2c2ea6a0415b0f508bc078528884e526dd201;hb=HEAD


I've fiddled for a while and cannot get a working Ethernet connection  
without this code to enable RGMII delay. Tried cloning configs/ib62x0.h,  
but no luck. Presumably you have the same PHY chip (88E1116R-NNC1) too?


Agree that it's a copy and pasted chunk of code that shouldn't be there  
though and at least should find a common home somewhere.




Luka



--
Jamie Lentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] kirkwood: add support for D-Link DNS-320

2012-05-11 Thread Luka Perkov
On Fri, May 11, 2012 at 03:09:25PM +0100, Jamie Lentin wrote:
 Are you sure you need this CONFIG_RESET_PHY_R at all? I mean I have the
 same SoC and I do not need this at all. I think this part is left over
 from other boards that we do not need anymore. It makes sense to remove
 this if you do not need it on your board.
 
 Take a look here:
 
 http://git.denx.de/?p=u-boot/u-boot-arm.git;a=blob;f=board/raidsonic/ib62x0/ib62x0.c;h=65f2c2ea6a0415b0f508bc078528884e526dd201;hb=HEAD
 
 I've fiddled for a while and cannot get a working Ethernet
 connection without this code to enable RGMII delay. Tried cloning
 configs/ib62x0.h, but no luck. Presumably you have the same PHY chip
 (88E1116R-NNC1) too?

I'm not sure... But if you really need this info I will disassemble the
box and take a look.

Anyway I'm glad you have double checked this.

 Agree that it's a copy and pasted chunk of code that shouldn't be
 there though and at least should find a common home somewhere.

Probably, but this is unrelated to this patch.

I have no more questions regarding this patch...

Regards,
Luka
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] kirkwood: add support for D-Link DNS-320

2012-05-02 Thread Luka Perkov
Hi Jamie,

I know that you have sent newer version of this patch but here is easier
for me to comment... I have also put maintainer of NAS325 board in
CC.


On Thu, Apr 26, 2012 at 11:23:58AM +0100, Jamie Lentin wrote:
 This patch adds support for D-Link DNS-320 ShareCenter NAS.

...

 +#ifdef CONFIG_RESET_PHY_R
 +/* Configure and initialize 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, __func__);
 + 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);
 +
 + debug(88E1116 Initialized on %s\n, name);
 +}
 +#endif /* CONFIG_RESET_PHY_R */

Are you sure you need this CONFIG_RESET_PHY_R at all? I mean I have the
same SoC and I do not need this at all. I think this part is left over
from other boards that we do not need anymore. It makes sense to remove
this if you do not need it on your board.

Take a look here:

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=blob;f=board/raidsonic/ib62x0/ib62x0.c;h=65f2c2ea6a0415b0f508bc078528884e526dd201;hb=HEAD

Luka
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] kirkwood: add support for D-Link DNS-320

2012-04-26 Thread Prafulla Wadaskar

Hi Jamie

 -Original Message-
 From: Jamie Lentin [mailto:j...@lentin.co.uk]
 Sent: 26 April 2012 15:54
 To: u-boot@lists.denx.de
 Cc: Jamie Lentin; Prafulla Wadaskar; albert.u.b...@aribaud.net
 Subject: [PATCH] kirkwood: add support for D-Link DNS-320

May you please post here a link/URL available for this board info?

 
 This patch adds support for D-Link DNS-320 ShareCenter NAS.
 
 Signed-off-by: Jamie Lentin j...@lentin.co.uk
 Cc: prafu...@marvell.com
 Cc: albert.u.b...@aribaud.net
 ---
 This patch is heavily based on Stefan's work for the DNS-325 port, the
 main difference being the memory timings.

If the diff against DNS-325 is not much, then you can re-use DNS-325 files 
instead of adding new one. I would like to suggest this method

Please check boards.cfg how OPENRD boards are supported.

Regards..
Prafulla . . .
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] kirkwood: add support for D-Link DNS-320

2012-04-26 Thread Jamie Lentin
This patch adds support for D-Link DNS-320 ShareCenter NAS.

Signed-off-by: Jamie Lentin j...@lentin.co.uk
Cc: prafu...@marvell.com
Cc: albert.u.b...@aribaud.net
---
This patch is heavily based on Stefan's work for the DNS-325 port, the
main difference being the memory timings. I've tested this on my board against
master (currently v2012.04.01) and network, USB, serial all seem to work fine.

Any comments appreciated!

 MAINTAINERS  |4 +
 board/d-link/dns320/Makefile |   48 +
 board/d-link/dns320/dns320.c |  147 +++
 board/d-link/dns320/dns320.h |   47 +
 board/d-link/dns320/kwbimage.cfg |  207 ++
 boards.cfg   |1 +
 include/configs/dns320.h |  191 +++
 7 files changed, 645 insertions(+)
 create mode 100644 board/d-link/dns320/Makefile
 create mode 100644 board/d-link/dns320/dns320.c
 create mode 100644 board/d-link/dns320/dns320.h
 create mode 100644 board/d-link/dns320/kwbimage.cfg
 create mode 100644 include/configs/dns320.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 708ded7..0da6384 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -669,6 +669,10 @@ Igor Grinberg grinb...@compulab.co.il
 
cm-t35  ARM ARMV7 (OMAP3xx Soc)
 
+Jamie Lentin j...@lentin.co.uk
+
+   dns320  ARM926EJS (Kirkwood SoC)
+
 Stefan Herbrechtsmeier ste...@code.herbrechtsmeier.net
 
dns325  ARM926EJS (Kirkwood SoC)
diff --git a/board/d-link/dns320/Makefile b/board/d-link/dns320/Makefile
new file mode 100644
index 000..83906fa
--- /dev/null
+++ b/board/d-link/dns320/Makefile
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2012
+# Jamie Lentin j...@lentin.co.uk
+#
+# Based on dns325 support:
+# Copyright (C) 2011
+# Stefan Herbrechtsmeier ste...@code.herbrechtsmeier.net
+#
+# 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
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := dns320.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/d-link/dns320/dns320.c b/board/d-link/dns320/dns320.c
new file mode 100644
index 000..23c945e
--- /dev/null
+++ b/board/d-link/dns320/dns320.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2012
+ * Jamie Lentin j...@lentin.co.uk
+ *
+ * Based on dns325 support:
+ * Copyright (C) 2011
+ * Stefan Herbrechtsmeier ste...@code.herbrechtsmeier.net
+ *
+ * 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
+ */
+
+#include common.h
+#include miiphy.h
+#include netdev.h
+#include asm/arch/cpu.h
+#include asm/arch/kirkwood.h
+#include asm/arch/mpp.h
+#include asm/arch/gpio.h
+#include dns320.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+   /* Gpio configuration */
+   kw_config_gpio(DNS320_OE_VAL_LOW, DNS320_OE_VAL_HIGH,
+   DNS320_OE_LOW, DNS320_OE_HIGH);
+
+   /* Multi-Purpose Pins Functionality configuration */
+   u32 kwmpp_config[] = {
+   MPP0_NF_IO2,
+   MPP1_NF_IO3,
+   MPP2_NF_IO4,
+ 

Re: [U-Boot] [PATCH] kirkwood: add support for D-Link DNS-320

2012-04-26 Thread Jamie Lentin
On Thu, 26 Apr 2012 11:57:36 +0100, Prafulla Wadaskar  
prafu...@marvell.com wrote:




Hi Jamie


-Original Message-
From: Jamie Lentin [mailto:j...@lentin.co.uk]
Sent: 26 April 2012 15:54
To: u-boot@lists.denx.de
Cc: Jamie Lentin; Prafulla Wadaskar; albert.u.b...@aribaud.net
Subject: [PATCH] kirkwood: add support for D-Link DNS-320


May you please post here a link/URL available for this board info?


Was there anything in particular you wanted to see? Some general URLs:-

 http://jamie.lentin.co.uk/devices/dlink-dns320
 http://dns323.kood.org/dns-320
 http://sharecenter.dlink.com/products/DNS-320



This patch adds support for D-Link DNS-320 ShareCenter NAS.

Signed-off-by: Jamie Lentin j...@lentin.co.uk
Cc: prafu...@marvell.com
Cc: albert.u.b...@aribaud.net
---
This patch is heavily based on Stefan's work for the DNS-325 port, the
main difference being the memory timings.


If the diff against DNS-325 is not much, then you can re-use DNS-325  
files instead of adding new one. I would like to suggest this method


Please check boards.cfg how OPENRD boards are supported.



Okay, I think I've got this going. Will send it on once I've tested on  
both NASes. It would seem sensible to me to rename the common parts from  
dns325 to dnskw (as in kirkwood-based-DNS, there are also  
orion-based-DNSes). Should I send a patch to do this too, or would you  
rather keep the original dns325 board name?



Regards..
Prafulla . . .


Thanks for looking it over!

--
Jamie Lentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot