diff mbox series

[v3,5/9] reset: amlogic: use reset number instead of register count

Message ID 20240808102742.4095904-6-jbrunet@baylibre.com (mailing list archive)
State Superseded
Headers show
Series reset: amlogic: move audio reset drivers out of CCF | expand

Commit Message

Jerome Brunet Aug. 8, 2024, 10:27 a.m. UTC
The reset driver from audio clock controller may register less
reset than a register can hold. To avoid making any change while
switching to auxiliary support, use the number of reset instead of the
register count to define the bounds of the reset controller.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 drivers/reset/reset-meson.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Neil Armstrong Aug. 19, 2024, 4:30 p.m. UTC | #1
On 08/08/2024 12:27, Jerome Brunet wrote:
> The reset driver from audio clock controller may register less
> reset than a register can hold. To avoid making any change while
> switching to auxiliary support, use the number of reset instead of the
> register count to define the bounds of the reset controller.
> 
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
>   drivers/reset/reset-meson.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
> index 8addd100e601..5b6f934c0265 100644
> --- a/drivers/reset/reset-meson.c
> +++ b/drivers/reset/reset-meson.c
> @@ -17,7 +17,7 @@
>   #include <linux/types.h>
>   
>   struct meson_reset_param {
> -	unsigned int reg_count;
> +	unsigned int reset_num;
>   	unsigned int reset_offset;
>   	unsigned int level_offset;
>   	bool level_low_reset;
> @@ -87,21 +87,21 @@ static const struct reset_control_ops meson_reset_ops = {
>   };
>   
>   static const struct meson_reset_param meson8b_param = {
> -	.reg_count	= 8,
> +	.reset_num	= 256,
>   	.reset_offset	= 0x0,
>   	.level_offset	= 0x7c,
>   	.level_low_reset = true,
>   };
>   
>   static const struct meson_reset_param meson_a1_param = {
> -	.reg_count	= 3,
> +	.reset_num	= 96,
>   	.reset_offset	= 0x0,
>   	.level_offset	= 0x40,
>   	.level_low_reset = true,
>   };
>   
>   static const struct meson_reset_param meson_s4_param = {
> -	.reg_count	= 6,
> +	.reset_num	= 192,
>   	.reset_offset	= 0x0,
>   	.level_offset	= 0x40,
>   	.level_low_reset = true,
> @@ -148,8 +148,7 @@ static int meson_reset_probe(struct platform_device *pdev)
>   				     "can't init regmap mmio region\n");
>   
>   	data->rcdev.owner = THIS_MODULE;
> -	data->rcdev.nr_resets = data->param->reg_count * BITS_PER_BYTE
> -		* regmap_config.reg_stride;
> +	data->rcdev.nr_resets = data->param->reset_num;
>   	data->rcdev.ops = &meson_reset_ops;
>   	data->rcdev.of_node = dev->of_node;
>   

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
diff mbox series

Patch

diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
index 8addd100e601..5b6f934c0265 100644
--- a/drivers/reset/reset-meson.c
+++ b/drivers/reset/reset-meson.c
@@ -17,7 +17,7 @@ 
 #include <linux/types.h>
 
 struct meson_reset_param {
-	unsigned int reg_count;
+	unsigned int reset_num;
 	unsigned int reset_offset;
 	unsigned int level_offset;
 	bool level_low_reset;
@@ -87,21 +87,21 @@  static const struct reset_control_ops meson_reset_ops = {
 };
 
 static const struct meson_reset_param meson8b_param = {
-	.reg_count	= 8,
+	.reset_num	= 256,
 	.reset_offset	= 0x0,
 	.level_offset	= 0x7c,
 	.level_low_reset = true,
 };
 
 static const struct meson_reset_param meson_a1_param = {
-	.reg_count	= 3,
+	.reset_num	= 96,
 	.reset_offset	= 0x0,
 	.level_offset	= 0x40,
 	.level_low_reset = true,
 };
 
 static const struct meson_reset_param meson_s4_param = {
-	.reg_count	= 6,
+	.reset_num	= 192,
 	.reset_offset	= 0x0,
 	.level_offset	= 0x40,
 	.level_low_reset = true,
@@ -148,8 +148,7 @@  static int meson_reset_probe(struct platform_device *pdev)
 				     "can't init regmap mmio region\n");
 
 	data->rcdev.owner = THIS_MODULE;
-	data->rcdev.nr_resets = data->param->reg_count * BITS_PER_BYTE
-		* regmap_config.reg_stride;
+	data->rcdev.nr_resets = data->param->reset_num;
 	data->rcdev.ops = &meson_reset_ops;
 	data->rcdev.of_node = dev->of_node;