The ATMEGA 8 has some Hardware PWM Generators.
I think the best one for your usage ist the PWM of Timer 1.
Timer 1 has 2 PWM Generators that can give Signals on the Output OC1A and OC1B.
The resolution ist switchable from 8Bit up to 16Bit.
The Steps are following:
1. Initialize the Timer 1 for the wished PWM Mode and frequency, additional Connect the OC1A Output.
2. Calculate the Duty Cycle for your Motor.
3. Write the wished Duty Cycle while an Interrupt into OCR1A ( for PWM A ) and it will run.
How to do this, you can read in the Datasheet of ATMEGA8.
The PWM frequency can be tuned by clock frequency and prescaler of Timer 1
Do not use fast PWM Mode - In this Mode Duty Cycle 0% isn't possible!
Change values is to do in an Interupt of Timer 1 ( Timer Overflow Interrupt or Comparematch 1A Interrupt ), to avoid glitches.
Which of both Interrupts is to use appends from the used PWM Mode.