1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de>
6 #include <linux/linkage.h>
7 #include <asm/assembler.h>
10 * r8 = bit 0-15: tx offset, bit 16-31: tx buffer size
11 * r9 = bit 0-15: rx offset, bit 16-31: rx buffer size
18 #define SSI_SACNT 0x38
20 #define SSI_SACNT_AC97EN (1 << 0)
22 #define SSI_SIER_TFE0_EN (1 << 0)
23 #define SSI_SISR_TFE0 (1 << 0)
24 #define SSI_SISR_RFF0 (1 << 2)
25 #define SSI_SIER_RFF0_EN (1 << 2)
28 .global imx_ssi_fiq_start
29 .global imx_ssi_fiq_end
30 .global imx_ssi_fiq_base
31 .global imx_ssi_fiq_rx_buffer
32 .global imx_ssi_fiq_tx_buffer
35 * imx_ssi_fiq_start is _intentionally_ not marked as a function symbol
36 * using ENDPROC(). imx_ssi_fiq_start and imx_ssi_fiq_end are used to
37 * mark the function body so that it can be copied to the FIQ vector in
38 * the vectors page. imx_ssi_fiq_start should only be called as the result
39 * of an FIQ: calling it directly will not work.
42 ldr r12, .L_imx_ssi_fiq_base
45 ldr r13, .L_imx_ssi_fiq_tx_buffer
48 ldr r11, [r12, #SSI_SIER]
49 tst r11, #SSI_SIER_TFE0_EN
53 ldr r11, [r12, #SSI_SISR]
54 tst r11, #SSI_SISR_TFE0
59 and r10, r10, r8 /* r10: current buffer offset */
64 strh r11, [r12, #SSI_STX0]
67 strh r11, [r12, #SSI_STX0]
70 strh r11, [r12, #SSI_STX0]
73 strh r11, [r12, #SSI_STX0]
76 lsr r11, r8, #16 /* r11: buffer size */
83 /* shall we receive? */
84 ldr r11, [r12, #SSI_SIER]
85 tst r11, #SSI_SIER_RFF0_EN
89 ldr r11, [r12, #SSI_SISR]
90 tst r11, #SSI_SISR_RFF0
93 ldr r13, .L_imx_ssi_fiq_rx_buffer
97 and r10, r10, r9 /* r10: current buffer offset */
101 ldr r11, [r12, #SSI_SACNT]
102 tst r11, #SSI_SACNT_AC97EN
104 ldr r11, [r12, #SSI_SRX0]
107 ldr r11, [r12, #SSI_SRX0]
110 /* dummy read to skip slot 12 */
111 ldrne r11, [r12, #SSI_SRX0]
113 ldr r11, [r12, #SSI_SRX0]
116 ldr r11, [r12, #SSI_SRX0]
119 /* dummy read to skip slot 12 */
120 ldrne r11, [r12, #SSI_SRX0]
123 lsr r11, r9, #16 /* r11: buffer size */
136 .L_imx_ssi_fiq_rx_buffer:
137 imx_ssi_fiq_rx_buffer:
139 .L_imx_ssi_fiq_tx_buffer:
140 imx_ssi_fiq_tx_buffer: