2 * Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
13 * r8 = bit 0-15: tx offset, bit 16-31: tx buffer size
14 * r9 = bit 0-15: rx offset, bit 16-31: rx buffer size
21 #define SSI_SACNT 0x38
23 #define SSI_SACNT_AC97EN (1 << 0)
25 #define SSI_SIER_TFE0_EN (1 << 0)
26 #define SSI_SISR_TFE0 (1 << 0)
27 #define SSI_SISR_RFF0 (1 << 2)
28 #define SSI_SIER_RFF0_EN (1 << 2)
31 .global imx_ssi_fiq_start
32 .global imx_ssi_fiq_end
33 .global imx_ssi_fiq_base
34 .global imx_ssi_fiq_rx_buffer
35 .global imx_ssi_fiq_tx_buffer
38 * imx_ssi_fiq_start is _intentionally_ not marked as a function symbol
39 * using ENDPROC(). imx_ssi_fiq_start and imx_ssi_fiq_end are used to
40 * mark the function body so that it can be copied to the FIQ vector in
41 * the vectors page. imx_ssi_fiq_start should only be called as the result
42 * of an FIQ: calling it directly will not work.
45 ldr r12, .L_imx_ssi_fiq_base
48 ldr r13, .L_imx_ssi_fiq_tx_buffer
51 ldr r11, [r12, #SSI_SIER]
52 tst r11, #SSI_SIER_TFE0_EN
56 ldr r11, [r12, #SSI_SISR]
57 tst r11, #SSI_SISR_TFE0
62 and r10, r10, r8 /* r10: current buffer offset */
67 strh r11, [r12, #SSI_STX0]
70 strh r11, [r12, #SSI_STX0]
73 strh r11, [r12, #SSI_STX0]
76 strh r11, [r12, #SSI_STX0]
79 lsr r11, r8, #16 /* r11: buffer size */
86 /* shall we receive? */
87 ldr r11, [r12, #SSI_SIER]
88 tst r11, #SSI_SIER_RFF0_EN
92 ldr r11, [r12, #SSI_SISR]
93 tst r11, #SSI_SISR_RFF0
96 ldr r13, .L_imx_ssi_fiq_rx_buffer
100 and r10, r10, r9 /* r10: current buffer offset */
104 ldr r11, [r12, #SSI_SACNT]
105 tst r11, #SSI_SACNT_AC97EN
107 ldr r11, [r12, #SSI_SRX0]
110 ldr r11, [r12, #SSI_SRX0]
113 /* dummy read to skip slot 12 */
114 ldrne r11, [r12, #SSI_SRX0]
116 ldr r11, [r12, #SSI_SRX0]
119 ldr r11, [r12, #SSI_SRX0]
122 /* dummy read to skip slot 12 */
123 ldrne r11, [r12, #SSI_SRX0]
126 lsr r11, r9, #16 /* r11: buffer size */
139 .L_imx_ssi_fiq_rx_buffer:
140 imx_ssi_fiq_rx_buffer:
142 .L_imx_ssi_fiq_tx_buffer:
143 imx_ssi_fiq_tx_buffer: