From d984818481320cf4a1b44cefbc99448205cc7673 Mon Sep 17 00:00:00 2001 From: Jingchang Lu Date: Thu, 4 Aug 2011 09:59:48 +0800 Subject: [PATCH 38/52] Add PCI Framebuffer support for Silicon Motion's Lynx family The driver may support SM710, SM712, SM720, and the SM712 has been tested on ColdFire M547X_8XEVB. Signed-off-by: Alison Wang Signed-off-by: Jingchang Lu --- drivers/video/Kconfig | 15 + drivers/video/Makefile | 1 + drivers/video/console/bitblit.c | 12 + drivers/video/console/fbcon.c | 4 + drivers/video/fbmem.c | 2 +- drivers/video/smifb.c | 963 +++++++++++++++++++++++++++++++++++++++ drivers/video/smifb.h | 150 ++++++ include/linux/fb.h | 18 +- 8 files changed, 1163 insertions(+), 2 deletions(-) create mode 100644 drivers/video/smifb.c create mode 100644 drivers/video/smifb.h --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -204,6 +204,7 @@ config FB_WMT_GE_ROPS config FB_DEFERRED_IO bool depends on FB + default y config FB_HECUBA tristate @@ -262,6 +263,20 @@ config FB_TILEBLITTING comment "Frame buffer hardware drivers" depends on FB +config FB_SMI + tristate "Silicon Motion Lynx support" + depends on FB && PCI + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + ---help--- + This enables support for the Silicon Motion Lynx family of graphic + chips. + + The SM712 has been tested on ColdFire M547X_8Xevb. + + If unsure, say N. + config FB_CIRRUS tristate "Cirrus Logic support" depends on FB && (ZORRO || PCI) --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_FB_DEFERRED_IO) += fb_def obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o # Hardware specific drivers go first +obj-$(CONFIG_FB_SMI) += smifb.o obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o obj-$(CONFIG_FB_ARC) += arcfb.o obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c @@ -79,7 +79,11 @@ static inline void bit_putcs_aligned(str u32 d_pitch, u32 s_pitch, u32 cellsize, struct fb_image *image, u8 *buf, u8 *dst) { +#ifndef CONFIG_COLDFIRE u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; +#else + u32 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; +#endif u32 idx = vc->vc_font.width >> 3; u8 *src; @@ -112,7 +116,11 @@ static inline void bit_putcs_unaligned(s struct fb_image *image, u8 *buf, u8 *dst) { +#ifndef CONFIG_COLDFIRE u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; +#else + u32 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; +#endif u32 shift_low = 0, mod = vc->vc_font.width % 8; u32 shift_high = 8; u32 idx = vc->vc_font.width >> 3; @@ -239,7 +247,11 @@ static void bit_cursor(struct vc_data *v { struct fb_cursor cursor; struct fbcon_ops *ops = info->fbcon_par; +#ifndef CONFIG_COLDFIRE unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; +#else + unsigned long charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; +#endif int w = DIV_ROUND_UP(vc->vc_font.width, 8), c; int y = real_y(ops->p, vc->vc_y); int attribute, use_sw = (vc->vc_cursor_type & 0x10); --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -2636,7 +2636,11 @@ static int fbcon_set_palette(struct vc_d { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; int i, j, k, depth; +#ifndef CONFIG_COLDFIRE u8 val; +#else + u32 val; +#endif if (fbcon_is_inactive(vc, info)) return -EINVAL; --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1433,7 +1433,7 @@ static int fb_check_foreignness(struct f fi->flags &= ~FBINFO_FOREIGN_ENDIAN; -#ifdef __BIG_ENDIAN +#if defined(__BIG_ENDIAN) && !defined(CONFIG_COLDFIRE) fi->flags |= foreign_endian ? 0 : FBINFO_BE_MATH; #else fi->flags |= foreign_endian ? FBINFO_BE_MATH : 0; --- /dev/null +++ b/drivers/video/smifb.c @@ -0,0 +1,963 @@ +/*************************************************************************** + smifb.c - Silicon Motion, Inc. LynxEM+ frame buffer device + ------------------- + begin : Thu Aug 9 2001 + copyright : (C) 2001 by Szu-Tao Huang + email : johuang@siliconmotion.com + ***************************************************************************/ +/* Copyright (C) 2008-2011 Freescale Semiconductor, Inc. All Rights Reserved.*/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "console/fbcon.h" + +/* +#include