shithub: riscv

Download patch

ref: b4e7d8fbf35200eccef55cee2a6f8ed27ce8c85e
parent: e6b30b287c4386075ee045327c2c28474ae11cfe
author: cinap_lenrek <[email protected]>
date: Tue Mar 29 01:06:32 EDT 2016

zynq: cleanup devarch, flushmmu() after procflushpsecg()

--- a/sys/src/9/zynq/devarch.c
+++ b/sys/src/9/zynq/devarch.c
@@ -165,8 +165,7 @@
 		slcr[0x900/4] = 0xf;
 		slcr[0x240/4] = 0;
 		devc[DEVMASK] |= DONE;
-		if(axi != nil)
-			axi->attr &= ~SG_FAULT;
+		axi->attr &= ~SG_FAULT;
 		wakeup(&pldoner);
 	}
 	if((fl & DMADONE) != 0){
@@ -181,6 +180,13 @@
 {
 	Physseg seg;
 
+	memset(&seg, 0, sizeof seg);
+	seg.attr = SG_PHYSICAL | SG_FAULT;
+	seg.name = "axi";
+	seg.pa = 0x40000000;
+	seg.size = 0x8000000;
+	axi = addphysseg(&seg);
+
 	devc[DEVCTRL] &= ~(PROG|1<<25);
 	devc[DEVCTRL] |= 3<<26|PROG;
 	devc[DEVISTS] = -1;
@@ -188,22 +194,14 @@
 	intrenable(DEVCIRQ, plirq, nil, LEVEL, "pl");
 	
 	slcr[FPGA0_CLK_CTRL] = 1<<20 | 10<<8;
-
-	memset(&seg, 0, sizeof seg);
-	seg.attr = SG_PHYSICAL | SG_FAULT;
-	seg.name = "axi";
-	seg.pa = 0x40000000;
-	seg.size = 0x8000000;
-	axi = addphysseg(&seg);
 }
 
 static void
 plconf(void)
 {
-	if(axi != nil){
-		axi->attr |= SG_FAULT;
-		procflushpseg(axi);
-	}
+	axi->attr |= SG_FAULT;
+	procflushpseg(axi);
+	flushmmu();
 
 	slcr[0x240/4] = 0xf;
 	slcr[0x900/4] = 0xa;