[v4,2/5] hdat: Add 'primary' property to master chip xscom node

Message ID 20170418085332.9558-3-hegdevasant@linux.vnet.ibm.com
State New
Headers show

Commit Message

Vasant Hegde April 18, 2017, 8:53 a.m.
Needed for SBE communication as some of the SBE MBOX commands
has to be sent to master chip SBE only.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hdata/spira.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Patch

diff --git a/hdata/spira.c b/hdata/spira.c
index 3340a09..a7689cb 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -401,6 +401,20 @@  static void add_xscom_add_pcia_assoc(struct dt_node *np, uint32_t pcid)
 	}
 }
 
+static void add_xscom_primary_property(const struct HDIF_common_hdr *hdif,
+				       struct dt_node *xscom)
+{
+	uint32_t size = 0;
+	const void *pnor;
+
+	pnor = HDIF_get_idata(hdif, SPPCRD_IDATA_PNOR_INFO, &size);
+	/* PNOR is attached to master chip only */
+	if (pnor && size != 0) {
+		dt_add_property(xscom, "primary", NULL, 0);
+		prlog(PR_DEBUG, "XSCOM: Found primary chip ID\n");
+	}
+}
+
 static bool add_xscom_sppcrd(uint64_t xscom_base)
 {
 	const struct HDIF_common_hdr *hdif;
@@ -471,6 +485,7 @@  static bool add_xscom_sppcrd(uint64_t xscom_base)
 		if (proc_gen >= proc_gen_p9) {
 			add_xive_node(np);
 			parse_i2c_devs(hdif, SPPCRD_IDATA_HOST_I2C, np);
+			add_xscom_primary_property(hdif, np);
 		}
 	}