linux-chenxing

MIU

Packaged DRAM config

For SSC8336N the value is 0xf

dig registers

Analog

offset name 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
                                   

Digital

offset name 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x0 config0 init done single command done enter self refresh enter deep power down rasz casz wez issue single command     turn off auto refresh turn on odt dram reset enable cs enable cke auto initial dram cycle
0x4 config1 cko en address en dq enable cke enable     data ratio data ratio columns columns banks banks bus width bus width dram type dram type
                0x0 - 1x   0x0 - 8   0x0 - 2   0x0 - 16 bit   0x0 - SDR  
                0x1 - 2x   0x1 - 9   0x1 - 4   0x1 - 32 bit   0x1 - DDR  
                0x2 - 4x   0x2 - 10   0x2 - 8   0x2 - 64bit   0x2 - DDR2  
                0x3 - 8x               0x3 - DDR3  
0x14       TRC timing TRC timing TRC timing TRC timing TRC timing TRC timing TRTP timing TRTP timing TRTP timing TRTP timing TRRD timing TRRD timing TRRD timing TRRD timing
0x3c sw_rst                 g3_rst g2_rst g1_rst g0_rst       miu_rst

IPL DDR2 init cycle

/*
 * MSC313 MIU (memory interface unit?) - multiport ddr controller
 *
 * The product brief for the msc313e that is available
 * doesn't detail any of the registers for this but it
 * seems to match the MIU in another MStar chip called
 * the MSB2521 that does have a leaked datasheet available.
 * That said I can't be 100% sure that all the bits in the
 * registers match what is actually in the msc313 so I'll
 * document anything that matches and not just paste the
 * whole lot here. TL;DR; there be gaps.
 *
 * 0x1f202000?
 * In the MSB2521 datasheet this is called MIU_ATOP, miu analog?
 *
 * 0x004 -
 *    15 - 8    |    7 - 0
 * dqs waveform | clock waveform
 * 0xaa - x8?   | 0xaa - x8?
 * 0xcc - x4?   | 0xcc - x4?
 *
 * 0x1f202400
 * In the MSB2521 datasheet this is called MIU_DIG, miu digital?
 *
 * 0x008 - config2
 * |   4 - 0
 * | rd timing
 * | 0xD
 *
 * 0x00c - config3
 *
 * 0x010 - config4
 *
 *    15   |    14    | 13 - 8 |    7 - 4  |   3 - 0
 * trp[4]  |  trcd[4] |  trs   |  trp[3:0] | trcd[3:0]
 *    0    |     0    |  0x1e  |  0x9      | 0x9
 *
 * 0x018 - config6
 * 15 - 12 | 11 - 8 | 7 - 4 | 3 - 0
 *  trtw   |  twtr  |  twr  |  twl
 *
 * 0x01c - config7
 *
 *    15  | 14   | 12 | 11 - 8 | 7 - 0
 * twr[4] | tccd |  txp   | trfc
 *
 * The vendor suspend code writes 0xFFFF to all of these
 * but the first where it writes 0xFFFE instead
 * Presumably this is to stop requests happening while it
 * is putting the memory into low power mode.
 *
 * 0x08c - group 0 request mask
 * 0x0cc - group 1 request mask
 * 0x10c - group 2 request mask
 * 0x14c - group 3 request mask
 *
 * 0x180 - protection 0 start
 * 0x184 - protection 0 end
 * 0x188 - protection 1 start
 * 0x18c - protection 1 end
 * 0x190 - protection 2 start
 * 0x194 - protection 2 end
 * 0x198 - protection 3 start
 * 0x19c - protection 3 end
 * 0x1a0 - protection msb 0 - 3
 * 0x1a4 - protection en / ddr size
 * top bits ddr size?
 * bottom bits protect 0 - 3 en
 * 0x1b4 - protection fault address low
 * 0x1b8 - protection fault address high
 * 0x1bc - protection fault status
 * 14 - 8    | 7 - 5  | 4         | 1        | 0
 * client id | hit no | hit flag? | int mask | clr
 *
 * 0x1f202200
 * This isn't in the MSB2521 datasheet but it looks like a bunch
 * more group registers.
 *
 * The vendor pm code writes 0xFFFF these before messing with
 * the DDR right after the 4 group registers above. Hence my guess
 * is that these are a bunch of strapped on groups.
 *
 * 0x00c - group 4 request mask?
 * 0x04c - group 5 request mask?
 */

