Commit graph

8 commits

Author SHA1 Message Date
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