Yes. It is possible.
See my previous post to you about the IO drive mode configuring. How to configure direction of I/O during runtime
This post will discuss flipping between directIO and SPI functions.
This is best achieved with making a TopDesign schematic at design-time.
I don't know your full design intent so here is an example to start you off:
This is a modification of the circuit I listed in your other posting about drive mode for IOs.
If this is your design intent, then you can set the IO drive mode and SPI MOSI and MISO routing with ONE bit in CR_OE_ctrl.
If this is not your intent, can you be more specific of the relationship of the SPI comm and the drive mode switchable IO?
Before I forget, I have a Caveat section for my previous post.
If you are in the middle of a SPI communication session and you switch IO assignments, you WILL corrupt the outgoing and incoming SPI data. To avoid this, make sure the the SPI comm status is SPI_TX_DONE before you switch IO.