Commit graph

14 commits

Author SHA1 Message Date
Claudiu Beznea caa6e150f8 power: reset: at91-poweroff: move shdwc related data to one structure
Move SHDWC realted data to only one structure to have them grouped.
Inspired from commit 9be74f0d39 ("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-06 21:56:37 +01:00
Claudiu.Beznea@microchip.com e6ae9a05a4 power: reset: at91-poweroff: remove at91_ramc_of_match
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-05 23:29:57 +01:00
Claudiu.Beznea@microchip.com 996463fdb8 power: reset: at91-poweroff: use one poweroff function for at91-poweroff
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 4e018c1e9b ("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-12-05 23:18:30 +01:00
Ladislav Michl ab08824826 power: reset: at91-poweroff: Remove redundant dev_err call in 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-19 20:50:51 +01:00
Ladislav Michl 062836db01 power: reset: at91-poweroff: Switch from the pr_*() to the dev_*() logging 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>
2018-03-19 20:50:24 +01:00
Alexandre Belloni 2e9bbbf694 power: reset: at91-poweroff: fix clobber list
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-06-08 13:05:28 +02:00
Alexandre Belloni 0b0408745e power: reset: at91-poweroff: timely shutdown LPDDR memories
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>
2017-01-16 23:21:33 +01:00
Javier Martinez Canillas c9ba9b7763 power: reset: at91-poweroff: Fix module autoload
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>
2016-10-19 05:16:09 +02:00
Alexandre Belloni 064380a12e power/reset: at91-poweroff: get and use slow clock
Commit dca1a4b5ff ("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-22 15:18:53 +02:00
Alexandre Belloni 6dd1ad1f23 power/reset: at91-poweroff: allow compiling as a module
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-09-22 15:18:53 +02:00
Fabian Frederick 8fb0885504 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 <fabf@skynet.be>

[for vexpress]
Acked-by: Sudeep Holla <sudeep.holla@arm.com>

Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-03-20 13:23:06 +01:00
Guenter Roeck a538cf04ef power/reset: at91-poweroff: Fix error handling and other compiler warnings
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>
2015-01-21 20:06:44 +01:00
Nicolas Ferre 405a72c5e7 power: reset: at91-poweroff: fix wakeup status register index
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-09-01 18:40:44 +02:00
Maxime Ripard ae499f0fad power: reset: Add AT91 poweroff driver
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>
2014-07-15 13:40:34 +02:00