summaryrefslogtreecommitdiff
path: root/drivers/renesas
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2018-12-27 20:31:22 +0100
committerMarek Vasut <marek.vasut+renesas@gmail.com>2019-01-08 14:08:44 +0100
commit452031e65816a9fa6b4314cc0f2cdfc16c5b40a9 (patch)
tree63ac554627e6c234870bf62ffd6f39ae23ba5153 /drivers/renesas
parente32b6228fe3974f50cea757b64bad13bb56e3402 (diff)
rcar_gen3: drivers: scif: Use TEND flag for transmission end detection
Use the SCIF SCFSR:TEND bit to check that all data were transmitted by the SCIF and that there are no more valid data to transmit in the FIFO. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Diffstat (limited to 'drivers/renesas')
-rw-r--r--drivers/renesas/rcar/scif/scif.S19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/renesas/rcar/scif/scif.S b/drivers/renesas/rcar/scif/scif.S
index 1cc0d590..09dc90b8 100644
--- a/drivers/renesas/rcar/scif/scif.S
+++ b/drivers/renesas/rcar/scif/scif.S
@@ -75,6 +75,8 @@
#if SCIF_CLK == SCIF_EXTARNAL_CLK
#define SCSCR_CKE_INT_CLK (SCSCR_CKE_BRG)
#else
+#define SCFSR_TEND_MASK (1 << 6)
+#define SCFSR_TEND_TRANS_END (0x0040)
#define SCSCR_CKE_INT_CLK (SCSCR_CKE_INT)
#endif
#define SCFSR_INIT_DATA (0x0000)
@@ -281,6 +283,11 @@ func console_core_putc
bcs 2b
strb w0, [x1, #SCIF_SCFTDR]
+ /* Clear TEND flag */
+ ldrh w2, [x1, #SCIF_SCFSR]
+ and w2, w2, #~SCFSR_TEND_MASK
+ strh w2, [x1, #SCIF_SCFSR]
+
ret
endfunc console_core_putc
@@ -309,16 +316,12 @@ endfunc console_getc
func console_flush
ldr x0, =SCIF2_BASE
1:
- ldrh w1, [x0, #SCIF_SCFDR]
- ubfx w1, w1, #8, #5
- cmp w1, #0
+ /* Check TEND flag */
+ ldrh w1, [x0, #SCIF_SCFSR]
+ and w1, w1, #SCFSR_TEND_MASK
+ cmp w1, #SCFSR_TEND_TRANS_END
bne 1b
- mov x0, #100
- mov x3, x30
- bl rcar_micro_delay
- mov x30, x3
-
ldr x0, =SCIF2_BASE
ldrh w1, [x0, #SCIF_SCSCR]
and w1, w1, #~(SCSCR_TE_EN + SCSCR_RE_EN)