Date:2012-06-16 21:17:33 (11 years 9 months ago)
Author:Maarten ter Huurne
Commit:9058ec89da4c7e9ac752d69b9edf3991738fca60
Message:MIPS: JZ4740: Work around fbcon logo crash with SLCD

The logo data is in the init section. However, when using the SLCD driver,
the fbcon code will try to fetch the logo data after the init section has
already been freed, potentially crashing the kernel.

This is a workaround because we have to release a stable kernel now.
The root cause should be found and fixed later.
Files: drivers/video/console/fbcon.c (2 diffs)
drivers/video/fbdev/jz4740_slcd_fb.c (4 diffs)

Change Details

drivers/video/console/fbcon.c
23312331    fbcon_set_palette(vc, color_table);
23322332    fbcon_clear_margins(vc, 0);
23332333
2334/* TODO: Figure out why the logo gets accessed after the init phase ends
2335 * when using the JZ4740 SLCD driver.
2336 */
2337#ifndef CONFIG_FB_JZ4740_SLCD
23342338    if (logo_shown == FBCON_LOGO_DRAW) {
23352339
23362340        logo_shown = fg_console;
...... 
23422346                         vc->vc_top) / 2);
23432347        return 0;
23442348    }
2349#endif
23452350    return 1;
23462351}
23472352
drivers/video/fbdev/jz4740_slcd_fb.c
416416
417417    mutex_lock(&jzfb->lock);
418418    if (!jzfb->is_enabled)
419        clk_enable(jzfb->ldclk);
419        clk_prepare_enable(jzfb->ldclk);
420420
421421    // TODO(MtH): We should not change config while DMA might be running.
422422    writew(slcd_cfg, jzfb->base + JZ_REG_SLCD_CFG);
423423
424424    if (!jzfb->is_enabled)
425        clk_disable(jzfb->ldclk);
425        clk_disable_unprepare(jzfb->ldclk);
426426    mutex_unlock(&jzfb->lock);
427427
428428    // TODO(MtH): Use maximum transfer speed that panel can handle.
...... 
437437{
438438    uint32_t ctrl;
439439
440    clk_enable(jzfb->ldclk);
440    clk_prepare_enable(jzfb->ldclk);
441441
442442    jz_gpio_bulk_resume(jz_slcd_ctrl_pins, jzfb_num_ctrl_pins(jzfb));
443443    if (jzfb->pdata->lcd_type & (1 << 6)) {
...... 
481481                     jzfb_num_data_pins(jzfb));
482482    }
483483
484    clk_disable(jzfb->ldclk);
484    clk_disable_unprepare(jzfb->ldclk);
485485}
486486
487487static int jzfb_blank(int blank_mode, struct fb_info *info)
...... 
933933
934934    mutex_init(&jzfb->lock);
935935
936    clk_enable(jzfb->ldclk);
936    clk_prepare_enable(jzfb->ldclk);
937937    jzfb->is_enabled = 1;
938938
939939    writel(JZ_LCD_CFG_SLCD, jzfb->base + JZ_REG_LCD_CFG);

Archive Download the corresponding diff file



interactive