summaryrefslogtreecommitdiff
path: root/drivers/power/reset/at91-poweroff.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-25power: reset: at91: Drop '__init' from at91_wakeup_status()Nathan Chancellor1-1/+1
When building with clang, there are two section mismatch warnings: WARNING: modpost: vmlinux: section mismatch in reference: at91_poweroff_probe+0x7c (section: .text) -> at91_wakeup_status (section: .init.text) WARNING: modpost: vmlinux: section mismatch in reference: at91_shdwc_probe+0xcc (section: .text) -> at91_wakeup_status (section: .init.text) Drop '__init' from at91_wakeup_status() to clear up the mismatch. Fixes: dde74a5de817 ("power: reset: at91-sama5d2_shdwc: Stop using module_platform_driver_probe()") Fixes: 099806de68b7 ("power: reset: at91-poweroff: Stop using module_platform_driver_probe()") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-16power: reset: at91-poweroff: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://lore.kernel.org/r/20231104211501.3676352-21-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-16power: reset: at91-poweroff: Stop using module_platform_driver_probe()Uwe Kleine-König1-4/+5
On today's platforms the benefit of platform_driver_probe() isn't that relevant any more. It allows to drop some code after booting (or module loading) for .probe() and discard the .remove() function completely if the driver is built-in. This typically saves a few 100k. The downside of platform_driver_probe() is that the driver cannot be bound and unbound at runtime which is ancient and so slightly complicates testing. There are also thoughts to deprecate platform_driver_probe() because it adds some complexity in the driver core for little gain. Also many drivers don't use it correctly. This driver for example misses to mark the driver struct with __ref which is needed to suppress a (W=1) modpost warning. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://lore.kernel.org/r/20231104211501.3676352-17-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-07-20power: reset: at91-poweroff: Convert to devm_platform_ioremap_resource()Yangtao Li1-3/+1
Use devm_platform_ioremap_resource() to simplify code. Signed-off-by: Yangtao Li <frank.li@vivo.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-06power: reset: at91-poweroff: move shdwc related data to one structureClaudiu Beznea1-23/+25
Move SHDWC realted data to only one structure to have them grouped. Inspired from commit 9be74f0d39c1 ("power: reset: at91-poweroff: make mpddrc_base part of struct shdwc"). Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-06power: reset: at91-poweroff: remove at91_ramc_of_matchClaudiu.Beznea@microchip.com1-5/+0
Remove at91_ramc_of_match[] since it is not used anywhere in this code. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-06power: reset: at91-poweroff: use one poweroff function for at91-poweroffClaudiu.Beznea@microchip.com1-22/+27
Use only one poweroff function and adapt it to work for both scenarios (with LPDDR or not). The assignement of pm_power_off was moved at the end of probe after all initializations are OK. This patch adapt the idea from commit 4e018c1e9b05 ("power: reset: at91-poweroff: use only one poweroff function"). Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-03-19power: reset: at91-poweroff: Remove redundant dev_err call in ↵Ladislav Michl1-3/+1
at91_poweroff_probe() There is an error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundancy. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-19power: reset: at91-poweroff: Switch from the pr_*() to the dev_*() logging ↵Ladislav Michl1-4/+6
functions Use dev_info() instead of pr_info(). Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08power: reset: at91-poweroff: fix clobber listAlexandre Belloni1-1/+1
Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6. Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-17power: reset: at91-poweroff: timely shutdown LPDDR memoriesAlexandre Belloni1-1/+53
LPDDR memories can only handle up to 400 uncontrolled power off. Ensure the proper power off sequence is used before shutting down the platform. Cc: <stable@vger.kernel.org> # 4.4+ Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19power: reset: at91-poweroff: Fix module autoloadJavier Martinez Canillas1-0/+1
If the driver is built as a module, autoload won't work because the module alias information is not filled. So user-space can't match the registered device with the corresponding module. Export the module alias information using the MODULE_DEVICE_TABLE() macro. Before this patch: $ modinfo drivers/power/reset/at91-poweroff.ko | grep alias $ After this patch: $ modinfo drivers/power/reset/at91-poweroff.ko | grep alias alias: of:N*T*Catmel,at91sam9x5-shdwcC* alias: of:N*T*Catmel,at91sam9x5-shdwc alias: of:N*T*Catmel,at91sam9rl-shdwcC* alias: of:N*T*Catmel,at91sam9rl-shdwc alias: of:N*T*Catmel,at91sam9260-shdwcC* alias: of:N*T*Catmel,at91sam9260-shdwc Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-poweroff: get and use slow clockAlexandre Belloni1-0/+15
Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang") added a workaround for the slow clock as it is not properly handled by its users. Get and use the slow clock as it is necessary for the at91 shutdown controller. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22power/reset: at91-poweroff: allow compiling as a moduleAlexandre Belloni1-3/+15
It was not possible to compile at91-poweroff as a module. Implement .remove() to allow it. Also switch to module_platform_driver_probe() as it is not hotpluggable. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-03-20power: constify of_device_id arrayFabian Frederick1-1/+1
of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> [for vexpress] Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-01-21power/reset: at91-poweroff: Fix error handling and other compiler warningsGuenter Roeck1-3/+4
at91_poweroff_get_wakeup_mode can return a negative error code and should therefore not return an enum type. Similar, its result should not be assigned to an enum type. Otherwise, the returned value is never negative, resulting in a compiler warning and a missed error condition, which in turn results in writing bad values into a chip register. Also fix other compiler warnings which can be easily avoided. drivers/power/reset/at91-poweroff.c:74:24: warning: type qualifiers ignored on function return type drivers/power/reset/at91-poweroff.c:74:24: warning: no previous prototype for 'at91_poweroff_get_wakeup_mode' drivers/power/reset/at91-poweroff.c:83:16: warning: comparison between signed and unsigned integer expressions drivers/power/reset/at91-poweroff.c:97:2: warning: comparison of unsigned expression < 0 is always false Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-01power: reset: at91-poweroff: fix wakeup status register indexNicolas Ferre1-1/+1
The wakeup status is read from Shutdown Status Register and not the SHDW_CR which is the one at address 0. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
2014-07-15power: reset: Add AT91 poweroff driverMaxime Ripard1-0/+156
Add a driver to handle the shutdown of the Atmel SoCs. This code used to be (and still is) in arch/arm/mach-at91. We didn't remove it yet so that we can convert all the boards to using this driver, before removing it entirely in a separate patch. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>