diff options
author | Sundar Raman | 2013-07-18 17:40:57 -0500 |
---|---|---|
committer | Sundar Raman | 2013-07-25 14:38:16 -0500 |
commit | 0ce75959352b4cc7ca4779b7706aa4590fc0d39b (patch) | |
tree | f9d78381bc6add7b18d41896a151e6e1275cfed6 | |
parent | 7bd9e88c2642b5aff268046eafc12b2c6f4e20d9 (diff) | |
download | kernel-video-0ce75959352b4cc7ca4779b7706aa4590fc0d39b.tar.gz kernel-video-0ce75959352b4cc7ca4779b7706aa4590fc0d39b.tar.xz kernel-video-0ce75959352b4cc7ca4779b7706aa4590fc0d39b.zip |
gc320: Adapt GC320 driver for K3.8
Modified SOC checks and a few other minor changes.
Change-Id: I426c2f017bea0384c7602dd50c0b558329d79b1a
Signed-off-by: Sundar Raman <a0393242@ti.com>
-rw-r--r-- | drivers/misc/gcx/gcbv/gcmain.c | 8 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcmain.c | 58 | ||||
-rw-r--r-- | drivers/misc/gcx/gcioctl/gcif.c | 8 | ||||
-rw-r--r-- | include/linux/gccore.h | 4 |
4 files changed, 50 insertions, 28 deletions
diff --git a/drivers/misc/gcx/gcbv/gcmain.c b/drivers/misc/gcx/gcbv/gcmain.c index aa8be6601ba..c9d7e8feb96 100644 --- a/drivers/misc/gcx/gcbv/gcmain.c +++ b/drivers/misc/gcx/gcbv/gcmain.c | |||
@@ -13,9 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "gcbv.h" | 15 | #include "gcbv.h" |
16 | #include <plat/cpu.h> | ||
17 | #include <plat/omap_hwmod.h> | ||
18 | |||
19 | 16 | ||
20 | /******************************************************************************* | 17 | /******************************************************************************* |
21 | * BLTsville interface exposure. | 18 | * BLTsville interface exposure. |
@@ -244,9 +241,10 @@ static int __init mod_init(void) | |||
244 | { | 241 | { |
245 | bv_init(); | 242 | bv_init(); |
246 | 243 | ||
247 | /* Assign BV function parameters only if SoC contains a GC core */ | 244 | if (gc_is_hw_present()) |
248 | if (cpu_is_omap447x()) | ||
249 | gcbv_assign(); | 245 | gcbv_assign(); |
246 | else | ||
247 | GCERR("gcx hardware is not present\n"); | ||
250 | 248 | ||
251 | return 0; | 249 | return 0; |
252 | } | 250 | } |
diff --git a/drivers/misc/gcx/gccore/gcmain.c b/drivers/misc/gcx/gccore/gcmain.c index 26939ed0e0d..2cc723451ab 100644 --- a/drivers/misc/gcx/gccore/gcmain.c +++ b/drivers/misc/gcx/gccore/gcmain.c | |||
@@ -17,13 +17,13 @@ | |||
17 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
18 | #include <linux/pm_runtime.h> | 18 | #include <linux/pm_runtime.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <plat/omap_gcx.h> | ||
21 | #include <linux/opp.h> | 20 | #include <linux/opp.h> |
22 | #include <linux/io.h> | 21 | #include <linux/io.h> |
23 | #include <plat/omap_hwmod.h> | 22 | #include <linux/platform_data/omap_gcx.h> |
24 | #include <plat/omap-pm.h> | ||
25 | #include "gcmain.h" | 23 | #include "gcmain.h" |
26 | 24 | ||
25 | |||
26 | |||
27 | #define GCZONE_NONE 0 | 27 | #define GCZONE_NONE 0 |
28 | #define GCZONE_ALL (~0U) | 28 | #define GCZONE_ALL (~0U) |
29 | #define GCZONE_INIT (1 << 0) | 29 | #define GCZONE_INIT (1 << 0) |
@@ -188,11 +188,12 @@ void gc_write_reg(unsigned int address, unsigned int data) | |||
188 | 188 | ||
189 | static void gcpwr_enable_clock(struct gccorecontext *gccorecontext) | 189 | static void gcpwr_enable_clock(struct gccorecontext *gccorecontext) |
190 | { | 190 | { |
191 | bool ctxlost; | 191 | int ctxlost; |
192 | 192 | ||
193 | GCENTER(GCZONE_POWER); | 193 | GCENTER(GCZONE_POWER); |
194 | 194 | ||
195 | ctxlost = gccorecontext->plat->get_context_loss_count(gccorecontext->device); | 195 | ctxlost = gccorecontext->plat->get_context_loss_count(gccorecontext->device); |
196 | GCDBG(GCZONE_POWER, "lost count = %d\n", ctxlost); | ||
196 | 197 | ||
197 | if (!gccorecontext->clockenabled) { | 198 | if (!gccorecontext->clockenabled) { |
198 | /* Enable the clock. */ | 199 | /* Enable the clock. */ |
@@ -217,6 +218,7 @@ static void gcpwr_enable_clock(struct gccorecontext *gccorecontext) | |||
217 | if (ctxlost || (gccorecontext->gcpower == GCPWR_UNKNOWN)) | 218 | if (ctxlost || (gccorecontext->gcpower == GCPWR_UNKNOWN)) |
218 | gcpwr_reset(gccorecontext); | 219 | gcpwr_reset(gccorecontext); |
219 | 220 | ||
221 | |||
220 | GCEXIT(GCZONE_POWER); | 222 | GCEXIT(GCZONE_POWER); |
221 | } | 223 | } |
222 | 224 | ||
@@ -235,6 +237,9 @@ static void gcpwr_disable_clock(struct gccorecontext *gccorecontext) | |||
235 | 237 | ||
236 | /* Clock disabled. */ | 238 | /* Clock disabled. */ |
237 | gccorecontext->clockenabled = false; | 239 | gccorecontext->clockenabled = false; |
240 | |||
241 | /* Reset the current pipe. */ | ||
242 | gccorecontext->gcpipe = GCPWR_UNKNOWN; | ||
238 | } | 243 | } |
239 | 244 | ||
240 | GCDBG(GCZONE_POWER, "clock %s.\n", | 245 | GCDBG(GCZONE_POWER, "clock %s.\n", |
@@ -249,6 +254,9 @@ static void gcpwr_scale(struct gccorecontext *gccorecontext, int index) | |||
249 | 254 | ||
250 | GCENTERARG(GCZONE_FREQSCALE, "index=%d\n", index); | 255 | GCENTERARG(GCZONE_FREQSCALE, "index=%d\n", index); |
251 | 256 | ||
257 | if (gccorecontext->opp_count == 0) | ||
258 | goto exit; | ||
259 | |||
252 | if ((index < 0) || (index >= gccorecontext->opp_count)) { | 260 | if ((index < 0) || (index >= gccorecontext->opp_count)) { |
253 | GCERR("invalid index %d.\n", index); | 261 | GCERR("invalid index %d.\n", index); |
254 | goto exit; | 262 | goto exit; |
@@ -260,6 +268,7 @@ static void gcpwr_scale(struct gccorecontext *gccorecontext, int index) | |||
260 | goto exit; | 268 | goto exit; |
261 | } | 269 | } |
262 | 270 | ||
271 | |||
263 | if (gccorecontext->cur_freq == gccorecontext->opp_freqs[index]) | 272 | if (gccorecontext->cur_freq == gccorecontext->opp_freqs[index]) |
264 | goto exit; | 273 | goto exit; |
265 | 274 | ||
@@ -493,6 +502,13 @@ unsigned int gcpwr_get_speed(void) | |||
493 | * Public API. | 502 | * Public API. |
494 | */ | 503 | */ |
495 | 504 | ||
505 | bool gc_is_hw_present(void) | ||
506 | { | ||
507 | struct gccorecontext *gccorecontext = &g_context; | ||
508 | return gccorecontext->plat->is_hw_present; | ||
509 | } | ||
510 | |||
511 | |||
496 | void gc_caps(struct gcicaps *gcicaps) | 512 | void gc_caps(struct gcicaps *gcicaps) |
497 | { | 513 | { |
498 | struct gccorecontext *gccorecontext = &g_context; | 514 | struct gccorecontext *gccorecontext = &g_context; |
@@ -871,22 +887,30 @@ done: | |||
871 | static int gc_probe(struct platform_device *pdev) | 887 | static int gc_probe(struct platform_device *pdev) |
872 | { | 888 | { |
873 | struct gccorecontext *gccorecontext = &g_context; | 889 | struct gccorecontext *gccorecontext = &g_context; |
890 | int ret; | ||
874 | 891 | ||
875 | GCENTER(GCZONE_PROBE); | 892 | GCENTER(GCZONE_PROBE); |
876 | 893 | ||
877 | gccorecontext->bb2ddevice = &pdev->dev; | 894 | gccorecontext->bb2ddevice = &pdev->dev; |
878 | gccorecontext->plat = (struct omap_gcx_platform_data *) | 895 | gccorecontext->plat = (struct omap_gcx_platform_data *) |
879 | pdev->dev.platform_data; | 896 | pdev->dev.platform_data; |
897 | |||
898 | if (!gccorecontext->plat->is_hw_present) { | ||
899 | GCERR("gc_probe failed. gcx hardware is not present\n"); | ||
900 | return -ENODEV; | ||
901 | } | ||
902 | |||
880 | gccorecontext->regbase = gccorecontext->plat->regbase; | 903 | gccorecontext->regbase = gccorecontext->plat->regbase; |
881 | gccorecontext->irqline = platform_get_irq(pdev, pdev->id); | 904 | gccorecontext->irqline = platform_get_irq(pdev, pdev->id); |
882 | gccorecontext->device = &pdev->dev; | 905 | gccorecontext->device = &pdev->dev; |
883 | 906 | ||
907 | |||
884 | pm_runtime_enable(gccorecontext->device); | 908 | pm_runtime_enable(gccorecontext->device); |
885 | gccorecontext->plat->get_context_loss_count(gccorecontext->device); | 909 | gccorecontext->plat->get_context_loss_count(gccorecontext->device); |
886 | 910 | ||
887 | gc_probe_opp(pdev); | 911 | gc_probe_opp(pdev); |
888 | 912 | ||
889 | pm_runtime_get_sync(gccorecontext->device); | 913 | ret = pm_runtime_get_sync(gccorecontext->device); |
890 | 914 | ||
891 | gccorecontext->gcmodel = gc_read_reg(GC_CHIP_ID_Address); | 915 | gccorecontext->gcmodel = gc_read_reg(GC_CHIP_ID_Address); |
892 | gccorecontext->gcrevision = gc_read_reg(GC_CHIP_REV_Address); | 916 | gccorecontext->gcrevision = gc_read_reg(GC_CHIP_REV_Address); |
@@ -987,12 +1011,6 @@ static int gc_init(struct gccorecontext *gccorecontext) | |||
987 | 1011 | ||
988 | GCENTER(GCZONE_INIT); | 1012 | GCENTER(GCZONE_INIT); |
989 | 1013 | ||
990 | /* check if hardware is available */ | ||
991 | if (!cpu_is_omap447x()) { | ||
992 | GCDBG(GCZONE_INIT, "gcx hardware is not present\n"); | ||
993 | goto exit; | ||
994 | } | ||
995 | |||
996 | /* Initialize data structutres. */ | 1014 | /* Initialize data structutres. */ |
997 | GCLOCK_INIT(&gccorecontext->powerlock); | 1015 | GCLOCK_INIT(&gccorecontext->powerlock); |
998 | GCLOCK_INIT(&gccorecontext->resetlock); | 1016 | GCLOCK_INIT(&gccorecontext->resetlock); |
@@ -1003,13 +1021,6 @@ static int gc_init(struct gccorecontext *gccorecontext) | |||
1003 | /* Pulse skipping isn't known. */ | 1021 | /* Pulse skipping isn't known. */ |
1004 | gccorecontext->pulseskipping = -1; | 1022 | gccorecontext->pulseskipping = -1; |
1005 | 1023 | ||
1006 | /* Initialize MMU. */ | ||
1007 | if (gcmmu_init(gccorecontext) != GCERR_NONE) { | ||
1008 | GCERR("failed to initialize MMU.\n"); | ||
1009 | result = -EINVAL; | ||
1010 | goto fail; | ||
1011 | } | ||
1012 | |||
1013 | result = platform_driver_register(&plat_drv); | 1024 | result = platform_driver_register(&plat_drv); |
1014 | if (result < 0) { | 1025 | if (result < 0) { |
1015 | GCERR("failed to register platform driver.\n"); | 1026 | GCERR("failed to register platform driver.\n"); |
@@ -1017,6 +1028,13 @@ static int gc_init(struct gccorecontext *gccorecontext) | |||
1017 | } | 1028 | } |
1018 | gccorecontext->platdriver = true; | 1029 | gccorecontext->platdriver = true; |
1019 | 1030 | ||
1031 | /* Initialize MMU. */ | ||
1032 | if (gcmmu_init(gccorecontext) != GCERR_NONE) { | ||
1033 | GCERR("failed to initialize MMU.\n"); | ||
1034 | result = -EINVAL; | ||
1035 | goto fail; | ||
1036 | } | ||
1037 | |||
1020 | #if CONFIG_HAS_EARLYSUSPEND | 1038 | #if CONFIG_HAS_EARLYSUSPEND |
1021 | register_early_suspend(&early_suspend_info); | 1039 | register_early_suspend(&early_suspend_info); |
1022 | #endif | 1040 | #endif |
@@ -1031,7 +1049,6 @@ static int gc_init(struct gccorecontext *gccorecontext) | |||
1031 | /* Create debugfs entry. */ | 1049 | /* Create debugfs entry. */ |
1032 | gc_debug_init(); | 1050 | gc_debug_init(); |
1033 | 1051 | ||
1034 | exit: | ||
1035 | GCEXIT(GCZONE_INIT); | 1052 | GCEXIT(GCZONE_INIT); |
1036 | return 0; | 1053 | return 0; |
1037 | 1054 | ||
@@ -1046,7 +1063,7 @@ static void gc_exit(struct gccorecontext *gccorecontext) | |||
1046 | { | 1063 | { |
1047 | GCENTER(GCZONE_INIT); | 1064 | GCENTER(GCZONE_INIT); |
1048 | 1065 | ||
1049 | if (cpu_is_omap447x()) { | 1066 | if (gc_is_hw_present()) { |
1050 | /* Stop command queue thread. */ | 1067 | /* Stop command queue thread. */ |
1051 | gcqueue_stop(gccorecontext); | 1068 | gcqueue_stop(gccorecontext); |
1052 | 1069 | ||
@@ -1094,6 +1111,7 @@ static void __exit gc_exit_wrapper(void) | |||
1094 | GCDBG_EXIT(); | 1111 | GCDBG_EXIT(); |
1095 | } | 1112 | } |
1096 | 1113 | ||
1114 | |||
1097 | MODULE_LICENSE("GPL v2"); | 1115 | MODULE_LICENSE("GPL v2"); |
1098 | MODULE_AUTHOR("www.vivantecorp.com"); | 1116 | MODULE_AUTHOR("www.vivantecorp.com"); |
1099 | MODULE_AUTHOR("www.ti.com"); | 1117 | MODULE_AUTHOR("www.ti.com"); |
diff --git a/drivers/misc/gcx/gcioctl/gcif.c b/drivers/misc/gcx/gcioctl/gcif.c index 262522c5084..267ada8bab8 100644 --- a/drivers/misc/gcx/gcioctl/gcif.c +++ b/drivers/misc/gcx/gcioctl/gcif.c | |||
@@ -945,10 +945,12 @@ static struct device *dev_object; | |||
945 | 945 | ||
946 | static int dev_open(struct inode *inode, struct file *file) | 946 | static int dev_open(struct inode *inode, struct file *file) |
947 | { | 947 | { |
948 | if (cpu_is_omap447x()) | 948 | if (gc_is_hw_present()) { |
949 | return 0; | 949 | return 0; |
950 | else | 950 | } else { |
951 | return -1; | 951 | GCERR("gcx hardware is not present\n"); |
952 | return -ENODEV; | ||
953 | } | ||
952 | } | 954 | } |
953 | 955 | ||
954 | static int dev_release(struct inode *inode, struct file *file) | 956 | static int dev_release(struct inode *inode, struct file *file) |
diff --git a/include/linux/gccore.h b/include/linux/gccore.h index ce9ed4fb75e..ae64f2f75c6 100644 --- a/include/linux/gccore.h +++ b/include/linux/gccore.h | |||
@@ -18,6 +18,10 @@ | |||
18 | #include "sched.h" | 18 | #include "sched.h" |
19 | #include "gcioctl.h" | 19 | #include "gcioctl.h" |
20 | 20 | ||
21 | |||
22 | /* Hw availability query */ | ||
23 | bool gc_is_hw_present(void); | ||
24 | |||
21 | /* Capability query. */ | 25 | /* Capability query. */ |
22 | void gc_caps(struct gcicaps *gcicaps); | 26 | void gc_caps(struct gcicaps *gcicaps); |
23 | 27 | ||