From 37a1f24287385ce9faff203416713d2efbf93757 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut+renesas@gmail.com>
Date: Fri, 14 Jun 2019 00:51:47 +0200
Subject: [PATCH] rcar_gen3: drivers: qos: D3: Make DBSC settings local to
 dbsc_setting()

Move the DBSC write enabling and disabling to dbsc_setting() function,
to make it local, instead of having it all over the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Change-Id: If8e5657c3230b5d82b551cb89b11c4d13a2d096b
---
 drivers/staging/renesas/rcar/qos/D3/qos_init_d3.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/renesas/rcar/qos/D3/qos_init_d3.c b/drivers/staging/renesas/rcar/qos/D3/qos_init_d3.c
index 258abfc0e..b58b7c437 100644
--- a/drivers/staging/renesas/rcar/qos/D3/qos_init_d3.c
+++ b/drivers/staging/renesas/rcar/qos/D3/qos_init_d3.c
@@ -20,6 +20,9 @@ static void dbsc_setting(void)
 {
 	uint32_t md=0;
 
+	/* Register write enable */
+	io_write_32(DBSC_DBSYSCNT0, 0x00001234U);
+
 	/* BUFCAM settings */
 	io_write_32(DBSC_DBCAM0CNF1, 0x00043218);
 	io_write_32(DBSC_DBCAM0CNF2, 0x000000F4);
@@ -65,12 +68,13 @@ static void dbsc_setting(void)
 	io_write_32(DBSC_DBSCHQOS151, 0x00000030);
 	io_write_32(DBSC_DBSCHQOS152, 0x00000020);
 	io_write_32(DBSC_DBSCHQOS153, 0x00000010);
+
+	/* Register write protect */
+	io_write_32(DBSC_DBSYSCNT0, 0x00000000U);
 }
 
 void qos_init_d3(void)
 {
-	io_write_32(DBSC_DBSYSCNT0, 0x00001234);
-
 	dbsc_setting();
 
 	/* DRAM Split Address mapping */
@@ -159,5 +163,4 @@ void qos_init_d3(void)
 	/* Resource Alloc start */
 	io_write_32(QOSCTRL_RAEN,  0x00000001U);
 #endif /* !(RCAR_QOS_TYPE == RCAR_QOS_NONE) */
-	io_write_32(DBSC_DBSYSCNT0, 0x00000000);
 }
-- 
GitLab