@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/spi/spi.h>
+#include <linux/memblock.h>
#include <mach/hardware.h>
#include <asm/mach/map.h>
@@ -222,13 +223,48 @@ static struct platform_device omap1_came
.resource = omap1_camera_resources,
};
+static phys_addr_t omap1_camera_phys_mempool_base;
+static phys_addr_t omap1_camera_phys_mempool_size;
+
+void __init omap1_camera_reserve(phys_addr_t size)
+{
+ phys_addr_t paddr;
+
+ if (!size)
+ return;
+
+ paddr = memblock_alloc(size, SZ_1M);
+
+ if (!paddr) {
+ pr_err("%s: failed to reserve %x bytes\n", __func__, size);
+ return;
+ }
+ memblock_free(paddr, size);
+ memblock_remove(paddr, size);
+
+ omap1_camera_phys_mempool_base = paddr;
+ omap1_camera_phys_mempool_size = size;
+}
+
void __init omap1_camera_init(void *info)
{
struct platform_device *dev = &omap1_camera_device;
+ dma_addr_t paddr = omap1_camera_phys_mempool_base;
+ dma_addr_t size = omap1_camera_phys_mempool_size;
int ret;
dev->dev.platform_data = info;
+ if (paddr) {
+ if (dma_declare_coherent_memory(&dev->dev, paddr, paddr, size,
+ DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE))
+ pr_info("%s: reserved %d bytes camera buffer memory\n",
+ __func__, size);
+ else
+ pr_warn("%s: cannot reserve camera buffer memory\n",
+ __func__);
+ }
+
ret = platform_device_register(dev);
if (ret)
dev_err(&dev->dev, "unable to register device: %d\n", ret);
@@ -3,6 +3,7 @@
#include <media/omap1_camera.h>
+void omap1_camera_reserve(phys_addr_t);
void omap1_camera_init(void *);
static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info)