mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-09 23:53:28 -04:00
flash-rk27xx.c drives the NAND controller and its BCH engine for the flash translation layer that follows. It knows the chip's geometry and how to read, program, erase and copy sectors, but not what the sectors mean. - Addresses are 512-byte sectors in a linear view of the chip where a block is a super-block: on a two-plane part, one physical block from each plane, consecutive pages alternating between them. The layer maps that view to the chip; the FTL never sees planes. - Every sector carries 16 spare bytes: 13 of BCH code, generated and checked by the hardware, and 3 for the FTL. Byte 1 is written 0x00 on every program - the "page programmed" marker the original firmware's FTL keys its mount and recovery on. - The program sequence was read out of the original firmware's own machine code. The write kick is the read kick plus FL_WR, and the BCH engine needs BCH_WR to encode rather than decode. - A copy is read through the ECC engine and programmed, never the chip's internal data move, which on this MLC part would carry bit errors forward. - Writes are refused until the FTL enables them, and writes into the boot area are dropped and reported successful, as the original firmware does. The write-protect line is lifted only for the duration of each program or erase. - Failures and timeouts are counted: the FTL can act on few of them. Only the first chip is handled; every device the FTL has been checked on has one. Tested on a generic rk2705 directly, on a free block: a program across both planes, a single-sector program with metadata, a whole page, a copy and an erase each read back byte-exact through the controller's ECC decode, which also shows the code it generated is valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: If6ffa9f9811172f4f8829c1e68d6de9466a022c8 |
||
|---|---|---|
| .. | ||
| asm | ||
| common | ||
| drivers | ||
| export | ||
| include | ||
| kernel | ||
| libc | ||
| reggen | ||
| target | ||
| usbstack | ||
| arabjoin.c | ||
| arabjoin.h | ||
| ata_idle_notify.c | ||
| backlight-sw-fading.c | ||
| backlight.c | ||
| bidi.c | ||
| buflib_malloc.c | ||
| buflib_mempool.c | ||
| chunk_alloc.c | ||
| COPYING | ||
| core_alloc.c | ||
| debug.c | ||
| eeprom_settings.c | ||
| elf_loader.c | ||
| enc_base.c | ||
| events.c | ||
| firmware.make | ||
| font.c | ||
| font_cache.c | ||
| general.c | ||
| hangul.c | ||
| lc-rock.c | ||
| linuxboot.c | ||
| logf.c | ||
| lru.c | ||
| panic.c | ||
| pcm.c | ||
| pcm_mixer.c | ||
| pcm_sampr.c | ||
| pcm_sw_volume.c | ||
| powermgmt.c | ||
| profile.c | ||
| README | ||
| rolo.c | ||
| rom.lds | ||
| screendump.c | ||
| scroll_engine.c | ||
| sdmmc.c | ||
| sound.c | ||
| SOURCES | ||
| storage.c | ||
| system.c | ||
| timer.c | ||
| tuner.c | ||
| usb.c | ||
See docs/README