cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

reset.c (1270B)


      1// SPDX-License-Identifier: GPL-2.0-only
      2/*
      3 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
      4 */
      5
      6#include <linux/bitops.h>
      7#include <linux/export.h>
      8#include <linux/regmap.h>
      9#include <linux/reset-controller.h>
     10#include <linux/delay.h>
     11
     12#include "reset.h"
     13
     14static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
     15{
     16	rcdev->ops->assert(rcdev, id);
     17	udelay(1);
     18	rcdev->ops->deassert(rcdev, id);
     19	return 0;
     20}
     21
     22static int
     23qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
     24{
     25	struct qcom_reset_controller *rst;
     26	const struct qcom_reset_map *map;
     27	u32 mask;
     28
     29	rst = to_qcom_reset_controller(rcdev);
     30	map = &rst->reset_map[id];
     31	mask = BIT(map->bit);
     32
     33	return regmap_update_bits(rst->regmap, map->reg, mask, mask);
     34}
     35
     36static int
     37qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
     38{
     39	struct qcom_reset_controller *rst;
     40	const struct qcom_reset_map *map;
     41	u32 mask;
     42
     43	rst = to_qcom_reset_controller(rcdev);
     44	map = &rst->reset_map[id];
     45	mask = BIT(map->bit);
     46
     47	return regmap_update_bits(rst->regmap, map->reg, mask, 0);
     48}
     49
     50const struct reset_control_ops qcom_reset_ops = {
     51	.reset = qcom_reset,
     52	.assert = qcom_reset_assert,
     53	.deassert = qcom_reset_deassert,
     54};
     55EXPORT_SYMBOL_GPL(qcom_reset_ops);