diff options
-rw-r--r-- | drivers/spi/spi-mxs.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 9e6101a38e85..759de701f050 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -67,6 +67,7 @@ | |||
67 | struct mxs_spi { | 67 | struct mxs_spi { |
68 | struct mxs_ssp ssp; | 68 | struct mxs_ssp ssp; |
69 | struct completion c; | 69 | struct completion c; |
70 | unsigned int sck; /* Rate requested (vs actual) */ | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | static int mxs_spi_setup_transfer(struct spi_device *dev, | 73 | static int mxs_spi_setup_transfer(struct spi_device *dev, |
@@ -81,7 +82,19 @@ static int mxs_spi_setup_transfer(struct spi_device *dev, | |||
81 | return -EINVAL; | 82 | return -EINVAL; |
82 | } | 83 | } |
83 | 84 | ||
84 | mxs_ssp_set_clk_rate(ssp, hz); | 85 | if (hz != spi->sck) { |
86 | mxs_ssp_set_clk_rate(ssp, hz); | ||
87 | /* | ||
88 | * Save requested rate, hz, rather than the actual rate, | ||
89 | * ssp->clk_rate. Otherwise we would set the rate every trasfer | ||
90 | * when the actual rate is not quite the same as requested rate. | ||
91 | */ | ||
92 | spi->sck = hz; | ||
93 | /* | ||
94 | * Perhaps we should return an error if the actual clock is | ||
95 | * nowhere close to what was requested? | ||
96 | */ | ||
97 | } | ||
85 | 98 | ||
86 | writel(BM_SSP_CTRL0_LOCK_CS, | 99 | writel(BM_SSP_CTRL0_LOCK_CS, |
87 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | 100 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); |