Commit a8afa264 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

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

Pull "Reset controller changes for v3.19" from Philipp Zabel:

This adds a new driver for the sti soc family, and creates
a reset_control_status interface, which is added to the existing
drivers.

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

:
  reset: add socfpga_reset_status
  reset: sti: Document sti-picophyreset controllers bindings.
  reset: stih407: Add softreset, powerdown and picophy controllers
  reset: stih407: Add reset controllers DT bindings
  reset: add reset_control_status helper function

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 136a713d f200890f
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
STMicroelectronics STi family Sysconfig Picophy SoftReset Controller
=============================================================================

This binding describes a reset controller device that is used to enable and
disable on-chip PicoPHY USB2 phy(s) using "softreset" control bits found in
the STi family SoC system configuration registers.

The actual action taken when softreset is asserted is hardware dependent.
However, when asserted it may not be possible to access the hardware's
registers and after 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: Should be "st,stih407-picophyreset"
- #reset-cells: 1, see below

Example:

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

Specifying picophyreset control of devices
=======================================

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

Example:

	usb2_picophy0: usbpicophy@0 {
		resets = <&picophyreset STIH407_PICOPHY0_RESET>;
	};

Macro definitions for the supported reset channels can be found in:
include/dt-bindings/reset-controller/stih407-resets.h
+15 −0
Original line number Diff line number Diff line
@@ -125,6 +125,21 @@ int reset_control_deassert(struct reset_control *rstc)
}
EXPORT_SYMBOL_GPL(reset_control_deassert);

/**
 * reset_control_status - returns a negative errno if not supported, a
 * positive value if the reset line is asserted, or zero if the reset
 * line is not asserted.
 * @rstc: reset controller
 */
int reset_control_status(struct reset_control *rstc)
{
	if (rstc->rcdev->ops->status)
		return rstc->rcdev->ops->status(rstc->rcdev, rstc->id);

	return -ENOSYS;
}
EXPORT_SYMBOL_GPL(reset_control_status);

/**
 * of_reset_control_get - Lookup and obtain a reference to a reset controller.
 * @node: device to be reset by the controller
+15 −0
Original line number Diff line number Diff line
@@ -76,9 +76,24 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
	return 0;
}

static int socfpga_reset_status(struct reset_controller_dev *rcdev,
				unsigned long id)
{
	struct socfpga_reset_data *data = container_of(rcdev,
						struct socfpga_reset_data, rcdev);
	int bank = id / BITS_PER_LONG;
	int offset = id % BITS_PER_LONG;
	u32 reg;

	reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));

	return !(reg & BIT(offset));
}

static struct reset_control_ops socfpga_reset_ops = {
	.assert		= socfpga_reset_assert,
	.deassert	= socfpga_reset_deassert,
	.status		= socfpga_reset_status,
};

static int socfpga_reset_probe(struct platform_device *pdev)
+4 −0
Original line number Diff line number Diff line
@@ -12,4 +12,8 @@ config STIH416_RESET
	bool
	select STI_RESET_SYSCFG

config STIH407_RESET
	bool
	select STI_RESET_SYSCFG

endif
+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@ obj-$(CONFIG_STI_RESET_SYSCFG) += reset-syscfg.o

obj-$(CONFIG_STIH415_RESET) += reset-stih415.o
obj-$(CONFIG_STIH416_RESET) += reset-stih416.o
obj-$(CONFIG_STIH407_RESET) += reset-stih407.o
Loading