For serial flash I use the code taht you can find in freescale example of LiteHttpServer or some else
I have connected a spansion serial flash to qspi bus and I use this code to do the initialisation.
If you search for example of LiteHttpserver you can find the complete code for a driver with a serial flash
void init_serial_flash( void )
{
// No delay, disable QSPI
QDLYR = 0;
// QSPI interrupt disabled
QIR = 0;
// QMR[BAUD] = fsys/ / (2 × [desired QSPI_CLK baud rate])
// QMR[BAUD] = 60000000/(2*8000000)
// Using 3 will yield a baud rate of 10Mhz
QMR = (0|
QMR_MSTR_BITMASK|
QMR_BITS(8)|
QMR_BAUD(3)
);
// Pin assignments for port QS
// Pin QS6 : GPIO input
// Pin QS5 : GPIO input
// Pin QS4 : GPIO input
// Pin QS3 : QSPI chip select QSPI_CS0
// Pin QS2 : QSPI serial clock, QSPI_CLK
// Pin QS1 : QSPI serial data input, QSPI_DIN
// Pin QS0 : QSPI serial data output, QSPI_DOUT
// DDRQS[DDRQS6] = 0
// DDRQS[DDRQS5] = 0
// DDRQS[DDRQS4] = 0
// DDRQS[DDRQS3] = 0
// DDRQS[DDRQS2] = 0
// DDRQS[DDRQS1] = 0
// DDRQS[DDRQS0] = 0
DDRQS &= 0xF0;
// PQSPAR[PQSPAR6] = 0
// PQSPAR[PQSPAR5] = 0
// PQSPAR[PQSPAR4] = 0
// PQSPAR[PQSPAR3] = %01
// PQSPAR[PQSPAR2] = %01
// PQSPAR[PQSPAR1] = %01
// PQSPAR[PQSPAR0] = %01
PQSPAR = PQSPAR_PQSPAR3(0x1) |
PQSPAR_PQSPAR2(0x1) |
PQSPAR_PQSPAR1(0x1) |
PQSPAR_PQSPAR0(0x1);
}