static void read_hw_config(struct pti_device *pti) { u32 ctl = ioread32(pti->base + REG_PTI_CTL); pti->mode = (ctl & PTI_MODE) >> __ffs(PTI_MODE); pti->clkdiv = (ctl & PTI_CLKDIV) >> __ffs(PTI_CLKDIV); pti->freeclk = !!(ctl & PTI_FCEN); if (!pti_mode[pti->mode]) pti->mode = pti_width_mode(4); if (!pti->clkdiv) pti->clkdiv = 1; }
static ssize_t mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct pti_device *pti = dev_get_drvdata(dev); unsigned long val; int ret; ret = kstrtoul(buf, 10, &val); if (ret) return ret; ret = pti_width_mode(val); if (ret < 0) return ret; pti->mode = ret; return size; }
static void read_hw_config(struct pti_device *pti) { u32 ctl = ioread32(pti->base + REG_PTI_CTL); pti->mode = (ctl & PTI_MODE) >> __ffs(PTI_MODE); pti->clkdiv = (ctl & PTI_CLKDIV) >> __ffs(PTI_CLKDIV); pti->freeclk = !!(ctl & PTI_FCEN); if (!pti_mode[pti->mode]) pti->mode = pti_width_mode(4); if (!pti->clkdiv) pti->clkdiv = 1; if (pti->thdev->output.type == GTH_LPP) { if (ctl & LPP_PTIPRESENT) pti->lpp_dest_mask |= LPP_DEST_PTI; if (ctl & LPP_BSSBPRESENT) pti->lpp_dest_mask |= LPP_DEST_EXI; if (ctl & LPP_DEST) pti->lpp_dest = 1; } }