Merge tag 'dt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[deliverable/linux.git] / arch / arm / mach-omap2 / fb.c
CommitLineData
c40fae95 1/*
c40fae95
TL
2 * Framebuffer device registration for TI OMAP platforms
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 * Author: Imre Deak <imre.deak@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
0dc5e77c
TL
22#include <linux/module.h>
23#include <linux/kernel.h>
27ac792c 24#include <linux/mm.h>
0dc5e77c
TL
25#include <linux/init.h>
26#include <linux/platform_device.h>
98864ff5 27#include <linux/memblock.h>
fced80c7 28#include <linux/io.h>
91773a00 29#include <linux/omapfb.h>
3f5ba55e 30#include <linux/dma-mapping.h>
0dc5e77c 31
0dc5e77c
TL
32#include <asm/mach/map.h>
33
16d60bb8 34#include "soc.h"
406c8563
TV
35
36#ifdef CONFIG_OMAP2_VRFB
37
38/*
39 * The first memory resource is the register region for VRFB,
40 * the rest are VRFB virtual memory areas for each VRFB context.
41 */
42
43static const struct resource omap2_vrfb_resources[] = {
44 DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"),
45 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
46 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
47 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
48 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
49};
50
51static const struct resource omap3_vrfb_resources[] = {
52 DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"),
53 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
54 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
55 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
56 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
57 DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"),
58 DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"),
59 DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"),
60 DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"),
61 DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"),
62 DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"),
63 DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"),
64 DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
65};
66
67static int __init omap_init_vrfb(void)
68{
69 struct platform_device *pdev;
70 const struct resource *res;
71 unsigned int num_res;
72
73 if (cpu_is_omap24xx()) {
74 res = omap2_vrfb_resources;
75 num_res = ARRAY_SIZE(omap2_vrfb_resources);
76 } else if (cpu_is_omap34xx()) {
77 res = omap3_vrfb_resources;
78 num_res = ARRAY_SIZE(omap3_vrfb_resources);
79 } else {
80 return 0;
81 }
82
83 pdev = platform_device_register_resndata(NULL, "omapvrfb", -1,
84 res, num_res, NULL, 0);
85
86 if (IS_ERR(pdev))
87 return PTR_ERR(pdev);
88 else
89 return 0;
90}
91
b76c8b19 92omap_arch_initcall(omap_init_vrfb);
406c8563
TV
93#endif
94
16d60bb8 95#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
b39a982d
TV
96
97static u64 omap_fb_dma_mask = ~(u32)0;
98static struct omapfb_platform_data omapfb_config;
99
100static struct platform_device omap_fb_device = {
101 .name = "omapfb",
102 .id = -1,
103 .dev = {
104 .dma_mask = &omap_fb_dma_mask,
3f5ba55e 105 .coherent_dma_mask = DMA_BIT_MASK(32),
b39a982d
TV
106 .platform_data = &omapfb_config,
107 },
108 .num_resources = 0,
109};
110
375c324b 111static int __init omap_init_fb(void)
b39a982d
TV
112{
113 return platform_device_register(&omap_fb_device);
114}
115
b76c8b19 116omap_arch_initcall(omap_init_fb);
0dc5e77c 117
0dc5e77c 118#endif
This page took 0.556966 seconds and 5 git commands to generate.