From: David du Colombier <0intro@gmail.com>
To: 9fans@9fans.net
Subject: Re: [9fans] rpi emmc
Date: Sun, 3 Jan 2016 05:53:47 +0100 [thread overview]
Message-ID: <20160103055347.3fd67946@neon.9fans.fr> (raw)
In-Reply-To: <ab98a6ce086002af76809331300969cc@mule>
> in diffing bls' version and sources, i see some significant
> differences, but it's not clear which one is more up-to-date.
Brian Stuart's version is more up-to-date.
Brian Stuart based his changes on the latest changes from Richard Miller,
available in /n/sources/contrib/miller/9/bcm.
term% ape/diff -Nru /n/sources/plan9/sys/src/9/bcm/emmc.c /n/sources/contrib/miller/9/bcm/emmc.c
--- /n/sources/plan9/sys/src/9/bcm/emmc.c Tue Jan 29 22:07:37 2013
+++ /n/sources/contrib/miller/9/bcm/emmc.c Wed Mar 11 12:23:33 2015
@@ -178,7 +178,11 @@
static int
datadone(void*)
{
- return emmc.datadone;
+ int i;
+
+ u32int *r = (u32int*)EMMCREGS;
+ i = r[Interrupt];
+ return i & (Datadone|Err);
}
static int
@@ -310,9 +314,9 @@
if((c & Respmask) == Resp48busy){
WR(Irpten, Datadone|Err);
tsleep(&emmc.r, datadone, 0, 3000);
- i = emmc.datadone;
- emmc.datadone = 0;
WR(Irpten, 0);
+ emmc.datadone = 0;
+ i = r[Interrupt];
if((i & Datadone) == 0)
print("emmcio: no Datadone after CMD%d\n", cmd);
if(i & Err)
@@ -380,11 +384,13 @@
&r[Data], buf, len);
if(dmawait(DmaChanEmmc) < 0)
error(Eio);
+ if(!write)
+ cachedinvse(buf, len);
WR(Irpten, Datadone|Err);
tsleep(&emmc.r, datadone, 0, 3000);
- i = emmc.datadone;
- emmc.datadone = 0;
WR(Irpten, 0);
+ emmc.datadone = 0;
+ i = r[Interrupt];
if((i & Datadone) == 0){
print("emmcio: %d timeout intr %ux stat %ux\n",
write, i, r[Status]);
@@ -407,13 +413,11 @@
mmcinterrupt(Ureg*, void*)
{
u32int *r;
- int i;
-
r = (u32int*)EMMCREGS;
- i = r[Interrupt];
- r[Interrupt] = i & (Datadone|Err);
- emmc.datadone = i;
- wakeup(&emmc.r);
+ if(r[Interrupt]&(Datadone|Err)){
+ WR(Irpten, 0);
+ wakeup(&emmc.r);
+ }
}
SDio sdio = {
--
David du Colombier
next prev parent reply other threads:[~2016-01-03 4:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-03 2:28 erik quanstrom
2016-01-03 4:53 ` David du Colombier [this message]
[not found] <1064208925.81416.1451798293880.JavaMail.yahoo.ref@mail.yahoo.com>
2016-01-03 5:18 ` Brian L. Stuart
2016-01-03 5:27 ` erik quanstrom
2016-01-03 5:29 ` David du Colombier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160103055347.3fd67946@neon.9fans.fr \
--to=0intro@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).