In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "Hardware/NAND Interface"

From WiiBrew
Jump to navigation Jump to search
(Undo revision 88046 by Cease and Desist (Talk))
Line 1: Line 1:
This is a warning to the owners of this site. My name is Shigeru Miyamoto and I am disappoint. You are breaking the DCMA laws. DCMA laws protect our freedoms far into the furture. There is over 9000 pages here and I want every single one of them gone by next week. This is not a threat but a promise. Every day after that week is up, I will sue you for $100,000 a day.
+
{{Infobox MMIO
 
+
| arm = Full
Thank you for using Nintendo. We must ensure our freedoms through use of the DCMA. This not the analog millennium one passed in 1000 A.D., but the digital one.
+
| base = 0x0d010000
 
+
| len = 0x1C
==CEASE==
+
| bits = 32
AND DESIST
+
| hwdirq = 1
 +
}}
 +
== Register List ==
 +
{{reglist|NAND Interface}}
 +
{{rla|0x0d010000|32|NAND_CTRL|NAND Control and Status}}
 +
{{rla|0x0d010004|32|NAND_CONFIG|??}}
 +
{{rla|0x0d010008|32|NAND_ADDR1|Address bytes 1-2 (column)}}
 +
{{rla|0x0d01000c|32|NAND_ADDR2|Address bytes 3-5 (row)}}
 +
{{rla|0x0d010010|32|NAND_DATABUF|Memory address of the Data buffer}}
 +
{{rla|0x0d010014|32|NAND_ECCBUF|Memory address of the Spare buffer}}
 +
{{rla|0x0d010018|32|NAND_UNK|Unknown}}
 +
|}
 +
== Register Details ==
 +
{{reg32 | NAND_CTRL | addr = 0x0d010000 | hifields = 9 | lofields = 5 |
 +
|1|1|1|1|1|1|1|1|8|
 +
|R/W|R/W|R/W|R/W|R/W|R/W|R/W|R/W|R/W|
 +
|EXEC|IRQ|ERR|A5|A4|A3|A2|A1|COMMAND||
 +
|1|1|1|1|12|
 +
|R/W|R/W|R/W|R/W|W|
 +
|WAIT|WR|RD|ECC|DATALEN|
 +
}}
 +
This register controls the state of the NAND interface.
 +
{{regdesc
 +
|EXEC|Write 1: initiate NAND command<br/>Write 0: reset NAND interface<br/>Read: NAND interface busy
 +
|IRQ|Set to enable IRQ generation when command is complete
 +
|ERR|If set, NAND error occured (?){{check}}
 +
|A5|Send fifth address byte (typ. row address high)
 +
|A4|Send fourth address byte (typ. row address mid)
 +
|A3|Send third address byte (typ. row address low)
 +
|A2|Send second address byte (typ. column address high)
 +
|A1|Send first address byte (typ. column address low)
 +
|COMMAND|8-bit NAND command
 +
|WAIT|Wait for R/B to go high between address and data phases (wait for read/write/erase/reset)
 +
|WR|Transfer data to the NAND chip
 +
|RD|Transfer data from the NAND chip
 +
|ECC|Calculate ECC or ?? {{check}}
 +
|DATALEN|Number of bytes to transfer during the data phase
 +
}}
 +
----
 +
{{reg32 | NAND_CONFIG | addr = 0x0d010004 | hifields = 4 | lofields = 2 |
 +
|4|1|4|8|
 +
|R/W|R/W|R/W|R/W|
 +
|ATTR0|ENABLE|ATTR1|ATTR2||
 +
|8|8|
 +
|R/W|R/W|
 +
|ATTR3|ATTR4|
 +
}}
 +
This register probably configures certain aspects of the NAND interface (timings?){{check}}.  
 +
{{regdesc
 +
|ATTR0|Set based on lookup table; set to 3 for 128MB NAND chips, 4 otherwise
 +
|ENABLE|Set to 1 before first command is sent to NAND, set to 0 when de-initializing the NAND driver.
 +
|ATTR1|Set based on lookup table; always 0x3
 +
|ATTR2|Set based on lookup table; always 0x3e
 +
|ATTR3|Set based on lookup table; always 0x0e
 +
|ATTR4|Set based on lookup table; always 0x7f
 +
}}
 +
When IOS initializes the NAND driver, it turns on the enable bit (writing 0x08000000) and then send the GET CHIP ID command (0x90). Based on the reply, it looks up the correct definitions of the other attributes and pokes them into this register (generally, 0x4b3e0e7f).
 +
----
 +
{{reg32 | NAND_ADDR1 | addr = 0x0d010008 | hifields = 1 | lofields = 2 |
 +
|16|
 +
|U|
 +
|||
 +
|8|8|
 +
|R/W|R/W|
 +
|ADDR2|ADDR1|
 +
}}
 +
This register contains the first two address bytes that can be sent to the NAND chip. Normally it contains the column address (offset within a page).
 +
{{regdesc
 +
|ADDR2|Second address byte
 +
|ADDR1|First address byte
 +
}}
 +
----
 +
{{reg32 | NAND_ADDR2 | addr = 0x0d01000c | hifields = 2 | lofields = 2 |
 +
|8|8|
 +
|U|R/W|
 +
||ADDR5||
 +
|8|8|
 +
|R/W|R/W|
 +
|ADDR4|ADDR3|
 +
}}
 +
This register contains the last three address bytes that can be sent to the NAND chip. Normally it contains the row address (page number).
 +
{{regdesc
 +
|ADDR5|Fifth address byte
 +
|ADDR4|Fourth address byte
 +
|ADDR3|Third address byte
 +
}}
 +
