#ifndef __RK3399_MCU_H__
#define __RK3399_MCU_H__
-#define readl(c) ({unsigned int __v = \
+#define mmio_read_32(c) ({unsigned int __v = \
(*(volatile unsigned int *)(c)); __v; })
-#define writel(v, c) ((*(volatile unsigned int *) (c)) = (v))
+#define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v))
#define MCU_BASE 0x40000000
#define PMU_BASE (MCU_BASE + 0x07310000)
unsigned int mode_con;
while (1) {
- status_value = readl(PMU_BASE + PMU_POWER_ST);
+ status_value = mmio_read_32(PMU_BASE + PMU_POWER_ST);
if (status_value) {
- mode_con = readl(PMU_BASE + PMU_PWRMODE_CON);
- writel(mode_con & (~0x01),
- PMU_BASE + PMU_PWRMODE_CON);
+ mode_con = mmio_read_32(PMU_BASE + PMU_PWRMODE_CON);
+ mmio_write_32(PMU_BASE + PMU_PWRMODE_CON,
+ mode_con & (~0x01));
return;
}
}
system_wakeup();
- reg_src = readl(M0_SCR);
+ reg_src = mmio_read_32(M0_SCR);
/* m0 enter deep sleep mode */
- writel(reg_src | SCR_SLEEPDEEP_SHIFT, M0_SCR);
+ mmio_write_32(M0_SCR, reg_src | SCR_SLEEPDEEP_SHIFT);
for (;;)
__asm volatile("wfi");