diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-03-07 20:20:37 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-03-08 14:38:22 +0100 |
commit | 9f09bd66064cd3a00631d54e579b1fb2baa0b262 (patch) | |
tree | 289ac2db5e2d2369ea1dbd04a2998494951b800d /target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch | |
parent | b6e3b7079097ccce6262891f9f1130bea3879aad (diff) | |
download | mtk-20170518-9f09bd66064cd3a00631d54e579b1fb2baa0b262.zip mtk-20170518-9f09bd66064cd3a00631d54e579b1fb2baa0b262.tar.gz mtk-20170518-9f09bd66064cd3a00631d54e579b1fb2baa0b262.tar.bz2 |
ipq806x: refresh patches
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch')
-rw-r--r-- | target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch b/target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch index 2f316b1..e9e22b8 100644 --- a/target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch +++ b/target/linux/ipq806x/patches-4.9/0009-spi-qup-Fix-block-mode-to-work-correctly.patch @@ -49,11 +49,11 @@ Signed-off-by: Andy Gross <andy.gross@linaro.org> - int idx, shift, w_size; - - w_size = controller->w_size; +- +- while (controller->rx_bytes < xfer->len) { + int i, shift, num_bytes; + u32 word; -- while (controller->rx_bytes < xfer->len) { -- - state = readl_relaxed(controller->base + QUP_OPERATIONAL); - if (0 == (state & QUP_OP_IN_FIFO_NOT_EMPTY)) - break; @@ -95,16 +95,20 @@ Signed-off-by: Andy Gross <andy.gross@linaro.org> - int idx, w_size; + u32 remainder, words_per_block, num_words; + bool is_block_mode = controller->mode == QUP_IO_M_MODE_BLOCK; -+ + +- w_size = controller->w_size; + remainder = DIV_ROUND_UP(xfer->len - controller->rx_bytes, + controller->w_size); + words_per_block = controller->in_blk_sz >> 2; -+ + +- while (controller->tx_bytes < xfer->len) { + do { + /* ACK by clearing service flag */ + writel_relaxed(QUP_OP_IN_SERVICE_FLAG, + controller->base + QUP_OPERATIONAL); -+ + +- state = readl_relaxed(controller->base + QUP_OPERATIONAL); +- if (state & QUP_OP_OUT_FIFO_FULL) + if (is_block_mode) { + num_words = (remainder > words_per_block) ? + words_per_block : remainder; @@ -112,19 +116,15 @@ Signed-off-by: Andy Gross <andy.gross@linaro.org> + if (!spi_qup_is_flag_set(controller, + QUP_OP_IN_FIFO_NOT_EMPTY)) + break; - -- w_size = controller->w_size; ++ + num_words = 1; + } + + /* read up to the maximum transfer size available */ + spi_qup_read_from_fifo(controller, xfer, num_words); - -- while (controller->tx_bytes < xfer->len) { ++ + remainder -= num_words; - -- state = readl_relaxed(controller->base + QUP_OPERATIONAL); -- if (state & QUP_OP_OUT_FIFO_FULL) ++ + /* if block mode, check to see if next block is available */ + if (is_block_mode && !spi_qup_is_flag_set(controller, + QUP_OP_IN_BLOCK_READ_REQ)) |