To initiate communication, the SPI master selects the slave (by pulling the corresponding SS line low) and starts generating the clock signal.
The clock signal synchronizes data transmission both from the master to a slave (the MOSI line) and from the slave to the master (the MISO line). The clock phase and polarity defines the clock phases where the master and the slave can sample data on the MOSI and MISO lines.