Skip to content

Commit 5e94c3c

Browse files
msperlbroonie
authored andcommitted
spi: bcm2835aux: support effective_speed_hz
Setting spi_transfer->effective_speed_hz in transfer_one so that it can get used in cs_change_delay configured with delay as a muliple of SPI clock cycles. Signed-off-by: Martin Sperl <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9df2003 commit 5e94c3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/spi/spi-bcm2835aux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static int bcm2835aux_spi_transfer_one(struct spi_master *master,
345345
struct spi_transfer *tfr)
346346
{
347347
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
348-
unsigned long spi_hz, clk_hz, speed, spi_used_hz;
348+
unsigned long spi_hz, clk_hz, speed;
349349
unsigned long hz_per_byte, byte_limit;
350350

351351
/* calculate the registers to handle
@@ -374,7 +374,7 @@ static int bcm2835aux_spi_transfer_one(struct spi_master *master,
374374
/* set the new speed */
375375
bs->cntl[0] |= speed << BCM2835_AUX_SPI_CNTL0_SPEED_SHIFT;
376376

377-
spi_used_hz = clk_hz / (2 * (speed + 1));
377+
tfr->effective_speed_hz = clk_hz / (2 * (speed + 1));
378378

379379
/* set transmit buffers and length */
380380
bs->tx_buf = tfr->tx_buf;
@@ -391,7 +391,7 @@ static int bcm2835aux_spi_transfer_one(struct spi_master *master,
391391
* 30 µs per 300,000 Hz of bus clock.
392392
*/
393393
hz_per_byte = polling_limit_us ? (9 * 1000000) / polling_limit_us : 0;
394-
byte_limit = hz_per_byte ? spi_used_hz / hz_per_byte : 1;
394+
byte_limit = hz_per_byte ? tfr->effective_speed_hz / hz_per_byte : 1;
395395

396396
/* run in polling mode for short transfers */
397397
if (tfr->len < byte_limit)

0 commit comments

Comments
 (0)