ibm_newemac: Fix new MAL feature handling
authorJosh Boyer <jwboyer@linux.vnet.ibm.com>
Thu, 16 Oct 2008 04:38:40 +0000 (04:38 +0000)
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>
Mon, 20 Oct 2008 23:59:54 +0000 (19:59 -0400)
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 <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
drivers/net/ibm_newemac/core.c
drivers/net/ibm_newemac/mal.c

index efcf21c9f5c7a825ee66ca0671e689c90c13f5ff..2ee2622258f587c40196a8917ba78dcf6952b397 100644 (file)
@@ -2604,8 +2604,16 @@ static int __devinit emac_init_config(struct emac_instance *dev)
                if (of_device_is_compatible(np, "ibm,emac-440ep") ||
                    of_device_is_compatible(np, "ibm,emac-440gr"))
                        dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
-               if (of_device_is_compatible(np, "ibm,emac-405ez"))
+               if (of_device_is_compatible(np, "ibm,emac-405ez")) {
+#ifdef CONFIG_IBM_NEW_EMAC_NO_FLOW_CONTROL
                        dev->features |= EMAC_FTR_NO_FLOW_CONTROL_40x;
+#else
+                       printk(KERN_ERR "%s: Flow control not disabled!\n",
+                                       np->full_name);
+                       return -ENXIO;
+#endif
+               }
+
        }
 
        /* Fixup some feature bits based on the device tree */
index 1839d3f154a3f3256f15b9d842f86fbd407a8fe5..ecf9798987fade1915904f6cb011b8f61f93346f 100644 (file)
@@ -280,9 +280,11 @@ static irqreturn_t mal_txeob(int irq, void *dev_instance)
        mal_schedule_poll(mal);
        set_mal_dcrn(mal, MAL_TXEOBISR, r);
 
+#ifdef CONFIG_PPC_DCR_NATIVE
        if (mal_has_feature(mal, MAL_FTR_CLEAR_ICINTSTAT))
                mtdcri(SDR0, DCRN_SDR_ICINTSTAT,
                                (mfdcri(SDR0, DCRN_SDR_ICINTSTAT) | ICINTSTAT_ICTX));
+#endif
 
        return IRQ_HANDLED;
 }
@@ -298,9 +300,11 @@ static irqreturn_t mal_rxeob(int irq, void *dev_instance)
        mal_schedule_poll(mal);
        set_mal_dcrn(mal, MAL_RXEOBISR, r);
 
+#ifdef CONFIG_PPC_DCR_NATIVE
        if (mal_has_feature(mal, MAL_FTR_CLEAR_ICINTSTAT))
                mtdcri(SDR0, DCRN_SDR_ICINTSTAT,
                                (mfdcri(SDR0, DCRN_SDR_ICINTSTAT) | ICINTSTAT_ICRX));
+#endif
 
        return IRQ_HANDLED;
 }
@@ -572,9 +576,18 @@ static int __devinit mal_probe(struct of_device *ofdev,
                goto fail;
        }
 
-       if (of_device_is_compatible(ofdev->node, "ibm,mcmal-405ez"))
+       if (of_device_is_compatible(ofdev->node, "ibm,mcmal-405ez")) {
+#if defined(CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT) && \
+               defined(CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR)
                mal->features |= (MAL_FTR_CLEAR_ICINTSTAT |
                                MAL_FTR_COMMON_ERR_INT);
+#else
+               printk(KERN_ERR "%s: Support for 405EZ not enabled!\n",
+                               ofdev->node->full_name);
+               err = -ENODEV;
+               goto fail;
+#endif
+       }
 
        mal->txeob_irq = irq_of_parse_and_map(ofdev->node, 0);
        mal->rxeob_irq = irq_of_parse_and_map(ofdev->node, 1);