Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Debugging macro include header
 4 *
 5 *  Copyright (C) 1994-1999 Russell King
 6 *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
 
 
 
 
 
 7*/
 8
 9#include <linux/serial_reg.h>
10
11/* External port on Zoom2/3 */
12#define ZOOM_UART_BASE		0x10000000
13#define ZOOM_UART_VIRT		0xfa400000
14
15#define OMAP_PORT_SHIFT		2
16#define ZOOM_PORT_SHIFT		1
17
18#define UART_OFFSET(addr)	((addr) & 0x00ffffff)
19
20		.pushsection .data
21		.align	2
22omap_uart_phys:	.word	0
23omap_uart_virt:	.word	0
24omap_uart_lsr:	.word	0
25		.popsection
26
27		.macro	addruart, rp, rv, tmp
28
29		/* Use omap_uart_phys/virt if already configured */
3010:		adr	\rp, 99f		@ get effective addr of 99f
31		ldr	\rv, [\rp]		@ get absolute addr of 99f
32		sub	\rv, \rv, \rp		@ offset between the two
33		ldr	\rp, [\rp, #4]		@ abs addr of omap_uart_phys
34		sub	\tmp, \rp, \rv		@ make it effective
35		ldr	\rp, [\tmp, #0]		@ omap_uart_phys
36		ldr	\rv, [\tmp, #4]		@ omap_uart_virt
37		cmp	\rp, #0			@ is port configured?
38		cmpne	\rv, #0
39		bne	100f			@ already configured
40
41		/* Configure the UART offset from the phys/virt base */
42#ifdef CONFIG_DEBUG_ZOOM_UART
43		ldr	\rp, =ZOOM_UART_BASE
44		str	\rp, [\tmp, #0]		@ omap_uart_phys
45		ldr	\rp, =ZOOM_UART_VIRT
46		str	\rp, [\tmp, #4]		@ omap_uart_virt
47		mov	\rp, #(UART_LSR << ZOOM_PORT_SHIFT)
48		str	\rp, [\tmp, #8]		@ omap_uart_lsr
49#endif
50		b	10b
51
52		.align
5399:		.word	.
54		.word	omap_uart_phys
55		.ltorg
56
57100:		/* Pass the UART_LSR reg address */
58		ldr	\tmp, [\tmp, #8]	@ omap_uart_lsr
59		add	\rp, \rp, \tmp
60		add	\rv, \rv, \tmp
61		.endm
62
63		.macro	senduart,rd,rx
64		orr	\rd, \rd, \rx, lsl #24	@ preserve LSR reg offset
65		bic	\rx, \rx, #0xff		@ get base (THR) reg address
66		strb	\rd, [\rx]		@ send lower byte of rd
67		orr	\rx, \rx, \rd, lsr #24	@ restore original rx (LSR)
68		bic	\rd, \rd, #(0xff << 24)	@ restore original rd
69		.endm
70
71		.macro	busyuart,rd,rx
721001:		ldrb	\rd, [\rx]		@ rx contains UART_LSR address
73		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
74		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
75		bne	1001b
76		.endm
77
78		.macro	waituartcts,rd,rx
79		.endm
80
81		.macro	waituarttxrdy,rd,rx
82		.endm
v4.17
 
 1/*
 2 * Debugging macro include header
 3 *
 4 *  Copyright (C) 1994-1999 Russell King
 5 *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
 6 *
 7 * This program is free software; you can redistribute it and/or modify
 8 * it under the terms of the GNU General Public License version 2 as
 9 * published by the Free Software Foundation.
10 *
11*/
12
13#include <linux/serial_reg.h>
14
15/* External port on Zoom2/3 */
16#define ZOOM_UART_BASE		0x10000000
17#define ZOOM_UART_VIRT		0xfa400000
18
19#define OMAP_PORT_SHIFT		2
20#define ZOOM_PORT_SHIFT		1
21
22#define UART_OFFSET(addr)	((addr) & 0x00ffffff)
23
24		.pushsection .data
25		.align	2
26omap_uart_phys:	.word	0
27omap_uart_virt:	.word	0
28omap_uart_lsr:	.word	0
29		.popsection
30
31		.macro	addruart, rp, rv, tmp
32
33		/* Use omap_uart_phys/virt if already configured */
3410:		adr	\rp, 99f		@ get effective addr of 99f
35		ldr	\rv, [\rp]		@ get absolute addr of 99f
36		sub	\rv, \rv, \rp		@ offset between the two
37		ldr	\rp, [\rp, #4]		@ abs addr of omap_uart_phys
38		sub	\tmp, \rp, \rv		@ make it effective
39		ldr	\rp, [\tmp, #0]		@ omap_uart_phys
40		ldr	\rv, [\tmp, #4]		@ omap_uart_virt
41		cmp	\rp, #0			@ is port configured?
42		cmpne	\rv, #0
43		bne	100f			@ already configured
44
45		/* Configure the UART offset from the phys/virt base */
46#ifdef CONFIG_DEBUG_ZOOM_UART
47		ldr	\rp, =ZOOM_UART_BASE
48		str	\rp, [\tmp, #0]		@ omap_uart_phys
49		ldr	\rp, =ZOOM_UART_VIRT
50		str	\rp, [\tmp, #4]		@ omap_uart_virt
51		mov	\rp, #(UART_LSR << ZOOM_PORT_SHIFT)
52		str	\rp, [\tmp, #8]		@ omap_uart_lsr
53#endif
54		b	10b
55
56		.align
5799:		.word	.
58		.word	omap_uart_phys
59		.ltorg
60
61100:		/* Pass the UART_LSR reg address */
62		ldr	\tmp, [\tmp, #8]	@ omap_uart_lsr
63		add	\rp, \rp, \tmp
64		add	\rv, \rv, \tmp
65		.endm
66
67		.macro	senduart,rd,rx
68		orr	\rd, \rd, \rx, lsl #24	@ preserve LSR reg offset
69		bic	\rx, \rx, #0xff		@ get base (THR) reg address
70		strb	\rd, [\rx]		@ send lower byte of rd
71		orr	\rx, \rx, \rd, lsr #24	@ restore original rx (LSR)
72		bic	\rd, \rd, #(0xff << 24)	@ restore original rd
73		.endm
74
75		.macro	busyuart,rd,rx
761001:		ldrb	\rd, [\rx]		@ rx contains UART_LSR address
77		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
78		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
79		bne	1001b
80		.endm
81
82		.macro	waituart,rd,rx
 
 
 
83		.endm