| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 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. |
|---|
| 7 | | - * |
|---|
| 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. |
|---|
| 12 | 4 | */ |
|---|
| 13 | 5 | |
|---|
| 14 | 6 | #include <linux/bitops.h> |
|---|
| .. | .. |
|---|
| 21 | 13 | |
|---|
| 22 | 14 | static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) |
|---|
| 23 | 15 | { |
|---|
| 16 | + struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev); |
|---|
| 17 | + |
|---|
| 24 | 18 | rcdev->ops->assert(rcdev, id); |
|---|
| 25 | | - udelay(1); |
|---|
| 19 | + fsleep(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */ |
|---|
| 20 | + |
|---|
| 26 | 21 | rcdev->ops->deassert(rcdev, id); |
|---|
| 27 | 22 | return 0; |
|---|
| 28 | 23 | } |
|---|
| .. | .. |
|---|
| 36 | 31 | |
|---|
| 37 | 32 | rst = to_qcom_reset_controller(rcdev); |
|---|
| 38 | 33 | map = &rst->reset_map[id]; |
|---|
| 39 | | - mask = BIT(map->bit); |
|---|
| 34 | + mask = map->bitmask ? map->bitmask : BIT(map->bit); |
|---|
| 40 | 35 | |
|---|
| 41 | 36 | return regmap_update_bits(rst->regmap, map->reg, mask, mask); |
|---|
| 42 | 37 | } |
|---|
| .. | .. |
|---|
| 50 | 45 | |
|---|
| 51 | 46 | rst = to_qcom_reset_controller(rcdev); |
|---|
| 52 | 47 | map = &rst->reset_map[id]; |
|---|
| 53 | | - mask = BIT(map->bit); |
|---|
| 48 | + mask = map->bitmask ? map->bitmask : BIT(map->bit); |
|---|
| 54 | 49 | |
|---|
| 55 | 50 | return regmap_update_bits(rst->regmap, map->reg, mask, 0); |
|---|
| 56 | 51 | } |
|---|