diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-10-23 21:12:13 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-24 15:25:14 +0100 |
commit | 3a219cefe1560692107afaffa7ce91c0a9f63279 (patch) | |
tree | 077b6c495ec2673189e2fa3867ff69d9667840f2 | |
parent | 8e07d6845277efb96e067306f1ec9bc378c58bc0 (diff) | |
download | rockbox-3a219ce.tar.gz rockbox-3a219ce.zip |
hwstub: add Shanling M2 IPL/SPL dumping code
Change-Id: I14987d9783dd371f4990a5bcfbfb2d1c0c9be213
-rw-r--r-- | utils/hwstub/tools/lua/shanlingm2.lua | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/shanlingm2.lua b/utils/hwstub/tools/lua/shanlingm2.lua new file mode 100644 index 0000000000..c384900c51 --- /dev/null +++ b/utils/hwstub/tools/lua/shanlingm2.lua @@ -0,0 +1,50 @@ +-- +-- Shangling M2 +-- +M2 = {} + +-- call with nil to get automatic name +function M2.dump_ipl(file) + if file == nil then + file = "shangling_m2_ipl.bin" + end + print("Dumping IPL to " .. file .." ...") + JZ.nand.rom.init() + JZ.nand.rom.read_flags() + local ipl = JZ.nand.rom.read_bootloader() + JZ.nand.rom.write_to_file(file, ipl) +end + +-- call with nil to get automatic name +function M2.dump_spl(file) + if file == nil then + file = "shangling_m2_spl.bin" + end + print("Dumping SPL to " .. file .." ...") + -- hardcoded parameters are specific to the Shangling M2 + local nand_params = { + bus_width = 16, + row_cycle = 3, + col_cycle = 2, + page_size = 2048, + page_per_block = 64, + oob_size = 128, + badblock_pos = 0, + badblock_page = 0, + ecc_pos = 4, + ecc_size = 13, + ecc_level = 8, + addr_setup_time = 4, + addr_hold_time = 4, + write_strobe_time = 4, + read_strobe_time = 4, + recovery_time = 13, + } + local spl = JZ.nand.rom.read_spl(nand_params, 0x400, 0x200) + JZ.nand.rom.write_to_file(file, spl) +end + +function M2.dump() + M2.dump_ipl(nil) + M2.dump_spl(nil) +end |