Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/plat-omap/common.c |
| 3 | * |
| 4 | * Code common to all OMAP machines. |
Santosh Shilimkar | 4416907 | 2009-05-28 14:16:04 -0700 | [diff] [blame] | 5 | * The file is created by Tony Lindgren <tony@atomide.com> |
| 6 | * |
| 7 | * Copyright (C) 2009 Texas Instruments |
| 8 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/init.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 16 | #include <linux/io.h> |
Tony Lindgren | 16edc3d | 2011-12-06 05:45:37 +0100 | [diff] [blame] | 17 | #include <linux/dma-mapping.h> |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 18 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 19 | #include <plat/common.h> |
| 20 | #include <plat/board.h> |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 21 | #include <plat/vram.h> |
Felipe Contreras | 9017388 | 2010-10-04 19:09:14 +0300 | [diff] [blame] | 22 | #include <plat/dsp.h> |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 23 | |
Santosh Shilimkar | 259ee57 | 2011-06-06 20:28:23 +0530 | [diff] [blame] | 24 | #include <plat/omap-secure.h> |
| 25 | |
Paul Walmsley | 4459598 | 2008-03-18 10:04:51 +0200 | [diff] [blame] | 26 | |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 27 | #define NO_LENGTH_CHECK 0xffffffff |
| 28 | |
Uwe Kleine-König | 119c4c2 | 2011-02-09 21:40:09 +0100 | [diff] [blame] | 29 | struct omap_board_config_kernel *omap_board_config __initdata; |
Tony Lindgren | 92105bb | 2005-09-07 17:20:26 +0100 | [diff] [blame] | 30 | int omap_board_config_size; |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 31 | |
Uwe Kleine-König | 119c4c2 | 2011-02-09 21:40:09 +0100 | [diff] [blame] | 32 | static const void *__init get_config(u16 tag, size_t len, |
| 33 | int skip, size_t *len_out) |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 34 | { |
| 35 | struct omap_board_config_kernel *kinfo = NULL; |
| 36 | int i; |
| 37 | |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 38 | /* Try to find the config from the board-specific structures |
| 39 | * in the kernel. */ |
| 40 | for (i = 0; i < omap_board_config_size; i++) { |
| 41 | if (omap_board_config[i].tag == tag) { |
Tony Lindgren | c40fae9 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 42 | if (skip == 0) { |
| 43 | kinfo = &omap_board_config[i]; |
| 44 | break; |
| 45 | } else { |
| 46 | skip--; |
| 47 | } |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 48 | } |
| 49 | } |
| 50 | if (kinfo == NULL) |
| 51 | return NULL; |
| 52 | return kinfo->data; |
| 53 | } |
| 54 | |
Uwe Kleine-König | 2354f64 | 2011-02-09 21:40:08 +0100 | [diff] [blame] | 55 | const void *__init __omap_get_config(u16 tag, size_t len, int nr) |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 56 | { |
| 57 | return get_config(tag, len, nr, NULL); |
| 58 | } |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 59 | |
Uwe Kleine-König | 2354f64 | 2011-02-09 21:40:08 +0100 | [diff] [blame] | 60 | const void *__init omap_get_var_config(u16 tag, size_t *len) |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 61 | { |
| 62 | return get_config(tag, NO_LENGTH_CHECK, 0, len); |
| 63 | } |
Tony Lindgren | 5e1c5ff | 2005-07-10 19:58:15 +0100 | [diff] [blame] | 64 | |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 65 | void __init omap_reserve(void) |
| 66 | { |
Russell King | 98864ff | 2010-05-22 23:59:11 +0100 | [diff] [blame] | 67 | omap_vram_reserve_sdram_memblock(); |
Felipe Contreras | 9017388 | 2010-10-04 19:09:14 +0300 | [diff] [blame] | 68 | omap_dsp_reserve_sdram_memblock(); |
Santosh Shilimkar | 259ee57 | 2011-06-06 20:28:23 +0530 | [diff] [blame] | 69 | omap_secure_ram_reserve_memblock(); |
Santosh Shilimkar | 2ec1fc4 | 2012-02-02 19:33:55 +0530 | [diff] [blame] | 70 | omap_barrier_reserve_memblock(); |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 71 | } |
Nicolas Pitre | 7146182 | 2011-09-14 17:06:22 -0400 | [diff] [blame] | 72 | |
| 73 | void __init omap_init_consistent_dma_size(void) |
| 74 | { |
| 75 | #ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE |
| 76 | init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20); |
| 77 | #endif |
| 78 | } |