Re: [PATCH v3 0/4] mvebu: Add network support for Armada 370/XP

2014-11-10 Thread Sebastian Hesselbarth

On 11/10/2014 07:43 PM, Uwe Kleine-König wrote:

On Mon, Nov 10, 2014 at 03:10:56PM -0300, Ezequiel Garcia wrote:

On 11/10/2014 05:06 AM, Uwe Kleine-König wrote:

I tested this series on top of 784b352aeeed with a patch to support my
ReadyNAS 104 (by Netgear, Armada 370 system, currently only second stage
booting from U-Boot, similar to mirabox with
armada-370-netgear-rn104.dts from next-20141106).

Marvell>> tftp start_netgear_rn104.pblx
Using egiga1 device
TFTP from server 192.168.77.157; our IP address is 192.168.77.133
Filename 'start_netgear_rn104.pblx'.
Load address: 0x200
Loading: 
done
Bytes transferred = 292148 (47534 hex)
Marvell>> go 0x200
## Starting application at 0x0200 ...

barebox 2014.11.0-00123-g422a0a9d46a8 #3 Sun Nov 9 21:35:11 CET 2014

Board: NETGEAR ReadyNAS 104
SoC: Marvell 6710 rev 1
mdio_bus: miibus0: probed
eth1: got preset MAC address: 28:c6:8e:36:df:57
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
malloc space: 0x01f0 -> 0x03df (size 31 MiB)
environment load /dev/env0: No such file or directory
Maybe you have to create the partition.
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...
/env/bin/init not found
barebox:/ ethact eth1
barebox:/ dhcp
eth1: 1000Mbps full duplex link detected
T T T T T T T T T T T T T T T T T T T T dhcp failed: Connection timed 
out
dhcp: Connection timed out
barebox:/ eth1.ipaddr=192.168.77.133
barebox:/ eth1.netmask=255.255.255.0
barebox:/ echo $eth1.ethaddr
28:c6:8e:36:df:57
barebox:/ ping 192.168.77.157
T T T T T ping failed: Connection timed out
barebox:/

tcpdump on 192.168.77.157 (which is connected via a switch) worked just
fine from U-Boot, after all it served the barebox image.


[...]

Hm, not really. I've tested this with my Armada 370 Mirabox and Armada
XP Openblocks AX3-4 boards (I use kwboot to load the barebox image, so I
don't jump from U-Boot).



I would expect to use second stage booting to be more robust, because a
missing gpio to enable some hardware component in barebox is already
setup by U-Boot.

Do you have a command line for me? I used

scripts/kwboot -b images/barebox-netgear-rn104-uart.img /dev/ttyUSB0

which took much longer than I expected (didn't time it, but I'd say in
the several minutes range). And I didn't know what to do then. Ctrl-C
and then connecting microcom was wrong. Adding -t to the command line
above, too.


I guess we must be missing some config. What's confusing is that the
Mirabox and the RN104 should be pretty similar in this regard (e.g. they
use the same phy mode).

How do you know which phy is used? I assume from Arnaud's webpage?

Any hints how I can debug this apart from using a dtb without pinmuxing
stuff? (OTOH the same dtb works with linux, hmm.)


If you use barebox as first-stage BL, then you definitely need the 
pinmuxing. If you use it as second-stage BL, u-boot should have set

it up already. The log above suggests that you already used the same
egiga/mvneta controller before on u-boot so that should be fine.

Currently, I cannot tell what is the problem here. I never tried 2nd
stage booting. Can you add the pinmuxing and try uart booting? Also,
can you connect the RN104 directly to a PC and run wireshark on the
interface? You should see packets from the MAC above when e.g. ping
from RN104.

Sebastian


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v3 0/4] mvebu: Add network support for Armada 370/XP

2014-11-10 Thread Uwe Kleine-König
Hello Ezequiel,

On Mon, Nov 10, 2014 at 03:10:56PM -0300, Ezequiel Garcia wrote:
> On 11/10/2014 05:06 AM, Uwe Kleine-König wrote:
> > I tested this series on top of 784b352aeeed with a patch to support my
> > ReadyNAS 104 (by Netgear, Armada 370 system, currently only second stage
> > booting from U-Boot, similar to mirabox with
> > armada-370-netgear-rn104.dts from next-20141106).
> > 
> > Marvell>> tftp start_netgear_rn104.pblx
> > Using egiga1 device
> > TFTP from server 192.168.77.157; our IP address is 192.168.77.133
> > Filename 'start_netgear_rn104.pblx'.
> > Load address: 0x200
> > Loading: 
> > done
> > Bytes transferred = 292148 (47534 hex)
> > Marvell>> go 0x200
> > ## Starting application at 0x0200 ...
> > 
> > 
> > barebox 2014.11.0-00123-g422a0a9d46a8 #3 Sun Nov 9 21:35:11 CET 2014
> > 
> > 
> > Board: NETGEAR ReadyNAS 104
> > SoC: Marvell 6710 rev 1
> > mdio_bus: miibus0: probed
> > eth1: got preset MAC address: 28:c6:8e:36:df:57
> > of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
> > of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
> > of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
> > of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
> > malloc space: 0x01f0 -> 0x03df (size 31 MiB)
> > environment load /dev/env0: No such file or directory
> > Maybe you have to create the partition.
> > no valid environment found on /dev/env0. Using default environment
> > running /env/bin/init...
> > /env/bin/init not found
> > barebox:/ ethact eth1
> > barebox:/ dhcp
> > eth1: 1000Mbps full duplex link detected
> > T T T T T T T T T T T T T T T T T T T T dhcp failed: Connection timed 
> > out
> > dhcp: Connection timed out
> > barebox:/ eth1.ipaddr=192.168.77.133
> > barebox:/ eth1.netmask=255.255.255.0
> > barebox:/ echo $eth1.ethaddr
> > 28:c6:8e:36:df:57
> > barebox:/ ping 192.168.77.157
> > T T T T T ping failed: Connection timed out
> > barebox:/ 
> > 
> > tcpdump on 192.168.77.157 (which is connected via a switch) worked just
> > fine from U-Boot, after all it served the barebox image.
> > 
> > The pca9554 i2c device is only used for leds, so I don't think the error
> > messages above are related.
> > 
> > Yesterday I saw a different error, that I cannot reproduce now with the
> > same barebox image. IIRC I first played around a bit with eth0 until
> > noticing that I need eth1. I didn't save the full log, but it resulted
> > in:
> > 
> > barebox:/ ethact eth1
> > barebox:/ dhcp
> > eth1: 1000Mbps full duplex link detected
> > eth1: transmit error 3
> > dhcp failed: I/O error
> > dhcp: I/O error
> > 
> > Any ideas? I can try to use a dtb without pinmux definitions later
> > today.
> > 
> 
> Hm, not really. I've tested this with my Armada 370 Mirabox and Armada
> XP Openblocks AX3-4 boards (I use kwboot to load the barebox image, so I
> don't jump from U-Boot).
I would expect to use second stage booting to be more robust, because a
missing gpio to enable some hardware component in barebox is already
setup by U-Boot.

Do you have a command line for me? I used

scripts/kwboot -b images/barebox-netgear-rn104-uart.img /dev/ttyUSB0

which took much longer than I expected (didn't time it, but I'd say in
the several minutes range). And I didn't know what to do then. Ctrl-C
and then connecting microcom was wrong. Adding -t to the command line
above, too.
 
> I guess we must be missing some config. What's confusing is that the
> Mirabox and the RN104 should be pretty similar in this regard (e.g. they
> use the same phy mode).
How do you know which phy is used? I assume from Arnaud's webpage?

Any hints how I can debug this apart from using a dtb without pinmuxing
stuff? (OTOH the same dtb works with linux, hmm.)

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v4 5/5] net: Add driver for Armada 370/XP 10/100/1000 Mbps network controller

2014-11-10 Thread Ezequiel Garcia
This patch introduces the mvneta driver to support the network controller
found in Armada 370/XP SoCs.

Tested-by: Sebastian Hesselbarth 
Signed-off-by: Ezequiel Garcia 
---
 drivers/net/Kconfig  |   6 +
 drivers/net/Makefile |   1 +
 drivers/net/mvneta.c | 766 +++
 3 files changed, 773 insertions(+)
 create mode 100644 drivers/net/mvneta.c

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 24b9844..724507f 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -137,6 +137,12 @@ config DRIVER_NET_MPC5200
depends on ARCH_MPC5200
select PHYLIB
 
