FogBugz #205359: nios2: flushp after write instruction to memory

According to nios2 handbook [1], software needs to execute flushd,
flushi and flushp instructions after write instruction to memory.
This patch add the flushp instruction after flushd and flushi.

[1]http://www.altera.com/literature/hb/nios2/n2sw_nii52007.pdf
   (page 9-5)

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #205319: nios2: Use initi and initd to initialize caches

Change flushi to initi and flushd to initd instructions.

According to nios2 handbook:
- Use initi instruction initializes a single
instruction cache line. Do not use the flushi instruction because
it might cause undesired effects when used to initialize the
instruction cache in future Nios II implementations.
- Use initd instruction initializes a single data cache line. Do not
use the flushd instruction for this purpose, because it writes dirty
lines back to memory.

[1]http://www.altera.com/literature/hb/nios2/n2sw_nii52007.pdf

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #201449: Fix bug found by sparse tool.

The sparse code analysis tools identified a locking problem
in the Cadence QSPI driver.  This patch is the fix.

In the process, I removed a continue, renamed a variable, and
reversed the logic of an if-block.

Signed-off-by: Graham Moore <grmoore@altera.com>