2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include <linux/bitops.h>
15 #include <linux/export.h>
16 #include <linux/regmap.h>
17 #include <linux/reset-controller.h>
18 #include <linux/delay.h>
22 static int qcom_reset(struct reset_controller_dev
*rcdev
, unsigned long id
)
24 rcdev
->ops
->assert(rcdev
, id
);
26 rcdev
->ops
->deassert(rcdev
, id
);
31 qcom_reset_assert(struct reset_controller_dev
*rcdev
, unsigned long id
)
33 struct qcom_reset_controller
*rst
;
34 const struct qcom_reset_map
*map
;
37 rst
= to_qcom_reset_controller(rcdev
);
38 map
= &rst
->reset_map
[id
];
41 return regmap_update_bits(rst
->regmap
, map
->reg
, mask
, mask
);
45 qcom_reset_deassert(struct reset_controller_dev
*rcdev
, unsigned long id
)
47 struct qcom_reset_controller
*rst
;
48 const struct qcom_reset_map
*map
;
51 rst
= to_qcom_reset_controller(rcdev
);
52 map
= &rst
->reset_map
[id
];
55 return regmap_update_bits(rst
->regmap
, map
->reg
, mask
, 0);
58 struct reset_control_ops qcom_reset_ops
= {
60 .assert = qcom_reset_assert
,
61 .deassert
= qcom_reset_deassert
,
63 EXPORT_SYMBOL_GPL(qcom_reset_ops
);