Commit Graph

82 Commits

Author SHA1 Message Date
Andrew F. Davis cc7c2bb149 reset: add TI SYSCON based reset driver
Add a reset-controller driver for performing reset management of
various devices present on the SoC, with the reset registers shared
between devices in a common register memory space. This driver uses
the syscon/regmap frameworks to actually implement the various reset
functionalities needed by the reset consumer devices.

Signed-off-by: Andrew F. Davis <afd@ti.com>
[s-anna@ti.com: add documentation, syscon name change]
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-06-29 23:39:10 +02:00
Xinliang Liu ab52b599c1 reset: hisilicon: Add hi6220 media subsystem reset support
Add hi6220 media subsystem reset controller.

Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Xia Qing <saberlily.xia@hisilicon.com>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-06-29 23:39:09 +02:00
Chen Feng 8768a26cea reset: hisilicon: Change to syscon register access
There are two reset controllers in hi6220 SoC:
The peripheral reset controller bits are part of sysctrl registers.
The media reset controller bits are part of mediactrl registers.

So change register access to syscon way.
And rename current reset controller to peripheral one.

Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Xia Qing <saberlily.xia@hisilicon.com>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-06-29 23:39:09 +02:00
Neil Armstrong c7224dc343 reset: Add support for the Amlogic Meson SoC Reset Controller
This patch adds the platform driver for the Amlogic Meson SoC Reset
Controller.

The Meson8b and GXBB SoCs are supported.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-06-01 08:21:10 +02:00
Neil Armstrong 42fa905bd9 reset: oxnas: Use devm register API and get rid of platform remove
Use the brand new devm_reset_controller_register() API to get rid of
the platform driver remove callback.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada 998cd4637f reset: fix Kconfig menu to include reset drivers in sub-menu
In "make menuconfig", reset drivers are currently lined up together
with the reset sub-system menu, like this:

    -*- Reset Controller Support  ----
    < > Hi6220 Reset Driver

(It also means, the menu "Reset Controller Support" is always empty.)

"Hi6220 Reset Driver" should go into the sub-menu of the
"Reset Controller Support".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada da1fda2a23 reset: zynq: use devm_reset_controller_register()
Use devm_reset_controller_register() for the reset controller
registration and drop the .remove callback.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada dc22e08ef7 reset: socfpga: use devm_reset_controller_register()
Use devm_reset_controller_register() for the reset controller
registration and drop the .remove callback.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada 2f38a88c7c reset: sunxi: use devm_reset_controller_register()
Use devm_reset_controller_register() for the reset controller
registration and drop the .remove callback.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada 1b1447f493 reset: pistachio: use devm_reset_controller_register()
Use devm_reset_controller_register() for the reset controller
registration and drop the .remove callback.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada 56865f452a reset: ath79: use devm_reset_controller_register()
Use devm_reset_controller_register() for the reset controller
registration and remove the unregister call from the .remove callback.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Masahiro Yamada 8d5b5d5ce5 reset: add devm_reset_controller_register API
Add a device managed API for reset_controller_register().

This helps in reducing code in .remove callbacks and sometimes
dropping .remove callbacks entirely.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-05-30 09:37:47 +02:00
Neil Armstrong 6e667fac82 reset: Add Oxford Semiconductor Reset Controller driver
Add System reset controller driver for Oxford Semiconductor OXNAS SoC
Family.

CC: Ma Haijun <mahaijuns@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-04-01 16:31:09 +02:00
Joachim Eastwood 773fe72630 reset: lpc18xx: get rid of global variables for restart notifier
Moving the notifier_block into the drivers priv struct allows us
to retrive the priv struct with container_of and remove the
global variables.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-03-30 15:42:07 +02:00
Hans de Goede 0b52297f22 reset: Add support for shared reset controls
In some SoCs some hw-blocks share a reset control. Add support for this
setup by adding new:

reset_control_get_shared()
devm_reset_control_get_shared()
devm_reset_control_get_shared_by_index()

methods to get a reset_control. Note that this patch omits adding of_
variants, if these are needed later they can be easily added.

This patch also changes the behavior of the existing exclusive
reset_control_get() variants, if these are now called more then once
for the same reset_control they will return -EBUSY. To catch existing
drivers triggering this error (there should not be any) a WARN_ON(1)
is added in this path.

When a reset_control is shared, the behavior of reset_control_assert /
deassert is changed, for shared reset_controls these will work like the
clock-enable/disable and regulator-on/off functions. They will keep a
deassert_count, and only (re-)assert the reset after reset_control_assert
has been called as many times as reset_control_deassert was called.

Calling reset_control_assert without first calling reset_control_deassert
is not allowed on a shared reset control. Calling reset_control_reset is
also not allowed on a shared reset control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-03-30 15:42:05 +02:00
Hans de Goede c15ddec2ca reset: Share struct reset_control between reset_control_get calls
Now that struct reset_control no longer stores the device pointer for
the device calling reset_control_get we can share a single struct
reset_control when multiple calls to reset_control_get are made for
the same reset line (same id / index).

This is a preparation patch for adding support for shared reset lines.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-03-30 15:42:03 +02:00
Hans de Goede 6c96f05c8b reset: Make [of_]reset_control_get[_foo] functions wrappers
With both the regular, _by_index and _optional variants we already have
quite a few variants of [of_]reset_control_get[_foo], the upcoming
addition of shared reset lines support makes this worse.

This commit changes all the variants into wrappers around common core
functions. For completeness sake this commit also adds a new
devm_get_reset_control_by_index wrapper.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-03-30 15:42:01 +02:00
Philipp Zabel f673ed4d5f reset: sti: Make reset_control_ops const
The syscfg_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-02-10 10:53:38 +01:00
Philipp Zabel 356d108f87 reset: zynq: Make reset_control_ops const
The zynq_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-02-10 10:53:37 +01:00
Philipp Zabel 387eb3f3d5 reset: socfpga: Make reset_control_ops const
The socfpga_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-02-10 10:53:36 +01:00
Philipp Zabel 0e18e60e1b reset: hi6220: Make reset_control_ops const
The hi6220_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-02-10 10:53:35 +01:00
Philipp Zabel d2f79f223f reset: ath79: Make reset_control_ops const
The ath79_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Alban Bedel <albeu@free.fr>
2016-02-10 10:53:34 +01:00
Philipp Zabel 1a55cad19f reset: lpc18xx: Make reset_control_ops const
The lpc18xx_rgu_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Joachim Eastwood <manabian@gmail.com>
2016-02-08 17:19:57 +01:00
Philipp Zabel 01501d5730 reset: sunxi: Make reset_control_ops const
The sunxi_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-02-08 17:03:48 +01:00
Philipp Zabel c0cc2609bc reset: img: Make reset_control_ops const
The pistachio_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: James Hartley <james.hartley@imgtec.com>
2016-02-08 17:03:40 +01:00
Philipp Zabel b7a9007565 reset: berlin: Make reset_control_ops const
The berlin_reset_ops structure is never modified. Make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
2016-02-08 16:11:25 +01:00
Philipp Zabel 27ca5aaa36 reset: berlin: drop DT cell size check
Now that the DT cell size check has been moved to the core,
there is no need to check again.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-02-05 16:42:31 +01:00
Damien Horsley 8a56736a2f reset: img: Add Pistachio reset controller driver
Add reset controller driver for Pistachio SoC

