various pwm driver fixes

- fix integer overflow when selecting prescaler
- fix writing of channel 1 prescaler
- fix width of period counter (PWM_PRD_MASK)
- fix off-by-one error in checking max period value