diff options
author | Rajat Verma <rajat.verma@stericsson.com> | 2011-06-16 11:53:26 +0530 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:48 +0200 |
commit | d73500f3633b23319382625833ceaf9bb29c7833 (patch) | |
tree | 1d43c0be45b68ed2879e5ab11e0b18ea38be3f88 | |
parent | 0c7620202ac39239144573d2b6c883cf27d66eba (diff) |
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.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/staging/mmio/st_mmio.c b/drivers/staging/mmio/st_mmio.c index 696644ae835..c79c2768d19 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; |