Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 1 | /* |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 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 | |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 22 | #include <linux/module.h> |
| 23 | #include <linux/kernel.h> |
Andrea Righi | 27ac792 | 2008-07-23 21:28:13 -0700 | [diff] [blame] | 24 | #include <linux/mm.h> |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 25 | #include <linux/init.h> |
| 26 | #include <linux/platform_device.h> |
Russell King | 98864ff | 2010-05-22 23:59:11 +0100 | [diff] [blame] | 27 | #include <linux/memblock.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 28 | #include <linux/io.h> |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 29 | #include <linux/omapfb.h> |
Tomi Valkeinen | 3f5ba55 | 2012-11-09 15:41:21 +0200 | [diff] [blame] | 30 | #include <linux/dma-mapping.h> |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 31 | |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 32 | #include <asm/mach/map.h> |
| 33 | |
Tony Lindgren | 16d60bb | 2012-12-16 11:39:40 -0800 | [diff] [blame] | 34 | #include "soc.h" |
Archit Taneja | fc8df75 | 2013-09-16 12:48:30 +0530 | [diff] [blame] | 35 | #include "display.h" |
Tomi Valkeinen | 406c856 | 2012-10-08 14:35:44 +0300 | [diff] [blame] | 36 | |
| 37 | #ifdef CONFIG_OMAP2_VRFB |
| 38 | |
| 39 | /* |
| 40 | * The first memory resource is the register region for VRFB, |
| 41 | * the rest are VRFB virtual memory areas for each VRFB context. |
| 42 | */ |
| 43 | |
| 44 | static const struct resource omap2_vrfb_resources[] = { |
| 45 | DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"), |
| 46 | DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"), |
| 47 | DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"), |
| 48 | DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"), |
| 49 | DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"), |
| 50 | }; |
| 51 | |
| 52 | static const struct resource omap3_vrfb_resources[] = { |
| 53 | DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"), |
| 54 | DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"), |
| 55 | DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"), |
| 56 | DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"), |
| 57 | DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"), |
| 58 | DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"), |
| 59 | DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"), |
| 60 | DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"), |
| 61 | DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"), |
| 62 | DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"), |
| 63 | DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"), |
| 64 | DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"), |
| 65 | DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"), |
| 66 | }; |
| 67 | |
Archit Taneja | fc8df75 | 2013-09-16 12:48:30 +0530 | [diff] [blame] | 68 | int __init omap_init_vrfb(void) |
Tomi Valkeinen | 406c856 | 2012-10-08 14:35:44 +0300 | [diff] [blame] | 69 | { |
| 70 | struct platform_device *pdev; |
| 71 | const struct resource *res; |
| 72 | unsigned int num_res; |
| 73 | |
| 74 | if (cpu_is_omap24xx()) { |
| 75 | res = omap2_vrfb_resources; |
| 76 | num_res = ARRAY_SIZE(omap2_vrfb_resources); |
| 77 | } else if (cpu_is_omap34xx()) { |
| 78 | res = omap3_vrfb_resources; |
| 79 | num_res = ARRAY_SIZE(omap3_vrfb_resources); |
| 80 | } else { |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | pdev = platform_device_register_resndata(NULL, "omapvrfb", -1, |
| 85 | res, num_res, NULL, 0); |
| 86 | |
Thomas Meyer | 1261674 | 2013-06-01 11:44:44 +0200 | [diff] [blame] | 87 | return PTR_RET(pdev); |
Tomi Valkeinen | 406c856 | 2012-10-08 14:35:44 +0300 | [diff] [blame] | 88 | } |
Archit Taneja | fc8df75 | 2013-09-16 12:48:30 +0530 | [diff] [blame] | 89 | #else |
| 90 | int __init omap_init_vrfb(void) { return 0; } |
Tomi Valkeinen | 406c856 | 2012-10-08 14:35:44 +0300 | [diff] [blame] | 91 | #endif |
| 92 | |
Tony Lindgren | 16d60bb | 2012-12-16 11:39:40 -0800 | [diff] [blame] | 93 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 94 | |
| 95 | static u64 omap_fb_dma_mask = ~(u32)0; |
| 96 | static struct omapfb_platform_data omapfb_config; |
| 97 | |
| 98 | static struct platform_device omap_fb_device = { |
| 99 | .name = "omapfb", |
| 100 | .id = -1, |
| 101 | .dev = { |
| 102 | .dma_mask = &omap_fb_dma_mask, |
Tomi Valkeinen | 3f5ba55 | 2012-11-09 15:41:21 +0200 | [diff] [blame] | 103 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 104 | .platform_data = &omapfb_config, |
| 105 | }, |
| 106 | .num_resources = 0, |
| 107 | }; |
| 108 | |
Archit Taneja | fc8df75 | 2013-09-16 12:48:30 +0530 | [diff] [blame] | 109 | int __init omap_init_fb(void) |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 110 | { |
| 111 | return platform_device_register(&omap_fb_device); |
| 112 | } |
Archit Taneja | fc8df75 | 2013-09-16 12:48:30 +0530 | [diff] [blame] | 113 | #else |
| 114 | int __init omap_init_fb(void) { return 0; } |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 115 | #endif |