Remove preallocation of framebuffer and GPU memory in favor of being nice and dynamic. Note that GPU memory reserved is entirely down to the MMU now, and framebuffer memory is "size of framebuffer" rounded up to 1MB block.

Everything still works.

Includes a Wild mashup of Freescale ENGR00143019 which concludes GPU MMU support for the platform.
This commit is contained in:
Matt Sealey
2011-06-28 15:08:08 -05:00
parent e26d3e911c
commit 2811c4a4ef
7 changed files with 18 additions and 102 deletions

View File

@@ -22,6 +22,7 @@
#include <linux/delay.h>
#include <linux/mxc_scc2_driver.h>
#include <linux/iram_alloc.h>
#include <linux/fsl_devices.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/gpio.h>
@@ -1113,6 +1114,11 @@ struct platform_device gpu_device = {
.resource = mxc_gpu_resources,
};
struct mxc_gpu_platform_data mxc_gpu_data = {
.z160_revision = 0,
.enable_mmu = 1,
};
static struct resource mxc_gpu2d_resources[] = {
{
.start = MX51_GPU2D_BASE_ADDR,

View File

@@ -72,3 +72,5 @@ extern struct platform_device mxc_pxp_device;
extern struct platform_device mxc_pxp_client_device;
extern struct platform_device epdc_device;
extern struct platform_device elcdif_device;
extern struct mxc_gpu_platform_data mxc_gpu_data;

View File

@@ -280,71 +280,17 @@ static void __init mx51_efikamx_board_init(void)
}
}
/* is in mx51_efikamx_cpu.c */
static struct sys_timer mx51_efikamx_timer = {
.init = mx51_efikamx_timer_init,
};
static void __init mx51_efikamx_fixup(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
char *str;
struct tag *t;
struct tag *mem_tag = 0;
int total_mem = SZ_512M;
int left_mem = 0;
int gpu_mem = SZ_64M;
int fb_mem = SZ_32M;
mxc_set_cpu_type(MXC_CPU_MX51);
get_cpu_wp = mx51_efikamx_get_cpu_wp;
set_num_cpu_wp = mx51_efikamx_set_num_cpu_wp;
for_each_tag(mem_tag, tags) {
if (mem_tag->hdr.tag == ATAG_MEM) {
total_mem = mem_tag->u.mem.size;
left_mem = total_mem - gpu_mem - fb_mem;
break;
}
}
for_each_tag(t, tags) {
if (t->hdr.tag == ATAG_CMDLINE) {
str = t->u.cmdline.cmdline;
str = strstr(str, "mem=");
if (str != NULL) {
str += 4;
left_mem = memparse(str, &str);
if (left_mem == 0 || left_mem > total_mem)
left_mem = total_mem - gpu_mem - fb_mem;
}
str = t->u.cmdline.cmdline;
str = strstr(str, "gpu_memory=");
if (str != NULL) {
str += 11;
gpu_mem = memparse(str, &str);
}
break;
}
}
if (mem_tag) {
fb_mem = total_mem - left_mem - gpu_mem;
if (fb_mem < 0) {
gpu_mem = total_mem - left_mem;
fb_mem = 0;
}
mem_tag->u.mem.size = left_mem;
mx51_efikamx_display_adjust_mem(mem_tag->u.mem.start + left_mem,
gpu_mem,
fb_mem);
}
}

View File

@@ -67,7 +67,6 @@ extern void mx51_efikamx_set_num_cpu_wp(int num);
extern int mx51_efikamx_reboot(void);
extern void mx51_efikamx_power_off(void);
extern void mx51_efikamx_display_adjust_mem(int gpu_start, int gpu_mem, int fb_mem);
#define DBG(x) { printk(KERN_INFO "Efika MX: "); printk x ; }
extern void mx51_efikamx_wifi_power(int state);

View File

