fmem: Add reserved_size to fmem

Due to a limitation in how the video hardware is able
to access memory, fmem needs to be able to allocate a
physically contiguous block of memory that can be split into
two pieces. One piece will be managed by fmem
while the other piece (reserved) will not be handled by fmem.
The hardware limitation requires the reserved part to be at
a lower address than the other piece managed by fmem.

Add a new parameter to fmem that allows platform
data to specify the size of the piece that should not
be managed by fmem.

Change-Id: I910680ca72233de9cef91ac3262a078a36f1b1fd
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
This commit is contained in:
Larry Bassel
2012-02-02 09:09:43 -08:00
committed by Olav Haugan
parent 653c46c43f
commit cf10e5846d
2 changed files with 10 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
/* /*
* *
* Copyright (c) 2011, Code Aurora Forum. All rights reserved. * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@@ -51,12 +51,14 @@ static int fmem_probe(struct platform_device *pdev)
{ {
struct fmem_platform_data *pdata = pdev->dev.platform_data; struct fmem_platform_data *pdata = pdev->dev.platform_data;
if (!pdata->size) fmem_data.phys = pdata->phys + pdata->reserved_size;
fmem_data.size = pdata->size - pdata->reserved_size;
fmem_data.reserved_size = pdata->reserved_size;
if (!fmem_data.size)
return -ENODEV; return -ENODEV;
fmem_data.phys = pdata->phys; fmem_data.area = get_vm_area(fmem_data.size, VM_IOREMAP);
fmem_data.size = pdata->size;
fmem_data.area = get_vm_area(pdata->size, VM_IOREMAP);
if (!fmem_data.area) if (!fmem_data.area)
return -ENOMEM; return -ENOMEM;

View File

@@ -1,6 +1,6 @@
/* /*
* *
* Copyright (c) 2011, Code Aurora Forum. All rights reserved. * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@@ -20,6 +20,7 @@
struct fmem_platform_data { struct fmem_platform_data {
unsigned long phys; unsigned long phys;
unsigned long size; unsigned long size;
unsigned long reserved_size;
}; };
struct fmem_data { struct fmem_data {
@@ -27,6 +28,7 @@ struct fmem_data {
void *virt; void *virt;
struct vm_struct *area; struct vm_struct *area;
unsigned long size; unsigned long size;
unsigned long reserved_size;
}; };
enum fmem_state { enum fmem_state {