aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajat Verma <rajat.verma@stericsson.com>2011-06-16 11:53:26 +0530
committersaid m bagheri <ebgheri@steludxu2848.(none)>2011-06-29 10:30:32 +0200
commit1802321d8a25ab04a35a0df552d7bc41eca7f616 (patch)
tree14235399987ae661a88d0a5f9b63d3ab83b2b044
parent88db109c363380fbbff2e354e1e73a5e5d2dfe95 (diff)
downloadlinux-2.6.38-lt-ux500-1802321d8a25ab04a35a0df552d7bc41eca7f616.tar.gz
staging: mmio: enable extended DDR usage
Enables configuration of DDR usage size for camera firmware. Earlier it was fixed at 64 kB, now ISP can use upto 256 MB of DDR memory. ST-Ericsson Linux next: NA ST-Ericsson ID: 345711 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ie5599f55176ccaf42ba76392803057d96c096e62 Signed-off-by: Rajat Verma <rajat.verma@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25193 Reviewed-by: QATOOLS Reviewed-by: QATEST Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r--drivers/staging/mmio/st_mmio.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/staging/mmio/st_mmio.c b/drivers/staging/mmio/st_mmio.c
index b7f2cc997e6..96f6ff1fe36 100644
--- a/drivers/staging/mmio/st_mmio.c
+++ b/drivers/staging/mmio/st_mmio.c
@@ -111,6 +111,36 @@ struct mmio_info {
*/
static struct mmio_info *info;
+/*
+ * This function converts a given logical memory region size
+ * to appropriate ISP_MCU_SYS_SIZEx register value.
+ */
+static int get_mcu_sys_size(u32 size, u32 *val)
+{
+ int ret = 0;
+
+ if (size > 0 && size <= SZ_4K)
+ *val = 4;
+ else if (size > SZ_4K && size <= SZ_8K)
+ *val = 5;
+ else if (size > SZ_8K && size <= SZ_16K)
+ *val = 6;
+ else if (size > SZ_16K && size <= SZ_32K)
+ *val = 7;
+ else if (size > SZ_32K && size <= SZ_64K)
+ *val = 0;
+ else if (size > SZ_64K && size <= SZ_1M)
+ *val = 1;
+ else if (size > SZ_1M && size <= SZ_16M)
+ *val = 2;
+ else if (size > SZ_16M && size <= SZ_256M)
+ *val = 3;
+ else
+ ret = -EINVAL;
+
+ return ret;
+}
+
static int mmio_cam_pwr_sensor(struct mmio_info *info, int on)
{
int err = 0;
@@ -302,8 +332,13 @@ static int mmio_load_xp70_fw(struct mmio_info *info,
*/
writew(upper_16_bits(xp70_fw->addr_sdram_ext),
info->siabase + SIA_ISP_MCU_SYS_ADDR1_OFFSET);
- /* ISP_MCU_SYS_SIZEx XP70 register (size of the code =64KB) */
- writew(0x0, info->siabase + SIA_ISP_MCU_SYS_SIZE1_OFFSET);
+ /* ISP_MCU_SYS_SIZEx XP70 register */
+ err = get_mcu_sys_size(xp70_fw->size_sdram_ext, &itval);
+
+ if (err)
+ goto err_exit;
+
+ writew(itval, info->siabase + SIA_ISP_MCU_SYS_SIZE1_OFFSET);
}
return 0;