]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/mach-rockchip/rk_early_print.c
2 * (C) Copyright 2015 Rockchip Electronics Co., Ltd
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm/arch/uart.h>
11 static struct rk_uart
*uart_ptr
;
13 static void uart_wrtie_byte(char byte
)
15 writel(byte
, &uart_ptr
->rbr
);
16 while (!(readl(&uart_ptr
->lsr
) & 0x40))
24 uart_wrtie_byte('\r');
30 void print_hex(unsigned int n
)
38 for (i
= 8; i
> 0; i
--) {
39 temp
= (n
>> (i
- 1) * 4) & 0x0f;
41 uart_wrtie_byte((char)(temp
+ '0'));
43 uart_wrtie_byte((char)(temp
- 10 + 'a'));
45 uart_wrtie_byte('\n');
46 uart_wrtie_byte('\r');
50 * TODO: since rk3036 only 4K sram to use in SPL, for saving space,
51 * we implement uart driver this way, we should convert this to use
52 * ns16550 driver in future, which support DEBUG_UART in the standard way
54 void rk_uart_init(void *base
)
56 uart_ptr
= (struct rk_uart
*)base
;
57 writel(0x83, &uart_ptr
->lcr
);
58 writel(0x0d, &uart_ptr
->rbr
);
59 writel(0x03, &uart_ptr
->lcr
);
61 /* fifo enable, sfe is shadow register of FCR[0] */
62 writel(0x01, &uart_ptr
->sfe
);