for_each_child_of_node(macio->of_node, gparent) if (of_node_name_eq(gparent, "gpio")) break; if (gparent == NULL) return;
DBG("Installing GPIO functions for macio %pOF\n",
macio->of_node);
/* * Ok, got one, we dont need anything special to track them down, so * we just create them all
*/
for_each_child_of_node(gparent, gp) { const u32 *reg = of_get_property(gp, "reg", NULL); unsignedlong offset; if (reg == NULL) continue;
offset = *reg; /* Deal with old style device-tree. We can safely hard code the * offset for now too even if it's a bit gross ...
*/ if (offset < 0x50)
offset += 0x50;
offset += (unsignedlong)macio->base;
pmf_register_driver(gp, &macio_gpio_handlers, (void *)offset);
}
DBG("Calling initial GPIO functions for macio %pOF\n",
macio->of_node);
/* And now we run all the init ones */
for_each_child_of_node(gparent, gp)
pmf_do_functions(gp, NULL, 0, PMF_FLAGS_ON_INIT, NULL);
of_node_put(gparent);
/* Note: We do not at this point implement the "at sleep" or "at wake" * functions. I yet to find any for GPIOs anyway
*/
}
raw_spin_lock_irqsave(&feature_lock, flags); /* This is fairly bogus in darwin, but it should work for our needs * implemeted that way:
*/
UN_OUT(offset, (UN_IN(offset) & ~mask) | (value & mask));
raw_spin_unlock_irqrestore(&feature_lock, flags); return 0;
}
DBG("Installing functions for UniN %pOF\n",
uninorth_node);
/* * Install handlers for the bridge itself
*/
pmf_register_driver(uninorth_node, &unin_mmio_handlers, NULL);
pmf_do_functions(uninorth_node, NULL, 0, PMF_FLAGS_ON_INIT, NULL);
/* * Install handlers for the hwclock child if any
*/
for_each_child_of_node(uninorth_node, np) if (of_node_name_eq(np, "hw-clock")) {
unin_hwclock = np; break;
} if (unin_hwclock) {
DBG("Installing functions for UniN clock %pOF\n",
unin_hwclock);
pmf_register_driver(unin_hwclock, &unin_mmio_handlers, NULL);
pmf_do_functions(unin_hwclock, NULL, 0, PMF_FLAGS_ON_INIT,
NULL);
}
}
/* We export this as the SMP code might init us early */ int __init pmac_pfunc_base_install(void)
{ staticint pfbase_inited; int i;
if (pfbase_inited) return 0;
pfbase_inited = 1;
if (!machine_is(powermac)) return 0;
DBG("Installing base platform functions...\n");
/* * Locate mac-io chips and install handlers
*/ for (i = 0 ; i < MAX_MACIO_CHIPS; i++) { if (macio_chips[i].of_node) {
macio_mmio_init_one(&macio_chips[i]);
macio_gpio_init_one(&macio_chips[i]);
}
}
/* * Install handlers for northbridge and direct mapped hwclock * if any. We do not implement the config space access callback * which is only ever used for functions that we do not call in * the current driver (enabling/disabling cells in U2, mostly used * to restore the PCI settings, we do that differently)
*/ if (uninorth_node && uninorth_base)
uninorth_install_pfunc();
/* Those can be called by pmac_feature. Ultimately, I should use a sysdev * or a device, but for now, that's good enough until I sort out some * ordering issues. Also, we do not bother with GPIOs, as so far I yet have * to see a case where a GPIO function has the on-suspend or on-resume bit
*/ void pmac_pfunc_base_suspend(void)
{ int i;
for (i = 0 ; i < MAX_MACIO_CHIPS; i++) { if (macio_chips[i].of_node)
pmf_do_functions(macio_chips[i].of_node, NULL, 0,
PMF_FLAGS_ON_SLEEP, NULL);
} if (uninorth_node)
pmf_do_functions(uninorth_node, NULL, 0,
PMF_FLAGS_ON_SLEEP, NULL); if (unin_hwclock)
pmf_do_functions(unin_hwclock, NULL, 0,
PMF_FLAGS_ON_SLEEP, NULL);
}
void pmac_pfunc_base_resume(void)
{ int i;
if (unin_hwclock)
pmf_do_functions(unin_hwclock, NULL, 0,
PMF_FLAGS_ON_WAKE, NULL); if (uninorth_node)
pmf_do_functions(uninorth_node, NULL, 0,
PMF_FLAGS_ON_WAKE, NULL); for (i = 0 ; i < MAX_MACIO_CHIPS; i++) { if (macio_chips[i].of_node)
pmf_do_functions(macio_chips[i].of_node, NULL, 0,
PMF_FLAGS_ON_WAKE, NULL);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.