Same as me. I can unlock the spi flash with the command
'sf protect unlock 0x0 <FLASH_SIZE>',
and after doing so I can change the value of an environment variable as often as I want in the bootloader cli, and exactly once in linux by running the 'fw_setenv' command. After this command, the SPI-flash is protected again.
Does anyone know why the SPI flash gets locked? Is this somehow adjustable by a define during U-Boot configuration?
I use the u-boot-imx 2016.03
Best Regards
Benjamin