Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78d375b9 authored by Olof Johansson's avatar Olof Johansson
Browse files

Merge tag 'reset-for-4.10' of git://git.pengutronix.de/git/pza/linux into next/drivers

Reset controller changes for v4.10

- remove obsolete STiH41[56] platform support
- add Oxford Semiconductor OX820 support
- add reset index include files for OX810SE and OX820
- make drivers with boolean Kconfig options explicitly
  non-modular
- allow shared pulsed resets via reset_control_reset, which
  in this case means that the reset must have been triggered
  once, but possibly earlier, after the function returns, and
  is never triggered again for the lifetime of the reset
  control

* tag 'reset-for-4.10' of git://git.pengutronix.de/git/pza/linux

:
  reset: allow using reset_control_reset with shared reset
  reset: lpc18xx: make it explicitly non-modular
  reset: zynq: make it explicitly non-modular
  reset: sunxi: make it explicitly non-modular
  reset: socfpga: make it explicitly non-modular
  reset: berlin: make it explicitly non-modular
  dt-bindings: reset: oxnas: Update for OX820
  dt-bindings: reset: oxnas: Add include file with reset indexes
  reset: oxnas: Add OX820 support
  reset: sti: softreset: Remove obsolete platforms from dt binding doc.
  reset: sti: Remove STiH415/6 reset support

Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 555b2b5d 7da33a37
Loading
Loading
Loading
Loading
+9 −35
Original line number Diff line number Diff line
@@ -5,45 +5,19 @@ Please also refer to reset.txt in this directory for common reset
controller binding usage.

Required properties:
- compatible: Should be "oxsemi,ox810se-reset"
- compatible: For OX810SE, should be "oxsemi,ox810se-reset"
	      For OX820, should be "oxsemi,ox820-reset"
- #reset-cells: 1, see below

Parent node should have the following properties :
- compatible: Should be "oxsemi,ox810se-sys-ctrl", "syscon", "simple-mfd"
- compatible: For OX810SE, should be :
			"oxsemi,ox810se-sys-ctrl", "syscon", "simple-mfd"
	      For OX820, should be :
			"oxsemi,ox820-sys-ctrl", "syscon", "simple-mfd"

For OX810SE, the indices are :
 - 0 : ARM
 - 1 : COPRO
 - 2 : Reserved
 - 3 : Reserved
 - 4 : USBHS
 - 5 : USBHSPHY
 - 6 : MAC
 - 7 : PCI
 - 8 : DMA
 - 9 : DPE
 - 10 : DDR
 - 11 : SATA
 - 12 : SATA_LINK
 - 13 : SATA_PHY
 - 14 : Reserved
 - 15 : NAND
 - 16 : GPIO
 - 17 : UART1
 - 18 : UART2
 - 19 : MISC
 - 20 : I2S
 - 21 : AHB_MON
 - 22 : UART3
 - 23 : UART4
 - 24 : SGDMA
 - 25 : Reserved
 - 26 : Reserved
 - 27 : Reserved
 - 28 : Reserved
 - 29 : Reserved
 - 30 : Reserved
 - 31 : BUS
Reset indices are in dt-bindings include files :
- For OX810SE: include/dt-bindings/reset/oxsemi,ox810se.h
- For OX820: include/dt-bindings/reset/oxsemi,ox820.h

example:

+3 −5
Original line number Diff line number Diff line
@@ -15,15 +15,14 @@ Please refer to reset.txt in this directory for common reset
controller binding usage.

Required properties:
- compatible: Should be "st,<chip>-softreset" example:
	"st,stih415-softreset" or "st,stih416-softreset";
- compatible: Should be st,stih407-softreset";
- #reset-cells: 1, see below

example:

	softreset: softreset-controller {
		#reset-cells = <1>;
		compatible = "st,stih415-softreset";
		compatible = "st,stih407-softreset";
	};


@@ -42,5 +41,4 @@ example:

Macro definitions for the supported reset channels can be found in:

include/dt-bindings/reset/stih415-resets.h
include/dt-bindings/reset/stih416-resets.h
include/dt-bindings/reset/stih407-resets.h
+0 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ if ARCH_STI
config SOC_STIH415
	bool "STiH415 STMicroelectronics Consumer Electronics family"
	default y
	select STIH415_RESET
	help
	  This enables support for STMicroelectronics Digital Consumer
	  Electronics family StiH415 parts, primarily targeted at set-top-box
@@ -38,7 +37,6 @@ config SOC_STIH415
config SOC_STIH416
	bool "STiH416 STMicroelectronics Consumer Electronics family"
	default y
	select STIH416_RESET
	help
	  This enables support for STMicroelectronics Digital Consumer
	  Electronics family StiH416 parts, primarily targeted at set-top-box
