mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
Reset controller updates for v5.14
This tag adds support for the Microchip Sparx5 Switch Reset controller and contains some small fixes and cleanups in core and various drivers. -----BEGIN PGP SIGNATURE----- iI0EABYIADUWIQRRO6F6WdpH1R0vGibVhaclGDdiwAUCYJvZbRcccC56YWJlbEBw ZW5ndXRyb25peC5kZQAKCRDVhaclGDdiwLVVAP0Wr2d8eQ7BPHIau4ewshPnjqLC 6hNy34HKbne5w6Ex9QEAnTmokTIibu++m8hs2BYMaouNcjck3CR8EuXKbyY8DQk= =5CsH -----END PGP SIGNATURE----- Merge tag 'reset-for-v5.14' of git://git.pengutronix.de/pza/linux into arm/drivers Reset controller updates for v5.14 This tag adds support for the Microchip Sparx5 Switch Reset controller and contains some small fixes and cleanups in core and various drivers. * tag 'reset-for-v5.14' of git://git.pengutronix.de/pza/linux: reset: brcmstb: Add missing MODULE_DEVICE_TABLE reset: a10sr: add missing of_match_table reference reset: RESET_INTEL_GW should depend on X86 reset: RESET_BRCMSTB_RESCAL should depend on ARCH_BRCMSTB reset: uniphier: enclose UNIPHIER_RESET_ID_END value in parentheses reset: sti/syscfg: replace comma with semicolon reset: ti-syscon: fix to_ti_syscon_reset_data macro reset: berlin: replace unsigned with unsigned int reset: whitespace fixes reset: mchp: sparx5: add switch reset driver dt-bindings: reset: microchip sparx5 reset driver bindings reset: oxnas: replace file name with short description reset: zynqmp: replace spaces with tabs reset: bcm6345: Make reset_control_ops const Link: https://lore.kernel.org/r/418cf3a460cfe1d0f91f87e10baaf478bd41f1d5.camel@pengutronix.de Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
commit
6d9b10fd95
58
Documentation/devicetree/bindings/reset/microchip,rst.yaml
Normal file
58
Documentation/devicetree/bindings/reset/microchip,rst.yaml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: "http://devicetree.org/schemas/reset/microchip,rst.yaml#"
|
||||
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
|
||||
|
||||
title: Microchip Sparx5 Switch Reset Controller
|
||||
|
||||
maintainers:
|
||||
- Steen Hegelund <steen.hegelund@microchip.com>
|
||||
- Lars Povlsen <lars.povlsen@microchip.com>
|
||||
|
||||
description: |
|
||||
The Microchip Sparx5 Switch provides reset control and implements the following
|
||||
functions
|
||||
- One Time Switch Core Reset (Soft Reset)
|
||||
|
||||
properties:
|
||||
$nodename:
|
||||
pattern: "^reset-controller@[0-9a-f]+$"
|
||||
|
||||
compatible:
|
||||
const: microchip,sparx5-switch-reset
|
||||
|
||||
reg:
|
||||
items:
|
||||
- description: global control block registers
|
||||
|
||||
reg-names:
|
||||
items:
|
||||
- const: gcb
|
||||
|
||||
"#reset-cells":
|
||||
const: 1
|
||||
|
||||
cpu-syscon:
|
||||
$ref: "/schemas/types.yaml#/definitions/phandle"
|
||||
description: syscon used to access CPU reset
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- reg-names
|
||||
- "#reset-cells"
|
||||
- cpu-syscon
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
reset: reset-controller@11010008 {
|
||||
compatible = "microchip,sparx5-switch-reset";
|
||||
reg = <0x11010008 0x4>;
|
||||
reg-names = "gcb";
|
||||
#reset-cells = <1>;
|
||||
cpu-syscon = <&cpu_ctrl>;
|
||||
};
|
||||
|
||||
|
|
@ -59,7 +59,8 @@ config RESET_BRCMSTB
|
|||
config RESET_BRCMSTB_RESCAL
|
||||
bool "Broadcom STB RESCAL reset controller"
|
||||
depends on HAS_IOMEM
|
||||
default ARCH_BRCMSTB || COMPILE_TEST
|
||||
depends on ARCH_BRCMSTB || COMPILE_TEST
|
||||
default ARCH_BRCMSTB
|
||||
help
|
||||
This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on
|
||||
BCM7216.
|
||||
|
|
@ -82,6 +83,7 @@ config RESET_IMX7
|
|||
|
||||
config RESET_INTEL_GW
|
||||
bool "Intel Reset Controller Driver"
|
||||
depends on X86 || COMPILE_TEST
|
||||
depends on OF && HAS_IOMEM
|
||||
select REGMAP_MMIO
|
||||
help
|
||||
|
|
@ -111,6 +113,14 @@ config RESET_LPC18XX
|
|||
help
|
||||
This enables the reset controller driver for NXP LPC18xx/43xx SoCs.
|
||||
|
||||
config RESET_MCHP_SPARX5
|
||||
bool "Microchip Sparx5 reset driver"
|
||||
depends on HAS_IOMEM || COMPILE_TEST
|
||||
default y if SPARX5_SWITCH
|
||||
select MFD_SYSCON
|
||||
help
|
||||
This driver supports switch core reset for the Microchip Sparx5 SoC.
|
||||
|
||||
config RESET_MESON
|
||||
tristate "Meson Reset Driver"
|
||||
depends on ARCH_MESON || COMPILE_TEST
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o
|
|||
obj-$(CONFIG_RESET_K210) += reset-k210.o
|
||||
obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o
|
||||
obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
|
||||
obj-$(CONFIG_RESET_MCHP_SPARX5) += reset-microchip-sparx5.o
|
||||
obj-$(CONFIG_RESET_MESON) += reset-meson.o
|
||||
obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o
|
||||
obj-$(CONFIG_RESET_NPCM) += reset-npcm.o
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static const char *rcdev_name(struct reset_controller_dev *rcdev)
|
|||
* without gaps.
|
||||
*/
|
||||
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 (reset_spec->args[0] >= rcdev->nr_resets)
|
||||
return -EINVAL;
|
||||
|
|
@ -744,9 +744,9 @@ void reset_control_bulk_release(int num_rstcs,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(reset_control_bulk_release);
|
||||
|
||||
static struct reset_control *__reset_control_get_internal(
|
||||
struct reset_controller_dev *rcdev,
|
||||
unsigned int index, bool shared, bool acquired)
|
||||
static struct reset_control *
|
||||
__reset_control_get_internal(struct reset_controller_dev *rcdev,
|
||||
unsigned int index, bool shared, bool acquired)
|
||||
{
|
||||
struct reset_control *rstc;
|
||||
|
||||
|
|
@ -806,9 +806,9 @@ static void __reset_control_put_internal(struct reset_control *rstc)
|
|||
kref_put(&rstc->refcnt, __reset_control_release);
|
||||
}
|
||||
|
||||
struct reset_control *__of_reset_control_get(struct device_node *node,
|
||||
const char *id, int index, bool shared,
|
||||
bool optional, bool acquired)
|
||||
struct reset_control *
|
||||
__of_reset_control_get(struct device_node *node, const char *id, int index,
|
||||
bool shared, bool optional, bool acquired)
|
||||
{
|
||||
struct reset_control *rstc;
|
||||
struct reset_controller_dev *r, *rcdev;
|
||||
|
|
@ -1027,9 +1027,9 @@ static void devm_reset_control_release(struct device *dev, void *res)
|
|||
reset_control_put(*(struct reset_control **)res);
|
||||
}
|
||||
|
||||
struct reset_control *__devm_reset_control_get(struct device *dev,
|
||||
const char *id, int index, bool shared,
|
||||
bool optional, bool acquired)
|
||||
struct reset_control *
|
||||
__devm_reset_control_get(struct device *dev, const char *id, int index,
|
||||
bool shared, bool optional, bool acquired)
|
||||
{
|
||||
struct reset_control **ptr, *rstc;
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ static struct platform_driver a10sr_reset_driver = {
|
|||
.probe = a10sr_reset_probe,
|
||||
.driver = {
|
||||
.name = "altr_a10sr_reset",
|
||||
.of_match_table = a10sr_reset_of_match,
|
||||
},
|
||||
};
|
||||
module_platform_driver(a10sr_reset_driver);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ static int bcm6345_reset_status(struct reset_controller_dev *rcdev,
|
|||
return !(__raw_readl(bcm6345_reset->base) & BIT(id));
|
||||
}
|
||||
|
||||
static struct reset_control_ops bcm6345_reset_ops = {
|
||||
static const struct reset_control_ops bcm6345_reset_ops = {
|
||||
.assert = bcm6345_reset_assert,
|
||||
.deassert = bcm6345_reset_deassert,
|
||||
.reset = bcm6345_reset_reset,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static const struct reset_control_ops berlin_reset_ops = {
|
|||
static int berlin_reset_xlate(struct reset_controller_dev *rcdev,
|
||||
const struct of_phandle_args *reset_spec)
|
||||
{
|
||||
unsigned offset, bit;
|
||||
unsigned int offset, bit;
|
||||
|
||||
offset = reset_spec->args[0];
|
||||
bit = reset_spec->args[1];
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ static const struct of_device_id brcmstb_reset_of_match[] = {
|
|||
{ .compatible = "brcm,brcmstb-reset" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, brcmstb_reset_of_match);
|
||||
|
||||
static struct platform_driver brcmstb_reset_driver = {
|
||||
.probe = brcmstb_reset_probe,
|
||||
|
|
|
|||
146
drivers/reset/reset-microchip-sparx5.c
Normal file
146
drivers/reset/reset-microchip-sparx5.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/* Microchip Sparx5 Switch Reset driver
|
||||
*
|
||||
* Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* The Sparx5 Chip Register Model can be browsed at this location:
|
||||
* https://github.com/microchip-ung/sparx-5_reginfo
|
||||
*/
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/reset-controller.h>
|
||||
|
||||
#define PROTECT_REG 0x84
|
||||
#define PROTECT_BIT BIT(10)
|
||||
#define SOFT_RESET_REG 0x00
|
||||
#define SOFT_RESET_BIT BIT(1)
|
||||
|
||||
struct mchp_reset_context {
|
||||
struct regmap *cpu_ctrl;
|
||||
struct regmap *gcb_ctrl;
|
||||
struct reset_controller_dev rcdev;
|
||||
};
|
||||
|
||||
static struct regmap_config sparx5_reset_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.val_bits = 32,
|
||||
.reg_stride = 4,
|
||||
};
|
||||
|
||||
static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
|
||||
unsigned long id)
|
||||
{
|
||||
struct mchp_reset_context *ctx =
|
||||
container_of(rcdev, struct mchp_reset_context, rcdev);
|
||||
u32 val;
|
||||
|
||||
/* Make sure the core is PROTECTED from reset */
|
||||
regmap_update_bits(ctx->cpu_ctrl, PROTECT_REG, PROTECT_BIT, PROTECT_BIT);
|
||||
|
||||
/* Start soft reset */
|
||||
regmap_write(ctx->gcb_ctrl, SOFT_RESET_REG, SOFT_RESET_BIT);
|
||||
|
||||
/* Wait for soft reset done */
|
||||
return regmap_read_poll_timeout(ctx->gcb_ctrl, SOFT_RESET_REG, val,
|
||||
(val & SOFT_RESET_BIT) == 0,
|
||||
1, 100);
|
||||
}
|
||||
|
||||
static const struct reset_control_ops sparx5_reset_ops = {
|
||||
.reset = sparx5_switch_reset,
|
||||
};
|
||||
|
||||
static int mchp_sparx5_map_syscon(struct platform_device *pdev, char *name,
|
||||
struct regmap **target)
|
||||
{
|
||||
struct device_node *syscon_np;
|
||||
struct regmap *regmap;
|
||||
int err;
|
||||
|
||||
syscon_np = of_parse_phandle(pdev->dev.of_node, name, 0);
|
||||
if (!syscon_np)
|
||||
return -ENODEV;
|
||||
regmap = syscon_node_to_regmap(syscon_np);
|
||||
of_node_put(syscon_np);
|
||||
if (IS_ERR(regmap)) {
|
||||
err = PTR_ERR(regmap);
|
||||
dev_err(&pdev->dev, "No '%s' map: %d\n", name, err);
|
||||
return err;
|
||||
}
|
||||
*target = regmap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mchp_sparx5_map_io(struct platform_device *pdev, int index,
|
||||
struct regmap **target)
|
||||
{
|
||||
struct resource *res;
|
||||
struct regmap *map;
|
||||
void __iomem *mem;
|
||||
|
||||
mem = devm_platform_get_and_ioremap_resource(pdev, index, &res);
|
||||
if (!mem) {
|
||||
dev_err(&pdev->dev, "Could not map resource %d\n", index);
|
||||
return -ENXIO;
|
||||
}
|
||||
sparx5_reset_regmap_config.name = res->name;
|
||||
map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config);
|
||||
if (IS_ERR(map))
|
||||
return PTR_ERR(map);
|
||||
*target = map;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mchp_sparx5_reset_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *dn = pdev->dev.of_node;
|
||||
struct mchp_reset_context *ctx;
|
||||
int err;
|
||||
|
||||
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
|
||||
if (!ctx)
|
||||
return -ENOMEM;
|
||||
|
||||
err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl);
|
||||
if (err)
|
||||
return err;
|
||||
err = mchp_sparx5_map_io(pdev, 0, &ctx->gcb_ctrl);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ctx->rcdev.owner = THIS_MODULE;
|
||||
ctx->rcdev.nr_resets = 1;
|
||||
ctx->rcdev.ops = &sparx5_reset_ops;
|
||||
ctx->rcdev.of_node = dn;
|
||||
|
||||
return devm_reset_controller_register(&pdev->dev, &ctx->rcdev);
|
||||
}
|
||||
|
||||
static const struct of_device_id mchp_sparx5_reset_of_match[] = {
|
||||
{
|
||||
.compatible = "microchip,sparx5-switch-reset",
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver mchp_sparx5_reset_driver = {
|
||||
.probe = mchp_sparx5_reset_probe,
|
||||
.driver = {
|
||||
.name = "sparx5-switch-reset",
|
||||
.of_match_table = mchp_sparx5_reset_of_match,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init mchp_sparx5_reset_init(void)
|
||||
{
|
||||
return platform_driver_register(&mchp_sparx5_reset_driver);
|
||||
}
|
||||
|
||||
postcore_initcall(mchp_sparx5_reset_init);
|
||||
|
||||
MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");
|
||||
MODULE_AUTHOR("Steen Hegelund <steen.hegelund@microchip.com>");
|
||||
MODULE_LICENSE("Dual MIT/GPL");
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* drivers/reset/reset-oxnas.c
|
||||
* Oxford Semiconductor Reset Controller driver
|
||||
*
|
||||
* Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
|
||||
* Copyright (C) 2014 Ma Haijun <mahaijuns@gmail.com>
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ struct ti_syscon_reset_data {
|
|||
unsigned int nr_controls;
|
||||
};
|
||||
|
||||
#define to_ti_syscon_reset_data(rcdev) \
|
||||
container_of(rcdev, struct ti_syscon_reset_data, rcdev)
|
||||
#define to_ti_syscon_reset_data(_rcdev) \
|
||||
container_of(_rcdev, struct ti_syscon_reset_data, rcdev)
|
||||
|
||||
/**
|
||||
* ti_syscon_reset_assert() - assert device reset
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct uniphier_reset_data {
|
|||
#define UNIPHIER_RESET_ACTIVE_LOW BIT(0)
|
||||
};
|
||||
|
||||
#define UNIPHIER_RESET_ID_END (unsigned int)(-1)
|
||||
#define UNIPHIER_RESET_ID_END ((unsigned int)(-1))
|
||||
|
||||
#define UNIPHIER_RESET_END \
|
||||
{ .id = UNIPHIER_RESET_ID_END }
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ static const struct zynqmp_reset_soc_data zynqmp_reset_data = {
|
|||
};
|
||||
|
||||
static const struct zynqmp_reset_soc_data versal_reset_data = {
|
||||
.reset_id = 0,
|
||||
.num_resets = VERSAL_NR_RESETS,
|
||||
.reset_id = 0,
|
||||
.num_resets = VERSAL_NR_RESETS,
|
||||
};
|
||||
|
||||
static const struct reset_control_ops zynqmp_reset_ops = {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ static int syscfg_reset_controller_register(struct device *dev,
|
|||
if (!rc->channels)
|
||||
return -ENOMEM;
|
||||
|
||||
rc->rst.ops = &syscfg_reset_ops,
|
||||
rc->rst.ops = &syscfg_reset_ops;
|
||||
rc->rst.of_node = dev->of_node;
|
||||
rc->rst.nr_resets = data->nr_channels;
|
||||
rc->active_low = data->active_low;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user