Skip to contentSkip to conversation

NET: Move MDIO regs out of TSEC Space

PATCH Superseded Sandeep Gopalpet 4 participants 6 messages Oct 28, 2009 – Oct 29, 2009 Network drivers

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 NET: Move MDIO regs out of TSEC Space

Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for etsec2.0 can be provided.

This patch helps in providing the support for etsec2.0 In etsec2.0, the MDIO register space and the etsec reg space are different.

Also, moved the TSEC_BASE_ADDR and MDIO_BASE_ADDR definitons into platform specific files.

---
 drivers/net/tsec.c           |   19 ++++++++---------
 include/asm-ppc/immap_83xx.h |    9 ++++++++
 include/asm-ppc/immap_85xx.h |   10 +++++++++
 include/asm-ppc/immap_86xx.h |    9 ++++++++
 include/tsec.h               |   45 ++++++++++++++++++++---------------------
 5 files changed, 59 insertions(+), 33 deletions(-)
drivers/net/tsec.c +9 -10
index 3f74118..34f3be9 100644
@@ -80,7 +80,7 @@ static struct tsec_info_struct tsec_info[] = {
 #ifdef CONFIG_MPC85XX_FEC
 	{
 		.regs = (tsec_t *)(TSEC_BASE_ADDR + 0x2000),
-		.miiregs = (tsec_t *)(TSEC_BASE_ADDR),
+		.miiregs = (tsec_mdio_t *)(MDIO_BASE_ADDR),
 		.devname = CONFIG_MPC85XX_FEC_NAME,
 		.phyaddr = FEC_PHY_ADDR,
 		.flags = FEC_FLAGS
@@ -133,6 +133,7 @@ int tsec_initialize(bd_t * bis, struct tsec_info_struct *tsec_info)
 	privlist[num_tsecs++] = priv;
 	priv->regs = tsec_info->regs;
 	priv->phyregs = tsec_info->miiregs;
+	priv->phyregs_sgmii = tsec_info->miiregs_sgmii;
 
 	priv->phyaddr = tsec_info->phyaddr;
 	priv->flags = tsec_info->flags;
@@ -219,7 +220,7 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
 }
 
 /* Writes the given phy's reg with value, using the specified MDIO regs */
-static void tsec_local_mdio_write(volatile tsec_t *phyregs, uint addr,
+static void tsec_local_mdio_write(volatile tsec_mdio_t *phyregs, uint addr,
 		uint reg, uint value)
 {
 	int timeout = 1000000;
@@ -242,7 +243,7 @@ static void tsec_local_mdio_write(volatile tsec_t *phyregs, uint addr,
  * notvalid bit cleared), and the bus to cease activity (miimind
  * busy bit cleared), and then returns the value
  */
-uint tsec_local_mdio_read(volatile tsec_t *phyregs, uint phyid, uint regnum)
+uint tsec_local_mdio_read(volatile tsec_mdio_t *phyregs, uint phyid, uint regnum)
 {
 	uint value;
 
@@ -287,11 +288,11 @@ static void tsec_configure_serdes(struct tsec_private *priv)
 {
 	/* Access TBI PHY registers at given TSEC register offset as opposed to the
 	 * register offset used for external PHY accesses */
-	tsec_local_mdio_write(priv->regs, priv->regs->tbipa, TBI_ANA,
+	tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_ANA,
 			TBIANA_SETTINGS);
-	tsec_local_mdio_write(priv->regs, priv->regs->tbipa, TBI_TBICON,
+	tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_TBICON,
 			TBICON_CLK_SELECT);
-	tsec_local_mdio_write(priv->regs, priv->regs->tbipa, TBI_CR,
+	tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_CR,
 			TBICR_SETTINGS);
 }
 
@@ -303,12 +304,10 @@ static int init_phy(struct eth_device *dev)
 {
 	struct tsec_private *priv = (struct tsec_private *)dev->priv;
 	struct phy_info *curphy;
-	volatile tsec_t *phyregs = priv->phyregs;
 	volatile tsec_t *regs = priv->regs;
 
 	/* Assign a Physical address to the TBI */
 	regs->tbipa = CONFIG_SYS_TBIPA_VALUE;
-	phyregs->tbipa = CONFIG_SYS_TBIPA_VALUE;
 	asm("sync");
 
 	/* Reset MII (due to new addresses) */
@@ -733,7 +732,7 @@ uint mii_parse_dm9161_scsr(uint mii_reg, struct tsec_private * priv)
 uint mii_cis8204_fixled(uint mii_reg, struct tsec_private * priv)
 {
 	uint phyid;
-	volatile tsec_t *regbase = priv->phyregs;
+	volatile tsec_mdio_t *regbase = priv->phyregs;
 	int timeout = 1000000;
 
 	for (phyid = 0; phyid < 4; phyid++) {
@@ -1766,7 +1765,7 @@ void phy_run_commands(struct tsec_private *priv, struct phy_cmd *cmd)
 {
 	int i;
 	uint result;
-	volatile tsec_t *phyregs = priv->phyregs;
+	volatile tsec_mdio_t *phyregs = priv->phyregs;
 
 	phyregs->miimcfg = MIIMCFG_RESET;
 
include/asm-ppc/immap_83xx.h +9 -0
index c60a7d2..57b1a72 100644
@@ -868,4 +868,13 @@ typedef struct immap {
 #endif
 #define CONFIG_SYS_MPC83xx_USB_ADDR \
 			(CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_USB_OFFSET)
+
+#define CONFIG_SYS_TSEC1_OFFSET		0x24000
+#define TSEC_SIZE			0x01000
+
+#define CONFIG_SYS_MDIO1_OFFSET		0x24520
+#define MDIO_OFFSET			0x01000
+
+#define TSEC_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_TSEC1_OFFSET)
+#define MDIO_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_MDIO1_OFFSET)
 #endif				/* __IMMAP_83xx__ */
include/asm-ppc/immap_85xx.h +10 -0
index 4194295..ad3910c 100644
@@ -1932,4 +1932,14 @@ typedef struct ccsr_gur {
 #define CONFIG_SYS_MPC85xx_USB_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_USB_OFFSET)
 
+/* TSEC and MDIO OFFSETS */
+#define CONFIG_SYS_TSEC1_OFFSET		0x24000
+#define TSEC_SIZE			0x01000
+
+#define CONFIG_SYS_MDIO1_OFFSET		0x24520
+#define MDIO_OFFSET			0x01000
+
+#define TSEC_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_TSEC1_OFFSET)
+#define MDIO_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_MDIO1_OFFSET)
+
 #endif /*__IMMAP_85xx__*/
include/asm-ppc/immap_86xx.h +9 -0
index fdfc654..80e7ecd 100644
@@ -1298,4 +1298,13 @@ extern immap_t  *immr;
 #define CONFIG_SYS_MPC86xx_DMA_OFFSET	(0x21000)
 #define CONFIG_SYS_MPC86xx_DMA_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_DMA_OFFSET)
 
+#define CONFIG_SYS_TSEC1_OFFSET		0x24000
+#define TSEC_SIZE			0x01000
+
+#define CONFIG_SYS_MDIO1_OFFSET		0x24520
+#define MDIO_OFFSET			0x01000
+
+#define TSEC_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_TSEC1_OFFSET)
+#define MDIO_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_MDIO1_OFFSET)
+
 #endif /*__IMMAP_86xx__*/
include/tsec.h +22 -23

90 lines not on this page · raw message

Signature · 1 line
1.5.2.2
#1 lore raw

PATCH v3 1/2 NET: Move MDIO regs out of TSEC Space

Quoted 22 lines · Sandeep Gopalpet

Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for etsec2.0 can be provided.

This patch helps in providing the support for etsec2.0 In etsec2.0, the MDIO register space and the etsec reg space are different.

Also, moved the TSEC_BASE_ADDR and MDIO_BASE_ADDR definitons into platform specific files.

---

drivers/net/tsec.c           |   19 ++++++++---------
include/asm-ppc/immap_83xx.h |    9 ++++++++
include/asm-ppc/immap_85xx.h |   10 +++++++++
include/asm-ppc/immap_86xx.h |    9 ++++++++
include/tsec.h               |   45 +++++++++++++++++++ 
+---------------------
5 files changed, 59 insertions(+), 33 deletions(-)

[snip]

include/asm-ppc/immap_83xx.h typedef struct immap { · line 873

Quoted 12 lines
include/asm-ppc/ renamed from include/asm-ppc/immap_83xx.h +0 -0

immap_83xx.h
index c60a7d2..57b1a72 100644

include/asm-ppc/immap_83xx.h +3 -0
@@ -868,4 +868,13 @@ typedef struct immap {
 #endif
 #define CONFIG_SYS_MPC83xx_USB_ADDR \
 			(CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_USB_OFFSET)
+
+#define CONFIG_SYS_TSEC1_OFFSET		0x24000
+#define TSEC_SIZE			0x01000

Let's leave TSEC_SIZE in tsec.h as its never changing

include/asm-ppc/immap_83xx.h typedef struct immap { · line 876

Quoted 3 lines
include/asm-ppc/immap_83xx.h +3 -0
+
+#define CONFIG_SYS_MDIO1_OFFSET		0x24520
+#define MDIO_OFFSET			0x01000

didn't we agree to rename to TSEC_MDIO_OFFSET

include/asm-ppc/immap_83xx.h typedef struct immap { · line 879

Quoted 3 lines
include/asm-ppc/immap_83xx.h +3 -0
+
+#define TSEC_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_TSEC1_OFFSET)
+#define MDIO_BASE_ADDR		(CONFIG_SYS_IMMR + CONFIG_SYS_MDIO1_OFFSET)

- k

#2 lore raw

PATCH v3 1/2 NET: Move MDIO regs out of TSEC Space

Quoted 57 lines

-----Original Message-----
From: Kumar Gala [mailto:galak at kernel.crashing.org]
Sent: Wednesday, October 28, 2009 8:27 PM
To: Kumar Gopalpet-B05799
Cc: Phillips Kim-R1AAHA; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v3 1/2] NET: Move MDIO regs out of TSEC Space

Quoted 2 lines · Sandeep Gopalpet

Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for

etsec2.0 can

Quoted 19 lines

be provided.

This patch helps in providing the support for etsec2.0 In etsec2.0, the MDIO register space and the etsec reg space are different.

Also, moved the TSEC_BASE_ADDR and MDIO_BASE_ADDR definitons into platform specific files.

---

drivers/net/tsec.c           |   19 ++++++++---------
include/asm-ppc/immap_83xx.h |    9 ++++++++
include/asm-ppc/immap_85xx.h |   10 +++++++++
include/asm-ppc/immap_86xx.h |    9 ++++++++
include/tsec.h               |   45 +++++++++++++++++++ 
+---------------------
5 files changed, 59 insertions(+), 33 deletions(-)

[snip]

include/asm-ppc/immap_83xx.h typedef struct immap { #endif #define · line 869

Quoted 7 lines
include/asm-ppc/ renamed from include/asm-ppc/immap_83xx.h +0 -0

immap_83xx.h index c60a7d2..57b1a72 100644

include/asm-ppc/immap_83xx.h +0 -0
@@ -868,4 +868,13 @@ typedef struct immap { #endif #define 
 CONFIG_SYS_MPC83xx_USB_ADDR \
 			(CONFIG_SYS_IMMR + 

CONFIG_SYS_MPC83xx_USB_OFFSET)

include/asm-ppc/immap_83xx.h typedef struct immap { · line 873

Quoted 3 lines
include/asm-ppc/immap_83xx.h +3 -0
+
+#define CONFIG_SYS_TSEC1_OFFSET		0x24000
+#define TSEC_SIZE			0x01000

Let's leave TSEC_SIZE in tsec.h as its never changing

include/asm-ppc/immap_83xx.h typedef struct immap { · line 876

Quoted 3 lines
include/asm-ppc/immap_83xx.h +3 -0
+
+#define CONFIG_SYS_MDIO1_OFFSET		0x24520
+#define MDIO_OFFSET			0x01000

didn't we agree to rename to TSEC_MDIO_OFFSET

Quoted 6 lines

include/asm-ppc/immap_83xx.h typedef struct immap { #endif #define · line 877

Quoted 2 lines
include/asm-ppc/immap_83xx.h +2 -0
+
+#define TSEC_BASE_ADDR		(CONFIG_SYS_IMMR + 

CONFIG_SYS_TSEC1_OFFSET)

include/asm-ppc/immap_83xx.h typedef struct immap { #endif #define · line 878

Quoted 1 line
include/asm-ppc/immap_83xx.h +1 -0
+#define MDIO_BASE_ADDR		(CONFIG_SYS_IMMR + 

CONFIG_SYS_MDIO1_OFFSET)

OK. Will change them. I apolozise for not incorporating them in my last patch.

-Thanks
Sandeep

#3 lore raw

PATCH v3 1/2 NET: Move MDIO regs out of TSEC Space

In reply to Sandeep Gopalpet
Quoted 8 lines · On Wed, 28 Oct 2009 14:19:18 +0530 Sandeep Gopalpet…

Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for etsec2.0 can be provided.

This patch helps in providing the support for etsec2.0 In etsec2.0, the MDIO register space and the etsec reg space are different.

Quoted 5 lines

Also, moved the TSEC_BASE_ADDR and MDIO_BASE_ADDR definitons into platform specific files.

---

without this patchseries:

U-Boot 2009.11-rc1 (Oct 28 2009 - 14:57:54) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8315E, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8315ERDB Rev 0.1
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:  32 MiB
PCIE0: No link
PCIE1: No link
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC0, eTSEC1
Hit any key to stop autoboot:  0 

=> ping $serverip
Speed: 1000, full duplex
Using eTSEC0 device
host 192.168.1.1 is alive
=>

with this patchseries:

U-Boot 2009.11-rc1-00002-g3775d27 (Oct 28 2009 - 14:45:51) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8315E, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8315ERDB Rev 0.1
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:  32 MiB
PCIE0: No link
PCIE1: No link
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC0: No support for PHY id 0; assuming generic
eTSEC1: No support for PHY id 0; assuming generic

eTSEC0, eTSEC1
Hit any key to stop autoboot: 0
=> ping $serverip
eTSEC0: No link.
eTSEC1: No link.
ping failed; host 192.168.1.1 is not alive

do you not test older version tsecs/83xx?

include/tsec.h typedef struct tsec_hash_regs · line 457

Quoted 2 lines
include/tsec.h +2 -0
+typedef struct tsec_mdio
+{

please also move this brace onto the above line.

Kim

#4 lore raw

PATCH v3 1/2 NET: Move MDIO regs out of TSEC Space

Quoted 77 lines

-----Original Message-----
From: Phillips Kim-R1AAHA
Sent: Thursday, October 29, 2009 1:36 AM
To: Kumar Gopalpet-B05799
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 1/2] NET: Move MDIO regs out of TSEC Space

Quoted 2 lines · On Wed, 28 Oct 2009 14:19:18 +0530 Sandeep Gopalpet…

Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for

etsec2.0 can

Quoted 10 lines

be provided.

This patch helps in providing the support for etsec2.0 In etsec2.0, the MDIO register space and the etsec reg space are different.

Also, moved the TSEC_BASE_ADDR and MDIO_BASE_ADDR definitons into platform specific files.

---

without this patchseries:

U-Boot 2009.11-rc1 (Oct 28 2009 - 14:57:54) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8315E, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8315ERDB Rev 0.1
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:  32 MiB
PCIE0: No link
PCIE1: No link
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC0, eTSEC1
Hit any key to stop autoboot:  0

=> ping $serverip
Speed: 1000, full duplex
Using eTSEC0 device
host 192.168.1.1 is alive
=>

with this patchseries:

U-Boot 2009.11-rc1-00002-g3775d27 (Oct 28 2009 - 14:45:51) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8315E, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8315ERDB Rev 0.1
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:  32 MiB
PCIE0: No link
PCIE1: No link
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC0: No support for PHY id 0; assuming generic
eTSEC1: No support for PHY id 0; assuming generic eTSEC0, 

eTSEC1 Hit any key to stop autoboot: 0 => ping $serverip
eTSEC0: No link.
eTSEC1: No link.
ping failed; host 192.168.1.1 is not alive

Quoted 7 lines

do you not test older version tsecs/83xx?

include/tsec.h typedef struct tsec_hash_regs · line 457

Quoted 2 lines
include/tsec.h +2 -0
+typedef struct tsec_mdio
+{

please also move this brace onto the above line.

Yes, Kim I have tested on one of the 83xx platforms. Will recheck if I missed something.

-Thanks
Sandeep

#5 lore raw

PATCH v3 1/2 NET: Move MDIO regs out of TSEC Space

In reply to Kim Phillips
Quoted 77 lines

-----Original Message-----
From: Phillips Kim-R1AAHA
Sent: Thursday, October 29, 2009 1:36 AM
To: Kumar Gopalpet-B05799
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH v3 1/2] NET: Move MDIO regs out of TSEC Space

Quoted 2 lines · On Wed, 28 Oct 2009 14:19:18 +0530 Sandeep Gopalpet…

Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for

etsec2.0 can

Quoted 10 lines

be provided.

This patch helps in providing the support for etsec2.0 In etsec2.0, the MDIO register space and the etsec reg space are different.

Also, moved the TSEC_BASE_ADDR and MDIO_BASE_ADDR definitons into platform specific files.

---

without this patchseries:

U-Boot 2009.11-rc1 (Oct 28 2009 - 14:57:54) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8315E, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8315ERDB Rev 0.1
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:  32 MiB
PCIE0: No link
PCIE1: No link
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC0, eTSEC1
Hit any key to stop autoboot:  0

=> ping $serverip
Speed: 1000, full duplex
Using eTSEC0 device
host 192.168.1.1 is alive
=>

with this patchseries:

U-Boot 2009.11-rc1-00002-g3775d27 (Oct 28 2009 - 14:45:51) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8315E, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8315ERDB Rev 0.1
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:  32 MiB
PCIE0: No link
PCIE1: No link
In:    serial
Out:   serial
Err:   serial
Net:   eTSEC0: No support for PHY id 0; assuming generic
eTSEC1: No support for PHY id 0; assuming generic eTSEC0, 

eTSEC1 Hit any key to stop autoboot: 0 => ping $serverip
eTSEC0: No link.
eTSEC1: No link.
ping failed; host 192.168.1.1 is not alive

Quoted 6 lines

do you not test older version tsecs/83xx?

include/tsec.h typedef struct tsec_hash_regs · line 457

Quoted 2 lines
include/tsec.h +2 -0
+typedef struct tsec_mdio
+{

please also move this brace onto the above line.

My bad. I forgot to change the MDIO_OFFSET in the last version of my patches.
This is the reason why it failed for 83xx series.

Will resend the patches.

Thanks a lot Kim.

-Thanks
Sandeep