Instead of an odd comment, cite the documentation, which says more clearly what's going on with the programming flow on some of the Intel SoCs.
Showing the changes to include/linux/platform_data (1 of 1 file). Show all
Unified · Split
| @@ -15,9 +15,36 @@ struct pwm_lpss_boardinfo { · 14 unmodified lines | ||
| 15 | 15 | unsigned int npwm; |
| 16 | 16 | unsigned long base_unit_bits; |
| 17 | 17 | /* |
| 18 | − * Some versions of the IP may stuck in the state machine if enable | |
| 19 | − * bit is not set, and hence update bit will show busy status till | |
| 20 | − * the reset. For the rest it may be otherwise. | |
| 18 | + * NOTE: | |
| 19 | + * Intel Broxton, Apollo Lake, and Gemini Lake have different programming flow. | |
| 20 | + * | |
| 21 | + * Initial Enable or First Activation | |
| 22 | + * 1. Program the base unit and on time divisor values. | |
| 23 | + * 2. Set the software update bit. | |
| 24 | + * 3. Poll in a loop on the PWMCTRL bit until software update bit is cleared.+ | |
| 25 | + * 4. Enable the PWM output by setting PWM Enable. | |
| 26 | + * 5. Repeat the above steps for the next PWM Module. | |
| 27 | + * | |
| 28 | + * Dynamic update while PWM is Enabled | |
| 29 | + * 1. Program the base unit and on-time divisor values. | |
| 30 | + * 2. Set the software update bit. | |
| 31 | + * 3. Repeat the above steps for the next PWM module. | |
| 32 | + * | |
| 33 | + * + After setting PWMCTRL register's SW update bit, hardware automatically | |
| 34 | + * deasserts the SW update bit after a brief delay. It was observed that | |
| 35 | + * setting of PWM enable is typically done via read-modify-write of the PWMCTRL | |
| 36 | + * register. If there is no/little delay between setting software update bit | |
| 37 | + * and setting enable bit via read-modify-write, it is possible that the read | |
| 38 | + * could return with software enable as 1. In that case, the last write to set | |
| 39 | + * enable to 1 could also set sw_update to 1. If this happens, sw_update gets | |
| 40 | + * stuck and the driver code can hang as it explicitly waits for sw_update bit | |
| 41 | + * to be 0 after setting the enable bit to 1. To avoid this race condition, | |
| 42 | + * SW should poll on the software update bit to make sure that it is 0 before | |
| 43 | + * doing the read-modify-write to set the enable bit to 1. | |
| 44 | + * | |
| 45 | + * Also, we noted that if sw_update bit was set in step #1 above then when it | |
| 46 | + * is set again in step #2, sw_update bit never gets cleared and the flow hangs. | |
| 47 | + * As such, we need to make sure that sw_update bit is 0 when doing step #1. | |
| 21 | 48 | */ |
| 22 | 49 | bool bypass; |
| 23 | 50 | /* |