Commit d0a9af80 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [VIDEO]: Fix section mismatch in cg3.c
  [SPARC]: sparc64 gcc-4.2.0 20070317 -Werror failure
  [VIDEO] ffb: Fix two DAC handling bugs.
  [SPARC32]: Fix SMP build regression
  [DRM]: Delete sparc64 FFB driver code that never gets built.
parents c203b33d a7177514
...@@ -52,6 +52,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new) ...@@ -52,6 +52,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
spin_unlock_irqrestore(ATOMIC_HASH(v), flags); spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret; return ret;
} }
EXPORT_SYMBOL(atomic_cmpxchg);
int atomic_add_unless(atomic_t *v, int a, int u) int atomic_add_unless(atomic_t *v, int a, int u)
{ {
...@@ -65,6 +66,7 @@ int atomic_add_unless(atomic_t *v, int a, int u) ...@@ -65,6 +66,7 @@ int atomic_add_unless(atomic_t *v, int a, int u)
spin_unlock_irqrestore(ATOMIC_HASH(v), flags); spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret != u; return ret != u;
} }
EXPORT_SYMBOL(atomic_add_unless);
/* Atomic operations are already serializing */ /* Atomic operations are already serializing */
void atomic_set(atomic_t *v, int i) void atomic_set(atomic_t *v, int i)
......
...@@ -15,7 +15,6 @@ i810-objs := i810_drv.o i810_dma.o ...@@ -15,7 +15,6 @@ i810-objs := i810_drv.o i810_dma.o
i830-objs := i830_drv.o i830_dma.o i830_irq.o i830-objs := i830_drv.o i830_dma.o i830_irq.o
i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
ffb-objs := ffb_drv.o ffb_context.o
sis-objs := sis_drv.o sis_mm.o sis-objs := sis_drv.o sis_mm.o
savage-objs := savage_drv.o savage_bci.o savage_state.o savage-objs := savage_drv.o savage_bci.o savage_state.o
via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
...@@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o ...@@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o
obj-$(CONFIG_DRM_I810) += i810.o obj-$(CONFIG_DRM_I810) += i810.o
obj-$(CONFIG_DRM_I830) += i830.o obj-$(CONFIG_DRM_I830) += i830.o
obj-$(CONFIG_DRM_I915) += i915.o obj-$(CONFIG_DRM_I915) += i915.o
obj-$(CONFIG_DRM_FFB) += ffb.o
obj-$(CONFIG_DRM_SIS) += sis.o obj-$(CONFIG_DRM_SIS) += sis.o
obj-$(CONFIG_DRM_SAVAGE)+= savage.o obj-$(CONFIG_DRM_SAVAGE)+= savage.o
obj-$(CONFIG_DRM_VIA) +=via.o obj-$(CONFIG_DRM_VIA) +=via.o
......
This diff is collapsed.
/* $Id: ffb_drv.c,v 1.16 2001/10/18 16:00:24 davem Exp $
* ffb_drv.c: Creator/Creator3D direct rendering driver.
*
* Copyright (C) 2000 David S. Miller (davem@redhat.com)
*/
#include "ffb.h"
#include "drmP.h"
#include "ffb_drv.h"
#include <linux/smp_lock.h>
#include <asm/shmparam.h>
#include <asm/oplib.h>
#include <asm/upa.h>
#define DRIVER_AUTHOR "David S. Miller"
#define DRIVER_NAME "ffb"
#define DRIVER_DESC "Creator/Creator3D"
#define DRIVER_DATE "20000517"
#define DRIVER_MAJOR 0
#define DRIVER_MINOR 0
#define DRIVER_PATCHLEVEL 1
typedef struct _ffb_position_t {
int node;
int root;
} ffb_position_t;
static ffb_position_t *ffb_position;
static void get_ffb_type(ffb_dev_priv_t * ffb_priv, int instance)
{
volatile unsigned char *strap_bits;
unsigned char val;
strap_bits = (volatile unsigned char *)
(ffb_priv->card_phys_base + 0x00200000UL);
/* Don't ask, you have to read the value twice for whatever
* reason to get correct contents.
*/
val = upa_readb(strap_bits);
val = upa_readb(strap_bits);
switch (val & 0x78) {
case (0x0 << 5) | (0x0 << 3):
ffb_priv->ffb_type = ffb1_prototype;
printk("ffb%d: Detected FFB1 pre-FCS prototype\n", instance);
break;
case (0x0 << 5) | (0x1 << 3):
ffb_priv->ffb_type = ffb1_standard;
printk("ffb%d: Detected FFB1\n", instance);
break;
case (0x0 << 5) | (0x3 << 3):
ffb_priv->ffb_type = ffb1_speedsort;
printk("ffb%d: Detected FFB1-SpeedSort\n", instance);
break;
case (0x1 << 5) | (0x0 << 3):
ffb_priv->ffb_type = ffb2_prototype;
printk("ffb%d: Detected FFB2/vertical pre-FCS prototype\n",
instance);
break;
case (0x1 << 5) | (0x1 << 3):
ffb_priv->ffb_type = ffb2_vertical;
printk("ffb%d: Detected FFB2/vertical\n", instance);
break;
case (0x1 << 5) | (0x2 << 3):
ffb_priv->ffb_type = ffb2_vertical_plus;
printk("ffb%d: Detected FFB2+/vertical\n", instance);
break;
case (0x2 << 5) | (0x0 << 3):
ffb_priv->ffb_type = ffb2_horizontal;
printk("ffb%d: Detected FFB2/horizontal\n", instance);
break;
case (0x2 << 5) | (0x2 << 3):
ffb_priv->ffb_type = ffb2_horizontal;
printk("ffb%d: Detected FFB2+/horizontal\n", instance);
break;
default:
ffb_priv->ffb_type = ffb2_vertical;
printk("ffb%d: Unknown boardID[%08x], assuming FFB2\n",
instance, val);
break;
};
}
static void ffb_apply_upa_parent_ranges(int parent,
struct linux_prom64_registers *regs)
{
struct linux_prom64_ranges ranges[PROMREG_MAX];
char name[128];
int len, i;
prom_getproperty(parent, "name", name, sizeof(name));
if (strcmp(name, "upa") != 0)
return;
len =
prom_getproperty(parent, "ranges", (void *)ranges, sizeof(ranges));
if (len <= 0)
return;
len /= sizeof(struct linux_prom64_ranges);
for (i = 0; i < len; i++) {
struct linux_prom64_ranges *rng = &ranges[i];
u64 phys_addr = regs->phys_addr;
if (phys_addr >= rng->ot_child_base &&
phys_addr < (rng->ot_child_base + rng->or_size)) {
regs->phys_addr -= rng->ot_child_base;
regs->phys_addr += rng->ot_parent_base;
return;
}
}
return;
}
static int ffb_init_one(drm_device_t * dev, int prom_node, int parent_node,
int instance)
{
struct linux_prom64_registers regs[2 * PROMREG_MAX];
ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
int i;
ffb_priv->prom_node = prom_node;
if (prom_getproperty(ffb_priv->prom_node, "reg",
(void *)regs, sizeof(regs)) <= 0) {
return -EINVAL;
}
ffb_apply_upa_parent_ranges(parent_node, &regs[0]);
ffb_priv->card_phys_base = regs[0].phys_addr;
ffb_priv->regs = (ffb_fbcPtr)
(regs[0].phys_addr + 0x00600000UL);
get_ffb_type(ffb_priv, instance);
for (i = 0; i < FFB_MAX_CTXS; i++)
ffb_priv->hw_state[i] = NULL;
return 0;
}
static drm_map_t *ffb_find_map(struct file *filp, unsigned long off)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev;
drm_map_list_t *r_list;
struct list_head *list;
drm_map_t *map;
if (!priv || (dev = priv->dev) == NULL)
return NULL;
list_for_each(list, &dev->maplist->head) {
r_list = (drm_map_list_t *) list;
map = r_list->map;
if (!map)
continue;
if (r_list->user_token == off)
return map;
}
return NULL;
}
unsigned long ffb_get_unmapped_area(struct file *filp,
unsigned long hint,
unsigned long len,
unsigned long pgoff, unsigned long flags)
{
drm_map_t *map = ffb_find_map(filp, pgoff << PAGE_SHIFT);
unsigned long addr = -ENOMEM;
if (!map)
return get_unmapped_area(NULL, hint, len, pgoff, flags);
if (map->type == _DRM_FRAME_BUFFER || map->type == _DRM_REGISTERS) {
#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags);
#else
addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
#endif
} else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) {
unsigned long slack = SHMLBA - PAGE_SIZE;
addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags);
if (!(addr & ~PAGE_MASK)) {
unsigned long kvirt = (unsigned long)map->handle;
if ((kvirt & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
unsigned long koff, aoff;
koff = kvirt & (SHMLBA - 1);
aoff = addr & (SHMLBA - 1);
if (koff < aoff)
koff += SHMLBA;
addr += (koff - aoff);
}
}
} else {
addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
}
return addr;
}
static int ffb_presetup(drm_device_t * dev)
{
ffb_dev_priv_t *ffb_priv;
int ret = 0;
int i = 0;
/* Check for the case where no device was found. */
if (ffb_position == NULL)
return -ENODEV;
/* code used to use numdevs no numdevs anymore */
ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL);
if (!ffb_priv)
return -ENOMEM;
memset(ffb_priv, 0, sizeof(*ffb_priv));
dev->dev_private = ffb_priv;
ret = ffb_init_one(dev, ffb_position[i].node, ffb_position[i].root, i);
return ret;
}
static void ffb_driver_release(drm_device_t * dev, struct file *filp)
{
ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
int idx;
idx = context - 1;
if (fpriv &&
context != DRM_KERNEL_CONTEXT && fpriv->hw_state[idx] != NULL) {
kfree(fpriv->hw_state[idx]);
fpriv->hw_state[idx] = NULL;
}
}
static void ffb_driver_pretakedown(drm_device_t * dev)
{
kfree(dev->dev_private);
}
static int ffb_driver_postcleanup(drm_device_t * dev)
{
kfree(ffb_position);
return 0;
}
static void ffb_driver_kernel_context_switch_unlock(struct drm_device *dev,
drm_lock_t * lock)
{
dev->lock.filp = 0;
{
__volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
unsigned int old, new, prev, ctx;
ctx = lock->context;
do {
old = *plock;
new = ctx;
prev = cmpxchg(plock, old, new);
} while (prev != old);
}
wake_up_interruptible(&dev->lock.lock_queue);
}
static unsigned long ffb_driver_get_map_ofs(drm_map_t * map)
{
return (map->offset & 0xffffffff);
}
static unsigned long ffb_driver_get_reg_ofs(drm_device_t * dev)
{
ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
if (ffb_priv)
return ffb_priv->card_phys_base;
return 0;
}
static int postinit(struct drm_device *dev, unsigned long flags)
{
DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
DRIVER_NAME,
DRIVER_MAJOR,
DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->minor);
return 0;
}
static int version(drm_version_t * version)
{
int len;
version->version_major = DRIVER_MAJOR;
version->version_minor = DRIVER_MINOR;
version->version_patchlevel = DRIVER_PATCHLEVEL;
DRM_COPY(version->name, DRIVER_NAME);
DRM_COPY(version->date, DRIVER_DATE);
DRM_COPY(version->desc, DRIVER_DESC);
return 0;
}
static drm_ioctl_desc_t ioctls[] = {
};
static struct drm_driver driver = {
.driver_features = 0,
.dev_priv_size = sizeof(u32),
.release = ffb_driver_release,
.presetup = ffb_presetup,
.pretakedown = ffb_driver_pretakedown,
.postcleanup = ffb_driver_postcleanup,
.kernel_context_switch = ffb_driver_context_switch,
.kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock,
.get_map_ofs = ffb_driver_get_map_ofs,
.get_reg_ofs = ffb_driver_get_reg_ofs,
.postinit = postinit,
.version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
}
,
};
static int __init ffb_init(void)
{
return -ENODEV;
}
static void __exit ffb_exit(void)
{
}
module_init(ffb_init);
module_exit(ffb_exit);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL and additional rights");
This diff is collapsed.
...@@ -186,8 +186,7 @@ static int cg3_setcolreg(unsigned regno, ...@@ -186,8 +186,7 @@ static int cg3_setcolreg(unsigned regno,
* @blank_mode: the blank mode we want. * @blank_mode: the blank mode we want.
* @info: frame buffer structure that represents a single frame buffer * @info: frame buffer structure that represents a single frame buffer
*/ */
static int static int cg3_blank(int blank, struct fb_info *info)
cg3_blank(int blank, struct fb_info *info)
{ {
struct cg3_par *par = (struct cg3_par *) info->par; struct cg3_par *par = (struct cg3_par *) info->par;
struct cg3_regs __iomem *regs = par->regs; struct cg3_regs __iomem *regs = par->regs;
...@@ -251,8 +250,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) ...@@ -251,8 +250,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
* Initialisation * Initialisation
*/ */
static void static void __devinit cg3_init_fix(struct fb_info *info, int linebytes,
cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) struct device_node *dp)
{ {
strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
...@@ -264,8 +263,8 @@ cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) ...@@ -264,8 +263,8 @@ cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp)
info->fix.accel = FB_ACCEL_SUN_CGTHREE; info->fix.accel = FB_ACCEL_SUN_CGTHREE;
} }
static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
struct device_node *dp) struct device_node *dp)
{ {
char *params; char *params;
char *p; char *p;
...@@ -287,36 +286,36 @@ static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, ...@@ -287,36 +286,36 @@ static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
} }
} }
static u8 cg3regvals_66hz[] __initdata = { /* 1152 x 900, 66 Hz */ static u8 cg3regvals_66hz[] __devinitdata = { /* 1152 x 900, 66 Hz */
0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
0x10, 0x20, 0 0x10, 0x20, 0
}; };
static u8 cg3regvals_76hz[] __initdata = { /* 1152 x 900, 76 Hz */ static u8 cg3regvals_76hz[] __devinitdata = { /* 1152 x 900, 76 Hz */
0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
0x10, 0x24, 0 0x10, 0x24, 0
}; };
static u8 cg3regvals_rdi[] __initdata = { /* 640 x 480, cgRDI */ static u8 cg3regvals_rdi[] __devinitdata = { /* 640 x 480, cgRDI */
0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10,
0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51,
0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01,
0x10, 0x22, 0 0x10, 0x22, 0
}; };
static u8 *cg3_regvals[] __initdata = { static u8 *cg3_regvals[] __devinitdata = {
cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi
}; };
static u_char cg3_dacvals[] __initdata = { static u_char cg3_dacvals[] __devinitdata = {
4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0
}; };
static void cg3_do_default_mode(struct cg3_par *par) static void __devinit cg3_do_default_mode(struct cg3_par *par)
{ {
enum cg3_type type; enum cg3_type type;
u8 *p; u8 *p;
...@@ -433,7 +432,8 @@ static int __devinit cg3_init_one(struct of_device *op) ...@@ -433,7 +432,8 @@ static int __devinit cg3_init_one(struct of_device *op)
return 0; return 0;
} }
static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id *match) static int __devinit cg3_probe(struct of_device *dev,
const struct of_device_id *match)
{ {
struct of_device *op = to_of_device(&dev->dev); struct of_device *op = to_of_device(&dev->dev);
......
...@@ -336,14 +336,30 @@ struct ffb_dac { ...@@ -336,14 +336,30 @@ struct ffb_dac {
u32 value2; u32 value2;
}; };
#define FFB_DAC_UCTRL 0x1001 /* User Control */
#define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */
#define FFB_DAC_UCTRL_MANREV_SHIFT 8
#define FFB_DAC_TGEN 0x6000 /* Timing Generator */
#define FFB_DAC_TGEN_VIDE 0x00000001 /* Video Enable */
#define FFB_DAC_DID 0x8000 /* Device Identification */
#define FFB_DAC_DID_PNUM 0x0ffff000 /* Device Part Number */
#define FFB_DAC_DID_PNUM_SHIFT 12
#define FFB_DAC_DID_REV 0xf0000000 /* Device Revision */
#define FFB_DAC_DID_REV_SHIFT 28
#define FFB_DAC_CUR_CTRL 0x100
#define FFB_DAC_CUR_CTRL_P0 0x00000001
#define FFB_DAC_CUR_CTRL_P1 0x00000002
struct ffb_par { struct ffb_par {
spinlock_t lock; spinlock_t lock;
struct ffb_fbc __iomem *fbc; struct ffb_fbc __iomem *fbc;
struct ffb_dac __iomem *dac; struct ffb_dac __iomem *dac;
u32 flags; u32 flags;
#define FFB_FLAG_AFB 0x00000001 #define FFB_FLAG_AFB 0x00000001 /* AFB m3 or m6 */
#define FFB_FLAG_BLANKED 0x00000002 #define FFB_FLAG_BLANKED 0x00000002 /* screen is blanked */
#define FFB_FLAG_INVCURSOR 0x00000004 /* DAC has inverted cursor logic */
u32 fg_cache __attribute__((aligned (8))); u32 fg_cache __attribute__((aligned (8)));
u32 bg_cache; u32 bg_cache;
...@@ -354,7 +370,6 @@ struct ffb_par { ...@@ -354,7 +370,6 @@ struct ffb_par {
unsigned long physbase; unsigned long physbase;
unsigned long fbsize; unsigned long fbsize;
int dac_rev;
int board_type; int board_type;
}; };
...@@ -426,11 +441,12 @@ static void ffb_switch_from_graph(struct ffb_par *par) ...@@ -426,11 +441,12 @@ static void ffb_switch_from_graph(struct ffb_par *par)
FFBWait(par); FFBWait(par);
/* Disable cursor. */ /* Disable cursor. */
upa_writel(0x100, &dac->type2); upa_writel(FFB_DAC_CUR_CTRL, &dac->type2);
if (par->dac_rev <= 2) if (par->flags & FFB_FLAG_INVCURSOR)
upa_writel(0, &dac->value2); upa_writel(0, &dac->value2);
else else
upa_writel(3, &dac->value2); upa_writel((FFB_DAC_CUR_CTRL_P0 |
FFB_DAC_CUR_CTRL_P1), &dac->value2);
spin_unlock_irqrestore(&par->lock, flags); spin_unlock_irqrestore(&par->lock, flags);
} }
...@@ -664,18 +680,18 @@ ffb_blank(int blank, struct fb_info *info) ...@@ -664,18 +680,18 @@ ffb_blank(int blank, struct fb_info *info)
struct ffb_par *par = (struct ffb_par *) info->par; struct ffb_par *par = (struct ffb_par *) info->par;
struct ffb_dac __iomem *dac = par->dac; struct ffb_dac __iomem *dac = par->dac;
unsigned long flags; unsigned long flags;
u32 tmp; u32 val;
int i;
spin_lock_irqsave(&par->lock, flags); spin_lock_irqsave(&par->lock, flags);
FFBWait(par); FFBWait(par);
upa_writel(FFB_DAC_TGEN, &dac->type);
val = upa_readl(&dac->value);
switch (blank) { switch (blank) {
case FB_BLANK_UNBLANK: /* Unblanking */ case FB_BLANK_UNBLANK: /* Unblanking */
upa_writel(0x6000, &dac->type); val |= FFB_DAC_TGEN_VIDE;
tmp = (upa_readl(&dac->value) | 0x1);
upa_writel(0x6000, &dac->type);
upa_writel(tmp, &dac->value);
par->flags &= ~FFB_FLAG_BLANKED; par->flags &= ~FFB_FLAG_BLANKED;
break; break;
...@@ -683,13 +699,16 @@ ffb_blank(int blank, struct fb_info *info) ...@@ -683,13 +699,16 @@ ffb_blank(int blank, struct fb_info *info)
case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
case FB_BLANK_POWERDOWN: /* Poweroff */ case FB_BLANK_POWERDOWN: /* Poweroff */
upa_writel(0x6000, &dac->type); val &= ~FFB_DAC_TGEN_VIDE;
tmp = (upa_readl(&dac->value) & ~0x1);
upa_writel(0x6000, &dac->type);
upa_writel(tmp, &dac->value);
par->flags |= FFB_FLAG_BLANKED; par->flags |= FFB_FLAG_BLANKED;
break; break;
} }
upa_writel(FFB_DAC_TGEN, &dac->type);
upa_writel(val, &dac->value);
for (i = 0; i < 10; i++) {
upa_writel(FFB_DAC_TGEN, &dac->type);
upa_readl(&dac->value);
}
spin_unlock_irqrestore(&par->lock, flags); spin_unlock_irqrestore(&par->lock, flags);
...@@ -894,6 +913,7 @@ static int ffb_init_one(struct of_device *op) ...@@ -894,6 +913,7 @@ static int ffb_init_one(struct of_device *op)
struct ffb_dac __iomem *dac; struct ffb_dac __iomem *dac;
struct all_info *all; struct all_info *all;
int err; int err;
u32 dac_pnum, dac_rev, dac_mrev;
all = kzalloc(sizeof(*all), GFP_KERNEL); all = kzalloc(sizeof(*all), GFP_KERNEL);
if (!all) if (!all)
...@@ -948,17 +968,31 @@ static int ffb_init_one(struct of_device *op) ...@@ -948,17 +968,31 @@ static int ffb_init_one(struct of_device *op)
if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0)
upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr);
ffb_switch_from_graph(&all->par);
dac = all->par.dac; dac = all->par.dac;
upa_writel(0x8000, &dac->type); upa_writel(FFB_DAC_DID, &dac->type);
all->par.dac_rev = upa_readl(&dac->value) >> 0x1c; dac_pnum = upa_readl(&dac->value);
dac_rev = (dac_pnum & FFB_DAC_DID_REV) >> FFB_DAC_DID_REV_SHIFT;
dac_pnum = (dac_pnum & FFB_DAC_DID_PNUM) >> FFB_DAC_DID_PNUM_SHIFT;
upa_writel(FFB_DAC_UCTRL, &dac->type);
dac_mrev = upa_readl(&dac->value);
dac_mrev = (dac_mrev & FFB_DAC_UCTRL_MANREV) >>
FFB_DAC_UCTRL_MANREV_SHIFT;
/* Elite3D has different DAC revision numbering, and no DAC revisions /* Elite3D has different DAC revision numbering, and no DAC revisions
* have the reversed meaning of cursor enable. * have the reversed meaning of cursor enable. Otherwise, Pacifica 1
* ramdacs with manufacturing revision less than 3 have inverted
* cursor logic. We identify Pacifica 1 as not Pacifica 2, the
* latter having a part number value of 0x236e.
*/ */
if (all->par.flags & FFB_FLAG_AFB) if ((all->par.flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) {
all->par.dac_rev = 10; all->par.flags &= ~FFB_FLAG_INVCURSOR;
} else {
if (dac_mrev < 3)
all->par.flags |= FFB_FLAG_INVCURSOR;
}
ffb_switch_from_graph(&all->par);
/* Unblank it just to be sure. When there are multiple /* Unblank it just to be sure. When there are multiple
* FFB/AFB cards in the system, or it is not the OBP * FFB/AFB cards in the system, or it is not the OBP
...@@ -993,10 +1027,12 @@ static int ffb_init_one(struct of_device *op) ...@@ -993,10 +1027,12 @@ static int ffb_init_one(struct of_device *op)
dev_set_drvdata(&op->dev, all); dev_set_drvdata(&op->dev, all);
printk("%s: %s at %016lx, type %d, DAC revision %d\n", printk("%s: %s at %016lx, type %d, "
"DAC pnum[%x] rev[%d] manuf_rev[%d]\n",
dp->full_name, dp->full_name,
((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"),
all->par.physbase, all->par.board_type, all->par.dac_rev); all->par.physbase, all->par.board_type,
dac_pnum, dac_rev, dac_mrev);
return 0; return 0;
} }
......
...@@ -87,7 +87,7 @@ extern void __iomem *mstk48t02_regs; ...@@ -87,7 +87,7 @@ extern void __iomem *mstk48t02_regs;
#define MSTK_DOW_MASK 0x07 #define MSTK_DOW_MASK 0x07
#define MSTK_DOM_MASK 0x3f #define MSTK_DOM_MASK 0x3f
#define MSTK_MONTH_MASK 0x1f #define MSTK_MONTH_MASK 0x1f
#define MSTK_YEAR_MASK 0xff #define MSTK_YEAR_MASK 0xffU
/* Binary coded decimal conversion macros. */ /* Binary coded decimal conversion macros. */
#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) #define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
......
...@@ -89,7 +89,7 @@ extern void __iomem *mstk48t02_regs; ...@@ -89,7 +89,7 @@ extern void __iomem *mstk48t02_regs;
#define MSTK_DOW_MASK 0x07 #define MSTK_DOW_MASK 0x07
#define MSTK_DOM_MASK 0x3f #define MSTK_DOM_MASK 0x3f
#define MSTK_MONTH_MASK 0x1f #define MSTK_MONTH_MASK 0x1f
#define MSTK_YEAR_MASK 0xff #define MSTK_YEAR_MASK 0xffU
/* Binary coded decimal conversion macros. */ /* Binary coded decimal conversion macros. */
#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) #define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment