180180#define WAKE_AOWAKE_CNTRL (x ) (0x000 + ((x) << 2))
181181#define WAKE_AOWAKE_CNTRL_LEVEL (1 << 3)
182182#define WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN (1 << 1)
183- #define WAKE_AOWAKE_MASK_W (x ) (0x180 + ((x) << 2))
184- #define WAKE_AOWAKE_STATUS_W (x ) (0x30c + ((x) << 2))
185- #define WAKE_AOWAKE_STATUS_R (x ) (0x48c + ((x) << 2))
186- #define WAKE_AOWAKE_TIER2_ROUTING (x ) (0x4cc + ((x) << 2))
187- #define WAKE_AOWAKE_SW_STATUS_W_0 0x49c
188- #define WAKE_AOWAKE_SW_STATUS (x ) (0x4a0 + ((x) << 2))
189- #define WAKE_LATCH_SW 0x498
190-
191- #define WAKE_AOWAKE_CTRL 0x4f4
192- #define WAKE_AOWAKE_CTRL_INTR_POLARITY BIT(0)
183+ #define WAKE_AOWAKE_MASK_W (_pmc , x ) \
184+ ((_pmc)->soc->regs->aowake_mask_w + ((x) << 2))
185+ #define WAKE_AOWAKE_STATUS_W (_pmc , x ) \
186+ ((_pmc)->soc->regs->aowake_status_w + ((x) << 2))
187+ #define WAKE_AOWAKE_STATUS_R (_pmc , x ) \
188+ ((_pmc)->soc->regs->aowake_status_r + ((x) << 2))
189+ #define WAKE_AOWAKE_TIER2_ROUTING (_pmc , x ) \
190+ ((_pmc)->soc->regs->aowake_tier2_routing + ((x) << 2))
191+ #define WAKE_AOWAKE_SW_STATUS (_pmc , x ) \
192+ ((_pmc)->soc->regs->aowake_sw_status + ((x) << 2))
193+
194+ #define WAKE_AOWAKE_CTRL_INTR_POLARITY BIT(0)
193195
194196#define SW_WAKE_ID 83 /* wake83 */
195197
@@ -302,6 +304,14 @@ struct tegra_pmc_regs {
302304 unsigned int rst_source_mask ;
303305 unsigned int rst_level_shift ;
304306 unsigned int rst_level_mask ;
307+ unsigned int aowake_mask_w ;
308+ unsigned int aowake_status_w ;
309+ unsigned int aowake_status_r ;
310+ unsigned int aowake_tier2_routing ;
311+ unsigned int aowake_sw_status_w ;
312+ unsigned int aowake_sw_status ;
313+ unsigned int aowake_latch_sw ;
314+ unsigned int aowake_ctrl ;
305315};
306316
307317struct tegra_wake_event {
@@ -2629,20 +2639,20 @@ static int tegra186_pmc_irq_set_wake(struct irq_data *data, unsigned int on)
26292639 bit = data -> hwirq % 32 ;
26302640
26312641 /* clear wake status */
2632- writel (0x1 , pmc -> wake + WAKE_AOWAKE_STATUS_W (data -> hwirq ));
2642+ writel (0x1 , pmc -> wake + WAKE_AOWAKE_STATUS_W (pmc , data -> hwirq ));
26332643
26342644 /* route wake to tier 2 */
2635- value = readl (pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (offset ));
2645+ value = readl (pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (pmc , offset ));
26362646
26372647 if (!on )
26382648 value &= ~(1 << bit );
26392649 else
26402650 value |= 1 << bit ;
26412651
2642- writel (value , pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (offset ));
2652+ writel (value , pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (pmc , offset ));
26432653
26442654 /* enable wakeup event */
2645- writel (!!on , pmc -> wake + WAKE_AOWAKE_MASK_W (data -> hwirq ));
2655+ writel (!!on , pmc -> wake + WAKE_AOWAKE_MASK_W (pmc , data -> hwirq ));
26462656
26472657 return 0 ;
26482658}
@@ -3309,7 +3319,7 @@ static void wke_write_wake_levels(struct tegra_pmc *pmc)
33093319
33103320static void wke_clear_sw_wake_status (struct tegra_pmc * pmc )
33113321{
3312- wke_32kwritel (pmc , 1 , WAKE_AOWAKE_SW_STATUS_W_0 );
3322+ wke_32kwritel (pmc , 1 , pmc -> soc -> regs -> aowake_sw_status_w );
33133323}
33143324
33153325static void wke_read_sw_wake_status (struct tegra_pmc * pmc )
@@ -3322,7 +3332,7 @@ static void wke_read_sw_wake_status(struct tegra_pmc *pmc)
33223332
33233333 wke_clear_sw_wake_status (pmc );
33243334
3325- wke_32kwritel (pmc , 1 , WAKE_LATCH_SW );
3335+ wke_32kwritel (pmc , 1 , pmc -> soc -> regs -> aowake_latch_sw );
33263336
33273337 /*
33283338 * WAKE_AOWAKE_SW_STATUS is edge triggered, so in order to
@@ -3340,12 +3350,12 @@ static void wke_read_sw_wake_status(struct tegra_pmc *pmc)
33403350 */
33413351 udelay (300 );
33423352
3343- wke_32kwritel (pmc , 0 , WAKE_LATCH_SW );
3353+ wke_32kwritel (pmc , 0 , pmc -> soc -> regs -> aowake_latch_sw );
33443354
33453355 bitmap_zero (pmc -> wake_sw_status_map , pmc -> soc -> max_wake_events );
33463356
33473357 for (i = 0 ; i < pmc -> soc -> max_wake_vectors ; i ++ ) {
3348- status = readl (pmc -> wake + WAKE_AOWAKE_SW_STATUS (i ));
3358+ status = readl (pmc -> wake + WAKE_AOWAKE_SW_STATUS (pmc , i ));
33493359
33503360 for_each_set_bit (wake , & status , 32 )
33513361 set_bit (wake + (i * 32 ), pmc -> wake_sw_status_map );
@@ -3359,11 +3369,12 @@ static void wke_clear_wake_status(struct tegra_pmc *pmc)
33593369 u32 mask ;
33603370
33613371 for (i = 0 ; i < pmc -> soc -> max_wake_vectors ; i ++ ) {
3362- mask = readl (pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (i ));
3363- status = readl (pmc -> wake + WAKE_AOWAKE_STATUS_R (i )) & mask ;
3372+ mask = readl (pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (pmc , i ));
3373+ status = readl (pmc -> wake + WAKE_AOWAKE_STATUS_R (pmc , i )) & mask ;
33643374
33653375 for_each_set_bit (wake , & status , 32 )
3366- wke_32kwritel (pmc , 0x1 , WAKE_AOWAKE_STATUS_W ((i * 32 ) + wake ));
3376+ wke_32kwritel (pmc , 0x1 , WAKE_AOWAKE_STATUS_W (pmc ,
3377+ (i * 32 ) + wake ));
33673378 }
33683379}
33693380
@@ -3374,8 +3385,9 @@ static void tegra186_pmc_wake_syscore_resume(void *data)
33743385 u32 mask ;
33753386
33763387 for (i = 0 ; i < pmc -> soc -> max_wake_vectors ; i ++ ) {
3377- mask = readl (pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (i ));
3378- pmc -> wake_status [i ] = readl (pmc -> wake + WAKE_AOWAKE_STATUS_R (i )) & mask ;
3388+ mask = readl (pmc -> wake + WAKE_AOWAKE_TIER2_ROUTING (pmc , i ));
3389+ pmc -> wake_status [i ] = readl (pmc -> wake +
3390+ WAKE_AOWAKE_STATUS_R (pmc , i )) & mask ;
33793391 }
33803392
33813393 /* Schedule IRQ work to process wake IRQs (if any) */
@@ -4062,6 +4074,14 @@ static const struct tegra_pmc_regs tegra186_pmc_regs = {
40624074 .rst_source_mask = 0x3c ,
40634075 .rst_level_shift = 0x0 ,
40644076 .rst_level_mask = 0x3 ,
4077+ .aowake_mask_w = 0x180 ,
4078+ .aowake_status_w = 0x30c ,
4079+ .aowake_status_r = 0x48c ,
4080+ .aowake_tier2_routing = 0x4cc ,
4081+ .aowake_sw_status_w = 0x49c ,
4082+ .aowake_sw_status = 0x4a0 ,
4083+ .aowake_latch_sw = 0x498 ,
4084+ .aowake_ctrl = 0x4f4 ,
40654085};
40664086
40674087static void tegra186_pmc_init (struct tegra_pmc * pmc )
@@ -4094,14 +4114,14 @@ static void tegra186_pmc_setup_irq_polarity(struct tegra_pmc *pmc,
40944114 return ;
40954115 }
40964116
4097- value = readl (wake + WAKE_AOWAKE_CTRL );
4117+ value = readl (wake + pmc -> soc -> regs -> aowake_ctrl );
40984118
40994119 if (invert )
41004120 value |= WAKE_AOWAKE_CTRL_INTR_POLARITY ;
41014121 else
41024122 value &= ~WAKE_AOWAKE_CTRL_INTR_POLARITY ;
41034123
4104- writel (value , wake + WAKE_AOWAKE_CTRL );
4124+ writel (value , wake + pmc -> soc -> regs -> aowake_ctrl );
41054125
41064126 iounmap (wake );
41074127}
@@ -4281,6 +4301,14 @@ static const struct tegra_pmc_regs tegra194_pmc_regs = {
42814301 .rst_source_mask = 0x7c ,
42824302 .rst_level_shift = 0x0 ,
42834303 .rst_level_mask = 0x3 ,
4304+ .aowake_mask_w = 0x180 ,
4305+ .aowake_status_w = 0x30c ,
4306+ .aowake_status_r = 0x48c ,
4307+ .aowake_tier2_routing = 0x4cc ,
4308+ .aowake_sw_status_w = 0x49c ,
4309+ .aowake_sw_status = 0x4a0 ,
4310+ .aowake_latch_sw = 0x498 ,
4311+ .aowake_ctrl = 0x4f4 ,
42844312};
42854313
42864314static const char * const tegra194_reset_sources [] = {
@@ -4400,6 +4428,14 @@ static const struct tegra_pmc_regs tegra234_pmc_regs = {
44004428 .rst_source_mask = 0xfc ,
44014429 .rst_level_shift = 0x0 ,
44024430 .rst_level_mask = 0x3 ,
4431+ .aowake_mask_w = 0x180 ,
4432+ .aowake_status_w = 0x30c ,
4433+ .aowake_status_r = 0x48c ,
4434+ .aowake_tier2_routing = 0x4cc ,
4435+ .aowake_sw_status_w = 0x49c ,
4436+ .aowake_sw_status = 0x4a0 ,
4437+ .aowake_latch_sw = 0x498 ,
4438+ .aowake_ctrl = 0x4f4 ,
44034439};
44044440
44054441static const char * const tegra234_reset_sources [] = {
0 commit comments