• Simon Glass's avatar
    sf: Support querying write-protect · b3b60f59
    Simon Glass authored
    This feature was dropped from U-Boot some time ago:
       f12f96cf (sf: Drop spl_flash_get_sw_write_prot")
    However, we do need a way to see if a flash device is write-protected,
    since if it is, it may not be possible to write to do (i.e. failing to
    write is expected).
    I am not sure of the correct layer to implement this, so this patch is a
    stab at it. If spi-flash makes sense then I will add to the 'sf' also.
    Re the points mentioned in the removal commit:
        1) This kind of requirement can be achieved using existing
           flash operations and flash locking API calls instead of
           making a separate flash API.
    Which uclass is this?
        2) Technically there is no real hardware user for this API to
           use in the source tree.
    I do want coral (at least) to support this.
        3) Having a flash operations API for simple register read bits
           also make difficult to extend the flash operations.
    This new patch only mentions write-protect being on or off, rath...
spi_flash.h 5.81 KB