Reg dumps

M5 after IPL

DDR PLL?

1f206200: 0000 0000 0000 0000 0100 0000 0216 0000    ................
1f206210: 0010 0000 0000 0000 0000 0000 0000 0000    ................

ANA

1f202000: 0001 0000 aaaa 0000 0000 0000 0000 0000    ................
1f202010: 003f 0000 0000 0000 0000 0000 0085 0000    ?...............
1f202020: 0000 0000 0000 0000 0e00 0000 0200 0000    ................
1f202030: 0000 0000 8020 0000 0020 0000 6005 0000    .... ... ....`..
1f202040: 4820 0000 0004 0000 0000 0000 0000 0000     H..............
1f202050: 8000 0000 0000 0000 0114 0000 2222 0000    ............""..
1f202060: 8000 0000 0029 0000 2004 0000 0400 0000    ....).... ......
1f202070: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202080: 0000 0000 0000 0000 0000 0000 0800 0000    ................
1f202090: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2020a0: 0000 0000 0000 0000 4000 0000 1f1f 0000    .........@......
1f2020b0: 1f1f 0000 0000 0000 0000 0000 0010 0000    ................
1f2020c0: 33c8 0000 007f 0000 f000 0000 003b 0000    .3..........;...
1f2020d0: 2020 0000 2020 0000 0707 0000 0707 0000      ..  ..........
1f2020e0: 0800 0000 8801 0000 0202 0000 0707 0000    ................
1f2020f0: 0001 0000 0000 0000 0000 0000 0000 0000    ................
1f202100: 0000 0000 0000 0000 0000 0000 0008 0000    ................
1f202110: 0000 0000 0001 0000 0000 0000 0000 0000    ................
1f202120: f0f3 0000 0000 0000 2829 0000 0000 0000    ........)(......
1f202130: 0000 0000 0000 0000 ff00 0000 007f 0000    ................
1f202140: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202150: 0000 0000 0000 0000 0000 0000 0202 0000    ................
1f202160: 3800 0000 0000 0000 0000 0000 0000 0000    .8..............
1f202170: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202180: 001f 0000 0000 0000 0000 0000 0000 0000    ................
1f202190: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2021a0: 0000 0000 0200 0000 8600 0000 0000 0000    ................
1f2021b0: 0700 0000 0000 0000 0002 0000 0000 0000    ................
1f2021c0: 0011 0000 0000 0000 0010 0000 1111 0000    ................
1f2021d0: 1111 0000 1111 0000 1111 0000 1111 0000    ................
1f2021e0: 3333 0000 0033 0000 0000 0000 0000 0000    33..3...........
1f2021f0: 0000 0000 0000 0000 0000 0000 0000 0000    ................

Extra

1f202200: 00fe 0000 0320 0000 0000 0000 00fe 0000    .... ...........
1f202210: 0808 0000 00ff 0000 1f0f 0000 3f2f 0000    ............/?..
1f202220: aaab 0000 0000 0000 0000 0000 0000 0000    ................
1f202230: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202240: 2020 0000 2020 0000 2020 0000 2020 0000      ..  ..  ..  ..
1f202250: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202260: aaab 0000 0000 0000 0000 0000 0000 0000    ................
1f202270: 4007 0000 ffff 0000 0000 0000 0000 0000    .@..............
1f202280: 0000 0000 0000 0000 0300 0000 0000 0000    ................
1f202290: 0000 0000 0000 0000 ffff 0000 ffff 0000    ................
1f2022a0: 00ff 0000 003f 0000 0000 0000 0000 0000    ....?...........
1f2022b0: 0000 0000 0000 0000 1000 0000 0000 0000    ................
1f2022c0: 0000 0000 0000 0000 0000 0000 0030 0000    ............0...
1f2022d0: 0000 0000 0000 0000 0000 0000 ffff 0000    ................
1f2022e0: 0000 0000 2000 0000 0242 0000 0000 0000    ..... ..B.......
1f2022f0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202300: 0000 0000 0606 0000 0000 0000 0000 0000    ................
1f202310: 0000 0000 0000 0000 0000 0000 707c 0000    ............|p..
1f202320: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202330: 0000 0000 0000 0000 60ff 0000 001f 0000    .........`......
1f202340: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202350: 0925 0000 8009 0000 0b0b 0000 0b0b 0000    %...............
1f202360: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202370: 0000 0000 0000 0000 0000 0000 07ff 0000    ................
1f202380: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202390: 0000 0000 0000 0000 8321 0000 0000 0000    ........!.......
1f2023a0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2023b0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2023c0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2023d0: 00f8 0000 0000 0000 0000 0000 0000 0000    ................
1f2023e0: 0000 0000 7170 0000 0000 0000 0000 0000    ....pq..........
1f2023f0: 0000 0000 1074 0000 0000 0000 0000 0000    ....t...........

