Commit 69269446 authored by Fabien Dessenne's avatar Fabien Dessenne Committed by Jassi Brar

mailbox: stm32-ipcc: Update wakeup management

The wakeup specific IRQ management is no more needed to wake up the
stm32 platform. A relationship has been established between the EXTI and
the RX IRQ, just need to declare the EXTI interrupt instead of the
IPCC RX IRQ.
Signed-off-by: default avatarAlexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
parent 41c94799
...@@ -52,7 +52,6 @@ struct stm32_ipcc { ...@@ -52,7 +52,6 @@ struct stm32_ipcc {
struct clk *clk; struct clk *clk;
spinlock_t lock; /* protect access to IPCC registers */ spinlock_t lock; /* protect access to IPCC registers */
int irqs[IPCC_IRQ_NUM]; int irqs[IPCC_IRQ_NUM];
int wkp;
u32 proc_id; u32 proc_id;
u32 n_chans; u32 n_chans;
u32 xcr; u32 xcr;
...@@ -282,16 +281,9 @@ static int stm32_ipcc_probe(struct platform_device *pdev) ...@@ -282,16 +281,9 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
/* wakeup */ /* wakeup */
if (of_property_read_bool(np, "wakeup-source")) { if (of_property_read_bool(np, "wakeup-source")) {
ipcc->wkp = platform_get_irq_byname(pdev, "wakeup");
if (ipcc->wkp < 0) {
if (ipcc->wkp != -EPROBE_DEFER)
dev_err(dev, "could not get wakeup IRQ\n");
ret = ipcc->wkp;
goto err_clk;
}
device_set_wakeup_capable(dev, true); device_set_wakeup_capable(dev, true);
ret = dev_pm_set_dedicated_wake_irq(dev, ipcc->wkp);
ret = dev_pm_set_wake_irq(dev, ipcc->irqs[IPCC_IRQ_RX]);
if (ret) { if (ret) {
dev_err(dev, "Failed to set wake up irq\n"); dev_err(dev, "Failed to set wake up irq\n");
goto err_init_wkp; goto err_init_wkp;
...@@ -334,10 +326,10 @@ static int stm32_ipcc_probe(struct platform_device *pdev) ...@@ -334,10 +326,10 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
return 0; return 0;
err_irq_wkp: err_irq_wkp:
if (ipcc->wkp) if (of_property_read_bool(np, "wakeup-source"))
dev_pm_clear_wake_irq(dev); dev_pm_clear_wake_irq(dev);
err_init_wkp: err_init_wkp:
device_init_wakeup(dev, false); device_set_wakeup_capable(dev, false);
err_clk: err_clk:
clk_disable_unprepare(ipcc->clk); clk_disable_unprepare(ipcc->clk);
return ret; return ret;
...@@ -345,27 +337,17 @@ static int stm32_ipcc_probe(struct platform_device *pdev) ...@@ -345,27 +337,17 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
static int stm32_ipcc_remove(struct platform_device *pdev) static int stm32_ipcc_remove(struct platform_device *pdev)
{ {
struct stm32_ipcc *ipcc = platform_get_drvdata(pdev); struct device *dev = &pdev->dev;
if (ipcc->wkp) if (of_property_read_bool(dev->of_node, "wakeup-source"))
dev_pm_clear_wake_irq(&pdev->dev); dev_pm_clear_wake_irq(&pdev->dev);
device_init_wakeup(&pdev->dev, false); device_set_wakeup_capable(dev, false);
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static void stm32_ipcc_set_irq_wake(struct device *dev, bool enable)
{
struct stm32_ipcc *ipcc = dev_get_drvdata(dev);
unsigned int i;
if (device_may_wakeup(dev))
for (i = 0; i < IPCC_IRQ_NUM; i++)
irq_set_irq_wake(ipcc->irqs[i], enable);
}
static int stm32_ipcc_suspend(struct device *dev) static int stm32_ipcc_suspend(struct device *dev)
{ {
struct stm32_ipcc *ipcc = dev_get_drvdata(dev); struct stm32_ipcc *ipcc = dev_get_drvdata(dev);
...@@ -373,8 +355,6 @@ static int stm32_ipcc_suspend(struct device *dev) ...@@ -373,8 +355,6 @@ static int stm32_ipcc_suspend(struct device *dev)
ipcc->xmr = readl_relaxed(ipcc->reg_proc + IPCC_XMR); ipcc->xmr = readl_relaxed(ipcc->reg_proc + IPCC_XMR);
ipcc->xcr = readl_relaxed(ipcc->reg_proc + IPCC_XCR); ipcc->xcr = readl_relaxed(ipcc->reg_proc + IPCC_XCR);
stm32_ipcc_set_irq_wake(dev, true);
return 0; return 0;
} }
...@@ -382,8 +362,6 @@ static int stm32_ipcc_resume(struct device *dev) ...@@ -382,8 +362,6 @@ static int stm32_ipcc_resume(struct device *dev)
{ {
struct stm32_ipcc *ipcc = dev_get_drvdata(dev); struct stm32_ipcc *ipcc = dev_get_drvdata(dev);
stm32_ipcc_set_irq_wake(dev, false);
writel_relaxed(ipcc->xmr, ipcc->reg_proc + IPCC_XMR); writel_relaxed(ipcc->xmr, ipcc->reg_proc + IPCC_XMR);
writel_relaxed(ipcc->xcr, ipcc->reg_proc + IPCC_XCR); writel_relaxed(ipcc->xcr, ipcc->reg_proc + IPCC_XCR);
......
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