diff options
Diffstat (limited to 'drivers/spi/spi-xcomm.c')
-rw-r--r-- | drivers/spi/spi-xcomm.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 24c40b13dab1..2505b7e1232a 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c | |||
@@ -74,15 +74,13 @@ static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm, | |||
74 | static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, | 74 | static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, |
75 | struct spi_device *spi, struct spi_transfer *t, unsigned int *settings) | 75 | struct spi_device *spi, struct spi_transfer *t, unsigned int *settings) |
76 | { | 76 | { |
77 | unsigned int speed; | ||
78 | |||
79 | if (t->len > 62) | 77 | if (t->len > 62) |
80 | return -EINVAL; | 78 | return -EINVAL; |
81 | 79 | ||
82 | speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz; | 80 | if (t->speed_hz != spi_xcomm->current_speed) { |
81 | unsigned int divider; | ||
83 | 82 | ||
84 | if (speed != spi_xcomm->current_speed) { | 83 | divider = DIV_ROUND_UP(SPI_XCOMM_CLOCK, t->speed_hz); |
85 | unsigned int divider = DIV_ROUND_UP(SPI_XCOMM_CLOCK, speed); | ||
86 | if (divider >= 64) | 84 | if (divider >= 64) |
87 | *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_64; | 85 | *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_64; |
88 | else if (divider >= 16) | 86 | else if (divider >= 16) |
@@ -90,7 +88,7 @@ static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, | |||
90 | else | 88 | else |
91 | *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_4; | 89 | *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_4; |
92 | 90 | ||
93 | spi_xcomm->current_speed = speed; | 91 | spi_xcomm->current_speed = t->speed_hz; |
94 | } | 92 | } |
95 | 93 | ||
96 | if (spi->mode & SPI_CPOL) | 94 | if (spi->mode & SPI_CPOL) |
@@ -148,8 +146,6 @@ static int spi_xcomm_transfer_one(struct spi_master *master, | |||
148 | int status = 0; | 146 | int status = 0; |
149 | bool is_last; | 147 | bool is_last; |
150 | 148 | ||
151 | is_first = true; | ||
152 | |||
153 | spi_xcomm_chipselect(spi_xcomm, spi, true); | 149 | spi_xcomm_chipselect(spi_xcomm, spi, true); |
154 | 150 | ||
155 | list_for_each_entry(t, &msg->transfers, transfer_list) { | 151 | list_for_each_entry(t, &msg->transfers, transfer_list) { |