• Miquel Raynal's avatar
    mtd: spear_smi: Fix Write Burst mode · 69c7f461
    Miquel Raynal authored
    Any write with either dd or flashcp to a device driven by the
    spear_smi.c driver will pass through the spear_smi_cpy_toio()
    function. This function will get called for chunks of up to 256 bytes.
    If the amount of data is smaller, we may have a problem if the data
    length is not 4-byte aligned. In this situation, the kernel panics
    during the memcpy:
    
        # dd if=/dev/urandom bs=1001 count=1 of=/dev/mtd6
        spear_smi_cpy_toio [620] dest c9070000, src c7be8800, len 256
        spear_smi_cpy_toio [620] dest c9070100, src c7be8900, len 256
        spear_smi_cpy_toio [620] dest c9070200, src c7be8a00, len 256
        spear_smi_cpy_toio [620] dest c9070300, src c7be8b00, len 233
        Unhandled fault: external abort on non-linefetch (0x808) at 0xc90703e8
        [...]
        PC is at memcpy+0xcc/0x330
    
    The above error occurs because the implementation of memcpy_toio()
    tries to optimize the number of I/O by writing 4 bytes at a time as
    much as possible, until there are less than 4 bytes left and th...
    69c7f461
spear_smi.c 29.7 KB