netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
       [not found] <1329466058-15969-1-git-send-email-dhdang@apm.com>
@ 2012-02-29 13:43 ` Josh Boyer
  2012-02-29 18:25   ` David Miller
  2012-03-05  4:00 ` [PATCH v2 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
  2012-03-05  4:03 ` [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
  2 siblings, 1 reply; 12+ messages in thread
From: Josh Boyer @ 2012-02-29 13:43 UTC (permalink / raw)
  To: Duc Dang
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	linux-kernel, netdev

On Fri, Feb 17, 2012 at 3:07 AM, Duc Dang <dhdang@apm.com> wrote:
> This patch includes:
>
>  Configure EMAC PHY clock source (clock from PHY or internal clock).
>
>  Do not advertise PHY half duplex capability as APM821XX EMAC does not
> support half duplex mode.
>
>  Add changes to support configuring jumbo frame for APM821XX EMAC.
>
> Signed-off-by: Duc Dang <dhdang@apm.com>

This should have been sent to netdev.  CC'ing them now.

Ben and David, I can take this change through the 4xx tree if it looks OK to
both of you.  The pre-requisite DTS patch will go through my tree, so it might
make sense to keep them together.

josh

> ---
>  drivers/net/ethernet/ibm/emac/core.c |   26 +++++++++++++++++++++++++-
>  drivers/net/ethernet/ibm/emac/core.h |   13 +++++++++++--
>  drivers/net/ethernet/ibm/emac/emac.h |    5 ++++-
>  3 files changed, 40 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
> index ed79b2d..de620f1 100644
> --- a/drivers/net/ethernet/ibm/emac/core.c
> +++ b/drivers/net/ethernet/ibm/emac/core.c
> @@ -434,6 +434,11 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)
>  	else if (!netdev_mc_empty(ndev))
>  		r |= EMAC_RMR_MAE;
>
> +	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
> +		r &= ~EMAC4_RMR_MJS_MASK;
> +		r |= EMAC4_RMR_MJS(ndev->mtu);
> +	}
> +
>  	return r;
>  }
>
> @@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)
>  	int rx_sync_size = emac_rx_sync_size(new_mtu);
>  	int rx_skb_size = emac_rx_skb_size(new_mtu);
>  	int i, ret = 0;
> +	int mr1_jumbo_bit_change = 0;
>
>  	mutex_lock(&dev->link_lock);
>  	emac_netif_stop(dev);
> @@ -1013,7 +1019,14 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)
>  	}
>   skip:
>  	/* Check if we need to change "Jumbo" bit in MR1 */
> -	if ((new_mtu > ETH_DATA_LEN) ^ (dev->ndev->mtu > ETH_DATA_LEN)) {
> +	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE))
> +		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ||
> +				(dev->ndev->mtu > ETH_DATA_LEN);
> +	else
> +		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ^
> +				(dev->ndev->mtu > ETH_DATA_LEN);
> +
> +	if (mr1_jumbo_bit_change) {
>  		/* This is to prevent starting RX channel in emac_rx_enable() */
>  		set_bit(MAL_COMMAC_RX_STOPPED, &dev->commac.flags);
>
> @@ -2471,6 +2484,7 @@ static int __devinit emac_init_phy(struct emac_instance *dev)
>
>  	/* Disable any PHY features not supported by the platform */
>  	dev->phy.def->features &= ~dev->phy_feat_exc;
> +	dev->phy.features &= ~dev->phy_feat_exc;
>
>  	/* Setup initial link parameters */
>  	if (dev->phy.features & SUPPORTED_Autoneg) {
> @@ -2568,6 +2582,10 @@ static int __devinit emac_init_config(struct emac_instance *dev)
>  		if (of_device_is_compatible(np, "ibm,emac-405ex") ||
>  		    of_device_is_compatible(np, "ibm,emac-405exr"))
>  			dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
> +		if (of_device_is_compatible(np, "ibm,emac-apm821xx"))
> +			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE
> +					| EMAC_FTR_APM821XX_NO_HALF_DUPLEX
> +					| EMAC_FTR_460EX_PHY_CLK_FIX);
>  	} else if (of_device_is_compatible(np, "ibm,emac4")) {
>  		dev->features |= EMAC_FTR_EMAC4;
>  		if (of_device_is_compatible(np, "ibm,emac-440gx"))
> @@ -2818,6 +2836,12 @@ static int __devinit emac_probe(struct platform_device *ofdev)
>  	dev->stop_timeout = STOP_TIMEOUT_100;
>  	INIT_DELAYED_WORK(&dev->link_work, emac_link_timer);
>
> +	/* Some SoCs like APM821xx does not support Half Duplex mode. */
> +	if (emac_has_feature(dev, EMAC_FTR_APM821XX_NO_HALF_DUPLEX))
> +		dev->phy_feat_exc = (SUPPORTED_1000baseT_Half
> +					| SUPPORTED_100baseT_Half
> +					| SUPPORTED_10baseT_Half);
> +
>  	/* Find PHY if any */
>  	err = emac_init_phy(dev);
>  	if (err != 0)
> diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h
> index fa3ec57..9dea85a 100644
> --- a/drivers/net/ethernet/ibm/emac/core.h
> +++ b/drivers/net/ethernet/ibm/emac/core.h
> @@ -325,7 +325,14 @@ struct emac_instance {
>   * Set if we need phy clock workaround for 460ex or 460gt
>   */
>  #define EMAC_FTR_460EX_PHY_CLK_FIX	0x00000400
> -
> +/*
> + * APM821xx requires Jumbo frame size set explicitly
> + */
> +#define EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE	0x00000800
> +/*
> + * APM821xx does not support Half Duplex mode
> + */
> +#define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
>
>  /* Right now, we don't quite handle the always/possible masks on the
>   * most optimal way as we don't have a way to say something like
> @@ -353,7 +360,9 @@ enum {
>  	    EMAC_FTR_NO_FLOW_CONTROL_40x |
>  #endif
>  	EMAC_FTR_460EX_PHY_CLK_FIX |
> -	EMAC_FTR_440EP_PHY_CLK_FIX,
> +	EMAC_FTR_440EP_PHY_CLK_FIX |
> +	EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
> +	EMAC_FTR_APM821XX_NO_HALF_DUPLEX,
>  };
>
>  static inline int emac_has_feature(struct emac_instance *dev,
> diff --git a/drivers/net/ethernet/ibm/emac/emac.h b/drivers/net/ethernet/ibm/emac/emac.h
> index 1568278..36bcd69 100644
> --- a/drivers/net/ethernet/ibm/emac/emac.h
> +++ b/drivers/net/ethernet/ibm/emac/emac.h
> @@ -212,7 +212,10 @@ struct emac_regs {
>  #define EMAC4_RMR_RFAF_64_1024		0x00000006
>  #define EMAC4_RMR_RFAF_128_2048		0x00000007
>  #define EMAC4_RMR_BASE			EMAC4_RMR_RFAF_128_2048
> -
> +#if defined(CONFIG_APM821xx)
> +#define EMAC4_RMR_MJS_MASK              0x0001fff8
> +#define EMAC4_RMR_MJS(s)                (((s) << 3) & EMAC4_RMR_MJS_MASK)
> +#endif
>  /* EMACx_ISR & EMACx_ISER */
>  #define EMAC4_ISR_TXPE			0x20000000
>  #define EMAC4_ISR_RXPE			0x10000000
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
  2012-02-29 13:43 ` [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Josh Boyer
@ 2012-02-29 18:25   ` David Miller
  2012-03-01  5:05     ` Duc Dang
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2012-02-29 18:25 UTC (permalink / raw)
  To: jwboyer; +Cc: dhdang, benh, paulus, linuxppc-dev, linux-kernel, netdev

From: Josh Boyer <jwboyer@gmail.com>
Date: Wed, 29 Feb 2012 08:43:46 -0500

> On Fri, Feb 17, 2012 at 3:07 AM, Duc Dang <dhdang@apm.com> wrote:
>> This patch includes:
>>
>>  Configure EMAC PHY clock source (clock from PHY or internal clock).
>>
>>  Do not advertise PHY half duplex capability as APM821XX EMAC does not
>> support half duplex mode.
>>
>>  Add changes to support configuring jumbo frame for APM821XX EMAC.
>>
>> Signed-off-by: Duc Dang <dhdang@apm.com>
> 
> This should have been sent to netdev.  CC'ing them now.
> 
> Ben and David, I can take this change through the 4xx tree if it looks OK to
> both of you.  The pre-requisite DTS patch will go through my tree, so it might
> make sense to keep them together.

Well the patch has coding style problems, for one:

>> +			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE
>> +					| EMAC_FTR_APM821XX_NO_HALF_DUPLEX
>> +					| EMAC_FTR_460EX_PHY_CLK_FIX);

Should be:

>> +			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
>> +					  EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
>> +					  EMAC_FTR_460EX_PHY_CLK_FIX);

And this:

>> +		dev->phy_feat_exc = (SUPPORTED_1000baseT_Half
>> +					| SUPPORTED_100baseT_Half
>> +					| SUPPORTED_10baseT_Half);

Should be:

>> +		dev->phy_feat_exc = (SUPPORTED_1000baseT_Half |
>> +				     SUPPORTED_100baseT_Half |
>> +				     SUPPORTED_10baseT_Half);

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

* Re: [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
  2012-02-29 18:25   ` David Miller
@ 2012-03-01  5:05     ` Duc Dang
  0 siblings, 0 replies; 12+ messages in thread
From: Duc Dang @ 2012-03-01  5:05 UTC (permalink / raw)
  To: David Miller, jwboyer; +Cc: netdev, paulus, linuxppc-dev, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1964 bytes --]

Thanks, David and Josh.

Except the coding style problem that David mentioned, do you have other
comment about my patch set?

Regards,
Duc Dang.

On Thu, Mar 1, 2012 at 1:25 AM, David Miller <davem@davemloft.net> wrote:

> From: Josh Boyer <jwboyer@gmail.com>
> Date: Wed, 29 Feb 2012 08:43:46 -0500
>
> > On Fri, Feb 17, 2012 at 3:07 AM, Duc Dang <dhdang@apm.com> wrote:
> >> This patch includes:
> >>
> >>  Configure EMAC PHY clock source (clock from PHY or internal clock).
> >>
> >>  Do not advertise PHY half duplex capability as APM821XX EMAC does not
> >> support half duplex mode.
> >>
> >>  Add changes to support configuring jumbo frame for APM821XX EMAC.
> >>
> >> Signed-off-by: Duc Dang <dhdang@apm.com>
> >
> > This should have been sent to netdev.  CC'ing them now.
> >
> > Ben and David, I can take this change through the 4xx tree if it looks
> OK to
> > both of you.  The pre-requisite DTS patch will go through my tree, so it
> might
> > make sense to keep them together.
>
> Well the patch has coding style problems, for one:
>
> >> +                    dev->features |=
> (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE
> >> +                                    | EMAC_FTR_APM821XX_NO_HALF_DUPLEX
> >> +                                    | EMAC_FTR_460EX_PHY_CLK_FIX);
>
> Should be:
>
> >> +                    dev->features |=
> (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
> >> +                                      EMAC_FTR_APM821XX_NO_HALF_DUPLEX
> |
> >> +                                      EMAC_FTR_460EX_PHY_CLK_FIX);
>
> And this:
>
> >> +            dev->phy_feat_exc = (SUPPORTED_1000baseT_Half
> >> +                                    | SUPPORTED_100baseT_Half
> >> +                                    | SUPPORTED_10baseT_Half);
>
> Should be:
>
> >> +            dev->phy_feat_exc = (SUPPORTED_1000baseT_Half |
> >> +                                 SUPPORTED_100baseT_Half |
> >> +                                 SUPPORTED_10baseT_Half);
>

[-- Attachment #1.2: Type: text/html, Size: 2650 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* [PATCH v2 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file.
       [not found] <1329466058-15969-1-git-send-email-dhdang@apm.com>
  2012-02-29 13:43 ` [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Josh Boyer
@ 2012-03-05  4:00 ` Duc Dang
  2012-03-05  4:03 ` [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
  2 siblings, 0 replies; 12+ messages in thread
From: Duc Dang @ 2012-03-05  4:00 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, David Miller, Josh Boyer
  Cc: linuxppc-dev, linux-kernel, netdev, Duc Dang

This compatible value will be used to distinguish some special features of APM821XX EMAC: no half duplex mode support, configuring jumbo frame.

Signed-off-by: Duc Dang <dhdang@apm.com>
---
v2:
 No change since v1 patch set. Added for completeness.

 arch/powerpc/boot/dts/bluestone.dts |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts
index 2a56a0d..74876f7 100644
--- a/arch/powerpc/boot/dts/bluestone.dts
+++ b/arch/powerpc/boot/dts/bluestone.dts
@@ -222,7 +222,7 @@
 
 			EMAC0: ethernet@ef600c00 {
 				device_type = "network";
-				compatible = "ibm,emac4sync";
+				compatible = "ibm,emac-apm821xx", "ibm,emac4sync";
 				interrupt-parent = <&EMAC0>;
 				interrupts = <0x0 0x1>;
 				#interrupt-cells = <1>;
-- 
1.7.5.4

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

* [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
       [not found] <1329466058-15969-1-git-send-email-dhdang@apm.com>
  2012-02-29 13:43 ` [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Josh Boyer
  2012-03-05  4:00 ` [PATCH v2 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
@ 2012-03-05  4:03 ` Duc Dang
  2012-03-05  7:41   ` Stefan Roese
                     ` (2 more replies)
  2 siblings, 3 replies; 12+ messages in thread
From: Duc Dang @ 2012-03-05  4:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, David Miller, Josh Boyer
  Cc: linuxppc-dev, linux-kernel, netdev, Duc Dang

This patch includes:

  Configure EMAC PHY clock source (clock from PHY or internal clock).

  Do not advertise PHY half duplex capability as APM821XX EMAC does not
support half duplex mode.

  Add changes to support configuring jumbo frame for APM821XX EMAC.

Signed-off-by: Duc Dang <dhdang@apm.com>
---
v2:
 Fix coding style problems.

 drivers/net/ethernet/ibm/emac/core.c |   26 +++++++++++++++++++++++++-
 drivers/net/ethernet/ibm/emac/core.h |   13 +++++++++++--
 drivers/net/ethernet/ibm/emac/emac.h |    5 ++++-
 3 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 2abce96..ad671c5 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -434,6 +434,11 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)
 	else if (!netdev_mc_empty(ndev))
 		r |= EMAC_RMR_MAE;
 
+	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
+		r &= ~EMAC4_RMR_MJS_MASK;
+		r |= EMAC4_RMR_MJS(ndev->mtu);
+	}
+
 	return r;
 }
 
@@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)
 	int rx_sync_size = emac_rx_sync_size(new_mtu);
 	int rx_skb_size = emac_rx_skb_size(new_mtu);
 	int i, ret = 0;
+	int mr1_jumbo_bit_change = 0;
 
 	mutex_lock(&dev->link_lock);
 	emac_netif_stop(dev);
@@ -1013,7 +1019,14 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)
 	}
  skip:
 	/* Check if we need to change "Jumbo" bit in MR1 */
-	if ((new_mtu > ETH_DATA_LEN) ^ (dev->ndev->mtu > ETH_DATA_LEN)) {
+	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE))
+		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ||
+				(dev->ndev->mtu > ETH_DATA_LEN);
+	else
+		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ^
+				(dev->ndev->mtu > ETH_DATA_LEN);
+
+	if (mr1_jumbo_bit_change) {
 		/* This is to prevent starting RX channel in emac_rx_enable() */
 		set_bit(MAL_COMMAC_RX_STOPPED, &dev->commac.flags);
 
@@ -2471,6 +2484,7 @@ static int __devinit emac_init_phy(struct emac_instance *dev)
 
 	/* Disable any PHY features not supported by the platform */
 	dev->phy.def->features &= ~dev->phy_feat_exc;
+	dev->phy.features &= ~dev->phy_feat_exc;
 
 	/* Setup initial link parameters */
 	if (dev->phy.features & SUPPORTED_Autoneg) {
@@ -2568,6 +2582,10 @@ static int __devinit emac_init_config(struct emac_instance *dev)
 		if (of_device_is_compatible(np, "ibm,emac-405ex") ||
 		    of_device_is_compatible(np, "ibm,emac-405exr"))
 			dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
+		if (of_device_is_compatible(np, "ibm,emac-apm821xx"))
+			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
+					EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
+					EMAC_FTR_460EX_PHY_CLK_FIX);
 	} else if (of_device_is_compatible(np, "ibm,emac4")) {
 		dev->features |= EMAC_FTR_EMAC4;
 		if (of_device_is_compatible(np, "ibm,emac-440gx"))
@@ -2818,6 +2836,12 @@ static int __devinit emac_probe(struct platform_device *ofdev)
 	dev->stop_timeout = STOP_TIMEOUT_100;
 	INIT_DELAYED_WORK(&dev->link_work, emac_link_timer);
 
+	/* Some SoCs like APM821xx does not support Half Duplex mode. */
+	if (emac_has_feature(dev, EMAC_FTR_APM821XX_NO_HALF_DUPLEX))
+		dev->phy_feat_exc = (SUPPORTED_1000baseT_Half |
+					SUPPORTED_100baseT_Half |
+					SUPPORTED_10baseT_Half);
+
 	/* Find PHY if any */
 	err = emac_init_phy(dev);
 	if (err != 0)
diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h
index fa3ec57..9dea85a 100644
--- a/drivers/net/ethernet/ibm/emac/core.h
+++ b/drivers/net/ethernet/ibm/emac/core.h
@@ -325,7 +325,14 @@ struct emac_instance {
  * Set if we need phy clock workaround for 460ex or 460gt
  */
 #define EMAC_FTR_460EX_PHY_CLK_FIX	0x00000400
-
+/*
+ * APM821xx requires Jumbo frame size set explicitly
+ */
+#define EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE	0x00000800
+/*
+ * APM821xx does not support Half Duplex mode
+ */
+#define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
 
 /* Right now, we don't quite handle the always/possible masks on the
  * most optimal way as we don't have a way to say something like
@@ -353,7 +360,9 @@ enum {
 	    EMAC_FTR_NO_FLOW_CONTROL_40x |
 #endif
 	EMAC_FTR_460EX_PHY_CLK_FIX |
-	EMAC_FTR_440EP_PHY_CLK_FIX,
+	EMAC_FTR_440EP_PHY_CLK_FIX |
+	EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
+	EMAC_FTR_APM821XX_NO_HALF_DUPLEX,
 };
 
 static inline int emac_has_feature(struct emac_instance *dev,
diff --git a/drivers/net/ethernet/ibm/emac/emac.h b/drivers/net/ethernet/ibm/emac/emac.h
index 1568278..36bcd69 100644
--- a/drivers/net/ethernet/ibm/emac/emac.h
+++ b/drivers/net/ethernet/ibm/emac/emac.h
@@ -212,7 +212,10 @@ struct emac_regs {
 #define EMAC4_RMR_RFAF_64_1024		0x00000006
 #define EMAC4_RMR_RFAF_128_2048		0x00000007
 #define EMAC4_RMR_BASE			EMAC4_RMR_RFAF_128_2048
-
+#if defined(CONFIG_APM821xx)
+#define EMAC4_RMR_MJS_MASK              0x0001fff8
+#define EMAC4_RMR_MJS(s)                (((s) << 3) & EMAC4_RMR_MJS_MASK)
+#endif
 /* EMACx_ISR & EMACx_ISER */
 #define EMAC4_ISR_TXPE			0x20000000
 #define EMAC4_ISR_RXPE			0x10000000
-- 
1.7.5.4

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

* Re: [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
  2012-03-05  4:03 ` [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
@ 2012-03-05  7:41   ` Stefan Roese
  2012-03-05  8:45     ` Duc Dang
  2012-03-05 10:57   ` [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
  2012-03-05 10:58   ` [PATCH v3 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan Roese @ 2012-03-05  7:41 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Duc Dang, Benjamin Herrenschmidt, Paul Mackerras, David Miller,
	Josh Boyer, netdev, linux-kernel

On Monday 05 March 2012 05:03:44 Duc Dang wrote:
> This patch includes:
> 
>   Configure EMAC PHY clock source (clock from PHY or internal clock).
> 
>   Do not advertise PHY half duplex capability as APM821XX EMAC does not
> support half duplex mode.
> 
>   Add changes to support configuring jumbo frame for APM821XX EMAC.
> 
> Signed-off-by: Duc Dang <dhdang@apm.com>
> ---
> v2:
>  Fix coding style problems.
> 
>  drivers/net/ethernet/ibm/emac/core.c |   26 +++++++++++++++++++++++++-
>  drivers/net/ethernet/ibm/emac/core.h |   13 +++++++++++--
>  drivers/net/ethernet/ibm/emac/emac.h |    5 ++++-
>  3 files changed, 40 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/emac/core.c
> b/drivers/net/ethernet/ibm/emac/core.c index 2abce96..ad671c5 100644
> --- a/drivers/net/ethernet/ibm/emac/core.c
> +++ b/drivers/net/ethernet/ibm/emac/core.c
> @@ -434,6 +434,11 @@ static inline u32 emac_iff2rmr(struct net_device
> *ndev) else if (!netdev_mc_empty(ndev))
>  		r |= EMAC_RMR_MAE;
> 
> +	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
> +		r &= ~EMAC4_RMR_MJS_MASK;
> +		r |= EMAC4_RMR_MJS(ndev->mtu);
> +	}
> +
>  	return r;
>  }
> 
> @@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance
> *dev, int new_mtu) int rx_sync_size = emac_rx_sync_size(new_mtu);
>  	int rx_skb_size = emac_rx_skb_size(new_mtu);
>  	int i, ret = 0;
> +	int mr1_jumbo_bit_change = 0;
> 
>  	mutex_lock(&dev->link_lock);
>  	emac_netif_stop(dev);
> @@ -1013,7 +1019,14 @@ static int emac_resize_rx_ring(struct emac_instance
> *dev, int new_mtu) }
>   skip:
>  	/* Check if we need to change "Jumbo" bit in MR1 */
> -	if ((new_mtu > ETH_DATA_LEN) ^ (dev->ndev->mtu > ETH_DATA_LEN)) {
> +	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE))
> +		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ||
> +				(dev->ndev->mtu > ETH_DATA_LEN);
> +	else
> +		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ^
> +				(dev->ndev->mtu > ETH_DATA_LEN);
> +
> +	if (mr1_jumbo_bit_change) {
>  		/* This is to prevent starting RX channel in emac_rx_enable() 
*/
>  		set_bit(MAL_COMMAC_RX_STOPPED, &dev->commac.flags);
> 
> @@ -2471,6 +2484,7 @@ static int __devinit emac_init_phy(struct
> emac_instance *dev)
> 
>  	/* Disable any PHY features not supported by the platform */
>  	dev->phy.def->features &= ~dev->phy_feat_exc;
> +	dev->phy.features &= ~dev->phy_feat_exc;
> 
>  	/* Setup initial link parameters */
>  	if (dev->phy.features & SUPPORTED_Autoneg) {
> @@ -2568,6 +2582,10 @@ static int __devinit emac_init_config(struct
> emac_instance *dev) if (of_device_is_compatible(np, "ibm,emac-405ex") ||
>  		    of_device_is_compatible(np, "ibm,emac-405exr"))
>  			dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
> +		if (of_device_is_compatible(np, "ibm,emac-apm821xx"))
> +			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE 
|
> +					EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
> +					EMAC_FTR_460EX_PHY_CLK_FIX);

Nitpick: Parentheses for multi line statement please.

>  	} else if (of_device_is_compatible(np, "ibm,emac4")) {
>  		dev->features |= EMAC_FTR_EMAC4;
>  		if (of_device_is_compatible(np, "ibm,emac-440gx"))
> @@ -2818,6 +2836,12 @@ static int __devinit emac_probe(struct
> platform_device *ofdev) dev->stop_timeout = STOP_TIMEOUT_100;
>  	INIT_DELAYED_WORK(&dev->link_work, emac_link_timer);
> 
> +	/* Some SoCs like APM821xx does not support Half Duplex mode. */
> +	if (emac_has_feature(dev, EMAC_FTR_APM821XX_NO_HALF_DUPLEX))
> +		dev->phy_feat_exc = (SUPPORTED_1000baseT_Half |
> +					SUPPORTED_100baseT_Half |
> +					SUPPORTED_10baseT_Half);
> +

Nitpick: Parentheses for multi line statement please.

>  	/* Find PHY if any */
>  	err = emac_init_phy(dev);
>  	if (err != 0)
> diff --git a/drivers/net/ethernet/ibm/emac/core.h
> b/drivers/net/ethernet/ibm/emac/core.h index fa3ec57..9dea85a 100644
> --- a/drivers/net/ethernet/ibm/emac/core.h
> +++ b/drivers/net/ethernet/ibm/emac/core.h
> @@ -325,7 +325,14 @@ struct emac_instance {
>   * Set if we need phy clock workaround for 460ex or 460gt
>   */
>  #define EMAC_FTR_460EX_PHY_CLK_FIX	0x00000400
> -
> +/*
> + * APM821xx requires Jumbo frame size set explicitly
> + */
> +#define EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE	0x00000800
> +/*
> + * APM821xx does not support Half Duplex mode
> + */
> +#define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
> 
>  /* Right now, we don't quite handle the always/possible masks on the
>   * most optimal way as we don't have a way to say something like
> @@ -353,7 +360,9 @@ enum {
>  	    EMAC_FTR_NO_FLOW_CONTROL_40x |
>  #endif
>  	EMAC_FTR_460EX_PHY_CLK_FIX |
> -	EMAC_FTR_440EP_PHY_CLK_FIX,
> +	EMAC_FTR_440EP_PHY_CLK_FIX |
> +	EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
> +	EMAC_FTR_APM821XX_NO_HALF_DUPLEX,
>  };
> 
>  static inline int emac_has_feature(struct emac_instance *dev,
> diff --git a/drivers/net/ethernet/ibm/emac/emac.h
> b/drivers/net/ethernet/ibm/emac/emac.h index 1568278..36bcd69 100644
> --- a/drivers/net/ethernet/ibm/emac/emac.h
> +++ b/drivers/net/ethernet/ibm/emac/emac.h
> @@ -212,7 +212,10 @@ struct emac_regs {
>  #define EMAC4_RMR_RFAF_64_1024		0x00000006
>  #define EMAC4_RMR_RFAF_128_2048		0x00000007
>  #define EMAC4_RMR_BASE			EMAC4_RMR_RFAF_128_2048
> -
> +#if defined(CONFIG_APM821xx)
> +#define EMAC4_RMR_MJS_MASK              0x0001fff8
> +#define EMAC4_RMR_MJS(s)                (((s) << 3) & EMAC4_RMR_MJS_MASK)
> +#endif

Is this "#if defined" really needed? If not, I suggest you drop it.

Thanks,
Stefan

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

* Re: [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
  2012-03-05  7:41   ` Stefan Roese
@ 2012-03-05  8:45     ` Duc Dang
  0 siblings, 0 replies; 12+ messages in thread
From: Duc Dang @ 2012-03-05  8:45 UTC (permalink / raw)
  To: Stefan Roese
  Cc: linux-kernel, Paul Mackerras, netdev, linuxppc-dev, David Miller


[-- Attachment #1.1: Type: text/plain, Size: 6689 bytes --]

Thanks, Stefan.

Please see my answer bellow.

Regards,
Duc Dang.

On Mon, Mar 5, 2012 at 2:41 PM, Stefan Roese <sr@denx.de> wrote:

> On Monday 05 March 2012 05:03:44 Duc Dang wrote:
> > This patch includes:
> >
> >   Configure EMAC PHY clock source (clock from PHY or internal clock).
> >
> >   Do not advertise PHY half duplex capability as APM821XX EMAC does not
> > support half duplex mode.
> >
> >   Add changes to support configuring jumbo frame for APM821XX EMAC.
> >
> > Signed-off-by: Duc Dang <dhdang@apm.com>
> > ---
> > v2:
> >  Fix coding style problems.
> >
> >  drivers/net/ethernet/ibm/emac/core.c |   26 +++++++++++++++++++++++++-
> >  drivers/net/ethernet/ibm/emac/core.h |   13 +++++++++++--
> >  drivers/net/ethernet/ibm/emac/emac.h |    5 ++++-
> >  3 files changed, 40 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ibm/emac/core.c
> > b/drivers/net/ethernet/ibm/emac/core.c index 2abce96..ad671c5 100644
> > --- a/drivers/net/ethernet/ibm/emac/core.c
> > +++ b/drivers/net/ethernet/ibm/emac/core.c
> > @@ -434,6 +434,11 @@ static inline u32 emac_iff2rmr(struct net_device
> > *ndev) else if (!netdev_mc_empty(ndev))
> >               r |= EMAC_RMR_MAE;
> >
> > +     if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
> > +             r &= ~EMAC4_RMR_MJS_MASK;
> > +             r |= EMAC4_RMR_MJS(ndev->mtu);
> > +     }
> > +
> >       return r;
> >  }
> >
> > @@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance
> > *dev, int new_mtu) int rx_sync_size = emac_rx_sync_size(new_mtu);
> >       int rx_skb_size = emac_rx_skb_size(new_mtu);
> >       int i, ret = 0;
> > +     int mr1_jumbo_bit_change = 0;
> >
> >       mutex_lock(&dev->link_lock);
> >       emac_netif_stop(dev);
> > @@ -1013,7 +1019,14 @@ static int emac_resize_rx_ring(struct
> emac_instance
> > *dev, int new_mtu) }
> >   skip:
> >       /* Check if we need to change "Jumbo" bit in MR1 */
> > -     if ((new_mtu > ETH_DATA_LEN) ^ (dev->ndev->mtu > ETH_DATA_LEN)) {
> > +     if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE))
> > +             mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ||
> > +                             (dev->ndev->mtu > ETH_DATA_LEN);
> > +     else
> > +             mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ^
> > +                             (dev->ndev->mtu > ETH_DATA_LEN);
> > +
> > +     if (mr1_jumbo_bit_change) {
> >               /* This is to prevent starting RX channel in
> emac_rx_enable()
> */
> >               set_bit(MAL_COMMAC_RX_STOPPED, &dev->commac.flags);
> >
> > @@ -2471,6 +2484,7 @@ static int __devinit emac_init_phy(struct
> > emac_instance *dev)
> >
> >       /* Disable any PHY features not supported by the platform */
> >       dev->phy.def->features &= ~dev->phy_feat_exc;
> > +     dev->phy.features &= ~dev->phy_feat_exc;
> >
> >       /* Setup initial link parameters */
> >       if (dev->phy.features & SUPPORTED_Autoneg) {
> > @@ -2568,6 +2582,10 @@ static int __devinit emac_init_config(struct
> > emac_instance *dev) if (of_device_is_compatible(np, "ibm,emac-405ex") ||
> >                   of_device_is_compatible(np, "ibm,emac-405exr"))
> >                       dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
> > +             if (of_device_is_compatible(np, "ibm,emac-apm821xx"))
> > +                     dev->features |=
> (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE
> |
> > +                                     EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
> > +                                     EMAC_FTR_460EX_PHY_CLK_FIX);
>
> Nitpick: Parentheses for multi line statement please.
>
[Duc Dang] I wil add parentheses as you suggested.

>       } else if (of_device_is_compatible(np, "ibm,emac4")) {
> >               dev->features |= EMAC_FTR_EMAC4;
> >               if (of_device_is_compatible(np, "ibm,emac-440gx"))
> > @@ -2818,6 +2836,12 @@ static int __devinit emac_probe(struct
> > platform_device *ofdev) dev->stop_timeout = STOP_TIMEOUT_100;
> >       INIT_DELAYED_WORK(&dev->link_work, emac_link_timer);
> >
> > +     /* Some SoCs like APM821xx does not support Half Duplex mode. */
> > +     if (emac_has_feature(dev, EMAC_FTR_APM821XX_NO_HALF_DUPLEX))
> > +             dev->phy_feat_exc = (SUPPORTED_1000baseT_Half |
> > +                                     SUPPORTED_100baseT_Half |
> > +                                     SUPPORTED_10baseT_Half);
> > +
>
> Nitpick: Parentheses for multi line statement please.
>
> >       /* Find PHY if any */
> >       err = emac_init_phy(dev);
> >       if (err != 0)
> > diff --git a/drivers/net/ethernet/ibm/emac/core.h
> > b/drivers/net/ethernet/ibm/emac/core.h index fa3ec57..9dea85a 100644
> > --- a/drivers/net/ethernet/ibm/emac/core.h
> > +++ b/drivers/net/ethernet/ibm/emac/core.h
> > @@ -325,7 +325,14 @@ struct emac_instance {
> >   * Set if we need phy clock workaround for 460ex or 460gt
> >   */
> >  #define EMAC_FTR_460EX_PHY_CLK_FIX   0x00000400
> > -
> > +/*
> > + * APM821xx requires Jumbo frame size set explicitly
> > + */
> > +#define EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE   0x00000800
> > +/*
> > + * APM821xx does not support Half Duplex mode
> > + */
> > +#define EMAC_FTR_APM821XX_NO_HALF_DUPLEX     0x00001000
> >
> >  /* Right now, we don't quite handle the always/possible masks on the
> >   * most optimal way as we don't have a way to say something like
> > @@ -353,7 +360,9 @@ enum {
> >           EMAC_FTR_NO_FLOW_CONTROL_40x |
> >  #endif
> >       EMAC_FTR_460EX_PHY_CLK_FIX |
> > -     EMAC_FTR_440EP_PHY_CLK_FIX,
> > +     EMAC_FTR_440EP_PHY_CLK_FIX |
> > +     EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
> > +     EMAC_FTR_APM821XX_NO_HALF_DUPLEX,
> >  };
> >
> >  static inline int emac_has_feature(struct emac_instance *dev,
> > diff --git a/drivers/net/ethernet/ibm/emac/emac.h
> > b/drivers/net/ethernet/ibm/emac/emac.h index 1568278..36bcd69 100644
> > --- a/drivers/net/ethernet/ibm/emac/emac.h
> > +++ b/drivers/net/ethernet/ibm/emac/emac.h
> > @@ -212,7 +212,10 @@ struct emac_regs {
> >  #define EMAC4_RMR_RFAF_64_1024               0x00000006
> >  #define EMAC4_RMR_RFAF_128_2048              0x00000007
> >  #define EMAC4_RMR_BASE                       EMAC4_RMR_RFAF_128_2048
> > -
> > +#if defined(CONFIG_APM821xx)
> > +#define EMAC4_RMR_MJS_MASK              0x0001fff8
> > +#define EMAC4_RMR_MJS(s)                (((s) << 3) &
> EMAC4_RMR_MJS_MASK)
> > +#endif
>
> Is this "#if defined" really needed? If not, I suggest you drop it.
>


> [Duc Dang] Only APM821XX and later SoCs have this register field, but it
> is no harm to drop the #if defined as 460EX/460GT/405EX have this register
> field as reserved. So I will drop it.
>


> Thanks,
> Stefan
>

[-- Attachment #1.2: Type: text/html, Size: 8456 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file.
  2012-03-05  4:03 ` [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
  2012-03-05  7:41   ` Stefan Roese
@ 2012-03-05 10:57   ` Duc Dang
  2012-03-06 22:08     ` David Miller
  2012-03-05 10:58   ` [PATCH v3 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
  2 siblings, 1 reply; 12+ messages in thread
From: Duc Dang @ 2012-03-05 10:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, David Miller, Josh Boyer,
	Stefan Roese
  Cc: linuxppc-dev, linux-kernel, netdev, Duc Dang

This compatible value will be used to distinguish some special features of APM821XX EMAC: no half duplex mode support, configuring jumbo frame.

Signed-off-by: Duc Dang <dhdang@apm.com>
---
v3:
 No change since v1/v2 patch sets. Added for completeness.

 arch/powerpc/boot/dts/bluestone.dts |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts
index 2a56a0d..74876f7 100644
--- a/arch/powerpc/boot/dts/bluestone.dts
+++ b/arch/powerpc/boot/dts/bluestone.dts
@@ -222,7 +222,7 @@
 
 			EMAC0: ethernet@ef600c00 {
 				device_type = "network";
-				compatible = "ibm,emac4sync";
+				compatible = "ibm,emac-apm821xx", "ibm,emac4sync";
 				interrupt-parent = <&EMAC0>;
 				interrupts = <0x0 0x1>;
 				#interrupt-cells = <1>;
-- 
1.7.5.4

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

* [PATCH v3 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
  2012-03-05  4:03 ` [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
  2012-03-05  7:41   ` Stefan Roese
  2012-03-05 10:57   ` [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
@ 2012-03-05 10:58   ` Duc Dang
  2012-03-06 22:08     ` David Miller
  2 siblings, 1 reply; 12+ messages in thread
From: Duc Dang @ 2012-03-05 10:58 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, David Miller, Josh Boyer,
	Stefan Roese
  Cc: linuxppc-dev, linux-kernel, netdev, Duc Dang

 This patch includes:

  Configure EMAC PHY clock source (clock from PHY or internal clock).

  Do not advertise PHY half duplex capability as APM821XX EMAC does not support half duplex mode.

  Add changes to support configuring jumbo frame for APM821XX EMAC.

Signed-off-by: Duc Dang <dhdang@apm.com>
---
v3:
 Add parentheses for multi-line statements.
 Drop #if defined(CONFIG_APM821xx) in emac.h.

 drivers/net/ethernet/ibm/emac/core.c |   29 ++++++++++++++++++++++++++++-
 drivers/net/ethernet/ibm/emac/core.h |   13 +++++++++++--
 drivers/net/ethernet/ibm/emac/emac.h |    2 ++
 3 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 2abce96..cc51842 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -434,6 +434,11 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)
 	else if (!netdev_mc_empty(ndev))
 		r |= EMAC_RMR_MAE;
 
+	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
+		r &= ~EMAC4_RMR_MJS_MASK;
+		r |= EMAC4_RMR_MJS(ndev->mtu);
+	}
+
 	return r;
 }
 
@@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)
 	int rx_sync_size = emac_rx_sync_size(new_mtu);
 	int rx_skb_size = emac_rx_skb_size(new_mtu);
 	int i, ret = 0;
+	int mr1_jumbo_bit_change = 0;
 
 	mutex_lock(&dev->link_lock);
 	emac_netif_stop(dev);
@@ -1013,7 +1019,15 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)
 	}
  skip:
 	/* Check if we need to change "Jumbo" bit in MR1 */
-	if ((new_mtu > ETH_DATA_LEN) ^ (dev->ndev->mtu > ETH_DATA_LEN)) {
+	if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
+		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ||
+				(dev->ndev->mtu > ETH_DATA_LEN);
+	} else {
+		mr1_jumbo_bit_change = (new_mtu > ETH_DATA_LEN) ^
+				(dev->ndev->mtu > ETH_DATA_LEN);
+	}
+
+	if (mr1_jumbo_bit_change) {
 		/* This is to prevent starting RX channel in emac_rx_enable() */
 		set_bit(MAL_COMMAC_RX_STOPPED, &dev->commac.flags);
 
@@ -2471,6 +2485,7 @@ static int __devinit emac_init_phy(struct emac_instance *dev)
 
 	/* Disable any PHY features not supported by the platform */
 	dev->phy.def->features &= ~dev->phy_feat_exc;
+	dev->phy.features &= ~dev->phy_feat_exc;
 
 	/* Setup initial link parameters */
 	if (dev->phy.features & SUPPORTED_Autoneg) {
@@ -2568,6 +2583,11 @@ static int __devinit emac_init_config(struct emac_instance *dev)
 		if (of_device_is_compatible(np, "ibm,emac-405ex") ||
 		    of_device_is_compatible(np, "ibm,emac-405exr"))
 			dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
+		if (of_device_is_compatible(np, "ibm,emac-apm821xx")) {
+			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
+					EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
+					EMAC_FTR_460EX_PHY_CLK_FIX);
+		}
 	} else if (of_device_is_compatible(np, "ibm,emac4")) {
 		dev->features |= EMAC_FTR_EMAC4;
 		if (of_device_is_compatible(np, "ibm,emac-440gx"))
@@ -2818,6 +2838,13 @@ static int __devinit emac_probe(struct platform_device *ofdev)
 	dev->stop_timeout = STOP_TIMEOUT_100;
 	INIT_DELAYED_WORK(&dev->link_work, emac_link_timer);
 
+	/* Some SoCs like APM821xx does not support Half Duplex mode. */
+	if (emac_has_feature(dev, EMAC_FTR_APM821XX_NO_HALF_DUPLEX)) {
+		dev->phy_feat_exc = (SUPPORTED_1000baseT_Half |
+					SUPPORTED_100baseT_Half |
+					SUPPORTED_10baseT_Half);
+	}
+	
 	/* Find PHY if any */
 	err = emac_init_phy(dev);
 	if (err != 0)
diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h
index fa3ec57..9dea85a 100644
--- a/drivers/net/ethernet/ibm/emac/core.h
+++ b/drivers/net/ethernet/ibm/emac/core.h
@@ -325,7 +325,14 @@ struct emac_instance {
  * Set if we need phy clock workaround for 460ex or 460gt
  */
 #define EMAC_FTR_460EX_PHY_CLK_FIX	0x00000400
-
+/*
+ * APM821xx requires Jumbo frame size set explicitly
+ */
+#define EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE	0x00000800
+/*
+ * APM821xx does not support Half Duplex mode
+ */
+#define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
 
 /* Right now, we don't quite handle the always/possible masks on the
  * most optimal way as we don't have a way to say something like
@@ -353,7 +360,9 @@ enum {
 	    EMAC_FTR_NO_FLOW_CONTROL_40x |
 #endif
 	EMAC_FTR_460EX_PHY_CLK_FIX |
-	EMAC_FTR_440EP_PHY_CLK_FIX,
+	EMAC_FTR_440EP_PHY_CLK_FIX |
+	EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
+	EMAC_FTR_APM821XX_NO_HALF_DUPLEX,
 };
 
 static inline int emac_has_feature(struct emac_instance *dev,
diff --git a/drivers/net/ethernet/ibm/emac/emac.h b/drivers/net/ethernet/ibm/emac/emac.h
index 1568278..c9090a4 100644
--- a/drivers/net/ethernet/ibm/emac/emac.h
+++ b/drivers/net/ethernet/ibm/emac/emac.h
@@ -212,6 +212,8 @@ struct emac_regs {
 #define EMAC4_RMR_RFAF_64_1024		0x00000006
 #define EMAC4_RMR_RFAF_128_2048		0x00000007
 #define EMAC4_RMR_BASE			EMAC4_RMR_RFAF_128_2048
+#define EMAC4_RMR_MJS_MASK              0x0001fff8
+#define EMAC4_RMR_MJS(s)                (((s) << 3) & EMAC4_RMR_MJS_MASK)
 
 /* EMACx_ISR & EMACx_ISER */
 #define EMAC4_ISR_TXPE			0x20000000
-- 
1.7.5.4

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

* Re: [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file.
  2012-03-05 10:57   ` [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
@ 2012-03-06 22:08     ` David Miller
  2012-03-06 22:15       ` Josh Boyer
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2012-03-06 22:08 UTC (permalink / raw)
  To: dhdang; +Cc: benh, paulus, jwboyer, sr, linuxppc-dev, linux-kernel, netdev

From: Duc Dang <dhdang@apm.com>
Date: Mon,  5 Mar 2012 17:57:42 +0700

> This compatible value will be used to distinguish some special features of APM821XX EMAC: no half duplex mode support, configuring jumbo frame.
> 
> Signed-off-by: Duc Dang <dhdang@apm.com>

Applied.

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

* Re: [PATCH v3 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver
  2012-03-05 10:58   ` [PATCH v3 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
@ 2012-03-06 22:08     ` David Miller
  0 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2012-03-06 22:08 UTC (permalink / raw)
  To: dhdang; +Cc: benh, paulus, jwboyer, sr, linuxppc-dev, linux-kernel, netdev

From: Duc Dang <dhdang@apm.com>
Date: Mon,  5 Mar 2012 17:58:22 +0700

>  This patch includes:
> 
>   Configure EMAC PHY clock source (clock from PHY or internal clock).
> 
>   Do not advertise PHY half duplex capability as APM821XX EMAC does not support half duplex mode.
> 
>   Add changes to support configuring jumbo frame for APM821XX EMAC.
> 
> Signed-off-by: Duc Dang <dhdang@apm.com>

Applied with coding style fixes.

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

* Re: [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file.
  2012-03-06 22:08     ` David Miller
@ 2012-03-06 22:15       ` Josh Boyer
  0 siblings, 0 replies; 12+ messages in thread
From: Josh Boyer @ 2012-03-06 22:15 UTC (permalink / raw)
  To: David Miller; +Cc: dhdang, benh, paulus, sr, linuxppc-dev, linux-kernel, netdev

On Tue, Mar 6, 2012 at 5:08 PM, David Miller <davem@davemloft.net> wrote:
> From: Duc Dang <dhdang@apm.com>
> Date: Mon,  5 Mar 2012 17:57:42 +0700
>
>> This compatible value will be used to distinguish some special features of APM821XX EMAC: no half duplex mode support, configuring jumbo frame.
>>
>> Signed-off-by: Duc Dang <dhdang@apm.com>
>
> Applied.

So I guess we're taking these through your tree?  I guess that works out
well enough since the other patches I was going to send to Ben aren't
panning out anyway.

josh

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

end of thread, other threads:[~2012-03-06 22:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1329466058-15969-1-git-send-email-dhdang@apm.com>
2012-02-29 13:43 ` [PATCH 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Josh Boyer
2012-02-29 18:25   ` David Miller
2012-03-01  5:05     ` Duc Dang
2012-03-05  4:00 ` [PATCH v2 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
2012-03-05  4:03 ` [PATCH v2 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
2012-03-05  7:41   ` Stefan Roese
2012-03-05  8:45     ` Duc Dang
2012-03-05 10:57   ` [PATCH v3 1/2] powerpc/44x: Add new compatible value for EMAC node of APM821XX dts file Duc Dang
2012-03-06 22:08     ` David Miller
2012-03-06 22:15       ` Josh Boyer
2012-03-05 10:58   ` [PATCH v3 2/2] powerpc/44x: Add more changes for APM821XX EMAC driver Duc Dang
2012-03-06 22:08     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).