.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * arch/arm/mach-lpc32xx/serial.c |
---|
3 | 4 | * |
---|
4 | 5 | * Author: Kevin Wells <kevin.wells@nxp.com> |
---|
5 | 6 | * |
---|
6 | 7 | * Copyright (C) 2010 NXP Semiconductors |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | 8 | */ |
---|
18 | 9 | |
---|
19 | 10 | #include <linux/kernel.h> |
---|
.. | .. |
---|
25 | 16 | #include <linux/clk.h> |
---|
26 | 17 | #include <linux/io.h> |
---|
27 | 18 | |
---|
28 | | -#include <mach/hardware.h> |
---|
29 | | -#include <mach/platform.h> |
---|
| 19 | +#include "lpc32xx.h" |
---|
30 | 20 | #include "common.h" |
---|
31 | 21 | |
---|
32 | 22 | #define LPC32XX_SUART_FIFO_SIZE 64 |
---|
.. | .. |
---|
69 | 59 | }, |
---|
70 | 60 | }; |
---|
71 | 61 | |
---|
| 62 | +/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */ |
---|
| 63 | +void lpc32xx_loopback_set(resource_size_t mapbase, int state) |
---|
| 64 | +{ |
---|
| 65 | + int bit; |
---|
| 66 | + u32 tmp; |
---|
| 67 | + |
---|
| 68 | + switch (mapbase) { |
---|
| 69 | + case LPC32XX_HS_UART1_BASE: |
---|
| 70 | + bit = 0; |
---|
| 71 | + break; |
---|
| 72 | + case LPC32XX_HS_UART2_BASE: |
---|
| 73 | + bit = 1; |
---|
| 74 | + break; |
---|
| 75 | + case LPC32XX_HS_UART7_BASE: |
---|
| 76 | + bit = 6; |
---|
| 77 | + break; |
---|
| 78 | + default: |
---|
| 79 | + WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase); |
---|
| 80 | + return; |
---|
| 81 | + } |
---|
| 82 | + |
---|
| 83 | + tmp = readl(LPC32XX_UARTCTL_CLOOP); |
---|
| 84 | + if (state) |
---|
| 85 | + tmp |= (1 << bit); |
---|
| 86 | + else |
---|
| 87 | + tmp &= ~(1 << bit); |
---|
| 88 | + writel(tmp, LPC32XX_UARTCTL_CLOOP); |
---|
| 89 | +} |
---|
| 90 | +EXPORT_SYMBOL_GPL(lpc32xx_loopback_set); |
---|
| 91 | + |
---|
72 | 92 | void __init lpc32xx_serial_init(void) |
---|
73 | 93 | { |
---|
74 | 94 | u32 tmp, clkmodes = 0; |
---|