drivers: soc: Update the max capacity programming

LLCC has four instances, the total size of the memory is divided equally
among these four instances. SW uses broadcast registers to program the
LLCC, meaning if SW writes to broadcast register the value reflects in
all the llcc instances. So when max capacity for a client is programmed
we need to divide it by four, otherwise the max capacity for a client
will exceed the max capacity of LLCC.

Change-Id: Ifbc6b712689bb70d3b35c7d88cc72fbb3eb25d37
Signed-off-by: Channagoud Kadabi <ckadabi@codeaurora.org>
diff --git a/drivers/soc/qcom/llcc-slice.c b/drivers/soc/qcom/llcc-slice.c
index c8b4ca6..3a9c7aa 100644
--- a/drivers/soc/qcom/llcc-slice.c
+++ b/drivers/soc/qcom/llcc-slice.c
@@ -43,6 +43,7 @@
 #define LLCC_STATUS_READ_DELAY 100
 
 #define CACHE_LINE_SIZE_SHIFT 6
+#define SIZE_PER_LLCC_SHIFT   2
 #define MAX_CAP_TO_BYTES(n) (n * 1024)
 #define LLCC_TRP_ACT_CTRLn(n) (n * 0x1000)
 #define LLCC_TRP_STATUSn(n)   (4 + n * 0x1000)
@@ -344,7 +345,12 @@
 
 		max_cap_cacheline = MAX_CAP_TO_BYTES(llcc_table[i].max_cap);
 		max_cap_cacheline >>= CACHE_LINE_SIZE_SHIFT;
-
+		/* There are four llcc instances llcc0..llcc3. The SW writes to
+		 * to broadcast register which gets propagated to each llcc.
+		 * Since the size of the memory is divided equally amongst the
+		 * four llcc, we need to divide the max cap by 4
+		 */
+		max_cap_cacheline >>= SIZE_PER_LLCC_SHIFT;
 		attr1_val |= (max_cap_cacheline << ATTR1_MAX_CAP_SHIFT);
 
 		attr0_val = llcc_table[i].res_ways & ATTR0_RES_WAYS_MASK;