+config DRIVER_NET_MVNETA
+   bool "Marvell NETA"
+   depends on ARCH_MVEBU
+   select PHYLIB
+   select MDIO_MVEBU
+
 config DRIVER_NET_NETX
bool "Hilscher Netx ethernet driver"
depends on HAS_NETX_ETHER
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 3e66b31..75a70be 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_DRIVER_NET_KS8851_MLL)   += ks8851_mll.o
 obj-$(CONFIG_DRIVER_NET_MACB)  += macb.o
 obj-$(CONFIG_DRIVER_NET_MICREL)+= ksz8864rmn.o
 obj-$(CONFIG_DRIVER_NET_MPC5200)   += fec_mpc5200.o
+obj-$(CONFIG_DRIVER_NET_MVNETA)+= mvneta.o
 obj-$(CONFIG_DRIVER_NET_NETX)  += netx_eth.o
 obj-$(CONFIG_DRIVER_NET_ORION) += orion-gbe.o
 obj-$(CONFIG_DRIVER_NET_RTL8139)   += rtl8139.o
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
new file mode 100644
index 000..7734cf8
--- /dev/null
+++ b/drivers/net/mvneta.c
@@ -0,0 +1,766 @@
+/*
+ * (C) Copyright 2014 - Ezequiel Garcia 
+ *
+ * based on mvneta driver from linux
+ *   (C) Copyright 2012 Marvell
+ *   Rami Rosen 
+ *   Thomas Petazzoni 
+ *
+ * based on orion-gbe driver from barebox
+ *   (C) Copyright 2014
+ *   Pengutronix, Michael Grzeschik 
+ *   Sebastian Hesselbarth 
+
+ * 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+
+/* Rx queue */
+#define MVNETA_RXQ_CONFIG_REG(q)(0x1400 + ((q) << 2))
+#define  MVNETA_RXQ_PKT_OFFSET_ALL_MASK (0xf<< 8)
+#define  MVNETA_RXQ_PKT_OFFSET_MASK(offs)   ((offs) << 8)
+#define MVNETA_RXQ_THRESHOLD_REG(q) (0x14c0 + ((q) << 2))
+#define  MVNETA_RXQ_NON_OCCUPIED(v) ((v) << 16)
+#define MVNETA_RXQ_BASE_ADDR_REG(q) (0x1480 + ((q) << 2))
+#define MVNETA_RXQ_SIZE_REG(q)  (0x14a0 + ((q) << 2))
+#define  MVNETA_RXQ_BUF_SIZE_SHIFT  19
+#define  MVNETA_RXQ_BUF_SIZE_MASK   (0x1fff << 19)
+#define MVNETA_RXQ_STATUS_REG(q)(0x14e0 + ((q) << 2))
+#define  MVNETA_RXQ_OCCUPIED_ALL_MASK   0x3fff
+#define MVNETA_RXQ_STATUS_UPDATE_REG(q) (0x1500 + ((q) << 2))
+#define  MVNETA_RXQ_ADD_NON_OCCUPIED_SHIFT  16
+#define  MVNETA_RXQ_ADD_NON_OCCUPIED_MAX255
+
+#define MVNETA_PORT_RX_RESET0x1cc0
+#define MVNETA_MBUS_RETRY   0x2010
+#define MVNETA_UNIT_INTR_CAUSE  0x2080
+#define MVNETA_UNIT_CONTROL 0x20B0
+#define MVNETA_WIN_BASE(w)  (0x2200 + ((w) << 3))
+#define MVNETA_WIN_SIZE(w)  (0x2204 + ((w) << 3))
+#define MVNETA_WIN_REMAP(w) (0x2280 + ((w) << 2))
+#define MVNETA_BASE_ADDR_ENABLE 0x2290
+#define MVNETA_PORT_CONFIG  0x2400
+#define  MVNETA_DEF_RXQ(q)  ((q) << 1)
+#define  MVNETA_DEF_RXQ_ARP(q)  ((q) << 4)
+#define  MVNETA_TX_UNSET_ERR_SUMBIT(12)
+#define  MVNETA_DEF_RXQ_TCP(q)  ((q) << 16)
+#define  MVNETA_DEF_RXQ_UDP(q)  ((q) << 19)
+#define  MVNETA_DEF_RXQ_BPDU(q) ((q) << 22)
+#define  MVNETA_RX_CSUM_WITH_PSEUDO_HDR BIT(25)
+#define  MVNETA_PORT_CONFIG_DEFL_VALUE(q)   (MVNETA_DEF_RXQ(q)   | \
+MVNETA_DEF_RXQ_ARP(q)   | \
+MVNETA_DEF_RXQ_TCP(q)   | \
+MVNETA_DEF_RXQ_UDP(q)   | \
+MVNETA_DEF_RXQ_BPDU(q)  | \
+MVNETA_TX_UNSET_ERR_SUM | \
+MVNETA_RX_CSUM_WITH_PSE

