All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] davinci: addition of emac features
@ 2011-09-30 11:57 nagabhushana.netagunte at ti.com
  2011-09-30 11:57 ` [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC nagabhushana.netagunte at ti.com
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: nagabhushana.netagunte at ti.com @ 2011-09-30 11:57 UTC (permalink / raw)
  To: u-boot

From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

These patches add features relating davinci emac driver.

First patch adds more features for EMAC-PHY auto-negotiation.
Second patch adds support for RMII in da830. Patch no.3
adds support in emac driver to work with any of the active
PHYs. Last patch removes config CONFIG_EMAC_MDIO_PHY_NUM
which becomes obsolete due to patch number 3.

Nagabhushana Netagunte (4):
  davinci: emac: add new features to autonegotiate for EMAC
  da830: emac: add support for RMII
  davinci: emac: add support for more than 1 PHYs
  davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM

 arch/arm/cpu/arm926ejs/davinci/et1011c.c      |    6 +-
 arch/arm/include/asm/arch-davinci/emac_defs.h |    4 -
 drivers/net/davinci_emac.c                    |  206 ++++++++++++++++---------
 include/configs/da830evm.h                    |    2 +-
 include/configs/da850_am18xxevm.h             |    2 +-
 include/configs/da850_l138evm.h               |    2 +-
 include/configs/davinci_dm365evm.h            |    1 -
 include/configs/davinci_dm6467Tevm.h          |    1 -
 include/configs/davinci_dm6467evm.h           |    1 -
 include/configs/davinci_dvevm.h               |    1 -
 include/configs/davinci_schmoogie.h           |    1 -
 include/configs/davinci_sffsdr.h              |    1 -
 include/configs/davinci_sonata.h              |    1 -
 include/configs/ea20.h                        |    1 -
 include/configs/hawkboard.h                   |    1 -
 include/miiphy.h                              |   67 ++++++++-
 16 files changed, 203 insertions(+), 95 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC
  2011-09-30 11:57 [U-Boot] [PATCH 0/4] davinci: addition of emac features nagabhushana.netagunte at ti.com
@ 2011-09-30 11:57 ` nagabhushana.netagunte at ti.com
  2011-09-30 21:07   ` Laurence Withers
  2011-09-30 11:57 ` [U-Boot] [PATCH 2/4] da830: emac: add support for RMII nagabhushana.netagunte at ti.com
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: nagabhushana.netagunte at ti.com @ 2011-09-30 11:57 UTC (permalink / raw)
  To: u-boot

From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

add more features like DUPLEX, 100MB link speed etc to auto negotiate
in EMAC driver. EMAC controller autonegotiates for these features with
PHYs which are on the board.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 drivers/net/davinci_emac.c |   38 +++++++++++++++++++++----
 include/miiphy.h           |   67 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 98 insertions(+), 7 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index c0b8929..be3aabf 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -279,20 +279,46 @@ static int gen_get_link_speed(int phy_addr)
 static int gen_auto_negotiate(int phy_addr)
 {
 	u_int16_t	tmp;
+	u_int16_t	val;
+	unsigned long	cntr = 0;
 
-	if (!davinci_eth_phy_read(phy_addr, MII_BMCR, &tmp))
+	if (!davinci_eth_phy_read(phy_addr, PHY_BMCR, &tmp))
+		return 0;
+
+	val = tmp | PHY_BMCR_DPLX | PHY_BMCR_AUTON |
+						PHY_BMCR_100MB;
+	davinci_eth_phy_write(phy_addr, PHY_BMCR, val);
+
+	if (!davinci_eth_phy_read(phy_addr, PHY_ANAR, &val))
+		return 0;
+
+	val |= (PHY_ANLPAR_TXFD | PHY_ANLPAR_TX | PHY_ANLPAR_10FD |
+							PHY_ANLPAR_10);
+	davinci_eth_phy_write(phy_addr, PHY_ANAR, val);
+
+	if (!davinci_eth_phy_read(phy_addr, PHY_BMCR, &tmp))
 		return(0);
 
 	/* Restart Auto_negotiation  */
-	tmp |= BMCR_ANENABLE;
-	davinci_eth_phy_write(phy_addr, MII_BMCR, tmp);
+	tmp |= PHY_BMCR_RST_NEG;
+	davinci_eth_phy_write(phy_addr, PHY_BMCR, tmp);
 
 	/*check AutoNegotiate complete */
-	udelay (10000);
-	if (!davinci_eth_phy_read(phy_addr, MII_BMSR, &tmp))
+	do {
+		udelay(40000);
+		if (!davinci_eth_phy_read(phy_addr, PHY_BMSR, &tmp))
+			return 0;
+
+		if (tmp & PHY_BMSR_AUTN_COMP)
+			break;
+
+		cntr++;
+	} while (cntr < 200);
+
+	if (!davinci_eth_phy_read(phy_addr, PHY_BMSR, &tmp))
 		return(0);
 
-	if (!(tmp & BMSR_ANEGCOMPLETE))
+	if (!(tmp & PHY_BMSR_AUTN_COMP))
 		return(0);
 
 	return(gen_get_link_speed(phy_addr));
diff --git a/include/miiphy.h b/include/miiphy.h
index 7e70cf8..a9be741 100644
--- a/include/miiphy.h
+++ b/include/miiphy.h
@@ -118,7 +118,72 @@ int bb_miiphy_write(const char *devname, unsigned char addr,
 #define FULL			44
 
 /* phy register offsets */
-#define MII_MIPSCR		0x11
+#define PHY_BMCR		0x00
+#define PHY_BMSR		0x01
+#define PHY_PHYIDR1		0x02
+#define PHY_PHYIDR2		0x03
+#define PHY_ANAR		0x04
+#define PHY_ANLPAR		0x05
+#define PHY_ANER		0x06
+#define PHY_ANNPTR		0x07
+#define PHY_ANLPNP		0x08
+#define PHY_1000BTCR		0x09
+#define PHY_1000BTSR		0x0A
+#define PHY_EXSR		0x0F
+#define PHY_PHYSTS		0x10
+#define PHY_MIPSCR		0x11
+#define PHY_MIPGSR		0x12
+#define PHY_DCR			0x13
+#define PHY_FCSCR		0x14
+#define PHY_RECR		0x15
+#define PHY_PCSR		0x16
+#define PHY_LBR			0x17
+#define PHY_10BTSCR		0x18
+#define PHY_PHYCTRL		0x19
+
+/* PHY BMCR */
+#define PHY_BMCR_RESET		0x8000
+#define PHY_BMCR_LOOP		0x4000
+#define PHY_BMCR_100MB		0x2000
+#define PHY_BMCR_AUTON		0x1000
+#define PHY_BMCR_POWD		0x0800
+#define PHY_BMCR_ISO		0x0400
+#define PHY_BMCR_RST_NEG	0x0200
+#define PHY_BMCR_DPLX		0x0100
+#define PHY_BMCR_COL_TST	0x0080
+
+#define PHY_BMCR_SPEED_MASK	0x2040
+#define PHY_BMCR_1000_MBPS	0x0040
+#define PHY_BMCR_100_MBPS	0x2000
+#define PHY_BMCR_10_MBPS	0x0000
+
+/* phy BMSR */
+#define PHY_BMSR_100T4		0x8000
+#define PHY_BMSR_100TXF		0x4000
+#define PHY_BMSR_100TXH		0x2000
+#define PHY_BMSR_10TF		0x1000
+#define PHY_BMSR_10TH		0x0800
+#define PHY_BMSR_EXT_STAT	0x0100
+#define PHY_BMSR_PRE_SUP	0x0040
+#define PHY_BMSR_AUTN_COMP	0x0020
+#define PHY_BMSR_RF		0x0010
+#define PHY_BMSR_AUTN_ABLE	0x0008
+#define PHY_BMSR_LS		0x0004
+#define PHY_BMSR_JD		0x0002
+#define PHY_BMSR_EXT		0x0001
+
+/*phy ANLPAR */
+#define PHY_ANLPAR_NP		0x8000
+#define PHY_ANLPAR_ACK		0x4000
+#define PHY_ANLPAR_RF		0x2000
+#define PHY_ANLPAR_ASYMP	0x0800
+#define PHY_ANLPAR_PAUSE	0x0400
+#define PHY_ANLPAR_T4		0x0200
+#define PHY_ANLPAR_TXFD		0x0100
+#define PHY_ANLPAR_TX		0x0080
+#define PHY_ANLPAR_10FD		0x0040
+#define PHY_ANLPAR_10		0x0020
+#define PHY_ANLPAR_100		0x0380	/* we can run@100 */
 
 /* MII_LPA */
 #define PHY_ANLPAR_PSB_802_3	0x0001
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/4] da830: emac: add support for RMII
  2011-09-30 11:57 [U-Boot] [PATCH 0/4] davinci: addition of emac features nagabhushana.netagunte at ti.com
  2011-09-30 11:57 ` [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC nagabhushana.netagunte at ti.com
@ 2011-09-30 11:57 ` nagabhushana.netagunte at ti.com
  2011-09-30 15:48   ` Mike Frysinger
  2011-09-30 11:57 ` [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs nagabhushana.netagunte at ti.com
  2011-09-30 11:57 ` [U-Boot] [PATCH 4/4] davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM nagabhushana.netagunte at ti.com
  3 siblings, 1 reply; 14+ messages in thread
From: nagabhushana.netagunte at ti.com @ 2011-09-30 11:57 UTC (permalink / raw)
  To: u-boot

From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

add support for RMII in davinci EMAC driver for da830. da850 RMII support
existed already in the driver. New configs are added to extend this support
for da830.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 drivers/net/davinci_emac.c        |    6 +++---
 include/configs/da830evm.h        |    1 +
 include/configs/da850_am18xxevm.h |    1 +
 include/configs/da850_l138evm.h   |    1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index be3aabf..0d67a06 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -246,7 +246,7 @@ static int gen_get_link_speed(int phy_addr)
 	if (davinci_eth_phy_read(phy_addr, MII_STATUS_REG, &tmp) &&
 			(tmp & 0x04)) {
 #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
-		defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+		defined(CONFIG_MACH_DAVINCI_DA8XX_EVM)
 		davinci_eth_phy_read(phy_addr, MII_LPA, &tmp);
 
 		/* Speed doesn't matter, there is no setting for it in EMAC. */
@@ -381,7 +381,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 #endif
 
 #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
-	defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+	defined(CONFIG_MACH_DAVINCI_DA8XX_EVM)
 	adap_ewrap->c0rxen = adap_ewrap->c1rxen = adap_ewrap->c2rxen = 0;
 	adap_ewrap->c0txen = adap_ewrap->c1txen = adap_ewrap->c2txen = 0;
 	adap_ewrap->c0miscen = adap_ewrap->c1miscen = adap_ewrap->c2miscen = 0;
@@ -541,7 +541,7 @@ static void davinci_eth_close(struct eth_device *dev)
 #endif
 
 #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
-	defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+	defined(CONFIG_MACH_DAVINCI_DA8XX_EVM)
 	adap_ewrap->c0rxen = adap_ewrap->c1rxen = adap_ewrap->c2rxen = 0;
 	adap_ewrap->c0txen = adap_ewrap->c1txen = adap_ewrap->c2txen = 0;
 	adap_ewrap->c0miscen = adap_ewrap->c1miscen = adap_ewrap->c2miscen = 0;
diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h
index a451513..b61443a 100644
--- a/include/configs/da830evm.h
+++ b/include/configs/da830evm.h
@@ -36,6 +36,7 @@
 #define CONFIG_MACH_DAVINCI_DA830_EVM
 #define CONFIG_ARM926EJS		/* arm926ejs CPU core */
 #define CONFIG_SOC_DA8XX		/* TI DA8xx SoC */
+#define CONFIG_MACH_DAVINCI_DA8XX_EVM
 #define CONFIG_SYS_CLK_FREQ		clk_get(DAVINCI_ARM_CLKID)
 #define CONFIG_SYS_OSCIN_FREQ		24000000
 #define CONFIG_SYS_TIMERBASE		DAVINCI_TIMER0_BASE
diff --git a/include/configs/da850_am18xxevm.h b/include/configs/da850_am18xxevm.h
index b525f14..8a65956 100644
--- a/include/configs/da850_am18xxevm.h
+++ b/include/configs/da850_am18xxevm.h
@@ -36,6 +36,7 @@
 #define CONFIG_MACH_DAVINCI_DA850_EVM
 #define CONFIG_ARM926EJS		/* arm926ejs CPU core */
 #define CONFIG_SOC_DA8XX		/* TI DA8xx SoC */
+#define CONFIG_MACH_DAVINCI_DA8XX_EVM
 #define CONFIG_SYS_CLK_FREQ		clk_get(DAVINCI_ARM_CLKID)
 #define CONFIG_SYS_OSCIN_FREQ		24000000
 #define CONFIG_SYS_TIMERBASE		DAVINCI_TIMER0_BASE
diff --git a/include/configs/da850_l138evm.h b/include/configs/da850_l138evm.h
index 9e4a652..afe00e8 100644
--- a/include/configs/da850_l138evm.h
+++ b/include/configs/da850_l138evm.h
@@ -36,6 +36,7 @@
 #define CONFIG_MACH_DAVINCI_DA850_EVM
 #define CONFIG_ARM926EJS		/* arm926ejs CPU core */
 #define CONFIG_SOC_DA8XX		/* TI DA8xx SoC */
+#define CONFIG_MACH_DAVINCI_DA8XX_EVM
 #define CONFIG_SYS_CLK_FREQ		clk_get(DAVINCI_ARM_CLKID)
 #define CONFIG_SYS_OSCIN_FREQ		24000000
 #define CONFIG_SYS_TIMERBASE		DAVINCI_TIMER0_BASE
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs
  2011-09-30 11:57 [U-Boot] [PATCH 0/4] davinci: addition of emac features nagabhushana.netagunte at ti.com
  2011-09-30 11:57 ` [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC nagabhushana.netagunte at ti.com
  2011-09-30 11:57 ` [U-Boot] [PATCH 2/4] da830: emac: add support for RMII nagabhushana.netagunte at ti.com
@ 2011-09-30 11:57 ` nagabhushana.netagunte at ti.com
  2011-09-30 20:29   ` Laurence Withers
  2011-10-06 21:16   ` Wolfgang Denk
  2011-09-30 11:57 ` [U-Boot] [PATCH 4/4] davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM nagabhushana.netagunte at ti.com
  3 siblings, 2 replies; 14+ messages in thread
From: nagabhushana.netagunte at ti.com @ 2011-09-30 11:57 UTC (permalink / raw)
  To: u-boot

From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

add support for more than 1 PHYs. Many of the davinci platforms have more
than 1 PHYs on thier board. This patch extends support in davinci emac
driver for upto 3 PHYs.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 drivers/net/davinci_emac.c |  148 +++++++++++++++++++++++++++-----------------
 1 files changed, 90 insertions(+), 58 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 0d67a06..ed8fbfe 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -81,9 +81,12 @@ static int			emac_rx_queue_active = 0;
 static unsigned char		emac_rx_buffers[EMAC_MAX_RX_BUFFERS * (EMAC_MAX_ETHERNET_PKT_SIZE + EMAC_PKT_ALIGN)];
 
 /* PHY address for a discovered PHY (0xff - not found) */
-static volatile u_int8_t	active_phy_addr = 0xff;
+static volatile u_int8_t	active_phy_addr[3] = { 0xff, 0xff, 0xff };
 
-phy_t				phy;
+/* number of PHY found active */
+static volatile u_int8_t	num_phy;
+
+phy_t				phy[3];
 
 static int davinci_eth_set_mac_addr(struct eth_device *dev)
 {
@@ -147,27 +150,30 @@ static int davinci_eth_phy_detect(void)
 {
 	u_int32_t	phy_act_state;
 	int		i;
+	int		j;
+	unsigned int	count = 0;
+
+	active_phy_addr[0] = 0xff;
+	active_phy_addr[1] = 0xff;
+	active_phy_addr[2] = 0xff;
 
-	active_phy_addr = 0xff;
+	udelay(1000);
+	phy_act_state = readl(&adap_mdio->ALIVE);
 
-	phy_act_state = readl(&adap_mdio->ALIVE) & EMAC_MDIO_PHY_MASK;
 	if (phy_act_state == 0)
-		return(0);				/* No active PHYs */
+		return 0;		/* No active PHYs */
 
 	debug_emac("davinci_eth_phy_detect(), ALIVE = 0x%08x\n", phy_act_state);
 
-	for (i = 0; i < 32; i++) {
+	for (i = 0, j = 0; i < 32; i++)
 		if (phy_act_state & (1 << i)) {
-			if (phy_act_state & ~(1 << i))
-				return(0);		/* More than one PHY */
-			else {
-				active_phy_addr = i;
-				return(1);
-			}
+			count++;
+			active_phy_addr[j++] = i;
 		}
-	}
 
-	return(0);	/* Just to make GCC happy */
+	num_phy = count;
+
+	return count;
 }
 
 
@@ -236,7 +242,18 @@ static int gen_is_phy_connected(int phy_addr)
 {
 	u_int16_t	dummy;
 
-	return(davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy));
+	return davinci_eth_phy_read(phy_addr, PHY_PHYIDR1, &dummy);
+}
+
+static int get_active_phy(void)
+{
+	int i;
+
+	for (i = 0; i < num_phy; i++)
+		if (phy[i].get_link_speed(active_phy_addr[i]))
+			return i;
+
+	return -1;	/* Return error if no link */
 }
 
 static int gen_get_link_speed(int phy_addr)
@@ -362,6 +379,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	dv_reg_p		addr;
 	u_int32_t		clkdiv, cnt;
 	volatile emac_desc	*rx_desc;
+	int			index;
 
 	debug_emac("+ emac_open\n");
 
@@ -460,7 +478,8 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	/* We need to wait for MDIO to start */
 	udelay(1000);
 
-	if (!phy.get_link_speed(active_phy_addr))
+	index = get_active_phy();
+	if (index == -1)
 		return(0);
 
 	emac_gigabit_enable();
@@ -559,12 +578,12 @@ static int davinci_eth_send_packet (struct eth_device *dev,
 					volatile void *packet, int length)
 {
 	int ret_status = -1;
-
+	int index;
 	tx_send_loop = 0;
 
-	/* Return error if no link */
-	if (!phy.get_link_speed (active_phy_addr)) {
-		printf ("WARN: emac_send_packet: No link\n");
+	index = get_active_phy();
+	if (index == -1) {
+		printf(" WARN: emac_send_packet: No link\n");
 		return (ret_status);
 	}
 
@@ -588,7 +607,7 @@ static int davinci_eth_send_packet (struct eth_device *dev,
 
 	/* Wait for packet to complete or link down */
 	while (1) {
-		if (!phy.get_link_speed (active_phy_addr)) {
+		if (!phy[index].get_link_speed(active_phy_addr[index])) {
 			davinci_eth_ch_teardown (EMAC_CH_TX);
 			return (ret_status);
 		}
@@ -685,6 +704,7 @@ int davinci_emac_initialize(void)
 	u_int32_t	phy_id;
 	u_int16_t	tmp;
 	int		i;
+	int		ret;
 	struct eth_device *dev;
 
 	dev = malloc(sizeof *dev);
@@ -709,7 +729,7 @@ int davinci_emac_initialize(void)
 	for (i = 0; i < 256; i++) {
 		if (readl(&adap_mdio->ALIVE))
 			break;
-		udelay(10);
+		udelay(1000);
 	}
 
 	if (i >= 256) {
@@ -717,57 +737,69 @@ int davinci_emac_initialize(void)
 		return(0);
 	}
 
-	/* Find if a PHY is connected and get it's address */
-	if (!davinci_eth_phy_detect())
+	/* Find if PHY(s) is/are connected */
+	ret = davinci_eth_phy_detect();
+	if (!ret)
 		return(0);
+	else
+		printf(" %d ETH PHY detected\n", ret);
 
 	/* Get PHY ID and initialize phy_ops for a detected PHY */
-	if (!davinci_eth_phy_read(active_phy_addr, MII_PHYSID1, &tmp)) {
-		active_phy_addr = 0xff;
-		return(0);
-	}
+	for (i = 0; i < num_phy; i++) {
+		if (!davinci_eth_phy_read(active_phy_addr[i], PHY_PHYIDR1,
+							&tmp)) {
+			active_phy_addr[i] = 0xff;
+			continue;
+		}
 
-	phy_id = (tmp << 16) & 0xffff0000;
+		phy_id = (tmp << 16) & 0xffff0000;
 
-	if (!davinci_eth_phy_read(active_phy_addr, MII_PHYSID2, &tmp)) {
-		active_phy_addr = 0xff;
-		return(0);
-	}
+		if (!davinci_eth_phy_read(active_phy_addr[i], PHY_PHYIDR2,
+							&tmp)) {
+			active_phy_addr[i] = 0xff;
+			continue;
+		}
 
-	phy_id |= tmp & 0x0000ffff;
+		phy_id |= tmp & 0x0000ffff;
 
-	switch (phy_id) {
+		switch (phy_id) {
 		case PHY_LXT972:
-			sprintf(phy.name, "LXT972 @ 0x%02x", active_phy_addr);
-			phy.init = lxt972_init_phy;
-			phy.is_phy_connected = lxt972_is_phy_connected;
-			phy.get_link_speed = lxt972_get_link_speed;
-			phy.auto_negotiate = lxt972_auto_negotiate;
+			sprintf(phy[i].name, "LXT972 @ 0x%02x",
+						active_phy_addr[i]);
+			phy[i].init = lxt972_init_phy;
+			phy[i].is_phy_connected = lxt972_is_phy_connected;
+			phy[i].get_link_speed = lxt972_get_link_speed;
+			phy[i].auto_negotiate = lxt972_auto_negotiate;
 			break;
 		case PHY_DP83848:
-			sprintf(phy.name, "DP83848 @ 0x%02x", active_phy_addr);
-			phy.init = dp83848_init_phy;
-			phy.is_phy_connected = dp83848_is_phy_connected;
-			phy.get_link_speed = dp83848_get_link_speed;
-			phy.auto_negotiate = dp83848_auto_negotiate;
+			sprintf(phy[i].name, "DP83848 @ 0x%02x",
+						active_phy_addr[i]);
+			phy[i].init = dp83848_init_phy;
+			phy[i].is_phy_connected = dp83848_is_phy_connected;
+			phy[i].get_link_speed = dp83848_get_link_speed;
+			phy[i].auto_negotiate = dp83848_auto_negotiate;
 			break;
 		case PHY_ET1011C:
-			sprintf(phy.name, "ET1011C @ 0x%02x", active_phy_addr);
-			phy.init = gen_init_phy;
-			phy.is_phy_connected = gen_is_phy_connected;
-			phy.get_link_speed = et1011c_get_link_speed;
-			phy.auto_negotiate = gen_auto_negotiate;
+			sprintf(phy[i].name, "ET1011C @ 0x%02x",
+						active_phy_addr[i]);
+			phy[i].init = gen_init_phy;
+			phy[i].is_phy_connected = gen_is_phy_connected;
+			phy[i].get_link_speed = et1011c_get_link_speed;
+			phy[i].auto_negotiate = gen_auto_negotiate;
 			break;
 		default:
-			sprintf(phy.name, "GENERIC @ 0x%02x", active_phy_addr);
-			phy.init = gen_init_phy;
-			phy.is_phy_connected = gen_is_phy_connected;
-			phy.get_link_speed = gen_get_link_speed;
-			phy.auto_negotiate = gen_auto_negotiate;
-	}
+			sprintf(phy[i].name, "GENERIC @ 0x%02x",
+						active_phy_addr[i]);
+			phy[i].init = gen_init_phy;
+			phy[i].is_phy_connected = gen_is_phy_connected;
+			phy[i].get_link_speed = gen_get_link_speed;
+			phy[i].auto_negotiate = gen_auto_negotiate;
+		}
 
-	printf("Ethernet PHY: %s\n", phy.name);
+		printf("Ethernet PHY: %s\n", phy[i].name);
 
-	miiphy_register(phy.name, davinci_mii_phy_read, davinci_mii_phy_write);
+		miiphy_register(phy[i].name, davinci_mii_phy_read,
+						davinci_mii_phy_write);
+	}
 	return(1);
 }
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 4/4] davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM
  2011-09-30 11:57 [U-Boot] [PATCH 0/4] davinci: addition of emac features nagabhushana.netagunte at ti.com
                   ` (2 preceding siblings ...)
  2011-09-30 11:57 ` [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs nagabhushana.netagunte at ti.com
@ 2011-09-30 11:57 ` nagabhushana.netagunte at ti.com
  3 siblings, 0 replies; 14+ messages in thread
From: nagabhushana.netagunte at ti.com @ 2011-09-30 11:57 UTC (permalink / raw)
  To: u-boot

From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

remove macro CONFIG_EMAC_MDIO_PHY_NUM and depending macro EMAC_MDIO_PHY_NUM
as they are no longer needed with the support for more than 1 PHYs in davinci
emac driver.davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM

Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 arch/arm/cpu/arm926ejs/davinci/et1011c.c      |    6 ++----
 arch/arm/include/asm/arch-davinci/emac_defs.h |    4 ----
 drivers/net/davinci_emac.c                    |   14 +++++++-------
 include/configs/da830evm.h                    |    1 -
 include/configs/da850_am18xxevm.h             |    1 -
 include/configs/da850_l138evm.h               |    1 -
 include/configs/davinci_dm365evm.h            |    1 -
 include/configs/davinci_dm6467Tevm.h          |    1 -
 include/configs/davinci_dm6467evm.h           |    1 -
 include/configs/davinci_dvevm.h               |    1 -
 include/configs/davinci_schmoogie.h           |    1 -
 include/configs/davinci_sffsdr.h              |    1 -
 include/configs/davinci_sonata.h              |    1 -
 include/configs/ea20.h                        |    1 -
 include/configs/hawkboard.h                   |    1 -
 15 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/davinci/et1011c.c b/arch/arm/cpu/arm926ejs/davinci/et1011c.c
index da07345..df35e44 100644
--- a/arch/arm/cpu/arm926ejs/davinci/et1011c.c
+++ b/arch/arm/cpu/arm926ejs/davinci/et1011c.c
@@ -39,11 +39,9 @@ int et1011c_get_link_speed(int phy_addr)
 	u_int16_t	data;
 
 	if (davinci_eth_phy_read(phy_addr, MII_STATUS_REG, &data) && (data & 0x04)) {
-		davinci_eth_phy_read(EMAC_MDIO_PHY_NUM,
-				MII_PHY_CONFIG_REG, &data);
+		davinci_eth_phy_read(phy_addr, MII_PHY_CONFIG_REG, &data);
 		/* Enable 125MHz clock sourced from PHY */
-		davinci_eth_phy_write(EMAC_MDIO_PHY_NUM,
-			MII_PHY_CONFIG_REG,
+		davinci_eth_phy_write(phy_addr, MII_PHY_CONFIG_REG,
 			data | PHY_SYS_CLK_EN);
 		return (1);
 	}
diff --git a/arch/arm/include/asm/arch-davinci/emac_defs.h b/arch/arm/include/asm/arch-davinci/emac_defs.h
index 4a4ee04..21e1fd7 100644
--- a/arch/arm/include/asm/arch-davinci/emac_defs.h
+++ b/arch/arm/include/asm/arch-davinci/emac_defs.h
@@ -84,10 +84,6 @@
 #define EMAC_MDIO_CLOCK_FREQ		2000000		/* 2.0 MHz */
 #endif
 
-/* PHY mask - set only those phy number bits where phy is/can be connected */
-#define EMAC_MDIO_PHY_NUM           CONFIG_EMAC_MDIO_PHY_NUM
-#define EMAC_MDIO_PHY_MASK          (1 << EMAC_MDIO_PHY_NUM)
-
 /* Ethernet Min/Max packet size */
 #define EMAC_MIN_ETHERNET_PKT_SIZE	60
 #define EMAC_MAX_ETHERNET_PKT_SIZE	1518
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index ed8fbfe..2af7026 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -48,9 +48,9 @@ unsigned int	emac_dbg = 0;
 #define debug_emac(fmt,args...)	if (emac_dbg) printf(fmt,##args)
 
 #ifdef DAVINCI_EMAC_GIG_ENABLE
-#define emac_gigabit_enable()	davinci_eth_gigabit_enable()
+#define emac_gigabit_enable(phy_addr)	davinci_eth_gigabit_enable(phy_addr)
 #else
-#define emac_gigabit_enable()	/* no gigabit to enable */
+#define emac_gigabit_enable(phy_addr)	/* no gigabit to enable */
 #endif
 
 static void davinci_eth_mdio_enable(void);
@@ -355,11 +355,11 @@ static int davinci_mii_phy_write(const char *devname, unsigned char addr, unsign
 }
 #endif
 
-static void  __attribute__((unused)) davinci_eth_gigabit_enable(void)
+static void  __attribute__((unused)) davinci_eth_gigabit_enable(int phy_addr)
 {
 	u_int16_t data;
 
-	if (davinci_eth_phy_read(EMAC_MDIO_PHY_NUM, 0, &data)) {
+	if (davinci_eth_phy_read(phy_addr, 0, &data)) {
 		if (data & (1 << 6)) { /* speed selection MSB */
 			/*
 			 * Check if link detected is giga-bit
@@ -482,7 +482,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	if (index == -1)
 		return(0);
 
-	emac_gigabit_enable();
+	emac_gigabit_enable(active_phy_addr[index]);
 
 	/* Start receive process */
 	writel((u_int32_t)emac_rx_desc, &adap_emac->RX0HDP);
@@ -587,7 +587,7 @@ static int davinci_eth_send_packet (struct eth_device *dev,
 		return (ret_status);
 	}
 
-	emac_gigabit_enable();
+	emac_gigabit_enable(active_phy_addr[index]);
 
 	/* Check packet size and if < EMAC_MIN_ETHERNET_PKT_SIZE, pad it up */
 	if (length < EMAC_MIN_ETHERNET_PKT_SIZE) {
@@ -612,7 +612,7 @@ static int davinci_eth_send_packet (struct eth_device *dev,
 			return (ret_status);
 		}
 
-		emac_gigabit_enable();
+		emac_gigabit_enable(active_phy_addr[index]);
 
 		if (readl(&adap_emac->TXINTSTATRAW) & 0x01) {
 			ret_status = length;
diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h
index b61443a..eaf40ea 100644
--- a/include/configs/da830evm.h
+++ b/include/configs/da830evm.h
@@ -88,7 +88,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/da850_am18xxevm.h b/include/configs/da850_am18xxevm.h
index 8a65956..47b7e70 100644
--- a/include/configs/da850_am18xxevm.h
+++ b/include/configs/da850_am18xxevm.h
@@ -125,7 +125,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/da850_l138evm.h b/include/configs/da850_l138evm.h
index afe00e8..abaa45d 100644
--- a/include/configs/da850_l138evm.h
+++ b/include/configs/da850_l138evm.h
@@ -118,7 +118,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_dm365evm.h b/include/configs/davinci_dm365evm.h
index 28b9db9..f80de3d 100644
--- a/include/configs/davinci_dm365evm.h
+++ b/include/configs/davinci_dm365evm.h
@@ -60,7 +60,6 @@
 
 /* Network Configuration */
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_dm6467Tevm.h b/include/configs/davinci_dm6467Tevm.h
index d4eaeab..33b3923 100644
--- a/include/configs/davinci_dm6467Tevm.h
+++ b/include/configs/davinci_dm6467Tevm.h
@@ -85,7 +85,6 @@ extern unsigned int davinci_arm_clk_get(void);
 
 /* Network & Ethernet Configuration */
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_dm6467evm.h b/include/configs/davinci_dm6467evm.h
index 8b33288..7a09bd8 100644
--- a/include/configs/davinci_dm6467evm.h
+++ b/include/configs/davinci_dm6467evm.h
@@ -84,7 +84,6 @@ extern unsigned int davinci_arm_clk_get(void);
 
 /* Network & Ethernet Configuration */
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_dvevm.h b/include/configs/davinci_dvevm.h
index 2e56501..d13ccb5 100644
--- a/include/configs/davinci_dvevm.h
+++ b/include/configs/davinci_dvevm.h
@@ -104,7 +104,6 @@
 /* Network & Ethernet Configuration */
 /*==================================*/
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_schmoogie.h b/include/configs/davinci_schmoogie.h
index 29a3db7..8630dff 100644
--- a/include/configs/davinci_schmoogie.h
+++ b/include/configs/davinci_schmoogie.h
@@ -67,7 +67,6 @@
 /* Network & Ethernet Configuration */
 /*==================================*/
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_sffsdr.h b/include/configs/davinci_sffsdr.h
index 3c1ff28..f521765 100644
--- a/include/configs/davinci_sffsdr.h
+++ b/include/configs/davinci_sffsdr.h
@@ -64,7 +64,6 @@
 #define CONFIG_SYS_I2C_SLAVE		10	/* Bogus, master-only in U-Boot */
 /* Network & Ethernet Configuration */
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/davinci_sonata.h b/include/configs/davinci_sonata.h
index 00b1068..97b6d8d 100644
--- a/include/configs/davinci_sonata.h
+++ b/include/configs/davinci_sonata.h
@@ -100,7 +100,6 @@
 /* Network & Ethernet Configuration */
 /*==================================*/
 #define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/ea20.h b/include/configs/ea20.h
index 48ce945..6da60f1 100644
--- a/include/configs/ea20.h
+++ b/include/configs/ea20.h
@@ -86,7 +86,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/include/configs/hawkboard.h b/include/configs/hawkboard.h
index 23a88d0..1bf6a16 100644
--- a/include/configs/hawkboard.h
+++ b/include/configs/hawkboard.h
@@ -83,7 +83,6 @@
 /*
  * Network & Ethernet Configuration
  */
-#define CONFIG_EMAC_MDIO_PHY_NUM	0x7
 #if !defined(CONFIG_NAND_SPL)
 #define CONFIG_DRIVER_TI_EMAC
 #endif
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/4] da830: emac: add support for RMII
  2011-09-30 11:57 ` [U-Boot] [PATCH 2/4] da830: emac: add support for RMII nagabhushana.netagunte at ti.com
@ 2011-09-30 15:48   ` Mike Frysinger
  2011-10-02  8:38     ` Igor Grinberg
  2011-10-03 14:07     ` Laurence Withers
  0 siblings, 2 replies; 14+ messages in thread
From: Mike Frysinger @ 2011-09-30 15:48 UTC (permalink / raw)
  To: u-boot

On Friday, September 30, 2011 07:57:10 nagabhushana.netagunte at ti.com wrote:
> --- a/drivers/net/davinci_emac.c
> +++ b/drivers/net/davinci_emac.c
> @@ -246,7 +246,7 @@ static int gen_get_link_speed(int phy_addr)
>  	if (davinci_eth_phy_read(phy_addr, MII_STATUS_REG, &tmp) &&
>  			(tmp & 0x04)) {
>  #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \

there's a common CONFIG_RMII symbol already ...

> -		defined(CONFIG_MACH_DAVINCI_DA850_EVM)
> +		defined(CONFIG_MACH_DAVINCI_DA8XX_EVM)

maybe it's just me, but board level defines in an emac driver make no sense
-mike

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs
  2011-09-30 11:57 ` [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs nagabhushana.netagunte at ti.com
@ 2011-09-30 20:29   ` Laurence Withers
  2011-10-11  6:57     ` Hadli, Manjunath
  2011-10-06 21:16   ` Wolfgang Denk
  1 sibling, 1 reply; 14+ messages in thread
From: Laurence Withers @ 2011-09-30 20:29 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 30, 2011 at 05:27:11PM +0530, nagabhushana.netagunte at ti.com wrote:
> add support for more than 1 PHYs. Many of the davinci platforms have more
> than 1 PHYs on thier board. This patch extends support in davinci emac
> driver for upto 3 PHYs.

As a nitpick, there is a typo in "thier", which should be "their".

But a real question: where does the number 3 come from? It seems rather
arbitrary, at least without any explanatory comments. The MDIO interface can
support up to 31 devices, so perhaps you should allow for that many PHYs?
(Or perhaps a limit configurable with a #define, as it would seem wasteful
to allocate memory for 31 phy_t structures when I doubt there are any boards
that could truly take advantage of that).

Bye for now,
-- 
Laurence Withers, <lwithers@guralp.com>                http://www.guralp.com/
Direct tel:+447753988197 or tel:+443333408643               Software Engineer
General support queries: <support@guralp.com>         CMG-DCM CMG-EAM CMG-NAM

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC
  2011-09-30 11:57 ` [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC nagabhushana.netagunte at ti.com
@ 2011-09-30 21:07   ` Laurence Withers
  2011-10-04 13:53     ` Netagunte, Nagabhushana
  2011-10-11  7:00     ` Hadli, Manjunath
  0 siblings, 2 replies; 14+ messages in thread
From: Laurence Withers @ 2011-09-30 21:07 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 30, 2011 at 05:27:09PM +0530, nagabhushana.netagunte at ti.com wrote:
> From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> 
> add more features like DUPLEX, 100MB link speed etc to auto negotiate
> in EMAC driver. EMAC controller autonegotiates for these features with
> PHYs which are on the board.
> 
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

I tried this on a board I am developing with an OMAP-L138. I have a managed
switch and tried a few different port settings (auto negotiate enabled and
disabled etc.) with no problems at all. If you like, please feel free to add:

Tested-by: Laurence Withers <lwithers@guralp.com>

Bye for now,
-- 
Laurence Withers, <lwithers@guralp.com>                http://www.guralp.com/
Direct tel:+447753988197 or tel:+443333408643               Software Engineer
General support queries: <support@guralp.com>         CMG-DCM CMG-EAM CMG-NAM

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/4] da830: emac: add support for RMII
  2011-09-30 15:48   ` Mike Frysinger
@ 2011-10-02  8:38     ` Igor Grinberg
  2011-10-03 14:07     ` Laurence Withers
  1 sibling, 0 replies; 14+ messages in thread
From: Igor Grinberg @ 2011-10-02  8:38 UTC (permalink / raw)
  To: u-boot

On 09/30/11 18:48, Mike Frysinger wrote:
> On Friday, September 30, 2011 07:57:10 nagabhushana.netagunte at ti.com wrote:
>> --- a/drivers/net/davinci_emac.c
>> +++ b/drivers/net/davinci_emac.c
>> @@ -246,7 +246,7 @@ static int gen_get_link_speed(int phy_addr)
>>  	if (davinci_eth_phy_read(phy_addr, MII_STATUS_REG, &tmp) &&
>>  			(tmp & 0x04)) {
>>  #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
> 
> there's a common CONFIG_RMII symbol already ...
> 
>> -		defined(CONFIG_MACH_DAVINCI_DA850_EVM)
>> +		defined(CONFIG_MACH_DAVINCI_DA8XX_EVM)
> 
> maybe it's just me, but board level defines in an emac driver make no sense

No, it is not just you ;)
Davinci EMAC is used also in non davinci SoCs and restricting its
features to some board (or family of boards) indeed makes no sense.
There must be a good reason for doing so, otherwise that board
specific config should be removed.


-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/4] da830: emac: add support for RMII
  2011-09-30 15:48   ` Mike Frysinger
  2011-10-02  8:38     ` Igor Grinberg
@ 2011-10-03 14:07     ` Laurence Withers
  1 sibling, 0 replies; 14+ messages in thread
From: Laurence Withers @ 2011-10-03 14:07 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 30, 2011 at 11:48:13AM -0400, Mike Frysinger wrote:
> On Friday, September 30, 2011 07:57:10 nagabhushana.netagunte at ti.com wrote:
> > --- a/drivers/net/davinci_emac.c
> > +++ b/drivers/net/davinci_emac.c
> > @@ -246,7 +246,7 @@ static int gen_get_link_speed(int phy_addr)
> >  	if (davinci_eth_phy_read(phy_addr, MII_STATUS_REG, &tmp) &&
> >  			(tmp & 0x04)) {
> >  #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
> 
> there's a common CONFIG_RMII symbol already ...
> 
> > -		defined(CONFIG_MACH_DAVINCI_DA850_EVM)
> > +		defined(CONFIG_MACH_DAVINCI_DA8XX_EVM)
> 
> maybe it's just me, but board level defines in an emac driver make no sense

This led me to look a bit more closely at this code, and I think there is
something wrong with it. Under Linux, I am able to run in RMII mode at either
10BASE-T or 100BASE-TX, either by forcing it on the board with ethtool or by
forcing it on the managed switch.

However, the driver in U-Boot fails to work with 10BASE-T altogether. A
simple change to #if defined(CONFIG_SOC_DA8XX) doesn't seem to resolve the
situation so it would appear there are some bugs in the TI EMAC driver. I
also note it doesn't reset the PHY properly as if I reboot from Linux with
the PHY forced to 10BASE-T then U-Boot is no longer able to get the link up.

Bye for now,
-- 
Laurence Withers, <lwithers@guralp.com>                http://www.guralp.com/
Direct tel:+447753988197 or tel:+443333408643               Software Engineer
General support queries: <support@guralp.com>         CMG-DCM CMG-EAM CMG-NAM

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC
  2011-09-30 21:07   ` Laurence Withers
@ 2011-10-04 13:53     ` Netagunte, Nagabhushana
  2011-10-11  7:00     ` Hadli, Manjunath
  1 sibling, 0 replies; 14+ messages in thread
From: Netagunte, Nagabhushana @ 2011-10-04 13:53 UTC (permalink / raw)
  To: u-boot

Laurence,
 On Sat, Oct 01, 2011 at 02:37:34, Laurence Withers wrote:
> On Fri, Sep 30, 2011 at 05:27:09PM +0530, nagabhushana.netagunte at ti.com wrote:
> > From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> > 
> > add more features like DUPLEX, 100MB link speed etc to auto negotiate 
> > in EMAC driver. EMAC controller autonegotiates for these features with 
> > PHYs which are on the board.
> > 
> > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> 
> I tried this on a board I am developing with an OMAP-L138. I have a managed switch and tried a few different port settings (auto negotiate enabled and disabled etc.) with no problems at all. If you like, please feel free to add:
> 
> Tested-by: Laurence Withers <lwithers@guralp.com>
Thank you for testing!
-Nag
> 
> Bye for now,
> -- 
> Laurence Withers, <lwithers@guralp.com>                http://www.guralp.com/
> Direct tel:+447753988197 or tel:+443333408643               Software Engineer
> General support queries: <support@guralp.com>         CMG-DCM CMG-EAM CMG-NAM
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs
  2011-09-30 11:57 ` [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs nagabhushana.netagunte at ti.com
  2011-09-30 20:29   ` Laurence Withers
@ 2011-10-06 21:16   ` Wolfgang Denk
  1 sibling, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2011-10-06 21:16 UTC (permalink / raw)
  To: u-boot

Dear nagabhushana.netagunte at ti.com,

In message <1317383832-23480-4-git-send-email-nagabhushana.netagunte@ti.com> you wrote:
> From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> 
> add support for more than 1 PHYs. Many of the davinci platforms have more
> than 1 PHYs on thier board. This patch extends support in davinci emac
> driver for upto 3 PHYs.
> 
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> ---
>  drivers/net/davinci_emac.c |  148 +++++++++++++++++++++++++++-----------------
>  1 files changed, 90 insertions(+), 58 deletions(-)

Checkpatch says:

total: 0 errors, 2 warnings, 235 lines checked

Please clean up and resubmit.  Thanks.

Best regards,

Wolfgang Denk

-- 
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
"A great many people think they are thinking when they are merely re-
arranging their prejudices."                          - William James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs
  2011-09-30 20:29   ` Laurence Withers
@ 2011-10-11  6:57     ` Hadli, Manjunath
  0 siblings, 0 replies; 14+ messages in thread
From: Hadli, Manjunath @ 2011-10-11  6:57 UTC (permalink / raw)
  To: u-boot

Laurence,
On Sat, Oct 01, 2011 at 01:59:30, Laurence Withers wrote:
> On Fri, Sep 30, 2011 at 05:27:11PM +0530, nagabhushana.netagunte at ti.com wrote:
> > add support for more than 1 PHYs. Many of the davinci platforms have 
> > more than 1 PHYs on thier board. This patch extends support in davinci 
> > emac driver for upto 3 PHYs.
> 
> As a nitpick, there is a typo in "thier", which should be "their".
Thanks!

> 
> But a real question: where does the number 3 come from? It seems rather arbitrary, at least without any explanatory comments. The MDIO interface can support up to 31 devices, so perhaps you should allow for that many PHYs?
> (Or perhaps a limit configurable with a #define, as it would seem wasteful to allocate memory for 31 phy_t structures when I doubt there are any boards that could truly take advantage of that).
Agreed. The reason why it is 3 is because it is currently detecting only 3 at the max (on DA830), although the support is for 32 nos. We will #define it is 3 and latter boards can possibly change that depending on the board support.

Thx and Regards,
-Mat anju
> 
> Bye for now,
> -- 
> Laurence Withers, <lwithers@guralp.com>                http://www.guralp.com/
> Direct tel:+447753988197 or tel:+443333408643               Software Engineer
> General support queries: <support@guralp.com>         CMG-DCM CMG-EAM CMG-NAM
> 
	

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC
  2011-09-30 21:07   ` Laurence Withers
  2011-10-04 13:53     ` Netagunte, Nagabhushana
@ 2011-10-11  7:00     ` Hadli, Manjunath
  1 sibling, 0 replies; 14+ messages in thread
From: Hadli, Manjunath @ 2011-10-11  7:00 UTC (permalink / raw)
  To: u-boot

Laurence,
On Sat, Oct 01, 2011 at 02:37:34, Laurence Withers wrote:
> On Fri, Sep 30, 2011 at 05:27:09PM +0530, nagabhushana.netagunte at ti.com wrote:
> > From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> > 
> > add more features like DUPLEX, 100MB link speed etc to auto negotiate 
> > in EMAC driver. EMAC controller autonegotiates for these features with 
> > PHYs which are on the board.
> > 
> > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> 
> I tried this on a board I am developing with an OMAP-L138. I have a managed switch and tried a few different port settings (auto negotiate enabled and disabled etc.) with no problems at all. If you like, please feel free to add:
> 
> Tested-by: Laurence Withers <lwithers@guralp.com>
> 
Thank you!
-Manju

> Bye for now,
> -- 
> Laurence Withers, <lwithers@guralp.com>                http://www.guralp.com/
> Direct tel:+447753988197 or tel:+443333408643               Software Engineer
> General support queries: <support@guralp.com>         CMG-DCM CMG-EAM CMG-NAM
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-10-11  7:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-30 11:57 [U-Boot] [PATCH 0/4] davinci: addition of emac features nagabhushana.netagunte at ti.com
2011-09-30 11:57 ` [U-Boot] [PATCH 1/4] davinci: emac: add new features to autonegotiate for EMAC nagabhushana.netagunte at ti.com
2011-09-30 21:07   ` Laurence Withers
2011-10-04 13:53     ` Netagunte, Nagabhushana
2011-10-11  7:00     ` Hadli, Manjunath
2011-09-30 11:57 ` [U-Boot] [PATCH 2/4] da830: emac: add support for RMII nagabhushana.netagunte at ti.com
2011-09-30 15:48   ` Mike Frysinger
2011-10-02  8:38     ` Igor Grinberg
2011-10-03 14:07     ` Laurence Withers
2011-09-30 11:57 ` [U-Boot] [PATCH 3/4] davinci: emac: add support for more than 1 PHYs nagabhushana.netagunte at ti.com
2011-09-30 20:29   ` Laurence Withers
2011-10-11  6:57     ` Hadli, Manjunath
2011-10-06 21:16   ` Wolfgang Denk
2011-09-30 11:57 ` [U-Boot] [PATCH 4/4] davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM nagabhushana.netagunte at ti.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.