diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts index c8908f6b3143b..c6ff03ba495a8 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts @@ -426,6 +426,7 @@ dpi_16bit_gpio2: &rp1_dpi_16bit_gpio2 { }; vmmc-supply = <&wl_on_reg>; sd-uhs-ddr50; non-removable; + cap-power-off-card; status = "okay"; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi index dfad85a666a8a..76ecc3d2e3582 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi @@ -411,6 +411,7 @@ dpi_16bit_gpio2: &rp1_dpi_16bit_gpio2 { }; vmmc-supply = <&wl_on_reg>; sd-uhs-ddr50; non-removable; + cap-power-off-card; status = "okay"; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm64/configs/bcm2712_defconfig b/arch/arm64/configs/bcm2712_defconfig index dd54cc94a63a5..69e7bf73d621c 100644 --- a/arch/arm64/configs/bcm2712_defconfig +++ b/arch/arm64/configs/bcm2712_defconfig @@ -59,7 +59,7 @@ CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y CONFIG_RANDOMIZE_BASE=y CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -# CONFIG_SUSPEND is not set +CONFIG_SUSPEND=y CONFIG_PM=y CONFIG_PM_DEBUG=y CONFIG_CPU_IDLE=y diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c index 8c54980b4b7e1..f458d477bc8aa 100644 --- a/drivers/mailbox/bcm2835-mailbox.c +++ b/drivers/mailbox/bcm2835-mailbox.c @@ -183,6 +183,25 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) return ret; } +static int bcm2835_mbox_resume_noirq(struct device *dev) +{ + struct bcm2835_mbox *mbox = dev_get_drvdata(dev); + + /* + * MAIL0_CNF is reset while the SoC is powered down in suspend-to-RAM. + * Re-enable the receive interrupt before any driver resumes, otherwise + * the replies are never signalled and every firmware transaction times + * out. + */ + writel(ARM_MC_IHAVEDATAIRQEN, mbox->regs + MAIL0_CNF); + + return 0; +} + +static const struct dev_pm_ops bcm2835_mbox_pm_ops = { + NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, bcm2835_mbox_resume_noirq) +}; + static const struct of_device_id bcm2835_mbox_of_match[] = { { .compatible = "brcm,bcm2835-mbox", }, {}, @@ -193,6 +212,7 @@ static struct platform_driver bcm2835_mbox_driver = { .driver = { .name = "bcm2835-mbox", .of_match_table = bcm2835_mbox_of_match, + .pm = pm_sleep_ptr(&bcm2835_mbox_pm_ops), }, .probe = bcm2835_mbox_probe, }; diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c index ed4ae9fdf9d22..2e7a7ce6297e5 100644 --- a/drivers/watchdog/bcm2835_wdt.c +++ b/drivers/watchdog/bcm2835_wdt.c @@ -232,11 +232,31 @@ static void bcm2835_wdt_remove(struct platform_device *pdev) pm_power_off = NULL; } +static int bcm2835_wdt_suspend(struct device *dev) +{ + if (watchdog_active(&bcm2835_wdt_wdd) || watchdog_hw_running(&bcm2835_wdt_wdd)) + bcm2835_wdt_stop(&bcm2835_wdt_wdd); + + return 0; +} + +static int bcm2835_wdt_resume(struct device *dev) +{ + if (watchdog_active(&bcm2835_wdt_wdd) || watchdog_hw_running(&bcm2835_wdt_wdd)) + bcm2835_wdt_start(&bcm2835_wdt_wdd); + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(bcm2835_wdt_pm_ops, + bcm2835_wdt_suspend, bcm2835_wdt_resume); + static struct platform_driver bcm2835_wdt_driver = { .probe = bcm2835_wdt_probe, .remove = bcm2835_wdt_remove, .driver = { .name = "bcm2835-wdt", + .pm = pm_sleep_ptr(&bcm2835_wdt_pm_ops), }, }; module_platform_driver(bcm2835_wdt_driver); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 5ff5d99f6ead5..d038dc2996e0e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1182,7 +1183,7 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) } static inline bool acpi_storage_d3(struct device *dev) { - return false; + return of_machine_is_compatible("brcm,bcm2712"); } static inline bool acpi_dev_state_d0(struct device *dev) {