[PATCH v4 0/5] mvebu: Add network support for Armada 370/XP

2014-11-10 Thread Ezequiel Garcia
Changes from v3:

  * As requested by Sascha, added a patch to fix the indentation
in the marvell phys array.

Changes from v2:

  * Included SPI in the PUP register as noted by Sebastian.

  * Added MAC flow control configuration. Added missing support
for TX-delayed RGMII (RGMII_TXID) and RX-delayed RGMII.
As per Sebastian's comments.

  * Dropped the defconfig patch. mvebu_defconfig should work fine.

Ezequiel Garcia (5):
  ARM: mvebu: Enable PUP register
  net: phy: marvell: Fix array identation
  net: phy: Support Marvell 88EE1545 PHY
  net: phy: Support Marvell 88EE1543 PHY
  net: Add driver for Armada 370/XP 10/100/1000 Mbps network controller

 arch/arm/mach-mvebu/armada-370-xp.c|   5 +
 .../mach-mvebu/include/mach/armada-370-xp-regs.h   |   7 +
 drivers/net/Kconfig|   6 +
 drivers/net/Makefile   |   1 +
 drivers/net/mvneta.c   | 766 +
 drivers/net/phy/marvell.c  |  85 ++-
 include/linux/marvell_phy.h|   2 +
 7 files changed, 863 insertions(+), 9 deletions(-)
 create mode 100644 drivers/net/mvneta.c

-- 
2.1.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v4 3/5] net: phy: Support Marvell 88EE1545 PHY

2014-11-10 Thread Ezequiel Garcia
This commit adds support for Marvell's 88E1545 PHY chip. In particular, this
allows to support QSGMII interfaces.

Signed-off-by: Ezequiel Garcia 
---
 drivers/net/phy/marvell.c   | 58 +
 include/linux/marvell_phy.h |  1 +
 2 files changed, 59 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2fb4ad2..8964d7a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -35,6 +35,13 @@
 #define MII_88E1121_PHY_MSCR_DELAY_MASK\
(MII_88E1121_PHY_MSCR_RX_DELAY | MII_88E1121_PHY_MSCR_TX_DELAY)
 
+#define MII_88E1540_LED_PAGE   0x3
+#define MII_88E1540_LED_CONTROL0x10
+
+#define MII_88E1540_QSGMII_PAGE0x4
+#define MII_88E1540_QSGMII_CONTROL 0x0
+#define MII_88E1540_QSGMII_AUTONEG_EN  BIT(12)
+
 /*
  * marvell_read_status
  *
@@ -123,6 +130,48 @@ static int marvell_read_status(struct phy_device *phydev)
return 0;
 }
 
+static int m88e1540_config_init(struct phy_device *phydev)
+{
+   u16 reg;
+   int ret;
+
+   /* Configure QSGMII auto-negotiation */
+   if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) {
+   ret = phy_write(phydev, MII_MARVELL_PHY_PAGE,
+   MII_88E1540_QSGMII_PAGE);
+   if (ret < 0)
+   return ret;
+
+   reg = phy_read(phydev, MII_88E1540_QSGMII_CONTROL);
+   ret = phy_write(phydev, MII_88E1540_QSGMII_CONTROL,
+   reg | MII_88E1540_QSGMII_AUTONEG_EN);
+   if (ret < 0)
+   return ret;
+   }
+
+   /* Configure LED as:
+* Activity: Blink
+* Link: On
+* No Link:  Off
+*/
+   phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1540_LED_PAGE);
+   phy_write(phydev, MII_88E1540_LED_CONTROL, 0x);
+
+   /* Power-up the PHY. When going from power down to normal operation,
+* software reset and auto-negotiation restart are also performed.
+*/
+   ret = phy_write(phydev, MII_MARVELL_PHY_PAGE,
+   MII_MARVELL_PHY_DEFAULT_PAGE);
+   if (ret < 0)
+   return ret;
+   ret = phy_write(phydev, MII_BMCR,
+   phy_read(phydev, MII_BMCR) & ~BMCR_PDOWN);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
 static int m88e1121_config_init(struct phy_device *phydev)
 {
u16 reg;
@@ -175,6 +224,15 @@ static struct phy_driver marvell_phys[] = {
.config_aneg= genphy_config_aneg,
.read_status= marvell_read_status,
},
+   {
+   .phy_id = MARVELL_PHY_ID_88E1545,
+   .phy_id_mask= MARVELL_PHY_ID_MASK,
+   .drv.name   = "Marvell 88E1545",
+   .features   = PHY_GBIT_FEATURES,
+   .config_init= m88e1540_config_init,
+   .config_aneg= genphy_config_aneg,
+   .read_status= marvell_read_status,
+   },
 };
 
 static int __init marvell_phy_init(void)
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index bf2c66a..deb75bf 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -27,6 +27,7 @@
 #define MARVELL_PHY_ID_88E1318S0x01410e90
 #define MARVELL_PHY_ID_88E1116R0x01410e40
 #define MARVELL_PHY_ID_88E1510 0x01410dd0
