@@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)intrx_sync_size=emac_rx_sync_size(new_mtu);intrx_skb_size=emac_rx_skb_size(new_mtu);inti,ret=0;+intmr1_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);}elseif(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)
On Fri, Feb 17, 2012 at 3:07 AM, Duc Dang [off-list ref] wrote:
This patch includes:
=A0Configure EMAC PHY clock source (clock from PHY or internal clock).
=A0Do not advertise PHY half duplex capability as APM821XX EMAC does not
support half duplex mode.
=A0Add changes to support configuring jumbo frame for APM821XX EMAC.
Signed-off-by: Duc Dang <redacted>
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 t=
o
both of you. The pre-requisite DTS patch will go through my tree, so it mi=
ght
make sense to keep them together.
josh
else if (!netdev_mc_empty(ndev))
r |=3D EMAC_RMR_MAE;
+ if (emac_has_feature(dev, EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE)) {
+ r &=3D ~EMAC4_RMR_MJS_MASK;
+ r |=3D EMAC4_RMR_MJS(ndev->mtu);
+ }
+
return r;
}
@@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *=
dev, int new_mtu)
quoted hunk
int rx_sync_size =3D emac_rx_sync_size(new_mtu);
int rx_skb_size =3D emac_rx_skb_size(new_mtu);
int i, ret =3D 0;
+ int mr1_jumbo_bit_change =3D 0;
mutex_lock(&dev->link_lock);
emac_netif_stop(dev);
@@ -1013,7 +1019,14 @@ static int emac_resize_rx_ring(struct emac_instanc=
e *dev, int new_mtu)
quoted hunk
}
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 =3D (new_mtu > ETH_DATA_LEN) ||
+ (dev->ndev->mtu > ETH_DATA_LEN);
+ else
+ mr1_jumbo_bit_change =3D (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_inst=
ance *dev)
quoted hunk
/* Disable any PHY features not supported by the platform */
dev->phy.def->features &=3D ~dev->phy_feat_exc;
+ dev->phy.features &=3D ~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)
quoted hunk
if (of_device_is_compatible(np, "ibm,emac-405ex") ||
of_device_is_compatible(np, "ibm,emac-405exr"))
dev->features |=3D EMAC_FTR_440EP_PHY_CLK_FIX;
+ if (of_device_is_compatible(np, "ibm,emac-apm821xx"))
+ dev->features |=3D (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 |=3D EMAC_FTR_EMAC4;
if (of_device_is_compatible(np, "ibm,emac-440gx"))
@@ -2818,6 +2836,12 @@ static int __devinit emac_probe(struct platform_de=
vice *ofdev)
quoted hunk
dev->stop_timeout =3D 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 =3D (SUPPORTED_1000baseT_Half
+ | SUPPORTED_100baseT_Half
+ | SUPPORTED_10baseT_Half);
+
/* Find PHY if any */
err =3D emac_init_phy(dev);
if (err !=3D 0)
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 [off-list ref] wrote:
On Fri, Feb 17, 2012 at 3:07 AM, Duc Dang [off-list ref] wrote:
quoted
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 <redacted>
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
quoted
both of you. The pre-requisite DTS patch will go through my tree, so it
might
quoted
make sense to keep them together.
Well the patch has coding style problems, for one:
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 <redacted>
---
v2:
No change since v1 patch set. Added for completeness.
arch/powerpc/boot/dts/bluestone.dts | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)intrx_sync_size=emac_rx_sync_size(new_mtu);intrx_skb_size=emac_rx_skb_size(new_mtu);inti,ret=0;+intmr1_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);}elseif(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)
*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()
@@ -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
*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
quoted
*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
@@ -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 |=
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.
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 <redacted>
---
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(-)
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 <redacted>
---
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(-)
@@ -965,6 +970,7 @@ static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu)intrx_sync_size=emac_rx_sync_size(new_mtu);intrx_skb_size=emac_rx_skb_size(new_mtu);inti,ret=0;+intmr1_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);+}}elseif(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)
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 <redacted>
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 <redacted>
This compatible value will be used to distinguish some special features =
of APM821XX EMAC: no half duplex mode support, configuring jumbo frame.
quoted
Signed-off-by: Duc Dang <redacted>
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