Lines Matching +full:burst +full:- +full:clk +full:- +full:enable
11 #include <linux/clk.h>
19 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
78 { .compatible = "fsl,imx1-weim", .data = &imx1_weim_devtype, },
80 { .compatible = "fsl,imx27-weim", .data = &imx27_weim_devtype, },
82 { .compatible = "fsl,imx50-weim", .data = &imx50_weim_devtype, },
83 { .compatible = "fsl,imx6q-weim", .data = &imx50_weim_devtype, },
85 { .compatible = "fsl,imx51-weim", .data = &imx51_weim_devtype, },
92 struct device_node *np = pdev->dev.of_node; in imx_weim_gpr_setup()
107 gpr = syscon_regmap_lookup_by_phandle(np, "fsl,weim-cs-gpr"); in imx_weim_gpr_setup()
109 dev_dbg(&pdev->dev, "failed to find weim-cs-gpr\n"); in imx_weim_gpr_setup()
135 dev_err(&pdev->dev, "Invalid 'ranges' configuration\n"); in imx_weim_gpr_setup()
136 return -EINVAL; in imx_weim_gpr_setup()
151 if (WARN_ON(devtype->cs_regs_count > MAX_CS_REGS_COUNT)) in weim_timing_setup()
152 return -EINVAL; in weim_timing_setup()
153 if (WARN_ON(devtype->cs_count > MAX_CS_COUNT)) in weim_timing_setup()
154 return -EINVAL; in weim_timing_setup()
157 base = priv->base; in weim_timing_setup()
158 ts = &priv->timing_state; in weim_timing_setup()
160 ret = of_property_read_u32_array(np, "fsl,weim-cs-timing", in weim_timing_setup()
161 value, devtype->cs_regs_count); in weim_timing_setup()
173 return -EINVAL; in weim_timing_setup()
181 if (cs_idx >= devtype->cs_count) in weim_timing_setup()
182 return -EINVAL; in weim_timing_setup()
184 /* prevent re-configuring a CS that's already been configured */ in weim_timing_setup()
185 cst = &ts->cs[cs_idx]; in weim_timing_setup()
186 if (cst->is_applied && memcmp(value, cst->regs, in weim_timing_setup()
187 devtype->cs_regs_count * sizeof(u32))) { in weim_timing_setup()
188 dev_err(dev, "fsl,weim-cs-timing conflict on %pOF", np); in weim_timing_setup()
189 return -EINVAL; in weim_timing_setup()
193 for (i = 0; i < devtype->cs_regs_count; i++) in weim_timing_setup()
195 base + cs_idx * devtype->cs_stride + i * 4); in weim_timing_setup()
196 if (!cst->is_applied) { in weim_timing_setup()
197 cst->is_applied = true; in weim_timing_setup()
198 memcpy(cst->regs, value, in weim_timing_setup()
199 devtype->cs_regs_count * sizeof(u32)); in weim_timing_setup()
208 const struct imx_weim_devtype *devtype = device_get_match_data(&pdev->dev); in weim_parse_dt()
221 priv = dev_get_drvdata(&pdev->dev); in weim_parse_dt()
222 base = priv->base; in weim_parse_dt()
224 if (of_property_read_bool(pdev->dev.of_node, "fsl,burst-clk-enable")) { in weim_parse_dt()
225 if (devtype->wcr_bcm) { in weim_parse_dt()
226 reg = readl(base + devtype->wcr_offset); in weim_parse_dt()
227 reg |= devtype->wcr_bcm; in weim_parse_dt()
229 if (of_property_read_bool(pdev->dev.of_node, in weim_parse_dt()
230 "fsl,continuous-burst-clk")) { in weim_parse_dt()
231 if (devtype->wcr_cont_bclk) { in weim_parse_dt()
232 reg |= devtype->wcr_cont_bclk; in weim_parse_dt()
234 dev_err(&pdev->dev, in weim_parse_dt()
235 "continuous burst clk not supported.\n"); in weim_parse_dt()
236 return -EINVAL; in weim_parse_dt()
240 writel(reg, base + devtype->wcr_offset); in weim_parse_dt()
242 dev_err(&pdev->dev, "burst clk mode not supported.\n"); in weim_parse_dt()
243 return -EINVAL; in weim_parse_dt()
247 for_each_available_child_of_node(pdev->dev.of_node, child) { in weim_parse_dt()
248 ret = weim_timing_setup(&pdev->dev, child, devtype); in weim_parse_dt()
250 dev_warn(&pdev->dev, "%pOF set timing failed.\n", in weim_parse_dt()
257 ret = of_platform_default_populate(pdev->dev.of_node, in weim_parse_dt()
258 NULL, &pdev->dev); in weim_parse_dt()
260 dev_err(&pdev->dev, "%pOF fail to create devices.\n", in weim_parse_dt()
261 pdev->dev.of_node); in weim_parse_dt()
268 struct clk *clk; in weim_probe() local
272 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in weim_probe()
274 return -ENOMEM; in weim_probe()
281 priv->base = base; in weim_probe()
282 dev_set_drvdata(&pdev->dev, priv); in weim_probe()
285 clk = devm_clk_get_enabled(&pdev->dev, NULL); in weim_probe()
286 if (IS_ERR(clk)) in weim_probe()
287 return PTR_ERR(clk); in weim_probe()
294 dev_info(&pdev->dev, "Driver registered.\n"); in weim_probe()
311 of_id = of_match_node(weim_id_table, rd->dn->parent); in of_weim_notify()
315 devtype = of_id->data; in of_weim_notify()
317 pdev = of_find_device_by_node(rd->dn->parent); in of_weim_notify()
320 __func__, rd->dn->parent); in of_weim_notify()
322 return notifier_from_errno(-EINVAL); in of_weim_notify()
325 if (weim_timing_setup(&pdev->dev, rd->dn, devtype)) in of_weim_notify()
326 dev_warn(&pdev->dev, in of_weim_notify()
327 "Failed to setup timing for '%pOF'\n", rd->dn); in of_weim_notify()
329 if (!of_node_check_flag(rd->dn, OF_POPULATED)) { in of_weim_notify()
335 rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE; in of_weim_notify()
336 if (!of_platform_device_create(rd->dn, NULL, &pdev->dev)) { in of_weim_notify()
337 dev_err(&pdev->dev, in of_weim_notify()
339 rd->dn); in of_weim_notify()
340 ret = notifier_from_errno(-EINVAL); in of_weim_notify()
348 if (!of_node_check_flag(rd->dn, OF_POPULATED)) in of_weim_notify()
351 of_id = of_match_node(weim_id_table, rd->dn->parent); in of_weim_notify()
355 pdev = of_find_device_by_node(rd->dn); in of_weim_notify()
358 rd->dn); in of_weim_notify()
360 ret = notifier_from_errno(-EINVAL); in of_weim_notify()
362 of_platform_device_destroy(&pdev->dev, NULL); in of_weim_notify()
381 .name = "imx-weim",