Skip to contentSkip to conversation

SGI O2 gbe/crm patch

PATCH Andrew Randrianasulu 2 participants 2 messages Apr 29, 2009

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

I've moved some code around and add few defines here, no new features, driver should work as before. I want to add something actually useful on top of this in near future. This stuff doesn't have any license header diff yet, i guess i need to ask NetBSD devs first about proper procedure . All hard work on writing working driver (including various useful defines) was done by Jared D. McNeill and Michael Lorenz. My own code not even started, but i want to give credit to people who actually inspired me and made such kind of work possible. Also Dmitri Vorobiev was very helpful, he survived tons of stupid questions from me. So, my part here is small ... just want to roll this stone a bit, may be others will follow.

Just for clarification: all bugs in this code are mine :)

drivers/video/gbefb.c +34 -34
index fe5b519..ed732a8 100644
@@ -193,7 +193,7 @@ static int flat_panel_enabled = 0;
 static void gbe_reset(void)
 {
 	/* Turn on dotclock PLL */
-	gbe->ctrlstat = 0x300aa000;
+	gbe->sgi_gbe_first.ctrlstat = 0x300aa000;
 }
 
 
@@ -213,7 +213,7 @@ void gbe_turn_off(void)
 	gbe_turned_on = 0;
 
 	/* check if pixel counter is on */
-	val = gbe->vt_xy;
+	val = gbe->sgi_gbe_vt.vt_xy;
 	if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1)
 		return;
 
@@ -254,11 +254,11 @@ void gbe_turn_off(void)
 		printk(KERN_ERR "gbefb: turn off DMA timed out\n");
 
 	/* wait for vpixen_off */
