Visible to Intel only — GUID: fkr1674511644764
Ixiasoft
Visible to Intel only — GUID: fkr1674511644764
Ixiasoft
5.3.6.7. Remapping Mechanism
The NAND Flash controller supports the remap mechanism that can automatically translate physical addresses in the NAND Flash device when accessing this. This is useful for bad block management handling. This feature is only supported in CDMA and PIO operation modes.
The remap mechanism performs address translation based on an internal record table. The address translation is requested automatically by the command engine when the mechanism is enabled with the rmp_en bit in the remap_ctrl (0x0480) register. This table supports up to 1024 records of 68 bits each one. Each record contains the remapping information. In the table, all records must be sorted in ascending order, which is done by the remap engine automatically. The table can be initialized and read using NAND controller registers and this can be used for all the Flash devices connected for the SoC. In case the address to be accessed is not found in the remapping table, the original address is used.
The structure of a record in the remapping table is shown in the following figure. This includes a logical address which is related to the original address to be accessed and a physical address which is related to the new translated address to be accessed in the device.
One single record could be used to translate a range of addresses which is indicated by a mask defined with the remap_mask (0x0484) register.
The address translation mechanism works as shown below:
base_log_addr = input_address & remap_mask offset_log_addr = input_address & remap_mask if (base_log_addr == (log_addr_in_record) & remap_mask) output_address = (phy_addr_in_record & remap_mask) | offset_log_addr else output_address = input_address input_address – is the original transaction address that wants to be accessed in the device. output_address – is the final address to be accessed in the device log_addr_in record – is the original logical address used when creating the record (in remap_log_addr) register. phy_addr_in_record – is the physical address used when creating the record (in remap_phys_addr register. Example: If the following range of the address translation is desired, the values needed when creating the record are shown next: 0x101100 -> 0x200000 0x101101 -> 0x200001 ... 0x1011fe -> 0x2000fe 0x1011ff -> 0x2000ff remap_mask: 0xFFFF00 log_addr_in_record: 0x101100 phy_addr_in_record: 0x200000
The mask should be constructed as a continuous sequence of logical ones from the bit position where part of the row address valid for remap starts to the most significant bit of the row address.
The remap table can be initialized with the following registers:
- remap_access (0x0488): write this register to start access to the records table. Additionally, it contains fields to configure access type and select which target is connected to requested record.
- remap_log_addr (0x048c): the value of this register determines source translation address (logical address).
- remap_phys_addr (0x0490): this register contains destination address for the current record (physical address)
The records in the remap table can be read by following the next steps:
- Write the rec_rd_idx (number of record to be read), rec_actype (access type, value of 1 for read) and rec_access (access start, value of 1) fields in the remap_access (0x0488) register.
- Wait for clearing the rec_access bit. This indicates that the selected record is ready to be read from the remap_log_addr (0x048c) and remap_phys_addr (0x0490) registers. The number of target associated with read record can be found in rec_trg field of the remap_access (0x0488) register.
The process to add or update a record, follow the steps below:
- Fill the remap_log_addr (0x048c) and remap_phys_addr (0x0490) registers with the original and translated address to be performed by the record.
- Fill the remap_mask (0x0484) registers with the appropriate mask for the desired range that is wanted for the record.
- Write the remap_access (0x0488) register with rec_actype cleared and rec_access set to 1 to start the operation. In this register also the target for which this record will apply must be indicated using the rec_trg field. The controller automatically stores new records or updates the existing one in the record table. The value provided through the registers is XOR-ed with mask value before writing to the table. Finishing the operation is signaled by clearing the rec_access bit. If the records table is already full, the writing of a new record is ignored. The host can check the number of records already stored in records table by reading the rec_cnt field in the remap_ctrl (0x0480) register.
- Additionally, you can clear the whole records table by setting the rec_actype to two (clear all). You can also use system reset to clear the records table.
The host should not perform new records table access operation if the previous operation is not finished (that is, rec_access bit set).