History

spi/pl022: Allow request for higher frequency than maximum possible

Currently, if we request for frequency greater than maximum possible, spi driver returns error. For example, if the spi block src frequency is 333/4 MHz, i.e. 83.33.. MHz, maximum frequency programmable would be src/2. Which would come around 41.6... It is difficult to pass frequency in these figures. We normally try to program in round figures, like 42 MHz and it should get programmed to <= requested_frequency, i.e. 41.6... For this to happen, we must not return error even if requested freq is higher than max possible. But should program it to max possible.

Viresh Kumar committed 14 years ago

Commit ea505bc1 parent 88a3a251 file · +8 −2Browse files

Unified · Split

drivers/spi/spi-pl022.c+8−2
@@ -1667,9 +1667,15 @@ static int calculate_effective_freq(struct pl022 *pl022, int freq, struct · 1666 unmodified lines
16671667 /* cpsdvsr = 254 & scr = 255 */
16681668 min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX);
16691669
1670− if (!((freq <= max_tclk) && (freq >= min_tclk))) {
1670+ if (freq > max_tclk)
1671+ dev_warn(&pl022->adev->dev,
1672+ "Max speed that can be programmed is %d Hz, you requested %d\n",
1673+ max_tclk, freq);
1674+
1675+ if (freq < min_tclk) {
16711676 dev_err(&pl022->adev->dev,
1672− "controller data is incorrect: out of range frequency");
1677+ "Requested frequency: %d Hz is less than minimum possible %d Hz\n",
1678+ freq, min_tclk);
16731679 return -EINVAL;
16741680 }
16751681