Lines Matching refs:sl
189 u32 cpsw_sl_reg_read(struct cpsw_sl *sl, enum cpsw_sl_regs reg) in cpsw_sl_reg_read() argument
193 if (sl->regs[reg] == CPSW_SL_REG_NOTUSED) { in cpsw_sl_reg_read()
194 dev_err(sl->dev, "cpsw_sl: not sup r reg: %04X\n", in cpsw_sl_reg_read()
195 sl->regs[reg]); in cpsw_sl_reg_read()
199 val = readl(sl->sl_base + sl->regs[reg]); in cpsw_sl_reg_read()
200 dev_dbg(sl->dev, "cpsw_sl: reg: %04X r 0x%08X\n", sl->regs[reg], val); in cpsw_sl_reg_read()
204 void cpsw_sl_reg_write(struct cpsw_sl *sl, enum cpsw_sl_regs reg, u32 val) in cpsw_sl_reg_write() argument
206 if (sl->regs[reg] == CPSW_SL_REG_NOTUSED) { in cpsw_sl_reg_write()
207 dev_err(sl->dev, "cpsw_sl: not sup w reg: %04X\n", in cpsw_sl_reg_write()
208 sl->regs[reg]); in cpsw_sl_reg_write()
212 dev_dbg(sl->dev, "cpsw_sl: reg: %04X w 0x%08X\n", sl->regs[reg], val); in cpsw_sl_reg_write()
213 writel(val, sl->sl_base + sl->regs[reg]); in cpsw_sl_reg_write()
235 struct cpsw_sl *sl; in cpsw_sl_get() local
237 sl = devm_kzalloc(dev, sizeof(struct cpsw_sl), GFP_KERNEL); in cpsw_sl_get()
238 if (!sl) in cpsw_sl_get()
240 sl->dev = dev; in cpsw_sl_get()
241 sl->sl_base = sl_base; in cpsw_sl_get()
245 dev_err(sl->dev, "cpsw_sl: dev_id %s not found.\n", device_id); in cpsw_sl_get()
248 sl->regs = sl_dev_id->regs; in cpsw_sl_get()
249 sl->control_features = sl_dev_id->control_features; in cpsw_sl_get()
250 sl->idle_mask = sl_dev_id->idle_mask; in cpsw_sl_get()
251 sl->sl_base += sl_dev_id->regs_offset; in cpsw_sl_get()
253 return sl; in cpsw_sl_get()
256 void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo) in cpsw_sl_reset() argument
261 cpsw_sl_reg_write(sl, CPSW_SL_SOFT_RESET, CPSW_SL_SOFT_RESET_BIT); in cpsw_sl_reset()
266 } while ((cpsw_sl_reg_read(sl, CPSW_SL_SOFT_RESET) & in cpsw_sl_reset()
270 if (cpsw_sl_reg_read(sl, CPSW_SL_SOFT_RESET) & CPSW_SL_SOFT_RESET_BIT) in cpsw_sl_reset()
271 dev_err(sl->dev, "cpsw_sl failed to soft-reset.\n"); in cpsw_sl_reset()
274 u32 cpsw_sl_ctl_set(struct cpsw_sl *sl, u32 ctl_funcs) in cpsw_sl_ctl_set() argument
278 if (ctl_funcs & ~sl->control_features) { in cpsw_sl_ctl_set()
279 dev_err(sl->dev, "cpsw_sl: unsupported func 0x%08X\n", in cpsw_sl_ctl_set()
280 ctl_funcs & (~sl->control_features)); in cpsw_sl_ctl_set()
284 val = cpsw_sl_reg_read(sl, CPSW_SL_MACCONTROL); in cpsw_sl_ctl_set()
286 cpsw_sl_reg_write(sl, CPSW_SL_MACCONTROL, val); in cpsw_sl_ctl_set()
291 u32 cpsw_sl_ctl_clr(struct cpsw_sl *sl, u32 ctl_funcs) in cpsw_sl_ctl_clr() argument
295 if (ctl_funcs & ~sl->control_features) { in cpsw_sl_ctl_clr()
296 dev_err(sl->dev, "cpsw_sl: unsupported func 0x%08X\n", in cpsw_sl_ctl_clr()
297 ctl_funcs & (~sl->control_features)); in cpsw_sl_ctl_clr()
301 val = cpsw_sl_reg_read(sl, CPSW_SL_MACCONTROL); in cpsw_sl_ctl_clr()
303 cpsw_sl_reg_write(sl, CPSW_SL_MACCONTROL, val); in cpsw_sl_ctl_clr()
308 void cpsw_sl_ctl_reset(struct cpsw_sl *sl) in cpsw_sl_ctl_reset() argument
310 cpsw_sl_reg_write(sl, CPSW_SL_MACCONTROL, 0); in cpsw_sl_ctl_reset()
313 int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo) in cpsw_sl_wait_for_idle() argument
319 } while (!(cpsw_sl_reg_read(sl, CPSW_SL_MACSTATUS) & in cpsw_sl_wait_for_idle()
320 sl->idle_mask) && time_after(timeout, jiffies)); in cpsw_sl_wait_for_idle()
322 if (!(cpsw_sl_reg_read(sl, CPSW_SL_MACSTATUS) & sl->idle_mask)) { in cpsw_sl_wait_for_idle()
323 dev_err(sl->dev, "cpsw_sl failed to soft-reset.\n"); in cpsw_sl_wait_for_idle()