Use switch to control the direction. The 5V signal may be from a microcontroller or any square wave generator. The duty cycle controls the motor speed.
Sample of a bidirecional DC motor controller. Not as efficient as Mosfets driven, but work just as fine.