Date:2012-06-16 21:17:33 (7 years 11 months ago)
Author:Maarten ter Huurne
Commit:0b28849edec11eb83071758762d34720df121cd8
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
22822282    fbcon_set_palette(vc, color_table);
22832283    fbcon_clear_margins(vc, 0);
22842284
2285/* TODO: Figure out why the logo gets accessed after the init phase ends
2286 * when using the JZ4740 SLCD driver.
2287 */
2288#ifndef CONFIG_FB_JZ4740_SLCD
22852289    if (logo_shown == FBCON_LOGO_DRAW) {
22862290
22872291        logo_shown = fg_console;
...... 
22932297                         vc->vc_top) / 2);
22942298        return 0;
22952299    }
2300#endif
22962301    return 1;
22972302}
22982303
drivers/video/fbdev/jz4740_slcd_fb.c
418418
419419    mutex_lock(&jzfb->lock);
420420    if (!jzfb->is_enabled)
421        clk_enable(jzfb->ldclk);
421        clk_prepare_enable(jzfb->ldclk);
422422
423423    // TODO(MtH): We should not change config while DMA might be running.
424424    writew(slcd_cfg, jzfb->base + JZ_REG_SLCD_CFG);
425425
426426    if (!jzfb->is_enabled)
427        clk_disable(jzfb->ldclk);
427        clk_disable_unprepare(jzfb->ldclk);
428428    mutex_unlock(&jzfb->lock);
429429
430430    // TODO(MtH): Use maximum transfer speed that panel can handle.
...... 
439439{
440440    uint32_t ctrl;
441441
442    clk_enable(jzfb->ldclk);
442    clk_prepare_enable(jzfb->ldclk);
443443
444444    jz_gpio_bulk_resume(jz_slcd_ctrl_pins, jzfb_num_ctrl_pins(jzfb));
445445    if (jzfb->pdata->lcd_type & (1 << 6)) {
...... 
483483                     jzfb_num_data_pins(jzfb));
484484    }
485485
486    clk_disable(jzfb->ldclk);
486    clk_disable_unprepare(jzfb->ldclk);
487487}
488488
489489static int jzfb_blank(int blank_mode, struct fb_info *info)
...... 
946946
947947    mutex_init(&jzfb->lock);
948948
949    clk_enable(jzfb->ldclk);
949    clk_prepare_enable(jzfb->ldclk);
950950    jzfb->is_enabled = 1;
951951
952952    writel(JZ_LCD_CFG_SLCD, jzfb->base + JZ_REG_LCD_CFG);

Archive Download the corresponding diff file



interactive