f049af0d8285e20e6610a299b99abd07707f51f1
[openwrt/staging/luka.git] /
1 From 3fcc36962c32ad0af2d5904103e2b2b824b6b1aa Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Sat, 4 Feb 2017 12:32:59 +0100
4 Subject: [PATCH 2/8] spi/bcm63xx: make spi subsystem aware of message size
5 limits
6
7 The bcm63xx LS SPI controller does not allow manual control of the CS
8 lines and will toggle it automatically before after sending data, so we
9 are limited to messages that fit in the FIFO buffer. Since the CS lines
10 aren't available as GPIOs either, we will need to make slave drivers
11 aware of this limitation and handle it accordingly.
12
13 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
14 ---
15 drivers/spi/spi-bcm63xx.c | 9 +++++++++
16 1 file changed, 9 insertions(+)
17
18 --- a/drivers/spi/spi-bcm63xx.c
19 +++ b/drivers/spi/spi-bcm63xx.c
20 @@ -428,6 +428,13 @@ static irqreturn_t bcm63xx_spi_interrupt
21 return IRQ_HANDLED;
22 }
23
24 +static size_t bcm63xx_spi_max_length(struct spi_device *spi)
25 +{
26 + struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master);
27 +
28 + return bs->fifo_size;
29 +}
30 +
31 static const unsigned long bcm6348_spi_reg_offsets[] = {
32 [SPI_CMD] = SPI_6348_CMD,
33 [SPI_INT_STATUS] = SPI_6348_INT_STATUS,
34 @@ -541,6 +548,8 @@ static int bcm63xx_spi_probe(struct plat
35 master->transfer_one_message = bcm63xx_spi_transfer_one;
36 master->mode_bits = MODEBITS;
37 master->bits_per_word_mask = SPI_BPW_MASK(8);
38 + master->max_transfer_size = bcm63xx_spi_max_length;
39 + master->max_message_size = bcm63xx_spi_max_length;
40 master->auto_runtime_pm = true;
41 bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT];
42 bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH];