From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Hoover Subject: [PATCH 2.5.68] Epson 1355 Rewrite for 2.5 Date: Thu, 1 May 2003 14:04:37 -0700 Sender: linux-fbdev-devel-admin@lists.sourceforge.net Message-ID: <20030501140415.A4518@heavens.murgatroid.com> Mime-Version: 1.0 Return-path: Received: from 12-234-34-139.client.attbi.com ([12.234.34.139] helo=heavens.murgatroid.com) by sc8-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 19BLEM-0006rN-00 for ; Thu, 01 May 2003 14:04:39 -0700 Content-Disposition: inline Errors-To: linux-fbdev-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: jsimmons@infradead.org, geert@linux-m68k.org Cc: linux-fbdev-devel@lists.sourceforge.net, ch@murgatroid.com Here's a patch, close to a complete rewrite, that makes the Epson 1355/SED355/S1D1305 work under 2.5. I tested it thoroughly in 5/6/5 truecolor mode on a Ceiva. N.B., I hacked cfb* a bit so that I could use that code with my own versions of fb_{read|write}*. This was necessary as this controller only supports 16-bit accesses (at least on ARM ep7212-based Ceiva platform). Please apply. Thanks, -ch mailto:ch(at)murgatroid.com mailto:ch(at)hpl.hp.com PATCH FOLLOWS diff -Nuarp -X dontdiff.txt linux-2.5.68-rmk1/drivers/video/Kconfig linux-2.5.68-rmk1-ceiva1/drivers/video/Kconfig --- linux-2.5.68-rmk1/drivers/video/Kconfig 2003-04-19 19:48:49.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/Kconfig 2003-04-30 16:34:44.000000000 -0700 @@ -423,35 +423,15 @@ config FB_PVR2_DEBUG messages. Most people will want to say N here. If unsure, you will also want to say N. -config FB_E1355 +config FB_EPSON1355 bool "Epson 1355 framebuffer support" - depends on FB && SUPERH + depends on FB && (SUPERH || ARCH_CEIVA) help Build in support for the SED1355 Epson Research Embedded RAMDAC LCD/CRT Controller (since redesignated as the S1D13505) as a framebuffer. Product specs at . -config E1355_REG_BASE - hex "Register Base Address" - depends on FB_E1355 - default "a8000000" - help - Epson SED1355/S1D13505 LCD/CRT controller register base address. - See the manuals at - for - discussion. - -config E1355_FB_BASE - hex "Framebuffer Base Address" - depends on FB_E1355 - default "a8200000" - help - Epson SED1355/S1D13505 LCD/CRT controller memory base address. See - the manuals at - for - discussion. - config FB_RIVA tristate "nVidia Riva support" depends on FB && PCI diff -Nuarp -X dontdiff.txt linux-2.5.68-rmk1/drivers/video/Makefile linux-2.5.68-rmk1-ceiva1/drivers/video/Makefile --- linux-2.5.68-rmk1/drivers/video/Makefile 2003-04-19 19:48:51.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/Makefile 2003-04-30 16:34:55.000000000 -0700 @@ -68,7 +68,7 @@ obj-$(CONFIG_FB_HGA) += hga obj-$(CONFIG_FB_SA1100) += sa1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_E1355) += epson1355fb.o +obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o diff -Nuarp -X dontdiff.txt linux-2.5.68-rmk1/drivers/video/cfbcopyarea.c linux-2.5.68-rmk1-ceiva1/drivers/video/cfbcopyarea.c --- linux-2.5.68-rmk1/drivers/video/cfbcopyarea.c 2003-04-19 19:50:46.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/cfbcopyarea.c 2003-04-24 14:27:52.000000000 -0700 @@ -29,16 +29,31 @@ #include #include +/* this file may be included verbatim, with your own + * fb_{read,write}{l,q} routines, if you define CFB_COPYAREA and + * _FB_{READ|WRITE}{Q|L} + */ +#ifndef CFB_COPYAREA +# define CFB_COPYAREA cfb_copyarea +# define CFB_COPYAREA_STATIC +# define _FB_WRITEL fb_writel +# define _FB_READL fb_readl +# define _FB_WRITEQ fb_writeq +# define _FB_READQ _fb_readq +#else +# define CFB_COPYAREA_STATIC static +#endif + #define LONG_MASK (BITS_PER_LONG - 1) #if BITS_PER_LONG == 32 -#define FB_WRITEL fb_writel -#define FB_READL fb_readl +#define FB_WRITEL _FB_WRITEL +#define FB_READL _FB_READL #define SHIFT_PER_LONG 5 #define BYTES_PER_LONG 4 #else -#define FB_WRITEL fb_writeq -#define FB_READL fb_readq +#define FB_WRITEL _FB_WRITEQ +#define FB_READL _FB_READQ #define SHIFT_PER_LONG 6 #define BYTES_PER_LONG 8 #endif @@ -337,7 +352,8 @@ static void bitcpy_rev(unsigned long *ds } } -void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) +CFB_COPYAREA_STATIC +void CFB_COPYAREA(struct fb_info *p, const struct fb_copyarea *area) { u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy; u32 height = area->height, width = area->width; @@ -424,9 +440,10 @@ void cfb_copyarea(struct fb_info *p, con } } +#ifndef CFB_COPYAREA EXPORT_SYMBOL(cfb_copyarea); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Generic software accelerated copyarea"); MODULE_LICENSE("GPL"); - +#endif diff -Nuarp -X dontdiff.txt linux-2.5.68-rmk1/drivers/video/cfbfillrect.c linux-2.5.68-rmk1-ceiva1/drivers/video/cfbfillrect.c --- linux-2.5.68-rmk1/drivers/video/cfbfillrect.c 2003-04-19 19:49:54.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/cfbfillrect.c 2003-04-24 14:27:14.000000000 -0700 @@ -23,14 +23,29 @@ #include #include +/* this file may be included verbatim, with your own + * fb_{read,write}{l,q} routines, if you define CFB_FILLRECT and + * _FB_{READ|WRITE}{Q|L} + */ +#ifndef CFB_FILLRECT +# define CFB_FILLRECT cfb_fillrect +# define CFB_FILLRECT_STATIC +# define _FB_WRITEL fb_writel +# define _FB_READL fb_readl +# define _FB_WRITEQ fb_writeq +# define _FB_READQ _fb_readq +#else +# define CFB_FILLRECT_STATIC static +#endif + #if BITS_PER_LONG == 32 -#define FB_WRITEL fb_writel -#define FB_READL fb_readl +#define FB_WRITEL _FB_WRITEL +#define FB_READL _FB_READL #define BYTES_PER_LONG 4 #define SHIFT_PER_LONG 5 #else -#define FB_WRITEL fb_writeq -#define FB_READL fb_readq +#define FB_WRITEL _FB_WRITEQ +#define FB_READL _FB_READQ #define BYTES_PER_LONG 8 #define SHIFT_PER_LONG 6 #endif @@ -119,7 +134,7 @@ static inline unsigned long pixel_to_pat * Unaligned 32-bit pattern fill using 32/64-bit memory accesses */ -void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) +static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat; unsigned long first, last; @@ -178,7 +193,7 @@ void bitfill32(unsigned long *dst, int d * used for the next 32/64-bit word */ -void bitfill(unsigned long *dst, int dst_idx, unsigned long pat, int left, +static void bitfill(unsigned long *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last; @@ -228,7 +243,7 @@ void bitfill(unsigned long *dst, int dst } } -void bitfill32_rev(unsigned long *dst, int dst_idx, u32 pat, u32 n) +static void bitfill32_rev(unsigned long *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat, dat; unsigned long first, last; @@ -300,7 +315,7 @@ void bitfill32_rev(unsigned long *dst, i * used for the next 32/64-bit word */ -void bitfill_rev(unsigned long *dst, int dst_idx, unsigned long pat, int left, +static void bitfill_rev(unsigned long *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last, dat; @@ -359,7 +374,8 @@ void bitfill_rev(unsigned long *dst, int } } -void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect) +CFB_FILLRECT_STATIC +void CFB_FILLRECT(struct fb_info *p, const struct fb_fillrect *rect) { u32 bpp = p->var.bits_per_pixel; unsigned long x2, y2, vxres, vyres; @@ -451,8 +467,10 @@ void cfb_fillrect(struct fb_info *p, con } } +#ifndef CFB_FILLRECT EXPORT_SYMBOL(cfb_fillrect); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Generic software accelerated fill rectangle"); MODULE_LICENSE("GPL"); +#endif diff -Nuarp -X dontdiff.txt linux-2.5.68-rmk1/drivers/video/cfbimgblt.c linux-2.5.68-rmk1-ceiva1/drivers/video/cfbimgblt.c --- linux-2.5.68-rmk1/drivers/video/cfbimgblt.c 2003-04-19 19:49:54.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/cfbimgblt.c 2003-04-24 14:26:47.000000000 -0700 @@ -35,6 +35,21 @@ #include #include +/* this file may be included verbatim, with your own + * fb_{read,write}{l,q} routines, if you define CFB_IMAGEBLIT and + * _FB_{READ|WRITE}{Q|L} + */ +#ifndef CFB_IMAGEBLIT +# define CFB_IMAGEBLIT cfb_imageblit +# define CFB_IMAGEBLIT_STATIC +# define _FB_WRITEL fb_writel +# define _FB_READL fb_readl +# define _FB_WRITEQ fb_writeq +# define _FB_READQ _fb_readq +#else +# define CFB_IMAGEBLIT_STATIC static +#endif + #define DEBUG #ifdef DEBUG @@ -84,13 +99,13 @@ static u32 cfb_tab32[] = { #endif #if BITS_PER_LONG == 32 -#define FB_WRITEL fb_writel -#define FB_READL fb_readl +#define FB_WRITEL _FB_WRITEL +#define FB_READL _FB_READL #define INIT_FASTPATH {} -#define FASTPATH fb_writel((end_mask & eorx)^bgx, dst++) +#define FASTPATH _FB_WRITEL((end_mask & eorx)^bgx, dst++) #else -#define FB_WRITEL fb_writeq -#define FB_READL fb_readq +#define FB_WRITEL _FB_WRITEQ +#define FB_READL _FB_READQ #define INIT_FASTPATH unsigned long val = 0, bpl = 0 #define FASTPATH { \ val |= SHIFT_HIGH((end_mask & eorx)^bgx, bpl); \ @@ -290,7 +305,9 @@ static inline void fast_imageblit(const } } -void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + +CFB_IMAGEBLIT_STATIC +void CFB_IMAGEBLIT(struct fb_info *p, const struct fb_image *image) { unsigned long fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; unsigned long bpl = sizeof(unsigned long), bpp = p->var.bits_per_pixel; @@ -350,9 +367,10 @@ void cfb_imageblit(struct fb_info *p, co color_imageblit(image, p, dst1, start_index, pitch_index); } +#ifndef CFB_IMAGEBLIT EXPORT_SYMBOL(cfb_imageblit); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Generic software accelerated imaging drawing"); MODULE_LICENSE("GPL"); - +#endif diff -Nuarp -X dontdiff.txt linux-2.5.68-rmk1/drivers/video/epson1355fb.c linux-2.5.68-rmk1-ceiva1/drivers/video/epson1355fb.c --- linux-2.5.68-rmk1/drivers/video/epson1355fb.c 2003-04-19 19:48:50.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/epson1355fb.c 2003-04-30 16:43:32.000000000 -0700 @@ -1,542 +1,725 @@ /* - * linux/drivers/video/epson1355fb.c - * -- Support for the Epson SED1355 LCD/CRT controller + * linux/drivers/video/epson1355fb.c -- Epson S1D1305 frame buffer for 2.5. * - * Copyright (C) 2000 Philipp Rumpf + * Copyright (C) Hewlett-Packard Company. All rights reserved. * - * based on linux/drivers/video/skeletonfb.c, which was + * Written by Christopher Hoover + * + * Adapted from: + * + * linux/drivers/video/skeletonfb.c + * Modified to new api Jan 2001 by James Simmons (jsimmons@transvirtual.com) * Created 28 Dec 1997 by Geert Uytterhoeven * + * linux/drivers/video/epson1355fb.c (2.4 driver) + * Copyright (C) 2000 Philipp Rumpf + * * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - */ -/* TODO (roughly in order of priority): - * 16 bpp support - * crt support - * hw cursor support - * SwivelView + * License. See the file COPYING in the main directory of this archive for + * more details. + * + * + * Noteworthy Issues + * ----------------- + * + * This driver is complicated by the fact that this is a 16-bit chip + * and, on at least one platform (ceiva), we can only do 16-bit reads + * and writes to the framebuffer. We hide this from user space + * except in the case of mmap(). + * + * If other platforms can automagically do two 16-bit reads/writes for + * each 32-bit read/write efficiently, we can accomodate these + * platforms with a second fbops defintition that utilizes the default + * cfb and i/o routines. This will shrink the code size and be + * faster. + * + * To Do + * ----- + * + * - Test 8-bit pseudocolor mode + * - Allow setting bpp, virtual resolution + * - Implement horizontal panning + * - (maybe) Implement hardware cursor */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include #include +#include #include -#include