-	val = gbe->vt_vpixen;
+	val = gbe->sgi_gbe_vt.vt_vpixen;
 	vpixen_off = GET_GBE_FIELD(VT_VPIXEN, VPIXEN_OFF, val);
 
 	for (i = 0; i < 100000; i++) {
-		val = gbe->vt_xy;
+		val = gbe->sgi_gbe_vt.vt_xy;
 		x = GET_GBE_FIELD(VT_XY, X, val);
 		y = GET_GBE_FIELD(VT_XY, Y, val);
 		if (y < vpixen_off)
@@ -269,7 +269,7 @@ void gbe_turn_off(void)
 		printk(KERN_ERR
 		       "gbefb: wait for vpixen_off timed out\n");
 	for (i = 0; i < 10000; i++) {
-		val = gbe->vt_xy;
+		val = gbe->sgi_gbe_vt.vt_xy;
 		x = GET_GBE_FIELD(VT_XY, X, val);
 		y = GET_GBE_FIELD(VT_XY, Y, val);
 		if (y > vpixen_off)
@@ -282,10 +282,10 @@ void gbe_turn_off(void)
 	/* turn off pixel counter */
 	val = 0;
 	SET_GBE_FIELD(VT_XY, FREEZE, val, 1);
-	gbe->vt_xy = val;
+	gbe->sgi_gbe_vt.vt_xy = val;
 	udelay(10000);
 	for (i = 0; i < 10000; i++) {
-		val = gbe->vt_xy;
+		val = gbe->sgi_gbe_vt.vt_xy;
 		if (GET_GBE_FIELD(VT_XY, FREEZE, val) != 1)
 			udelay(10);
 		else
@@ -295,12 +295,12 @@ void gbe_turn_off(void)
 		printk(KERN_ERR "gbefb: turn off pixel clock timed out\n");
 
 	/* turn off dot clock */
-	val = gbe->dotclock;
+	val = gbe->sgi_gbe_first.dotclock;
 	SET_GBE_FIELD(DOTCLK, RUN, val, 0);
-	gbe->dotclock = val;
+	gbe->sgi_gbe_first.dotclock = val;
 	udelay(10000);
 	for (i = 0; i < 10000; i++) {
-		val = gbe->dotclock;
+		val = gbe->sgi_gbe_first.dotclock;
 		if (GET_GBE_FIELD(DOTCLK, RUN, val))
 			udelay(10);
 		else
@@ -326,18 +326,18 @@ static void gbe_turn_on(void)
 	 * code hangs Visual Workstations
 	 */
 	if (gbe_revision < 2) {
-		val = gbe->vt_xy;
+		val = gbe->sgi_gbe_vt.vt_xy;
 		if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 0)
 			return;
 	}
 
 	/* turn on dot clock */
-	val = gbe->dotclock;
+	val = gbe->sgi_gbe_first.dotclock;
 	SET_GBE_FIELD(DOTCLK, RUN, val, 1);
-	gbe->dotclock = val;
+	gbe->sgi_gbe_first.dotclock = val;
 	udelay(10000);
 	for (i = 0; i < 10000; i++) {
-		val = gbe->dotclock;
+		val = gbe->sgi_gbe_first.dotclock;
 		if (GET_GBE_FIELD(DOTCLK, RUN, val) != 1)
 			udelay(10);
 		else
@@ -349,10 +349,10 @@ static void gbe_turn_on(void)
 	/* turn on pixel counter */
 	val = 0;
 	SET_GBE_FIELD(VT_XY, FREEZE, val, 0);
-	gbe->vt_xy = val;
+	gbe->sgi_gbe_vt.vt_xy = val;
 	udelay(10000);
 	for (i = 0; i < 10000; i++) {
-		val = gbe->vt_xy;
+		val = gbe->sgi_gbe_vt.vt_xy;
 		if (GET_GBE_FIELD(VT_XY, FREEZE, val))
 			udelay(10);
 		else
@@ -428,7 +428,7 @@ static void gbefb_setup_flatpanel(struct gbe_timing_info *timing)
 		(timing->flags & FB_SYNC_HOR_HIGH_ACT) ? 0 : 1);
 	SET_GBE_FIELD(VT_FLAGS, VDRV_INVERT, outputVal,
 		(timing->flags & FB_SYNC_VERT_HIGH_ACT) ? 0 : 1);
-	gbe->vt_flags = outputVal;
+	gbe->sgi_gbe_vt.vt_flags = outputVal;
 
 	/* Turn on the flat panel */
 	fp_wid = 1600;
@@ -442,14 +442,14 @@ static void gbefb_setup_flatpanel(struct gbe_timing_info *timing)
 	outputVal = 0;
 	SET_GBE_FIELD(FP_DE, ON, outputVal, fp_vbs);
 	SET_GBE_FIELD(FP_DE, OFF, outputVal, fp_vbe);
-	gbe->fp_de = outputVal;
+	gbe->sgi_gbe_vt.fp_de = outputVal;
 	outputVal = 0;
 	SET_GBE_FIELD(FP_HDRV, OFF, outputVal, fp_wid);
-	gbe->fp_hdrv = outputVal;
+	gbe->sgi_gbe_vt.fp_hdrv = outputVal;
 	outputVal = 0;
 	SET_GBE_FIELD(FP_VDRV, ON, outputVal, 1);
 	SET_GBE_FIELD(FP_VDRV, OFF, outputVal, fp_hgt + 1);
-	gbe->fp_vdrv = outputVal;
+	gbe->sgi_gbe_vt.fp_vdrv = outputVal;
 }
 
 struct gbe_pll_info {
@@ -550,44 +550,44 @@ static void gbe_set_timing_info(struct gbe_timing_info *timing)
 	SET_GBE_FIELD(DOTCLK, N, val, timing->pll_n - 1);
 	SET_GBE_FIELD(DOTCLK, P, val, timing->pll_p);
 	SET_GBE_FIELD(DOTCLK, RUN, val, 0);	/* do not start yet */
-	gbe->dotclock = val;
+	gbe->sgi_gbe_first.dotclock = val;
 	udelay(10000);
 
 	/* setup pixel counter */
 	val = 0;
 	SET_GBE_FIELD(VT_XYMAX, MAXX, val, timing->htotal);
 	SET_GBE_FIELD(VT_XYMAX, MAXY, val, timing->vtotal);
-	gbe->vt_xymax = val;
+	gbe->sgi_gbe_vt.vt_xymax = val;
 
 	/* setup video timing signals */
 	val = 0;
 	SET_GBE_FIELD(VT_VSYNC, VSYNC_ON, val, timing->vsync_start);
 	SET_GBE_FIELD(VT_VSYNC, VSYNC_OFF, val, timing->vsync_end);
-	gbe->vt_vsync = val;
+	gbe->sgi_gbe_vt.vt_vsync = val;
 	val = 0;
 	SET_GBE_FIELD(VT_HSYNC, HSYNC_ON, val, timing->hsync_start);
 	SET_GBE_FIELD(VT_HSYNC, HSYNC_OFF, val, timing->hsync_end);
-	gbe->vt_hsync = val;
+	gbe->sgi_gbe_vt.vt_hsync = val;
 	val = 0;
 	SET_GBE_FIELD(VT_VBLANK, VBLANK_ON, val, timing->vblank_start);
 	SET_GBE_FIELD(VT_VBLANK, VBLANK_OFF, val, timing->vblank_end);
-	gbe->vt_vblank = val;
+	gbe->sgi_gbe_vt.vt_vblank = val;
 	val = 0;
 	SET_GBE_FIELD(VT_HBLANK, HBLANK_ON, val,
 		      timing->hblank_start - 5);
 	SET_GBE_FIELD(VT_HBLANK, HBLANK_OFF, val,
 		      timing->hblank_end - 3);
-	gbe->vt_hblank = val;
+	gbe->sgi_gbe_vt.vt_hblank = val;
 
 	/* setup internal timing signals */
 	val = 0;
 	SET_GBE_FIELD(VT_VCMAP, VCMAP_ON, val, timing->vblank_start);
 	SET_GBE_FIELD(VT_VCMAP, VCMAP_OFF, val, timing->vblank_end);
-	gbe->vt_vcmap = val;
+	gbe->sgi_gbe_vt.vt_vcmap = val;
 	val = 0;
 	SET_GBE_FIELD(VT_HCMAP, HCMAP_ON, val, timing->hblank_start);
 	SET_GBE_FIELD(VT_HCMAP, HCMAP_OFF, val, timing->hblank_end);
-	gbe->vt_hcmap = val;
+	gbe->sgi_gbe_vt.vt_hcmap = val;
 
 	val = 0;
 	temp = timing->vblank_start - timing->vblank_end - 1;
@@ -631,17 +631,17 @@ static void gbe_set_timing_info(struct gbe_timing_info *timing)
 	SET_GBE_FIELD(VT_HPIXEN, HPIXEN_OFF, val,
 		      ((temp + timing->width -
 			GBE_PIXEN_MAGIC_OFF) % timing->htotal));
-	gbe->vt_hpixen = val;
+	gbe->sgi_gbe_vt.vt_hpixen = val;
 
 	val = 0;
 	SET_GBE_FIELD(VT_VPIXEN, VPIXEN_ON, val, timing->vblank_end);
 	SET_GBE_FIELD(VT_VPIXEN, VPIXEN_OFF, val, timing->vblank_start);
-	gbe->vt_vpixen = val;
+	gbe->sgi_gbe_vt.vt_vpixen = val;
 
 	/* turn off sync on green */
 	val = 0;
 	SET_GBE_FIELD(VT_FLAGS, SYNC_LOW, val, 1);
-	gbe->vt_flags = val;
+	gbe->sgi_gbe_vt.vt_flags = val;
 }
 
 /*
@@ -693,8 +693,8 @@ static int gbefb_set_par(struct fb_info *info)
 		gbe->mode_regs[i] = val;
 
 	/* Initialize interrupts */
-	gbe->vt_intr01 = 0xffffffff;
-	gbe->vt_intr23 = 0xffffffff;
+	gbe->sgi_gbe_vt.vt_intr01 = 0xffffffff;
+	gbe->sgi_gbe_vt.vt_intr23 = 0xffffffff;
 
 	/* HACK:
 	   The GBE hardware uses a tiled memory to screen mapping. Tiles are
@@ -1159,7 +1159,7 @@ static int __init gbefb_probe(struct platform_device *p_dev)
 		ret = -ENXIO;
 		goto out_release_mem_region;
 	}
-	gbe_revision = gbe->ctrlstat & 15;
+	gbe_revision = gbe->sgi_gbe_first.ctrlstat & 15;
 
 	gbe_tiles.cpu =
 		dma_alloc_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),
include/video/gbe.h +271 -0

283 lines not on this page · raw message

#1 lore raw

Andrew Randrianasulu wrote:

[...]

Quoted 3 lines

ZGlmZiAtLWdpdCBhL2RyaXZlcnMvdmlkZW8vZ2JlZmIuYyBiL2RyaXZlcnMv dmlkZW8vZ2JlZmIuYwppbmRleCBmZTViNTE5Li5lZDczMmE4IDEwMDY0NAot LS0gYS9kcml2ZXJzL3ZpZGVvL2diZWZiLmMKKysrIGIvZHJpdmVycy92aWRl

[...]

I can't read that.

Please send patches as outlined here:
http://www.linux-mips.org/git?p=linux.git;a=blob;f=Documentation/SubmittingPatches;h=f309d3c6221c3699a0c0b97fbe689faed09e4d2f;hb=07057d15cd9cd1ccc8d1cafd286c871694d8483c

Thanks,
David Daney