Reset controller updates for v5.20

Allow reset-simple to be selected under EXPERT and reset-a10sr to be
 built under COMPILE_TEST. Add Renesas RZ/G2UL USBPHY binding and a new
 driver for the TI TPS380x line of voltage supervisor ICs with manual
 reset control.
 
 A patch to make reset-microchip-sparx5 buildable as a module had to be
 reverted as that turned out to break MDIO on kswitch-d10.
 -----BEGIN PGP SIGNATURE-----
 
 iI0EABYIADUWIQRRO6F6WdpH1R0vGibVhaclGDdiwAUCYuPhlBcccC56YWJlbEBw
 ZW5ndXRyb25peC5kZQAKCRDVhaclGDdiwNJ4AP9DtTgPOZpWuyqxdLG5WdGYW7ci
 q/cWuJWZAWBgnuZaIQD9HfFro1M2q4muVJ8uTYYfXKfNbv0AZ1vqZUAIij9JTg0=
 =PZam
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmLpLVsACgkQmmx57+YA
 GNlwJhAAqmpwr7jPQpcg5dLR30aluIy27dQKqgu2rnDXUr3CFlZ5aUiTrjc6tilc
 hUYFjiv0DMeH8ohQMMlCyvPZsfBvQL/12WOO8C5+c0HasDJ1Rbxmfx73q5YtqOP5
 ZkN7F3vsmSOQZsLGKdPeAFkpo7AttyyB0JxyONh++PpeSzPqdu8hNXKg5JY12o7Q
 Xzw2dCeqjfkZz2cwg8genyQheEA9XU3tLV6W7jQwHU8uwh5yNrQgWYeN7lqj2RSA
 mcmBFFQvNS/rQBLr2H3fz65X3asVRgzalPwAa8Nt1MmdEubP0Gz/Abr9pgS6Xbke
 2ApuAxgod/M5vvecsoNP1coGQX7T9ZbqzNPkRXNh3MjU1217HkkaRbI1ftje8TFE
 Tk1VBuL4d/WJKP7bEnfNVTiFX8dSKsGb6UuqiZLLLAaYv1VtGw5BEqG5P5vP/ba9
 n5FIvMyKyAJrkW6UrHxQV4sLxiAYNHwf5cKM5O+ewfgKAs/hkCikImWlYrtmdCRJ
 X25bqjkqKy70/kaTpKfDQKiOrx7ZS+m5deKZ37z6ZLW4/XCO51s+6OaXO6Sv9lYm
 uMBTYXsaLVbJjnVas8GS6hsoauyecRVU8we7w8IFhO7OXegTVAV1s7AiKVEaHdiK
 jzMZACbf8OfKjCttSTWeKUcmj7hD/9c8T4kXj8fM0F7gixhlDNU=
 =M1VO
 -----END PGP SIGNATURE-----

Merge tag 'reset-for-v5.20' of git://git.pengutronix.de/pza/linux into arm/late

Reset controller updates for v5.20

Allow reset-simple to be selected under EXPERT and reset-a10sr to be
built under COMPILE_TEST. Add Renesas RZ/G2UL USBPHY binding and a new
driver for the TI TPS380x line of voltage supervisor ICs with manual
reset control.

A patch to make reset-microchip-sparx5 buildable as a module had to be
reverted as that turned out to break MDIO on kswitch-d10.

* tag 'reset-for-v5.20' of git://git.pengutronix.de/pza/linux:
  reset: tps380x: Fix spelling mistake "Voltags" -> "Voltage"
  reset: tps380x: Add TPS380x device driver supprt
  dt-bindings: reset: Add TPS380x documentation
  dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G2UL USBPHY Control bindings
  reset: reset-simple should depends on HAS_IOMEM
  Revert "reset: microchip-sparx5: allow building as a module"
  reset: a10sr: allow building under COMPILE_TEST
  reset: allow building of reset simple driver if expert config selected
  reset: microchip-sparx5: allow building as a module

Link: https://lore.kernel.org/r/20220729133620.488379-1-p.zabel@pengutronix.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-08-02 15:57:46 +02:00
commit d2fd1ddd31
5 changed files with 188 additions and 2 deletions

View file

@ -17,6 +17,7 @@ properties:
compatible:
items:
- enum:
- renesas,r9a07g043-usbphy-ctrl # RZ/G2UL
- renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
- renesas,r9a07g054-usbphy-ctrl # RZ/V2L
- const: renesas,rzg2l-usbphy-ctrl

View file

@ -0,0 +1,49 @@
# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/reset/ti,tps380x-reset.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: TI TPS380x reset controller node bindings
maintainers:
- Marco Felsch <kernel@pengutronix.de>
description: |
The TPS380x family [1] of supervisory circuits monitor supply voltages to
provide circuit initialization and timing supervision. The devices assert a
RESET signal if the voltage drops below a preset threshold or upon a manual
reset input (MR). The RESET output remains asserted for the factory
programmed delay after the voltage return above its threshold or after the
manual reset input is released.
[1] https://www.ti.com/product/TPS3801
properties:
compatible:
enum:
- ti,tps3801
reset-gpios:
maxItems: 1
description: Reference to the GPIO connected to the MR pin.
"#reset-cells":
const: 0
required:
- compatible
- reset-gpios
- "#reset-cells"
additionalProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
reset: reset-controller {
compatible = "ti,tps3801";
#reset-cells = <0>;
reset-gpios = <&gpio3 2 GPIO_ACTIVE_LOW>;
};
...

View file

