@@ -447,8 +447,7 @@ static void rzv2h_mod_clock_mstop_enable(struct rzv2h_cpg_priv *priv,
447
447
{
448
448
unsigned long mstop_mask = FIELD_GET (BUS_MSTOP_BITS_MASK , mstop_data );
449
449
u16 mstop_index = FIELD_GET (BUS_MSTOP_IDX_MASK , mstop_data );
450
- unsigned int index = (mstop_index - 1 ) * 16 ;
451
- atomic_t * mstop = & priv -> mstop_count [index ];
450
+ atomic_t * mstop = & priv -> mstop_count [mstop_index * 16 ];
452
451
unsigned long flags ;
453
452
unsigned int i ;
454
453
u32 val = 0 ;
@@ -469,8 +468,7 @@ static void rzv2h_mod_clock_mstop_disable(struct rzv2h_cpg_priv *priv,
469
468
{
470
469
unsigned long mstop_mask = FIELD_GET (BUS_MSTOP_BITS_MASK , mstop_data );
471
470
u16 mstop_index = FIELD_GET (BUS_MSTOP_IDX_MASK , mstop_data );
472
- unsigned int index = (mstop_index - 1 ) * 16 ;
473
- atomic_t * mstop = & priv -> mstop_count [index ];
471
+ atomic_t * mstop = & priv -> mstop_count [mstop_index * 16 ];
474
472
unsigned long flags ;
475
473
unsigned int i ;
476
474
u32 val = 0 ;
@@ -630,8 +628,7 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod,
630
628
} else if (clock -> mstop_data != BUS_MSTOP_NONE && mod -> critical ) {
631
629
unsigned long mstop_mask = FIELD_GET (BUS_MSTOP_BITS_MASK , clock -> mstop_data );
632
630
u16 mstop_index = FIELD_GET (BUS_MSTOP_IDX_MASK , clock -> mstop_data );
633
- unsigned int index = (mstop_index - 1 ) * 16 ;
634
- atomic_t * mstop = & priv -> mstop_count [index ];
631
+ atomic_t * mstop = & priv -> mstop_count [mstop_index * 16 ];
635
632
unsigned long flags ;
636
633
unsigned int i ;
637
634
u32 val = 0 ;
@@ -926,6 +923,9 @@ static int __init rzv2h_cpg_probe(struct platform_device *pdev)
926
923
if (!priv -> mstop_count )
927
924
return - ENOMEM ;
928
925
926
+ /* Adjust for CPG_BUS_m_MSTOP starting from m = 1 */
927
+ priv -> mstop_count -= 16 ;
928
+
929
929
priv -> resets = devm_kmemdup (dev , info -> resets , sizeof (* info -> resets ) *
930
930
info -> num_resets , GFP_KERNEL );
931
931
if (!priv -> resets )
0 commit comments