Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2004-2006 Atmel Corporation |
| 4 | * |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 5 | * Modified to support C structur SoC access by |
| 6 | * Andreas Bießmann <biessmann@corscience.de> |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 7 | */ |
| 8 | #include <common.h> |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 9 | #include <clk.h> |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 10 | #include <dm.h> |
| 11 | #include <errno.h> |
Simon Glass | 336d461 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 12 | #include <malloc.h> |
Jean-Christophe PLAGNIOL-VILLARD | 843a265 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 13 | #include <watchdog.h> |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 14 | #include <serial.h> |
Wenyou Yang | 998cf3c | 2016-10-17 09:49:55 +0800 | [diff] [blame] | 15 | #include <debug_uart.h> |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 16 | #include <linux/compiler.h> |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 17 | |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 18 | #include <asm/io.h> |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 19 | #ifdef CONFIG_DM_SERIAL |
| 20 | #include <asm/arch/atmel_serial.h> |
| 21 | #endif |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 22 | #include <asm/arch/clk.h> |
Reinhard Meyer | 329f0f5 | 2010-11-03 16:32:56 +0100 | [diff] [blame] | 23 | #include <asm/arch/hardware.h> |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 24 | |
| 25 | #include "atmel_usart.h" |
| 26 | |
| 27 | DECLARE_GLOBAL_DATA_PTR; |
| 28 | |
Wenyou Yang | 5f29e79 | 2017-04-14 15:01:27 +0800 | [diff] [blame] | 29 | #ifndef CONFIG_DM_SERIAL |
Simon Glass | 62137fc | 2014-10-29 13:08:59 -0600 | [diff] [blame] | 30 | static void atmel_serial_setbrg_internal(atmel_usart3_t *usart, int id, |
| 31 | int baudrate) |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 32 | { |
| 33 | unsigned long divisor; |
| 34 | unsigned long usart_hz; |
| 35 | |
| 36 | /* |
| 37 | * Master Clock |
| 38 | * Baud Rate = -------------- |
| 39 | * 16 * CD |
| 40 | */ |
Simon Glass | 62137fc | 2014-10-29 13:08:59 -0600 | [diff] [blame] | 41 | usart_hz = get_usart_clk_rate(id); |
| 42 | divisor = (usart_hz / 16 + baudrate / 2) / baudrate; |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 43 | writel(USART3_BF(CD, divisor), &usart->brgr); |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 44 | } |
| 45 | |
Simon Glass | 62137fc | 2014-10-29 13:08:59 -0600 | [diff] [blame] | 46 | static void atmel_serial_init_internal(atmel_usart3_t *usart) |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 47 | { |
Xu, Hong | 1f4faed | 2011-08-02 01:05:04 +0000 | [diff] [blame] | 48 | /* |
| 49 | * Just in case: drain transmitter register |
| 50 | * 1000us is enough for baudrate >= 9600 |
| 51 | */ |
| 52 | if (!(readl(&usart->csr) & USART3_BIT(TXEMPTY))) |
| 53 | __udelay(1000); |
| 54 | |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 55 | writel(USART3_BIT(RSTRX) | USART3_BIT(RSTTX), &usart->cr); |
Simon Glass | 62137fc | 2014-10-29 13:08:59 -0600 | [diff] [blame] | 56 | } |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 57 | |
Simon Glass | 62137fc | 2014-10-29 13:08:59 -0600 | [diff] [blame] | 58 | static void atmel_serial_activate(atmel_usart3_t *usart) |
| 59 | { |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 60 | writel((USART3_BF(USART_MODE, USART3_USART_MODE_NORMAL) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 61 | | USART3_BF(USCLKS, USART3_USCLKS_MCK) |
| 62 | | USART3_BF(CHRL, USART3_CHRL_8) |
| 63 | | USART3_BF(PAR, USART3_PAR_NONE) |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 64 | | USART3_BF(NBSTOP, USART3_NBSTOP_1)), |
| 65 | &usart->mr); |
Xu, Hong | 1f4faed | 2011-08-02 01:05:04 +0000 | [diff] [blame] | 66 | writel(USART3_BIT(RXEN) | USART3_BIT(TXEN), &usart->cr); |
| 67 | /* 100us is enough for the new settings to be settled */ |
| 68 | __udelay(100); |
Simon Glass | 62137fc | 2014-10-29 13:08:59 -0600 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | static void atmel_serial_setbrg(void) |
| 72 | { |
| 73 | atmel_serial_setbrg_internal((atmel_usart3_t *)CONFIG_USART_BASE, |
| 74 | CONFIG_USART_ID, gd->baudrate); |
| 75 | } |
| 76 | |
| 77 | static int atmel_serial_init(void) |
| 78 | { |
| 79 | atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; |
| 80 | |
| 81 | atmel_serial_init_internal(usart); |
| 82 | serial_setbrg(); |
| 83 | atmel_serial_activate(usart); |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 88 | static void atmel_serial_putc(char c) |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 89 | { |
Reinhard Meyer | 329f0f5 | 2010-11-03 16:32:56 +0100 | [diff] [blame] | 90 | atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 91 | |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 92 | if (c == '\n') |
| 93 | serial_putc('\r'); |
| 94 | |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 95 | while (!(readl(&usart->csr) & USART3_BIT(TXRDY))); |
| 96 | writel(c, &usart->thr); |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 97 | } |
| 98 | |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 99 | static int atmel_serial_getc(void) |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 100 | { |
Reinhard Meyer | 329f0f5 | 2010-11-03 16:32:56 +0100 | [diff] [blame] | 101 | atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 102 | |
| 103 | while (!(readl(&usart->csr) & USART3_BIT(RXRDY))) |
Jean-Christophe PLAGNIOL-VILLARD | 843a265 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 104 | WATCHDOG_RESET(); |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 105 | return readl(&usart->rhr); |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 106 | } |
| 107 | |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 108 | static int atmel_serial_tstc(void) |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 109 | { |
Reinhard Meyer | 329f0f5 | 2010-11-03 16:32:56 +0100 | [diff] [blame] | 110 | atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; |
Andreas Bießmann | 125637c | 2010-09-03 10:28:05 +0200 | [diff] [blame] | 111 | return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0; |
Wolfgang Denk | f93ae78 | 2006-10-24 14:31:24 +0200 | [diff] [blame] | 112 | } |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 113 | |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 114 | static struct serial_device atmel_serial_drv = { |
| 115 | .name = "atmel_serial", |
| 116 | .start = atmel_serial_init, |
| 117 | .stop = NULL, |
| 118 | .setbrg = atmel_serial_setbrg, |
| 119 | .putc = atmel_serial_putc, |
Marek Vasut | ec3fd68 | 2012-10-06 14:07:02 +0000 | [diff] [blame] | 120 | .puts = default_serial_puts, |
Marek Vasut | cfba457 | 2012-09-13 16:50:30 +0200 | [diff] [blame] | 121 | .getc = atmel_serial_getc, |
| 122 | .tstc = atmel_serial_tstc, |
| 123 | }; |
| 124 | |
| 125 | void atmel_serial_initialize(void) |
| 126 | { |
| 127 | serial_register(&atmel_serial_drv); |
| 128 | } |
| 129 | |
| 130 | __weak struct serial_device *default_serial_console(void) |
| 131 | { |
| 132 | return &atmel_serial_drv; |
| 133 | } |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 134 | #endif |
| 135 | |
| 136 | #ifdef CONFIG_DM_SERIAL |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 137 | enum serial_clk_type { |
| 138 | CLK_TYPE_NORMAL = 0, |
| 139 | CLK_TYPE_DBGU, |
| 140 | }; |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 141 | |
| 142 | struct atmel_serial_priv { |
| 143 | atmel_usart3_t *usart; |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 144 | ulong usart_clk_rate; |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 145 | }; |
| 146 | |
Wenyou Yang | 5f29e79 | 2017-04-14 15:01:27 +0800 | [diff] [blame] | 147 | static void _atmel_serial_set_brg(atmel_usart3_t *usart, |
| 148 | ulong usart_clk_rate, int baudrate) |
| 149 | { |
| 150 | unsigned long divisor; |
| 151 | |
| 152 | divisor = (usart_clk_rate / 16 + baudrate / 2) / baudrate; |
| 153 | writel(USART3_BF(CD, divisor), &usart->brgr); |
| 154 | } |
| 155 | |
| 156 | void _atmel_serial_init(atmel_usart3_t *usart, |
| 157 | ulong usart_clk_rate, int baudrate) |
| 158 | { |
| 159 | writel(USART3_BIT(RXDIS) | USART3_BIT(TXDIS), &usart->cr); |
| 160 | |
| 161 | writel((USART3_BF(USART_MODE, USART3_USART_MODE_NORMAL) | |
| 162 | USART3_BF(USCLKS, USART3_USCLKS_MCK) | |
| 163 | USART3_BF(CHRL, USART3_CHRL_8) | |
| 164 | USART3_BF(PAR, USART3_PAR_NONE) | |
| 165 | USART3_BF(NBSTOP, USART3_NBSTOP_1)), &usart->mr); |
| 166 | |
| 167 | _atmel_serial_set_brg(usart, usart_clk_rate, baudrate); |
| 168 | |
| 169 | writel(USART3_BIT(RSTRX) | USART3_BIT(RSTTX), &usart->cr); |
| 170 | writel(USART3_BIT(RXEN) | USART3_BIT(TXEN), &usart->cr); |
| 171 | } |
| 172 | |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 173 | int atmel_serial_setbrg(struct udevice *dev, int baudrate) |
| 174 | { |
| 175 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
| 176 | |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 177 | _atmel_serial_set_brg(priv->usart, priv->usart_clk_rate, baudrate); |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 178 | |
| 179 | return 0; |
| 180 | } |
| 181 | |
| 182 | static int atmel_serial_getc(struct udevice *dev) |
| 183 | { |
| 184 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
| 185 | |
| 186 | if (!(readl(&priv->usart->csr) & USART3_BIT(RXRDY))) |
| 187 | return -EAGAIN; |
| 188 | |
| 189 | return readl(&priv->usart->rhr); |
| 190 | } |
| 191 | |
| 192 | static int atmel_serial_putc(struct udevice *dev, const char ch) |
| 193 | { |
| 194 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
| 195 | |
| 196 | if (!(readl(&priv->usart->csr) & USART3_BIT(TXRDY))) |
| 197 | return -EAGAIN; |
| 198 | |
| 199 | writel(ch, &priv->usart->thr); |
| 200 | |
| 201 | return 0; |
| 202 | } |
| 203 | |
| 204 | static int atmel_serial_pending(struct udevice *dev, bool input) |
| 205 | { |
| 206 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
| 207 | uint32_t csr = readl(&priv->usart->csr); |
| 208 | |
| 209 | if (input) |
| 210 | return csr & USART3_BIT(RXRDY) ? 1 : 0; |
| 211 | else |
| 212 | return csr & USART3_BIT(TXEMPTY) ? 0 : 1; |
| 213 | } |
| 214 | |
| 215 | static const struct dm_serial_ops atmel_serial_ops = { |
| 216 | .putc = atmel_serial_putc, |
| 217 | .pending = atmel_serial_pending, |
| 218 | .getc = atmel_serial_getc, |
| 219 | .setbrg = atmel_serial_setbrg, |
| 220 | }; |
| 221 | |
Stefan Roese | e567dfb | 2019-04-03 15:24:19 +0200 | [diff] [blame] | 222 | #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_CLK) |
| 223 | static int atmel_serial_enable_clk(struct udevice *dev) |
| 224 | { |
| 225 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
| 226 | |
| 227 | /* Use fixed clock value in SPL */ |
| 228 | priv->usart_clk_rate = CONFIG_SPL_UART_CLOCK; |
| 229 | |
| 230 | return 0; |
| 231 | } |
| 232 | #else |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 233 | static int atmel_serial_enable_clk(struct udevice *dev) |
| 234 | { |
| 235 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
| 236 | struct clk clk; |
| 237 | ulong clk_rate; |
| 238 | int ret; |
| 239 | |
| 240 | ret = clk_get_by_index(dev, 0, &clk); |
| 241 | if (ret) |
| 242 | return -EINVAL; |
| 243 | |
| 244 | if (dev_get_driver_data(dev) == CLK_TYPE_NORMAL) { |
| 245 | ret = clk_enable(&clk); |
| 246 | if (ret) |
| 247 | return ret; |
| 248 | } |
| 249 | |
| 250 | clk_rate = clk_get_rate(&clk); |
| 251 | if (!clk_rate) |
| 252 | return -EINVAL; |
| 253 | |
| 254 | priv->usart_clk_rate = clk_rate; |
| 255 | |
| 256 | clk_free(&clk); |
| 257 | |
| 258 | return 0; |
| 259 | } |
Stefan Roese | e567dfb | 2019-04-03 15:24:19 +0200 | [diff] [blame] | 260 | #endif |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 261 | |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 262 | static int atmel_serial_probe(struct udevice *dev) |
| 263 | { |
| 264 | struct atmel_serial_platdata *plat = dev->platdata; |
| 265 | struct atmel_serial_priv *priv = dev_get_priv(dev); |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 266 | int ret; |
Wenyou Yang | c1631c8 | 2016-06-01 08:36:56 +0800 | [diff] [blame] | 267 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
| 268 | fdt_addr_t addr_base; |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 269 | |
Simon Glass | a821c4a | 2017-05-17 17:18:05 -0600 | [diff] [blame] | 270 | addr_base = devfdt_get_addr(dev); |
Wenyou Yang | c1631c8 | 2016-06-01 08:36:56 +0800 | [diff] [blame] | 271 | if (addr_base == FDT_ADDR_T_NONE) |
| 272 | return -ENODEV; |
| 273 | |
| 274 | plat->base_addr = (uint32_t)addr_base; |
| 275 | #endif |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 276 | priv->usart = (atmel_usart3_t *)plat->base_addr; |
Wenyou Yang | 5f29e79 | 2017-04-14 15:01:27 +0800 | [diff] [blame] | 277 | |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 278 | ret = atmel_serial_enable_clk(dev); |
| 279 | if (ret) |
| 280 | return ret; |
| 281 | |
| 282 | _atmel_serial_init(priv->usart, priv->usart_clk_rate, gd->baudrate); |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
Wenyou Yang | c1631c8 | 2016-06-01 08:36:56 +0800 | [diff] [blame] | 287 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
| 288 | static const struct udevice_id atmel_serial_ids[] = { |
Wenyou Yang | f8b7fff | 2017-04-14 15:01:28 +0800 | [diff] [blame] | 289 | { |
| 290 | .compatible = "atmel,at91sam9260-dbgu", |
| 291 | .data = CLK_TYPE_DBGU, |
| 292 | }, |
| 293 | { |
| 294 | .compatible = "atmel,at91sam9260-usart", |
| 295 | .data = CLK_TYPE_NORMAL, |
| 296 | }, |
Wenyou Yang | c1631c8 | 2016-06-01 08:36:56 +0800 | [diff] [blame] | 297 | { } |
| 298 | }; |
| 299 | #endif |
| 300 | |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 301 | U_BOOT_DRIVER(serial_atmel) = { |
| 302 | .name = "serial_atmel", |
| 303 | .id = UCLASS_SERIAL, |
Wenyou Yang | c1631c8 | 2016-06-01 08:36:56 +0800 | [diff] [blame] | 304 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
| 305 | .of_match = atmel_serial_ids, |
| 306 | .platdata_auto_alloc_size = sizeof(struct atmel_serial_platdata), |
| 307 | #endif |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 308 | .probe = atmel_serial_probe, |
| 309 | .ops = &atmel_serial_ops, |
Bin Meng | 4687919 | 2018-10-24 06:36:36 -0700 | [diff] [blame] | 310 | #if !CONFIG_IS_ENABLED(OF_CONTROL) |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 311 | .flags = DM_FLAG_PRE_RELOC, |
Bin Meng | 4687919 | 2018-10-24 06:36:36 -0700 | [diff] [blame] | 312 | #endif |
Simon Glass | 0f65f48 | 2014-10-29 13:09:00 -0600 | [diff] [blame] | 313 | .priv_auto_alloc_size = sizeof(struct atmel_serial_priv), |
| 314 | }; |
| 315 | #endif |
Wenyou Yang | 998cf3c | 2016-10-17 09:49:55 +0800 | [diff] [blame] | 316 | |
| 317 | #ifdef CONFIG_DEBUG_UART_ATMEL |
| 318 | static inline void _debug_uart_init(void) |
| 319 | { |
| 320 | atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE; |
| 321 | |
Wenyou Yang | 5f29e79 | 2017-04-14 15:01:27 +0800 | [diff] [blame] | 322 | _atmel_serial_init(usart, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE); |
Wenyou Yang | 998cf3c | 2016-10-17 09:49:55 +0800 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | static inline void _debug_uart_putc(int ch) |
| 326 | { |
| 327 | atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE; |
| 328 | |
| 329 | while (!(readl(&usart->csr) & USART3_BIT(TXRDY))) |
| 330 | ; |
| 331 | |
| 332 | writel(ch, &usart->thr); |
| 333 | } |
| 334 | |
| 335 | DEBUG_UART_FUNCS |
| 336 | #endif |