Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: stm32: update wakeup IRQ management

The wakeup specific IRQ management is no more needed to wake up the stm32
plaform. A relationship has been established between the EXTI and
the EVENT IRQ, just need to declare the EXTI interrupt instead of the
UART event IRQ.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
Link: https://lore.kernel.org/r/20210319184253.5841-5-erwan.leray@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexandre Torgue and committed by
Greg Kroah-Hartman
3d530017 986e9f60

+12 -22
+11 -21
drivers/tty/serial/stm32-usart.c
··· 924 924 } 925 925 926 926 /* Configure wake up from low power on start bit detection */ 927 - if (stm32_port->wakeirq > 0) { 927 + if (stm32_port->wakeup_src) { 928 928 cr3 &= ~USART_CR3_WUS_MASK; 929 929 cr3 |= USART_CR3_WUS_START_BIT; 930 930 } ··· 1044 1044 if (ret) 1045 1045 return ret; 1046 1046 1047 - if (stm32port->info->cfg.has_wakeup) { 1048 - stm32port->wakeirq = platform_get_irq_optional(pdev, 1); 1049 - if (stm32port->wakeirq <= 0 && stm32port->wakeirq != -ENXIO) 1050 - return stm32port->wakeirq ? : -ENODEV; 1051 - } 1047 + stm32port->wakeup_src = stm32port->info->cfg.has_wakeup && 1048 + of_property_read_bool(pdev->dev.of_node, "wakeup-source"); 1052 1049 1053 1050 stm32port->fifoen = stm32port->info->cfg.has_fifo; 1054 1051 ··· 1280 1283 if (ret) 1281 1284 return ret; 1282 1285 1283 - if (stm32port->wakeirq > 0) { 1284 - ret = device_init_wakeup(&pdev->dev, true); 1285 - if (ret) 1286 - goto err_uninit; 1287 - 1288 - ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, 1289 - stm32port->wakeirq); 1286 + if (stm32port->wakeup_src) { 1287 + device_set_wakeup_capable(&pdev->dev, true); 1288 + ret = dev_pm_set_wake_irq(&pdev->dev, stm32port->port.irq); 1290 1289 if (ret) 1291 1290 goto err_nowup; 1292 - 1293 - device_set_wakeup_enable(&pdev->dev, false); 1294 1291 } 1295 1292 1296 1293 ret = stm32_usart_of_dma_rx_probe(stm32port, pdev); ··· 1334 1343 TX_BUF_L, stm32port->tx_buf, 1335 1344 stm32port->tx_dma_buf); 1336 1345 1337 - if (stm32port->wakeirq > 0) 1346 + if (stm32port->wakeup_src) 1338 1347 dev_pm_clear_wake_irq(&pdev->dev); 1339 1348 1340 1349 err_nowup: 1341 - if (stm32port->wakeirq > 0) 1342 - device_init_wakeup(&pdev->dev, false); 1350 + if (stm32port->wakeup_src) 1351 + device_set_wakeup_capable(&pdev->dev, false); 1343 1352 1344 - err_uninit: 1345 1353 stm32_usart_deinit_port(stm32port); 1346 1354 1347 1355 return ret; ··· 1386 1396 TX_BUF_L, stm32_port->tx_buf, 1387 1397 stm32_port->tx_dma_buf); 1388 1398 1389 - if (stm32_port->wakeirq > 0) { 1399 + if (stm32_port->wakeup_src) { 1390 1400 dev_pm_clear_wake_irq(&pdev->dev); 1391 1401 device_init_wakeup(&pdev->dev, false); 1392 1402 } ··· 1502 1512 struct stm32_port *stm32_port = to_stm32_port(port); 1503 1513 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; 1504 1514 1505 - if (stm32_port->wakeirq <= 0) 1515 + if (!stm32_port->wakeup_src) 1506 1516 return; 1507 1517 1508 1518 /*
+1 -1
drivers/tty/serial/stm32-usart.h
··· 269 269 bool tx_dma_busy; /* dma tx busy */ 270 270 bool hw_flow_control; 271 271 bool fifoen; 272 - int wakeirq; 272 + bool wakeup_src; 273 273 int rdr_mask; /* receive data register mask */ 274 274 struct mctrl_gpios *gpios; /* modem control gpios */ 275 275 };