Signed-off-by: Damien Horsley <Damien.Horsley@imgtec.com>
Signed-off-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-02-05 16:41:20 +01:00
Masahiro Yamada c41ef91f65 reset: hisilicon: check return value of reset_controller_register()
The newly added hisilicon reset driver missed the subsystem-wide
fixup by commit d1f15aa095 ("reset: check return value of
reset_controller_register()").  So fix it now.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-01-25 11:00:33 +01:00
Maxime Ripard e677774f50 reset: Move DT cell size check to the core
The core currently doesn't check that the DT cell size matches what the
driver declares, which means that every xlate function needs to duplicate
that check.

Make sure that of_reset_control_get checks for this to avoid duplication
and errors.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-01-25 10:58:44 +01:00
Philipp Zabel d056c9b819 reset: remove unnecessary local variable initialization from of_reset_control_get_by_index
There is no need to initialize rstc, as it is unconditionally
assigned the return value of a kzalloc call before use.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-01-25 10:58:44 +01:00
Arnd Bergmann 70b3590f63 reset: hi6220: fix modular build
We need to include <linux/module.h> to build the driver as a loadable
module:

drivers/reset/hisilicon/hi6220_reset.c:108:1: warning: data definition has no type or storage class
 postcore_initcall(hi6220_reset_init);

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2015-12-12 08:53:21 +01:00
Alban Bedel ba64e27e9d reset: ath79: Add system restart support
Add a system restart handler that use the FULL_CHIP_RESET bit of the
reset controller.

Signed-off-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-25 10:49:58 +01:00
Chen Feng f59d23c2c0 reset: hi6220: Reset driver for hisilicon hi6220 SoC
Add reset driver for hi6220-hikey board,this driver supply deassert
of IP on hi6220 SoC.

Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-20 15:41:45 +01:00
Philipp Zabel b354f68ff0 reset: remove unused device pointer from struct reset_control
Commit 0c5b2b915a ("reset: Mark function as static and remove unused
function in core.c") removed the only user of the device pointer in
struct reset_control. As it is now unused, remove it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-18 15:13:20 +01:00
Masahiro Yamada d1f15aa095 reset: check return value of reset_controller_register()
Currently, reset_controller_register() always return 0, but it would
be better to check its return code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Masahiro Yamada 5b321a631a reset: remove redundant $(CONFIG_RESET_CONTROLLER) from Makefile
The directory drivers/reset/ is guarded by CONFIG_RESET_CONTROLLER
in driver/Makefile.

CONFIG_RESET_CONTROLLER is boolean, so it always evaluates to 'y'
in drivers/reset/Makefile.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Philipp Zabel 39b4da71ca reset: use ENOTSUPP instead of ENOSYS
ENOSYS is reserved to report invalid syscalls to userspace.
Consistently return ENOTSUPP to indicate that the driver doesn't support
the functionality or the reset framework is not enabled at all.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Philipp Zabel fddad17ed1 reset: sunxi: mark the of_device_id array as __initconst
Since this array is static const, it should be marked as __initconst.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2015-11-16 09:23:47 +01:00
Philipp Zabel 0437838484 reset: sti: add a missing blank line after declaration
This just fixes a checkpatch warning, no functional change.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
2015-11-16 09:23:47 +01:00
Lee Jones 9a4cc897fd reset: sti: Provide ops .status() call-back
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Lee Jones 1a539387b7 reset: sti: Add support for resetting co-processors
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Alban Bedel 3d81216fde reset: Fix of_reset_control_get() for consistent return values
When of_reset_control_get() is called without connection ID it returns
-ENOENT when the 'resets' property doesn't exists or is an empty entry.
However when a connection ID is given it returns -EINVAL when the 'resets'
property doesn't exists or the requested name can't be found. This is
because the error code returned by of_property_match_string() is just
passed down as an index to of_parse_phandle_with_args(), which then
returns -EINVAL.

To get a consistent return value with both code paths we must return
-ENOENT when of_property_match_string() fails.

Signed-off-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Vince Hsu c0a13aa6da reset: add of_reset_control_get_by_index()
Add of_reset_control_get_by_index() to allow the drivers to get reset
device without knowing its name.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
[jonathanh@nvidia.com: Updated stub function to return -ENOTSUPP instead
 of -ENOSYS which should only be used for system calls.]
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-11-16 09:23:47 +01:00
Axel Lin f319cb8491 reset: ath79: Fix missing spin_lock_init
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-09-01 14:48:40 +02:00
Philipp Zabel 5d44595c26 Merge branch 'reset/ath79' into reset/next 2015-08-16 17:11:20 +02:00
Moritz Fischer fedf42b50d reset: reset-zynq: Adding support for Xilinx Zynq reset controller.
This adds a reset controller driver to control the Xilinx Zynq
AP-SoC's various resets.

Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-08-04 17:07:46 +02:00
Alban Bedel ff591a9122 reset: Add a driver for the reset controller on the AR71XX/AR9XXX
The AR71XX/AR9XXX SoC have a simple reset controller with one bit per
reset line.

Signed-off-by: Alban Bedel <albeu@free.fr>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-08-04 10:41:30 +02:00
Dinh Nguyen 27e44646dc reset: socfpga: Update reset-socfpga to read the altr,modrst-offset property
In order for the Arria10 to be able to re-use the reset driver for SoCFPGA
Cyclone5/Arria5, we need to read the 'altr,modrst-offset' property from the
device tree entry. The 'altr,modrst-offset' property is the first register
into the reset manager that is used for bringing peripherals out of reset.

The driver assumes a modrst-offset of 0x10 in order to support legacy
Cyclone5/Arria5 hardware.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
2015-08-03 13:13:59 +02:00
Joachim Eastwood c392b65ba8 reset: add driver for lpc18xx rgu
Add reset driver for the Reset Generation Unit (RGU) found on NXP
LPC18xx and LPC43xx devies. This reset controller features up to 64
reset lines connected to different blocks and peripheral in the SoC.
Most reset lines on the controller are self clearing except for
those dealing with the Cortex-M0 cores on LPC43xx devices.

This driver also registers a restart handler that can be used to
reset the entire device.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-08-03 13:13:51 +02:00