/* This code first checks the new way, and then the old way.  */
static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l)
/* This code first checks the new way, and then the old way.  */
static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l)
{
	struct device_node *np;
	const char *soc_string;
	unsigned int svr;
	unsigned int soc;
	np = of_find_node_by_type(NULL, "cpu");
	if (!np)
		return 0;
	soc_string = of_get_property(np, "compatible", NULL);
	if (!soc_string)
		soc_string = np->name;
	if ((sscanf(soc_string, "PowerPC,%u", &soc) != 1) || !soc)
		return 0;
	svr = mfspr(SPRN_SVR);
	*rev_h = (svr >> 4) & 0xf;
	*rev_l = svr & 0xf;
	return soc;
}