Skip to content

Commit

Permalink
spi/bcm63xx: fix clock configuration selection
Browse files Browse the repository at this point in the history
We are currently using an inferior or equal operator for comparing
the transfer frequency with the clock frequency table. Because of
this, we always end up selecting 20Mhz as a frequency, due to the
inequality transfer hz <= 20 Mhz being always true. Fix this by
reversing the inequality, which is how the comparison should be done.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Florian Fainelli authored and Mark Brown committed Jul 23, 2012
1 parent f814f9a commit d76ea24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,

/* Find the closest clock configuration */
for (i = 0; i < SPI_CLK_MASK; i++) {
if (hz <= bcm63xx_spi_freq_table[i][0]) {
if (hz >= bcm63xx_spi_freq_table[i][0]) {
clk_cfg = bcm63xx_spi_freq_table[i][1];
break;
}
Expand Down

0 comments on commit d76ea24

Please sign in to comment.