----
 +
{{regsimple2 | NAND_DATABUF | addr = 0x0d010010 | bits = 32 | split=4 | access = U | accesshi = R/W }}
 +
This register contains the DMA address of the page data buffer (0x800 bytes). The address must be 16-byte aligned.
 +
If the spare data is being written alone (such as using a RANDOM DATA IN command with DMALEN=0x40), this points to it instead. Generally speaking, the first 0x800 bytes of data go here, whatever they may be.
 +
----
 +
{{regsimple2 | NAND_ECCBUF | addr = 0x0d010014 | bits = 32 | split=4 | access = U | accesshi = R/W }}
 +
This register contains the DMA address of the spare and ECC data buffer (0x40 spare bytes + 0x10 bytes of hardware-calculated ECC syndrome). The address must be 16-byte aligned.
 +
The hardware-calculated ECC is written to the address in this register XOR 0x40.
 +
----
 +
{{regsimple | NAND_UNK | addr = 0x0d010018 | bits = 32 | access = R/W }}
 +
This register has an unknown function; boot2 writes 1 to it when reloading to a new IOS.

Revision as of 21:17, 7 August 2010

NAND Interface
Access
BroadwayNone
StarletFull
Registers
Base0x0d010000
Length0x1C
Access size32 bits
Byte orderBig Endian
IRQs
Hollywood1
This box: view  talk  edit

Register List

NAND Interface
Address Bits Name Description
0x0d010000 32 NAND_CTRL NAND Control and Status
0x0d010004 32 NAND_CONFIG ??
0x0d010008 32 NAND_ADDR1 Address bytes 1-2 (column)
0x0d01000c 32 NAND_ADDR2 Address bytes 3-5 (row)
0x0d010010 32 NAND_DATABUF Memory address of the Data buffer
0x0d010014 32 NAND_ECCBUF Memory address of the Spare buffer
0x0d010018 32 NAND_UNK Unknown

Register Details

NAND_CTRL (0x0d010000)
  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Access R/W R/W R/W R/W R/W R/W R/W R/W R/W
Field EXEC IRQ ERR A5 A4 A3 A2 A1 COMMAND
  15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Access R/W R/W R/W R/W W
Field WAIT WR RD ECC DATALEN

This register controls the state of the NAND interface.

Field Description
EXEC Write 1: initiate NAND command
Write 0: reset NAND interface
Read: NAND interface busy
IRQ Set to enable IRQ generation when command is complete
ERR If set, NAND error occured (?)[check]
A5 Send fifth address byte (typ. row address high)
A4 Send fourth address byte (typ. row address mid)
A3 Send third address byte (typ. row address low)
A2 Send second address byte (typ. column address high)
A1 Send first address byte (typ. column address low)
COMMAND 8-bit NAND command
WAIT Wait for R/B to go high between address and data phases (wait for read/write/erase/reset)
WR Transfer data to the NAND chip
RD Transfer data from the NAND chip
ECC Calculate ECC or ?? [check]
DATALEN Number of bytes to transfer during the data phase

NAND_CONFIG (0x0d010004)
  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Access R/W R/W R/W R/W
Field ATTR0 ENABLE ATTR1 ATTR2
  15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Access R/W R/W
Field ATTR3 ATTR4

This register probably configures certain aspects of the NAND interface (timings?)[check].

Field Description
ATTR0 Set based on lookup table; set to 3 for 128MB NAND chips, 4 otherwise
ENABLE Set to 1 before first command is sent to NAND, set to 0 when de-initializing the NAND driver.
ATTR1 Set based on lookup table; always 0x3
ATTR2 Set based on lookup table; always 0x3e
ATTR3 Set based on lookup table; always 0x0e
ATTR4 Set based on lookup table; always 0x7f

When IOS initializes the NAND driver, it turns on the enable bit (writing 0x08000000) and then send the GET CHIP ID command (0x90). Based on the reply, it looks up the correct definitions of the other attributes and pokes them into this register (generally, 0x4b3e0e7f).


NAND_ADDR1 (0x0d010008)
  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Access U
Field
  15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Access R/W R/W
Field ADDR2 ADDR1

This register contains the first two address bytes that can be sent to the NAND chip. Normally it contains the column address (offset within a page).

Field Description
ADDR2 Second address byte
ADDR1 First address byte

NAND_ADDR2 (0x0d01000c)
  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Access U R/W
Field ADDR5
  15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Access R/W R/W
Field ADDR4 ADDR3

This register contains the last three address bytes that can be sent to the NAND chip. Normally it contains the row address (page number).

Field Description
ADDR5 Fifth address byte
ADDR4 Fourth address byte
ADDR3 Third address byte

NAND_DATABUF (0x0d010010)
  314 30
Access R/W U

This register contains the DMA address of the page data buffer (0x800 bytes). The address must be 16-byte aligned. If the spare data is being written alone (such as using a RANDOM DATA IN command with DMALEN=0x40), this points to it instead. Generally speaking, the first 0x800 bytes of data go here, whatever they may be.


NAND_ECCBUF (0x0d010014)
  314 30
Access R/W U

This register contains the DMA address of the spare and ECC data buffer (0x40 spare bytes + 0x10 bytes of hardware-calculated ECC syndrome). The address must be 16-byte aligned. The hardware-calculated ECC is written to the address in this register XOR 0x40.


NAND_UNK (0x0d010018)
  310
Access R/W

This register has an unknown function; boot2 writes 1 to it when reloading to a new IOS.