+#define MARVELL_PHY_ID_88E1545 0x01410eb0
 
 /* Mask used for ID comparisons */
 #define MARVELL_PHY_ID_MASK0xfff0
-- 
2.1.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v4 1/5] ARM: mvebu: Enable PUP register

2014-11-10 Thread Ezequiel Garcia
As reported by Sebastian, we need to enable this explicitly for the
Tx clock on RGMII. While here, let's enable all the other peripherals.

Although this is documented to be required only for Armada XP SoC,
it has been found to be harmless on Armada 370, so we do it unconditionally
to simplify the code.

Reported-by: Sebastian Hesselbarth 
Acked-by: Sebastian Hesselbarth 
Signed-off-by: Ezequiel Garcia 
---
 arch/arm/mach-mvebu/armada-370-xp.c   | 5 +
 arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h | 7 +++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c 
b/arch/arm/mach-mvebu/armada-370-xp.c
index 57f6a5f..244f8cd 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -74,6 +74,11 @@ static int armada_370_xp_init_soc(struct device_node *root, 
void *context)
 
mvebu_set_memory(phys_base, phys_size);
 
+   /* Enable peripherals PUP */
+   reg = readl(ARMADA_XP_PUP_ENABLE_BASE);
+   reg |= GE0_PUP_EN | GE1_PUP_EN | LCD_PUP_EN | NAND_PUP_EN | SPI_PUP_EN;
+   writel(reg, ARMADA_XP_PUP_ENABLE_BASE);
+
return 0;
 }
 
diff --git a/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h 
b/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h
index ccc687c..bac27e5 100644
--- a/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h
+++ b/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h
@@ -30,6 +30,13 @@
 #define  SAR_TCLK_FREQ BIT(20)
 #define  SAR_HIGH  0x04
 
+#define ARMADA_XP_PUP_ENABLE_BASE   (ARMADA_370_XP_INT_REGS_BASE + 0x1864c)
+#define  GE0_PUP_ENBIT(0)
+#define  GE1_PUP_ENBIT(1)
+#define  LCD_PUP_ENBIT(2)
+#define  NAND_PUP_EN   BIT(4)
+#define  SPI_PUP_ENBIT(5)
+
 #define ARMADA_370_XP_SDRAM_BASE   (ARMADA_370_XP_INT_REGS_BASE + 0x2)
 #define  DDR_BASE_CS   0x180
 #define  DDR_BASE_CSn(n)   (DDR_BASE_CS + ((n) * 0x8))
-- 
2.1.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v4 2/5] net: phy: marvell: Fix array identation

2014-11-10 Thread Ezequiel Garcia
Just a cosmetic clean-up to fix the indentation of the entries
in the phys array.

