diff options
34 files changed, 499 insertions, 288 deletions
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c index 5cfade235bb4..6f58cad5bf74 100644 --- a/arch/arm/mach-omap2/board-omap3logic.c +++ b/arch/arm/mach-omap2/board-omap3logic.c | |||
@@ -34,9 +34,6 @@ | |||
34 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
35 | #include <asm/mach/map.h> | 35 | #include <asm/mach/map.h> |
36 | 36 | ||
37 | #include "gpmc-smsc911x.h" | ||
38 | #include "gpmc.h" | ||
39 | #include <plat/sdrc.h> | ||
40 | #include <plat/usb.h> | 37 | #include <plat/usb.h> |
41 | 38 | ||
42 | #include "common.h" | 39 | #include "common.h" |
@@ -44,6 +41,8 @@ | |||
44 | #include "hsmmc.h" | 41 | #include "hsmmc.h" |
45 | #include "control.h" | 42 | #include "control.h" |
46 | #include "common-board-devices.h" | 43 | #include "common-board-devices.h" |
44 | #include "gpmc.h" | ||
45 | #include "gpmc-smsc911x.h" | ||
47 | 46 | ||
48 | #define OMAP3LOGIC_SMSC911X_CS 1 | 47 | #define OMAP3LOGIC_SMSC911X_CS 1 |
49 | 48 | ||
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c index 4ae439222085..35076592189e 100644 --- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c +++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c | |||
@@ -27,13 +27,13 @@ | |||
27 | 27 | ||
28 | #include <plat/clock.h> | 28 | #include <plat/clock.h> |
29 | #include <plat/sram.h> | 29 | #include <plat/sram.h> |
30 | #include <plat/sdrc.h> | ||
31 | 30 | ||
32 | #include "clock.h" | 31 | #include "clock.h" |
33 | #include "clock2xxx.h" | 32 | #include "clock2xxx.h" |
34 | #include "opp2xxx.h" | 33 | #include "opp2xxx.h" |
35 | #include "cm2xxx_3xxx.h" | 34 | #include "cm2xxx_3xxx.h" |
36 | #include "cm-regbits-24xx.h" | 35 | #include "cm-regbits-24xx.h" |
36 | #include "sdrc.h" | ||
37 | 37 | ||
38 | /* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ | 38 | /* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ |
39 | 39 | ||
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c index 3524f0e7b6d5..0cf63e7c6102 100644 --- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | |||
@@ -35,7 +35,6 @@ | |||
35 | 35 | ||
36 | #include <plat/clock.h> | 36 | #include <plat/clock.h> |
37 | #include <plat/sram.h> | 37 | #include <plat/sram.h> |
38 | #include <plat/sdrc.h> | ||
39 | 38 | ||
40 | #include "soc.h" | 39 | #include "soc.h" |
41 | #include "clock.h" | 40 | #include "clock.h" |
@@ -43,6 +42,7 @@ | |||
43 | #include "opp2xxx.h" | 42 | #include "opp2xxx.h" |
44 | #include "cm2xxx_3xxx.h" | 43 | #include "cm2xxx_3xxx.h" |
45 | #include "cm-regbits-24xx.h" | 44 | #include "cm-regbits-24xx.h" |
45 | #include "sdrc.h" | ||
46 | 46 | ||
47 | const struct prcm_config *curr_prcm_set; | 47 | const struct prcm_config *curr_prcm_set; |
48 | const struct prcm_config *rate_table; | 48 | const struct prcm_config *rate_table; |
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c index 7c6da2f731dc..aff6ca4fd3a4 100644 --- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c +++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include <plat/clock.h> | 24 | #include <plat/clock.h> |
25 | #include <plat/sram.h> | 25 | #include <plat/sram.h> |
26 | #include <plat/sdrc.h> | ||
27 | 26 | ||
28 | #include "clock.h" | 27 | #include "clock.h" |
29 | #include "clock3xxx.h" | 28 | #include "clock3xxx.h" |
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index d1ff8399a222..bf2be5c5468d 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP2/3 System Control Module register access | 2 | * OMAP2/3 System Control Module register access |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Texas Instruments, Inc. | 4 | * Copyright (C) 2007, 2012 Texas Instruments, Inc. |
5 | * Copyright (C) 2007 Nokia Corporation | 5 | * Copyright (C) 2007 Nokia Corporation |
6 | * | 6 | * |
7 | * Written by Paul Walmsley | 7 | * Written by Paul Walmsley |
@@ -15,8 +15,6 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | 17 | ||
18 | #include <plat/sdrc.h> | ||
19 | |||
20 | #include "soc.h" | 18 | #include "soc.h" |
21 | #include "iomap.h" | 19 | #include "iomap.h" |
22 | #include "common.h" | 20 | #include "common.h" |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 1011995f150a..28f508724a56 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -284,6 +284,35 @@ err: | |||
284 | return ERR_PTR(r); | 284 | return ERR_PTR(r); |
285 | } | 285 | } |
286 | 286 | ||
287 | static enum omapdss_version __init omap_display_get_version(void) | ||
288 | { | ||
289 | if (cpu_is_omap24xx()) | ||
290 | return OMAPDSS_VER_OMAP24xx; | ||
291 | else if (cpu_is_omap3630()) | ||
292 | return OMAPDSS_VER_OMAP3630; | ||
293 | else if (cpu_is_omap34xx()) { | ||
294 | if (soc_is_am35xx()) { | ||
295 | return OMAPDSS_VER_AM35xx; | ||
296 | } else { | ||
297 | if (omap_rev() < OMAP3430_REV_ES3_0) | ||
298 | return OMAPDSS_VER_OMAP34xx_ES1; | ||
299 | else | ||
300 | return OMAPDSS_VER_OMAP34xx_ES3; | ||
301 | } | ||
302 | } else if (omap_rev() == OMAP4430_REV_ES1_0) | ||
303 | return OMAPDSS_VER_OMAP4430_ES1; | ||
304 | else if (omap_rev() == OMAP4430_REV_ES2_0 || | ||
305 | omap_rev() == OMAP4430_REV_ES2_1 || | ||
306 | omap_rev() == OMAP4430_REV_ES2_2) | ||
307 | return OMAPDSS_VER_OMAP4430_ES2; | ||
308 | else if (cpu_is_omap44xx()) | ||
309 | return OMAPDSS_VER_OMAP4; | ||
310 | else if (soc_is_omap54xx()) | ||
311 | return OMAPDSS_VER_OMAP5; | ||
312 | else | ||
313 | return OMAPDSS_VER_UNKNOWN; | ||
314 | } | ||
315 | |||
287 | int __init omap_display_init(struct omap_dss_board_info *board_data) | 316 | int __init omap_display_init(struct omap_dss_board_info *board_data) |
288 | { | 317 | { |
289 | int r = 0; | 318 | int r = 0; |
@@ -291,9 +320,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
291 | int i, oh_count; | 320 | int i, oh_count; |
292 | const struct omap_dss_hwmod_data *curr_dss_hwmod; | 321 | const struct omap_dss_hwmod_data *curr_dss_hwmod; |
293 | struct platform_device *dss_pdev; | 322 | struct platform_device *dss_pdev; |
323 | enum omapdss_version ver; | ||
294 | 324 | ||
295 | /* create omapdss device */ | 325 | /* create omapdss device */ |
296 | 326 | ||
327 | ver = omap_display_get_version(); | ||
328 | |||
329 | if (ver == OMAPDSS_VER_UNKNOWN) { | ||
330 | pr_err("DSS not supported on this SoC\n"); | ||
331 | return -ENODEV; | ||
332 | } | ||
333 | |||
334 | board_data->version = ver; | ||
297 | board_data->dsi_enable_pads = omap_dsi_enable_pads; | 335 | board_data->dsi_enable_pads = omap_dsi_enable_pads; |
298 | board_data->dsi_disable_pads = omap_dsi_disable_pads; | 336 | board_data->dsi_disable_pads = omap_dsi_disable_pads; |
299 | board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; | 337 | board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index f14bd3f55218..9472541a4d8d 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
32 | 32 | ||
33 | #include <plat/cpu.h> | 33 | #include <plat/cpu.h> |
34 | #include <plat/sdrc.h> | ||
35 | #include <plat/omap_device.h> | 34 | #include <plat/omap_device.h> |
36 | 35 | ||
37 | #include "soc.h" | 36 | #include "soc.h" |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 42a4b9c08aaa..f71e51bfbe2a 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
27 | 27 | ||
28 | #include <plat/sram.h> | 28 | #include <plat/sram.h> |
29 | #include <plat/sdrc.h> | ||
30 | #include <plat/serial.h> | 29 | #include <plat/serial.h> |
31 | #include <plat/omap-pm.h> | 30 | #include <plat/omap-pm.h> |
32 | #include <plat/omap_hwmod.h> | 31 | #include <plat/omap_hwmod.h> |
@@ -43,6 +42,7 @@ | |||
43 | #include "clock2xxx.h" | 42 | #include "clock2xxx.h" |
44 | #include "clock3xxx.h" | 43 | #include "clock3xxx.h" |
45 | #include "clock44xx.h" | 44 | #include "clock44xx.h" |
45 | #include "sdrc.h" | ||
46 | 46 | ||
47 | /* | 47 | /* |
48 | * The machine specific code may provide the extra mapping besides the | 48 | * The machine specific code may provide the extra mapping besides the |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 001eff290cdb..bbe15cb1b874 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <plat/sram.h> | 38 | #include <plat/sram.h> |
39 | #include "clockdomain.h" | 39 | #include "clockdomain.h" |
40 | #include "powerdomain.h" | 40 | #include "powerdomain.h" |
41 | #include <plat/sdrc.h> | ||
42 | #include <plat/prcm.h> | 41 | #include <plat/prcm.h> |
43 | #include <plat-omap/dma-omap.h> | 42 | #include <plat-omap/dma-omap.h> |
44 | 43 | ||
diff --git a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h index 8bfaf342a028..1ee58c281a31 100644 --- a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h +++ b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM | 11 | #ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM |
12 | #define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM | 12 | #define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM |
13 | 13 | ||
14 | #include <plat/sdrc.h> | 14 | #include "sdrc.h" |
15 | 15 | ||
16 | /* Hynix H8MBX00U0MER-0EM */ | 16 | /* Hynix H8MBX00U0MER-0EM */ |
17 | static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = { | 17 | static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = { |
diff --git a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h index a391b4939f74..85cccc004c06 100644 --- a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h +++ b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF | 14 | #ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF |
15 | #define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF | 15 | #define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF |
16 | 16 | ||
17 | #include <plat/sdrc.h> | 17 | #include "sdrc.h" |
18 | 18 | ||
19 | /* Micron MT46H32M32LF-6 */ | 19 | /* Micron MT46H32M32LF-6 */ |
20 | /* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */ | 20 | /* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */ |
diff --git a/arch/arm/mach-omap2/sdram-nokia.c b/arch/arm/mach-omap2/sdram-nokia.c index 845c4fd2b125..5e5702cd410d 100644 --- a/arch/arm/mach-omap2/sdram-nokia.c +++ b/arch/arm/mach-omap2/sdram-nokia.c | |||
@@ -19,9 +19,9 @@ | |||
19 | 19 | ||
20 | #include "common.h" | 20 | #include "common.h" |
21 | #include <plat/clock.h> | 21 | #include <plat/clock.h> |
22 | #include <plat/sdrc.h> | ||
23 | 22 | ||
24 | #include "sdram-nokia.h" | 23 | #include "sdram-nokia.h" |
24 | #include "sdrc.h" | ||
25 | 25 | ||
26 | /* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */ | 26 | /* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */ |
27 | struct sdram_timings { | 27 | struct sdram_timings { |
diff --git a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h index cd4352917022..003f7bf4e2e3 100644 --- a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h +++ b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM | 11 | #ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM |
12 | #define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM | 12 | #define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM |
13 | 13 | ||
14 | #include <plat/sdrc.h> | 14 | #include "sdrc.h" |
15 | 15 | ||
16 | /* Numonyx M65KXXXXAM */ | 16 | /* Numonyx M65KXXXXAM */ |
17 | static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = { | 17 | static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = { |
diff --git a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h index 0e518a72831f..8dc3de5ebb5b 100644 --- a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h +++ b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 | 14 | #ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 |
15 | #define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 | 15 | #define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 |
16 | 16 | ||
17 | #include <plat/sdrc.h> | 17 | #include "sdrc.h" |
18 | 18 | ||
19 | /* Qimonda HYB18M512160AF-6 */ | 19 | /* Qimonda HYB18M512160AF-6 */ |
20 | static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = { | 20 | static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = { |
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c index e3d345f46409..761a781a99c5 100644 --- a/arch/arm/mach-omap2/sdrc.c +++ b/arch/arm/mach-omap2/sdrc.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <plat/clock.h> | 27 | #include <plat/clock.h> |
28 | #include <plat/sram.h> | 28 | #include <plat/sram.h> |
29 | 29 | ||
30 | #include <plat/sdrc.h> | ||
31 | #include "sdrc.h" | 30 | #include "sdrc.h" |
32 | 31 | ||
33 | static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; | 32 | static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; |
@@ -160,19 +159,3 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | |||
160 | sdrc_write_reg(l, SDRC_POWER); | 159 | sdrc_write_reg(l, SDRC_POWER); |
161 | omap2_sms_save_context(); | 160 | omap2_sms_save_context(); |
162 | } | 161 | } |
163 | |||
164 | void omap2_sms_write_rot_control(u32 val, unsigned ctx) | ||
165 | { | ||
166 | sms_write_reg(val, SMS_ROT_CONTROL(ctx)); | ||
167 | } | ||
168 | |||
169 | void omap2_sms_write_rot_size(u32 val, unsigned ctx) | ||
170 | { | ||
171 | sms_write_reg(val, SMS_ROT_SIZE(ctx)); | ||
172 | } | ||
173 | |||
174 | void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) | ||
175 | { | ||
176 | sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx)); | ||
177 | } | ||
178 | |||
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h index b3f83799e6cf..69c4b329452e 100644 --- a/arch/arm/mach-omap2/sdrc.h +++ b/arch/arm/mach-omap2/sdrc.h | |||
@@ -2,12 +2,14 @@ | |||
2 | #define __ARCH_ARM_MACH_OMAP2_SDRC_H | 2 | #define __ARCH_ARM_MACH_OMAP2_SDRC_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * OMAP2 SDRC register definitions | 5 | * OMAP2/3 SDRC/SMS macros and prototypes |
6 | * | 6 | * |
7 | * Copyright (C) 2007 Texas Instruments, Inc. | 7 | * Copyright (C) 2007-2008, 2012 Texas Instruments, Inc. |
8 | * Copyright (C) 2007 Nokia Corporation | 8 | * Copyright (C) 2007-2008 Nokia Corporation |
9 | * | 9 | * |
10 | * Written by Paul Walmsley | 10 | * Paul Walmsley |
11 | * Tony Lindgren | ||
12 | * Richard Woodruff | ||
11 | * | 13 | * |
12 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License version 2 as | 15 | * it under the terms of the GNU General Public License version 2 as |
@@ -15,8 +17,6 @@ | |||
15 | */ | 17 | */ |
16 | #undef DEBUG | 18 | #undef DEBUG |
17 | 19 | ||
18 | #include <plat/sdrc.h> | ||
19 | |||
20 | #ifndef __ASSEMBLER__ | 20 | #ifndef __ASSEMBLER__ |
21 | 21 | ||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
@@ -50,6 +50,58 @@ static inline u32 sms_read_reg(u16 reg) | |||
50 | { | 50 | { |
51 | return __raw_readl(OMAP_SMS_REGADDR(reg)); | 51 | return __raw_readl(OMAP_SMS_REGADDR(reg)); |
52 | } | 52 | } |
53 | |||
54 | |||
55 | /** | ||
56 | * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate | ||
57 | * @rate: SDRC clock rate (in Hz) | ||
58 | * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate | ||
59 | * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate | ||
60 | * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate | ||
61 | * @mr: Value to program to SDRC_MR for this rate | ||
62 | * | ||
63 | * This structure holds a pre-computed set of register values for the | ||
64 | * SDRC for a given SDRC clock rate and SDRAM chip. These are | ||
65 | * intended to be pre-computed and specified in an array in the board-*.c | ||
66 | * files. The structure is keyed off the 'rate' field. | ||
67 | */ | ||
68 | struct omap_sdrc_params { | ||
69 | unsigned long rate; | ||
70 | u32 actim_ctrla; | ||
71 | u32 actim_ctrlb; | ||
72 | u32 rfr_ctrl; | ||
73 | u32 mr; | ||
74 | }; | ||
75 | |||
76 | #ifdef CONFIG_SOC_HAS_OMAP2_SDRC | ||
77 | void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | ||
78 | struct omap_sdrc_params *sdrc_cs1); | ||
79 | #else | ||
80 | static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | ||
81 | struct omap_sdrc_params *sdrc_cs1) {}; | ||
82 | #endif | ||
83 | |||
84 | int omap2_sdrc_get_params(unsigned long r, | ||
85 | struct omap_sdrc_params **sdrc_cs0, | ||
86 | struct omap_sdrc_params **sdrc_cs1); | ||
87 | void omap2_sms_save_context(void); | ||
88 | void omap2_sms_restore_context(void); | ||
89 | |||
90 | struct memory_timings { | ||
91 | u32 m_type; /* ddr = 1, sdr = 0 */ | ||
92 | u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */ | ||
93 | u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */ | ||
94 | u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */ | ||
95 | u32 base_cs; /* base chip select to use for calculations */ | ||
96 | }; | ||
97 | |||
98 | extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode); | ||
99 | struct omap_sdrc_params *rx51_get_sdram_timings(void); | ||
100 | |||
101 | u32 omap2xxx_sdrc_dll_is_unlocked(void); | ||
102 | u32 omap2xxx_sdrc_reprogram(u32 level, u32 force); | ||
103 | |||
104 | |||
53 | #else | 105 | #else |
54 | #define OMAP242X_SDRC_REGADDR(reg) \ | 106 | #define OMAP242X_SDRC_REGADDR(reg) \ |
55 | OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) | 107 | OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) |
@@ -57,6 +109,7 @@ static inline u32 sms_read_reg(u16 reg) | |||
57 | OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) | 109 | OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) |
58 | #define OMAP34XX_SDRC_REGADDR(reg) \ | 110 | #define OMAP34XX_SDRC_REGADDR(reg) \ |
59 | OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) | 111 | OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) |
112 | |||
60 | #endif /* __ASSEMBLER__ */ | 113 | #endif /* __ASSEMBLER__ */ |
61 | 114 | ||
62 | /* Minimum frequency that the SDRC DLL can lock at */ | 115 | /* Minimum frequency that the SDRC DLL can lock at */ |
@@ -74,4 +127,85 @@ static inline u32 sms_read_reg(u16 reg) | |||
74 | */ | 127 | */ |
75 | #define SDRC_MPURATE_LOOPS 96 | 128 | #define SDRC_MPURATE_LOOPS 96 |
76 | 129 | ||
130 | /* SDRC register offsets - read/write with sdrc_{read,write}_reg() */ | ||
131 | |||
132 | #define SDRC_SYSCONFIG 0x010 | ||
133 | #define SDRC_CS_CFG 0x040 | ||
134 | #define SDRC_SHARING 0x044 | ||
135 | #define SDRC_ERR_TYPE 0x04C | ||
136 | #define SDRC_DLLA_CTRL 0x060 | ||
137 | #define SDRC_DLLA_STATUS 0x064 | ||
138 | #define SDRC_DLLB_CTRL 0x068 | ||
139 | #define SDRC_DLLB_STATUS 0x06C | ||
140 | #define SDRC_POWER 0x070 | ||
141 | #define SDRC_MCFG_0 0x080 | ||
142 | #define SDRC_MR_0 0x084 | ||
143 | #define SDRC_EMR2_0 0x08c | ||
144 | #define SDRC_ACTIM_CTRL_A_0 0x09c | ||
145 | #define SDRC_ACTIM_CTRL_B_0 0x0a0 | ||
146 | #define SDRC_RFR_CTRL_0 0x0a4 | ||
147 | #define SDRC_MANUAL_0 0x0a8 | ||
148 | #define SDRC_MCFG_1 0x0B0 | ||
149 | #define SDRC_MR_1 0x0B4 | ||
150 | #define SDRC_EMR2_1 0x0BC | ||
151 | #define SDRC_ACTIM_CTRL_A_1 0x0C4 | ||
152 | #define SDRC_ACTIM_CTRL_B_1 0x0C8 | ||
153 | #define SDRC_RFR_CTRL_1 0x0D4 | ||
154 | #define SDRC_MANUAL_1 0x0D8 | ||
155 | |||
156 | #define SDRC_POWER_AUTOCOUNT_SHIFT 8 | ||
157 | #define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT) | ||
158 | #define SDRC_POWER_CLKCTRL_SHIFT 4 | ||
159 | #define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT) | ||
160 | #define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT) | ||
161 | |||
162 | /* | ||
163 | * These values represent the number of memory clock cycles between | ||
164 | * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192 | ||
165 | * rows per device, and include a subtraction of a 50 cycle window in the | ||
166 | * event that the autorefresh command is delayed due to other SDRC activity. | ||
167 | * The '| 1' sets the ARE field to send one autorefresh when the autorefresh | ||
168 | * counter reaches 0. | ||
169 | * | ||
170 | * These represent optimal values for common parts, it won't work for all. | ||
171 | * As long as you scale down, most parameters are still work, they just | ||
172 | * become sub-optimal. The RFR value goes in the opposite direction. If you | ||
173 | * don't adjust it down as your clock period increases the refresh interval | ||
174 | * will not be met. Setting all parameters for complete worst case may work, | ||
175 | * but may cut memory performance by 2x. Due to errata the DLLs need to be | ||
176 | * unlocked and their value needs run time calibration. A dynamic call is | ||
177 | * need for that as no single right value exists acorss production samples. | ||
178 | * | ||
179 | * Only the FULL speed values are given. Current code is such that rate | ||
180 | * changes must be made at DPLLoutx2. The actual value adjustment for low | ||
181 | * frequency operation will be handled by omap_set_performance() | ||
182 | * | ||
183 | * By having the boot loader boot up in the fastest L4 speed available likely | ||
184 | * will result in something which you can switch between. | ||
185 | */ | ||
186 | #define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1) | ||
187 | #define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1) | ||
188 | #define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1) | ||
189 | #define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */ | ||
190 | #define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */ | ||
191 | |||
192 | |||
193 | /* | ||
194 | * SMS register access | ||
195 | */ | ||
196 | |||
197 | #define OMAP242X_SMS_REGADDR(reg) \ | ||
198 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg) | ||
199 | #define OMAP243X_SMS_REGADDR(reg) \ | ||
200 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg) | ||
201 | #define OMAP343X_SMS_REGADDR(reg) \ | ||
202 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg) | ||
203 | |||
204 | /* SMS register offsets - read/write with sms_{read,write}_reg() */ | ||
205 | |||
206 | #define SMS_SYSCONFIG 0x010 | ||
207 | /* REVISIT: fill in other SMS registers here */ | ||
208 | |||
209 | |||
210 | |||
77 | #endif | 211 | #endif |
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c index 73e55e485329..f7074ff1d084 100644 --- a/arch/arm/mach-omap2/sdrc2xxx.c +++ b/arch/arm/mach-omap2/sdrc2xxx.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <plat/clock.h> | 27 | #include <plat/clock.h> |
28 | #include <plat/sram.h> | 28 | #include <plat/sram.h> |
29 | #include <plat/sdrc.h> | ||
30 | 29 | ||
31 | #include "soc.h" | 30 | #include "soc.h" |
32 | #include "iomap.h" | 31 | #include "iomap.h" |
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c index bcbb9d5dc293..f868caeedfd6 100644 --- a/arch/arm/plat-omap/fb.c +++ b/arch/arm/plat-omap/fb.c | |||
@@ -33,6 +33,67 @@ | |||
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
35 | 35 | ||
36 | #include <plat/cpu.h> | ||
37 | |||
38 | #ifdef CONFIG_OMAP2_VRFB | ||
39 | |||
40 | /* | ||
41 | * The first memory resource is the register region for VRFB, | ||
42 | * the rest are VRFB virtual memory areas for each VRFB context. | ||
43 | */ | ||
44 | |||
45 | static const struct resource omap2_vrfb_resources[] = { | ||
46 | DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"), | ||
47 | DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"), | ||
48 | DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"), | ||
49 | DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"), | ||
50 | DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"), | ||
51 | }; | ||
52 | |||
53 | static const struct resource omap3_vrfb_resources[] = { | ||
54 | DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"), | ||
55 | DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"), | ||
56 | DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"), | ||
57 | DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"), | ||
58 | DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"), | ||
59 | DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"), | ||
60 | DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"), | ||
61 | DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"), | ||
62 | DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"), | ||
63 | DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"), | ||
64 | DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"), | ||
65 | DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"), | ||
66 | DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"), | ||
67 | }; | ||
68 | |||
69 | static int __init omap_init_vrfb(void) | ||
70 | { | ||
71 | struct platform_device *pdev; | ||
72 | const struct resource *res; | ||
73 | unsigned int num_res; | ||
74 | |||
75 | if (cpu_is_omap24xx()) { | ||
76 | res = omap2_vrfb_resources; | ||
77 | num_res = ARRAY_SIZE(omap2_vrfb_resources); | ||
78 | } else if (cpu_is_omap34xx()) { | ||
79 | res = omap3_vrfb_resources; | ||
80 | num_res = ARRAY_SIZE(omap3_vrfb_resources); | ||
81 | } else { | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | pdev = platform_device_register_resndata(NULL, "omapvrfb", -1, | ||
86 | res, num_res, NULL, 0); | ||
87 | |||
88 | if (IS_ERR(pdev)) | ||
89 | return PTR_ERR(pdev); | ||
90 | else | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | arch_initcall(omap_init_vrfb); | ||
95 | #endif | ||
96 | |||
36 | #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) | 97 | #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) |
37 | 98 | ||
38 | static bool omapfb_lcd_configured; | 99 | static bool omapfb_lcd_configured; |
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h deleted file mode 100644 index 36d6a7666216..000000000000 --- a/arch/arm/plat-omap/include/plat/sdrc.h +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | #ifndef ____ASM_ARCH_SDRC_H | ||
2 | #define ____ASM_ARCH_SDRC_H | ||
3 | |||
4 | /* | ||
5 | * OMAP2/3 SDRC/SMS register definitions | ||
6 | * | ||
7 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007-2008 Nokia Corporation | ||
9 | * | ||
10 | * Tony Lindgren | ||
11 | * Paul Walmsley | ||
12 | * Richard Woodruff | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | */ | ||
18 | |||
19 | |||
20 | /* SDRC register offsets - read/write with sdrc_{read,write}_reg() */ | ||
21 | |||
22 | #define SDRC_SYSCONFIG 0x010 | ||
23 | #define SDRC_CS_CFG 0x040 | ||
24 | #define SDRC_SHARING 0x044 | ||
25 | #define SDRC_ERR_TYPE 0x04C | ||
26 | #define SDRC_DLLA_CTRL 0x060 | ||
27 | #define SDRC_DLLA_STATUS 0x064 | ||
28 | #define SDRC_DLLB_CTRL 0x068 | ||
29 | #define SDRC_DLLB_STATUS 0x06C | ||
30 | #define SDRC_POWER 0x070 | ||
31 | #define SDRC_MCFG_0 0x080 | ||
32 | #define SDRC_MR_0 0x084 | ||
33 | #define SDRC_EMR2_0 0x08c | ||
34 | #define SDRC_ACTIM_CTRL_A_0 0x09c | ||
35 | #define SDRC_ACTIM_CTRL_B_0 0x0a0 | ||
36 | #define SDRC_RFR_CTRL_0 0x0a4 | ||
37 | #define SDRC_MANUAL_0 0x0a8 | ||
38 | #define SDRC_MCFG_1 0x0B0 | ||
39 | #define SDRC_MR_1 0x0B4 | ||
40 | #define SDRC_EMR2_1 0x0BC | ||
41 | #define SDRC_ACTIM_CTRL_A_1 0x0C4 | ||
42 | #define SDRC_ACTIM_CTRL_B_1 0x0C8 | ||
43 | #define SDRC_RFR_CTRL_1 0x0D4 | ||
44 | #define SDRC_MANUAL_1 0x0D8 | ||
45 | |||
46 | #define SDRC_POWER_AUTOCOUNT_SHIFT 8 | ||
47 | #define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT) | ||
48 | #define SDRC_POWER_CLKCTRL_SHIFT 4 | ||
49 | #define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT) | ||
50 | #define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT) | ||
51 | |||
52 | /* | ||
53 | * These values represent the number of memory clock cycles between | ||
54 | * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192 | ||
55 | * rows per device, and include a subtraction of a 50 cycle window in the | ||
56 | * event that the autorefresh command is delayed due to other SDRC activity. | ||
57 | * The '| 1' sets the ARE field to send one autorefresh when the autorefresh | ||
58 | * counter reaches 0. | ||
59 | * | ||
60 | * These represent optimal values for common parts, it won't work for all. | ||
61 | * As long as you scale down, most parameters are still work, they just | ||
62 | * become sub-optimal. The RFR value goes in the opposite direction. If you | ||
63 | * don't adjust it down as your clock period increases the refresh interval | ||
64 | * will not be met. Setting all parameters for complete worst case may work, | ||
65 | * but may cut memory performance by 2x. Due to errata the DLLs need to be | ||
66 | * unlocked and their value needs run time calibration. A dynamic call is | ||
67 | * need for that as no single right value exists acorss production samples. | ||
68 | * | ||
69 | * Only the FULL speed values are given. Current code is such that rate | ||
70 | * changes must be made at DPLLoutx2. The actual value adjustment for low | ||
71 | * frequency operation will be handled by omap_set_performance() | ||
72 | * | ||
73 | * By having the boot loader boot up in the fastest L4 speed available likely | ||
74 | * will result in something which you can switch between. | ||
75 | */ | ||
76 | #define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1) | ||
77 | #define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1) | ||
78 | #define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1) | ||
79 | #define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */ | ||
80 | #define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */ | ||
81 | |||
82 | |||
83 | /* | ||
84 | * SMS register access | ||
85 | */ | ||
86 | |||
87 | #define OMAP242X_SMS_REGADDR(reg) \ | ||
88 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg) | ||
89 | #define OMAP243X_SMS_REGADDR(reg) \ | ||
90 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg) | ||
91 | #define OMAP343X_SMS_REGADDR(reg) \ | ||
92 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg) | ||
93 | |||
94 | /* SMS register offsets - read/write with sms_{read,write}_reg() */ | ||
95 | |||
96 | #define SMS_SYSCONFIG 0x010 | ||
97 | #define SMS_ROT_CONTROL(context) (0x180 + 0x10 * context) | ||
98 | #define SMS_ROT_SIZE(context) (0x184 + 0x10 * context) | ||
99 | #define SMS_ROT_PHYSICAL_BA(context) (0x188 + 0x10 * context) | ||
100 | /* REVISIT: fill in other SMS registers here */ | ||
101 | |||
102 | |||
103 | #ifndef __ASSEMBLER__ | ||
104 | |||
105 | /** | ||
106 | * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate | ||
107 | * @rate: SDRC clock rate (in Hz) | ||
108 | * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate | ||
109 | * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate | ||
110 | * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate | ||
111 | * @mr: Value to program to SDRC_MR for this rate | ||
112 | * | ||
113 | * This structure holds a pre-computed set of register values for the | ||
114 | * SDRC for a given SDRC clock rate and SDRAM chip. These are | ||
115 | * intended to be pre-computed and specified in an array in the board-*.c | ||
116 | * files. The structure is keyed off the 'rate' field. | ||
117 | */ | ||
118 | struct omap_sdrc_params { | ||
119 | unsigned long rate; | ||
120 | u32 actim_ctrla; | ||
121 | u32 actim_ctrlb; | ||
122 | u32 rfr_ctrl; | ||
123 | u32 mr; | ||
124 | }; | ||
125 | |||
126 | #ifdef CONFIG_SOC_HAS_OMAP2_SDRC | ||
127 | void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | ||
128 | struct omap_sdrc_params *sdrc_cs1); | ||
129 | #else | ||
130 | static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | ||
131 | struct omap_sdrc_params *sdrc_cs1) {}; | ||
132 | #endif | ||
133 | |||
134 | int omap2_sdrc_get_params(unsigned long r, | ||
135 | struct omap_sdrc_params **sdrc_cs0, | ||
136 | struct omap_sdrc_params **sdrc_cs1); | ||
137 | void omap2_sms_save_context(void); | ||
138 | void omap2_sms_restore_context(void); | ||
139 | |||
140 | void omap2_sms_write_rot_control(u32 val, unsigned ctx); | ||
141 | void omap2_sms_write_rot_size(u32 val, unsigned ctx); | ||
142 | void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx); | ||
143 | |||
144 | #ifdef CONFIG_ARCH_OMAP2 | ||
145 | |||
146 | struct memory_timings { | ||
147 | u32 m_type; /* ddr = 1, sdr = 0 */ | ||
148 | u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */ | ||
149 | u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */ | ||
150 | u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */ | ||
151 | u32 base_cs; /* base chip select to use for calculations */ | ||
152 | }; | ||
153 | |||
154 | extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode); | ||
155 | struct omap_sdrc_params *rx51_get_sdram_timings(void); | ||
156 | |||
157 | u32 omap2xxx_sdrc_dll_is_unlocked(void); | ||
158 | u32 omap2xxx_sdrc_reprogram(u32 level, u32 force); | ||
159 | |||
160 | #endif /* CONFIG_ARCH_OMAP2 */ | ||
161 | |||
162 | #endif /* __ASSEMBLER__ */ | ||
163 | |||
164 | #endif | ||
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 1bd6a2ec95a3..4b1becc86e54 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | #include <plat/cpu.h> | 47 | #include <plat/cpu.h> |
48 | #include <plat-omap/dma-omap.h> | 48 | #include <plat-omap/dma-omap.h> |
49 | #include <plat/vrfb.h> | 49 | #include <video/omapvrfb.h> |
50 | #include <video/omapdss.h> | 50 | #include <video/omapdss.h> |
51 | 51 | ||
52 | #include "omap_voutlib.h" | 52 | #include "omap_voutlib.h" |
diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c index bed4cbb18ef5..8340445a0ee5 100644 --- a/drivers/media/platform/omap/omap_vout_vrfb.c +++ b/drivers/media/platform/omap/omap_vout_vrfb.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <media/v4l2-device.h> | 17 | #include <media/v4l2-device.h> |
18 | 18 | ||
19 | #include <plat-omap/dma-omap.h> | 19 | #include <plat-omap/dma-omap.h> |
20 | #include <plat/vrfb.h> | 20 | #include <video/omapvrfb.h> |
21 | 21 | ||
22 | #include "omap_voutdef.h" | 22 | #include "omap_voutdef.h" |
23 | #include "omap_voutlib.h" | 23 | #include "omap_voutlib.h" |
diff --git a/drivers/media/platform/omap/omap_voutdef.h b/drivers/media/platform/omap/omap_voutdef.h index 27a95d23b913..9ccfe1f475a4 100644 --- a/drivers/media/platform/omap/omap_voutdef.h +++ b/drivers/media/platform/omap/omap_voutdef.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #define OMAP_VOUTDEF_H | 12 | #define OMAP_VOUTDEF_H |
13 | 13 | ||
14 | #include <video/omapdss.h> | 14 | #include <video/omapdss.h> |
15 | #include <plat/vrfb.h> | 15 | #include <video/omapvrfb.h> |
16 | 16 | ||
17 | #define YUYV_BPP 2 | 17 | #define YUYV_BPP 2 |
18 | #define RGB565_BPP 2 | 18 | #define RGB565_BPP 2 |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index b2af72dc20bd..d94ef9e31a35 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -237,7 +237,7 @@ static int __init omap_dss_probe(struct platform_device *pdev) | |||
237 | 237 | ||
238 | core.pdev = pdev; | 238 | core.pdev = pdev; |
239 | 239 | ||
240 | dss_features_init(); | 240 | dss_features_init(pdata->version); |
241 | 241 | ||
242 | dss_apply_init(); | 242 | dss_apply_init(); |
243 | 243 | ||
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index b43477a5fae8..a5ab354f267a 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | #include <linux/pm_runtime.h> | 38 | #include <linux/pm_runtime.h> |
39 | 39 | ||
40 | #include <plat/cpu.h> | ||
41 | |||
42 | #include <video/omapdss.h> | 40 | #include <video/omapdss.h> |
43 | 41 | ||
44 | #include "dss.h" | 42 | #include "dss.h" |
@@ -4042,29 +4040,44 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = { | |||
4042 | .gfx_fifo_workaround = true, | 4040 | .gfx_fifo_workaround = true, |
4043 | }; | 4041 | }; |
4044 | 4042 | ||
4045 | static int __init dispc_init_features(struct device *dev) | 4043 | static int __init dispc_init_features(struct platform_device *pdev) |
4046 | { | 4044 | { |
4045 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
4047 | const struct dispc_features *src; | 4046 | const struct dispc_features *src; |
4048 | struct dispc_features *dst; | 4047 | struct dispc_features *dst; |
4049 | 4048 | ||
4050 | dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); | 4049 | dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); |
4051 | if (!dst) { | 4050 | if (!dst) { |
4052 | dev_err(dev, "Failed to allocate DISPC Features\n"); | 4051 | dev_err(&pdev->dev, "Failed to allocate DISPC Features\n"); |
4053 | return -ENOMEM; | 4052 | return -ENOMEM; |
4054 | } | 4053 | } |
4055 | 4054 | ||
4056 | if (cpu_is_omap24xx()) { | 4055 | switch (pdata->version) { |
4056 | case OMAPDSS_VER_OMAP24xx: | ||
4057 | src = &omap24xx_dispc_feats; | 4057 | src = &omap24xx_dispc_feats; |
4058 | } else if (cpu_is_omap34xx()) { | 4058 | break; |
4059 | if (omap_rev() < OMAP3430_REV_ES3_0) | 4059 | |
4060 | src = &omap34xx_rev1_0_dispc_feats; | 4060 | case OMAPDSS_VER_OMAP34xx_ES1: |
4061 | else | 4061 | src = &omap34xx_rev1_0_dispc_feats; |
4062 | src = &omap34xx_rev3_0_dispc_feats; | 4062 | break; |
4063 | } else if (cpu_is_omap44xx()) { | 4063 | |
4064 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
4065 | case OMAPDSS_VER_OMAP3630: | ||
4066 | case OMAPDSS_VER_AM35xx: | ||
4067 | src = &omap34xx_rev3_0_dispc_feats; | ||
4068 | break; | ||
4069 | |||
4070 | case OMAPDSS_VER_OMAP4430_ES1: | ||
4071 | case OMAPDSS_VER_OMAP4430_ES2: | ||
4072 | case OMAPDSS_VER_OMAP4: | ||
4064 | src = &omap44xx_dispc_feats; | 4073 | src = &omap44xx_dispc_feats; |
4065 | } else if (soc_is_omap54xx()) { | 4074 | break; |
4075 | |||
4076 | case OMAPDSS_VER_OMAP5: | ||
4066 | src = &omap44xx_dispc_feats; | 4077 | src = &omap44xx_dispc_feats; |
4067 | } else { | 4078 | break; |
4079 | |||
4080 | default: | ||
4068 | return -ENODEV; | 4081 | return -ENODEV; |
4069 | } | 4082 | } |
4070 | 4083 | ||
@@ -4084,7 +4097,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev) | |||
4084 | 4097 | ||
4085 | dispc.pdev = pdev; | 4098 | dispc.pdev = pdev; |
4086 | 4099 | ||
4087 | r = dispc_init_features(&dispc.pdev->dev); | 4100 | r = dispc_init_features(dispc.pdev); |
4088 | if (r) | 4101 | if (r) |
4089 | return r; | 4102 | return r; |
4090 | 4103 | ||
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 2ab1c3e96553..363852a0f764 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
37 | 37 | ||
38 | #include <plat/cpu.h> | ||
39 | |||
40 | #include "dss.h" | 38 | #include "dss.h" |
41 | #include "dss_features.h" | 39 | #include "dss_features.h" |
42 | 40 | ||
@@ -792,29 +790,46 @@ static const struct dss_features omap54xx_dss_feats __initconst = { | |||
792 | .dpi_select_source = &dss_dpi_select_source_omap5, | 790 | .dpi_select_source = &dss_dpi_select_source_omap5, |
793 | }; | 791 | }; |
794 | 792 | ||
795 | static int __init dss_init_features(struct device *dev) | 793 | static int __init dss_init_features(struct platform_device *pdev) |
796 | { | 794 | { |
795 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
797 | const struct dss_features *src; | 796 | const struct dss_features *src; |
798 | struct dss_features *dst; | 797 | struct dss_features *dst; |
799 | 798 | ||
800 | dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); | 799 | dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); |
801 | if (!dst) { | 800 | if (!dst) { |
802 | dev_err(dev, "Failed to allocate local DSS Features\n"); | 801 | dev_err(&pdev->dev, "Failed to allocate local DSS Features\n"); |
803 | return -ENOMEM; | 802 | return -ENOMEM; |
804 | } | 803 | } |
805 | 804 | ||
806 | if (cpu_is_omap24xx()) | 805 | switch (pdata->version) { |
806 | case OMAPDSS_VER_OMAP24xx: | ||
807 | src = &omap24xx_dss_feats; | 807 | src = &omap24xx_dss_feats; |
808 | else if (cpu_is_omap34xx()) | 808 | break; |
809 | |||
810 | case OMAPDSS_VER_OMAP34xx_ES1: | ||
811 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
812 | case OMAPDSS_VER_AM35xx: | ||
809 | src = &omap34xx_dss_feats; | 813 | src = &omap34xx_dss_feats; |
810 | else if (cpu_is_omap3630()) | 814 | break; |
815 | |||
816 | case OMAPDSS_VER_OMAP3630: | ||
811 | src = &omap3630_dss_feats; | 817 | src = &omap3630_dss_feats; |
812 | else if (cpu_is_omap44xx()) | 818 | break; |
819 | |||
820 | case OMAPDSS_VER_OMAP4430_ES1: | ||
821 | case OMAPDSS_VER_OMAP4430_ES2: | ||
822 | case OMAPDSS_VER_OMAP4: | ||
813 | src = &omap44xx_dss_feats; | 823 | src = &omap44xx_dss_feats; |
814 | else if (soc_is_omap54xx()) | 824 | break; |
825 | |||
826 | case OMAPDSS_VER_OMAP5: | ||
815 | src = &omap54xx_dss_feats; | 827 | src = &omap54xx_dss_feats; |
816 | else | 828 | break; |
829 | |||
830 | default: | ||
817 | return -ENODEV; | 831 | return -ENODEV; |
832 | } | ||
818 | 833 | ||
819 | memcpy(dst, src, sizeof(*dst)); | 834 | memcpy(dst, src, sizeof(*dst)); |
820 | dss.feat = dst; | 835 | dss.feat = dst; |
@@ -831,7 +846,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev) | |||
831 | 846 | ||
832 | dss.pdev = pdev; | 847 | dss.pdev = pdev; |
833 | 848 | ||
834 | r = dss_init_features(&dss.pdev->dev); | 849 | r = dss_init_features(dss.pdev); |
835 | if (r) | 850 | if (r) |
836 | return r; | 851 | return r; |
837 | 852 | ||
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index acbc1e1efba3..3e8287c8709d 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | 24 | ||
25 | #include <video/omapdss.h> | 25 | #include <video/omapdss.h> |
26 | #include <plat/cpu.h> | ||
27 | 26 | ||
28 | #include "dss.h" | 27 | #include "dss.h" |
29 | #include "dss_features.h" | 28 | #include "dss_features.h" |
@@ -825,10 +824,20 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { | |||
825 | 824 | ||
826 | }; | 825 | }; |
827 | 826 | ||
828 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data) | 827 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, |
828 | enum omapdss_version version) | ||
829 | { | 829 | { |
830 | if (cpu_is_omap44xx()) | 830 | switch (version) { |
831 | case OMAPDSS_VER_OMAP4430_ES1: | ||
832 | case OMAPDSS_VER_OMAP4430_ES2: | ||
833 | case OMAPDSS_VER_OMAP4: | ||
831 | ip_data->ops = &omap4_hdmi_functions; | 834 | ip_data->ops = &omap4_hdmi_functions; |
835 | break; | ||
836 | default: | ||
837 | ip_data->ops = NULL; | ||
838 | } | ||
839 | |||
840 | WARN_ON(ip_data->ops == NULL); | ||
832 | } | 841 | } |
833 | #endif | 842 | #endif |
834 | 843 | ||
@@ -929,29 +938,44 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type) | |||
929 | return omap_current_dss_features->supported_rotation_types & rot_type; | 938 | return omap_current_dss_features->supported_rotation_types & rot_type; |
930 | } | 939 | } |
931 | 940 | ||
932 | void dss_features_init(void) | 941 | void dss_features_init(enum omapdss_version version) |
933 | { | 942 | { |
934 | if (cpu_is_omap24xx()) | 943 | switch (version) { |
944 | case OMAPDSS_VER_OMAP24xx: | ||
935 | omap_current_dss_features = &omap2_dss_features; | 945 | omap_current_dss_features = &omap2_dss_features; |
936 | else if (cpu_is_omap3630()) | 946 | break; |
947 | |||
948 | case OMAPDSS_VER_OMAP34xx_ES1: | ||
949 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
950 | omap_current_dss_features = &omap3430_dss_features; | ||
951 | break; | ||
952 | |||
953 | case OMAPDSS_VER_OMAP3630: | ||
937 | omap_current_dss_features = &omap3630_dss_features; | 954 | omap_current_dss_features = &omap3630_dss_features; |
938 | else if (cpu_is_omap34xx()) { | 955 | break; |
939 | if (soc_is_am35xx()) { | 956 | |
940 | omap_current_dss_features = &am35xx_dss_features; | 957 | case OMAPDSS_VER_OMAP4430_ES1: |
941 | } else { | ||
942 | omap_current_dss_features = &omap3430_dss_features; | ||
943 | } | ||
944 | } | ||
945 | else if (omap_rev() == OMAP4430_REV_ES1_0) | ||
946 | omap_current_dss_features = &omap4430_es1_0_dss_features; | 958 | omap_current_dss_features = &omap4430_es1_0_dss_features; |
947 | else if (omap_rev() == OMAP4430_REV_ES2_0 || | 959 | break; |
948 | omap_rev() == OMAP4430_REV_ES2_1 || | 960 | |
949 | omap_rev() == OMAP4430_REV_ES2_2) | 961 | case OMAPDSS_VER_OMAP4430_ES2: |
950 | omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; | 962 | omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; |
951 | else if (cpu_is_omap44xx()) | 963 | break; |
964 | |||
965 | case OMAPDSS_VER_OMAP4: | ||
952 | omap_current_dss_features = &omap4_dss_features; | 966 | omap_current_dss_features = &omap4_dss_features; |
953 | else if (soc_is_omap54xx()) | 967 | break; |
968 | |||
969 | case OMAPDSS_VER_OMAP5: | ||
954 | omap_current_dss_features = &omap5_dss_features; | 970 | omap_current_dss_features = &omap5_dss_features; |
955 | else | 971 | break; |
972 | |||
973 | case OMAPDSS_VER_AM35xx: | ||
974 | omap_current_dss_features = &am35xx_dss_features; | ||
975 | break; | ||
976 | |||
977 | default: | ||
956 | DSSWARN("Unsupported OMAP version"); | 978 | DSSWARN("Unsupported OMAP version"); |
979 | break; | ||
980 | } | ||
957 | } | 981 | } |
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h index 9218113b5e88..fc492ef72a51 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/omap2/dss/dss_features.h | |||
@@ -123,8 +123,9 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type); | |||
123 | 123 | ||
124 | bool dss_has_feature(enum dss_feat_id id); | 124 | bool dss_has_feature(enum dss_feat_id id); |
125 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); | 125 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); |
126 | void dss_features_init(void); | 126 | void dss_features_init(enum omapdss_version version); |
127 | #if defined(CONFIG_OMAP4_DSS_HDMI) | 127 | #if defined(CONFIG_OMAP4_DSS_HDMI) |
128 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data); | 128 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, |
129 | enum omapdss_version version); | ||
129 | #endif | 130 | #endif |
130 | #endif | 131 | #endif |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index a48a7dd75b33..adcc906d12f8 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -323,6 +323,7 @@ static void hdmi_runtime_put(void) | |||
323 | 323 | ||
324 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) | 324 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
325 | { | 325 | { |
326 | struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data; | ||
326 | int r; | 327 | int r; |
327 | 328 | ||
328 | struct gpio gpios[] = { | 329 | struct gpio gpios[] = { |
@@ -333,7 +334,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev) | |||
333 | 334 | ||
334 | DSSDBG("init_display\n"); | 335 | DSSDBG("init_display\n"); |
335 | 336 | ||
336 | dss_init_hdmi_ip_ops(&hdmi.ip_data); | 337 | dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version); |
337 | 338 | ||
338 | if (hdmi.vdda_hdmi_dac_reg == NULL) { | 339 | if (hdmi.vdda_hdmi_dac_reg == NULL) { |
339 | struct regulator *reg; | 340 | struct regulator *reg; |
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 606b89f12351..55a39be694a5 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <video/omapvrfb.h> |
34 | #include <plat/vram.h> | 34 | #include <plat/vram.h> |
35 | 35 | ||
36 | #include "omapfb.h" | 36 | #include "omapfb.h" |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 16db1589bd91..bc225e46fdd2 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -31,9 +31,8 @@ | |||
31 | #include <linux/omapfb.h> | 31 | #include <linux/omapfb.h> |
32 | 32 | ||
33 | #include <video/omapdss.h> | 33 | #include <video/omapdss.h> |
34 | #include <plat/cpu.h> | ||
35 | #include <plat/vram.h> | 34 | #include <plat/vram.h> |
36 | #include <plat/vrfb.h> | 35 | #include <video/omapvrfb.h> |
37 | 36 | ||
38 | #include "omapfb.h" | 37 | #include "omapfb.h" |
39 | 38 | ||
@@ -2396,10 +2395,7 @@ static int __init omapfb_probe(struct platform_device *pdev) | |||
2396 | goto err0; | 2395 | goto err0; |
2397 | } | 2396 | } |
2398 | 2397 | ||
2399 | /* TODO : Replace cpu check with omap_has_vrfb once HAS_FEATURE | 2398 | if (def_vrfb && !omap_vrfb_supported()) { |
2400 | * available for OMAP2 and OMAP3 | ||
2401 | */ | ||
2402 | if (def_vrfb && !cpu_is_omap24xx() && !cpu_is_omap34xx()) { | ||
2403 | def_vrfb = 0; | 2399 | def_vrfb = 0; |
2404 | dev_warn(&pdev->dev, "VRFB is not supported on this hardware, " | 2400 | dev_warn(&pdev->dev, "VRFB is not supported on this hardware, " |
2405 | "ignoring the module parameter vrfb=y\n"); | 2401 | "ignoring the module parameter vrfb=y\n"); |
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c index e8d8cc76a435..17aa174e187c 100644 --- a/drivers/video/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/omapfb.h> | 30 | #include <linux/omapfb.h> |
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <video/omapvrfb.h> |
34 | 34 | ||
35 | #include "omapfb.h" | 35 | #include "omapfb.h" |
36 | 36 | ||
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index 7e990220ad2a..5d8fdac3b800 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c | |||
@@ -26,9 +26,9 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/bitops.h> | 27 | #include <linux/bitops.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/platform_device.h> | ||
29 | 30 | ||
30 | #include <plat/vrfb.h> | 31 | #include <video/omapvrfb.h> |
31 | #include <plat/sdrc.h> | ||
32 | 32 | ||
33 | #ifdef DEBUG | 33 | #ifdef DEBUG |
34 | #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__) | 34 | #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__) |
@@ -36,10 +36,10 @@ | |||
36 | #define DBG(format, ...) | 36 | #define DBG(format, ...) |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define SMS_ROT_VIRT_BASE(context, rot) \ | 39 | #define SMS_ROT_CONTROL(context) (0x0 + 0x10 * context) |
40 | (((context >= 4) ? 0xD0000000 : 0x70000000) \ | 40 | #define SMS_ROT_SIZE(context) (0x4 + 0x10 * context) |
41 | + (0x4000000 * (context)) \ | 41 | #define SMS_ROT_PHYSICAL_BA(context) (0x8 + 0x10 * context) |
42 | + (0x1000000 * (rot))) | 42 | #define SMS_ROT_VIRT_BASE(rot) (0x1000000 * (rot)) |
43 | 43 | ||
44 | #define OMAP_VRFB_SIZE (2048 * 2048 * 4) | 44 | #define OMAP_VRFB_SIZE (2048 * 2048 * 4) |
45 | 45 | ||
@@ -53,10 +53,16 @@ | |||
53 | #define SMS_PW_OFFSET 4 | 53 | #define SMS_PW_OFFSET 4 |
54 | #define SMS_PS_OFFSET 0 | 54 | #define SMS_PS_OFFSET 0 |
55 | 55 | ||
56 | #define VRFB_NUM_CTXS 12 | ||
57 | /* bitmap of reserved contexts */ | 56 | /* bitmap of reserved contexts */ |
58 | static unsigned long ctx_map; | 57 | static unsigned long ctx_map; |
59 | 58 | ||
59 | struct vrfb_ctx { | ||
60 | u32 base; | ||
61 | u32 physical_ba; | ||
62 | u32 control; | ||
63 | u32 size; | ||
64 | }; | ||
65 | |||
60 | static DEFINE_MUTEX(ctx_lock); | 66 | static DEFINE_MUTEX(ctx_lock); |
61 | 67 | ||
62 | /* | 68 | /* |
@@ -65,17 +71,34 @@ static DEFINE_MUTEX(ctx_lock); | |||
65 | * we don't need locking, since no drivers will run until after the wake-up | 71 | * we don't need locking, since no drivers will run until after the wake-up |
66 | * has finished. | 72 | * has finished. |
67 | */ | 73 | */ |
68 | static struct { | 74 | |
69 | u32 physical_ba; | 75 | static void __iomem *vrfb_base; |
70 | u32 control; | 76 | |
71 | u32 size; | 77 | static int num_ctxs; |
72 | } vrfb_hw_context[VRFB_NUM_CTXS]; | 78 | static struct vrfb_ctx *ctxs; |
79 | |||
80 | static bool vrfb_loaded; | ||
81 | |||
82 | static void omap2_sms_write_rot_control(u32 val, unsigned ctx) | ||
83 | { | ||
84 | __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx)); | ||
85 | } | ||
86 | |||
87 | static void omap2_sms_write_rot_size(u32 val, unsigned ctx) | ||
88 | { | ||
89 | __raw_writel(val, vrfb_base + SMS_ROT_SIZE(ctx)); | ||
90 | } | ||
91 | |||
92 | static void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) | ||
93 | { | ||
94 | __raw_writel(val, vrfb_base + SMS_ROT_PHYSICAL_BA(ctx)); | ||
95 | } | ||
73 | 96 | ||
74 | static inline void restore_hw_context(int ctx) | 97 | static inline void restore_hw_context(int ctx) |
75 | { | 98 | { |
76 | omap2_sms_write_rot_control(vrfb_hw_context[ctx].control, ctx); | 99 | omap2_sms_write_rot_control(ctxs[ctx].control, ctx); |
77 | omap2_sms_write_rot_size(vrfb_hw_context[ctx].size, ctx); | 100 | omap2_sms_write_rot_size(ctxs[ctx].size, ctx); |
78 | omap2_sms_write_rot_physical_ba(vrfb_hw_context[ctx].physical_ba, ctx); | 101 | omap2_sms_write_rot_physical_ba(ctxs[ctx].physical_ba, ctx); |
79 | } | 102 | } |
80 | 103 | ||
81 | static u32 get_image_width_roundup(u16 width, u8 bytespp) | 104 | static u32 get_image_width_roundup(u16 width, u8 bytespp) |
@@ -196,9 +219,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, | |||
196 | control |= VRFB_PAGE_WIDTH_EXP << SMS_PW_OFFSET; | 219 | control |= VRFB_PAGE_WIDTH_EXP << SMS_PW_OFFSET; |
197 | control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET; | 220 | control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET; |
198 | 221 | ||
199 | vrfb_hw_context[ctx].physical_ba = paddr; | 222 | ctxs[ctx].physical_ba = paddr; |
200 | vrfb_hw_context[ctx].size = size; | 223 | ctxs[ctx].size = size; |
201 | vrfb_hw_context[ctx].control = control; | 224 | ctxs[ctx].control = control; |
202 | 225 | ||
203 | omap2_sms_write_rot_physical_ba(paddr, ctx); | 226 | omap2_sms_write_rot_physical_ba(paddr, ctx); |
204 | omap2_sms_write_rot_size(size, ctx); | 227 | omap2_sms_write_rot_size(size, ctx); |
@@ -274,11 +297,11 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb) | |||
274 | 297 | ||
275 | mutex_lock(&ctx_lock); | 298 | mutex_lock(&ctx_lock); |
276 | 299 | ||
277 | for (ctx = 0; ctx < VRFB_NUM_CTXS; ++ctx) | 300 | for (ctx = 0; ctx < num_ctxs; ++ctx) |
278 | if ((ctx_map & (1 << ctx)) == 0) | 301 | if ((ctx_map & (1 << ctx)) == 0) |
279 | break; | 302 | break; |
280 | 303 | ||
281 | if (ctx == VRFB_NUM_CTXS) { | 304 | if (ctx == num_ctxs) { |
282 | pr_err("vrfb: no free contexts\n"); | 305 | pr_err("vrfb: no free contexts\n"); |
283 | r = -EBUSY; | 306 | r = -EBUSY; |
284 | goto out; | 307 | goto out; |
@@ -293,7 +316,7 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb) | |||
293 | vrfb->context = ctx; | 316 | vrfb->context = ctx; |
294 | 317 | ||
295 | for (rot = 0; rot < 4; ++rot) { | 318 | for (rot = 0; rot < 4; ++rot) { |
296 | paddr = SMS_ROT_VIRT_BASE(ctx, rot); | 319 | paddr = ctxs[ctx].base + SMS_ROT_VIRT_BASE(rot); |
297 | if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) { | 320 | if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) { |
298 | pr_err("vrfb: failed to reserve VRFB " | 321 | pr_err("vrfb: failed to reserve VRFB " |
299 | "area for ctx %d, rotation %d\n", | 322 | "area for ctx %d, rotation %d\n", |
@@ -314,3 +337,80 @@ out: | |||
314 | return r; | 337 | return r; |
315 | } | 338 | } |
316 | EXPORT_SYMBOL(omap_vrfb_request_ctx); | 339 | EXPORT_SYMBOL(omap_vrfb_request_ctx); |
340 | |||
341 | bool omap_vrfb_supported(void) | ||
342 | { | ||
343 | return vrfb_loaded; | ||
344 | } | ||
345 | EXPORT_SYMBOL(omap_vrfb_supported); | ||
346 | |||
347 | static int __init vrfb_probe(struct platform_device *pdev) | ||
348 | { | ||
349 | struct resource *mem; | ||
350 | int i; | ||
351 | |||
352 | /* first resource is the register res, the rest are vrfb contexts */ | ||
353 | |||
354 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
355 | if (!mem) { | ||
356 | dev_err(&pdev->dev, "can't get vrfb base address\n"); | ||
357 | return -EINVAL; | ||
358 | } | ||
359 | |||
360 | vrfb_base = devm_request_and_ioremap(&pdev->dev, mem); | ||
361 | if (!vrfb_base) { | ||
362 | dev_err(&pdev->dev, "can't ioremap vrfb memory\n"); | ||
363 | return -ENOMEM; | ||
364 | } | ||
365 | |||
366 | num_ctxs = pdev->num_resources - 1; | ||
367 | |||
368 | ctxs = devm_kzalloc(&pdev->dev, | ||
369 | sizeof(struct vrfb_ctx) * num_ctxs, | ||
370 | GFP_KERNEL); | ||
371 | |||
372 | if (!ctxs) | ||
373 | return -ENOMEM; | ||
374 | |||
375 | for (i = 0; i < num_ctxs; ++i) { | ||
376 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i); | ||
377 | if (!mem) { | ||
378 | dev_err(&pdev->dev, "can't get vrfb ctx %d address\n", | ||
379 | i); | ||
380 | return -EINVAL; | ||
381 | } | ||
382 | |||
383 | ctxs[i].base = mem->start; | ||
384 | } | ||
385 | |||
386 | vrfb_loaded = true; | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static void __exit vrfb_remove(struct platform_device *pdev) | ||
392 | { | ||
393 | vrfb_loaded = false; | ||
394 | } | ||
395 | |||
396 | static struct platform_driver vrfb_driver = { | ||
397 | .driver.name = "omapvrfb", | ||
398 | .remove = __exit_p(vrfb_remove), | ||
399 | }; | ||
400 | |||
401 | static int __init vrfb_init(void) | ||
402 | { | ||
403 | return platform_driver_probe(&vrfb_driver, &vrfb_probe); | ||
404 | } | ||
405 | |||
406 | static void __exit vrfb_exit(void) | ||
407 | { | ||
408 | platform_driver_unregister(&vrfb_driver); | ||
409 | } | ||
410 | |||
411 | module_init(vrfb_init); | ||
412 | module_exit(vrfb_exit); | ||
413 | |||
414 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); | ||
415 | MODULE_DESCRIPTION("OMAP VRFB"); | ||
416 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 3729173b7fbc..88c829466fc1 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -314,6 +314,19 @@ int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel); | |||
314 | int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel); | 314 | int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel); |
315 | void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel); | 315 | void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel); |
316 | 316 | ||
317 | enum omapdss_version { | ||
318 | OMAPDSS_VER_UNKNOWN = 0, | ||
319 | OMAPDSS_VER_OMAP24xx, | ||
320 | OMAPDSS_VER_OMAP34xx_ES1, /* OMAP3430 ES1.0, 2.0 */ | ||
321 | OMAPDSS_VER_OMAP34xx_ES3, /* OMAP3430 ES3.0+ */ | ||
322 | OMAPDSS_VER_OMAP3630, | ||
323 | OMAPDSS_VER_AM35xx, | ||
324 | OMAPDSS_VER_OMAP4430_ES1, /* OMAP4430 ES1.0 */ | ||
325 | OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */ | ||
326 | OMAPDSS_VER_OMAP4, /* All other OMAP4s */ | ||
327 | OMAPDSS_VER_OMAP5, | ||
328 | }; | ||
329 | |||
317 | /* Board specific data */ | 330 | /* Board specific data */ |
318 | struct omap_dss_board_info { | 331 | struct omap_dss_board_info { |
319 | int (*get_context_loss_count)(struct device *dev); | 332 | int (*get_context_loss_count)(struct device *dev); |
@@ -323,6 +336,7 @@ struct omap_dss_board_info { | |||
323 | int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); | 336 | int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); |
324 | void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); | 337 | void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); |
325 | int (*set_min_bus_tput)(struct device *dev, unsigned long r); | 338 | int (*set_min_bus_tput)(struct device *dev, unsigned long r); |
339 | enum omapdss_version version; | ||
326 | }; | 340 | }; |
327 | 341 | ||
328 | /* Init with the board info */ | 342 | /* Init with the board info */ |
diff --git a/arch/arm/plat-omap/include/plat/vrfb.h b/include/video/omapvrfb.h index 3792bdea2f6d..bb0bd89f8bc6 100644 --- a/arch/arm/plat-omap/include/plat/vrfb.h +++ b/include/video/omapvrfb.h | |||
@@ -36,6 +36,7 @@ struct vrfb { | |||
36 | }; | 36 | }; |
37 | 37 | ||
38 | #ifdef CONFIG_OMAP2_VRFB | 38 | #ifdef CONFIG_OMAP2_VRFB |
39 | extern bool omap_vrfb_supported(void); | ||
39 | extern int omap_vrfb_request_ctx(struct vrfb *vrfb); | 40 | extern int omap_vrfb_request_ctx(struct vrfb *vrfb); |
40 | extern void omap_vrfb_release_ctx(struct vrfb *vrfb); | 41 | extern void omap_vrfb_release_ctx(struct vrfb *vrfb); |
41 | extern void omap_vrfb_adjust_size(u16 *width, u16 *height, | 42 | extern void omap_vrfb_adjust_size(u16 *width, u16 *height, |
@@ -49,6 +50,7 @@ extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot); | |||
49 | extern void omap_vrfb_restore_context(void); | 50 | extern void omap_vrfb_restore_context(void); |
50 | 51 | ||
51 | #else | 52 | #else |
53 | static inline bool omap_vrfb_supported(void) { return false; } | ||
52 | static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; } | 54 | static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; } |
53 | static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {} | 55 | static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {} |
54 | static inline void omap_vrfb_adjust_size(u16 *width, u16 *height, | 56 | static inline void omap_vrfb_adjust_size(u16 *width, u16 *height, |