public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/4] net/fman: Add support for 10GEC3 and 10GEC4
@ 2013-11-14 11:31 Shengzhou Liu
  2013-11-21 17:51 ` York Sun
  0 siblings, 1 reply; 3+ messages in thread
From: Shengzhou Liu @ 2013-11-14 11:31 UTC (permalink / raw)
  To: u-boot

There are more than two 10GEC in single FMAN in some SoCs(e.g. T2080).
This patch adds support for 10GEC3 and 10GEC4.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
---
Against master branch of upstream.

 arch/powerpc/include/asm/fsl_serdes.h |  2 ++
 arch/powerpc/include/asm/immap_85xx.h |  2 ++
 drivers/net/fm/eth.c                  |  8 ++++++--
 drivers/net/fm/fm.h                   |  2 ++
 drivers/net/fm/init.c                 | 18 ++++++++++++++----
 include/fm_eth.h                      | 18 ++++++++++++++++++
 6 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/fsl_serdes.h b/arch/powerpc/include/asm/fsl_serdes.h
index cce892c..404ded4 100644
--- a/arch/powerpc/include/asm/fsl_serdes.h
+++ b/arch/powerpc/include/asm/fsl_serdes.h
@@ -62,6 +62,8 @@ enum srds_prtcl {
 	QSGMII_FM1_B,		/* B indicates MACs 5,6,9,10 */
 	QSGMII_FM2_A,
 	QSGMII_FM2_B,
+	XFI_FM1_MAC1,
+	XFI_FM1_MAC2,
 	XFI_FM1_MAC9,
 	XFI_FM1_MAC10,
 	XFI_FM2_MAC9,
diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h
index 060e0d7..e47da1d 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -1717,6 +1717,8 @@ typedef struct ccsr_gur {
 #define FSL_CORENET_DEVDISR2_DTSEC1_10	0x00400000
 #define FSL_CORENET_DEVDISR2_10GEC1_1	0x00800000
 #define FSL_CORENET_DEVDISR2_10GEC1_2	0x00400000
+#define FSL_CORENET_DEVDISR2_10GEC1_3	0x80000000
+#define FSL_CORENET_DEVDISR2_10GEC1_4	0x40000000
 #define FSL_CORENET_DEVDISR2_DTSEC2_1	0x00080000
 #define FSL_CORENET_DEVDISR2_DTSEC2_2	0x00040000
 #define FSL_CORENET_DEVDISR2_DTSEC2_3	0x00020000
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index cb099cd..e346cd2 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -557,8 +557,12 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
 	num = fm_eth->num;
 
 #ifdef CONFIG_SYS_FMAN_V3
-	if (fm_eth->type == FM_ETH_10G_E)
-		num += 8;
+	if (fm_eth->type == FM_ETH_10G_E) {
+		if (fm_eth->num >= 2)
+			num -= 2;
+		else
+			num += 8;
+	}
 	base = &reg->memac[num].fm_memac;
 	phyregs = &reg->memac[num].fm_memac_mdio;
 #else
diff --git a/drivers/net/fm/fm.h b/drivers/net/fm/fm.h
index 3ec49a4..43de114 100644
--- a/drivers/net/fm/fm.h
+++ b/drivers/net/fm/fm.h
@@ -18,9 +18,11 @@
 #define RX_PORT_1G_BASE		0x08
 #define MAX_NUM_RX_PORT_1G	CONFIG_SYS_NUM_FM1_DTSEC
 #define RX_PORT_10G_BASE	0x10
+#define RX_PORT_10G_BASE2	0x08
 #define TX_PORT_1G_BASE		0x28
 #define MAX_NUM_TX_PORT_1G	CONFIG_SYS_NUM_FM1_DTSEC
 #define TX_PORT_10G_BASE	0x30
+#define TX_PORT_10G_BASE2	0x28
 #define MIIM_TIMEOUT    0xFFFF
 
 struct fm_muram {
diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index 35edd7a..cd787f4 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
@@ -64,6 +64,12 @@ struct fm_eth_info fm_info[] = {
 #if (CONFIG_SYS_NUM_FM1_10GEC >= 2)
 	FM_TGEC_INFO_INITIALIZER(1, 2),
 #endif
+#if (CONFIG_SYS_NUM_FM1_10GEC >= 3)
+	FM_TGEC_INFO_INITIALIZER2(1, 3),
+#endif
+#if (CONFIG_SYS_NUM_FM1_10GEC >= 4)
+	FM_TGEC_INFO_INITIALIZER2(1, 4),
+#endif
 #if (CONFIG_SYS_NUM_FM2_10GEC >= 1)
 	FM_TGEC_INFO_INITIALIZER(2, 1),
 #endif
@@ -239,10 +245,14 @@ static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
 	 * FM1_10GEC1 is enabled and  FM1_DTSEC9 is disabled, ensure that the
 	 * dual-role MAC is not disabled, ditto for other dual-role MACs.
 	 */
-	if (((info->port == FM1_DTSEC9) && (PORT_IS_ENABLED(FM1_10GEC1)))	||
-	    ((info->port == FM1_DTSEC10) && (PORT_IS_ENABLED(FM1_10GEC2)))	||
-	    ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC9)))	||
-	    ((info->port == FM1_10GEC2) && (PORT_IS_ENABLED(FM1_DTSEC10)))
+	if (((info->port == FM1_DTSEC9) && (PORT_IS_ENABLED(FM1_10GEC1)))  ||
+	    ((info->port == FM1_DTSEC10) && (PORT_IS_ENABLED(FM1_10GEC2))) ||
+	    ((info->port == FM1_DTSEC1) && (PORT_IS_ENABLED(FM1_10GEC3)))  ||
+	    ((info->port == FM1_DTSEC2) && (PORT_IS_ENABLED(FM1_10GEC4)))  ||
+	    ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC9)))  ||
+	    ((info->port == FM1_10GEC2) && (PORT_IS_ENABLED(FM1_DTSEC10))) ||
+	    ((info->port == FM1_10GEC3) && (PORT_IS_ENABLED(FM1_DTSEC1)))  ||
+	    ((info->port == FM1_10GEC4) && (PORT_IS_ENABLED(FM1_DTSEC2)))
 #if (CONFIG_SYS_NUM_FMAN == 2)
 										||
 	    ((info->port == FM2_DTSEC9) && (PORT_IS_ENABLED(FM2_10GEC1)))	||
diff --git a/include/fm_eth.h b/include/fm_eth.h
index 5a4fb70..98edfcf 100644
--- a/include/fm_eth.h
+++ b/include/fm_eth.h
@@ -22,6 +22,8 @@ enum fm_port {
 	FM1_DTSEC10,
 	FM1_10GEC1,
 	FM1_10GEC2,
+	FM1_10GEC3,
+	FM1_10GEC4,
 	FM2_DTSEC1,
 	FM2_DTSEC2,
 	FM2_DTSEC3,
@@ -85,6 +87,22 @@ enum fm_eth_type {
 	.compat_offset	= CONFIG_SYS_FSL_FM##idx##_OFFSET +		\
 				offsetof(struct ccsr_fman, memac[n-1+8]),\
 }
+
+#if (CONFIG_SYS_NUM_FM1_10GEC >= 3)
+#define FM_TGEC_INFO_INITIALIZER2(idx, n) \
+{									\
+	FM_ETH_INFO_INITIALIZER(idx, CONFIG_SYS_FM1_TGEC_MDIO_ADDR)	\
+	.index		= idx,						\
+	.num		= n - 1,					\
+	.type		= FM_ETH_10G_E,					\
+	.port		= FM##idx##_10GEC##n,				\
+	.rx_port_id	= RX_PORT_10G_BASE2 + n - 3,			\
+	.tx_port_id	= TX_PORT_10G_BASE2 + n - 3,			\
+	.compat_offset	= CONFIG_SYS_FSL_FM##idx##_OFFSET +		\
+				offsetof(struct ccsr_fman, memac[n-1-2]),\
+}
+#endif
+
 #else
 #define FM_DTSEC_INFO_INITIALIZER(idx, n) \
 {									\
-- 
1.8.0

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

* [U-Boot] [PATCH 1/4] net/fman: Add support for 10GEC3 and 10GEC4
  2013-11-14 11:31 [U-Boot] [PATCH 1/4] net/fman: Add support for 10GEC3 and 10GEC4 Shengzhou Liu
@ 2013-11-21 17:51 ` York Sun
  2013-11-22  3:19   ` Shengzhou Liu
  0 siblings, 1 reply; 3+ messages in thread
From: York Sun @ 2013-11-21 17:51 UTC (permalink / raw)
  To: u-boot

On 11/14/2013 03:31 AM, Shengzhou Liu wrote:
> There are more than two 10GEC in single FMAN in some SoCs(e.g. T2080).
> This patch adds support for 10GEC3 and 10GEC4.
> 
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> ---
> Against master branch of upstream.
> 
>  arch/powerpc/include/asm/fsl_serdes.h |  2 ++
>  arch/powerpc/include/asm/immap_85xx.h |  2 ++
>  drivers/net/fm/eth.c                  |  8 ++++++--
>  drivers/net/fm/fm.h                   |  2 ++
>  drivers/net/fm/init.c                 | 18 ++++++++++++++----
>  include/fm_eth.h                      | 18 ++++++++++++++++++
>  6 files changed, 44 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/fsl_serdes.h b/arch/powerpc/include/asm/fsl_serdes.h
> index cce892c..404ded4 100644
> --- a/arch/powerpc/include/asm/fsl_serdes.h
> +++ b/arch/powerpc/include/asm/fsl_serdes.h
> @@ -62,6 +62,8 @@ enum srds_prtcl {
>  	QSGMII_FM1_B,		/* B indicates MACs 5,6,9,10 */
>  	QSGMII_FM2_A,
>  	QSGMII_FM2_B,
> +	XFI_FM1_MAC1,
> +	XFI_FM1_MAC2,
>  	XFI_FM1_MAC9,
>  	XFI_FM1_MAC10,
>  	XFI_FM2_MAC9,
> diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h
> index 060e0d7..e47da1d 100644
> --- a/arch/powerpc/include/asm/immap_85xx.h
> +++ b/arch/powerpc/include/asm/immap_85xx.h
> @@ -1717,6 +1717,8 @@ typedef struct ccsr_gur {
>  #define FSL_CORENET_DEVDISR2_DTSEC1_10	0x00400000
>  #define FSL_CORENET_DEVDISR2_10GEC1_1	0x00800000
>  #define FSL_CORENET_DEVDISR2_10GEC1_2	0x00400000
> +#define FSL_CORENET_DEVDISR2_10GEC1_3	0x80000000
> +#define FSL_CORENET_DEVDISR2_10GEC1_4	0x40000000
>  #define FSL_CORENET_DEVDISR2_DTSEC2_1	0x00080000
>  #define FSL_CORENET_DEVDISR2_DTSEC2_2	0x00040000
>  #define FSL_CORENET_DEVDISR2_DTSEC2_3	0x00020000
> diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
> index cb099cd..e346cd2 100644
> --- a/drivers/net/fm/eth.c
> +++ b/drivers/net/fm/eth.c
> @@ -557,8 +557,12 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
>  	num = fm_eth->num;
>  
>  #ifdef CONFIG_SYS_FMAN_V3
> -	if (fm_eth->type == FM_ETH_10G_E)
> -		num += 8;
> +	if (fm_eth->type == FM_ETH_10G_E) {
> +		if (fm_eth->num >= 2)
> +			num -= 2;
> +		else
> +			num += 8;
> +	}

It would be nice if you can add some comments here.


>  	base = &reg->memac[num].fm_memac;
>  	phyregs = &reg->memac[num].fm_memac_mdio;
>  #else
> diff --git a/drivers/net/fm/fm.h b/drivers/net/fm/fm.h
> index 3ec49a4..43de114 100644
> --- a/drivers/net/fm/fm.h
> +++ b/drivers/net/fm/fm.h
> @@ -18,9 +18,11 @@
>  #define RX_PORT_1G_BASE		0x08
>  #define MAX_NUM_RX_PORT_1G	CONFIG_SYS_NUM_FM1_DTSEC
>  #define RX_PORT_10G_BASE	0x10
> +#define RX_PORT_10G_BASE2	0x08
>  #define TX_PORT_1G_BASE		0x28
>  #define MAX_NUM_TX_PORT_1G	CONFIG_SYS_NUM_FM1_DTSEC
>  #define TX_PORT_10G_BASE	0x30
> +#define TX_PORT_10G_BASE2	0x28
>  #define MIIM_TIMEOUT    0xFFFF
>  
>  struct fm_muram {
> diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
> index 35edd7a..cd787f4 100644
> --- a/drivers/net/fm/init.c
> +++ b/drivers/net/fm/init.c
> @@ -64,6 +64,12 @@ struct fm_eth_info fm_info[] = {
>  #if (CONFIG_SYS_NUM_FM1_10GEC >= 2)
>  	FM_TGEC_INFO_INITIALIZER(1, 2),
>  #endif
> +#if (CONFIG_SYS_NUM_FM1_10GEC >= 3)
> +	FM_TGEC_INFO_INITIALIZER2(1, 3),
> +#endif
> +#if (CONFIG_SYS_NUM_FM1_10GEC >= 4)
> +	FM_TGEC_INFO_INITIALIZER2(1, 4),
> +#endif
>  #if (CONFIG_SYS_NUM_FM2_10GEC >= 1)
>  	FM_TGEC_INFO_INITIALIZER(2, 1),
>  #endif
> @@ -239,10 +245,14 @@ static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
>  	 * FM1_10GEC1 is enabled and  FM1_DTSEC9 is disabled, ensure that the
>  	 * dual-role MAC is not disabled, ditto for other dual-role MACs.
>  	 */

Revise this comment to match your change.


> -	if (((info->port == FM1_DTSEC9) && (PORT_IS_ENABLED(FM1_10GEC1)))	||
> -	    ((info->port == FM1_DTSEC10) && (PORT_IS_ENABLED(FM1_10GEC2)))	||
> -	    ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC9)))	||
> -	    ((info->port == FM1_10GEC2) && (PORT_IS_ENABLED(FM1_DTSEC10)))
> +	if (((info->port == FM1_DTSEC9) && (PORT_IS_ENABLED(FM1_10GEC1)))  ||
> +	    ((info->port == FM1_DTSEC10) && (PORT_IS_ENABLED(FM1_10GEC2))) ||
> +	    ((info->port == FM1_DTSEC1) && (PORT_IS_ENABLED(FM1_10GEC3)))  ||
> +	    ((info->port == FM1_DTSEC2) && (PORT_IS_ENABLED(FM1_10GEC4)))  ||
> +	    ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC9)))  ||
> +	    ((info->port == FM1_10GEC2) && (PORT_IS_ENABLED(FM1_DTSEC10))) ||
> +	    ((info->port == FM1_10GEC3) && (PORT_IS_ENABLED(FM1_DTSEC1)))  ||
> +	    ((info->port == FM1_10GEC4) && (PORT_IS_ENABLED(FM1_DTSEC2)))

York

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

* [U-Boot] [PATCH 1/4] net/fman: Add support for 10GEC3 and 10GEC4
  2013-11-21 17:51 ` York Sun
