u-boot-2009.08 NET: Move MDIO regs out of TSEC Space
PATCH 1/2 u-boot-2009.08 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
--- drivers/net/tsec.c | 20 ++++++++-------- include/asm-ppc/immap_85xx.h | 10 ++++++++ include/tsec.h | 48 +++++++++++++++++++++++++++++++---------- 3 files changed, 56 insertions(+), 22 deletions(-)
drivers/net/tsec.c +10 -10
@@ -83,7 +83,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
@@ -136,6 +136,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;
@@ -222,7 +223,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 ;
@@ -245,7 +246,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;
@@ -290,11 +291,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 ); }
@@ -306,12 +307,11 @@ 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_mdio_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) */
@@ -739,7 +739,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++) {
@@ -1772,7 +1772,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_85xx.h +10 -0
@@ -1935,4 +1935,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/tsec.h +36 -12
100 lines not on this page · raw message
Signature · 1 line
1.5.2.2
PATCH 2/2 u-boot-2009.08 NET: Base support for etsec2.0
1. Modified the tsec_mdio structure to include the new regs
2. Modified the MDIO_BASE_ADDR so that it will handle both older version and new version of etsec.
--- include/asm-ppc/immap_85xx.h | 6 +++++- include/tsec.h | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
include/asm-ppc/immap_85xx.h +5 -1
@@ -1936,10 +1936,14 @@ typedef struct ccsr_gur { (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_USB_OFFSET) /* TSEC and MDIO OFFSETS */ +#ifdef CONFIG_P1020 +#define CONFIG_SYS_TSEC1_OFFSET (0xB0000) +#else #define CONFIG_SYS_TSEC1_OFFSET (0x24000) +#endif #define TSEC_SIZE (0x01000) -#define CONFIG_SYS_MDIO1_OFFSET (0x24520) +#define CONFIG_SYS_MDIO1_OFFSET (0x24000)#define MDIO_OFFSET (0x01000)#define TSEC_BASE_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_TSEC1_OFFSET)
include/tsec.h +12 -1
@@ -29,7 +29,7 @@#endif #ifndef CONFIG_SYS_MDIO1_OFFSET -#define CONFIG_SYS_MDIO1_OFFSET (0x24520) +#define CONFIG_SYS_MDIO1_OFFSET (0x24000)#endif #ifndef MDIO_OFFSET
@@ -478,14 +478,25 @@ typedef struct tsec_hash_regsuint res2[24 ]; } tsec_hash_t; +/* MDIO structure for etsec2.0. +* Backward compatible to etsec1.x +*/ +typedef struct tsec_mdio { +uint res1[4 ]; +uint ieventm;/* MDIO Interrupt event register */ +uint imaskm;/* MDIO Interrupt mask register */ +uint res2; +uint emapm;/* MDIO Event mapping register */ +uint res3[320 ];uint miimcfg;/* MII Management: Configuration */ uint miimcom;/* MII Management: Command */ uint miimadd;/* MII Management: Address */ uint miimcon;/* MII Management: Control */ uint miimstat;/* MII Management: Status */ uint miimind;/* MII Management: Indicators */ +uint res4[690 ]; }tsec_mdio_t ; typedef struct tsec
Signature · 1 line
1.5.2.2
PATCH 2/2 u-boot-2009.08 NET: Base support for etsec2.0
Quoted 16 lines · Sandeep Gopalpet
1. Modified the
tsec_mdiostructure to include the new regs
2. Modified theMDIO_BASE_ADDRso that it will handle both older version and new version of etsec.Signed-off-by Sandeep Gopalpet <[email protected]>---
include/asm-ppc/immap_85xx.h| 6 +++++-include/tsec.h| 13 ++++++++++++-2 files changed, 17 insertions(+), 2 deletions(-)include/asm-ppc/ renamed from include/asm-ppc/immap_85xx.h +0
-0
immap_85xx.h
index dc82f49..bbeb585 100644
include/asm-ppc/immap_85xx.h typedef struct ccsr_gur { · line 1939
Quoted 4 lines
include/asm-ppc/immap_85xx.h +1
-0@@ -1936,10 +1936,14 @@ typedef struct ccsr_gur { (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_USB_OFFSET) /* TSEC and MDIO OFFSETS */ +#ifdef CONFIG_P1020
we should use something like TSECV2 instead of CONFIG_P1020
Quoted 57 lines
include/asm-ppc/immap_85xx.h +4
-1+#define CONFIG_SYS_TSEC1_OFFSET (0xB0000) +#else #define CONFIG_SYS_TSEC1_OFFSET (0x24000) +#endif #define TSEC_SIZE (0x01000) -#define CONFIG_SYS_MDIO1_OFFSET (0x24520) +#define CONFIG_SYS_MDIO1_OFFSET (0x24000)#define MDIO_OFFSET (0x01000)#define TSEC_BASE_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_TSEC1_OFFSET)include/tsec.h +5
-1@@ -29,7 +29,7 @@#endif #ifndef CONFIG_SYS_MDIO1_OFFSET -#define CONFIG_SYS_MDIO1_OFFSET (0x24520) +#define CONFIG_SYS_MDIO1_OFFSET (0x24000)#endif #ifndef MDIO_OFFSET @@ -478,14 +478,25 @@ typedef struct tsec_hash_regsuint res2[24 ]; } tsec_hash_t; +/* MDIO structure for etsec2.0. +* Backward compatible to etsec1.x +*/ +typedef struct
tsec_mdio
{include/tsec.h +6
-0+uint res1[4 ]; +uint ieventm;/* MDIO Interrupt event register */ +uint imaskm;/* MDIO Interrupt mask register */ +uint res2; +uint emapm;/* MDIO Event mapping register */ +uint res3[320 ];uint miimcfg; /* MII Management: Configuration */
uint miimcom; /* MII Management: Command */
uint miimadd; /* MII Management: Address */
uint miimcon; /* MII Management: Control */
uint miimstat; /* MII Management: Status */
uint miimind; /* MII Management: Indicators */include/tsec.h +1
-0+uint res4[690 ];}
tsec_mdio_t;typedef struct tsec
Signature · 6 lines
1.5.2.2 _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
PATCH 2/2 u-boot-2009.08 NET: Base support for etsec2.0
Quoted 32 lines
-----Original Message-----
From: Kumar Gala [mailto:galak at kernel.crashing.org]
Sent: Thursday, October 01, 2009 7:13 PM
To: Kumar Gopalpet-B05799
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v0 2/2] u-boot-2009.08 NET: Base support for etsec2.0Quoted 2 lines · Sandeep Gopalpet
1. Modified the
tsec_mdiostructure to include the new regs 2. Modified theMDIO_BASE_ADDRso that it will handle botholder version
Quoted 13 lines
and new version of etsec.
Signed-off-by Sandeep Gopalpet <[email protected]>---
include/asm-ppc/immap_85xx.h| 6 +++++-include/tsec.h| 13 ++++++++++++-2 files changed, 17 insertions(+), 2 deletions(-)include/asm-ppc/ renamed from include/asm-ppc/immap_85xx.h +0
-0
immap_85xx.hindex dc82f49..bbeb585 100644include/asm-ppc/immap_85xx.h typedef struct ccsr_gur { · line 1936
Quoted 1 line
include/asm-ppc/immap_85xx.h +0
-0@@ -1936,10 +1936,14 @@ typedef struct ccsr_gur { (CONFIG_SYS_IMMR +
CONFIG_SYS_MPC85xx_USB_OFFSET)Quoted 1 line
Quoted 5 lines
Quoted 2 lines
/* TSEC and MDIO OFFSETS */
+#ifdefCONFIG_P1020we should use something like TSECV2 instead of
CONFIG_P1020
OK. Will update the patch and send it across based on your recent changes to immap_85xx.h
PATCH 1/2 u-boot-2009.08 NET: Move MDIO regs out of TSEC Space
In reply to Sandeep GopalpetDear Sandeep Gopalpet,
Quoted 7 lines · In message <[email protected]> you…
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
Please omit the "u-boot-2009.08" from the commit message. It has no place there (same in the following patch, too).
Best regards,
Wolfgang Denk
Signature · 6 lines
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 Worlds may change, galaxies disintegrate, but a woman always remains a woman. -- Kirk, "The Conscience of the King", stardate 2818.9
PATCH 1/2 u-boot-2009.08 NET: Move MDIO regs out of TSEC Space
Quoted 16 lines
-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Friday, October 02, 2009 12:00 AM
To: Kumar Gopalpet-B05799
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v0 1/2] u-boot-2009.08 NET: Move MDIO regs out of TSEC SpaceDear Sandeep Gopalpet,
In message
Quoted 2 lines · <[email protected]> you wrote:
Moved the mdio regs out of the tsec structure,and provided different offsets for tsec base and mdio base so that provision for
Quoted 9 lines
etsec2.0 can
Quoted 4 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
Please omit the "u-boot-2009.08" from the commit message. It has no place there (same in the following patch, too).
OK. Will update and send new version of the patches
-Thanks
Sandeep