common.c 1.6 KB
Newer Older
1 2 3 4
/*
 * linux/arch/arm/plat-omap/common.c
 *
 * Code common to all OMAP machines.
5 6 7 8
 * The file is created by Tony Lindgren <tony@atomide.com>
 *
 * Copyright (C) 2009 Texas Instruments
 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
9 10 11 12 13 14 15
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/kernel.h>
#include <linux/init.h>
16
#include <linux/io.h>
17
#include <linux/omapfb.h>
18

19 20
#include <plat/common.h>
#include <plat/board.h>
21
#include <plat/vram.h>
22

23

24 25 26
#define NO_LENGTH_CHECK 0xffffffff

struct omap_board_config_kernel *omap_board_config;
27
int omap_board_config_size;
28 29 30 31 32 33 34 35 36 37

static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
{
	struct omap_board_config_kernel *kinfo = NULL;
	int i;

	/* Try to find the config from the board-specific structures
	 * in the kernel. */
	for (i = 0; i < omap_board_config_size; i++) {
		if (omap_board_config[i].tag == tag) {
38 39 40 41 42 43
			if (skip == 0) {
				kinfo = &omap_board_config[i];
				break;
			} else {
				skip--;
			}
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
		}
	}
	if (kinfo == NULL)
		return NULL;
	return kinfo->data;
}

const void *__omap_get_config(u16 tag, size_t len, int nr)
{
        return get_config(tag, len, nr, NULL);
}
EXPORT_SYMBOL(__omap_get_config);

const void *omap_get_var_config(u16 tag, size_t *len)
{
        return get_config(tag, NO_LENGTH_CHECK, 0, len);
}
EXPORT_SYMBOL(omap_get_var_config);

63 64
void __init omap_reserve(void)
{
65 66
	omapfb_reserve_sdram_memblock();
	omap_vram_reserve_sdram_memblock();
67
}