Port-sgimips archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: R10K crmfb
On Tue, Jun 24, 2008 at 05:17:31PM -0400, Michael Lorenz wrote:
> [...]
> Ok, that rules out any local hacks I might have forgotten about.
> Another thing to try is this - please have a look at srch/sgimips/dev/
> crmfb.c / crmfb_setup_video(). You'll notice an awful lot of DELAY()s
> - - we need them, many register writes to the graphics backend take
> some time to complete and we don't have enough documentation to know
> if there's a busy bit somewhere we could use instead. What might help
> is to increase those delays or sprinkle some more after register writes.
I tried increasing the delays, and also did add some printfs, see attached
diff. On console I see
wr1
wr2
then the screen gets cleared, only the blue background stays,
then the screen get black
then the CRT goes in power saving mode
then the CRT wakes up, and I see the same pattern again. But this time,
instead of dark red lines in background, it's red.
After some time the red becomes dark red, and finally the system boots.
Here's the dmesg:
crime0 at mainbus0 addr 0x14000000: rev 1.1 (CRIME_ID: a1)
crmfb0 at mainbus0 addr 0x16000000: SGI CRIME Graphics Display Engine
crmfb0: initial resolution 1024x768
crmfb0: allocated 3145728 byte fb @ 0x80060000 (0xa1400000)
wr1
wr2
wr3
wr4
wr5
wr6
wr7
wr8
wr9
wr10
wr11
wr12
wr13
wr14
wr15
wr16
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr19
wr20
wr20
wr20
wr20
wr20
wr20
wr20
wr20
wr21
wr22
wr23
wr24
wr25
wr26
wr27
wr28
wr29
wr30
wr31
wr32
wr33
wr34
wr35
wr36
end
wsdisplay0 at crmfb0 kbdmux 1: console (default, vt100 emulation)
wsmux1: connecting to wsdisplay0
--
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
NetBSD: 26 ans d'experience feront toujours la difference
--
Index: crmfb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/dev/crmfb.c,v
retrieving revision 1.25
diff -u -r1.25 crmfb.c
--- crmfb.c 8 May 2008 02:10:59 -0000 1.25
+++ crmfb.c 25 Jun 2008 21:17:49 -0000
@@ -773,6 +773,7 @@
return idle;
}
+#define SETUPVIDEO_DELAY 10000
static int
crmfb_setup_video(struct crmfb_softc *sc, int depth)
{
@@ -785,14 +786,17 @@
/* disable DMA */
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_OVR_CONTROL);
d &= ~(1 << CRMFB_OVR_CONTROL_DMAEN_SHIFT);
+ printf("wr1\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_OVR_CONTROL, d);
- DELAY(50000);
+ DELAY(50 * SETUPVIDEO_DELAY);
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_FRM_CONTROL);
d &= ~(1 << CRMFB_FRM_CONTROL_DMAEN_SHIFT);
+ printf("wr2\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_CONTROL, d);
- DELAY(50000);
+ DELAY(50 * SETUPVIDEO_DELAY);
+ printf("wr3\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_DID_CONTROL, 0);
- DELAY(50000);
+ DELAY(50 * SETUPVIDEO_DELAY);
if (!crmfb_wait_dma_idle(sc))
aprint_error("crmfb: crmfb_wait_dma_idle timed out\n");
@@ -801,10 +805,12 @@
* when we re-enable DMA later
*/
d = (1 << CRMFB_VT_XY_FREEZE_SHIFT);
+ printf("wr4\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_VT_XY, d);
- delay(1000);
+ delay(1 * SETUPVIDEO_DELAY);
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_DOTCLOCK);
d &= ~(1 << CRMFB_DOTCLOCK_CLKRUN_SHIFT);
+ printf("wr5\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_DOTCLOCK, d);
/* wait for dotclock to turn off */
@@ -814,12 +820,16 @@
delay(10);
bail--;
}
+ if (bail == 0)
+ printf("crmfb_setup_video CRMFB_DOTCLOCK fail\n");
/* reset FIFO */
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_FRM_TILESIZE);
d |= (1 << CRMFB_FRM_TILESIZE_FIFOR_SHIFT);
+ printf("wr6\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_TILESIZE, d);
d &= ~(1 << CRMFB_FRM_TILESIZE_FIFOR_SHIFT);
+ printf("wr7\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_TILESIZE, d);
/* setup colour mode */
@@ -841,6 +851,7 @@
}
d = h << CRMFB_MODE_TYP_SHIFT;
d |= CRMFB_MODE_BUF_BOTH << CRMFB_MODE_BUF_SHIFT;
+ printf("wr8\n"); DELAY(2000000);
for (i = 0; i < (32 * 4); i += 4)
bus_space_write_4(sc->sc_iot, sc->sc_ioh, CRMFB_MODE + i, d);
wbflush();
@@ -848,6 +859,7 @@
/* setup tile pointer, but don't turn on DMA yet! */
h = DMAADDR(sc->sc_dmai);
d = (h >> 9) << CRMFB_FRM_CONTROL_TILEPTR_SHIFT;
+ printf("wr9\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_CONTROL, d);
/* init framebuffer width and pixel size */
@@ -872,26 +884,33 @@
panic("Unsupported depth");
}
d |= (h << CRMFB_FRM_TILESIZE_DEPTH_SHIFT);
+ printf("wr10\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_TILESIZE, d);
/*h = sc->sc_width * sc->sc_height / (512 / (depth >> 3));*/
h = sc->sc_height;
d = h << CRMFB_FRM_PIXSIZE_HEIGHT_SHIFT;
+ printf("wr11\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_PIXSIZE, d);
/* turn off firmware overlay and hardware cursor */
+ printf("wr12\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_OVR_WIDTH_TILE, 0);
+ printf("wr13\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_CURSOR_CONTROL, 0);
/* enable drawing again */
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_DOTCLOCK);
d |= (1 << CRMFB_DOTCLOCK_CLKRUN_SHIFT);
+ printf("wr14\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_DOTCLOCK, d);
+ printf("wr15\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_VT_XY, 0);
/* turn on DMA for the framebuffer */
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_FRM_CONTROL);
d |= (1 << CRMFB_FRM_CONTROL_DMAEN_SHIFT);
+ printf("wr16\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_FRM_CONTROL, d);
/* turn off sync-on-green */
@@ -901,6 +920,7 @@
d = ( 1 << CRMFB_VT_FLAGS_SYNC_LOW_LSB) &
CRMFB_REG_MASK(CRMFB_VT_FLAGS_SYNC_LOW_MSB,
CRMFB_VT_FLAGS_SYNC_LOW_LSB);
+ printf("wr17\n"); DELAY(2000000);
crmfb_write_reg(sc, CRMFB_VT_FLAGS, d);
}
@@ -925,6 +945,7 @@
reg |= (((uint64_t)(v | 0x8000)) << shift);
if (shift == 0) {
shift = 64;
+ printf("wr18\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh,
CRIME_RE_TLB_A + tlbptr + lptr,
reg);
@@ -937,6 +958,7 @@
v++;
}
if (shift != 64) {
+ printf("wr19\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh,
CRIME_RE_TLB_A + tlbptr + lptr, reg);
#ifdef CRMFB_DEBUG
@@ -952,6 +974,7 @@
tlbptr = 0;
for (i = 0; i < 8; i++) {
reg = ((uint64_t)page << 32) | (page + 1);
+ printf("wr20\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh,
CRIME_RE_LINEAR_A + tlbptr, reg);
page += 2;
@@ -960,16 +983,25 @@
wbflush();
/* do some very basic engine setup */
+ printf("wr21\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_CLIPMODE, 0);
+ printf("wr22\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_WINOFFSET_SRC, 0);
+ printf("wr23\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_WINOFFSET_DST, 0);
+ printf("wr24\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_PLANEMASK,
0xffffffff);
+ printf("wr25\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh, 0x20, 0);
+ printf("wr26\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh, 0x28, 0);
+ printf("wr27\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh, 0x30, 0);
+ printf("wr28\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh, 0x38, 0);
+ printf("wr29\n"); DELAY(2000000);
bus_space_write_8(sc->sc_iot, sc->sc_reh, 0x40, 0);
switch (depth) {
@@ -989,12 +1021,17 @@
panic("%s: unsuported colour depth %d\n", __func__,
depth);
}
+ printf("wr30\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_MODE_DST, mode);
+ printf("wr31\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_MODE_SRC, mode);
+ printf("wr32\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_XFER_STEP_X, 1);
+ printf("wr33\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_XFER_STEP_Y, 1);
/* initialize memory transfer engine */
+ printf("wr34\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_MTE_MODE,
MTE_MODE_DST_ECC |
(MTE_TLB_A << MTE_DST_TLB_SHIFT) |
@@ -1002,9 +1039,12 @@
(MTE_DEPTH_8 << MTE_DEPTH_SHIFT) |
MTE_MODE_COPY);
sc->sc_mte_direction = 1;
+ printf("wr35\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_MTE_DST_Y_STEP, 1);
+ printf("wr36\n"); DELAY(2000000);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_MTE_SRC_Y_STEP, 1);
+ printf("end\n"); DELAY(2000000);
return 0;
}
@@ -1201,7 +1241,7 @@
DE_MODE_PIXDEPTH_8);
#if 1
- delay(4000000);
+ delay(4000 * SETUPVIDEO_DELAY);
bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_MTE_BG, 0x15151515);
crmfb_wait_idle(sc);
@@ -1257,7 +1297,7 @@
(MTE_DEPTH_8 << MTE_DEPTH_SHIFT) |
0/*MTE_MODE_COPY*/);
#endif
- delay(4000000);
+ delay(4000 * SETUPVIDEO_DELAY);
#if 0
for (i = 0; i < 128; i+=8)
printf("%016llx\n", bus_space_read_8(sc->sc_iot, sc->sc_reh,
Home |
Main Index |
Thread Index |
Old Index