Fix flash write protection code.

This commit replaces the code that was commited earlier with the one
that at least changes the contents of write protection bytes. The code
introduced before that was incorrect and did nothing but because of the
bug in the conditional statement that was responsible for invoking it
was never executed.

Singed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>