summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-stm32mp/include/mach/debug_ll.h
blob: 99fedb91fe6717f580f94211e81517d7aec3a41a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef __MACH_STM32MP1_DEBUG_LL_H
#define __MACH_STM32MP1_DEBUG_LL_H

#include <io.h>
#include <mach/stm32.h>

#define DEBUG_LL_UART_ADDR	STM32_UART4_BASE

#define CR1_OFFSET	0x00
#define CR3_OFFSET	0x08
#define BRR_OFFSET	0x0c
#define ISR_OFFSET	0x1c
#define ICR_OFFSET	0x20
#define RDR_OFFSET	0x24
#define TDR_OFFSET	0x28

#define USART_ISR_TXE	BIT(7)

static inline void PUTC_LL(int c)
{
	void __iomem *base = IOMEM(DEBUG_LL_UART_ADDR);

	writel(c, base + TDR_OFFSET);

	while ((readl(base + ISR_OFFSET) & USART_ISR_TXE) == 0);
}

#endif /* __MACH_STM32MP1_DEBUG_LL_H */