| 
									
										
										
										
											2006-12-07 13:58:10 -08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Framebuffer device registration for TI OMAP platforms | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2006 Nokia Corporation | 
					
						
							|  |  |  |  * Author: Imre Deak <imre.deak@nokia.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify it | 
					
						
							|  |  |  |  * under the terms of the GNU General Public License as published by the | 
					
						
							|  |  |  |  * Free Software Foundation; either version 2 of the License, or (at your | 
					
						
							|  |  |  |  * option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, but | 
					
						
							|  |  |  |  * WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
					
						
							|  |  |  |  * General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License along | 
					
						
							|  |  |  |  * with this program; if not, write to the Free Software Foundation, Inc., | 
					
						
							|  |  |  |  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-02 17:46:26 +01:00
										 |  |  | #include <linux/module.h>
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-23 21:28:13 -07:00
										 |  |  | #include <linux/mm.h>
 | 
					
						
							| 
									
										
										
										
											2006-04-02 17:46:26 +01:00
										 |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							| 
									
										
										
										
											2010-05-22 23:59:11 +01:00
										 |  |  | #include <linux/memblock.h>
 | 
					
						
							| 
									
										
										
										
											2008-09-06 12:10:45 +01:00
										 |  |  | #include <linux/io.h>
 | 
					
						
							| 
									
										
										
										
											2009-08-03 15:06:36 +03:00
										 |  |  | #include <linux/omapfb.h>
 | 
					
						
							| 
									
										
										
										
											2012-11-09 15:41:21 +02:00
										 |  |  | #include <linux/dma-mapping.h>
 | 
					
						
							| 
									
										
										
										
											2006-04-02 17:46:26 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <asm/mach/map.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-16 11:39:40 -08:00
										 |  |  | #include "soc.h"
 | 
					
						
							| 
									
										
										
										
											2013-09-16 12:48:30 +05:30
										 |  |  | #include "display.h"
 | 
					
						
							| 
									
										
										
										
											2012-10-08 14:35:44 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_OMAP2_VRFB
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * The first memory resource is the register region for VRFB, | 
					
						
							|  |  |  |  * the rest are VRFB virtual memory areas for each VRFB context. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct resource omap2_vrfb_resources[] = { | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct resource omap3_vrfb_resources[] = { | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"), | 
					
						
							|  |  |  | 	DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-16 12:48:30 +05:30
										 |  |  | int __init omap_init_vrfb(void) | 
					
						
							| 
									
										
										
										
											2012-10-08 14:35:44 +03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct platform_device *pdev; | 
					
						
							|  |  |  | 	const struct resource *res; | 
					
						
							|  |  |  | 	unsigned int num_res; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (cpu_is_omap24xx()) { | 
					
						
							|  |  |  | 		res = omap2_vrfb_resources; | 
					
						
							|  |  |  | 		num_res = ARRAY_SIZE(omap2_vrfb_resources); | 
					
						
							|  |  |  | 	} else if (cpu_is_omap34xx()) { | 
					
						
							|  |  |  | 		res = omap3_vrfb_resources; | 
					
						
							|  |  |  | 		num_res = ARRAY_SIZE(omap3_vrfb_resources); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pdev = platform_device_register_resndata(NULL, "omapvrfb", -1, | 
					
						
							|  |  |  | 			res, num_res, NULL, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-01 11:44:44 +02:00
										 |  |  | 	return PTR_RET(pdev); | 
					
						
							| 
									
										
										
										
											2012-10-08 14:35:44 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2013-09-16 12:48:30 +05:30
										 |  |  | #else
 | 
					
						
							|  |  |  | int __init omap_init_vrfb(void) { return 0; } | 
					
						
							| 
									
										
										
										
											2012-10-08 14:35:44 +03:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-16 11:39:40 -08:00
										 |  |  | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
 | 
					
						
							| 
									
										
										
										
											2009-08-04 16:12:50 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | static u64 omap_fb_dma_mask = ~(u32)0; | 
					
						
							|  |  |  | static struct omapfb_platform_data omapfb_config; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device omap_fb_device = { | 
					
						
							|  |  |  | 	.name		= "omapfb", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask		= &omap_fb_dma_mask, | 
					
						
							| 
									
										
										
										
											2012-11-09 15:41:21 +02:00
										 |  |  | 		.coherent_dma_mask	= DMA_BIT_MASK(32), | 
					
						
							| 
									
										
										
										
											2009-08-04 16:12:50 +03:00
										 |  |  | 		.platform_data		= &omapfb_config, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources = 0, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-16 12:48:30 +05:30
										 |  |  | int __init omap_init_fb(void) | 
					
						
							| 
									
										
										
										
											2009-08-04 16:12:50 +03:00
										 |  |  | { | 
					
						
							|  |  |  | 	return platform_device_register(&omap_fb_device); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2013-09-16 12:48:30 +05:30
										 |  |  | #else
 | 
					
						
							|  |  |  | int __init omap_init_fb(void) { return 0; } | 
					
						
							| 
									
										
										
										
											2006-04-02 17:46:26 +01:00
										 |  |  | #endif
 |