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 ldr r12, imx_ssi_fiq_base
41 ldr r11, imx_ssi_fiq_tx_buffer
44 ldr r13, [r12, #SSI_SIER]
45 tst r13, #SSI_SIER_TFE0_EN
49 ldr r13, [r12, #SSI_SISR]
50 tst r13, #SSI_SISR_TFE0
55 and r10, r10, r8 /* r10: current buffer offset */
60 strh r13, [r12, #SSI_STX0]
63 strh r13, [r12, #SSI_STX0]
66 strh r13, [r12, #SSI_STX0]
69 strh r13, [r12, #SSI_STX0]
72 lsr r13, r8, #16 /* r13: buffer size */
79 /* shall we receive? */
80 ldr r13, [r12, #SSI_SIER]
81 tst r13, #SSI_SIER_RFF0_EN
85 ldr r13, [r12, #SSI_SISR]
86 tst r13, #SSI_SISR_RFF0
89 ldr r11, imx_ssi_fiq_rx_buffer
93 and r10, r10, r9 /* r10: current buffer offset */
97 ldr r13, [r12, #SSI_SACNT]
98 tst r13, #SSI_SACNT_AC97EN
100 ldr r13, [r12, #SSI_SRX0]
103 ldr r13, [r12, #SSI_SRX0]
106 /* dummy read to skip slot 12 */
107 ldrne r13, [r12, #SSI_SRX0]
109 ldr r13, [r12, #SSI_SRX0]
112 ldr r13, [r12, #SSI_SRX0]
115 /* dummy read to skip slot 12 */
116 ldrne r13, [r12, #SSI_SRX0]
119 lsr r13, r9, #16 /* r13: buffer size */
129 imx_ssi_fiq_rx_buffer:
131 imx_ssi_fiq_tx_buffer: