Commit 3f2242ec authored by Olof Johansson's avatar Olof Johansson
Browse files

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

Reset controller changes for v4.6

- add support for the imgtec Pistachio SoC reset controller
- make struct reset_control_ops const
- move DT cell size check into the core to avoid code duplication
  in the drivers

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

:
  reset: sti: Make reset_control_ops const
  reset: zynq: Make reset_control_ops const
  reset: socfpga: Make reset_control_ops const
  reset: hi6220: Make reset_control_ops const
  reset: ath79: Make reset_control_ops const
  reset: lpc18xx: Make reset_control_ops const
  reset: sunxi: Make reset_control_ops const
  reset: img: Make reset_control_ops const
  reset: berlin: Make reset_control_ops const
  reset: berlin: drop DT cell size check
  reset: img: Add Pistachio reset controller driver
  reset: img: Add pistachio reset controller binding document
  reset: hisilicon: check return value of reset_controller_register()
  reset: Move DT cell size check to the core
  reset: Make reset_control_ops const
  reset: remove unnecessary local variable initialization from of_reset_control_get_by_index

Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents f628c64f f673ed4d
Loading
Loading
Loading
Loading
+55 −0
Original line number Original line Diff line number Diff line
Pistachio Reset Controller
=============================================================================

This binding describes a reset controller device that is used to enable and
disable individual IP blocks within the Pistachio SoC using "soft reset"
control bits found in the Pistachio SoC top level registers.

The actual action taken when soft reset is asserted is hardware dependent.
However, when asserted it may not be possible to access the hardware's
registers, and following an assert/deassert sequence the hardware's previous
state may no longer be valid.

Please refer to Documentation/devicetree/bindings/reset/reset.txt
for common reset controller binding usage.

Required properties:

- compatible: Contains "img,pistachio-reset"

- #reset-cells: Contains 1

Example:

	cr_periph: clk@18148000 {
		compatible = "img,pistachio-cr-periph", "syscon", "simple-mfd";
		reg = <0x18148000 0x1000>;
		clocks = <&clk_periph PERIPH_CLK_SYS>;
		clock-names = "sys";
		#clock-cells = <1>;

		pistachio_reset: reset-controller {
			compatible = "img,pistachio-reset";
			#reset-cells = <1>;
		};
	};

Specifying reset control of devices
=======================================

Device nodes should specify the reset channel required in their "resets"
property, containing a phandle to the pistachio reset device node and an
index specifying which reset to use, as described in
Documentation/devicetree/bindings/reset/reset.txt.

Example:

	spdif_out: spdif-out@18100d00 {
		...
		resets = <&pistachio_reset PISTACHIO_RESET_SPDIF_OUT>;
		reset-names = "rst";
		...
	};

Macro definitions for the supported resets can be found in:
include/dt-bindings/reset/pistachio-resets.h
+1 −0
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@ obj-y += core.o
obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
obj-$(CONFIG_ARCH_STI) += sti/
obj-$(CONFIG_ARCH_STI) += sti/
obj-$(CONFIG_ARCH_HISI) += hisilicon/
obj-$(CONFIG_ARCH_HISI) += hisilicon/
+6 −4
Original line number Original line Diff line number Diff line
@@ -45,9 +45,6 @@ struct reset_control {
static int of_reset_simple_xlate(struct reset_controller_dev *rcdev,
static int of_reset_simple_xlate(struct reset_controller_dev *rcdev,
			  const struct of_phandle_args *reset_spec)
			  const struct of_phandle_args *reset_spec)
{
{
	if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells))
		return -EINVAL;

	if (reset_spec->args[0] >= rcdev->nr_resets)
	if (reset_spec->args[0] >= rcdev->nr_resets)
		return -EINVAL;
		return -EINVAL;


@@ -152,7 +149,7 @@ EXPORT_SYMBOL_GPL(reset_control_status);
struct reset_control *of_reset_control_get_by_index(struct device_node *node,
struct reset_control *of_reset_control_get_by_index(struct device_node *node,
					   int index)
					   int index)
{
{
	struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER);
	struct reset_control *rstc;
	struct reset_controller_dev *r, *rcdev;
	struct reset_controller_dev *r, *rcdev;
	struct of_phandle_args args;
	struct of_phandle_args args;
	int rstc_id;
	int rstc_id;
@@ -178,6 +175,11 @@ struct reset_control *of_reset_control_get_by_index(struct device_node *node,
		return ERR_PTR(-EPROBE_DEFER);
		return ERR_PTR(-EPROBE_DEFER);
	}
	}


	if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) {
		mutex_unlock(&reset_controller_list_mutex);
		return ERR_PTR(-EINVAL);
	}

	rstc_id = rcdev->of_xlate(rcdev, &args);
	rstc_id = rcdev->of_xlate(rcdev, &args);
	if (rstc_id < 0) {
	if (rstc_id < 0) {
		mutex_unlock(&reset_controller_list_mutex);
		mutex_unlock(&reset_controller_list_mutex);
+2 −4
Original line number Original line Diff line number Diff line
@@ -57,7 +57,7 @@ static int hi6220_reset_deassert(struct reset_controller_dev *rc_dev,
	return 0;
	return 0;
}
}


static struct reset_control_ops hi6220_reset_ops = {
static const struct reset_control_ops hi6220_reset_ops = {
	.assert = hi6220_reset_assert,
	.assert = hi6220_reset_assert,
	.deassert = hi6220_reset_deassert,
	.deassert = hi6220_reset_deassert,
};
};
@@ -83,9 +83,7 @@ static int hi6220_reset_probe(struct platform_device *pdev)
	data->rc_dev.ops = &hi6220_reset_ops;
	data->rc_dev.ops = &hi6220_reset_ops;
	data->rc_dev.of_node = pdev->dev.of_node;
	data->rc_dev.of_node = pdev->dev.of_node;


	reset_controller_register(&data->rc_dev);
	return reset_controller_register(&data->rc_dev);

	return 0;
}
}


static const struct of_device_id hi6220_reset_match[] = {
static const struct of_device_id hi6220_reset_match[] = {
+1 −1
Original line number Original line Diff line number Diff line
@@ -70,7 +70,7 @@ static int ath79_reset_status(struct reset_controller_dev *rcdev,
	return !!(val & BIT(id));
	return !!(val & BIT(id));
}
}


static struct reset_control_ops ath79_reset_ops = {
static const struct reset_control_ops ath79_reset_ops = {
	.assert = ath79_reset_assert,
	.assert = ath79_reset_assert,
	.deassert = ath79_reset_deassert,
	.deassert = ath79_reset_deassert,
	.status = ath79_reset_status,
	.status = ath79_reset_status,
Loading