/* macfb.c: Generic framebuffer for Macs whose colourmaps/modes we
don't know how to set */
/* (c) 1999 David Huggins-Daines <dhd@debian.org>
Primarily based on vesafb.c, by Gerd Knorr
(c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
Also uses information and code from:
The original macfb.c from Linux/mac68k 2.0, by Alan Cox, Juergen
Mellinger, Mikael Forselius, Michael Schmitz, and others.
valkyriefb.c, by Martin Costabel, Kevin Schoedel, Barry Nathan, Dan
Jacobowitz, Paul Mackerras, Fabio Riccardi, and Geert Uytterhoeven.
This code is free software. You may copy, modify, and distribute
it subject to the terms and conditions of the GNU General Public
License, version 2, or any later version, at your convenience. */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/nubus.h>
#include <linux/init.h>
#include <linux/fb.h>
#include <asm/setup.h>
#include <asm/bootinfo.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/irq.h>
#include <asm/macintosh.h>
#include <asm/io.h>
/* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */
#define DAC_BASE 0x50f24000
/* Some addresses for the DAFB */
#define DAFB_BASE 0xf9800200
/* Address for the built-in Civic framebuffer in Quadra AVs */
#define CIVIC_BASE 0x50f30800 /* Only tested on 660AV! */
/* GSC (Gray Scale Controller) base address */
#define GSC_BASE 0x50F20000
/* CSC (Color Screen Controller) base address */
#define CSC_BASE 0x50F20000
static int (*macfb_setpalette) (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *info) = NULL;
static int valkyrie_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *info);
static int dafb_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *fb_info);
static int rbv_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *fb_info);
static int mdc_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *fb_info);
static int toby_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *fb_info);
static int civic_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *fb_info);
static int csc_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue,
struct fb_info *fb_info);
static struct {
unsigned char addr;
/* Note: word-aligned */
char pad[3];
unsigned char lut;
} __iomem *valkyrie_cmap_regs;
static struct {
unsigned char addr;
unsigned char lut;
} __iomem *v8_brazil_cmap_regs;
static struct {
unsigned char addr;
char pad1[3]; /* word aligned */
unsigned char lut;
char pad2[3]; /* word aligned */
unsigned char cntl; /* a guess as to purpose */
} __iomem *rbv_cmap_regs;
static struct {
unsigned long reset;
unsigned long pad1[3];
unsigned char pad2[3];
unsigned char lut;
} __iomem *dafb_cmap_regs;
static struct {
unsigned char addr; /* OFFSET: 0x00 */
unsigned char pad1[15];
unsigned char lut; /* OFFSET: 0x10 */
unsigned char pad2[15];
unsigned char status; /* OFFSET: 0x20 */
unsigned char pad3[7];
unsigned long vbl_addr; /* OFFSET: 0x28 */
unsigned int status2; /* OFFSET: 0x2C */
} __iomem *civic_cmap_regs;
static struct {
char pad1[0x40];
unsigned char clut_waddr; /* 0x40 */
char pad2;
unsigned char clut_data; /* 0x42 */
char pad3[0x3];
unsigned char clut_raddr; /* 0x46 */
} __iomem *csc_cmap_regs;
/* We will leave these the way they are for the time being */
struct mdc_cmap_regs {
char pad1[0x200200];
unsigned char addr;
char pad2[6];
unsigned char lut;
};
struct toby_cmap_regs {
char pad1[0x90018];
unsigned char lut; /* TFBClutWDataReg, offset 0x90018 */
char pad2[3];
unsigned char addr; /* TFBClutAddrReg, offset 0x9001C */
};
struct jet_cmap_regs {
char pad1[0xe0e000];
unsigned char addr;
unsigned char lut;
};