summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0074-MOST-dim2-add-R-Car3-related-initialization.patch
blob: 572da2a878f76ec24a1ec63ddc6215e5aba18218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 41d15fa6003b65080f05d271bf495104013754f9 Mon Sep 17 00:00:00 2001
From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Date: Fri, 7 Jul 2017 20:43:33 +0300
Subject: [PATCH 112/114] MOST: dim2: add R-Car3 related initialization

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
 drivers/staging/most/hdm-dim2/dim2_hdm.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index f28f169180fe..c1beabc28fa8 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -26,6 +26,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/sched.h>
 #include <linux/kthread.h>
+#include <linux/delay.h>
 
 #include <mostcore.h>
 #include <networking.h>
@@ -189,6 +191,26 @@ static int dim_parce_speed(const char *clock_speed)
 	return -1;
 }
 
+static int dim_rcar_init(struct dim2_hdm *dev)
+{
+        /* PLL */
+	__raw_writel(0x04, dev->io_base + 0x600);
+
+	/* 512FS Enable Register */
+	if (dev->clk_speed == CLK_512FS)
+		__raw_writel(0x01, dev->io_base + 0x604);
+	else
+		__raw_writel(0x00, dev->io_base + 0x604);
+
+	udelay(200);
+
+	/* BBCR  = 0b11 */
+	__raw_writel(0x03, dev->io_base + 0x500);
+	__raw_writel(0x0002FF02, dev->io_base + 0x508);
+
+	return 0;
+}
+
 /**
  * startup_dim - initialize the dim2 interface
  * @pdev: platform device
@@ -216,6 +238,10 @@ static int startup_dim(struct platform_device *pdev)
 			return ret;
 	}
 
+	if (1 /* renesas */) {
+		dim_rcar_init(dev);
+	}
+
 	pr_info("sync: num of frames per sub-buffer: %u\n", fcnt);
 	hal_ret = dim_startup(dev->io_base, dev->clk_speed, fcnt);
 	if (hal_ret != DIM_NO_ERROR) {
-- 
2.13.0