Lines Matching refs:otp
46 static int mxs_ocotp_wait(struct mxs_ocotp *otp) in mxs_ocotp_wait() argument
52 status = readl(otp->base); in mxs_ocotp_wait()
71 struct mxs_ocotp *otp = context; in mxs_ocotp_read() local
75 ret = clk_enable(otp->clk); in mxs_ocotp_read()
79 writel(BM_OCOTP_CTRL_ERROR, otp->base + STMP_OFFSET_REG_CLR); in mxs_ocotp_read()
81 ret = mxs_ocotp_wait(otp); in mxs_ocotp_read()
86 writel(BM_OCOTP_CTRL_RD_BANK_OPEN, otp->base + STMP_OFFSET_REG_SET); in mxs_ocotp_read()
91 ret = mxs_ocotp_wait(otp); in mxs_ocotp_read()
100 *buf++ = readl(otp->base + offset); in mxs_ocotp_read()
109 writel(BM_OCOTP_CTRL_RD_BANK_OPEN, otp->base + STMP_OFFSET_REG_CLR); in mxs_ocotp_read()
112 clk_disable(otp->clk); in mxs_ocotp_read()
147 struct mxs_ocotp *otp; in mxs_ocotp_probe() local
156 otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); in mxs_ocotp_probe()
157 if (!otp) in mxs_ocotp_probe()
161 otp->base = devm_ioremap_resource(dev, res); in mxs_ocotp_probe()
162 if (IS_ERR(otp->base)) in mxs_ocotp_probe()
163 return PTR_ERR(otp->base); in mxs_ocotp_probe()
165 otp->clk = devm_clk_get(&pdev->dev, NULL); in mxs_ocotp_probe()
166 if (IS_ERR(otp->clk)) in mxs_ocotp_probe()
167 return PTR_ERR(otp->clk); in mxs_ocotp_probe()
169 ret = clk_prepare(otp->clk); in mxs_ocotp_probe()
178 ocotp_config.priv = otp; in mxs_ocotp_probe()
180 otp->nvmem = nvmem_register(&ocotp_config); in mxs_ocotp_probe()
181 if (IS_ERR(otp->nvmem)) { in mxs_ocotp_probe()
182 ret = PTR_ERR(otp->nvmem); in mxs_ocotp_probe()
186 platform_set_drvdata(pdev, otp); in mxs_ocotp_probe()
191 clk_unprepare(otp->clk); in mxs_ocotp_probe()
198 struct mxs_ocotp *otp = platform_get_drvdata(pdev); in mxs_ocotp_remove() local
200 clk_unprepare(otp->clk); in mxs_ocotp_remove()
202 return nvmem_unregister(otp->nvmem); in mxs_ocotp_remove()