patch-2.4.9 linux/drivers/video/cyber2000fb.c
Next file: linux/drivers/video/cyberfb.h
Previous file: linux/drivers/video/controlfb.h
Back to the patch index
Back to the overall index
- Lines: 161
- Date:
Sun Aug 12 17:37:53 2001
- Orig file:
v2.4.8/linux/drivers/video/cyber2000fb.c
- Orig date:
Wed Jul 25 17:10:24 2001
diff -u --recursive --new-file v2.4.8/linux/drivers/video/cyber2000fb.c linux/drivers/video/cyber2000fb.c
@@ -53,15 +53,6 @@
*/
/*#define CFB16_IS_CFB15*/
-/*
- * This is the offset of the PCI space in physical memory
- */
-#ifdef CONFIG_FOOTBRIDGE
-#define PCI_PHYS_OFFSET 0x80000000
-#else
-#define PCI_PHYS_OFFSET 0x00000000
-#endif
-
static char *CyberRegs;
#include "cyber2000fb.h"
@@ -1074,18 +1065,18 @@
case 2: /* vsync off */
cyber2000_grphw(0x16, 0x04);
break;
- case 1: /* just software blanking of screen */
+ case 1: /* soft blank */
cyber2000_grphw(0x16, 0x00);
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < NR_PALETTE; i++) {
cyber2000_outb(i, 0x3c8);
cyber2000_outb(0, 0x3c9);
cyber2000_outb(0, 0x3c9);
cyber2000_outb(0, 0x3c9);
}
break;
- default: /* case 0, or anything else: unblank */
+ default: /* unblank */
cyber2000_grphw(0x16, 0x00);
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < NR_PALETTE; i++) {
cyber2000_outb(i, 0x3c8);
cyber2000_outb(cfb->palette[i].red, 0x3c9);
cyber2000_outb(cfb->palette[i].green, 0x3c9);
@@ -1323,7 +1314,7 @@
cyber2000_outb(0x01, 0x3cf);
/*
- * MCLK on the NetWinder is fixed at 75MHz
+ * MCLK on the NetWinder and the Shark is fixed at 75MHz
*/
cfb->mclk_mult = 0xdb;
cfb->mclk_div = 0x54;
@@ -1361,7 +1352,7 @@
}
static struct cfb_info * __devinit
-cyberpro_alloc_fb_info(struct pci_dev *dev, const struct pci_device_id *id)
+cyberpro_alloc_fb_info(struct pci_dev *dev, const struct pci_device_id *id, char *name)
{
struct cfb_info *cfb;
@@ -1385,7 +1376,7 @@
else
cfb->divisors[3] = 8;
- sprintf(cfb->fb.fix.id, "CyberPro%4X", id->device);
+ strcpy(cfb->fb.fix.id, name);
cfb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
cfb->fb.fix.type_aux = 0;
@@ -1440,14 +1431,9 @@
mmio_base = pci_resource_start(dev, 0) + MMIO_OFFSET;
- cfb->fb.fix.mmio_start = mmio_base + PCI_PHYS_OFFSET;
+ cfb->fb.fix.mmio_start = mmio_base;
cfb->fb.fix.mmio_len = MMIO_SIZE;
- if (!request_mem_region(mmio_base, MMIO_SIZE, "memory mapped I/O")) {
- printk("%s: memory mapped IO in use\n", cfb->fb.fix.id);
- return -EBUSY;
- }
-
CyberRegs = ioremap(mmio_base, MMIO_SIZE);
if (!CyberRegs) {
printk("%s: unable to map memory mapped IO\n",
@@ -1465,9 +1451,6 @@
if (cfb && CyberRegs) {
iounmap(CyberRegs);
CyberRegs = NULL;
-
- release_mem_region(cfb->fb.fix.mmio_start - PCI_PHYS_OFFSET,
- cfb->fb.fix.mmio_len);
}
}
@@ -1481,15 +1464,9 @@
smem_base = pci_resource_start(dev, 0);
- cfb->fb.fix.smem_start = smem_base + PCI_PHYS_OFFSET;
+ cfb->fb.fix.smem_start = smem_base;
cfb->fb.fix.smem_len = smem_len;
- if (!request_mem_region(smem_base, smem_len, "frame buffer")) {
- printk("%s: frame buffer in use\n",
- cfb->fb.fix.id);
- return -EBUSY;
- }
-
cfb->fb.screen_base = ioremap(smem_base, smem_len);
if (!cfb->fb.screen_base) {
printk("%s: unable to map screen memory\n",
@@ -1505,9 +1482,6 @@
if (cfb && cfb->fb.screen_base) {
iounmap(cfb->fb.screen_base);
cfb->fb.screen_base = NULL;
-
- release_mem_region(cfb->fb.fix.smem_start - PCI_PHYS_OFFSET,
- cfb->fb.fix.smem_len);
}
}
@@ -1517,14 +1491,21 @@
struct cfb_info *cfb;
u_int h_sync, v_sync;
u_long smem_size;
+ char name[16];
int err;
+ sprintf(name, "CyberPro%4X", id->device);
+
err = pci_enable_device(dev);
if (err)
return err;
+ err = pci_request_regions(dev, name);
+ if (err)
+ return err;
+
err = -ENOMEM;
- cfb = cyberpro_alloc_fb_info(dev, id);
+ cfb = cyberpro_alloc_fb_info(dev, id, name);
if (!cfb)
goto failed;
@@ -1593,6 +1574,9 @@
cyberpro_unmap_mmio(cfb);
cyberpro_free_fb_info(cfb);
+release:
+ pci_release_regions(dev);
+
return err;
}
@@ -1621,6 +1605,8 @@
pci_set_drvdata(dev, NULL);
if (cfb == int_cfb_info)
int_cfb_info = NULL;
+
+ pci_release_regions(dev);
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)