Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* $Id: g364fb.c,v 1.3 1998/08/28 22:43:00 tsbogend Exp $
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * linux/drivers/video/g364fb.c -- Mips Magnum frame buffer device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * (C) 1998 Thomas Bogendoerfer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  This driver is based on tgafb.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *	Copyright (C) 1997 Geert Uytterhoeven 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *	Copyright (C) 1995  Jay Estabrook
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *  This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *  License. See the file COPYING in the main directory of this archive for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *  more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/console.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/vmalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <asm/jazz.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) /* 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * Various defines for the G364
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define G364_MEM_BASE   0xe4400000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define G364_PORT_BASE  0xe4000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define ID_REG 		0xe4000000	/* Read only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define BOOT_REG 	0xe4080000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define TIMING_REG 	0xe4080108	/* to 0x080170 - DON'T TOUCH! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define DISPLAY_REG 	0xe4080118
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define VDISPLAY_REG 	0xe4080150
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define MASK_REG 	0xe4080200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define CTLA_REG 	0xe4080300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define CURS_TOGGLE 	0x800000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define BIT_PER_PIX	0x700000	/* bits 22 to 20 of Control A */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define DELAY_SAMPLE    0x080000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define PORT_INTER	0x040000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define PIX_PIPE_DEL	0x030000	/* bits 17 and 16 of Control A */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define PIX_PIPE_DEL2	0x008000	/* same as above - don't ask me why */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define TR_CYCLE_TOG	0x004000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define VRAM_ADR_INC	0x003000	/* bits 13 and 12 of Control A */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define BLANK_OFF	0x000800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define FORCE_BLANK	0x000400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define BLK_FUN_SWTCH	0x000200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define BLANK_IO	0x000100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define BLANK_LEVEL	0x000080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define A_VID_FORM	0x000040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define D_SYNC_FORM	0x000020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define FRAME_FLY_PAT	0x000010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define OP_MODE		0x000008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define INTL_STAND	0x000004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define SCRN_FORM	0x000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define ENABLE_VTG	0x000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define TOP_REG 	0xe4080400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define CURS_PAL_REG 	0xe4080508	/* to 0x080518 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define CHKSUM_REG 	0xe4080600	/* to 0x080610 - unused */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define CURS_POS_REG 	0xe4080638
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define CLR_PAL_REG 	0xe4080800	/* to 0x080ff8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define CURS_PAT_REG 	0xe4081000	/* to 0x081ff8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define MON_ID_REG 	0xe4100000	/* unused */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define RESET_REG 	0xe4180000	/* Write only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) static struct fb_info fb_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) static struct fb_fix_screeninfo fb_fix __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	.id 		= "G364 8plane",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	.smem_start 	= 0x40000000,	/* physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	.type 		= FB_TYPE_PACKED_PIXELS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	.visual 	= FB_VISUAL_PSEUDOCOLOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	.ypanstep 	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	.accel 		= FB_ACCEL_NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) static struct fb_var_screeninfo fb_var __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	.bits_per_pixel = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	.red 		= { 0, 8, 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)       	.green 		= { 0, 8, 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)       	.blue		= { 0, 8, 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)       	.activate	= FB_ACTIVATE_NOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)       	.height		= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)       	.width		= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)       	.pixclock	= 39722,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)       	.left_margin	= 40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)       	.right_margin	= 24,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)       	.upper_margin	= 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)       	.lower_margin	= 11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)       	.hsync_len 	= 96,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)       	.vsync_len 	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)       	.vmode		= FB_VMODE_NONINTERLACED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  *  Interface used by the world
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) int g364fb_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static int g364fb_pan_display(struct fb_var_screeninfo *var,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			      struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static int g364fb_setcolreg(u_int regno, u_int red, u_int green,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			    u_int blue, u_int transp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			    struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static int g364fb_blank(int blank, struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static const struct fb_ops g364fb_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.owner		= THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.fb_setcolreg	= g364fb_setcolreg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.fb_pan_display	= g364fb_pan_display,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.fb_blank	= g364fb_blank,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.fb_fillrect	= cfb_fillrect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	.fb_copyarea	= cfb_copyarea,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	.fb_imageblit	= cfb_imageblit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  *  Pan or Wrap the Display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) static int g364fb_pan_display(struct fb_var_screeninfo *var, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			      struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	if (var->xoffset ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	    var->yoffset + info->var.yres > info->var.yres_virtual)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	*(unsigned int *) TOP_REG = var->yoffset * info->var.xres;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  *  Blank the display.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) static int g364fb_blank(int blank, struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	if (blank)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		*(unsigned int *) CTLA_REG |= FORCE_BLANK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		*(unsigned int *) CTLA_REG &= ~FORCE_BLANK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  *  Set a single color register. Return != 0 for invalid regno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) static int g364fb_setcolreg(u_int regno, u_int red, u_int green,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 			    u_int blue, u_int transp, struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	volatile unsigned int *ptr = (volatile unsigned int *) CLR_PAL_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	if (regno > 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	red >>= 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	green >>= 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	blue >>= 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	ptr[regno << 1] = (red << 16) | (green << 8) | blue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  *  Initialisation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) int __init g364fb_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	volatile unsigned int *curs_pal_ptr =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	    (volatile unsigned int *) CURS_PAL_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	int mem, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	if (fb_get_options("g364fb", NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	/* TBD: G364 detection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	/* get the resolution set by ARC console */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	*(volatile unsigned int *) CTLA_REG &= ~ENABLE_VTG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	fb_var.xres =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	    (*((volatile unsigned int *) DISPLAY_REG) & 0x00ffffff) * 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	fb_var.yres =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	    (*((volatile unsigned int *) VDISPLAY_REG) & 0x00ffffff) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	*(volatile unsigned int *) CTLA_REG |= ENABLE_VTG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	/* setup cursor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	curs_pal_ptr[0] |= 0x00ffffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	curs_pal_ptr[2] |= 0x00ffffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	curs_pal_ptr[4] |= 0x00ffffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	 * first set the whole cursor to transparent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	for (i = 0; i < 512; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		*(unsigned short *) (CURS_PAT_REG + i * 8) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 * switch the last two lines to cursor palette 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	 * we assume here, that FONTSIZE_X is 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	*(unsigned short *) (CURS_PAT_REG + 14 * 64) = 0xffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	*(unsigned short *) (CURS_PAT_REG + 15 * 64) = 0xffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	fb_var.xres_virtual = fb_var.xres;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	fb_fix.line_length = fb_var.xres_virtual * fb_var.bits_per_pixel / 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	fb_fix.smem_start = 0x40000000;	/* physical address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	/* get size of video memory; this is special for the JAZZ hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	mem = (r4030_read_reg32(JAZZ_R4030_CONFIG) >> 8) & 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	fb_fix.smem_len = (1 << (mem * 2)) * 512 * 1024;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	fb_var.yres_virtual = fb_fix.smem_len / fb_var.xres;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	fb_info.fbops = &g364fb_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	fb_info.screen_base = (char *) G364_MEM_BASE;	/* virtual kernel address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	fb_info.var = fb_var;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	fb_info.fix = fb_fix;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	fb_alloc_cmap(&fb_info.cmap, 255, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	if (register_framebuffer(&fb_info) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) module_init(g364fb_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) MODULE_LICENSE("GPL");