From c8df9a53e8d16877fc0b268b002af2a47a14643a Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 29 Apr 2008 09:34:07 +0100 Subject: [ARM] 5024/1: Fix some minor clk issues in the MMCI PL18x driver This fixes some two minor clk issues. The first is a comparison where a byte will probably wrap around to 0 instead of being saturated to 255, shouldn't be triggered very often but need fixing. The second is an attempt by the driver to adjust MCLK down to the maximum frequency according to the spec, so we don't accidentally overclock the PL18x block. None of the mach-{versatile|integrator|lh7a40x} that use it in-tree seem to have a problem with this (all are well below 100MHz, typically 33MHz), but some day there will be a problem. This is not applied on top of the earlier mmci patch for race condition but rather a clean 2.6.25, but I guess it applies without major protests anyway. Signed-off-by: Linus Walleij Signed-off-by: Russell King --- drivers/mmc/host/mmci.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 626ac083f4e..da5fecad74d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -425,7 +425,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) host->cclk = host->mclk; } else { clk = host->mclk / (2 * ios->clock) - 1; - if (clk > 256) + if (clk >= 256) clk = 255; host->cclk = host->mclk / (2 * (clk + 1)); } @@ -512,6 +512,18 @@ static int mmci_probe(struct amba_device *dev, void *id) host->plat = plat; host->mclk = clk_get_rate(host->clk); + /* + * According to the spec, mclk is max 100 MHz, + * so we try to adjust the clock down to this, + * (if possible). + */ + if (host->mclk > 100000000) { + ret = clk_set_rate(host->clk, 100000000); + if (ret < 0) + goto clk_disable; + host->mclk = clk_get_rate(host->clk); + DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); + } host->mmc = mmc; host->base = ioremap(dev->res.start, SZ_4K); if (!host->base) { -- cgit v1.2.3 From ebdf982aaeb0005d5093b10872adce17ea12f5ba Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 5 May 2008 15:31:44 +0100 Subject: [ARM] 5028/1: pxafb: fix broken "backward compatibility way" in framebuffer configuration Commit 84f43c308b73a6a12128288721a1007ba4f1a8da "pxafb: introduce register independent LCD connection type for pxafb" implements compatibility mode for old style pxafb_mach_info initialization data wrongly, causing the system to Oops repeatedly - first during probe, then when drawing. Fix it and make pxafb_decode_mach_info void. Signed-off-by: Guennadi Liakhovetski Acked-by: Eric Miao Signed-off-by: Russell King --- drivers/video/pxafb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3ab6e3d973a..48aea39c35a 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1301,8 +1301,8 @@ static void pxafb_decode_mode_info(struct pxafb_info *fbi, } } -static int pxafb_decode_mach_info(struct pxafb_info *fbi, - struct pxafb_mach_info *inf) +static void pxafb_decode_mach_info(struct pxafb_info *fbi, + struct pxafb_mach_info *inf) { unsigned int lcd_conn = inf->lcd_conn; @@ -1333,7 +1333,7 @@ static int pxafb_decode_mach_info(struct pxafb_info *fbi, fbi->lccr0 = inf->lccr0; fbi->lccr3 = inf->lccr3; fbi->lccr4 = inf->lccr4; - return -EINVAL; + goto decode_mode; } if (lcd_conn == LCD_MONO_STN_8BPP) @@ -1343,8 +1343,8 @@ static int pxafb_decode_mach_info(struct pxafb_info *fbi, fbi->lccr3 |= (lcd_conn & LCD_BIAS_ACTIVE_LOW) ? LCCR3_OEP : 0; fbi->lccr3 |= (lcd_conn & LCD_PCLK_EDGE_FALL) ? LCCR3_PCP : 0; +decode_mode: pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); - return 0; } static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) -- cgit v1.2.3