[v5,5/7] vas: Create device tree node

Submitted by Sukadev Bhattiprolu on Jan. 26, 2017, 1:32 a.m.

Details

Message ID 1485394353-30319-6-git-send-email-sukadev@linux.vnet.ibm.com
State New
Headers show

Commit Message

Sukadev Bhattiprolu Jan. 26, 2017, 1:32 a.m.
Create a device tree node for VAS and add properties that Linux
will need to configure/use VAS.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
 core/vas.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Patch hide | download patch | download mbox

diff --git a/core/vas.c b/core/vas.c
index 6d475f9..688fa0f 100644
--- a/core/vas.c
+++ b/core/vas.c
@@ -256,6 +256,34 @@  static inline uint64_t get_window_base_addr(struct proc_chip *chip)
 	return val;
 }
 
+static void create_dt_node(struct proc_chip *chip)
+{
+	struct dt_node *dn;
+	uint64_t x;
+
+	x = get_window_base_addr(chip);
+	dn = dt_new_addr(chip->devnode, "vas", x);
+
+	dt_add_property(dn, "window-base", &x, sizeof(x));
+
+	x = RMA_LSMP_WINID_SHIFT;
+	dt_add_property(dn, "window-shift", &x, sizeof(x));
+
+	x = get_hvwc_mmio_bar(chip->id);
+	dt_add_property(dn, "hvwc-bar-start", &x, sizeof(x));
+
+	x = VAS_HVWC_MMIO_BAR_SIZE;
+	dt_add_property(dn, "hvwc-bar-size", &x, sizeof(x));
+
+	x = get_uwc_mmio_bar(chip->id);
+	dt_add_property(dn, "uwc-bar-start", &x, sizeof(x));
+
+	x = VAS_UWC_MMIO_BAR_SIZE;
+	dt_add_property(dn, "uwc-bar-size", &x, sizeof(x));
+
+	dt_add_property(dn, "vas-id", &chip->vas_id, sizeof(chip->vas_id));
+}
+
 /*
  * Initialize VAS on one chip
  */
@@ -275,6 +303,8 @@  static int init_one_chip(struct proc_chip *chip)
 	if (init_rma(chip))
 		goto out;
 
+	create_dt_node(chip);
+
 	prlog(PR_INFO, "VAS: Initialized chip %d\n", chip->id);
 	return 0;