|
@@ -74,15 +74,13 @@ static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm,
|
|
static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm,
|
|
static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm,
|
|
struct spi_device *spi, struct spi_transfer *t, unsigned int *settings)
|
|
struct spi_device *spi, struct spi_transfer *t, unsigned int *settings)
|
|
{
|
|
{
|
|
- unsigned int speed;
|
|
|
|
-
|
|
|
|
if (t->len > 62)
|
|
if (t->len > 62)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz;
|
|
|
|
|
|
+ if (t->speed_hz != spi_xcomm->current_speed) {
|
|
|
|
+ unsigned int divider;
|
|
|
|
|
|
- if (speed != spi_xcomm->current_speed) {
|
|
|
|
- unsigned int divider = DIV_ROUND_UP(SPI_XCOMM_CLOCK, speed);
|
|
|
|
|
|
+ divider = DIV_ROUND_UP(SPI_XCOMM_CLOCK, t->speed_hz);
|
|
if (divider >= 64)
|
|
if (divider >= 64)
|
|
*settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_64;
|
|
*settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_64;
|
|
else if (divider >= 16)
|
|
else if (divider >= 16)
|
|
@@ -90,7 +88,7 @@ static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm,
|
|
else
|
|
else
|
|
*settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_4;
|
|
*settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_4;
|
|
|
|
|
|
- spi_xcomm->current_speed = speed;
|
|
|
|
|
|
+ spi_xcomm->current_speed = t->speed_hz;
|
|
}
|
|
}
|
|
|
|
|
|
if (spi->mode & SPI_CPOL)
|
|
if (spi->mode & SPI_CPOL)
|
|
@@ -148,8 +146,6 @@ static int spi_xcomm_transfer_one(struct spi_master *master,
|
|
int status = 0;
|
|
int status = 0;
|
|
bool is_last;
|
|
bool is_last;
|
|
|
|
|
|
- is_first = true;
|
|
|
|
-
|
|
|
|
spi_xcomm_chipselect(spi_xcomm, spi, true);
|
|
spi_xcomm_chipselect(spi_xcomm, spi, true);
|
|
|
|
|
|
list_for_each_entry(t, &msg->transfers, transfer_list) {
|
|
list_for_each_entry(t, &msg->transfers, transfer_list) {
|