// SPDX-License-Identifier: GPL-2.0-only /* * TI SYSCON regmap reset driver * * Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ * Andrew F. Davis <[email protected]> * Suman Anna <[email protected]> */ #include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/reset-controller.h> #include <dt-bindings/reset/ti-syscon.h> /** * struct ti_syscon_reset_control - reset control structure * @assert_offset: reset assert control register offset from syscon base * @assert_bit: reset assert bit in the reset assert control register * @deassert_offset: reset deassert control register offset from syscon base * @deassert_bit: reset deassert bit in the reset deassert control register * @status_offset: reset status register offset from syscon base * @status_bit: reset status bit in the reset status register * @flags: reset flag indicating how the (de)assert and status are handled */ struct ti_syscon_reset_control { … }; /** * struct ti_syscon_reset_data - reset controller information structure * @rcdev: reset controller entity * @regmap: regmap handle containing the memory-mapped reset registers * @controls: array of reset controls * @nr_controls: number of controls in control array */ struct ti_syscon_reset_data { … }; #define to_ti_syscon_reset_data(_rcdev) … /** * ti_syscon_reset_assert() - assert device reset * @rcdev: reset controller entity * @id: ID of the reset to be asserted * * This function implements the reset driver op to assert a device's reset. * This asserts the reset in a manner prescribed by the reset flags. * * Return: 0 for successful request, else a corresponding error value */ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) { … } /** * ti_syscon_reset_deassert() - deassert device reset * @rcdev: reset controller entity * @id: ID of reset to be deasserted * * This function implements the reset driver op to deassert a device's reset. * This deasserts the reset in a manner prescribed by the reset flags. * * Return: 0 for successful request, else a corresponding error value */ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) { … } /** * ti_syscon_reset_status() - check device reset status * @rcdev: reset controller entity * @id: ID of the reset for which the status is being requested * * This function implements the reset driver op to return the status of a * device's reset. * * Return: 0 if reset is deasserted, true if reset is asserted, else a * corresponding error value */ static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, unsigned long id) { … } static const struct reset_control_ops ti_syscon_reset_ops = …; static int ti_syscon_reset_probe(struct platform_device *pdev) { … } static const struct of_device_id ti_syscon_reset_of_match[] = …; MODULE_DEVICE_TABLE(of, ti_syscon_reset_of_match); static struct platform_driver ti_syscon_reset_driver = …; module_platform_driver(…) …; MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;