static bool __devinit sdhci_of_wp_inverted(struct device_node *np) { if (of_get_property(np, "sdhci,wp-inverted", NULL)) return true; /* Old device trees don't have the wp-inverted property. */ return machine_is(mpc837x_rdb) || machine_is(mpc837x_mds); }
static int __init mpc85xx_publish_devices(void) { if (machine_is(mpc8568_mds)) simple_gpiochip_init("fsl,mpc8568mds-bcsr-gpio"); if (machine_is(mpc8569_mds)) simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); return mpc85xx_common_publish_devices(); }
static bool sdhci_of_wp_inverted(struct device_node *np) { if (of_get_property(np, "sdhci,wp-inverted", NULL)) return true; /* Old device trees don't have the wp-inverted property. */ #ifdef CONFIG_PPC return machine_is(mpc837x_rdb) || machine_is(mpc837x_mds); #else return false; #endif /* CONFIG_PPC */ }
/* * UHC(usb host controller) enable function. * affect to both of OHCI and EHCI core module. */ static void enable_scc_uhc(struct pci_dev *dev) { void __iomem *uhc_base; u32 __iomem *uhc_clkctrl; u32 __iomem *uhc_ecmode; u32 val = 0; int i; if (!machine_is(celleb_beat) && !machine_is(celleb_native)) return; uhc_base = ioremap(pci_resource_start(dev, 0), pci_resource_len(dev, 0)); if (!uhc_base) { printk(KERN_ERR "failed to map UHC register base.\n"); return; } uhc_clkctrl = uhc_base + SCC_UHC_CKRCTRL; uhc_ecmode = uhc_base + SCC_UHC_ECMODE; /* setup for normal mode */ val |= SCC_UHC_F48MCKLEN; out_be32(uhc_clkctrl, val); val |= SCC_UHC_PHY_SUSPEND_SEL; out_be32(uhc_clkctrl, val); udelay(10); val |= SCC_UHC_PHYEN; out_be32(uhc_clkctrl, val); udelay(50); /* disable reset */ val |= SCC_UHC_HCLKEN; out_be32(uhc_clkctrl, val); val |= (SCC_UHC_USBCEN | SCC_UHC_USBEN); out_be32(uhc_clkctrl, val); i = 0; while (!uhc_clkctrl_ready(in_be32(uhc_clkctrl))) { udelay(10); if (i++ > UHC_RESET_WAIT_MAX) { printk(KERN_ERR "Failed to disable UHC reset %x\n", in_be32(uhc_clkctrl)); break; } } /* Endian Conversion Mode for Master ALL area */ out_be32(uhc_ecmode, SCC_UHC_ECMODE_BY_BYTE); iounmap(uhc_base); }
static void cell_fixup_pcie_rootcomplex(struct pci_dev *dev) { struct pci_controller *hose; const char *s; int i; if (!machine_is(cell)) return; /* We're searching for a direct child of the PHB */ if (dev->bus->self != NULL || dev->devfn != 0) return; hose = pci_bus_to_host(dev->bus); if (hose == NULL) return; /* Only on PCIE */ if (!of_device_is_compatible(hose->dn, "pciex")) return; /* And only on axon */ s = of_get_property(hose->dn, "model", NULL); if (!s || strcmp(s, "Axon") != 0) return; for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) { dev->resource[i].start = dev->resource[i].end = 0; dev->resource[i].flags = 0; } printk(KERN_DEBUG "PCI: Hiding resources on Axon PCIE RC %s\n", pci_name(dev)); }
static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { switch(cmd) { #ifdef CONFIG_PPC_PMAC case OBSOLETE_PMAC_NVRAM_GET_OFFSET: printk(KERN_WARNING "nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n"); case IOC_NVRAM_GET_OFFSET: { int part, offset; if (!machine_is(powermac)) return -EINVAL; if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0) return -EFAULT; if (part < pmac_nvram_OF || part > pmac_nvram_NR) return -EINVAL; offset = pmac_get_partition(part); if (copy_to_user((void __user*)arg, &offset, sizeof(offset)) != 0) return -EFAULT; break; } #endif /* CONFIG_PPC_PMAC */ case IOC_NVRAM_SYNC: nvram_sync(); break; default: return -EINVAL; } return 0; }
int __init pmac_ide_probe(void) { int error; if (!machine_is(powermac)) return -ENODEV; #ifdef CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST error = pci_register_driver(&pmac_ide_pci_driver); if (error) goto out; error = macio_register_driver(&pmac_ide_macio_driver); if (error) { pci_unregister_driver(&pmac_ide_pci_driver); goto out; } #else error = macio_register_driver(&pmac_ide_macio_driver); if (error) goto out; error = pci_register_driver(&pmac_ide_pci_driver); if (error) { macio_unregister_driver(&pmac_ide_macio_driver); goto out; } #endif out: return error; }
static int __init proc_rtas_init(void) { if (!machine_is(pseries)) return -ENODEV; rtas_node = of_find_node_by_name(NULL, "rtas"); if (rtas_node == NULL) return -ENODEV; proc_create("powerpc/rtas/progress", S_IRUGO|S_IWUSR, NULL, &ppc_rtas_progress_operations); proc_create("powerpc/rtas/clock", S_IRUGO|S_IWUSR, NULL, &ppc_rtas_clock_operations); proc_create("powerpc/rtas/poweron", S_IWUSR|S_IRUGO, NULL, &ppc_rtas_poweron_operations); proc_create("powerpc/rtas/sensors", S_IRUGO, NULL, &ppc_rtas_sensors_operations); proc_create("powerpc/rtas/frequency", S_IWUSR|S_IRUGO, NULL, &ppc_rtas_tone_freq_operations); proc_create("powerpc/rtas/volume", S_IWUSR|S_IRUGO, NULL, &ppc_rtas_tone_volume_operations); proc_create("powerpc/rtas/rmo_buffer", S_IRUSR, NULL, &ppc_rtas_rmo_buf_ops); return 0; }
static int __init cbe_init_pm_irq(void) { unsigned int irq; int rc, node; if (!machine_is(cell)) return 0; for_each_node(node) { irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI | (node << IIC_IRQ_NODE_SHIFT)); if (irq == NO_IRQ) { printk("ERROR: Unable to allocate irq for node %d\n", node); return -EINVAL; } rc = request_irq(irq, cbe_pm_irq, IRQF_DISABLED, "cbe-pmu-0", NULL); if (rc) { printk("ERROR: Request for irq on node %d failed\n", node); return rc; } } return 0; }
static void __init mpc85xx_mds_qe_init(void) { struct device_node *np; np = of_find_compatible_node(NULL, NULL, "fsl,qe"); if (!np) { np = of_find_node_by_name(NULL, "qe"); if (!np) return; } if (!of_device_is_available(np)) { of_node_put(np); return; } qe_reset(); of_node_put(np); np = of_find_node_by_name(NULL, "par_io"); if (np) { struct device_node *ucc; par_io_init(np); of_node_put(np); for_each_node_by_name(ucc, "ucc") par_io_of_config(ucc); } mpc85xx_mds_reset_ucc_phys(); if (machine_is(p1021_mds)) { struct ccsr_guts __iomem *guts; np = of_find_node_by_name(NULL, "global-utilities"); if (np) { guts = of_iomap(np, 0); if (!guts) pr_err("mpc85xx-rdb: could not map global utilities register\n"); else{ /* P1021 has pins muxed for QE and other functions. To * enable QE UEC mode, we need to set bit QE0 for UCC1 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9 * and QE12 for QE MII management signals in PMUXCR * register. */ setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) | MPC85xx_PMUXCR_QE(3) | MPC85xx_PMUXCR_QE(9) | MPC85xx_PMUXCR_QE(12)); iounmap(guts); } of_node_put(np); } } }
static int __init declare_of_platform_devices(void) { if (!machine_is(mpc85xx_ads)) return 0; of_platform_bus_probe(NULL, of_bus_ids, NULL); return 0; }
int __init adb_init(void) { struct adb_driver *driver; int i; #ifdef CONFIG_PPC32 if (!machine_is(chrp) && !machine_is(powermac)) return 0; #endif #ifdef CONFIG_MAC if (!MACH_IS_MAC) return 0; #endif /* xmon may do early-init */ if (adb_inited) return 0; adb_inited = 1; adb_controller = NULL; i = 0; while ((driver = adb_driver_list[i++]) != NULL) { if (!driver->probe()) { adb_controller = driver; break; } } if ((adb_controller == NULL) || adb_controller->init()) { printk(KERN_WARNING "Warning: no ADB interface detected\n"); adb_controller = NULL; } else { #ifdef CONFIG_PM pmu_register_sleep_notifier(&adb_sleep_notifier); #endif /* CONFIG_PM */ #ifdef CONFIG_PPC if (machine_is_compatible("AAPL,PowerBook1998") || machine_is_compatible("PowerBook1,1")) sleepy_trackpad = 1; #endif /* CONFIG_PPC */ init_completion(&adb_probe_task_comp); adbdev_init(); adb_reset_bus(); } return 0; }
static int __init wii_device_probe(void) { if (!machine_is(wii)) return 0; of_platform_populate(NULL, wii_of_bus, NULL, NULL); return 0; }
static int __init gamecube_device_probe(void) { if (!machine_is(gamecube)) return 0; of_platform_bus_probe(NULL, gamecube_of_bus, NULL); return 0; }
static int __init rtas_init(void) { struct proc_dir_entry *entry; if (!machine_is(pseries) && !machine_is(chrp)) return 0; if (!rtas_log_buf) return -ENODEV; entry = proc_create("powerpc/rtas/error_log", S_IRUSR, NULL, &proc_rtas_log_operations); if (!entry) printk(KERN_ERR "Failed to create error_log proc entry\n"); return 0; }
static int __init adb_init(void) { struct adb_driver *driver; int i; #ifdef CONFIG_PPC32 if (!machine_is(chrp) && !machine_is(powermac)) return 0; #endif #ifdef CONFIG_MAC if (!MACH_IS_MAC) return 0; #endif /* xmon may do early-init */ if (adb_inited) return 0; adb_inited = 1; adb_controller = NULL; i = 0; while ((driver = adb_driver_list[i++]) != NULL) { if (!driver->probe()) { adb_controller = driver; break; } } if (adb_controller != NULL && adb_controller->init && adb_controller->init()) adb_controller = NULL; if (adb_controller == NULL) { pr_warn("Warning: no ADB interface detected\n"); } else { #ifdef CONFIG_PPC if (of_machine_is_compatible("AAPL,PowerBook1998") || of_machine_is_compatible("PowerBook1,1")) sleepy_trackpad = 1; #endif /* CONFIG_PPC */ adbdev_init(); adb_reset_bus(); } return 0; }
static int __init rtas_init(void) { struct proc_dir_entry *entry; if (!machine_is(pseries) && !machine_is(chrp)) return 0; /* No RTAS */ event_scan = rtas_token("event-scan"); if (event_scan == RTAS_UNKNOWN_SERVICE) { printk(KERN_INFO "rtasd: No event-scan on system\n"); return -ENODEV; } rtas_event_scan_rate = rtas_token("rtas-event-scan-rate"); if (rtas_event_scan_rate == RTAS_UNKNOWN_SERVICE) { printk(KERN_ERR "rtasd: no rtas-event-scan-rate on system\n"); return -ENODEV; } if (!rtas_event_scan_rate) { /* Broken firmware: take a rate of zero to mean don't scan */ printk(KERN_DEBUG "rtasd: scan rate is 0, not scanning\n"); return 0; } /* Make room for the sequence number */ rtas_error_log_max = rtas_get_error_log_max(); rtas_error_log_buffer_max = rtas_error_log_max + sizeof(int); rtas_log_buf = vmalloc(rtas_error_log_buffer_max*LOG_NUMBER); if (!rtas_log_buf) { printk(KERN_ERR "rtasd: no memory\n"); return -ENOMEM; } entry = proc_create("powerpc/rtas/error_log", S_IRUSR, NULL, &proc_rtas_log_operations); if (!entry) printk(KERN_ERR "Failed to create error_log proc entry\n"); start_event_scan(); return 0; }
static int __init celleb_publish_devices(void) { if (!machine_is(celleb)) return 0; /* Publish OF platform devices for southbridge IOs */ of_platform_bus_probe(NULL, celleb_bus_ids, NULL); return 0; }
static int __init mpc832x_declare_of_platform_devices(void) { if (!machine_is(mpc832x_rdb)) return 0; /* Publish the QE devices */ of_platform_bus_probe(NULL, mpc832x_ids, NULL); return 0; }
static int __init rtas_event_scan_init(void) { if (!machine_is(pseries) && !machine_is(chrp)) return 0; /* No RTAS */ event_scan = rtas_token("event-scan"); if (event_scan == RTAS_UNKNOWN_SERVICE) { printk(KERN_INFO "rtasd: No event-scan on system\n"); return -ENODEV; } rtas_event_scan_rate = rtas_token("rtas-event-scan-rate"); if (rtas_event_scan_rate == RTAS_UNKNOWN_SERVICE) { printk(KERN_ERR "rtasd: no rtas-event-scan-rate on system\n"); return -ENODEV; } if (!rtas_event_scan_rate) { /* Broken firmware: take a rate of zero to mean don't scan */ printk(KERN_DEBUG "rtasd: scan rate is 0, not scanning\n"); return 0; } /* Make room for the sequence number */ rtas_error_log_max = rtas_get_error_log_max(); rtas_error_log_buffer_max = rtas_error_log_max + sizeof(int); rtas_log_buf = vmalloc(rtas_error_log_buffer_max*LOG_NUMBER); if (!rtas_log_buf) { printk(KERN_ERR "rtasd: no memory\n"); return -ENOMEM; } start_event_scan(); return 0; }
static int __init surveillance_setup(char *str) { int i; /* We only do surveillance on pseries */ if (!machine_is(pseries)) return 0; if (get_option(&str,&i)) { if (i >= 0 && i <= 255) surveillance_timeout = i; } return 1; }
static int __init mpc832x_rtc_hookup(void) { struct timespec tv; if (!machine_is(mpc832x_mds)) return 0; ppc_md.get_rtc_time = ds1374_get_rtc_time; ppc_md.set_rtc_time = ds1374_set_rtc_time; tv.tv_nsec = 0; tv.tv_sec = (ppc_md.get_rtc_time) (); do_settimeofday(&tv); return 0; }
/** * eeh_pseries_init - Register platform dependent EEH operations * * EEH initialization on pseries platform. This function should be * called before any EEH related functions. */ static int __init eeh_pseries_init(void) { int ret = -EINVAL; if (!machine_is(pseries)) return ret; ret = eeh_ops_register(&pseries_eeh_ops); if (!ret) pr_info("EEH: pSeries platform initialized\n"); else pr_info("EEH: pSeries platform initialization failure (%d)\n", ret); return ret; }
/* * Setup the architecture */ static void __init mpc85xx_rdb_setup_arch(void) { if (ppc_md.progress) ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); mpc85xx_smp_init(); fsl_pci_assign_primary(); #ifdef CONFIG_QUICC_ENGINE mpc85xx_qe_init(); mpc85xx_qe_par_io_init(); #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) if (machine_is(p1025_rdb)) { struct device_node *np; struct ccsr_guts __iomem *guts; np = of_find_node_by_name(NULL, "global-utilities"); if (np) { guts = of_iomap(np, 0); if (!guts) { pr_err("mpc85xx-rdb: could not map global utilities register\n"); } else { /* P1025 has pins muxed for QE and other functions. To * enable QE UEC mode, we need to set bit QE0 for UCC1 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9 * and QE12 for QE MII management singals in PMUXCR * register. */ setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) | MPC85xx_PMUXCR_QE(3) | MPC85xx_PMUXCR_QE(9) | MPC85xx_PMUXCR_QE(12)); iounmap(guts); } of_node_put(np); } } #endif #endif /* CONFIG_QUICC_ENGINE */ printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); }
static void gef_ppc9a_nec_fixup(struct pci_dev *pdev) { unsigned int val; /* Do not do the fixup on other platforms! */ if (!machine_is(gef_ppc9a)) return; printk(KERN_INFO "Running NEC uPD720101 Fixup\n"); /* Ensure ports 1, 2, 3, 4 & 5 are enabled */ pci_read_config_dword(pdev, 0xe0, &val); pci_write_config_dword(pdev, 0xe0, (val & ~7) | 0x5); /* System clock is 48-MHz Oscillator and EHCI Enabled. */ pci_write_config_dword(pdev, 0xe4, 1 << 5); }
/** * pseries_suspend_init - initcall for pSeries suspend * * Return value: * 0 on success / other on failure **/ static int __init pseries_suspend_init(void) { int rc; if (!machine_is(pseries) || !firmware_has_feature(FW_FEATURE_LPAR)) return 0; suspend_data.token = rtas_token("ibm,suspend-me"); if (suspend_data.token == RTAS_UNKNOWN_SERVICE) return 0; if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev))) return rc; suspend_set_ops(&pseries_suspend_ops); return 0; }
static int __init wii_device_probe(void) { struct device_node *np; if (!machine_is(wii)) return 0; of_platform_bus_probe(NULL, wii_of_bus, NULL); np = of_find_compatible_node(NULL, NULL, "nintendo,hollywood-mem2"); if (np) { of_platform_device_create(np, NULL, NULL); of_node_put(np); } return 0; }
static int hcd_pci_suspend_noirq(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); struct usb_hcd *hcd = pci_get_drvdata(pci_dev); int retval; retval = check_root_hub_suspended(dev); if (retval) return retval; pci_save_state(pci_dev); /* If the root hub is HALTed rather than SUSPENDed, * disallow remote wakeup. */ if (hcd->state == HC_STATE_HALT) device_set_wakeup_enable(dev, 0); dev_dbg(dev, "wakeup: %d\n", device_may_wakeup(dev)); /* Possibly enable remote wakeup, * choose the appropriate low-power state, and go to that state. */ retval = pci_prepare_to_sleep(pci_dev); if (retval == -EIO) { /* Low-power not supported */ dev_dbg(dev, "--> PCI D0 legacy\n"); retval = 0; } else if (retval == 0) { dev_dbg(dev, "--> PCI %s\n", pci_power_name(pci_dev->current_state)); } else { suspend_report_result(pci_prepare_to_sleep, retval); return retval; } #ifdef CONFIG_PPC_PMAC /* Disable ASIC clocks for USB */ if (machine_is(powermac)) { struct device_node *of_node; of_node = pci_device_to_OF_node(pci_dev); if (of_node) pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0); } #endif return retval; }
void nvidia_bl_init(struct nvidia_par *par) { struct backlight_properties props; struct fb_info *info = pci_get_drvdata(par->pci_dev); struct backlight_device *bd; char name[12]; if (!par->FlatPanel) return; #ifdef CONFIG_PMAC_BACKLIGHT if (!machine_is(powermac) || !pmac_has_backlight_type("mnca")) return; #endif snprintf(name, sizeof(name), "nvidiabl%d", info->node); memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = FB_BACKLIGHT_LEVELS - 1; bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops, &props); if (IS_ERR(bd)) { info->bl_dev = NULL; printk(KERN_WARNING "nvidia: Backlight registration failed\n"); goto error; } info->bl_dev = bd; fb_bl_default_curve(info, 0, 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); bd->props.brightness = bd->props.max_brightness; bd->props.power = FB_BLANK_UNBLANK; backlight_update_status(bd); printk("nvidia: Backlight initialized (%s)\n", name); return; error: return; }
static int __init cell_publish_devices(void) { int node; if (machine_is(cell)) of_platform_bus_probe(NULL, NULL, NULL); /* There is no device for the MIC memory controller, thus we create * a platform device for it to attach the EDAC driver to. */ for_each_online_node(node) { if (cbe_get_cpu_mic_tm_regs(cbe_node_to_cpu(node)) == NULL) continue; platform_device_register_simple("cbe-mic", node, NULL, 0); } return 0; }