@ 2013-11-22  3:19   ` Shengzhou Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Shengzhou Liu @ 2013-11-22  3:19 UTC (permalink / raw)
  To: u-boot

> -----Original Message-----
> From: York Sun [mailto:yorksun at freescale.com]
> Sent: Friday, November 22, 2013 1:51 AM
> To: Liu Shengzhou-B36685; u-boot at lists.denx.de
> Subject: Re: [PATCH 1/4] net/fman: Add support for 10GEC3 and 10GEC4
> 
> >  #ifdef CONFIG_SYS_FMAN_V3
> > -	if (fm_eth->type == FM_ETH_10G_E)
> > -		num += 8;
> > +	if (fm_eth->type == FM_ETH_10G_E) {
> > +		if (fm_eth->num >= 2)
> > +			num -= 2;
> > +		else
> > +			num += 8;
> > +	}
> 
> It would be nice if you can add some comments here.
> 
[Shengzhou] ok, will do.
> 
> > @@ -239,10 +245,14 @@ static void ft_fixup_port(void *blob, struct fm_eth_info
> *info, char *prop)
> >  	 * FM1_10GEC1 is enabled and  FM1_DTSEC9 is disabled, ensure that the
> >  	 * dual-role MAC is not disabled, ditto for other dual-role MACs.
> >  	 */
> 
> Revise this comment to match your change.
[Shengzhou] This comment doesn't need to revise, the comment takes FM1_10GEC1 an example, 
then "ditto for other dual-role MACs", it still matches the change of this patch. Thanks.

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

end of thread, other threads:[~2013-11-22  3:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 11:31 [U-Boot] [PATCH 1/4] net/fman: Add support for 10GEC3 and 10GEC4 Shengzhou Liu
2013-11-21 17:51 ` York Sun
2013-11-22  3:19   ` Shengzhou Liu

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