blob: f04731820301c921f8d65c3d394f570ee543b34a [file] [log] [blame]
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001/*
2 * linux/arch/arm/plat-omap/common.c
3 *
4 * Code common to all OMAP machines.
Santosh Shilimkar44169072009-05-28 14:16:04 -07005 * 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 Lindgren5e1c5ff2005-07-10 19:58:15 +01009 *
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 Lindgren5e1c5ff2005-07-10 19:58:15 +010014#include <linux/kernel.h>
15#include <linux/init.h>
Russell Kingfced80c2008-09-06 12:10:45 +010016#include <linux/io.h>
Russell King71ee7da2010-05-23 10:18:16 +010017#include <linux/omapfb.h>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010018
Tony Lindgrence491cf2009-10-20 09:40:47 -070019#include <plat/common.h>
20#include <plat/board.h>
Russell King71ee7da2010-05-23 10:18:16 +010021#include <plat/vram.h>
Felipe Contreras90173882010-10-04 19:09:14 +030022#include <plat/dsp.h>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010023
Paul Walmsley44595982008-03-18 10:04:51 +020024
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010025#define NO_LENGTH_CHECK 0xffffffff
26
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010027struct omap_board_config_kernel *omap_board_config;
Tony Lindgren92105bb2005-09-07 17:20:26 +010028int omap_board_config_size;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010029
30static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
31{
32 struct omap_board_config_kernel *kinfo = NULL;
33 int i;
34
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010035 /* Try to find the config from the board-specific structures
36 * in the kernel. */
37 for (i = 0; i < omap_board_config_size; i++) {
38 if (omap_board_config[i].tag == tag) {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080039 if (skip == 0) {
40 kinfo = &omap_board_config[i];
41 break;
42 } else {
43 skip--;
44 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010045 }
46 }
47 if (kinfo == NULL)
48 return NULL;
49 return kinfo->data;
50}
51
52const void *__omap_get_config(u16 tag, size_t len, int nr)
53{
54 return get_config(tag, len, nr, NULL);
55}
56EXPORT_SYMBOL(__omap_get_config);
57
58const void *omap_get_var_config(u16 tag, size_t *len)
59{
60 return get_config(tag, NO_LENGTH_CHECK, 0, len);
61}
62EXPORT_SYMBOL(omap_get_var_config);
63
Russell King71ee7da2010-05-23 10:18:16 +010064void __init omap_reserve(void)
65{
Russell King98864ff2010-05-22 23:59:11 +010066 omapfb_reserve_sdram_memblock();
67 omap_vram_reserve_sdram_memblock();
Felipe Contreras90173882010-10-04 19:09:14 +030068 omap_dsp_reserve_sdram_memblock();
Russell King71ee7da2010-05-23 10:18:16 +010069}