@ -17,7 +17,7 @@ if RESET_CONTROLLER
config RESET_A10SR
tristate "Altera Arria10 System Resource Reset"
depends on MFD_ALTERA_A10SR
depends on MFD_ALTERA_A10SR || COMPILE_TEST
help
This option enables support for the external reset functions for
peripheral PHYs on the Altera Arria10 System Resource Chip.
@ -200,8 +200,9 @@ config RESET_SCMI
firmware controlling all the reset signals.
config RESET_SIMPLE
bool "Simple Reset Controller Driver" if COMPILE_TEST
bool "Simple Reset Controller Driver" if COMPILE_TEST || EXPERT
default ARCH_ASPEED || ARCH_BCM4908 || ARCH_BITMAIN || ARCH_REALTEK || ARCH_STM32 || (ARCH_INTEL_SOCFPGA && ARM64) || ARCH_SUNXI || ARC
depends on HAS_IOMEM
help
This enables a simple reset controller driver for reset lines that
that can be asserted and deasserted by toggling bits in a contiguous,
@ -256,6 +257,14 @@ config RESET_TI_SYSCON
you wish to use the reset framework for such memory-mapped devices,
say Y here. Otherwise, say N.
config RESET_TI_TPS380X
tristate "TI TPS380x Reset Driver"
select GPIOLIB
help
This enables the reset driver support for TI TPS380x devices. If
you wish to use the reset framework for such devices, say Y here.
Otherwise, say N.
config RESET_TN48M_CPLD
tristate "Delta Networks TN48M switch CPLD reset controller"
depends on MFD_TN48M_CPLD || COMPILE_TEST

View file

@ -33,6 +33,7 @@ obj-$(CONFIG_RESET_STARFIVE_JH7100) += reset-starfive-jh7100.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_TPS380X) += reset-tps380x.o
obj-$(CONFIG_RESET_TN48M_CPLD) += reset-tn48m.o
obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
obj-$(CONFIG_RESET_UNIPHIER_GLUE) += reset-uniphier-glue.o

View file

@ -0,0 +1,126 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* TI TPS380x Supply Voltage Supervisor and Reset Controller Driver
*
* Copyright (C) 2022 Pengutronix, Marco Felsch <kernel@pengutronix.de>
*
* Based on Simple Reset Controller Driver
*
* Copyright (C) 2017 Pengutronix, Philipp Zabel <kernel@pengutronix.de>
*/
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/reset-controller.h>
struct tps380x_reset {
struct reset_controller_dev rcdev;
struct gpio_desc *reset_gpio;
unsigned int reset_ms;
};
struct tps380x_reset_devdata {
unsigned int min_reset_ms;
unsigned int typ_reset_ms;
unsigned int max_reset_ms;
};
static inline
struct tps380x_reset *to_tps380x_reset(struct reset_controller_dev *rcdev)
{
return container_of(rcdev, struct tps380x_reset, rcdev);
}
static int
tps380x_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
{
struct tps380x_reset *tps380x = to_tps380x_reset(rcdev);
gpiod_set_value_cansleep(tps380x->reset_gpio, 1);
return 0;
}
static int
tps380x_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
{
struct tps380x_reset *tps380x = to_tps380x_reset(rcdev);
gpiod_set_value_cansleep(tps380x->reset_gpio, 0);
msleep(tps380x->reset_ms);
return 0;
}
static const struct reset_control_ops reset_tps380x_ops = {
.assert = tps380x_reset_assert,
.deassert = tps380x_reset_deassert,
};
static int tps380x_reset_of_xlate(struct reset_controller_dev *rcdev,
const struct of_phandle_args *reset_spec)
{
/* No special handling needed, we have only one reset line per device */
return 0;
}
static int tps380x_reset_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct tps380x_reset_devdata *devdata;
struct tps380x_reset *tps380x;
devdata = device_get_match_data(dev);
if (!devdata)
return -EINVAL;
tps380x = devm_kzalloc(dev, sizeof(*tps380x), GFP_KERNEL);
if (!tps380x)
return -ENOMEM;
tps380x->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(tps380x->reset_gpio))
return dev_err_probe(dev, PTR_ERR(tps380x->reset_gpio),
"Failed to get GPIO\n");
tps380x->reset_ms = devdata->max_reset_ms;
tps380x->rcdev.ops = &reset_tps380x_ops;
tps380x->rcdev.owner = THIS_MODULE;
tps380x->rcdev.dev = dev;
tps380x->rcdev.of_node = dev->of_node;
tps380x->rcdev.of_reset_n_cells = 0;
tps380x->rcdev.of_xlate = tps380x_reset_of_xlate;
tps380x->rcdev.nr_resets = 1;
return devm_reset_controller_register(dev, &tps380x->rcdev);
}
static const struct tps380x_reset_devdata tps3801_reset_data = {
.min_reset_ms = 120,
.typ_reset_ms = 200,
.max_reset_ms = 280,
};
static const struct of_device_id tps380x_reset_dt_ids[] = {
{ .compatible = "ti,tps3801", .data = &tps3801_reset_data },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, tps380x_reset_dt_ids);
static struct platform_driver tps380x_reset_driver = {
.probe = tps380x_reset_probe,
.driver = {
.name = "tps380x-reset",
.of_match_table = tps380x_reset_dt_ids,
},
};
module_platform_driver(tps380x_reset_driver);
MODULE_AUTHOR("Marco Felsch <kernel@pengutronix.de>");
MODULE_DESCRIPTION("TI TPS380x Supply Voltage Supervisor and Reset Driver");
MODULE_LICENSE("GPL v2");