DIG

1f202400: 801f 0000 0392 0000 000d 0000 1828 0000    ............(...
1f202410: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202420: 0003 0000 4004 0000 8000 0000 c000 0000    .....@..........
1f202430: 0000 0000 0000 0000 0000 0000 8008 0000    ................
1f202440: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202450: 0020 0000 0000 0000 8221 0000 0000 0000     .......!.......
1f202460: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202470: 0000 0000 0000 0000 0000 0000 00f0 0000    ................
1f202480: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202490: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2024a0: 0000 0000 0303 0000 0000 0000 0000 0000    ................
1f2024b0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2024c0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2024d0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2024e0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2024f0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202500: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202510: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202520: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202530: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202540: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202550: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202560: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202570: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202580: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f202590: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2025a0: 0000 0000 6000 0000 00c0 0000 0200 0000    .....`..........
1f2025b0: 0000 0000 0000 0000 0210 0000 39f0 0000    .............9..
1f2025c0: 0000 0000 0000 0000 0008 0000 0000 0000    ................
1f2025d0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2025e0: 0000 0000 0000 0000 0000 0000 0000 0000    ................
1f2025f0: 0000 0000 0000 0000 61a1 0000 8000 0000    .........a......

i3 after IPL

DDR PLL?

1f206200: 0000 0000 0000 0000 0000 0000 022c 0000    ............,...
1f206210: 8010 0000 0000 0000 0000 0000 0000 0000    ................

M5 Register layout

The i3 and m5 layous seem to differ a lot. The M5 IPL uses a bunch of tables to work out where stuff is.

Offsets from 0x1f00000 | offset | name | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |———-|—————|—-|—-|—-|—-|—-|—-|—|—|—|—|—|—|—|—|—|—| | 0x202004 | dunno | | | | | | | | | | | | | | | | | | 0x202008 | dunno | | | | | | | | | | | | | | | | | | 0x20201C | dunno | | | | | | | | | | | | | | | | | | 0x202044 | dunno | | | | | | | | | | | | | | | | | | 0x202048 | dunno | | | | | | | | | | | | | | | | | | 0x202058 | dunno | | | | | | | | | | | | | | | | | | 0x202060 | dunno | | | | | | | | | | | | | | | | | | 0x202064 | dunno | | | | | | | | | | | | | | | | | | 0x202068 | dunno | | | | | | | | | | | | | | | | | | 0x20206C | dunno | | | | | | | | | | | | | | | | | | 0x20207C | dunno | | | | | | | | | | | | | | | | | | 0x2020BC | dunno | | | | | | | | | | | | | | | | | | 0x2020C0 | dunno | | | | | | | | | | | | | | | | | | 0x2020C4 | dunno | | | | | | | | | | | | | | | | | | 0x2020C8 | dunno | | | | | | | | | | | | | | | | | | 0x2020E0 | dunno | | | | | | | | | | | | | | | | | | 0x2020F0 | dunno | | | | | | | | | | | | | | | | | | 0x202114 | dunno | | | | | | | | | | | | | | | | | | 0x202130 | dunno | | | | | | | | | | | | | | | | | | 0x202134 | dunno | | | | | | | | | | | | | | | | | | 0x20216C | dunno | | | | | | | | | | | | | | | | | | 0x202120 | dunno | | | | | | | | | | | | | | | | | | 0x2022C0 | dunno | | | | | | | | | | | | | | | | | | 0x2022C4 | dunno | | | | | | | | | | | | | | | | | | 0x2022C8 | dunno | | | | | | | | | | | | | | | | | | 0x2022CC | dunno | | | | | | | | | | | | | | | | | | 0x202404 | dunno | | | | | | | | | | | | | | | | | | 0x202408 | dunno | | | | | | | | | | | | | | | | | | 0x20240C | dunno | | | | | | | | | | | | | | | | | | 0x202420 | dunno | | | | | | | | | | | | | | | | | | 0x202424 | dunno | | | | | | | | | | | | | | | | | | 0x202428 | dunno | | | | | | | | | | | | | | | | | | 0x20242C | dunno | | | | | | | | | | | | | | | | | | 0x202450 | dunno | | | | | | | | | | | | | | | | | | 0x20243C | sw rst | | | | | | | | | | | | | | | | | | 0x2025F8 | dunno | | | | | | | | | | | | | | | | | | 0x202644 | dunno | | | | | | | | | | | | | | | | | | 0x202680 | dunno | | | | | | | | | | | | | | | | | | 0x202684 | dunno | | | | | | | | | | | | | | | | | | 0x202688 | dunno | | | | | | | | | | | | | | | | | | 0x20268C | dunno | | | | | | | | | | | | | | | | | | 0x202690 | dunno | | | | | | | | | | | | | | | | | | 0x202694 | dunno | | | | | | | | | | | | | | | | | | 0x202698 | dunno | | | | | | | | | | | | | | | | | | 0x20269C | dunno | | | | | | | | | | | | | | | | | | 0x2026A0 | dunno | | | | | | | | | | | | | | | | | | 0x2026A4 | dunno | | | | | | | | | | | | | | | | | | 0x2026A8 | dunno | | | | | | | | | | | | | | | | | | 0x202700 | dunno | | | | | | | | | | | | | | | | | | 0x20270C | dunno | | | | | | | | | | | | | | | | | | 0x202714 | dunno | | | | | | | | | | | | | | | | | | 0x2027BC | dunno | | | | | | | | | | | | | | | | | | 0x2027FC | dunno | | | | | | | | | | | | | | | | | | 0x202C0C | group 0 mask | | | | | | | | | | | | | | | | | | 0x202C60 | dunno | | | | | | | | | | | | | | | | | | 0x202C8C | group 1 mask | | | | | | | | | | | | | | | | | | 0x202CE0 | dunno | | | | | | | | | | | | | | | | | | 0x202D0C | group 2 mask | | | | | | | | | | | | | | | | | | 0x202D60 | dunno | | | | | | | | | | | | | | | | | | 0x202D8C | group 3 mask | | | | | | | | | | | | | | | | | | 0x202DE0 | dunno | | | | | | | | | | | | | | | | | | 0x202E0C | group 4 mask | | | | | | | | | | | | | | | | | | 0x202E60 | dunno | | | | | | | | | | | | | | | | | | 0x202E8C | group 5 mask | | | | | | | | | | | | | | | | | | 0x202EE0 | dunno | | | | | | | | | | | | | | | | | | 0x202F0C | group 6 mask | | | | | | | | | | | | | | | | | | 0x202F60 | dunno | | | | | | | | | | | | | | | | | | 0x2023CC | group 7 mask? | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |