diff options
author | Kunihiko Hayashi <hayashi.kunihiko@socionext.com> | 2019-12-24 01:58:23 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-12-25 01:05:00 +0100 |
commit | 9cd34efbd3012171c102910ce17ee632a3cccb44 (patch) | |
tree | 8af40c24fdafb8b4d05846485550432d20ade4d2 /drivers/spi/spi-pxa2xx.c | |
parent | spi: fsl: use platform_get_irq() instead of of_irq_to_resource() (diff) | |
download | linux-9cd34efbd3012171c102910ce17ee632a3cccb44.tar.xz linux-9cd34efbd3012171c102910ce17ee632a3cccb44.zip |
spi: uniphier: Fix FIFO threshold
Rx threshold means the value to inform the receiver when the number of words
in Rx FIFO is equal to or more than the value. Similarly, Tx threshold means
the value to inform the sender when the number of words in Tx FIFO is equal
to or less than the value. The controller triggers the driver to start
the transfer.
In case of Rx, the driver wants to detect that the specified number of words
N are in Rx FIFO, so the value of Rx threshold should be N. In case of Tx,
the driver wants to detect that the same number of spaces as Rx are in
Tx FIFO, so the value of Tx threshold should be (FIFO size - N).
For example, in order for the driver to receive at least 3 words from
Rx FIFO, set 3 to Rx threshold.
+-+-+-+-+-+-+-+-+
| | | | | |*|*|*|
+-+-+-+-+-+-+-+-+
In order for the driver to send at least 3 words to Tx FIFO, because
it needs at least 3 spaces, set 8(FIFO size) - 3 = 5 to Tx threshold.
+-+-+-+-+-+-+-+-+
|*|*|*|*|*| | | |
+-+-+-+-+-+-+-+-+
This adds new function uniphier_spi_set_fifo_threshold() to set
threshold value to the register.
And more, FIFO counts by 'words', so this renames 'fill_bytes' with
'fill_words', and fixes the calculation using bytes_per_words.
Fixes: 37ffab817098 ("spi: uniphier: introduce polling mode")
Cc: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/1577149107-30670-2-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-pxa2xx.c')
0 files changed, 0 insertions, 0 deletions