Lines Matching refs:cpu

59 static int per_cpu_sw_state_rd(u32 cpu)  in per_cpu_sw_state_rd()  argument
61 sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); in per_cpu_sw_state_rd()
62 return per_cpu(per_cpu_sw_state, cpu); in per_cpu_sw_state_rd()
65 static void per_cpu_sw_state_wr(u32 cpu, int val) in per_cpu_sw_state_wr() argument
68 per_cpu(per_cpu_sw_state, cpu) = val; in per_cpu_sw_state_wr()
69 sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); in per_cpu_sw_state_wr()
72 static inline void per_cpu_sw_state_wr(u32 cpu, int val) { } in per_cpu_sw_state_wr() argument
75 static void __iomem *pwr_ctrl_get_base(u32 cpu) in pwr_ctrl_get_base() argument
78 base += (cpu_logical_map(cpu) * 4); in pwr_ctrl_get_base()
82 static u32 pwr_ctrl_rd(u32 cpu) in pwr_ctrl_rd() argument
84 void __iomem *base = pwr_ctrl_get_base(cpu); in pwr_ctrl_rd()
88 static void pwr_ctrl_set(unsigned int cpu, u32 val, u32 mask) in pwr_ctrl_set() argument
90 void __iomem *base = pwr_ctrl_get_base(cpu); in pwr_ctrl_set()
94 static void pwr_ctrl_clr(unsigned int cpu, u32 val, u32 mask) in pwr_ctrl_clr() argument
96 void __iomem *base = pwr_ctrl_get_base(cpu); in pwr_ctrl_clr()
101 static int pwr_ctrl_wait_tmout(unsigned int cpu, u32 set, u32 mask) in pwr_ctrl_wait_tmout() argument
107 tmp = pwr_ctrl_rd(cpu) & mask; in pwr_ctrl_wait_tmout()
112 tmp = pwr_ctrl_rd(cpu) & mask; in pwr_ctrl_wait_tmout()
119 static void cpu_rst_cfg_set(u32 cpu, int set) in cpu_rst_cfg_set() argument
124 val |= BIT(cpu_logical_map(cpu)); in cpu_rst_cfg_set()
126 val &= ~BIT(cpu_logical_map(cpu)); in cpu_rst_cfg_set()
130 static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr) in cpu_set_boot_addr() argument
132 const int reg_ofs = cpu_logical_map(cpu) * 8; in cpu_set_boot_addr()
137 static void brcmstb_cpu_boot(u32 cpu) in brcmstb_cpu_boot() argument
140 per_cpu_sw_state_wr(cpu, 1); in brcmstb_cpu_boot()
146 cpu_set_boot_addr(cpu, __pa_symbol(secondary_startup)); in brcmstb_cpu_boot()
149 cpu_rst_cfg_set(cpu, 0); in brcmstb_cpu_boot()
152 static void brcmstb_cpu_power_on(u32 cpu) in brcmstb_cpu_power_on() argument
158 pwr_ctrl_set(cpu, ZONE_MAN_ISO_CNTL_MASK, 0xffffff00); in brcmstb_cpu_power_on()
159 pwr_ctrl_set(cpu, ZONE_MANUAL_CONTROL_MASK, -1); in brcmstb_cpu_power_on()
160 pwr_ctrl_set(cpu, ZONE_RESERVED_1_MASK, -1); in brcmstb_cpu_power_on()
162 pwr_ctrl_set(cpu, ZONE_MAN_MEM_PWR_MASK, -1); in brcmstb_cpu_power_on()
164 if (pwr_ctrl_wait_tmout(cpu, 1, ZONE_MEM_PWR_STATE_MASK)) in brcmstb_cpu_power_on()
167 pwr_ctrl_set(cpu, ZONE_MAN_CLKEN_MASK, -1); in brcmstb_cpu_power_on()
169 if (pwr_ctrl_wait_tmout(cpu, 1, ZONE_DPG_PWR_STATE_MASK)) in brcmstb_cpu_power_on()
172 pwr_ctrl_clr(cpu, ZONE_MAN_ISO_CNTL_MASK, -1); in brcmstb_cpu_power_on()
173 pwr_ctrl_set(cpu, ZONE_MAN_RESET_CNTL_MASK, -1); in brcmstb_cpu_power_on()
176 static int brcmstb_cpu_get_power_state(u32 cpu) in brcmstb_cpu_get_power_state() argument
178 int tmp = pwr_ctrl_rd(cpu); in brcmstb_cpu_get_power_state()
184 static void brcmstb_cpu_die(u32 cpu) in brcmstb_cpu_die() argument
188 per_cpu_sw_state_wr(cpu, 0); in brcmstb_cpu_die()
198 static int brcmstb_cpu_kill(u32 cpu) in brcmstb_cpu_kill() argument
206 if (cpu == 0) { in brcmstb_cpu_kill()
211 while (per_cpu_sw_state_rd(cpu)) in brcmstb_cpu_kill()
214 pwr_ctrl_set(cpu, ZONE_MANUAL_CONTROL_MASK, -1); in brcmstb_cpu_kill()
215 pwr_ctrl_clr(cpu, ZONE_MAN_RESET_CNTL_MASK, -1); in brcmstb_cpu_kill()
216 pwr_ctrl_clr(cpu, ZONE_MAN_CLKEN_MASK, -1); in brcmstb_cpu_kill()
217 pwr_ctrl_set(cpu, ZONE_MAN_ISO_CNTL_MASK, -1); in brcmstb_cpu_kill()
218 pwr_ctrl_clr(cpu, ZONE_MAN_MEM_PWR_MASK, -1); in brcmstb_cpu_kill()
220 if (pwr_ctrl_wait_tmout(cpu, 0, ZONE_MEM_PWR_STATE_MASK)) in brcmstb_cpu_kill()
223 pwr_ctrl_clr(cpu, ZONE_RESERVED_1_MASK, -1); in brcmstb_cpu_kill()
225 if (pwr_ctrl_wait_tmout(cpu, 0, ZONE_DPG_PWR_STATE_MASK)) in brcmstb_cpu_kill()
232 cpu_rst_cfg_set(cpu, 1); in brcmstb_cpu_kill()
339 static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) in brcmstb_boot_secondary() argument
346 if (brcmstb_cpu_get_power_state(cpu) == 0) in brcmstb_boot_secondary()
347 brcmstb_cpu_power_on(cpu); in brcmstb_boot_secondary()
349 brcmstb_cpu_boot(cpu); in brcmstb_boot_secondary()