Skip to contentSkip to conversation

A video driver for Lynx3DM on NEC VR5701-SG2 Board.

PATCH In review Sergey Podstavin 2 participants 2 messages May 31, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 A video driver for Lynx3DM on NEC VR5701-SG2 Board.

Hi Antonio!

Attached is a video driver for Lynx3DM SM722, Silicon Motion Inc. It was designed for NEC VR5701-SG2 Board, MIPS-CPU Vr5701. Please review it.

Best wishes,
Sergey Podstavin.

drivers/video/Kconfig +19 -0
diff -Naurp --exclude=CVS linux_save/drivers/video/Kconfig linux_mips/drivers/video/Kconfig
@@ -1027,6 +1027,25 @@ config FB_ATY_GX
 	  is at
 	  <http://support.ati.com/products/pc/mach64/graphics_xpression.html>.
 
+config FB_SM
+	tristate "Silicon Motion SM722 support"
+	depends on FB && PCI
+	help
+	  SM722
+
+choice
+	prompt "Display size"
+	depends on FB_SM
+	default DISPLAY_640x480
+
+config DISPLAY_640x480
+	bool "640x480"
+
+config DISPLAY_1024x768
+	bool "1024x768"
+
+endchoice
+
 config FB_SAVAGE
 	tristate "S3 Savage support"
 	depends on FB && PCI && EXPERIMENTAL
drivers/video/Makefile +1 -0
diff -Naurp --exclude=CVS linux_save/drivers/video/Makefile linux_mips/drivers/video/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_FB_KYRO)             += kyr
 obj-$(CONFIG_FB_SAVAGE)		  += savage/
 obj-$(CONFIG_FB_GEODE)		  += geode/
 obj-$(CONFIG_FB_I810)             += vgastate.o
+obj-$(CONFIG_FB_SM)               += smi/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_RADEON_OLD)	  += radeonfb.o
 obj-$(CONFIG_FB_NEOMAGIC)         += neofb.o vgastate.o
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
drivers/video/smi/Makefile +9 -0
diff -Naurp --exclude=CVS linux_save/drivers/video/smi/Makefile linux_mips/drivers/video/smi/Makefile
@@ -0,0 +1,9 @@
+#
+# Makefile for LynxEM+/EM4+(Silicon Motion Inc.) fb driver for VR5701-SG2
+# under Linux.
+#
+
+obj-$(CONFIG_FB_SM)	+= smfb.o
+
+smfb-objs	:= smi_base.o smi_hw.o 
+
drivers/video/smi/smi_base.c +532 -0

532 lines not on this page · raw message

drivers/video/smi/smifb.h +89 -0

89 lines not on this page · raw message

drivers/video/smi/smi_hw.c +188 -0

188 lines not on this page · raw message

drivers/video/smi/smi_hw.h +197 -0

197 lines not on this page · raw message

drivers/video/smi/smi_params.h +442 -0

442 lines not on this page · raw message

#1 lore raw
Quoted 15 lines · Sergey Podstavin

Attached is a video driver for Lynx3DM SM722, Silicon Motion Inc. It was designed for NEC VR5701-SG2 Board, MIPS-CPU Vr5701. Please review it.

drivers/video/Kconfig +6 -0
@@ -1027,6 +1027,25 @@ config FB_ATY_GX
 	  is at
 	  <http://support.ati.com/products/pc/mach64/graphics_xpression.html>.
 
+config FB_SM
+	tristate "Silicon Motion SM722 support"
+	depends on FB && PCI
+	help
+	  SM722
+

drivers/video/Kconfig config FB_ATY_GX · line 1045

Quoted 10 lines
drivers/video/Kconfig +10 -0
+choice
+	prompt "Display size"
+	depends on FB_SM
+	default DISPLAY_640x480
+
+config DISPLAY_640x480
+	bool "640x480"
+
+config DISPLAY_1024x768
+	bool "1024x768"

Why do you need DISPLAY_640x480 and DISPLAY_1024x768?

