[U-Boot] [PATCH 0/3] ARM: DRA72x: Add CPSW Ethernet support for DRA72x SoC

CPSW Ethernet second port is pinned out as default Ethernet, so adding support for CPSW ethernet for downloading images via Ethernet.
Mugunthan V N (3): drivers: net: cpsw: add support for using second port as ethernet ARM: DRA7xx: Add cpsw second port pinmux ARM: dra7_evm: Add Ethernet support for dra72x platform
board/ti/dra7xx/evm.c | 7 ++++++- board/ti/dra7xx/mux_data.h | 12 ++++++++++++ drivers/net/cpsw.c | 8 +++++--- include/cpsw.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-)

Add support for using the second slave port of cpsw to be used as primary ethernet.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- drivers/net/cpsw.c | 8 +++++--- include/cpsw.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index bd5fba2..8ec5161 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -211,6 +211,8 @@ struct cpdma_chan { #define chan_read(chan, fld) __raw_readl((chan)->fld) #define chan_read_ptr(chan, fld) ((void *)__raw_readl((chan)->fld))
+#define for_active_slave(slave, priv) \ + slave = (priv)->slaves + (priv)->data.active_slave; if (slave) #define for_each_slave(slave, priv) \ for (slave = (priv)->slaves; slave != (priv)->slaves + \ (priv)->data.slaves; slave++) @@ -609,7 +611,7 @@ static int cpsw_update_link(struct cpsw_priv *priv) int link = 0; struct cpsw_slave *slave;
- for_each_slave(slave, priv) + for_active_slave(slave, priv) cpsw_slave_update_link(slave, priv, &link); priv->mdio_link = readl(&mdio_regs->link); return link; @@ -785,7 +787,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis) ALE_SECURE); cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);
- for_each_slave(slave, priv) + for_active_slave(slave, priv) cpsw_slave_init(slave, priv);
cpsw_update_link(priv); @@ -1013,7 +1015,7 @@ int cpsw_register(struct cpsw_platform_data *data)
cpsw_mdio_init(dev->name, data->mdio_base, data->mdio_div); priv->bus = miiphy_get_dev_by_name(dev->name); - for_each_slave(slave, priv) + for_active_slave(slave, priv) cpsw_phy_init(dev, slave);
return 1; diff --git a/include/cpsw.h b/include/cpsw.h index a73843d..547b40c 100644 --- a/include/cpsw.h +++ b/include/cpsw.h @@ -44,6 +44,7 @@ struct cpsw_platform_data { struct cpsw_slave_data *slave_data; void (*control)(int enabled); u32 host_port_num; + u32 active_slave; u8 version; };

On Thu, May 22, 2014 at 02:37:10PM +0530, Mugunthan V N wrote:
Add support for using the second slave port of cpsw to be used as primary ethernet.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Applied to u-boot-ti/master, thanks!

Add cpsw second slave port pinmux to use it as primary ethernet port
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- board/ti/dra7xx/mux_data.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/board/ti/dra7xx/mux_data.h b/board/ti/dra7xx/mux_data.h index 38de9d5..56cda07 100644 --- a/board/ti/dra7xx/mux_data.h +++ b/board/ti/dra7xx/mux_data.h @@ -51,6 +51,18 @@ const struct pad_conf_entry core_padconf_array_essential[] = { {RGMII0_RXD2, (IEN | M0) }, {RGMII0_RXD1, (IEN | M0) }, {RGMII0_RXD0, (IEN | M0) }, + {VIN2A_D12, (M3) }, + {VIN2A_D13, (M3) }, + {VIN2A_D14, (M3) }, + {VIN2A_D15, (M3) }, + {VIN2A_D16, (M3) }, + {VIN2A_D17, (M3) }, + {VIN2A_D18, (IEN | M3)}, + {VIN2A_D19, (IEN | M3)}, + {VIN2A_D20, (IEN | M3)}, + {VIN2A_D21, (IEN | M3)}, + {VIN2A_D22, (IEN | M3)}, + {VIN2A_D23, (IEN | M3)}, {GPMC_A13, (IEN | PDIS | M1)}, /* QSPI1_RTCLK */ {GPMC_A14, (IEN | PDIS | M1)}, /* QSPI1_D[3] */ {GPMC_A15, (IEN | PDIS | M1)}, /* QSPI1_D[2] */

On Thu, May 22, 2014 at 02:37:11PM +0530, Mugunthan V N wrote:
Add cpsw second slave port pinmux to use it as primary ethernet port
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Applied to u-boot-ti/master, thanks!

Set the active_slave to 1 as slave 1 is pinned out in dra72x base board
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- board/ti/dra7xx/evm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index 073d151..955c16f 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -157,6 +157,8 @@ int spl_start_uboot(void) #define VIN2A_D15_DLY_VAL ((0x4 << 5) + 0x0) #define VIN2A_D14_DLY_VAL ((0x4 << 5) + 0x0)
+extern u32 *const omap_si_rev; + static void cpsw_control(int enabled) { /* VTP can be added here */ @@ -183,7 +185,7 @@ static struct cpsw_platform_data cpsw_data = { .mdio_div = 0xff, .channels = 8, .cpdma_reg_ofs = 0x800, - .slaves = 1, + .slaves = 2, .slave_data = cpsw_slaves, .ale_reg_ofs = 0xd00, .ale_entries = 1024, @@ -254,6 +256,9 @@ int board_eth_init(bd_t *bis) ctrl_val |= 0x22; writel(ctrl_val, (*ctrl)->control_core_control_io1);
+ if (*omap_si_rev == DRA722_ES1_0) + cpsw_data.active_slave = 1; + ret = cpsw_register(&cpsw_data); if (ret < 0) printf("Error %d registering CPSW switch\n", ret);

On Thu, May 22, 2014 at 02:37:12PM +0530, Mugunthan V N wrote:
Set the active_slave to 1 as slave 1 is pinned out in dra72x base board
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Applied to u-boot-ti/master, thanks!

On Thursday 22 May 2014 02:37 PM, Mugunthan V N wrote:
CPSW Ethernet second port is pinned out as default Ethernet, so adding support for CPSW ethernet for downloading images via Ethernet.
Mugunthan V N (3): drivers: net: cpsw: add support for using second port as ethernet ARM: DRA7xx: Add cpsw second port pinmux ARM: dra7_evm: Add Ethernet support for dra72x platform
board/ti/dra7xx/evm.c | 7 ++++++- board/ti/dra7xx/mux_data.h | 12 ++++++++++++ drivers/net/cpsw.c | 8 +++++--- include/cpsw.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-)
This patch series depends on the following patch set
http://lists.denx.de/pipermail/u-boot/2014-May/179549.html
Regards Mugunthan V N

On Thu, May 22, 2014 at 02:37:09PM +0530, Mugunthan V N wrote:
CPSW Ethernet second port is pinned out as default Ethernet, so adding support for CPSW ethernet for downloading images via Ethernet.
Mugunthan V N (3): drivers: net: cpsw: add support for using second port as ethernet ARM: DRA7xx: Add cpsw second port pinmux ARM: dra7_evm: Add Ethernet support for dra72x platform
Can we please update the driver to support both interfaces (cpsw for compat, cpsw1 for the second interface) and then we would just at runtime see if ethact was not set and if so, set it to cpsw1 on the dra72x evm? This would also make using boards which do have both ports a little less surprising as we do set both ethaddrs (so that we update the device tree and pass them along) but can only use one interface. Thanks!

On Thu, May 22, 2014 at 02:37:09PM +0530, Mugunthan V N wrote:
CPSW Ethernet second port is pinned out as default Ethernet, so adding support for CPSW ethernet for downloading images via Ethernet.
Mugunthan V N (3): drivers: net: cpsw: add support for using second port as ethernet ARM: DRA7xx: Add cpsw second port pinmux ARM: dra7_evm: Add Ethernet support for dra72x platform
board/ti/dra7xx/evm.c | 7 ++++++- board/ti/dra7xx/mux_data.h | 12 ++++++++++++ drivers/net/cpsw.c | 8 +++++--- include/cpsw.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-)
I had previously rejected this as I was hoping to get 2nd port eth support work done. Mugunthan is working on this, but we're now also seeing more of the boards with this SoC out in the wild and we really do want eth working, so I'm going to take the series as-is as a bug-fix and we'll leave second port as a new feature to come in hopefully soon.
participants (2)
-
Mugunthan V N
-
Tom Rini