msm: msm_bus: Introduce support for RPMH

Introducing new iteration of Qcom msm_bus driver by adding functionality
that translates existing vector bandwidth requests into commands for
Qualcomm specific hardware accelerators known as BCMs. Add new BCM device
handling and dt parsing of BCM specific properties. Add init handoff
bandwidth request and late init functionalities.

Change-Id: I7da2b74f3fa2b191e28e2c3c8e1f10b6489e83bc
Signed-off-by: David Dai <daidavid1@codeaurora.org>
diff --git a/include/linux/msm_bus_rules.h b/include/linux/msm_bus_rules.h
new file mode 100644
index 0000000..1cc83fa
--- /dev/null
+++ b/include/linux/msm_bus_rules.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _ARCH_ARM_MACH_MSM_BUS_RULES_H
+#define _ARCH_ARM_MACH_MSM_BUS_RULES_H
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/notifier.h>
+#include <dt-bindings/msm/msm-bus-rule-ops.h>
+
+#define MAX_NODES		(5)
+
+struct rule_update_path_info {
+	u32 id;
+	u64 ab;
+	u64 ib;
+	u64 clk;
+	bool added;
+	struct list_head link;
+};
+
+struct rule_apply_rcm_info {
+	u32 id;
+	u64 lim_bw;
+	int throttle;
+	bool after_clk_commit;
+	struct list_head link;
+};
+
+struct bus_rule_type {
+	int num_src;
+	int *src_id;
+	int src_field;
+	int op;
+	u64 thresh;
+	int num_dst;
+	int *dst_node;
+	u64 dst_bw;
+	int mode;
+	void *client_data;
+};
+
+void msm_rule_register(int num_rules, struct bus_rule_type *rule,
+				struct notifier_block *nb);
+void msm_rule_unregister(int num_rules, struct bus_rule_type *rule,
+						struct notifier_block *nb);
+bool msm_rule_update(struct bus_rule_type *old_rule,
+				struct bus_rule_type *new_rule,
+				struct notifier_block *nb);
+void msm_rule_evaluate_rules(int node);
+void print_rules_buf(char *buf, int count);
+bool msm_rule_are_rules_registered(void);
+#endif /* _ARCH_ARM_MACH_MSM_BUS_RULES_H */