[U-Boot] [PATCH 2/2] EXYNOS: SPI: Support SPI_PREAMBLE mode

Simon Glass sjg at chromium.org
Sat May 11 16:41:24 CEST 2013


Hi,

On Thu, May 2, 2013 at 7:28 PM, Vadim Bendebury <vbendeb at chromium.org> wrote:
> On Thu, Mar 21, 2013 at 11:29 PM, Rajeshwari Shinde
> <rajeshwari.s at samsung.com> wrote:
>> Support interfaces with a preamble before each received message.
>>
>> We handle this when the client has requested a SPI_XFER_END, meaning
>> that we must close of the transaction. In this case we read until we
>> see the preamble (or a timeout occurs), skipping all data before and
>> including the preamble. The client will receive only data bytes after
>> the preamble.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> Signed-off-by: Rajeshwari Shinde <rajeshwari.s at samsung.com>
>> ---
>>  drivers/spi/exynos_spi.c |   62 ++++++++++++++++++++++++++++++++++++++++------
>>  1 files changed, 54 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
>> index be60ada..09e88d5 100644
>> --- a/drivers/spi/exynos_spi.c
>> +++ b/drivers/spi/exynos_spi.c
>> @@ -51,6 +51,7 @@ struct exynos_spi_slave {
>>         unsigned int mode;
>>         enum periph_id periph_id;       /* Peripheral ID for this device */
>>         unsigned int fifo_size;
>> +       int skip_preamble;
>>  };
>>
>>  static struct spi_bus *spi_get_bus(unsigned dev_index)
>> @@ -107,6 +108,8 @@ struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs,
>>         else
>>                 spi_slave->fifo_size = 256;
>>
>> +       spi_slave->skip_preamble = 0;
>> +
>>         spi_slave->freq = bus->frequency;
>>         if (max_hz)
>>                 spi_slave->freq = min(max_hz, spi_slave->freq);
>> @@ -219,17 +222,23 @@ static void spi_request_bytes(struct exynos_spi *regs, int count)
>>         writel(count | SPI_PACKET_CNT_EN, &regs->pkt_cnt);
>>  }
>>
>> -static void spi_rx_tx(struct exynos_spi_slave *spi_slave, int todo,
>> -                       void **dinp, void const **doutp)
>> +static int spi_rx_tx(struct exynos_spi_slave *spi_slave, int todo,
>> +                       void **dinp, void const **doutp, unsigned long flags)
>>  {
>>         struct exynos_spi *regs = spi_slave->regs;
>>         uchar *rxp = *dinp;
>>         const uchar *txp = *doutp;
>>         int rx_lvl, tx_lvl;
>>         uint out_bytes, in_bytes;
>> +       int toread, preamable_count = 0;
>
> preamable_count: the name is misspelled, and the variable is never modified.

Yes, it is supposed to count the number of bytes before the preamble,
in the event of an error, but it isn't really needed. I will resend
the patch with it removed.

Regards,
Simon


More information about the U-Boot mailing list