@@ -321,6 +321,7 @@ struct rzg2l_pinctrl_pin_settings {
321321 * @iolh: IOLH registers cache
322322 * @pupd: PUPD registers cache
323323 * @ien: IEN registers cache
324+ * @smt: SMT registers cache
324325 * @sd_ch: SD_CH registers cache
325326 * @eth_poc: ET_POC registers cache
326327 * @oen: Output Enable register cache
@@ -334,6 +335,7 @@ struct rzg2l_pinctrl_reg_cache {
334335 u32 * iolh [2 ];
335336 u32 * ien [2 ];
336337 u32 * pupd [2 ];
338+ u32 * smt ;
337339 u8 sd_ch [2 ];
338340 u8 eth_poc [2 ];
339341 u8 oen ;
@@ -2704,6 +2706,10 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl)
27042706 if (!cache -> pfc )
27052707 return - ENOMEM ;
27062708
2709+ cache -> smt = devm_kcalloc (pctrl -> dev , nports , sizeof (* cache -> smt ), GFP_KERNEL );
2710+ if (!cache -> smt )
2711+ return - ENOMEM ;
2712+
27072713 for (u8 i = 0 ; i < 2 ; i ++ ) {
27082714 u32 n_dedicated_pins = pctrl -> data -> n_dedicated_pins ;
27092715
@@ -2965,7 +2971,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
29652971 struct rzg2l_pinctrl_reg_cache * cache = pctrl -> cache ;
29662972
29672973 for (u32 port = 0 ; port < nports ; port ++ ) {
2968- bool has_iolh , has_ien , has_pupd ;
2974+ bool has_iolh , has_ien , has_pupd , has_smt ;
29692975 u32 off , caps ;
29702976 u8 pincnt ;
29712977 u64 cfg ;
@@ -2978,6 +2984,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
29782984 has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B | PIN_CFG_IOLH_C ));
29792985 has_ien = !!(caps & PIN_CFG_IEN );
29802986 has_pupd = !!(caps & PIN_CFG_PUPD );
2987+ has_smt = !!(caps & PIN_CFG_SMT );
29812988
29822989 if (suspend )
29832990 RZG2L_PCTRL_REG_ACCESS32 (suspend , pctrl -> base + PFC (off ), cache -> pfc [port ]);
@@ -3016,6 +3023,9 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
30163023 cache -> ien [1 ][port ]);
30173024 }
30183025 }
3026+
3027+ if (has_smt )
3028+ RZG2L_PCTRL_REG_ACCESS32 (suspend , pctrl -> base + SMT (off ), cache -> smt [port ]);
30193029 }
30203030}
30213031
@@ -3165,6 +3175,8 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev)
31653175 const struct rzg2l_hwcfg * hwcfg = pctrl -> data -> hwcfg ;
31663176 const struct rzg2l_register_offsets * regs = & hwcfg -> regs ;
31673177 struct rzg2l_pinctrl_reg_cache * cache = pctrl -> cache ;
3178+ unsigned long flags ;
3179+ u8 pwpr ;
31683180 int ret ;
31693181
31703182 if (!atomic_read (& pctrl -> wakeup_path )) {
@@ -3174,7 +3186,16 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev)
31743186 }
31753187
31763188 writeb (cache -> qspi , pctrl -> base + QSPI );
3189+ if (pctrl -> data -> hwcfg -> oen_pwpr_lock ) {
3190+ spin_lock_irqsave (& pctrl -> lock , flags );
3191+ pwpr = readb (pctrl -> base + regs -> pwpr );
3192+ writeb (pwpr | PWPR_REGWE_B , pctrl -> base + regs -> pwpr );
3193+ }
31773194 writeb (cache -> oen , pctrl -> base + pctrl -> data -> hwcfg -> regs .oen );
3195+ if (pctrl -> data -> hwcfg -> oen_pwpr_lock ) {
3196+ writeb (pwpr & ~PWPR_REGWE_B , pctrl -> base + regs -> pwpr );
3197+ spin_unlock_irqrestore (& pctrl -> lock , flags );
3198+ }
31783199 for (u8 i = 0 ; i < 2 ; i ++ ) {
31793200 if (regs -> sd_ch )
31803201 writeb (cache -> sd_ch [i ], pctrl -> base + SD_CH (regs -> sd_ch , i ));
0 commit comments