Signed-off-by: Ezequiel Garcia 
---
 drivers/net/phy/marvell.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index f2bc649..2fb4ad2 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -166,15 +166,15 @@ static int m88e1121_config_init(struct phy_device *phydev)
 }
 
 static struct phy_driver marvell_phys[] = {
-{
-   .phy_id = MARVELL_PHY_ID_88E1121R,
-   .phy_id_mask= MARVELL_PHY_ID_MASK,
-   .drv.name   = "Marvell 88E1121R",
-   .features   = PHY_GBIT_FEATURES,
-   .config_init= m88e1121_config_init,
-   .config_aneg= genphy_config_aneg,
-   .read_status= marvell_read_status,
-},
+   {
+   .phy_id = MARVELL_PHY_ID_88E1121R,
+   .phy_id_mask= MARVELL_PHY_ID_MASK,
+   .drv.name   = "Marvell 88E1121R",
+   .features   = PHY_GBIT_FEATURES,
+   .config_init= m88e1121_config_init,
+   .config_aneg= genphy_config_aneg,
+   .read_status= marvell_read_status,
+   },
 };
 
 static int __init marvell_phy_init(void)
-- 
2.1.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v4 4/5] net: phy: Support Marvell 88EE1543 PHY

2014-11-10 Thread Ezequiel Garcia
This commit adds support for Marvell's 88E1543 PHY chip. This chip is
almost identical to the 88EE1545, except the 88E1545 supports QSGMII
and the 88EE1543 supports SGMII.

Therefore, the same configuration function is used for both PHYs. For now,
the only initialization provided for the 88EE1543 is the LED setup.

Signed-off-by: Ezequiel Garcia 
---
 drivers/net/phy/marvell.c   | 9 +
 include/linux/marvell_phy.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 8964d7a..aaf9f53 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -225,6 +225,15 @@ static struct phy_driver marvell_phys[] = {
.read_status= marvell_read_status,
},
{
+   .phy_id = MARVELL_PHY_ID_88E1543,
+   .phy_id_mask= MARVELL_PHY_ID_MASK,
+   .drv.name   = "Marvell 88E1543",
+   .features   = PHY_GBIT_FEATURES,
+   .config_init= m88e1540_config_init,
+   .config_aneg= genphy_config_aneg,
+   .read_status= marvell_read_status,
+   },
+   {
.phy_id = MARVELL_PHY_ID_88E1545,
.phy_id_mask= MARVELL_PHY_ID_MASK,
.drv.name   = "Marvell 88E1545",
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index deb75bf..b7baae1 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -27,6 +27,7 @@
 #define MARVELL_PHY_ID_88E1318S0x01410e90
 #define MARVELL_PHY_ID_88E1116R0x01410e40
 #define MARVELL_PHY_ID_88E1510 0x01410dd0
+#define MARVELL_PHY_ID_88E1543 0x01410ea0
 #define MARVELL_PHY_ID_88E1545 0x01410eb0
 
 /* Mask used for ID comparisons */
-- 
2.1.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v3 0/4] mvebu: Add network support for Armada 370/XP

