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

Commit f44a12dc authored by Olof Johansson's avatar Olof Johansson
Browse files

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

Reset controller changes for v4.13, part 2

- Add reset manager offsets for Stratix10
- Use kref for reset contol reference counting
- Add new TI SCI reset driver for TI Keystone SoCs

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

:
  reset: Add the TI SCI reset driver
  dt-bindings: reset: Add TI SCI reset binding
  reset: use kref for reference counting
  dt-bindings: reset: Add reset manager offsets for Stratix10

Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 8b4a3587 28df169b
Loading
Loading
Loading
Loading
+62 −0
Original line number Original line Diff line number Diff line
Texas Instruments System Control Interface (TI-SCI) Reset Controller
=====================================================================

Some TI SoCs contain a system controller (like the Power Management Micro
Controller (PMMC) on Keystone 66AK2G SoC) that are responsible for controlling
the state of the various hardware modules present on the SoC. Communication
between the host processor running an OS and the system controller happens
through a protocol called TI System Control Interface (TI-SCI protocol).
For TI SCI details, please refer to the document,
Documentation/devicetree/bindings/arm/keystone/ti,sci.txt

TI-SCI Reset Controller Node
============================
This reset controller node uses the TI SCI protocol to perform the reset
management of various hardware modules present on the SoC. Must be a child
node of the associated TI-SCI system controller node.

Required properties:
--------------------
 - compatible	: Should be "ti,sci-reset"
 - #reset-cells	: Should be 2. Please see the reset consumer node below for
		  usage details.

TI-SCI Reset Consumer Nodes
===========================
Each of the reset consumer nodes should have the following properties,
in addition to their own properties.

Required properties:
--------------------
 - resets	: A phandle and reset specifier pair, one pair for each reset
		  signal that affects the device, or that the device manages.
		  The phandle should point to the TI-SCI reset controller node,
		  and the reset specifier should have 2 cell-values. The first
		  cell should contain the device ID. The second cell should
		  contain the reset mask value used by system controller.
		  Please refer to the protocol documentation for these values
		  to be used for different devices,
		  http://processors.wiki.ti.com/index.php/TISCI#66AK2G02_Data

Please also refer to Documentation/devicetree/bindings/reset/reset.txt for
common reset controller usage by consumers.

Example:
--------
The following example demonstrates both a TI-SCI reset controller node and a
consumer (a DSP device) on the 66AK2G SoC.

pmmc: pmmc {
	compatible = "ti,k2g-sci";

	k2g_reset: reset-controller {
		compatible = "ti,sci-reset";
		#reset-cells = <2>;
	};
};

dsp0: dsp@10800000 {
	...
	resets = <&k2g_reset 0x0046 0x1>;
	...
};
+2 −0
Original line number Original line Diff line number Diff line
@@ -12633,6 +12633,8 @@ F: include/linux/soc/ti/ti_sci_protocol.h
F:	Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
F:	Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
F:	include/dt-bindings/genpd/k2g.h
F:	include/dt-bindings/genpd/k2g.h
F:	drivers/soc/ti/ti_sci_pm_domains.c
F:	drivers/soc/ti/ti_sci_pm_domains.c
F:	Documentation/devicetree/bindings/reset/ti,sci-reset.txt
F:	drivers/reset/reset-ti-sci.c


THANKO'S RAREMONO AM/FM/SW RADIO RECEIVER USB DRIVER
THANKO'S RAREMONO AM/FM/SW RADIO RECEIVER USB DRIVER
M:	Hans Verkuil <hverkuil@xs4all.nl>
M:	Hans Verkuil <hverkuil@xs4all.nl>
+8 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,14 @@ config RESET_SUNXI
	help
	help
	  This enables the reset driver for Allwinner SoCs.
	  This enables the reset driver for Allwinner SoCs.


config RESET_TI_SCI
	tristate "TI System Control Interface (TI-SCI) reset driver"
	depends on TI_SCI_PROTOCOL
	help
	  This enables the reset driver support over TI System Control Interface
	  available on some new TI's SoCs. If you wish to use reset resources
	  managed by the TI System Controller, say Y here. Otherwise, say N.

config RESET_TI_SYSCON
config RESET_TI_SYSCON
	tristate "TI SYSCON Reset Driver"
	tristate "TI SYSCON Reset Driver"
	depends on HAS_IOMEM
	depends on HAS_IOMEM
+1 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_RESET_STM32) += reset-stm32.o
obj-$(CONFIG_RESET_STM32) += reset-stm32.o
obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o
obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o
+15 −8
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@
#include <linux/err.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/reset.h>
#include <linux/reset.h>
@@ -40,7 +41,7 @@ struct reset_control {
	struct reset_controller_dev *rcdev;
	struct reset_controller_dev *rcdev;
	struct list_head list;
	struct list_head list;
	unsigned int id;
	unsigned int id;
	unsigned int refcnt;
	struct kref refcnt;
	bool shared;
	bool shared;
	atomic_t deassert_count;
	atomic_t deassert_count;
	atomic_t triggered_count;
	atomic_t triggered_count;
@@ -288,7 +289,7 @@ static struct reset_control *__reset_control_get_internal(
			if (WARN_ON(!rstc->shared || !shared))
			if (WARN_ON(!rstc->shared || !shared))
				return ERR_PTR(-EBUSY);
				return ERR_PTR(-EBUSY);


			rstc->refcnt++;
			kref_get(&rstc->refcnt);
			return rstc;
			return rstc;
		}
		}
	}
	}
@@ -302,18 +303,18 @@ static struct reset_control *__reset_control_get_internal(
	rstc->rcdev = rcdev;
	rstc->rcdev = rcdev;
	list_add(&rstc->list, &rcdev->reset_control_head);
	list_add(&rstc->list, &rcdev->reset_control_head);
	rstc->id = index;
	rstc->id = index;
	rstc->refcnt = 1;
	kref_init(&rstc->refcnt);
	rstc->shared = shared;
	rstc->shared = shared;


	return rstc;
	return rstc;
}
}


static void __reset_control_put_internal(struct reset_control *rstc)
static void __reset_control_release(struct kref *kref)
{
{
	lockdep_assert_held(&reset_list_mutex);
	struct reset_control *rstc = container_of(kref, struct reset_control,
						  refcnt);


	if (--rstc->refcnt)
	lockdep_assert_held(&reset_list_mutex);
		return;


	module_put(rstc->rcdev->owner);
	module_put(rstc->rcdev->owner);


@@ -321,6 +322,13 @@ static void __reset_control_put_internal(struct reset_control *rstc)
	kfree(rstc);
	kfree(rstc);
}
}


static void __reset_control_put_internal(struct reset_control *rstc)
{
	lockdep_assert_held(&reset_list_mutex);

	kref_put(&rstc->refcnt, __reset_control_release);
}

struct reset_control *__of_reset_control_get(struct device_node *node,
struct reset_control *__of_reset_control_get(struct device_node *node,
				     const char *id, int index, bool shared,
				     const char *id, int index, bool shared,
				     bool optional)
				     bool optional)
@@ -400,7 +408,6 @@ EXPORT_SYMBOL_GPL(__reset_control_get);
 * reset_control_put - free the reset controller
 * reset_control_put - free the reset controller
 * @rstc: reset controller
 * @rstc: reset controller
 */
 */

void reset_control_put(struct reset_control *rstc)
void reset_control_put(struct reset_control *rstc)
{
{
	if (IS_ERR_OR_NULL(rstc))
	if (IS_ERR_OR_NULL(rstc))
Loading