xilinx_uartps.c (c37fe6aff89cb0d842993fe2f69e48bf3ebe0ab0) xilinx_uartps.c (18ee37e1382a7c4840e753bc8e9ba5fd5dc663f5)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Cadence UART driver (found in Xilinx Zynq)
4 *
5 * 2011 - 2014 (C) Xilinx Inc.
6 *
7 * This driver has originally been pushed by Xilinx using a Zynq-branding. This
8 * still shows in the naming of this file, the kconfig symbols and some symbols

--- 483 unchanged lines hidden (view full) ---

492 */
493static int cdns_uart_clk_notifier_cb(struct notifier_block *nb,
494 unsigned long event, void *data)
495{
496 u32 ctrl_reg;
497 struct uart_port *port;
498 int locked = 0;
499 struct clk_notifier_data *ndata = data;
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Cadence UART driver (found in Xilinx Zynq)
4 *
5 * 2011 - 2014 (C) Xilinx Inc.
6 *
7 * This driver has originally been pushed by Xilinx using a Zynq-branding. This
8 * still shows in the naming of this file, the kconfig symbols and some symbols

--- 483 unchanged lines hidden (view full) ---

492 */
493static int cdns_uart_clk_notifier_cb(struct notifier_block *nb,
494 unsigned long event, void *data)
495{
496 u32 ctrl_reg;
497 struct uart_port *port;
498 int locked = 0;
499 struct clk_notifier_data *ndata = data;
500 unsigned long flags = 0;
501 struct cdns_uart *cdns_uart = to_cdns_uart(nb);
500 struct cdns_uart *cdns_uart = to_cdns_uart(nb);
501 unsigned long flags;
502
503 port = cdns_uart->port;
504 if (port->suspended)
505 return NOTIFY_OK;
506
507 switch (event) {
508 case PRE_RATE_CHANGE:
509 {

--- 695 unchanged lines hidden (view full) ---

1205 * @co: Console handle
1206 * @s: Pointer to character array
1207 * @count: No of characters
1208 */
1209static void cdns_uart_console_write(struct console *co, const char *s,
1210 unsigned int count)
1211{
1212 struct uart_port *port = console_port;
502
503 port = cdns_uart->port;
504 if (port->suspended)
505 return NOTIFY_OK;
506
507 switch (event) {
508 case PRE_RATE_CHANGE:
509 {

--- 695 unchanged lines hidden (view full) ---

1205 * @co: Console handle
1206 * @s: Pointer to character array
1207 * @count: No of characters
1208 */
1209static void cdns_uart_console_write(struct console *co, const char *s,
1210 unsigned int count)
1211{
1212 struct uart_port *port = console_port;
1213 unsigned long flags = 0;
1213 unsigned long flags;
1214 unsigned int imr, ctrl;
1215 int locked = 1;
1216
1217 if (port->sysrq)
1218 locked = 0;
1219 else if (oops_in_progress)
1220 locked = spin_trylock_irqsave(&port->lock, flags);
1221 else

--- 81 unchanged lines hidden (view full) ---

1303{
1304 struct uart_port *port = dev_get_drvdata(device);
1305 struct cdns_uart *cdns_uart = port->private_data;
1306 int may_wake;
1307
1308 may_wake = device_may_wakeup(device);
1309
1310 if (console_suspend_enabled && uart_console(port) && may_wake) {
1214 unsigned int imr, ctrl;
1215 int locked = 1;
1216
1217 if (port->sysrq)
1218 locked = 0;
1219 else if (oops_in_progress)
1220 locked = spin_trylock_irqsave(&port->lock, flags);
1221 else

--- 81 unchanged lines hidden (view full) ---

1303{
1304 struct uart_port *port = dev_get_drvdata(device);
1305 struct cdns_uart *cdns_uart = port->private_data;
1306 int may_wake;
1307
1308 may_wake = device_may_wakeup(device);
1309
1310 if (console_suspend_enabled && uart_console(port) && may_wake) {
1311 unsigned long flags = 0;
1311 unsigned long flags;
1312
1313 spin_lock_irqsave(&port->lock, flags);
1314 /* Empty the receive FIFO 1st before making changes */
1315 while (!(readl(port->membase + CDNS_UART_SR) &
1316 CDNS_UART_SR_RXEMPTY))
1317 readl(port->membase + CDNS_UART_FIFO);
1318 /* set RX trigger level to 1 */
1319 writel(1, port->membase + CDNS_UART_RXWM);

--- 14 unchanged lines hidden (view full) ---

1334 * @device: Pointer to the device structure
1335 *
1336 * Return: 0
1337 */
1338static int cdns_uart_resume(struct device *device)
1339{
1340 struct uart_port *port = dev_get_drvdata(device);
1341 struct cdns_uart *cdns_uart = port->private_data;
1312
1313 spin_lock_irqsave(&port->lock, flags);
1314 /* Empty the receive FIFO 1st before making changes */
1315 while (!(readl(port->membase + CDNS_UART_SR) &
1316 CDNS_UART_SR_RXEMPTY))
1317 readl(port->membase + CDNS_UART_FIFO);
1318 /* set RX trigger level to 1 */
1319 writel(1, port->membase + CDNS_UART_RXWM);

--- 14 unchanged lines hidden (view full) ---

1334 * @device: Pointer to the device structure
1335 *
1336 * Return: 0
1337 */
1338static int cdns_uart_resume(struct device *device)
1339{
1340 struct uart_port *port = dev_get_drvdata(device);
1341 struct cdns_uart *cdns_uart = port->private_data;
1342 unsigned long flags = 0;
1342 unsigned long flags;
1343 u32 ctrl_reg;
1344 int may_wake;
1345
1346 may_wake = device_may_wakeup(device);
1347
1348 if (console_suspend_enabled && uart_console(port) && !may_wake) {
1349 clk_enable(cdns_uart->pclk);
1350 clk_enable(cdns_uart->uartclk);

--- 344 unchanged lines hidden ---
1343 u32 ctrl_reg;
1344 int may_wake;
1345
1346 may_wake = device_may_wakeup(device);
1347
1348 if (console_suspend_enabled && uart_console(port) && !may_wake) {
1349 clk_enable(cdns_uart->pclk);
1350 clk_enable(cdns_uart->uartclk);

--- 344 unchanged lines hidden ---