summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/powervr-drivers/omap3-sgx-modules-5.01.01.01/0002-SGX-linux-use-platform-data-to-provide-reset-info.patch
blob: 5a8d1f1e84f2a0400a9f27b669c901cdcb626f9f (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From 7886ef77e4b48a7edd14acbcbe48f6a898251e78 Mon Sep 17 00:00:00 2001
From: Darren Etheridge <detheridge@ti.com>
Date: Fri, 25 Jul 2014 16:03:14 -0500
Subject: [PATCH 2/5] SGX: linux: use platform data to provide reset info

In ti-linux-3.14.y we will not have a reset driver unlike ti-linux-3.12.y
so this commit removes the dependency on the reset driver and instead
uses the platform data that in a dt environment is configured in
mach-omap2/pdata-quirks.c

Signed-off-by: Darren Etheridge <detheridge@ti.com>
---
 GFX_Linux_KM/services4/srvkm/env/linux/module.c | 34 ++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/module.c b/GFX_Linux_KM/services4/srvkm/env/linux/module.c
index e03dc00..90e16ce 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/module.c
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/module.c
@@ -47,6 +47,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 #endif
 
+#ifndef CONFIG_RESET_CONTROLLER
+#include <linux/platform_data/sgx-omap.h>
+#endif
+
 #if defined(SUPPORT_DRI_DRM) && !defined(SUPPORT_DRI_DRM_PLUGIN)
 #define	PVR_MOD_STATIC
 #else
@@ -344,9 +348,11 @@ static LDM_DRV powervr_driver = {
 LDM_DEV *gpsPVRLDMDev;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
+#ifdef CONFIG_RESET_CONTROLLER
 struct reset_control *rstc;
 bool already_deasserted = false;
 #endif
+#endif
 
 #if defined(MODULE) && defined(PVR_LDM_PLATFORM_MODULE) && \
 	!defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
@@ -388,11 +394,14 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device
 #endif
 {
 	SYS_DATA *psSysData;
-	int ret;	
+	int ret;
+	struct device *dev = &pDevice->dev;
+	struct gfx_sgx_platform_data *pdata = dev->platform_data;
+
 	PVR_TRACE(("PVRSRVDriverProbe(pDevice=%p)", pDevice));
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
+#ifdef CONFIG_RESET_CONTROLLER
 	rstc = reset_control_get(&pDevice->dev, NULL);
-
 	if (IS_ERR(rstc)) 
 	{
 		dev_err(&pDevice->dev, "%s: error: reset_control_get\n", __func__);
@@ -403,7 +412,7 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device
 
 	if (ret < 0)
 	{
-		dev_err(&pDevice->dev, "%s: error: reset_control_clear_reset\n", __func__);
+		dev_err(dev, "%s: error: reset_control_clear_reset\n", __func__);
 		return ret;
 	}
 
@@ -413,11 +422,22 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device
 	{
 		already_deasserted = true;
 	}
-	else if (ret < 0) 
+	else if (ret < 0)
 	{
-		dev_err(&pDevice->dev, "%s: error: reset_control_deassert\n", __func__);
+		dev_err(dev, "%s: error: reset_control_deassert\n", __func__);
 		return ret;
 	}
+#else
+	if (pdata && pdata->deassert_reset) {
+		ret = pdata->deassert_reset(pDevice, pdata->reset_name);
+		if (ret) {
+			dev_err(dev, "Unable to reset SGX!\n");
+		}
+	} else {
+		dev_err(dev, "SGX Platform data missing deassert_reset!\n");
+		return -ENODEV;
+	}
+#endif  /* CONFIG_RESET_CONTROLLER */
 #endif
 
 #if 0   /* INTEGRATION_POINT */
@@ -432,7 +452,7 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device
 	{
 		return -EINVAL;
 	}
-#endif	
+#endif
 	/* SysInitialise only designed to be called once.
 	 */
 	psSysData = SysAcquireDataNoCheck();
@@ -445,6 +465,7 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device
 		}
 	}
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
+#ifdef CONFIG_RESET_CONTROLLER
         if (!already_deasserted)
         {
                 ret = reset_control_is_reset(rstc);
@@ -454,6 +475,7 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device
                 }
         }
         reset_control_put(rstc);
+#endif /* CONFIG_RESET_CONTROLLER */
 #endif
 
 	return PVRSRVIONClientCreate();
-- 
1.9.1