of: add 'of_' prefix to machine_is_compatible()
[safe/jmp/linux-2.6] / arch / powerpc / platforms / powermac / feature.c
index 52cfdd8..33e815f 100644 (file)
@@ -826,13 +826,15 @@ core99_ata100_enable(struct device_node *node, long value)
 
        if (value) {
                if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
-                       pdev = pci_find_slot(pbus, pid);
+                       pdev = pci_get_bus_and_slot(pbus, pid);
                if (pdev == NULL)
                        return 0;
                rc = pci_enable_device(pdev);
+               if (rc == 0)
+                       pci_set_master(pdev);
+               pci_dev_put(pdev);
                if (rc)
                        return rc;
-               pci_set_master(pdev);
        }
        return 0;
 }
@@ -1418,7 +1420,7 @@ static long g5_eth_phy_reset(struct device_node *node, long param, long value)
        phy = of_get_next_child(node, NULL);
        if (!phy)
                return -ENODEV;
-       need_reset = device_is_compatible(phy, "B5221");
+       need_reset = of_device_is_compatible(phy, "B5221");
        of_node_put(phy);
        if (!need_reset)
                return 0;
@@ -2417,14 +2419,14 @@ static int __init probe_motherboard(void)
        dt = of_find_node_by_name(NULL, "device-tree");
        if (dt != NULL)
                model = of_get_property(dt, "model", NULL);
-       for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
+       for(i=0; model && i<ARRAY_SIZE(pmac_mb_defs); i++) {
            if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
                pmac_mb = pmac_mb_defs[i];
                goto found;
            }
        }
-       for(i=0; i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
-           if (machine_is_compatible(pmac_mb_defs[i].model_string)) {
+       for(i=0; i<ARRAY_SIZE(pmac_mb_defs); i++) {
+           if (of_machine_is_compatible(pmac_mb_defs[i].model_string)) {
                pmac_mb = pmac_mb_defs[i];
                goto found;
            }
@@ -2563,6 +2565,8 @@ static void __init probe_uninorth(void)
 
        /* Locate core99 Uni-N */
        uninorth_node = of_find_node_by_name(NULL, "uni-n");
+       uninorth_maj = 1;
+
        /* Locate G5 u3 */
        if (uninorth_node == NULL) {
                uninorth_node = of_find_node_by_name(NULL, "u3");
@@ -2573,8 +2577,10 @@ static void __init probe_uninorth(void)
                uninorth_node = of_find_node_by_name(NULL, "u4");
                uninorth_maj = 4;
        }
-       if (uninorth_node == NULL)
+       if (uninorth_node == NULL) {
+               uninorth_maj = 0;
                return;
+       }
 
        addrp = of_get_property(uninorth_node, "reg", NULL);
        if (addrp == NULL)
@@ -2583,9 +2589,16 @@ static void __init probe_uninorth(void)
        if (address == 0)
                return;
        uninorth_base = ioremap(address, 0x40000);
+       if (uninorth_base == NULL)
+               return;
        uninorth_rev = in_be32(UN_REG(UNI_N_VERSION));
-       if (uninorth_maj == 3 || uninorth_maj == 4)
+       if (uninorth_maj == 3 || uninorth_maj == 4) {
                u3_ht_base = ioremap(address + U3_HT_CONFIG_BASE, 0x1000);
+               if (u3_ht_base == NULL) {
+                       iounmap(uninorth_base);
+                       return;
+               }
+       }
 
        printk(KERN_INFO "Found %s memory controller & host bridge"
               " @ 0x%08x revision: 0x%02x\n", uninorth_maj == 3 ? "U3" :
@@ -2624,7 +2637,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
        for (node = NULL; (node = of_find_node_by_name(node, name)) != NULL;) {
                if (!compat)
                        break;
-               if (device_is_compatible(node, compat))
+               if (of_device_is_compatible(node, compat))
                        break;
        }
        if (!node)
@@ -2671,7 +2684,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
        macio_chips[i].of_node  = node;
        macio_chips[i].type     = type;
        macio_chips[i].base     = base;
-       macio_chips[i].flags    = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
+       macio_chips[i].flags    = MACIO_FLAG_SCCA_ON | MACIO_FLAG_SCCB_ON;
        macio_chips[i].name     = macio_names[type];
        revp = of_get_property(node, "revision-id", NULL);
        if (revp)
@@ -2728,7 +2741,7 @@ initial_serial_shutdown(struct device_node *np)
        conn = of_get_property(np, "AAPL,connector", &len);
        if (conn && (strcmp(conn, "infrared") == 0))
                port_type = PMAC_SCC_IRDA;
-       else if (device_is_compatible(np, "cobalt"))
+       else if (of_device_is_compatible(np, "cobalt"))
                modem = 1;
        else if (slots && slots->count > 0) {
                if (strcmp(slots->name, "IrDA") == 0)
@@ -2787,7 +2800,7 @@ set_initial_features(void)
                 */
                np = of_find_node_by_name(NULL, "ethernet");
                while(np) {
-                       if (device_is_compatible(np, "K2-GMAC"))
+                       if (of_device_is_compatible(np, "K2-GMAC"))
                                g5_gmac_enable(np, 0, 1);
                        np = of_find_node_by_name(np, "ethernet");
                }
@@ -2799,7 +2812,7 @@ set_initial_features(void)
                 */
                np = of_find_node_by_name(NULL, "firewire");
                while(np) {
-                       if (device_is_compatible(np, "pci106b,5811")) {
+                       if (of_device_is_compatible(np, "pci106b,5811")) {
                                macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
                                g5_fw_enable(np, 0, 1);
                        }
@@ -2817,8 +2830,8 @@ set_initial_features(void)
                np = of_find_node_by_name(NULL, "ethernet");
                while(np) {
                        if (np->parent
-                           && device_is_compatible(np->parent, "uni-north")
-                           && device_is_compatible(np, "gmac"))
+                           && of_device_is_compatible(np->parent, "uni-north")
+                           && of_device_is_compatible(np, "gmac"))
                                core99_gmac_enable(np, 0, 1);
                        np = of_find_node_by_name(np, "ethernet");
                }
@@ -2831,10 +2844,10 @@ set_initial_features(void)
                np = of_find_node_by_name(NULL, "firewire");
                while(np) {
                        if (np->parent
-                           && device_is_compatible(np->parent, "uni-north")
-                           && (device_is_compatible(np, "pci106b,18") ||
-                               device_is_compatible(np, "pci106b,30") ||
-                               device_is_compatible(np, "pci11c1,5811"))) {
+                           && of_device_is_compatible(np->parent, "uni-north")
+                           && (of_device_is_compatible(np, "pci106b,18") ||
+                               of_device_is_compatible(np, "pci106b,30") ||
+                               of_device_is_compatible(np, "pci11c1,5811"))) {
                                macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
                                core99_firewire_enable(np, 0, 1);
                        }
@@ -2845,8 +2858,8 @@ set_initial_features(void)
                np = of_find_node_by_name(NULL, "ata-6");
                while(np) {
                        if (np->parent
-                           && device_is_compatible(np->parent, "uni-north")
-                           && device_is_compatible(np, "kauai-ata")) {
+                           && of_device_is_compatible(np->parent, "uni-north")
+                           && of_device_is_compatible(np, "kauai-ata")) {
                                core99_ata100_enable(np, 1);
                        }
                        np = of_find_node_by_name(np, "ata-6");
@@ -3027,3 +3040,8 @@ void pmac_resume_agp_for_card(struct pci_dev *dev)
        pmac_agp_resume(pmac_agp_bridge);
 }
 EXPORT_SYMBOL(pmac_resume_agp_for_card);
+
+int pmac_get_uninorth_variant(void)
+{
+       return uninorth_maj;
+}