diff options
| author | fishsoupisgood <github@madingley.org> | 2019-04-29 01:17:54 +0100 | 
|---|---|---|
| committer | fishsoupisgood <github@madingley.org> | 2019-05-27 03:43:43 +0100 | 
| commit | 3f2546b2ef55b661fd8dd69682b38992225e86f6 (patch) | |
| tree | 65ca85f13617aee1dce474596800950f266a456c /roms/u-boot/arch/arm/cpu/arm926ejs/lpc32xx/devices.c | |
| download | qemu-master.tar.gz qemu-master.tar.bz2 qemu-master.zip | |
Diffstat (limited to 'roms/u-boot/arch/arm/cpu/arm926ejs/lpc32xx/devices.c')
| -rw-r--r-- | roms/u-boot/arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 39 | 
1 files changed, 39 insertions, 0 deletions
| diff --git a/roms/u-boot/arch/arm/cpu/arm926ejs/lpc32xx/devices.c b/roms/u-boot/arch/arm/cpu/arm926ejs/lpc32xx/devices.c new file mode 100644 index 00000000..b5676578 --- /dev/null +++ b/roms/u-boot/arch/arm/cpu/arm926ejs/lpc32xx/devices.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011 by Vladimir Zapolskiy <vz@mleia.com> + * + * SPDX-License-Identifier:	GPL-2.0+ + */ + +#include <common.h> +#include <asm/arch/cpu.h> +#include <asm/arch/clk.h> +#include <asm/arch/uart.h> +#include <asm/io.h> + +static struct clk_pm_regs    *clk  = (struct clk_pm_regs *)CLK_PM_BASE; +static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE; + +void lpc32xx_uart_init(unsigned int uart_id) +{ +	if (uart_id < 1 || uart_id > 7) +		return; + +	/* Disable loopback mode, if it is set by S1L bootloader */ +	clrbits_le32(&ctrl->loop, +		     UART_LOOPBACK(CONFIG_SYS_LPC32XX_UART)); + +	if (uart_id < 3 || uart_id > 6) +		return; + +	/* Enable UART system clock */ +	setbits_le32(&clk->uartclk_ctrl, CLK_UART(uart_id)); + +	/* Set UART into autoclock mode */ +	clrsetbits_le32(&ctrl->clkmode, +			UART_CLKMODE_MASK(uart_id), +			UART_CLKMODE_AUTO(uart_id)); + +	/* Bypass pre-divider of UART clock */ +	writel(CLK_UART_X_DIV(1) | CLK_UART_Y_DIV(1), +	       &clk->u3clk + (uart_id - 3)); +} | 
