Skip to content

Commit 6b2d2e5

Browse files
jbrun3tpH5
authored andcommitted
reset: amlogic: add driver parameters
To allow using the same driver for the main reset controller and the auxiliary ones embedded in the clock controllers, allow to customise the reset offset, same as the level offset. Also add an option to make the level reset active low or high. Signed-off-by: Jerome Brunet <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Philipp Zabel <[email protected]>
1 parent ee64998 commit 6b2d2e5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/reset/reset-meson.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
struct meson_reset_param {
2020
unsigned int reg_count;
21+
unsigned int reset_offset;
2122
unsigned int level_offset;
23+
bool level_low_reset;
2224
};
2325

2426
struct meson_reset {
@@ -46,6 +48,7 @@ static int meson_reset_reset(struct reset_controller_dev *rcdev,
4648
unsigned int offset, bit;
4749

4850
meson_reset_offset_and_bit(data, id, &offset, &bit);
51+
offset += data->param->reset_offset;
4952

5053
return regmap_write(data->map, offset, BIT(bit));
5154
}
@@ -59,9 +62,10 @@ static int meson_reset_level(struct reset_controller_dev *rcdev,
5962

6063
meson_reset_offset_and_bit(data, id, &offset, &bit);
6164
offset += data->param->level_offset;
65+
assert ^= data->param->level_low_reset;
6266

6367
return regmap_update_bits(data->map, offset,
64-
BIT(bit), assert ? 0 : BIT(bit));
68+
BIT(bit), assert ? BIT(bit) : 0);
6569
}
6670

6771
static int meson_reset_assert(struct reset_controller_dev *rcdev,
@@ -84,22 +88,30 @@ static const struct reset_control_ops meson_reset_ops = {
8488

8589
static const struct meson_reset_param meson8b_param = {
8690
.reg_count = 8,
91+
.reset_offset = 0x0,
8792
.level_offset = 0x7c,
93+
.level_low_reset = true,
8894
};
8995

9096
static const struct meson_reset_param meson_a1_param = {
9197
.reg_count = 3,
98+
.reset_offset = 0x0,
9299
.level_offset = 0x40,
100+
.level_low_reset = true,
93101
};
94102

95103
static const struct meson_reset_param meson_s4_param = {
96104
.reg_count = 6,
105+
.reset_offset = 0x0,
97106
.level_offset = 0x40,
107+
.level_low_reset = true,
98108
};
99109

100110
static const struct meson_reset_param t7_param = {
101111
.reg_count = 7,
112+
.reset_offset = 0x0,
102113
.level_offset = 0x40,
114+
.level_low_reset = true,
103115
};
104116

105117
static const struct of_device_id meson_reset_dt_ids[] = {

0 commit comments

Comments
 (0)