Skip to content

Commit 1ff0fcf

Browse files
author
Josh Boyer
committed
ibm_newemac: Fix new MAL feature handling
Support for new features needed by the PPC 405EZ boards introduced some errors in the MAL and EMAC feature handling. This broke 'allmodconfig' builds as CONFIG_PPC_DCR_NATIVE is not set for those. This patch fixes these errors by wrapping the code in the appropriate #ifdefs. Acked-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Josh Boyer <[email protected]>
1 parent 878e755 commit 1ff0fcf

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

drivers/net/ibm_newemac/core.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,8 +2604,16 @@ static int __devinit emac_init_config(struct emac_instance *dev)
26042604
if (of_device_is_compatible(np, "ibm,emac-440ep") ||
26052605
of_device_is_compatible(np, "ibm,emac-440gr"))
26062606
dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
2607-
if (of_device_is_compatible(np, "ibm,emac-405ez"))
2607+
if (of_device_is_compatible(np, "ibm,emac-405ez")) {
2608+
#ifdef CONFIG_IBM_NEW_EMAC_NO_FLOW_CONTROL
26082609
dev->features |= EMAC_FTR_NO_FLOW_CONTROL_40x;
2610+
#else
2611+
printk(KERN_ERR "%s: Flow control not disabled!\n",
2612+
np->full_name);
2613+
return -ENXIO;
2614+
#endif
2615+
}
2616+
26092617
}
26102618

26112619
/* Fixup some feature bits based on the device tree */

drivers/net/ibm_newemac/mal.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,11 @@ static irqreturn_t mal_txeob(int irq, void *dev_instance)
280280
mal_schedule_poll(mal);
281281
set_mal_dcrn(mal, MAL_TXEOBISR, r);
282282

283+
#ifdef CONFIG_PPC_DCR_NATIVE
283284
if (mal_has_feature(mal, MAL_FTR_CLEAR_ICINTSTAT))
284285
mtdcri(SDR0, DCRN_SDR_ICINTSTAT,
285286
(mfdcri(SDR0, DCRN_SDR_ICINTSTAT) | ICINTSTAT_ICTX));
287+
#endif
286288

287289
return IRQ_HANDLED;
288290
}
@@ -298,9 +300,11 @@ static irqreturn_t mal_rxeob(int irq, void *dev_instance)
298300
mal_schedule_poll(mal);
299301
set_mal_dcrn(mal, MAL_RXEOBISR, r);
300302

303+
#ifdef CONFIG_PPC_DCR_NATIVE
301304
if (mal_has_feature(mal, MAL_FTR_CLEAR_ICINTSTAT))
302305
mtdcri(SDR0, DCRN_SDR_ICINTSTAT,
303306
(mfdcri(SDR0, DCRN_SDR_ICINTSTAT) | ICINTSTAT_ICRX));
307+
#endif
304308

305309
return IRQ_HANDLED;
306310
}
@@ -572,9 +576,18 @@ static int __devinit mal_probe(struct of_device *ofdev,
572576
goto fail;
573577
}
574578

575-
if (of_device_is_compatible(ofdev->node, "ibm,mcmal-405ez"))
579+
if (of_device_is_compatible(ofdev->node, "ibm,mcmal-405ez")) {
580+
#if defined(CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT) && \
581+
defined(CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR)
576582
mal->features |= (MAL_FTR_CLEAR_ICINTSTAT |
577583
MAL_FTR_COMMON_ERR_INT);
584+
#else
585+
printk(KERN_ERR "%s: Support for 405EZ not enabled!\n",
586+
ofdev->node->full_name);
587+
err = -ENODEV;
588+
goto fail;
589+
#endif
590+
}
578591

579592
mal->txeob_irq = irq_of_parse_and_map(ofdev->node, 0);
580593
mal->rxeob_irq = irq_of_parse_and_map(ofdev->node, 1);

0 commit comments

Comments
 (0)