2 * File: arch/arm/plat-omap/fb.c
4 * Framebuffer device registration for TI OMAP platforms
6 * Copyright (C) 2006 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include <linux/module.h>
25 #include <linux/kernel.h>
27 #include <linux/init.h>
28 #include <linux/platform_device.h>
29 #include <linux/memblock.h>
31 #include <linux/omapfb.h>
32 #include <linux/dma-mapping.h>
34 #include <mach/hardware.h>
35 #include <asm/mach/map.h>
39 #ifdef CONFIG_OMAP2_VRFB
42 * The first memory resource is the register region for VRFB,
43 * the rest are VRFB virtual memory areas for each VRFB context.
46 static const struct resource omap2_vrfb_resources[] = {
47 DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"),
48 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
49 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
50 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
51 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
54 static const struct resource omap3_vrfb_resources[] = {
55 DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"),
56 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
57 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
58 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
59 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
60 DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"),
61 DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"),
62 DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"),
63 DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"),
64 DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"),
65 DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"),
66 DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"),
67 DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
70 static int __init omap_init_vrfb(void)
72 struct platform_device *pdev;
73 const struct resource *res;
76 if (cpu_is_omap24xx()) {
77 res = omap2_vrfb_resources;
78 num_res = ARRAY_SIZE(omap2_vrfb_resources);
79 } else if (cpu_is_omap34xx()) {
80 res = omap3_vrfb_resources;
81 num_res = ARRAY_SIZE(omap3_vrfb_resources);
86 pdev = platform_device_register_resndata(NULL, "omapvrfb", -1,
87 res, num_res, NULL, 0);
95 arch_initcall(omap_init_vrfb);
98 #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
100 static bool omapfb_lcd_configured;
101 static struct omapfb_platform_data omapfb_config;
103 static u64 omap_fb_dma_mask = ~(u32)0;
105 static struct platform_device omap_fb_device = {
109 .dma_mask = &omap_fb_dma_mask,
110 .coherent_dma_mask = DMA_BIT_MASK(32),
111 .platform_data = &omapfb_config,
116 void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
118 omapfb_config.lcd = *config;
119 omapfb_lcd_configured = true;
122 static int __init omap_init_fb(void)
125 * If the board file has not set the lcd config with
126 * omapfb_set_lcd_config(), don't bother registering the omapfb device
128 if (!omapfb_lcd_configured)
131 return platform_device_register(&omap_fb_device);
134 arch_initcall(omap_init_fb);
136 #elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
138 static u64 omap_fb_dma_mask = ~(u32)0;
139 static struct omapfb_platform_data omapfb_config;
141 static struct platform_device omap_fb_device = {
145 .dma_mask = &omap_fb_dma_mask,
146 .coherent_dma_mask = DMA_BIT_MASK(32),
147 .platform_data = &omapfb_config,
152 static int __init omap_init_fb(void)
154 return platform_device_register(&omap_fb_device);
157 arch_initcall(omap_init_fb);
161 void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)