Commit 3d530017 authored by Alexandre Torgue's avatar Alexandre Torgue Committed by Greg Kroah-Hartman

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: default avatarAlexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: default avatarErwan Le Ray <erwan.leray@foss.st.com>
Link: https://lore.kernel.org/r/20210319184253.5841-5-erwan.leray@foss.st.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 986e9f60
...@@ -924,7 +924,7 @@ static void stm32_usart_set_termios(struct uart_port *port, ...@@ -924,7 +924,7 @@ static void stm32_usart_set_termios(struct uart_port *port,
} }
/* Configure wake up from low power on start bit detection */ /* Configure wake up from low power on start bit detection */
if (stm32_port->wakeirq > 0) { if (stm32_port->wakeup_src) {
cr3 &= ~USART_CR3_WUS_MASK; cr3 &= ~USART_CR3_WUS_MASK;
cr3 |= USART_CR3_WUS_START_BIT; cr3 |= USART_CR3_WUS_START_BIT;
} }
...@@ -1044,11 +1044,8 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, ...@@ -1044,11 +1044,8 @@ static int stm32_usart_init_port(struct stm32_port *stm32port,
if (ret) if (ret)
return ret; return ret;
if (stm32port->info->cfg.has_wakeup) { stm32port->wakeup_src = stm32port->info->cfg.has_wakeup &&
stm32port->wakeirq = platform_get_irq_optional(pdev, 1); of_property_read_bool(pdev->dev.of_node, "wakeup-source");
if (stm32port->wakeirq <= 0 && stm32port->wakeirq != -ENXIO)
return stm32port->wakeirq ? : -ENODEV;
}
stm32port->fifoen = stm32port->info->cfg.has_fifo; stm32port->fifoen = stm32port->info->cfg.has_fifo;
...@@ -1283,17 +1280,11 @@ static int stm32_usart_serial_probe(struct platform_device *pdev) ...@@ -1283,17 +1280,11 @@ static int stm32_usart_serial_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
if (stm32port->wakeirq > 0) { if (stm32port->wakeup_src) {
ret = device_init_wakeup(&pdev->dev, true); device_set_wakeup_capable(&pdev->dev, true);
if (ret) ret = dev_pm_set_wake_irq(&pdev->dev, stm32port->port.irq);
goto err_uninit;
ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
stm32port->wakeirq);
if (ret) if (ret)
goto err_nowup; goto err_nowup;
device_set_wakeup_enable(&pdev->dev, false);
} }
ret = stm32_usart_of_dma_rx_probe(stm32port, pdev); ret = stm32_usart_of_dma_rx_probe(stm32port, pdev);
...@@ -1343,14 +1334,13 @@ static int stm32_usart_serial_probe(struct platform_device *pdev) ...@@ -1343,14 +1334,13 @@ static int stm32_usart_serial_probe(struct platform_device *pdev)
TX_BUF_L, stm32port->tx_buf, TX_BUF_L, stm32port->tx_buf,
stm32port->tx_dma_buf); stm32port->tx_dma_buf);
if (stm32port->wakeirq > 0) if (stm32port->wakeup_src)
dev_pm_clear_wake_irq(&pdev->dev); dev_pm_clear_wake_irq(&pdev->dev);
err_nowup: err_nowup:
if (stm32port->wakeirq > 0) if (stm32port->wakeup_src)
device_init_wakeup(&pdev->dev, false); device_set_wakeup_capable(&pdev->dev, false);
err_uninit:
stm32_usart_deinit_port(stm32port); stm32_usart_deinit_port(stm32port);
return ret; return ret;
...@@ -1396,7 +1386,7 @@ static int stm32_usart_serial_remove(struct platform_device *pdev) ...@@ -1396,7 +1386,7 @@ static int stm32_usart_serial_remove(struct platform_device *pdev)
TX_BUF_L, stm32_port->tx_buf, TX_BUF_L, stm32_port->tx_buf,
stm32_port->tx_dma_buf); stm32_port->tx_dma_buf);
if (stm32_port->wakeirq > 0) { if (stm32_port->wakeup_src) {
dev_pm_clear_wake_irq(&pdev->dev); dev_pm_clear_wake_irq(&pdev->dev);
device_init_wakeup(&pdev->dev, false); device_init_wakeup(&pdev->dev, false);
} }
...@@ -1512,7 +1502,7 @@ static void __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port, ...@@ -1512,7 +1502,7 @@ static void __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port,
struct stm32_port *stm32_port = to_stm32_port(port); struct stm32_port *stm32_port = to_stm32_port(port);
const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
if (stm32_port->wakeirq <= 0) if (!stm32_port->wakeup_src)
return; return;
/* /*
......
...@@ -269,7 +269,7 @@ struct stm32_port { ...@@ -269,7 +269,7 @@ struct stm32_port {
bool tx_dma_busy; /* dma tx busy */ bool tx_dma_busy; /* dma tx busy */
bool hw_flow_control; bool hw_flow_control;
bool fifoen; bool fifoen;
int wakeirq; bool wakeup_src;
int rdr_mask; /* receive data register mask */ int rdr_mask; /* receive data register mask */
struct mctrl_gpios *gpios; /* modem control gpios */ struct mctrl_gpios *gpios; /* modem control gpios */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment