ARM: rockchip: support cpu hotplug and basic PM
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rockchip / cpu_axi.h
1 #ifndef __CPU_AXI_H
2 #define __CPU_AXI_H
3
4 #define CPU_AXI_QOS_PRIORITY    0x08
5 #define CPU_AXI_QOS_MODE        0x0c
6 #define CPU_AXI_QOS_BANDWIDTH   0x10
7 #define CPU_AXI_QOS_SATURATION  0x14
8
9 #define CPU_AXI_QOS_MODE_NONE           0
10 #define CPU_AXI_QOS_MODE_FIXED          1
11 #define CPU_AXI_QOS_MODE_LIMITER        2
12 #define CPU_AXI_QOS_MODE_REGULATOR      3
13
14 #define CPU_AXI_QOS_PRIORITY_LEVEL(h, l)        ((((h) & 3) << 2) | ((l) & 3))
15 #define CPU_AXI_SET_QOS_PRIORITY(h, l, base) \
16         writel_relaxed(CPU_AXI_QOS_PRIORITY_LEVEL(h, l), base + CPU_AXI_QOS_PRIORITY)
17
18 #define CPU_AXI_SET_QOS_MODE(mode, base) \
19         writel_relaxed((mode) & 3, base + CPU_AXI_QOS_MODE)
20
21 #define CPU_AXI_SET_QOS_BANDWIDTH(bandwidth, base) \
22         writel_relaxed((bandwidth) & 0x7ff, base + CPU_AXI_QOS_BANDWIDTH)
23
24 #define CPU_AXI_SET_QOS_SATURATION(saturation, base) \
25         writel_relaxed((saturation) & 0x3ff, base + CPU_AXI_QOS_SATURATION)
26
27 #define CPU_AXI_QOS_NUM_REGS 4
28 #define CPU_AXI_SAVE_QOS(array, base) do { \
29         array[0] = readl_relaxed(base + CPU_AXI_QOS_PRIORITY); \
30         array[1] = readl_relaxed(base + CPU_AXI_QOS_MODE); \
31         array[2] = readl_relaxed(base + CPU_AXI_QOS_BANDWIDTH); \
32         array[3] = readl_relaxed(base + CPU_AXI_QOS_SATURATION); \
33 } while (0)
34 #define CPU_AXI_RESTORE_QOS(array, base) do { \
35         writel_relaxed(array[0], base + CPU_AXI_QOS_PRIORITY); \
36         writel_relaxed(array[1], base + CPU_AXI_QOS_MODE); \
37         writel_relaxed(array[2], base + CPU_AXI_QOS_BANDWIDTH); \
38         writel_relaxed(array[3], base + CPU_AXI_QOS_SATURATION); \
39 } while (0)
40
41 #define RK3188_CPU_AXI_DMAC_QOS_BASE    (RK_CPU_AXI_BUS_VIRT + 0x1000)
42 #define RK3188_CPU_AXI_CPU0_QOS_BASE    (RK_CPU_AXI_BUS_VIRT + 0x2000)
43 #define RK3188_CPU_AXI_CPU1R_QOS_BASE   (RK_CPU_AXI_BUS_VIRT + 0x2080)
44 #define RK3188_CPU_AXI_CPU1W_QOS_BASE   (RK_CPU_AXI_BUS_VIRT + 0x2100)
45 #define RK3188_CPU_AXI_PERI_QOS_BASE    (RK_CPU_AXI_BUS_VIRT + 0x4000)
46 #define RK3188_CPU_AXI_GPU_QOS_BASE     (RK_CPU_AXI_BUS_VIRT + 0x5000)
47 #define RK3188_CPU_AXI_VPU_QOS_BASE     (RK_CPU_AXI_BUS_VIRT + 0x6000)
48 #define RK3188_CPU_AXI_LCDC0_QOS_BASE   (RK_CPU_AXI_BUS_VIRT + 0x7000)
49 #define RK3188_CPU_AXI_CIF0_QOS_BASE    (RK_CPU_AXI_BUS_VIRT + 0x7080)
50 #define RK3188_CPU_AXI_IPP_QOS_BASE     (RK_CPU_AXI_BUS_VIRT + 0x7100)
51 #define RK3188_CPU_AXI_LCDC1_QOS_BASE   (RK_CPU_AXI_BUS_VIRT + 0x7180)
52 #define RK3188_CPU_AXI_CIF1_QOS_BASE    (RK_CPU_AXI_BUS_VIRT + 0x7200)
53 #define RK3188_CPU_AXI_RGA_QOS_BASE     (RK_CPU_AXI_BUS_VIRT + 0x7280)
54
55 #endif