+37 −6
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ static LIST_HEAD(reset_controller_list);
 * @refcnt: Number of gets of this reset_control
 * @shared: Is this a shared (1), or an exclusive (0) reset_control?
 * @deassert_cnt: Number of times this reset line has been deasserted
 * @triggered_count: Number of times this reset line has been reset. Currently
 *                   only used for shared resets, which means that the value
 *                   will be either 0 or 1.
 */
struct reset_control {
	struct reset_controller_dev *rcdev;
@@ -40,6 +43,7 @@ struct reset_control {
	unsigned int refcnt;
	int shared;
	atomic_t deassert_count;
	atomic_t triggered_count;
};

/**
@@ -134,18 +138,35 @@ EXPORT_SYMBOL_GPL(devm_reset_controller_register);
 * reset_control_reset - reset the controlled device
 * @rstc: reset controller
 *
 * Calling this on a shared reset controller is an error.
 * On a shared reset line the actual reset pulse is only triggered once for the
 * lifetime of the reset_control instance: for all but the first caller this is
 * a no-op.
 * Consumers must not use reset_control_(de)assert on shared reset lines when
 * reset_control_reset has been used.
 */
int reset_control_reset(struct reset_control *rstc)
{
	if (WARN_ON(IS_ERR_OR_NULL(rstc)) ||
	    WARN_ON(rstc->shared))
		return -EINVAL;
	int ret;

	if (rstc->rcdev->ops->reset)
		return rstc->rcdev->ops->reset(rstc->rcdev, rstc->id);
	if (WARN_ON(IS_ERR_OR_NULL(rstc)))
		return -EINVAL;

	if (!rstc->rcdev->ops->reset)
		return -ENOTSUPP;

	if (rstc->shared) {
		if (WARN_ON(atomic_read(&rstc->deassert_count) != 0))
			return -EINVAL;

		if (atomic_inc_return(&rstc->triggered_count) != 1)
			return 0;
	}

	ret = rstc->rcdev->ops->reset(rstc->rcdev, rstc->id);
	if (rstc->shared && !ret)
		atomic_dec(&rstc->triggered_count);

	return ret;
}
EXPORT_SYMBOL_GPL(reset_control_reset);

@@ -159,6 +180,8 @@ EXPORT_SYMBOL_GPL(reset_control_reset);
 *
 * For shared reset controls a driver cannot expect the hw's registers and
 * internal state to be reset, but must be prepared for this to happen.
 * Consumers must not use reset_control_reset on shared reset lines when
 * reset_control_(de)assert has been used.
 */
int reset_control_assert(struct reset_control *rstc)
{
@@ -169,6 +192,9 @@ int reset_control_assert(struct reset_control *rstc)
		return -ENOTSUPP;

	if (rstc->shared) {
		if (WARN_ON(atomic_read(&rstc->triggered_count) != 0))
			return -EINVAL;

		if (WARN_ON(atomic_read(&rstc->deassert_count) == 0))
			return -EINVAL;

@@ -185,6 +211,8 @@ EXPORT_SYMBOL_GPL(reset_control_assert);
 * @rstc: reset controller
 *
 * After calling this function, the reset is guaranteed to be deasserted.
 * Consumers must not use reset_control_reset on shared reset lines when
 * reset_control_(de)assert has been used.
 */
int reset_control_deassert(struct reset_control *rstc)
{
@@ -195,6 +223,9 @@ int reset_control_deassert(struct reset_control *rstc)
		return -ENOTSUPP;

	if (rstc->shared) {
		if (WARN_ON(atomic_read(&rstc->triggered_count) != 0))
			return -EINVAL;

		if (atomic_inc_return(&rstc->deassert_count) != 1)
			return 0;
	}
+4 −8
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 Marvell Technology Group Ltd.
 *
 * Marvell Berlin reset driver
 *
 * Antoine Tenart <antoine.tenart@free-electrons.com>
 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
 *
@@ -12,7 +14,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
@@ -91,7 +93,6 @@ static const struct of_device_id berlin_reset_dt_match[] = {
	{ .compatible = "marvell,berlin2-reset" },
	{ },
};
MODULE_DEVICE_TABLE(of, berlin_reset_dt_match);

static struct platform_driver berlin_reset_driver = {
	.probe	= berlin2_reset_probe,
@@ -100,9 +101,4 @@ static struct platform_driver berlin_reset_driver = {
		.of_match_table = berlin_reset_dt_match,
	},
};
module_platform_driver(berlin_reset_driver);

MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>");
MODULE_DESCRIPTION("Marvell Berlin reset driver");
MODULE_LICENSE("GPL");
builtin_platform_driver(berlin_reset_driver);
Loading