Lines Matching full:region

3  * FPGA Region - Device Tree support for FPGA programming under Linux
10 #include <linux/fpga/fpga-region.h>
22 { .compatible = "fpga-region", },
28 * of_fpga_region_find - find FPGA region
29 * @np: device node of FPGA Region
31 * Caller will need to put_device(&region->dev) when done.
33 * Return: FPGA Region struct or NULL
42 * @np: device node of FPGA region
44 * Get FPGA Manager from "fpga-mgr" property or from ancestor region.
57 if (of_device_is_compatible(np, "fpga-region")) { in of_fpga_region_get_mgr()
75 * @region: FPGA region
82 * Caller should call fpga_bridges_put(&region->bridge_list) when
88 static int of_fpga_region_get_bridges(struct fpga_region *region) in of_fpga_region_get_bridges() argument
90 struct device *dev = &region->dev; in of_fpga_region_get_bridges()
92 struct fpga_image_info *info = region->info; in of_fpga_region_get_bridges()
98 &region->bridge_list); in of_fpga_region_get_bridges()
130 &region->bridge_list); in of_fpga_region_get_bridges()
135 fpga_bridges_put(&region->bridge_list); in of_fpga_region_get_bridges()
144 * child_regions_with_firmware - Used to check the child region info.
150 * Return: 0 for OK or -EINVAL if child FPGA region adds firmware-name.
174 pr_err("firmware-name not allowed in child FPGA region: %pOF", in child_regions_with_firmware()
181 * of_fpga_region_parse_ov - parse and check overlay applied to region
183 * @region: FPGA region
184 * @overlay: overlay applied to the FPGA region
186 * Given an overlay applied to an FPGA region, parse the FPGA image specific
195 of_fpga_region_parse_ov(struct fpga_region *region, in of_fpga_region_parse_ov() argument
198 struct device *dev = &region->dev; in of_fpga_region_parse_ov()
203 if (region->info) { in of_fpga_region_parse_ov()
204 dev_err(dev, "Region already has overlay applied.\n"); in of_fpga_region_parse_ov()
210 * firmware-name property (would mean that an FPGA region that has in of_fpga_region_parse_ov()
223 /* Read FPGA region properties from the overlay */ in of_fpga_region_parse_ov()
241 of_property_read_u32(overlay, "region-unfreeze-timeout-us", in of_fpga_region_parse_ov()
244 of_property_read_u32(overlay, "region-freeze-timeout-us", in of_fpga_region_parse_ov()
275 * @region: FPGA region that the overlay was applied to
278 * Called when an overlay targeted to an FPGA Region is about to be applied.
286 static int of_fpga_region_notify_pre_apply(struct fpga_region *region, in of_fpga_region_notify_pre_apply() argument
289 struct device *dev = &region->dev; in of_fpga_region_notify_pre_apply()
293 info = of_fpga_region_parse_ov(region, nd->overlay); in of_fpga_region_notify_pre_apply()
301 if (region->info) { in of_fpga_region_notify_pre_apply()
302 dev_err(dev, "Region already has overlay applied.\n"); in of_fpga_region_notify_pre_apply()
306 region->info = info; in of_fpga_region_notify_pre_apply()
307 ret = fpga_region_program_fpga(region); in of_fpga_region_notify_pre_apply()
311 region->info = NULL; in of_fpga_region_notify_pre_apply()
320 * @region: FPGA region that was targeted by the overlay that was removed
324 * FPGA region.
326 static void of_fpga_region_notify_post_remove(struct fpga_region *region, in of_fpga_region_notify_post_remove() argument
329 fpga_bridges_disable(&region->bridge_list); in of_fpga_region_notify_post_remove()
330 fpga_bridges_put(&region->bridge_list); in of_fpga_region_notify_post_remove()
331 fpga_image_info_free(region->info); in of_fpga_region_notify_post_remove()
332 region->info = NULL; in of_fpga_region_notify_post_remove()
342 * added to an fpga-region.
350 struct fpga_region *region; in of_fpga_region_notify() local
370 region = of_fpga_region_find(nd->target); in of_fpga_region_notify()
371 if (!region) in of_fpga_region_notify()
377 ret = of_fpga_region_notify_pre_apply(region, nd); in of_fpga_region_notify()
381 of_fpga_region_notify_post_remove(region, nd); in of_fpga_region_notify()
385 put_device(&region->dev); in of_fpga_region_notify()
401 struct fpga_region *region; in of_fpga_region_probe() local
405 /* Find the FPGA mgr specified by region or parent region. */ in of_fpga_region_probe()
410 region = fpga_region_register(dev, mgr, of_fpga_region_get_bridges); in of_fpga_region_probe()
411 if (IS_ERR(region)) { in of_fpga_region_probe()
412 ret = PTR_ERR(region); in of_fpga_region_probe()
416 of_platform_populate(np, fpga_region_of_match, NULL, &region->dev); in of_fpga_region_probe()
417 platform_set_drvdata(pdev, region); in of_fpga_region_probe()
419 dev_info(dev, "FPGA Region probed\n"); in of_fpga_region_probe()
430 struct fpga_region *region = platform_get_drvdata(pdev); in of_fpga_region_remove() local
431 struct fpga_manager *mgr = region->mgr; in of_fpga_region_remove()
433 fpga_region_unregister(region); in of_fpga_region_remove()
443 .name = "of-fpga-region",
482 MODULE_DESCRIPTION("FPGA Region");