diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index f1391c2..9bb221c 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -37,6 +37,14 @@ config MFD_SM501_GPIO lines on the SM501. The platform data is used to supply the base number for the first GPIO line to register. +config SM501_USE_EXTERNAL_MEMORY + bool "Support SM501 External memory" + depends on MFD_SM501 + default y if DEXXON_GDIUM + ---help--- + This is the core driver for the Silicon Motion SM501 multimedia + companion chip. This option will support SM501 External memory. + config MFD_ASIC3 bool "Support for Compaq ASIC3" depends on GENERIC_HARDIRQS && GPIOLIB && ARM diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 7242f3a..3924864 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1343,6 +1343,16 @@ static int sm501_check_clocks(struct sm501_devdata *sm) return ((msrc == 0 && m1src != 0) || (msrc != 0 && m1src == 0)); } +#ifdef CONFIG_SM501_USE_EXTERNAL_MEMORY +static unsigned int sm501_mem_external[] = { + [0] = 2*1024*1024, + [1] = 4*1024*1024, + [4] = 64*1024*1024, + [5] = 32*1024*1024, + [6] = 16*1024*1024, + [7] = 8*1024*1024, +}; +#else static unsigned int sm501_mem_local[] = { [0] = 4*1024*1024, [1] = 8*1024*1024, @@ -1351,6 +1361,8 @@ static unsigned int sm501_mem_local[] = { [4] = 64*1024*1024, [5] = 2*1024*1024, }; +#endif + /* sm501_init_dev * @@ -1382,7 +1394,18 @@ static int __devinit sm501_init_dev(struct sm501_devdata *sm) smc501_writel(0, sm->regs + SM501_IRQ_MASK); dramctrl = smc501_readl(sm->regs + SM501_DRAM_CONTROL); +#ifdef CONFIG_SM501_USE_EXTERNAL_MEMORY +#if CONFIG_GDIUM_VERSION < 3 + /* first generations of gdium did not configure correctly the dram control + register */ + dramctrl &= ~((7 << 24) | (7 << 13) | (3 << 22) | (3 << 11)); + dramctrl |= ((5 << 24) | (3 << 13) | (2 << 22) | (2 << 11)); + smc501_writel( dramctrl, sm->regs + SM501_DRAM_CONTROL); +#endif + mem_avail = sm501_mem_external[(dramctrl >> 24) & 0x7]; +#else mem_avail = sm501_mem_local[(dramctrl >> 13) & 0x7]; +#endif dev_info(sm->dev, "SM501 At %p: Version %08lx, %ld Mb, IRQ %d\n", sm->regs, devid, (unsigned long)mem_avail >> 20, sm->irq);