Path: blob/master/arch/powerpc/platforms/wsp/setup.c
10818 views
/*1* Copyright 2010 Michael Ellerman, IBM Corporation2*3* This program is free software; you can redistribute it and/or4* modify it under the terms of the GNU General Public License5* as published by the Free Software Foundation; either version6* 2 of the License, or (at your option) any later version.7*/89#include <linux/kernel.h>10#include <linux/of_platform.h>1112#include "wsp.h"1314/*15* Find chip-id by walking up device tree looking for ibm,wsp-chip-id property.16* Won't work for nodes that are not a descendant of a wsp node.17*/18int wsp_get_chip_id(struct device_node *dn)19{20const u32 *p;21int rc;2223/* Start looking at the specified node, not its parent */24dn = of_node_get(dn);25while (dn && !(p = of_get_property(dn, "ibm,wsp-chip-id", NULL)))26dn = of_get_next_parent(dn);2728if (!dn)29return -1;3031rc = *p;32of_node_put(dn);3334return rc;35}363738