From 039ab50bda5606307138b1baa1f18c7e33d357e4 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Mon, 16 Mar 2015 22:27:08 +0100 Subject: power/reset/rmobile-reset.c: Fix !HAS_IOMEM build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: drivers/power/reset/rmobile-reset.c: In function ‘rmobile_reset_probe’: drivers/power/reset/rmobile-reset.c:61:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration] iounmap(sysc_base2); Signed-off-by: Richard Weinberger Acked-by: Geert Uytterhoeven Signed-off-by: Sebastian Reichel --- drivers/power/reset/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/power/reset') diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index 27f6646731b0..6f791fbb1c96 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -154,6 +154,7 @@ config POWER_RESET_SYSCON config POWER_RESET_RMOBILE tristate "Renesas R-Mobile reset driver" depends on ARCH_RMOBILE || COMPILE_TEST + depends on HAS_IOMEM help Reboot support for Renesas R-Mobile and SH-Mobile SoCs. -- cgit v1.2.3 From 8fb0885504cc029bd48877fa89ba91c33c0110b5 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Mon, 16 Mar 2015 20:17:12 +0100 Subject: power: constify of_device_id array of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick [for vexpress] Acked-by: Sudeep Holla Signed-off-by: Sebastian Reichel --- drivers/power/charger-manager.c | 2 +- drivers/power/reset/at91-poweroff.c | 2 +- drivers/power/reset/at91-reset.c | 4 ++-- drivers/power/reset/hisi-reboot.c | 2 +- drivers/power/reset/keystone-reset.c | 2 +- drivers/power/reset/st-poweroff.c | 2 +- drivers/power/reset/syscon-reboot.c | 2 +- drivers/power/reset/vexpress-poweroff.c | 2 +- drivers/power/reset/xgene-reboot.c | 2 +- drivers/power/tps65090-charger.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/power/reset') diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index e23b7ba2cbd2..5933c1a585f4 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c @@ -1484,7 +1484,7 @@ static int cm_init_thermal_data(struct charger_manager *cm, return ret; } -static struct of_device_id charger_manager_match[] = { +static const struct of_device_id charger_manager_match[] = { { .compatible = "charger-manager", }, diff --git a/drivers/power/reset/at91-poweroff.c b/drivers/power/reset/at91-poweroff.c index 4b72ea51c364..9847cfb7e23d 100644 --- a/drivers/power/reset/at91-poweroff.c +++ b/drivers/power/reset/at91-poweroff.c @@ -140,7 +140,7 @@ static int at91_poweroff_probe(struct platform_device *pdev) return 0; } -static struct of_device_id at91_poweroff_of_match[] = { +static const struct of_device_id at91_poweroff_of_match[] = { { .compatible = "atmel,at91sam9260-shdwc", }, { .compatible = "atmel,at91sam9rl-shdwc", }, { .compatible = "atmel,at91sam9x5-shdwc", }, diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 13584e24736a..68b18962f73a 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -152,14 +152,14 @@ static void __init at91_reset_status(struct platform_device *pdev) pr_info("AT91: Starting after %s\n", reason); } -static struct of_device_id at91_ramc_of_match[] = { +static const struct of_device_id at91_ramc_of_match[] = { { .compatible = "atmel,at91sam9260-sdramc", }, { .compatible = "atmel,at91sam9g45-ddramc", }, { .compatible = "atmel,sama5d3-ddramc", }, { /* sentinel */ } }; -static struct of_device_id at91_reset_of_match[] = { +static const struct of_device_id at91_reset_of_match[] = { { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart }, { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, { /* sentinel */ } diff --git a/drivers/power/reset/hisi-reboot.c b/drivers/power/reset/hisi-reboot.c index 5385460e23bb..9ab7f562a83b 100644 --- a/drivers/power/reset/hisi-reboot.c +++ b/drivers/power/reset/hisi-reboot.c @@ -64,7 +64,7 @@ static int hisi_reboot_probe(struct platform_device *pdev) return err; } -static struct of_device_id hisi_reboot_of_match[] = { +static const struct of_device_id hisi_reboot_of_match[] = { { .compatible = "hisilicon,sysctrl" }, {} }; diff --git a/drivers/power/reset/keystone-reset.c b/drivers/power/reset/keystone-reset.c index faedf16c8111..c70f1bffe038 100644 --- a/drivers/power/reset/keystone-reset.c +++ b/drivers/power/reset/keystone-reset.c @@ -70,7 +70,7 @@ static struct notifier_block rsctrl_restart_nb = { .priority = 128, }; -static struct of_device_id rsctrl_of_match[] = { +static const struct of_device_id rsctrl_of_match[] = { {.compatible = "ti,keystone-reset", }, {}, }; diff --git a/drivers/power/reset/st-poweroff.c b/drivers/power/reset/st-poweroff.c index 27383de9caa8..a488877a3538 100644 --- a/drivers/power/reset/st-poweroff.c +++ b/drivers/power/reset/st-poweroff.c @@ -97,7 +97,7 @@ static struct notifier_block st_restart_nb = { .priority = 192, }; -static struct of_device_id st_reset_of_match[] = { +static const struct of_device_id st_reset_of_match[] = { { .compatible = "st,stih415-restart", .data = (void *)&stih415_reset, diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c index c4049f45663f..d3c7d245ae63 100644 --- a/drivers/power/reset/syscon-reboot.c +++ b/drivers/power/reset/syscon-reboot.c @@ -76,7 +76,7 @@ static int syscon_reboot_probe(struct platform_device *pdev) return err; } -static struct of_device_id syscon_reboot_of_match[] = { +static const struct of_device_id syscon_reboot_of_match[] = { { .compatible = "syscon-reboot" }, {} }; diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c index be12d9b92957..6a9bf7089373 100644 --- a/drivers/power/reset/vexpress-poweroff.c +++ b/drivers/power/reset/vexpress-poweroff.c @@ -80,7 +80,7 @@ DEVICE_ATTR(active, S_IRUGO | S_IWUSR, vexpress_reset_active_show, enum vexpress_reset_func { FUNC_RESET, FUNC_SHUTDOWN, FUNC_REBOOT }; -static struct of_device_id vexpress_reset_of_match[] = { +static const struct of_device_id vexpress_reset_of_match[] = { { .compatible = "arm,vexpress-reset", .data = (void *)FUNC_RESET, diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c index b0e5002f8deb..f07e93c97ba3 100644 --- a/drivers/power/reset/xgene-reboot.c +++ b/drivers/power/reset/xgene-reboot.c @@ -87,7 +87,7 @@ static int xgene_reboot_probe(struct platform_device *pdev) return err; } -static struct of_device_id xgene_reboot_of_match[] = { +static const struct of_device_id xgene_reboot_of_match[] = { { .compatible = "apm,xgene-reboot" }, {} }; diff --git a/drivers/power/tps65090-charger.c b/drivers/power/tps65090-charger.c index dcf9a3ca53d5..7e8fbd29c30e 100644 --- a/drivers/power/tps65090-charger.c +++ b/drivers/power/tps65090-charger.c @@ -349,7 +349,7 @@ static int tps65090_charger_remove(struct platform_device *pdev) return 0; } -static struct of_device_id of_tps65090_charger_match[] = { +static const struct of_device_id of_tps65090_charger_match[] = { { .compatible = "ti,tps65090-charger", }, { /* end */ } }; -- cgit v1.2.3 From 7be5ac2c32bd26c47a05367c0135cb6e67b3d452 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Thu, 26 Mar 2015 14:16:22 +0000 Subject: power/reset: at91: big endian fixes for atsama5d3x Fix the passing of big endian data to routines that will be writing it to the bus in the wrong order. Signed-off-by: Ben Dooks Signed-off-by: Sebastian Reichel --- drivers/power/reset/at91-reset.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/power/reset') diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 68b18962f73a..01c7055c4200 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -73,8 +73,8 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode, : "r" (at91_ramc_base[0]), "r" (at91_rstc_base), "r" (1), - "r" (AT91_SDRAMC_LPCB_POWER_DOWN), - "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST)); + "r" cpu_to_le32(AT91_SDRAMC_LPCB_POWER_DOWN), + "r" cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST)); return NOTIFY_DONE; } @@ -116,8 +116,8 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, "r" (at91_ramc_base[1]), "r" (at91_rstc_base), "r" (1), - "r" (AT91_DDRSDRC_LPCB_POWER_DOWN), - "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST) + "r" cpu_to_le32(AT91_DDRSDRC_LPCB_POWER_DOWN), + "r" cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST) : "r0"); return NOTIFY_DONE; -- cgit v1.2.3 From 8a577608ba4a3cab1d74025cea382e40544ab9cd Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Wed, 11 Mar 2015 17:37:18 -0700 Subject: power: reset: Add generic SYSCON register mapped poweroff. Add a generic SYSCON register mapped poweroff mechanism. Signed-off-by: Moritz Fischer Signed-off-by: Sebastian Reichel --- drivers/power/reset/Kconfig | 7 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/syscon-poweroff.c | 102 ++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 drivers/power/reset/syscon-poweroff.c (limited to 'drivers/power/reset') diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index 6f791fbb1c96..aad9c3318c02 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -151,6 +151,13 @@ config POWER_RESET_SYSCON help Reboot support for generic SYSCON mapped register reset. +config POWER_RESET_SYSCON_POWEROFF + bool "Generic SYSCON regmap poweroff driver" + depends on OF + select MFD_SYSCON + help + Poweroff support for generic SYSCON mapped register poweroff. + config POWER_RESET_RMOBILE tristate "Renesas R-Mobile reset driver" depends on ARCH_RMOBILE || COMPILE_TEST diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 11de15bae52e..dbe06c368743 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile @@ -17,4 +17,5 @@ obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o obj-$(CONFIG_POWER_RESET_KEYSTONE) += keystone-reset.o obj-$(CONFIG_POWER_RESET_SYSCON) += syscon-reboot.o +obj-$(CONFIG_POWER_RESET_SYSCON_POWEROFF) += syscon-poweroff.o obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c new file mode 100644 index 000000000000..5560b0dbc180 --- /dev/null +++ b/drivers/power/reset/syscon-poweroff.c @@ -0,0 +1,102 @@ +/* + * Generic Syscon Poweroff Driver + * + * Copyright (c) 2015, National Instruments Corp. + * Author: Moritz Fischer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct regmap *map; +static u32 offset; +static u32 mask; + +void syscon_poweroff(void) +{ + /* Issue the poweroff */ + regmap_write(map, offset, mask); + + mdelay(1000); + + pr_emerg("Unable to poweroff system\n"); +} + +static int syscon_poweroff_probe(struct platform_device *pdev) +{ + char symname[KSYM_NAME_LEN]; + + map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap"); + if (IS_ERR(map)) { + dev_err(&pdev->dev, "unable to get syscon"); + return PTR_ERR(map); + } + + if (of_property_read_u32(pdev->dev.of_node, "offset", &offset)) { + dev_err(&pdev->dev, "unable to read 'offset'"); + return -EINVAL; + } + + if (of_property_read_u32(pdev->dev.of_node, "mask", &mask)) { + dev_err(&pdev->dev, "unable to read 'mask'"); + return -EINVAL; + } + + if (pm_power_off) { + lookup_symbol_name((ulong)pm_power_off, symname); + dev_err(&pdev->dev, + "pm_power_off already claimed %p %s", + pm_power_off, symname); + return -EBUSY; + } + + pm_power_off = syscon_poweroff; + + return 0; +} + +static int syscon_poweroff_remove(struct platform_device *pdev) +{ + if (pm_power_off == syscon_poweroff) + pm_power_off = NULL; + + return 0; +} + +static const struct of_device_id syscon_poweroff_of_match[] = { + { .compatible = "syscon-poweroff" }, + {} +}; + +static struct platform_driver syscon_poweroff_driver = { + .probe = syscon_poweroff_probe, + .remove = syscon_poweroff_remove, + .driver = { + .name = "syscon-poweroff", + .of_match_table = syscon_poweroff_of_match, + }, +}; + +static int __init syscon_poweroff_register(void) +{ + return platform_driver_register(&syscon_poweroff_driver); +} +device_initcall(syscon_poweroff_register); -- cgit v1.2.3