mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
mass storage nand almost working
This commit is contained in:
@@ -220,11 +220,13 @@ bool kMemory_arch_map (kMemory *mem, kPage *page, unsigned address):
|
||||
mem->unmap (table->page[idx])
|
||||
table->entrylo[idx] = make_entry_lo (page)
|
||||
table->page[idx] = page
|
||||
//kdebug ("mapped ")
|
||||
//kdebug_num (page->frame)
|
||||
//kdebug (" at address ")
|
||||
//kdebug_num (address)
|
||||
//kdebug ('\n')
|
||||
#if 0
|
||||
kdebug ("mapped ")
|
||||
kdebug_num (page->frame)
|
||||
kdebug (" at address ")
|
||||
kdebug_num (address)
|
||||
kdebug ('\n')
|
||||
#endif
|
||||
page->mapping = address
|
||||
page->arch.next_mapped = mem->arch.shadow[address >> 21]
|
||||
if page->arch.next_mapped:
|
||||
|
||||
@@ -80,6 +80,9 @@ static unsigned rdata ():
|
||||
static void reset ():
|
||||
// Set up.
|
||||
gpio_as_nand ()
|
||||
gpio_as_gpio (2, 1 << 30)
|
||||
gpio_as_input (2, 1 << 30)
|
||||
gpio_enable_pull (2, 1 << 30)
|
||||
EMC_NFCSR = EMC_NFCSR_NFE1 | EMC_NFCSR_NFCE1
|
||||
|
||||
// Reset nand.
|
||||
@@ -149,11 +152,11 @@ static bool read (unsigned a, char *buffer):
|
||||
addr (col)
|
||||
addr (col >> 8)
|
||||
cmd (CMD_RNDOUTSTART)
|
||||
//debug ("parity data:")
|
||||
debug ("parity data:")
|
||||
for unsigned t = 0; t < 9; ++t:
|
||||
error[t] = rdata ()
|
||||
//debug (" %x", error[t] & 0xff)
|
||||
//debug ("\n")
|
||||
debug (" %x", error[t] & 0xff)
|
||||
debug ("\n")
|
||||
cmd (CMD_RNDOUT)
|
||||
addr (column)
|
||||
addr (column >> 8)
|
||||
@@ -165,8 +168,10 @@ static bool read (unsigned a, char *buffer):
|
||||
for unsigned t = 0; t < 9; ++t:
|
||||
((volatile char *)&EMC_NFPAR (0))[t] = error[t]
|
||||
EMC_NFECR = EMC_NFECR_ECCE | EMC_NFECR_RS | EMC_NFECR_RS_DECODING | EMC_NFECR_PRDY
|
||||
debug ("before\n")
|
||||
while !(EMC_NFINTS & EMC_NFINTS_DECF):
|
||||
DELAY ()
|
||||
debug ("after\n")
|
||||
unsigned ints = EMC_NFINTS
|
||||
if ints & EMC_NFINTS_UNCOR:
|
||||
debug ("uncorrectable error in nand at %x\n", a)
|
||||
|
||||
Reference in New Issue
Block a user