Quoted 49 lines
drivers/video/smi/smi_base.c +46 -0
@@ -0,0 +1,532 @@
+/*
+ * drivers/video/smi/smi_base.c
+ *
+ * LynxEM+/EM4+(Silicon Motion Inc.) fb driver	for VR5701-SG2
+ *
+ * Author: Sergey Podstavin <[email protected]>
+ *
+ * 2005 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/selection.h>
+#include <linux/tty.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/console.h>
+#include "../console/fbcon.h"
+#include "smifb.h"
+#include "smi_hw.h"
+
+/*
+ * Card Identification
+ *
+ */
+static struct pci_device_id smifb_pci_tbl[] __devinitdata = {
+	{PCI_VENDOR_ID_SMI, PCI_DEVICE_ID_SMI_LYNX_EM_PLUS,
+	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},	/* Lynx EM+/EM4+ */
+	{PCI_VENDOR_ID_SMI, PCI_DEVICE_ID_SMI_LYNX_3DM,
+	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},	/* Lynx 3DM/3DM+/3DM4+ */
+	{0,}			/* terminate list */
+};
+
+MODULE_DEVICE_TABLE(pci, smifb_pci_tbl);
+
+/*

drivers/video/smi/smi_base.c line 56

Quoted 10 lines
drivers/video/smi/smi_base.c +10 -0
+ *
+ * global variables
+ *
+ */
+
+#ifdef CONFIG_DISPLAY_1024x768
+/* 1024x768, 16bpp, 60Hz */
+static struct fb_var_screeninfo smifb_default_var = {
+      xres:1024,
+      yres:768,

Please use C99-style struct initializers, e.g.

	.xres = 1024,
Quoted 4 lines
drivers/video/smi/smi_base.c +4 -0
+/*
+ * VGA registers
+ *
+ */

drivers/video/smi/smi_base.c line 236

Quoted 10 lines
drivers/video/smi/smi_base.c +10 -0
+static void Unlock(struct smifb_info *sinfo)
+{
+	pr_debug("Unlock");
+	regSR_write(sinfo->mmio, 0x33, regSR_read(sinfo->mmio, 0x33) & 0x20);
+}
+
+static void Lock(struct smifb_info *sinfo)
+{
+	pr_debug("Lock");
+}

Hmm, Lock() doesn't do anything, while Unlock() does?

Quoted 11 lines

diff -Naurp --exclude=CVS linux_save/drivers/video/smi/smifb.h linux_mips/drivers/video/smi/smifb.h

drivers/video/smi/smifb.h +7 -0
@@ -0,0 +1,89 @@
+/*
+ * drivers/video/smi/smifb.h
+ *
+ * LynxEM+/EM4+(Silicon Motion Inc.) fb driver	for VR5701-SG2
+ *
+ * Author: Sergey Podstavin <[email protected]>
+ *

drivers/video/smi/smifb.h line 17

Quoted 10 lines
drivers/video/smi/smifb.h +10 -0
+ * 2005 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#ifndef __SMIFB_H__
+#define __SMIFB_H__
+
+#define FBCON_HAS_CFB16

Relic from 2.4?

drivers/video/smi/smifb.h line 62

Quoted 2 lines
drivers/video/smi/smifb.h +2 -0
+struct smifb_info;
+struct smifb_info {

You don't need a forward declaration just before the real declaration.

drivers/video/smi/smifb.h line 78

Quoted 11 lines
drivers/video/smi/smifb.h +11 -0
+	/* PCI base physical addresses */
+	unsigned long fb_base_phys;	/* physical Frame Buffer base address                  */
+	unsigned long dpr_base_phys;	/* physical Drawing Processor base address             */
+	unsigned long vpr_base_phys;	/* physical Video Processor base address               */
+	unsigned long cpr_base_phys;	/* physical Capture Processor base address             */
+	unsigned long mmio_base_phys;	/* physical MMIO spase (VGA + SMI regs ?) base address */
+	unsigned long dpport_base_phys;	/* physical Drawing Processor Data Port base address   */
+	int dpport_size;	/* size of Drawin Processor Data Port memory space     */
+
+	/* PCI base virtual addresses */
+	caddr_t base;		/* address of base */

unsigned long?

drivers/video/smi/smifb.h line 84

Quoted 6 lines
drivers/video/smi/smifb.h +6 -0
+	caddr_t fb_base;	/* address of frame buffer base */
+	caddr_t dpr;		/* Drawing Processor Registers  */
+	caddr_t vpr;		/* Video Processor Registers    */
+	caddr_t cpr;		/* Capture Processor Registers  */
+	caddr_t mmio;		/* Memory Mapped I/O Port       */
+	caddr_t dpport;		/* Drawing Processor Data       */

Etc.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds