--- a/spi.c +++ b/spi.c @@ -175,10 +175,12 @@ static int morse_spi_setup(struct spi_de spi->bits_per_word = 8; spi->max_speed_hz = max_speed_hz; +#if 0 if (spi->max_speed_hz > MAX_SPI_CLK_SPEED) { dev_err(&spi->dev, "SPI clocks above 50MHz are not supported by Morse chip\n"); return -EPERM; } +#endif ret = spi_setup(spi); if (ret < 0) { @@ -432,7 +434,7 @@ static u8 *morse_spi_find_data_ack(struc { u8 *cp = data; - while (cp < end && *cp == 0xff) + while (cp < end && (SPI_MMC_RESPONSE_CODE(*cp) != SPI_RESPONSE_ACCEPTED)) cp++; if (cp == end) @@ -529,13 +531,10 @@ static int morse_spi_cmd53_read(struct m cp += 4; if (!block) { - /* Scale bytes delay to block */ - u32 extra_bytes = (count * mspi->inter_block_delay_bytes) / MMC_SPI_BLOCKSIZE; - /* Allow 4 bytes for CRC and another 10 bytes for start block token & chip delays * (usually comes in 2). */ - data_size = count + 4 + 4 + extra_bytes; + data_size = count + 4 + 4 + mspi->inter_block_delay_bytes; if (is_rk3288) /* Short transactions are sometimes delayed. These extra bytes give enough * cycles to receive all the data. This could be optimised to a lower @@ -601,6 +600,7 @@ static int morse_spi_cmd53_write(struct u8 *resp; u8 *end; u8 *ack = cp; + u8 *test_ack; u32 data_size; int i; @@ -656,10 +656,11 @@ static int morse_spi_cmd53_write(struct /* crc */ *cp = (crc & 0xFF00) >> 8; *(cp + 1) = (crc & 0xFF); + test_ack = cp + 2; cp += sizeof(crc); /* Allow more bytes for status and chip processing (depends on CLK) */ - cp += block ? mspi->inter_block_delay_bytes : 4; + cp += mspi->inter_block_delay_bytes; } /* Do the actual transfer */