2014-11-10 Thread Ezequiel Garcia
On 11/10/2014 05:06 AM, Uwe Kleine-König wrote:
> Hello Ezequiel,
> 
> On Sun, Nov 09, 2014 at 11:56:14AM -0300, Ezequiel Garcia wrote:
>> Very delayed third round of the support for the network controller present
>> on Marvell Armada 370/XP SoC.
>>
>> The first patch enables the peripherals in a PUP register, which is required
>> on RGMII ports.
>>
>> The second and third patches add support for Marvell's 88E1543 and 88E1545 
>> PHY
>> chips.
>>
>> The fourth patch adds the mvneta driver. Most of the configuration part is
>> based on Linux's mvneta driver, while some of code organization is based
>> on Barebox's orion-gbe driver.
> I tested this series on top of 784b352aeeed with a patch to support my
> ReadyNAS 104 (by Netgear, Armada 370 system, currently only second stage
> booting from U-Boot, similar to mirabox with
> armada-370-netgear-rn104.dts from next-20141106).
> 
>   Marvell>> tftp start_netgear_rn104.pblx
>   Using egiga1 device
>   TFTP from server 192.168.77.157; our IP address is 192.168.77.133
>   Filename 'start_netgear_rn104.pblx'.
>   Load address: 0x200
>   Loading: 
>   done
>   Bytes transferred = 292148 (47534 hex)
>   Marvell>> go 0x200
>   ## Starting application at 0x0200 ...
> 
> 
>   barebox 2014.11.0-00123-g422a0a9d46a8 #3 Sun Nov 9 21:35:11 CET 2014
> 
> 
>   Board: NETGEAR ReadyNAS 104
>   SoC: Marvell 6710 rev 1
>   mdio_bus: miibus0: probed
>   eth1: got preset MAC address: 28:c6:8e:36:df:57
>   of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
>   of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
>   of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
>   of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
>   malloc space: 0x01f0 -> 0x03df (size 31 MiB)
>   environment load /dev/env0: No such file or directory
>   Maybe you have to create the partition.
>   no valid environment found on /dev/env0. Using default environment
>   running /env/bin/init...
>   /env/bin/init not found
>   barebox:/ ethact eth1
>   barebox:/ dhcp
>   eth1: 1000Mbps full duplex link detected
>   T T T T T T T T T T T T T T T T T T T T dhcp failed: Connection timed 
> out
>   dhcp: Connection timed out
>   barebox:/ eth1.ipaddr=192.168.77.133
>   barebox:/ eth1.netmask=255.255.255.0
>   barebox:/ echo $eth1.ethaddr
>   28:c6:8e:36:df:57
>   barebox:/ ping 192.168.77.157
>   T T T T T ping failed: Connection timed out
>   barebox:/ 
> 
> tcpdump on 192.168.77.157 (which is connected via a switch) worked just
> fine from U-Boot, after all it served the barebox image.
> 
> The pca9554 i2c device is only used for leds, so I don't think the error
> messages above are related.
> 
> Yesterday I saw a different error, that I cannot reproduce now with the
> same barebox image. IIRC I first played around a bit with eth0 until
> noticing that I need eth1. I didn't save the full log, but it resulted
> in:
> 
>   barebox:/ ethact eth1
>   barebox:/ dhcp
>   eth1: 1000Mbps full duplex link detected
>   eth1: transmit error 3
>   dhcp failed: I/O error
>   dhcp: I/O error
> 
> Any ideas? I can try to use a dtb without pinmux definitions later
> today.
> 

Hm, not really. I've tested this with my Armada 370 Mirabox and Armada
XP Openblocks AX3-4 boards (I use kwboot to load the barebox image, so I
don't jump from U-Boot).

I guess we must be missing some config. What's confusing is that the
Mirabox and the RN104 should be pretty similar in this regard (e.g. they
use the same phy mode).

Sebastian, do you have any ideas?
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: i.MX: Make NAND related Kconfig options depend on MTD

2014-11-10 Thread Andrey Smirnov
ARCH_IMX_EXTERNAL_BOOT_NAND, BAREBOX_UPDATE_IMX_EXTERNAL_NAND and
BAREBOX_UPDATE_IMX6_NAND all enable features that make use of API
provided by MTD subsystem, so to prevent those features breaking the
build when MTD is disabled make them dependent on it.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/mach-imx/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ef7c0a1..8dce491 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -102,17 +102,20 @@ endchoice
 
 config ARCH_IMX_EXTERNAL_BOOT_NAND
bool
+   depends on MTD
depends on ARCH_IMX25 || ARCH_IMX27 || ARCH_IMX31 || ARCH_IMX35
prompt "Support Starting barebox from NAND in external bootmode"
 
 config BAREBOX_UPDATE_IMX_EXTERNAL_NAND
bool
+   depends on MTD
depends on ARCH_IMX_EXTERNAL_BOOT_NAND
depends on BAREBOX_UPDATE
default y
 
 config BAREBOX_UPDATE_IMX6_NAND
bool
+   depends on MTD
depends on ARCH_IMX6
depends on BAREBOX_UPDATE
default y
-- 
1.9.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: i.MX6 Phytec phyFLEX: Fix imx6_bbu_nand_register_handler usage

2014-11-10 Thread Andrey Smirnov
imx6_bbu_nand_register_handler is not availible if
CONFIG_BAREBOX_UPDATE_IMX6_NAND is not selected. Fix this by wrapping
it's usage in preprocessor statements.

Signed-off-by: Andrey Smirnov 
---
 arch/arm/boards/phytec-phyflex-imx6/board.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/phytec-phyflex-imx6/board.c 
b/arch/arm/boards/phytec-phyflex-imx6/board.c
index 09a5c79..9acbd7a 100644
--- a/arch/arm/boards/phytec-phyflex-imx6/board.c
+++ b/arch/arm/boards/phytec-phyflex-imx6/board.c
@@ -81,8 +81,9 @@ static int phytec_pfla02_init(void)
 
phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK,
   ksz9031rn_phy_fixup);
