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>
11 #include <asm/export.h>
14 * r8 = bit 0-15: tx offset, bit 16-31: tx buffer size
15 * r9 = bit 0-15: rx offset, bit 16-31: rx buffer size
22 #define SSI_SACNT 0x38
24 #define SSI_SACNT_AC97EN (1 << 0)
26 #define SSI_SIER_TFE0_EN (1 << 0)
27 #define SSI_SISR_TFE0 (1 << 0)
28 #define SSI_SISR_RFF0 (1 << 2)
29 #define SSI_SIER_RFF0_EN (1 << 2)
32 .global imx_ssi_fiq_start
33 .global imx_ssi_fiq_end
34 .global imx_ssi_fiq_base
35 .global imx_ssi_fiq_rx_buffer
36 .global imx_ssi_fiq_tx_buffer
39 * imx_ssi_fiq_start is _intentionally_ not marked as a function symbol
40 * using ENDPROC(). imx_ssi_fiq_start and imx_ssi_fiq_end are used to
41 * mark the function body so that it can be copied to the FIQ vector in
42 * the vectors page. imx_ssi_fiq_start should only be called as the result
43 * of an FIQ: calling it directly will not work.
46 ldr r12, .L_imx_ssi_fiq_base
49 ldr r13, .L_imx_ssi_fiq_tx_buffer
52 ldr r11, [r12, #SSI_SIER]
53 tst r11, #SSI_SIER_TFE0_EN
57 ldr r11, [r12, #SSI_SISR]
58 tst r11, #SSI_SISR_TFE0
63 and r10, r10, r8 /* r10: current buffer offset */
68 strh r11, [r12, #SSI_STX0]
71 strh r11, [r12, #SSI_STX0]
74 strh r11, [r12, #SSI_STX0]
77 strh r11, [r12, #SSI_STX0]
80 lsr r11, r8, #16 /* r11: buffer size */
87 /* shall we receive? */
88 ldr r11, [r12, #SSI_SIER]
89 tst r11, #SSI_SIER_RFF0_EN
93 ldr r11, [r12, #SSI_SISR]
94 tst r11, #SSI_SISR_RFF0
97 ldr r13, .L_imx_ssi_fiq_rx_buffer
101 and r10, r10, r9 /* r10: current buffer offset */
105 ldr r11, [r12, #SSI_SACNT]
106 tst r11, #SSI_SACNT_AC97EN
108 ldr r11, [r12, #SSI_SRX0]
111 ldr r11, [r12, #SSI_SRX0]
114 /* dummy read to skip slot 12 */
115 ldrne r11, [r12, #SSI_SRX0]
117 ldr r11, [r12, #SSI_SRX0]
120 ldr r11, [r12, #SSI_SRX0]
123 /* dummy read to skip slot 12 */
124 ldrne r11, [r12, #SSI_SRX0]
127 lsr r11, r9, #16 /* r11: buffer size */
140 .L_imx_ssi_fiq_rx_buffer:
141 imx_ssi_fiq_rx_buffer:
143 .L_imx_ssi_fiq_tx_buffer:
144 imx_ssi_fiq_tx_buffer:
148 EXPORT_SYMBOL(imx_ssi_fiq_tx_buffer)
149 EXPORT_SYMBOL(imx_ssi_fiq_rx_buffer)
150 EXPORT_SYMBOL(imx_ssi_fiq_start)
151 EXPORT_SYMBOL(imx_ssi_fiq_end)
152 EXPORT_SYMBOL(imx_ssi_fiq_base)