Date:2012-06-16 21:17:33 (7 years 11 months ago)
Author:Maarten ter Huurne
Commit:93681ef5dd17f22063208ea5be2ca83e7da63a4d
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
23302330    fbcon_set_palette(vc, color_table);
23312331    fbcon_clear_margins(vc, 0);
23322332
2333/* TODO: Figure out why the logo gets accessed after the init phase ends
2334 * when using the JZ4740 SLCD driver.
2335 */
2336#ifndef CONFIG_FB_JZ4740_SLCD
23332337    if (logo_shown == FBCON_LOGO_DRAW) {
23342338
23352339        logo_shown = fg_console;
...... 
23412345                         vc->vc_top) / 2);
23422346        return 0;
23432347    }
2348#endif
23442349    return 1;
23452350}
23462351
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