-
+#ifdef CONFIG_BAREBOX_UPDATE_IMX6_NAND
imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT);
+#endif
 
switch (bootsource_get()) {
case BOOTSOURCE_MMC:
-- 
1.9.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] partitions/efi: Fix off-by-one error in 'last_lba'

2014-11-10 Thread Andrey Smirnov
LBAs are numbered starting from zero so the last LBA # would be equal
to total number of blocks minus one.

Signed-off-by: Andrey Smirnov 
---
 common/partitions/efi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index dcb9541..80dc3f3 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -51,11 +51,11 @@ efi_crc32(const void *buf, unsigned long len)
  *  the part[0] entry for this disk, and is the number of
  *  physical sectors available on the disk.
  */
-static u64 last_lba(struct block_device *bdev)
+static u64  last_lba(struct block_device *bdev)
 {
if (!bdev)
return 0;
-   return bdev->num_blocks;
+   return bdev->num_blocks - 1;
 }
 
 /**
-- 
1.9.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v3 0/4] mvebu: Add network support for Armada 370/XP

2014-11-10 Thread Uwe Kleine-König
Hello Ezequiel,

On Sun, Nov 09, 2014 at 11:56:14AM -0300, Ezequiel Garcia wrote:
> Very delayed third round of the support for the network controller present
> on Marvell Armada 370/XP SoC.
> 
> The first patch enables the peripherals in a PUP register, which is required
> on RGMII ports.
> 
> The second and third patches add support for Marvell's 88E1543 and 88E1545 PHY
> chips.
> 
> The fourth patch adds the mvneta driver. Most of the configuration part is
> based on Linux's mvneta driver, while some of code organization is based
> on Barebox's orion-gbe driver.
I tested this series on top of 784b352aeeed with a patch to support my
ReadyNAS 104 (by Netgear, Armada 370 system, currently only second stage
booting from U-Boot, similar to mirabox with
armada-370-netgear-rn104.dts from next-20141106).

Marvell>> tftp start_netgear_rn104.pblx
Using egiga1 device
TFTP from server 192.168.77.157; our IP address is 192.168.77.133
Filename 'start_netgear_rn104.pblx'.
Load address: 0x200
Loading: 
done
Bytes transferred = 292148 (47534 hex)
Marvell>> go 0x200
## Starting application at 0x0200 ...


barebox 2014.11.0-00123-g422a0a9d46a8 #3 Sun Nov 9 21:35:11 CET 2014


Board: NETGEAR ReadyNAS 104
SoC: Marvell 6710 rev 1
mdio_bus: miibus0: probed
eth1: got preset MAC address: 28:c6:8e:36:df:57
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
of_get_named_gpio_flags: unable to get gpio num of device pca95540: -19
malloc space: 0x01f0 -> 0x03df (size 31 MiB)
environment load /dev/env0: No such file or directory
Maybe you have to create the partition.
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...
/env/bin/init not found
barebox:/ ethact eth1
barebox:/ dhcp
eth1: 1000Mbps full duplex link detected
T T T T T T T T T T T T T T T T T T T T dhcp failed: Connection timed 
out
dhcp: Connection timed out
barebox:/ eth1.ipaddr=192.168.77.133
barebox:/ eth1.netmask=255.255.255.0
barebox:/ echo $eth1.ethaddr
28:c6:8e:36:df:57
barebox:/ ping 192.168.77.157
T T T T T ping failed: Connection timed out
barebox:/ 

tcpdump on 192.168.77.157 (which is connected via a switch) worked just
fine from U-Boot, after all it served the barebox image.

The pca9554 i2c device is only used for leds, so I don't think the error
messages above are related.

Yesterday I saw a different error, that I cannot reproduce now with the
same barebox image. IIRC I first played around a bit with eth0 until
noticing that I need eth1. I didn't save the full log, but it resulted
in:

barebox:/ ethact eth1
barebox:/ dhcp
eth1: 1000Mbps full duplex link detected
eth1: transmit error 3
dhcp failed: I/O error
dhcp: I/O error

Any ideas? I can try to use a dtb without pinmux definitions later
today.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox