]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/cpu/arm926ejs/lpc32xx/devices.c
2 * Copyright (C) 2011 by Vladimir Zapolskiy <vz@mleia.com>
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm/arch/cpu.h>
9 #include <asm/arch/clk.h>
10 #include <asm/arch/uart.h>
13 static struct clk_pm_regs
*clk
= (struct clk_pm_regs
*)CLK_PM_BASE
;
14 static struct uart_ctrl_regs
*ctrl
= (struct uart_ctrl_regs
*)UART_CTRL_BASE
;
16 void lpc32xx_uart_init(unsigned int uart_id
)
18 if (uart_id
< 1 || uart_id
> 7)
21 /* Disable loopback mode, if it is set by S1L bootloader */
22 clrbits_le32(&ctrl
->loop
,
23 UART_LOOPBACK(CONFIG_SYS_LPC32XX_UART
));
25 if (uart_id
< 3 || uart_id
> 6)
28 /* Enable UART system clock */
29 setbits_le32(&clk
->uartclk_ctrl
, CLK_UART(uart_id
));
31 /* Set UART into autoclock mode */
32 clrsetbits_le32(&ctrl
->clkmode
,
33 UART_CLKMODE_MASK(uart_id
),
34 UART_CLKMODE_AUTO(uart_id
));
36 /* Bypass pre-divider of UART clock */
37 writel(CLK_UART_X_DIV(1) | CLK_UART_Y_DIV(1),
38 &clk
->u3clk
+ (uart_id
- 3));