public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] NET: kirkwood-egiga smi access fix
@ 2010-01-19  5:39 Siddarth Gore
  2010-01-19 11:47 ` Prafulla Wadaskar
  2010-02-07  7:04 ` Ben Warren
  0 siblings, 2 replies; 3+ messages in thread
From: Siddarth Gore @ 2010-01-19  5:39 UTC (permalink / raw)
  To: u-boot

Although the datasheet mentions seperate smi registers for each
port, using Port 1 smi register to access ethernet phys does not
work. Hence only Port 0 smi register should be used to access all
devices connected to the smi bus. This behavior is consistant with
the mv643xx driver in the linux kernel.

Signed-off-by: Siddarth Gore <gores@marvell.com>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
---
 drivers/net/kirkwood_egiga.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/kirkwood_egiga.c b/drivers/net/kirkwood_egiga.c
index 07a86cd..2ad7fea 100644
--- a/drivers/net/kirkwood_egiga.c
+++ b/drivers/net/kirkwood_egiga.c
@@ -39,6 +39,7 @@
 #include "kirkwood_egiga.h"
 
 #define KIRKWOOD_PHY_ADR_REQUEST 0xee
+#define KWGBE_SMI_REG (((struct kwgbe_registers *)KW_EGIGA0_BASE)->smi)
 
 /*
  * smi_reg_read - miiphy_read callback function.
@@ -76,7 +77,7 @@ static int smi_reg_read(char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 	/* wait till the SMI is not busy */
 	do {
 		/* read smi register */
-		smi_reg = KWGBEREG_RD(regs->smi);
+		smi_reg = KWGBEREG_RD(KWGBE_SMI_REG);
 		if (timeout-- == 0) {
 			printf("Err..(%s) SMI busy timeout\n", __FUNCTION__);
 			return -EFAULT;
@@ -89,14 +90,14 @@ static int smi_reg_read(char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 		| KWGBE_PHY_SMI_OPCODE_READ;
 
 	/* write the smi register */
-	KWGBEREG_WR(regs->smi, smi_reg);
+	KWGBEREG_WR(KWGBE_SMI_REG, smi_reg);
 
 	/*wait till read value is ready */
 	timeout = KWGBE_PHY_SMI_TIMEOUT;
 
 	do {
 		/* read smi register */
-		smi_reg = KWGBEREG_RD(regs->smi);
+		smi_reg = KWGBEREG_RD(KWGBE_SMI_REG);
 		if (timeout-- == 0) {
 			printf("Err..(%s) SMI read ready timeout\n",
 				__FUNCTION__);
@@ -107,7 +108,7 @@ static int smi_reg_read(char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 	/* Wait for the data to update in the SMI register */
 	for (timeout = 0; timeout < KWGBE_PHY_SMI_TIMEOUT; timeout++) ;
 
-	*data = (u16) (KWGBEREG_RD(regs->smi) & KWGBE_PHY_SMI_DATA_MASK);
+	*data = (u16) (KWGBEREG_RD(KWGBE_SMI_REG) & KWGBE_PHY_SMI_DATA_MASK);
 
 	debug("%s:(adr %d, off %d) value= %04x\n", __FUNCTION__, phy_adr,
 		reg_ofs, *data);
@@ -150,7 +151,7 @@ static int smi_reg_write(char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
 	timeout = KWGBE_PHY_SMI_TIMEOUT;
 	do {
 		/* read smi register */
-		smi_reg = KWGBEREG_RD(regs->smi);
+		smi_reg = KWGBEREG_RD(KWGBE_SMI_REG);
 		if (timeout-- == 0) {
 			printf("Err..(%s) SMI busy timeout\n", __FUNCTION__);
 			return -ETIME;
@@ -164,7 +165,7 @@ static int smi_reg_write(char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
 	smi_reg &= ~KWGBE_PHY_SMI_OPCODE_READ;
 
 	/* write the smi register */
-	KWGBEREG_WR(regs->smi, smi_reg);
+	KWGBEREG_WR(KWGBE_SMI_REG, smi_reg);
 
 	return 0;
 }
-- 
1.6.0.3

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

* [U-Boot] [PATCH] NET: kirkwood-egiga smi access fix
  2010-01-19  5:39 [U-Boot] [PATCH] NET: kirkwood-egiga smi access fix Siddarth Gore
@ 2010-01-19 11:47 ` Prafulla Wadaskar
  2010-02-07  7:04 ` Ben Warren
  1 sibling, 0 replies; 3+ messages in thread
From: Prafulla Wadaskar @ 2010-01-19 11:47 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Siddarth Gore [mailto:gores at marvell.com] 
> Sent: Tuesday, January 19, 2010 11:09 AM
> To: u-boot at lists.denx.de
> Cc: Prafulla Wadaskar; Siddarth Gore
> Subject: [PATCH] NET: kirkwood-egiga smi access fix
> 
> Although the datasheet mentions seperate smi registers for 
> each port, using Port 1 smi register to access ethernet phys 
> does not work. Hence only Port 0 smi register should be used 
> to access all devices connected to the smi bus. This behavior 
> is consistant with the mv643xx driver in the linux kernel.
> 
> Signed-off-by: Siddarth Gore <gores@marvell.com>
> Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

Ack
I have tested this

Regards..
Prafulla . .

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

* [U-Boot] [PATCH] NET: kirkwood-egiga smi access fix
  2010-01-19  5:39 [U-Boot] [PATCH] NET: kirkwood-egiga smi access fix Siddarth Gore
  2010-01-19 11:47 ` Prafulla Wadaskar
@ 2010-02-07  7:04 ` Ben Warren
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Warren @ 2010-02-07  7:04 UTC (permalink / raw)
  To: u-boot

Siddarth,

On 1/18/2010 9:39 PM, Siddarth Gore wrote:
> Although the datasheet mentions seperate smi registers for each
> port, using Port 1 smi register to access ethernet phys does not
> work. Hence only Port 0 smi register should be used to access all
> devices connected to the smi bus. This behavior is consistant with
> the mv643xx driver in the linux kernel.
>
> Signed-off-by: Siddarth Gore<gores@marvell.com>
> Acked-by: Prafulla Wadaskar<prafulla@marvell.com>
> ---
>   drivers/net/kirkwood_egiga.c |   13 +++++++------
>   1 files changed, 7 insertions(+), 6 deletions(-)
>    
Applied to net repo.

thanks,
Ben

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

end of thread, other threads:[~2010-02-07  7:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19  5:39 [U-Boot] [PATCH] NET: kirkwood-egiga smi access fix Siddarth Gore
2010-01-19 11:47 ` Prafulla Wadaskar
2010-02-07  7:04 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox