Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) 2013 STMicroelectronics (R&D) Limited
0004  * Author: Stephen Gallimore <stephen.gallimore@st.com>
0005  */
0006 #ifndef __STI_RESET_SYSCFG_H
0007 #define __STI_RESET_SYSCFG_H
0008 
0009 #include <linux/device.h>
0010 #include <linux/regmap.h>
0011 #include <linux/reset-controller.h>
0012 
0013 /**
0014  * Reset channel description for a system configuration register based
0015  * reset controller.
0016  *
0017  * @compatible: Compatible string of the syscon regmap containing this
0018  *              channel's control and ack (status) bits.
0019  * @reset: Regmap field description of the channel's reset bit.
0020  * @ack: Regmap field description of the channel's acknowledge bit.
0021  */
0022 struct syscfg_reset_channel_data {
0023     const char *compatible;
0024     struct reg_field reset;
0025     struct reg_field ack;
0026 };
0027 
0028 #define _SYSCFG_RST_CH(_c, _rr, _rb, _ar, _ab)      \
0029     { .compatible   = _c,               \
0030       .reset    = REG_FIELD(_rr, _rb, _rb), \
0031       .ack      = REG_FIELD(_ar, _ab, _ab), }
0032 
0033 #define _SYSCFG_RST_CH_NO_ACK(_c, _rr, _rb)     \
0034     { .compatible   = _c,           \
0035       .reset    = REG_FIELD(_rr, _rb, _rb), }
0036 
0037 /**
0038  * Description of a system configuration register based reset controller.
0039  *
0040  * @wait_for_ack: The controller will wait for reset assert and de-assert to
0041  *                be "ack'd" in a channel's ack field.
0042  * @active_low: Are the resets in this controller active low, i.e. clearing
0043  *              the reset bit puts the hardware into reset.
0044  * @nr_channels: The number of reset channels in this controller.
0045  * @channels: An array of reset channel descriptions.
0046  */
0047 struct syscfg_reset_controller_data {
0048     bool wait_for_ack;
0049     bool active_low;
0050     int nr_channels;
0051     const struct syscfg_reset_channel_data *channels;
0052 };
0053 
0054 /**
0055  * syscfg_reset_probe(): platform device probe function used by syscfg
0056  *                       reset controller drivers. This registers a reset
0057  *                       controller configured by the OF match data for
0058  *                       the compatible device which should be of type
0059  *                       "struct syscfg_reset_controller_data".
0060  *
0061  * @pdev: platform device
0062  */
0063 int syscfg_reset_probe(struct platform_device *pdev);
0064 
0065 #endif /* __STI_RESET_SYSCFG_H */