If your panel is a video mode panel you should set mode_flags, as you are doing.
Performing 400 operations, taking 8ms should take 3.2 seconds (also too long), do you have any particular operation that consumes the remaining 27 seconds?
The thing in the code that sticks out is that the timeout for dsi_wait4video_done() is 70ms, which would land you at 28 seconds for those 400 operations. In that case I would recommend that you verify that the panel is properly powered and that your reset sequence is accurate.
But just to clarify, does the panel work after those 30 seconds?