Lines Matching refs:cpu

67 static int per_cpu_sw_state_rd(u32 cpu)  in per_cpu_sw_state_rd()  argument
69 sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); in per_cpu_sw_state_rd()
70 return per_cpu(per_cpu_sw_state, cpu); in per_cpu_sw_state_rd()
73 static void per_cpu_sw_state_wr(u32 cpu, int val) in per_cpu_sw_state_wr() argument
76 per_cpu(per_cpu_sw_state, cpu) = val; in per_cpu_sw_state_wr()
77 sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); in per_cpu_sw_state_wr()
80 static inline void per_cpu_sw_state_wr(u32 cpu, int val) { } in per_cpu_sw_state_wr() argument
83 static void __iomem *pwr_ctrl_get_base(u32 cpu) in pwr_ctrl_get_base() argument
86 base += (cpu_logical_map(cpu) * 4); in pwr_ctrl_get_base()
90 static u32 pwr_ctrl_rd(u32 cpu) in pwr_ctrl_rd() argument
92 void __iomem *base = pwr_ctrl_get_base(cpu); in pwr_ctrl_rd()
96 static void pwr_ctrl_set(unsigned int cpu, u32 val, u32 mask) in pwr_ctrl_set() argument
98 void __iomem *base = pwr_ctrl_get_base(cpu); in pwr_ctrl_set()
102 static void pwr_ctrl_clr(unsigned int cpu, u32 val, u32 mask) in pwr_ctrl_clr() argument
104 void __iomem *base = pwr_ctrl_get_base(cpu); in pwr_ctrl_clr()
109 static int pwr_ctrl_wait_tmout(unsigned int cpu, u32 set, u32 mask) in pwr_ctrl_wait_tmout() argument
115 tmp = pwr_ctrl_rd(cpu) & mask; in pwr_ctrl_wait_tmout()
120 tmp = pwr_ctrl_rd(cpu) & mask; in pwr_ctrl_wait_tmout()
127 static void cpu_rst_cfg_set(u32 cpu, int set) in cpu_rst_cfg_set() argument
132 val |= BIT(cpu_logical_map(cpu)); in cpu_rst_cfg_set()
134 val &= ~BIT(cpu_logical_map(cpu)); in cpu_rst_cfg_set()
138 static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr) in cpu_set_boot_addr() argument
140 const int reg_ofs = cpu_logical_map(cpu) * 8; in cpu_set_boot_addr()
145 static void brcmstb_cpu_boot(u32 cpu) in brcmstb_cpu_boot() argument
148 per_cpu_sw_state_wr(cpu, 1); in brcmstb_cpu_boot()
154 cpu_set_boot_addr(cpu, __pa_symbol(secondary_startup)); in brcmstb_cpu_boot()
157 cpu_rst_cfg_set(cpu, 0); in brcmstb_cpu_boot()
160 static void brcmstb_cpu_power_on(u32 cpu) in brcmstb_cpu_power_on() argument
166 pwr_ctrl_set(cpu, ZONE_MAN_ISO_CNTL_MASK, 0xffffff00); in brcmstb_cpu_power_on()
167 pwr_ctrl_set(cpu, ZONE_MANUAL_CONTROL_MASK, -1); in brcmstb_cpu_power_on()
168 pwr_ctrl_set(cpu, ZONE_RESERVED_1_MASK, -1); in brcmstb_cpu_power_on()
170 pwr_ctrl_set(cpu, ZONE_MAN_MEM_PWR_MASK, -1); in brcmstb_cpu_power_on()
172 if (pwr_ctrl_wait_tmout(cpu, 1, ZONE_MEM_PWR_STATE_MASK)) in brcmstb_cpu_power_on()
175 pwr_ctrl_set(cpu, ZONE_MAN_CLKEN_MASK, -1); in brcmstb_cpu_power_on()
177 if (pwr_ctrl_wait_tmout(cpu, 1, ZONE_DPG_PWR_STATE_MASK)) in brcmstb_cpu_power_on()
180 pwr_ctrl_clr(cpu, ZONE_MAN_ISO_CNTL_MASK, -1); in brcmstb_cpu_power_on()
181 pwr_ctrl_set(cpu, ZONE_MAN_RESET_CNTL_MASK, -1); in brcmstb_cpu_power_on()
184 static int brcmstb_cpu_get_power_state(u32 cpu) in brcmstb_cpu_get_power_state() argument
186 int tmp = pwr_ctrl_rd(cpu); in brcmstb_cpu_get_power_state()
192 static void brcmstb_cpu_die(u32 cpu) in brcmstb_cpu_die() argument
196 per_cpu_sw_state_wr(cpu, 0); in brcmstb_cpu_die()
206 static int brcmstb_cpu_kill(u32 cpu) in brcmstb_cpu_kill() argument
214 if (cpu == 0) { in brcmstb_cpu_kill()
219 while (per_cpu_sw_state_rd(cpu)) in brcmstb_cpu_kill()
222 pwr_ctrl_set(cpu, ZONE_MANUAL_CONTROL_MASK, -1); in brcmstb_cpu_kill()
223 pwr_ctrl_clr(cpu, ZONE_MAN_RESET_CNTL_MASK, -1); in brcmstb_cpu_kill()
224 pwr_ctrl_clr(cpu, ZONE_MAN_CLKEN_MASK, -1); in brcmstb_cpu_kill()
225 pwr_ctrl_set(cpu, ZONE_MAN_ISO_CNTL_MASK, -1); in brcmstb_cpu_kill()
226 pwr_ctrl_clr(cpu, ZONE_MAN_MEM_PWR_MASK, -1); in brcmstb_cpu_kill()
228 if (pwr_ctrl_wait_tmout(cpu, 0, ZONE_MEM_PWR_STATE_MASK)) in brcmstb_cpu_kill()
231 pwr_ctrl_clr(cpu, ZONE_RESERVED_1_MASK, -1); in brcmstb_cpu_kill()
233 if (pwr_ctrl_wait_tmout(cpu, 0, ZONE_DPG_PWR_STATE_MASK)) in brcmstb_cpu_kill()
240 cpu_rst_cfg_set(cpu, 1); in brcmstb_cpu_kill()
347 static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) in brcmstb_boot_secondary() argument
354 if (brcmstb_cpu_get_power_state(cpu) == 0) in brcmstb_boot_secondary()
355 brcmstb_cpu_power_on(cpu); in brcmstb_boot_secondary()
357 brcmstb_cpu_boot(cpu); in brcmstb_boot_secondary()