.. | .. |
---|
1887 | 1887 | |
---|
1888 | 1888 | pl011_disable_uart(uap); |
---|
1889 | 1889 | |
---|
| 1890 | + if (IS_ENABLED(CONFIG_RAW_PRINTK)) |
---|
| 1891 | + clk_disable(uap->clk); |
---|
1890 | 1892 | /* |
---|
1891 | 1893 | * Shut down the clock producer |
---|
1892 | 1894 | */ |
---|
.. | .. |
---|
2194 | 2196 | pl011_write(ch, uap, REG_DR); |
---|
2195 | 2197 | } |
---|
2196 | 2198 | |
---|
| 2199 | +#ifdef CONFIG_RAW_PRINTK |
---|
| 2200 | + |
---|
| 2201 | +static void |
---|
| 2202 | +pl011_console_write_raw(struct console *co, const char *s, unsigned int count) |
---|
| 2203 | +{ |
---|
| 2204 | + struct uart_amba_port *uap = amba_ports[co->index]; |
---|
| 2205 | + unsigned int old_cr = 0, new_cr; |
---|
| 2206 | + |
---|
| 2207 | + if (!uap->vendor->always_enabled) { |
---|
| 2208 | + old_cr = pl011_read(uap, REG_CR); |
---|
| 2209 | + new_cr = old_cr & ~UART011_CR_CTSEN; |
---|
| 2210 | + new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE; |
---|
| 2211 | + pl011_write(new_cr, uap, REG_CR); |
---|
| 2212 | + } |
---|
| 2213 | + |
---|
| 2214 | + while (count-- > 0) { |
---|
| 2215 | + if (*s == '\n') |
---|
| 2216 | + pl011_console_putchar(&uap->port, '\r'); |
---|
| 2217 | + pl011_console_putchar(&uap->port, *s++); |
---|
| 2218 | + } |
---|
| 2219 | + |
---|
| 2220 | + while ((pl011_read(uap, REG_FR) ^ uap->vendor->inv_fr) |
---|
| 2221 | + & uap->vendor->fr_busy) |
---|
| 2222 | + cpu_relax(); |
---|
| 2223 | + |
---|
| 2224 | + if (!uap->vendor->always_enabled) |
---|
| 2225 | + pl011_write(old_cr, uap, REG_CR); |
---|
| 2226 | +} |
---|
| 2227 | + |
---|
| 2228 | +#endif /* !CONFIG_RAW_PRINTK */ |
---|
| 2229 | + |
---|
2197 | 2230 | static void |
---|
2198 | 2231 | pl011_console_write(struct console *co, const char *s, unsigned int count) |
---|
2199 | 2232 | { |
---|
.. | .. |
---|
2323 | 2356 | pl011_console_get_options(uap, &baud, &parity, &bits); |
---|
2324 | 2357 | } |
---|
2325 | 2358 | |
---|
| 2359 | + if (IS_ENABLED(CONFIG_RAW_PRINTK)) |
---|
| 2360 | + clk_enable(uap->clk); |
---|
| 2361 | + |
---|
2326 | 2362 | return uart_set_options(&uap->port, co, baud, parity, bits, flow); |
---|
2327 | 2363 | } |
---|
2328 | 2364 | |
---|
.. | .. |
---|
2393 | 2429 | .device = uart_console_device, |
---|
2394 | 2430 | .setup = pl011_console_setup, |
---|
2395 | 2431 | .match = pl011_console_match, |
---|
| 2432 | +#ifdef CONFIG_RAW_PRINTK |
---|
| 2433 | + .write_raw = pl011_console_write_raw, |
---|
| 2434 | +#endif |
---|
2396 | 2435 | .flags = CON_PRINTBUFFER | CON_ANYTIME, |
---|
2397 | 2436 | .index = -1, |
---|
2398 | 2437 | .data = &amba_reg, |
---|