Commit c40fae95 authored by Tony Lindgren's avatar Tony Lindgren Committed by Russell King

ARM: OMAP: Sync core code with linux-omap

This patch syncs omap specific core code with linux-omap.
Most of the changes are needed to fix bitrot caused by
driver updates in linux-omap tree.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent f4e4c324
...@@ -22,6 +22,7 @@ comment "OMAP Board Type" ...@@ -22,6 +22,7 @@ comment "OMAP Board Type"
config MACH_OMAP_INNOVATOR config MACH_OMAP_INNOVATOR
bool "TI Innovator" bool "TI Innovator"
depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX) depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX)
select OMAP_MCBSP
help help
TI OMAP 1510 or 1610 Innovator board support. Say Y here if you TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
have such a board. have such a board.
...@@ -29,6 +30,7 @@ config MACH_OMAP_INNOVATOR ...@@ -29,6 +30,7 @@ config MACH_OMAP_INNOVATOR
config MACH_OMAP_H2 config MACH_OMAP_H2
bool "TI H2 Support" bool "TI H2 Support"
depends on ARCH_OMAP1 && ARCH_OMAP16XX depends on ARCH_OMAP1 && ARCH_OMAP16XX
select OMAP_MCBSP
help help
TI OMAP 1610/1611B H2 board support. Say Y here if you have such TI OMAP 1610/1611B H2 board support. Say Y here if you have such
a board. a board.
...@@ -36,6 +38,7 @@ config MACH_OMAP_H2 ...@@ -36,6 +38,7 @@ config MACH_OMAP_H2
config MACH_OMAP_H3 config MACH_OMAP_H3
bool "TI H3 Support" bool "TI H3 Support"
depends on ARCH_OMAP1 && ARCH_OMAP16XX depends on ARCH_OMAP1 && ARCH_OMAP16XX
select GPIOEXPANDER_OMAP
help help
TI OMAP 1710 H3 board support. Say Y here if you have such TI OMAP 1710 H3 board support. Say Y here if you have such
a board. a board.
......
...@@ -37,4 +37,3 @@ led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o ...@@ -37,4 +37,3 @@ led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
obj-$(CONFIG_LEDS) += $(led-y) obj-$(CONFIG_LEDS) += $(led-y)
...@@ -24,35 +24,6 @@ ...@@ -24,35 +24,6 @@
#include <asm/arch/mux.h> #include <asm/arch/mux.h>
#include <asm/arch/gpio.h> #include <asm/arch/gpio.h>
#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
static u64 irda_dmamask = 0xffffffff;
static struct platform_device omap1610ir_device = {
.name = "omap1610-ir",
.id = -1,
.dev = {
.dma_mask = &irda_dmamask,
},
};
static void omap_init_irda(void)
{
/* FIXME define and use a boot tag, members something like:
* u8 uart; // uart1, or uart3
* ... but driver only handles uart3 for now
* s16 fir_sel; // gpio for SIR vs FIR
* ... may prefer a callback for SIR/MIR/FIR mode select;
* while h2 uses a GPIO, H3 uses a gpio expander
*/
if (machine_is_omap_h2()
|| machine_is_omap_h3())
(void) platform_device_register(&omap1610ir_device);
}
#else
static inline void omap_init_irda(void) {}
#endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
...@@ -90,6 +61,45 @@ static void omap_init_rtc(void) ...@@ -90,6 +61,45 @@ static void omap_init_rtc(void)
static inline void omap_init_rtc(void) {} static inline void omap_init_rtc(void) {}
#endif #endif
#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
#if defined(CONFIG_ARCH_OMAP15XX)
# define OMAP1_MBOX_SIZE 0x23
# define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1
#elif defined(CONFIG_ARCH_OMAP16XX)
# define OMAP1_MBOX_SIZE 0x2f
# define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
#endif
#define OMAP1_MBOX_BASE IO_ADDRESS(OMAP16XX_MAILBOX_BASE)
static struct resource mbox_resources[] = {
{
.start = OMAP1_MBOX_BASE,
.end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
.flags = IORESOURCE_MEM,
},
{
.start = INT_DSP_MAILBOX1,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mbox_device = {
.name = "mailbox",
.id = -1,
.num_resources = ARRAY_SIZE(mbox_resources),
.resource = mbox_resources,
};
static inline void omap_init_mbox(void)
{
platform_device_register(&mbox_device);
}
#else
static inline void omap_init_mbox(void) { }
#endif
#if defined(CONFIG_OMAP_STI) #if defined(CONFIG_OMAP_STI)
#define OMAP1_STI_BASE IO_ADDRESS(0xfffea000) #define OMAP1_STI_BASE IO_ADDRESS(0xfffea000)
...@@ -154,7 +164,8 @@ static int __init omap1_init_devices(void) ...@@ -154,7 +164,8 @@ static int __init omap1_init_devices(void)
/* please keep these calls, and their implementations above, /* please keep these calls, and their implementations above,
* in alphabetical order so they're easier to sort through. * in alphabetical order so they're easier to sort through.
*/ */
omap_init_irda();
omap_init_mbox();
omap_init_rtc(); omap_init_rtc();
omap_init_sti(); omap_init_sti();
......
...@@ -9,6 +9,7 @@ config ARCH_OMAP2420 ...@@ -9,6 +9,7 @@ config ARCH_OMAP2420
bool "OMAP2420 support" bool "OMAP2420 support"
depends on ARCH_OMAP24XX depends on ARCH_OMAP24XX
select OMAP_DM_TIMER select OMAP_DM_TIMER
select ARCH_OMAP_OTG
comment "OMAP Board Type" comment "OMAP Board Type"
depends on ARCH_OMAP2 depends on ARCH_OMAP2
......
...@@ -66,6 +66,40 @@ static void omap_init_i2c(void) {} ...@@ -66,6 +66,40 @@ static void omap_init_i2c(void) {}
#endif #endif
#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
#define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
static struct resource mbox_resources[] = {
{
.start = OMAP2_MBOX_BASE,
.end = OMAP2_MBOX_BASE + 0x11f,
.flags = IORESOURCE_MEM,
},
{
.start = INT_24XX_MAIL_U0_MPU,
.flags = IORESOURCE_IRQ,
},
{
.start = INT_24XX_MAIL_U3_MPU,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mbox_device = {
.name = "mailbox",
.id = -1,
.num_resources = ARRAY_SIZE(mbox_resources),
.resource = mbox_resources,
};
static inline void omap_init_mbox(void)
{
platform_device_register(&mbox_device);
}
#else
static inline void omap_init_mbox(void) { }
#endif
#if defined(CONFIG_OMAP_STI) #if defined(CONFIG_OMAP_STI)
#define OMAP2_STI_BASE IO_ADDRESS(0x48068000) #define OMAP2_STI_BASE IO_ADDRESS(0x48068000)
...@@ -111,29 +145,45 @@ static inline void omap_init_sti(void) {} ...@@ -111,29 +145,45 @@ static inline void omap_init_sti(void) {}
#define OMAP2_MCSPI1_BASE 0x48098000 #define OMAP2_MCSPI1_BASE 0x48098000
#define OMAP2_MCSPI2_BASE 0x4809a000 #define OMAP2_MCSPI2_BASE 0x4809a000
/* FIXME: use resources instead */
static struct omap2_mcspi_platform_config omap2_mcspi1_config = { static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
.base = io_p2v(OMAP2_MCSPI1_BASE),
.num_cs = 4, .num_cs = 4,
}; };
static struct resource omap2_mcspi1_resources[] = {
{
.start = OMAP2_MCSPI1_BASE,
.end = OMAP2_MCSPI1_BASE + 0xff,
.flags = IORESOURCE_MEM,
},
};
struct platform_device omap2_mcspi1 = { struct platform_device omap2_mcspi1 = {
.name = "omap2_mcspi", .name = "omap2_mcspi",
.id = 1, .id = 1,
.num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
.resource = omap2_mcspi1_resources,
.dev = { .dev = {
.platform_data = &omap2_mcspi1_config, .platform_data = &omap2_mcspi1_config,
}, },
}; };
static struct omap2_mcspi_platform_config omap2_mcspi2_config = { static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
.base = io_p2v(OMAP2_MCSPI2_BASE),
.num_cs = 2, .num_cs = 2,
}; };
static struct resource omap2_mcspi2_resources[] = {
{
.start = OMAP2_MCSPI2_BASE,
.end = OMAP2_MCSPI2_BASE + 0xff,
.flags = IORESOURCE_MEM,
},
};
struct platform_device omap2_mcspi2 = { struct platform_device omap2_mcspi2 = {
.name = "omap2_mcspi", .name = "omap2_mcspi",
.id = 2, .id = 2,
.num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
.resource = omap2_mcspi2_resources,
.dev = { .dev = {
.platform_data = &omap2_mcspi2_config, .platform_data = &omap2_mcspi2_config,
}, },
...@@ -157,10 +207,10 @@ static int __init omap2_init_devices(void) ...@@ -157,10 +207,10 @@ static int __init omap2_init_devices(void)
* in alphabetical order so they're easier to sort through. * in alphabetical order so they're easier to sort through.
*/ */
omap_init_i2c(); omap_init_i2c();
omap_init_mbox();
omap_init_mcspi(); omap_init_mcspi();
omap_init_sti(); omap_init_sti();
return 0; return 0;
} }
arch_initcall(omap2_init_devices); arch_initcall(omap2_init_devices);
...@@ -246,14 +246,22 @@ static int gpmc_cs_mem_enabled(int cs) ...@@ -246,14 +246,22 @@ static int gpmc_cs_mem_enabled(int cs)
return l & (1 << 6); return l & (1 << 6);
} }
static void gpmc_cs_set_reserved(int cs, int reserved) int gpmc_cs_set_reserved(int cs, int reserved)
{ {
if (cs > GPMC_CS_NUM)
return -ENODEV;
gpmc_cs_map &= ~(1 << cs); gpmc_cs_map &= ~(1 << cs);
gpmc_cs_map |= (reserved ? 1 : 0) << cs; gpmc_cs_map |= (reserved ? 1 : 0) << cs;
return 0;
} }
static int gpmc_cs_reserved(int cs) int gpmc_cs_reserved(int cs)
{ {
if (cs > GPMC_CS_NUM)
return -ENODEV;
return gpmc_cs_map & (1 << cs); return gpmc_cs_map & (1 << cs);
} }
......
...@@ -40,9 +40,21 @@ static struct map_desc omap2_io_desc[] __initdata = { ...@@ -40,9 +40,21 @@ static struct map_desc omap2_io_desc[] __initdata = {
.type = MT_DEVICE .type = MT_DEVICE
}, },
{ {
.virtual = L4_24XX_VIRT, .virtual = DSP_MEM_24XX_VIRT,
.pfn = __phys_to_pfn(L4_24XX_PHYS), .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
.length = L4_24XX_SIZE, .length = DSP_MEM_24XX_SIZE,
.type = MT_DEVICE
},
{
.virtual = DSP_IPI_24XX_VIRT,
.pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS),
.length = DSP_IPI_24XX_SIZE,
.type = MT_DEVICE
},
{
.virtual = DSP_MMU_24XX_VIRT,
.pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS),
.length = DSP_MMU_24XX_SIZE,
.type = MT_DEVICE .type = MT_DEVICE
} }
}; };
......
...@@ -62,6 +62,14 @@ config OMAP_MUX_WARNINGS ...@@ -62,6 +62,14 @@ config OMAP_MUX_WARNINGS
to change the pin multiplexing setup. When there are no warnings to change the pin multiplexing setup. When there are no warnings
printed, it's safe to deselect OMAP_MUX for your product. printed, it's safe to deselect OMAP_MUX for your product.
config OMAP_MCBSP
bool "McBSP support"
depends on ARCH_OMAP
default y
help
Say Y here if you want support for the OMAP Multichannel
Buffered Serial Port.
choice choice
prompt "System timer" prompt "System timer"
default OMAP_MPU_TIMER default OMAP_MPU_TIMER
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# #
# Common support # Common support
obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o mcbsp.o usb.o fb.o obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o \
usb.o fb.o
obj-m := obj-m :=
obj-n := obj-n :=
obj- := obj- :=
......
...@@ -93,8 +93,12 @@ static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out) ...@@ -93,8 +93,12 @@ static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
* in the kernel. */ * in the kernel. */
for (i = 0; i < omap_board_config_size; i++) { for (i = 0; i < omap_board_config_size; i++) {
if (omap_board_config[i].tag == tag) { if (omap_board_config[i].tag == tag) {
kinfo = &omap_board_config[i]; if (skip == 0) {
break; kinfo = &omap_board_config[i];
break;
} else {
skip--;
}
} }
} }
if (kinfo == NULL) if (kinfo == NULL)
......
...@@ -25,7 +25,71 @@ ...@@ -25,7 +25,71 @@
#include <asm/arch/gpio.h> #include <asm/arch/gpio.h>
#include <asm/arch/menelaus.h> #include <asm/arch/menelaus.h>
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
#include "../plat-omap/dsp/dsp_common.h"
static struct dsp_platform_data dsp_pdata = {
.kdev_list = LIST_HEAD_INIT(dsp_pdata.kdev_list),
};
static struct resource omap_dsp_resources[] = {
{
.name = "dsp_mmu",
.start = -1,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device omap_dsp_device = {
.name = "dsp",
.id = -1,
.num_resources = ARRAY_SIZE(omap_dsp_resources),
.resource = omap_dsp_resources,
.dev = {
.platform_data = &dsp_pdata,
},
};
static inline void omap_init_dsp(void)
{
struct resource *res;
int irq;
if (cpu_is_omap15xx())
irq = INT_1510_DSP_MMU;
else if (cpu_is_omap16xx())
irq = INT_1610_DSP_MMU;
else if (cpu_is_omap24xx())
irq = INT_24XX_DSP_MMU;
res = platform_get_resource_byname(&omap_dsp_device,
IORESOURCE_IRQ, "dsp_mmu");
res->start = irq;
platform_device_register(&omap_dsp_device);
}
int dsp_kfunc_device_register(struct dsp_kfunc_device *kdev)
{
static DEFINE_MUTEX(dsp_pdata_lock);
mutex_init(&kdev->lock);
mutex_lock(&dsp_pdata_lock);
list_add_tail(&kdev->entry, &dsp_pdata.kdev_list);
mutex_unlock(&dsp_pdata_lock);
return 0;
}
EXPORT_SYMBOL(dsp_kfunc_device_register);
#else
static inline void omap_init_dsp(void) { }
#endif /* CONFIG_OMAP_DSP */
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#define OMAP1_I2C_BASE 0xfffb3800 #define OMAP1_I2C_BASE 0xfffb3800
#define OMAP2_I2C_BASE1 0x48070000 #define OMAP2_I2C_BASE1 0x48070000
...@@ -376,7 +440,7 @@ static inline void omap_init_wdt(void) {} ...@@ -376,7 +440,7 @@ static inline void omap_init_wdt(void) {}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if defined(CONFIG_OMAP_RNG) || defined(CONFIG_OMAP_RNG_MODULE) #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
#ifdef CONFIG_ARCH_OMAP24XX #ifdef CONFIG_ARCH_OMAP24XX
#define OMAP_RNG_BASE 0x480A0000 #define OMAP_RNG_BASE 0x480A0000
...@@ -436,6 +500,7 @@ static int __init omap_init_devices(void) ...@@ -436,6 +500,7 @@ static int __init omap_init_devices(void)
/* please keep these calls, and their implementations above, /* please keep these calls, and their implementations above,
* in alphabetical order so they're easier to sort through. * in alphabetical order so they're easier to sort through.
*/ */
omap_init_dsp();
omap_init_i2c(); omap_init_i2c();
omap_init_kp(); omap_init_kp();
omap_init_mmc(); omap_init_mmc();
...@@ -446,4 +511,3 @@ static int __init omap_init_devices(void) ...@@ -446,4 +511,3 @@ static int __init omap_init_devices(void)
return 0; return 0;
} }
arch_initcall(omap_init_devices); arch_initcall(omap_init_devices);
...@@ -372,7 +372,7 @@ void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) ...@@ -372,7 +372,7 @@ void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
/* When the functional clock disappears, too quick writes seem to /* When the functional clock disappears, too quick writes seem to
* cause an abort. */ * cause an abort. */
__delay(15000); __delay(150000);
} }
#endif #endif
......
/*
* File: arch/arm/plat-omap/fb.c
*
* 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.
*/
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -34,25 +57,42 @@ static struct platform_device omap_fb_device = { ...@@ -34,25 +57,42 @@ static struct platform_device omap_fb_device = {
void omapfb_reserve_mem(void) void omapfb_reserve_mem(void)
{ {
const struct omap_fbmem_config *fbmem_conf; const struct omap_fbmem_config *fbmem_conf;
unsigned long total_size;
int i;
if (!omap_fb_sram_valid) {
/* FBMEM SRAM configuration was already found to be invalid.
* Ignore the whole configuration block. */
omapfb_config.mem_desc.region_cnt = 0;
return;
}
i = 0;
total_size = 0;
while ((fbmem_conf = omap_get_nr_config(OMAP_TAG_FBMEM,
struct omap_fbmem_config, i)) != NULL) {
unsigned long start;
unsigned long size;
omapfb_config.fbmem.fb_sram_start = omap_fb_sram_start; if (i == OMAPFB_PLANE_NUM) {
omapfb_config.fbmem.fb_sram_size = omap_fb_sram_size; printk(KERN_ERR "ignoring extra plane info\n");
break;
fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
if (fbmem_conf != NULL) {
/* indicate that the bootloader already initialized the
* fb device, so we'll skip that part in the fb driver
*/
omapfb_config.fbmem.fb_sdram_start = fbmem_conf->fb_sdram_start;
omapfb_config.fbmem.fb_sdram_size = fbmem_conf->fb_sdram_size;
if (fbmem_conf->fb_sdram_size) {
pr_info("Reserving %u bytes SDRAM for frame buffer\n",
fbmem_conf->fb_sdram_size);
reserve_bootmem(fbmem_conf->fb_sdram_start,
fbmem_conf->fb_sdram_size);
} }
start = fbmem_conf->start;
size = fbmem_conf->size;
omapfb_config.mem_desc.region[i].paddr = start;
omapfb_config.mem_desc.region[i].size = size;
if (omap_fb_sram_plane != i && start) {
reserve_bootmem(start, size);
total_size += size;
}
i++;
} }
omapfb_config.mem_desc.region_cnt = i;
if (total_size)
pr_info("Reserving %lu bytes SDRAM for frame buffer\n",
total_size);
} }
void omapfb_set_ctrl_platform_data(void *data) void omapfb_set_ctrl_platform_data(void *data)
......
...@@ -46,12 +46,13 @@ ...@@ -46,12 +46,13 @@
#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
static unsigned long omap_sram_start;
static unsigned long omap_sram_base; static unsigned long omap_sram_base;
static unsigned long omap_sram_size; static unsigned long omap_sram_size;
static unsigned long omap_sram_ceil; static unsigned long omap_sram_ceil;
unsigned long omap_fb_sram_start; int omap_fb_sram_plane = -1;
unsigned long omap_fb_sram_size; int omap_fb_sram_valid;
/* Depending on the target RAMFS firewall setup, the public usable amount of /* Depending on the target RAMFS firewall setup, the public usable amount of
* SRAM varies. The default accessable size for all device types is 2k. A GP * SRAM varies. The default accessable size for all device types is 2k. A GP
...@@ -77,30 +78,43 @@ static int is_sram_locked(void) ...@@ -77,30 +78,43 @@ static int is_sram_locked(void)
return 1; /* assume locked with no PPA or security driver */ return 1; /* assume locked with no PPA or security driver */
} }
void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, static int get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
unsigned long *start, unsigned long *size) unsigned long *start, int *plane_idx)
{ {
const struct omap_fbmem_config *fbmem_conf; const struct omap_fbmem_config *fbmem_conf;
unsigned long size = 0;
fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config); int i;
if (fbmem_conf != NULL) {
*start = fbmem_conf->fb_sram_start; i = 0;
*size = fbmem_conf->fb_sram_size; *start = 0;
} else { *plane_idx = -1;
*size = 0; while ((fbmem_conf = omap_get_nr_config(OMAP_TAG_FBMEM,
*start = 0; struct omap_fbmem_config, i)) != NULL) {
u32 paddr, end;
paddr = fbmem_conf->start;
end = fbmem_conf->start + fbmem_conf->size;
if (paddr > omap_sram_start &&
paddr < omap_sram_start + omap_sram_size) {
if (*plane_idx != -1 || paddr < start_avail ||
paddr == end ||
end > start_avail + size_avail) {
printk(KERN_ERR "invalid FB SRAM configuration");
*start = 0;
return -1;
}
*plane_idx = i;
*start = fbmem_conf->start;
size = fbmem_conf->size;
}
i++;
} }
if (*size && ( if (*plane_idx >= 0)
*start < start_avail || pr_info("Reserving %lu bytes SRAM frame buffer "
*start + *size > start_avail + size_avail)) { "for plane %d\n", size, *plane_idx);
printk(KERN_ERR "invalid FB SRAM configuration\n");
*start = start_avail;
*size = size_avail;
}
if (*size) return 0;
pr_info("Reserving %lu bytes SRAM for frame buffer\n", *size);
} }
/* /*
...@@ -111,16 +125,16 @@ void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, ...@@ -111,16 +125,16 @@ void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
*/ */
void __init omap_detect_sram(void) void __init omap_detect_sram(void)
{ {
unsigned long sram_start; unsigned long fb_sram_start;
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
if (is_sram_locked()) { if (is_sram_locked()) {
omap_sram_base = OMAP2_SRAM_PUB_VA; omap_sram_base = OMAP2_SRAM_PUB_VA;
sram_start = OMAP2_SRAM_PUB_PA; omap_sram_start = OMAP2_SRAM_PUB_PA;
omap_sram_size = 0x800; /* 2K */ omap_sram_size = 0x800; /* 2K */
} else { } else {
omap_sram_base = OMAP2_SRAM_VA; omap_sram_base = OMAP2_SRAM_VA;
sram_start = OMAP2_SRAM_PA; omap_sram_start = OMAP2_SRAM_PA;
if (cpu_is_omap242x()) if (cpu_is_omap242x())
omap_sram_size = 0xa0000; /* 640K */ omap_sram_size = 0xa0000; /* 640K */
else if (cpu_is_omap243x()) else if (cpu_is_omap243x())
...@@ -128,7 +142,7 @@ void __init omap_detect_sram(void) ...@@ -128,7 +142,7 @@ void __init omap_detect_sram(void)
} }
} else { } else {
omap_sram_base = OMAP1_SRAM_VA; omap_sram_base = OMAP1_SRAM_VA;
sram_start = OMAP1_SRAM_PA; omap_sram_start = OMAP1_SRAM_PA;
if (cpu_is_omap730()) if (cpu_is_omap730())
omap_sram_size = 0x32000; /* 200K */ omap_sram_size = 0x32000; /* 200K */
...@@ -144,12 +158,13 @@ void __init omap_detect_sram(void) ...@@ -144,12 +158,13 @@ void __init omap_detect_sram(void)
omap_sram_size = 0x4000; omap_sram_size = 0x4000;
} }
} }
get_fb_sram_conf(sram_start + SRAM_BOOTLOADER_SZ, if (get_fb_sram_conf(omap_sram_start + SRAM_BOOTLOADER_SZ,
omap_sram_size - SRAM_BOOTLOADER_SZ, omap_sram_size - SRAM_BOOTLOADER_SZ,
&omap_fb_sram_start, &omap_fb_sram_size); &fb_sram_start, &omap_fb_sram_plane) == 0)
if (omap_fb_sram_size) omap_fb_sram_valid = 1;
omap_sram_size -= sram_start + omap_sram_size - if (omap_fb_sram_valid && omap_fb_sram_plane >= 0)
omap_fb_sram_start; omap_sram_size -= omap_sram_start + omap_sram_size -
fb_sram_start;
omap_sram_ceil = omap_sram_base + omap_sram_size; omap_sram_ceil = omap_sram_base + omap_sram_size;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment