diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-08-09 19:50:30 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-08-27 11:10:01 +0200 |
commit | 2340c646e6a5da658e114be2f721ff90853588d4 (patch) | |
tree | df9744d2344e71e8c5d1b75c3e1528bc474313fe /target/linux/brcm2708/patches-4.19/950-0554-bcm2835-pm-Move-bcm2835-watchdog-s-DT-probe-to-an-MF.patch | |
parent | 81d0da118694feb874f992093063a2852285d194 (diff) | |
download | upstream-2340c646e6a5da658e114be2f721ff90853588d4.tar.gz upstream-2340c646e6a5da658e114be2f721ff90853588d4.tar.bz2 upstream-2340c646e6a5da658e114be2f721ff90853588d4.zip |
brcm2708: update to latest patches from RPi foundation
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0554-bcm2835-pm-Move-bcm2835-watchdog-s-DT-probe-to-an-MF.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.19/950-0554-bcm2835-pm-Move-bcm2835-watchdog-s-DT-probe-to-an-MF.patch | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.19/950-0554-bcm2835-pm-Move-bcm2835-watchdog-s-DT-probe-to-an-MF.patch b/target/linux/brcm2708/patches-4.19/950-0554-bcm2835-pm-Move-bcm2835-watchdog-s-DT-probe-to-an-MF.patch new file mode 100644 index 0000000000..a6dee332db --- /dev/null +++ b/target/linux/brcm2708/patches-4.19/950-0554-bcm2835-pm-Move-bcm2835-watchdog-s-DT-probe-to-an-MF.patch @@ -0,0 +1,200 @@ +From 0718ee0a5ed119e57e69307baced70e1dd2236df Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Wed, 12 Dec 2018 15:51:47 -0800 +Subject: [PATCH 554/773] bcm2835-pm: Move bcm2835-watchdog's DT probe to an + MFD. + +The PM block that the wdt driver was binding to actually has multiple +features we want to expose (power domains, reset, watchdog). Move the +DT attachment to a MFD driver and make WDT probe against MFD. + +Signed-off-by: Eric Anholt <eric@anholt.net> +Reviewed-by: Guenter Roeck <linux@roeck-us.net> +Acked-by: Stefan Wahren <stefan.wahren@i2se.com> +Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> +(cherry picked from commit 5e6acc3e678ed3db746ab4fb53a980861cd711b6) +--- + drivers/mfd/Makefile | 1 + + drivers/mfd/bcm2835-pm.c | 64 ++++++++++++++++++++++++++++++++++ + drivers/watchdog/bcm2835_wdt.c | 26 +++++--------- + include/linux/mfd/bcm2835-pm.h | 13 +++++++ + 4 files changed, 87 insertions(+), 17 deletions(-) + create mode 100644 drivers/mfd/bcm2835-pm.c + create mode 100644 include/linux/mfd/bcm2835-pm.h + +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -10,6 +10,7 @@ obj-$(CONFIG_MFD_88PM805) += 88pm805.o 8 + obj-$(CONFIG_MFD_ACT8945A) += act8945a.o + obj-$(CONFIG_MFD_SM501) += sm501.o + obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o ++obj-$(CONFIG_ARCH_BCM2835) += bcm2835-pm.o + obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o + obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o + cros_ec_core-objs := cros_ec.o +--- /dev/null ++++ b/drivers/mfd/bcm2835-pm.c +@@ -0,0 +1,64 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * PM MFD driver for Broadcom BCM2835 ++ * ++ * This driver binds to the PM block and creates the MFD device for ++ * the WDT driver. ++ */ ++ ++#include <linux/delay.h> ++#include <linux/io.h> ++#include <linux/mfd/bcm2835-pm.h> ++#include <linux/mfd/core.h> ++#include <linux/module.h> ++#include <linux/of_address.h> ++#include <linux/of_platform.h> ++#include <linux/platform_device.h> ++#include <linux/types.h> ++#include <linux/watchdog.h> ++ ++static const struct mfd_cell bcm2835_pm_devs[] = { ++ { .name = "bcm2835-wdt" }, ++}; ++ ++static int bcm2835_pm_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ struct device *dev = &pdev->dev; ++ struct bcm2835_pm *pm; ++ ++ pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL); ++ if (!pm) ++ return -ENOMEM; ++ platform_set_drvdata(pdev, pm); ++ ++ pm->dev = dev; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ pm->base = devm_ioremap_resource(dev, res); ++ if (IS_ERR(pm->base)) ++ return PTR_ERR(pm->base); ++ ++ return devm_mfd_add_devices(dev, -1, ++ bcm2835_pm_devs, ARRAY_SIZE(bcm2835_pm_devs), ++ NULL, 0, NULL); ++} ++ ++static const struct of_device_id bcm2835_pm_of_match[] = { ++ { .compatible = "brcm,bcm2835-pm-wdt", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_pm_of_match); ++ ++static struct platform_driver bcm2835_pm_driver = { ++ .probe = bcm2835_pm_probe, ++ .driver = { ++ .name = "bcm2835-pm", ++ .of_match_table = bcm2835_pm_of_match, ++ }, ++}; ++module_platform_driver(bcm2835_pm_driver); ++ ++MODULE_AUTHOR("Eric Anholt <eric@anholt.net>"); ++MODULE_DESCRIPTION("Driver for Broadcom BCM2835 PM MFD"); ++MODULE_LICENSE("GPL"); +--- a/drivers/watchdog/bcm2835_wdt.c ++++ b/drivers/watchdog/bcm2835_wdt.c +@@ -12,6 +12,7 @@ + + #include <linux/delay.h> + #include <linux/types.h> ++#include <linux/mfd/bcm2835-pm.h> + #include <linux/module.h> + #include <linux/io.h> + #include <linux/watchdog.h> +@@ -41,6 +42,8 @@ struct bcm2835_wdt { + spinlock_t lock; + }; + ++static struct bcm2835_wdt *bcm2835_power_off_wdt; ++ + static unsigned int heartbeat; + static bool nowayout = WATCHDOG_NOWAYOUT; + +@@ -163,10 +166,7 @@ static struct watchdog_device bcm2835_wd + */ + static void bcm2835_power_off(void) + { +- struct device_node *np = +- of_find_compatible_node(NULL, NULL, "brcm,bcm2835-pm-wdt"); +- struct platform_device *pdev = of_find_device_by_node(np); +- struct bcm2835_wdt *wdt = platform_get_drvdata(pdev); ++ struct bcm2835_wdt *wdt = bcm2835_power_off_wdt; + + /* Partition 63 tells the firmware that this is a halt */ + __bcm2835_restart(wdt, 63); +@@ -174,7 +174,7 @@ static void bcm2835_power_off(void) + + static int bcm2835_wdt_probe(struct platform_device *pdev) + { +- struct resource *res; ++ struct bcm2835_pm *pm = dev_get_drvdata(pdev->dev.parent); + struct device *dev = &pdev->dev; + struct bcm2835_wdt *wdt; + int err; +@@ -186,10 +186,7 @@ static int bcm2835_wdt_probe(struct plat + + spin_lock_init(&wdt->lock); + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- wdt->base = devm_ioremap_resource(dev, res); +- if (IS_ERR(wdt->base)) +- return PTR_ERR(wdt->base); ++ wdt->base = pm->base; + + watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt); + watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev); +@@ -216,8 +213,10 @@ static int bcm2835_wdt_probe(struct plat + return err; + } + +- if (pm_power_off == NULL) ++ if (pm_power_off == NULL) { + pm_power_off = bcm2835_power_off; ++ bcm2835_power_off_wdt = wdt; ++ } + + dev_info(dev, "Broadcom BCM2835 watchdog timer"); + return 0; +@@ -231,18 +230,11 @@ static int bcm2835_wdt_remove(struct pla + return 0; + } + +-static const struct of_device_id bcm2835_wdt_of_match[] = { +- { .compatible = "brcm,bcm2835-pm-wdt", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm2835_wdt_of_match); +- + static struct platform_driver bcm2835_wdt_driver = { + .probe = bcm2835_wdt_probe, + .remove = bcm2835_wdt_remove, + .driver = { + .name = "bcm2835-wdt", +- .of_match_table = bcm2835_wdt_of_match, + }, + }; + module_platform_driver(bcm2835_wdt_driver); +--- /dev/null ++++ b/include/linux/mfd/bcm2835-pm.h +@@ -0,0 +1,13 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++ ++#ifndef BCM2835_MFD_PM_H ++#define BCM2835_MFD_PM_H ++ ++#include <linux/regmap.h> ++ ++struct bcm2835_pm { ++ struct device *dev; ++ void __iomem *base; ++}; ++ ++#endif /* BCM2835_MFD_PM_H */ |