@@ -129,9 +129,6 @@ static void mx51_efikasb_lvds_reset(void)
}
static struct siihdmi_platform_data mx51_efikamx_siihdmi_data = {
.reset = mx51_efikamx_display_reset,
@@ -177,13 +174,6 @@ static struct i2c_board_info mx51_efikamx_i2c_display[] __initdata = {
},
};
static struct resource mxcfb_resources[] = {
[0] = {
.flags = IORESOURCE_MEM,
},
};
static struct mxc_fb_platform_data mx51_efikamx_display_data[] = {
[EFIKAMX_HDMI_DISPLAY_ID] = {
.interface_pix_fmt = IPU_PIX_FMT_RGB24,
@@ -256,7 +246,7 @@ void __init mx51_efikamx_init_display(void)
mxc_register_device(&mxc_ipu_device, &mxc_ipu_data);
mxc_register_device(&mxcvpu_device, &mxc_vpu_data);
mxc_register_device(&gpu_device, NULL);
mxc_register_device(&gpu_device, &mxc_gpu_data);
mxc_register_device(&mxc_v4l2out_device, NULL);
/* display_id is specific to the board, and configures the single controller
@@ -264,8 +254,6 @@ void __init mx51_efikamx_init_display(void)
* supported)
*/
mxc_ipu_data.di_clk[display_id] = clk_get(NULL, mxcfb_clocks[display_id]);
mxc_fb_devices[display_id].num_resources = ARRAY_SIZE(mxcfb_resources);
mxc_fb_devices[display_id].resource = mxcfb_resources;
mxc_register_device(&mxc_fb_devices[display_id], &mx51_efikamx_display_data[display_id]);
i2c_register_board_info(1, &mx51_efikamx_i2c_display[display_id], 1);
@@ -273,20 +261,3 @@ void __init mx51_efikamx_init_display(void)
/* video overlay */
mxc_register_device(&mxc_fb_devices[2], NULL);
}
void __init mx51_efikamx_display_adjust_mem(int gpu_start, int gpu_mem, int fb_mem)
{
/*reserve memory for gpu*/
gpu_device.resource[5].start = gpu_start;
gpu_device.resource[5].end =
gpu_device.resource[5].start + gpu_mem - 1;
if (fb_mem) {
mxcfb_resources[0].start =
gpu_device.resource[5].end + 1;
mxcfb_resources[0].end =
mxcfb_resources[0].start + fb_mem - 1;
} else {
mxcfb_resources[0].start = 0;
mxcfb_resources[0].end = 0;
}
}

View File

@@ -1481,13 +1481,10 @@ static int mxcfb_resume(struct platform_device *pdev)
*/
static int mxcfb_map_video_memory(struct fb_info *fbi)
{
if (fbi->fix.smem_len < fbi->var.yres_virtual * fbi->fix.line_length)
fbi->fix.smem_len = fbi->var.yres_virtual *
fbi->fix.line_length;
fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;
fbi->fix.smem_len = (fbi->fix.smem_len + SZ_1M - 1) & ~(SZ_1M - 1);
/* line_length is 0 sometimes (BAH!) so temporarily hack it so this doesn't OOPS */
if (fbi->fix.smem_len)
fbi->screen_base = dma_alloc_writecombine(fbi->device,
fbi->screen_base = dma_alloc_writecombine(fbi->device,
fbi->fix.smem_len,
(dma_addr_t *)&fbi->fix.smem_start,
GFP_DMA);
@@ -1634,7 +1631,6 @@ static int mxcfb_probe(struct platform_device *pdev)
struct fb_info *fbi;
struct mxcfb_info *mxcfbi;
struct mxc_fb_platform_data *plat_data = pdev->dev.platform_data;
struct resource *res;
char *options;
char name[] = "mxcdi0fb";
int ret = 0;
@@ -1725,13 +1721,6 @@ static int mxcfb_probe(struct platform_device *pdev)
}
ipu_disable_irq(mxcfbi->ipu_ch_irq);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res && res->end) {
fbi->fix.smem_len = res->end - res->start + 1;
fbi->fix.smem_start = res->start;
fbi->screen_base = ioremap(fbi->fix.smem_start, fbi->fix.smem_len);
}
/* Need dummy values until real panel is configured */
fbi->var.xres = 640;
fbi->var.yres = 480;
@@ -1765,9 +1754,8 @@ static int mxcfb_probe(struct platform_device *pdev)
mxcfb_set_fix(fbi);
/* alocate fb first */
if (!res || !res->end)
if (mxcfb_map_video_memory(fbi) < 0)
/* allocate fb first */
if (mxcfb_map_video_memory(fbi) < 0)
return -ENOMEM;
ret = register_framebuffer(fbi);

View File

@@ -146,6 +146,10 @@ struct fsl_ata_platform_data {
char *core_reg;
};
struct mxc_gpu_platform_data {
int z160_revision;
int enable_mmu;
};
struct mpc8xx_pcmcia_ops {
void(*hw_ctrl)(int slot, int enable);