serial: stm32: fix wakeup source initialization
[ Upstream commit 5297f274e8b61ceb9676cba6649d3de9d03387ad ] Fixes dedicated_irq_wakeup issue and deactivated uart as wakeup source by default. Fixes: 270e5a74fe4c ("serial: stm32: add wakeup mechanism") Signed-off-by: Erwan Le Ray <erwan.leray@st.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6859cf2284
commit
c837323da4
@ -447,7 +447,6 @@ static int stm32_startup(struct uart_port *port)
|
||||
{
|
||||
struct stm32_port *stm32_port = to_stm32_port(port);
|
||||
struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
|
||||
struct stm32_usart_config *cfg = &stm32_port->info->cfg;
|
||||
const char *name = to_platform_device(port->dev)->name;
|
||||
u32 val;
|
||||
int ret;
|
||||
@ -458,15 +457,6 @@ static int stm32_startup(struct uart_port *port)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (cfg->has_wakeup && stm32_port->wakeirq >= 0) {
|
||||
ret = dev_pm_set_dedicated_wake_irq(port->dev,
|
||||
stm32_port->wakeirq);
|
||||
if (ret) {
|
||||
free_irq(port->irq, port);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
val = USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE;
|
||||
if (stm32_port->fifoen)
|
||||
val |= USART_CR1_FIFOEN;
|
||||
@ -497,7 +487,6 @@ static void stm32_shutdown(struct uart_port *port)
|
||||
|
||||
stm32_clr_bits(port, ofs->cr1, val);
|
||||
|
||||
dev_pm_clear_wake_irq(port->dev);
|
||||
free_irq(port->irq, port);
|
||||
}
|
||||
|
||||
@ -904,11 +893,18 @@ static int stm32_serial_probe(struct platform_device *pdev)
|
||||
ret = device_init_wakeup(&pdev->dev, true);
|
||||
if (ret)
|
||||
goto err_uninit;
|
||||
|
||||
ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
|
||||
stm32port->wakeirq);
|
||||
if (ret)
|
||||
goto err_nowup;
|
||||
|
||||
device_set_wakeup_enable(&pdev->dev, false);
|
||||
}
|
||||
|
||||
ret = uart_add_one_port(&stm32_usart_driver, &stm32port->port);
|
||||
if (ret)
|
||||
goto err_nowup;
|
||||
goto err_wirq;
|
||||
|
||||
ret = stm32_of_dma_rx_probe(stm32port, pdev);
|
||||
if (ret)
|
||||
@ -922,6 +918,10 @@ static int stm32_serial_probe(struct platform_device *pdev)
|
||||
|
||||
return 0;
|
||||
|
||||
err_wirq:
|
||||
if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >= 0)
|
||||
dev_pm_clear_wake_irq(&pdev->dev);
|
||||
|
||||
err_nowup:
|
||||
if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >= 0)
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
@ -959,8 +959,10 @@ static int stm32_serial_remove(struct platform_device *pdev)
|
||||
TX_BUF_L, stm32_port->tx_buf,
|
||||
stm32_port->tx_dma_buf);
|
||||
|
||||
if (cfg->has_wakeup && stm32_port->wakeirq >= 0)
|
||||
if (cfg->has_wakeup && stm32_port->wakeirq >= 0) {
|
||||
dev_pm_clear_wake_irq(&pdev->dev);
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
}
|
||||
|
||||
clk_disable_unprepare(stm32_port->clk);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user