2009-06-17 14:30:22 +08:00
|
|
|
/**
|
|
|
|
* mpc5xxx_get_bus_frequency - Find the bus frequency for a device
|
|
|
|
* @node: device node
|
|
|
|
*
|
|
|
|
* Returns bus frequency (IPS on MPC512x, IPB on MPC52xx),
|
|
|
|
* or 0 if the bus frequency cannot be found.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/of_platform.h>
|
2011-05-27 22:46:24 +08:00
|
|
|
#include <linux/export.h>
|
2013-02-01 23:23:39 +08:00
|
|
|
#include <asm/mpc5xxx.h>
|
2009-06-17 14:30:22 +08:00
|
|
|
|
2013-02-01 23:23:39 +08:00
|
|
|
unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
|
2009-06-17 14:30:22 +08:00
|
|
|
{
|
|
|
|
const unsigned int *p_bus_freq = NULL;
|
|
|
|
|
|
|
|
of_node_get(node);
|
|
|
|
while (node) {
|
|
|
|
p_bus_freq = of_get_property(node, "bus-frequency", NULL);
|
|
|
|
if (p_bus_freq)
|
|
|
|
break;
|
|
|
|
|
2015-10-12 04:27:40 +08:00
|
|
|
node = of_get_next_parent(node);
|
2009-06-17 14:30:22 +08:00
|
|
|
}
|
2014-08-08 18:07:46 +08:00
|
|
|
of_node_put(node);
|
2009-06-17 14:30:22 +08:00
|
|
|
|
|
|
|
return p_bus_freq ? *p_bus_freq : 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(mpc5xxx_get_bus_frequency);
|