Lines Matching full:region

3  * FPGA Region - Device Tree support for FPGA programming under Linux
10 #include <linux/fpga/fpga-region.h>
20 { .compatible = "fpga-region", },
26 * of_fpga_region_find - find FPGA region
27 * @np: device node of FPGA Region
29 * Caller will need to put_device(&region->dev) when done.
31 * Return: FPGA Region struct or NULL
40 * @np: device node of FPGA region
42 * Get FPGA Manager from "fpga-mgr" property or from ancestor region.
55 if (of_device_is_compatible(np, "fpga-region")) { in of_fpga_region_get_mgr()
73 * @region: FPGA region
80 * Caller should call fpga_bridges_put(&region->bridge_list) when
86 static int of_fpga_region_get_bridges(struct fpga_region *region) in of_fpga_region_get_bridges() argument
88 struct device *dev = &region->dev; in of_fpga_region_get_bridges()
90 struct fpga_image_info *info = region->info; in of_fpga_region_get_bridges()
96 &region->bridge_list); in of_fpga_region_get_bridges()
128 &region->bridge_list); in of_fpga_region_get_bridges()
133 fpga_bridges_put(&region->bridge_list); in of_fpga_region_get_bridges()
142 * child_regions_with_firmware - Used to check the child region info.
148 * Return: 0 for OK or -EINVAL if child FPGA region adds firmware-name.
172 pr_err("firmware-name not allowed in child FPGA region: %pOF", in child_regions_with_firmware()
179 * of_fpga_region_parse_ov - parse and check overlay applied to region
181 * @region: FPGA region
182 * @overlay: overlay applied to the FPGA region
184 * Given an overlay applied to an FPGA region, parse the FPGA image specific
193 of_fpga_region_parse_ov(struct fpga_region *region, in of_fpga_region_parse_ov() argument
196 struct device *dev = &region->dev; in of_fpga_region_parse_ov()
201 if (region->info) { in of_fpga_region_parse_ov()
202 dev_err(dev, "Region already has overlay applied.\n"); in of_fpga_region_parse_ov()
208 * firmware-name property (would mean that an FPGA region that has in of_fpga_region_parse_ov()
221 /* Read FPGA region properties from the overlay */ in of_fpga_region_parse_ov()
239 of_property_read_u32(overlay, "region-unfreeze-timeout-us", in of_fpga_region_parse_ov()
242 of_property_read_u32(overlay, "region-freeze-timeout-us", in of_fpga_region_parse_ov()
273 * @region: FPGA region that the overlay was applied to
276 * Called when an overlay targeted to an FPGA Region is about to be applied.
284 static int of_fpga_region_notify_pre_apply(struct fpga_region *region, in of_fpga_region_notify_pre_apply() argument
287 struct device *dev = &region->dev; in of_fpga_region_notify_pre_apply()
291 info = of_fpga_region_parse_ov(region, nd->overlay); in of_fpga_region_notify_pre_apply()
299 if (region->info) { in of_fpga_region_notify_pre_apply()
300 dev_err(dev, "Region already has overlay applied.\n"); in of_fpga_region_notify_pre_apply()
304 region->info = info; in of_fpga_region_notify_pre_apply()
305 ret = fpga_region_program_fpga(region); in of_fpga_region_notify_pre_apply()
309 region->info = NULL; in of_fpga_region_notify_pre_apply()
318 * @region: FPGA region that was targeted by the overlay that was removed
322 * FPGA region.
324 static void of_fpga_region_notify_post_remove(struct fpga_region *region, in of_fpga_region_notify_post_remove() argument
327 fpga_bridges_disable(&region->bridge_list); in of_fpga_region_notify_post_remove()
328 fpga_bridges_put(&region->bridge_list); in of_fpga_region_notify_post_remove()
329 fpga_image_info_free(region->info); in of_fpga_region_notify_post_remove()
330 region->info = NULL; in of_fpga_region_notify_post_remove()
340 * added to an fpga-region.
348 struct fpga_region *region; in of_fpga_region_notify() local
368 region = of_fpga_region_find(nd->target); in of_fpga_region_notify()
369 if (!region) in of_fpga_region_notify()
375 ret = of_fpga_region_notify_pre_apply(region, nd); in of_fpga_region_notify()
379 of_fpga_region_notify_post_remove(region, nd); in of_fpga_region_notify()
383 put_device(&region->dev); in of_fpga_region_notify()
399 struct fpga_region *region; in of_fpga_region_probe() local
403 /* Find the FPGA mgr specified by region or parent region. */ in of_fpga_region_probe()
408 region = fpga_region_register(dev, mgr, of_fpga_region_get_bridges); in of_fpga_region_probe()
409 if (IS_ERR(region)) { in of_fpga_region_probe()
410 ret = PTR_ERR(region); in of_fpga_region_probe()
414 of_platform_populate(np, fpga_region_of_match, NULL, &region->dev); in of_fpga_region_probe()
415 platform_set_drvdata(pdev, region); in of_fpga_region_probe()
417 dev_info(dev, "FPGA Region probed\n"); in of_fpga_region_probe()
428 struct fpga_region *region = platform_get_drvdata(pdev); in of_fpga_region_remove() local
429 struct fpga_manager *mgr = region->mgr; in of_fpga_region_remove()
431 fpga_region_unregister(region); in of_fpga_region_remove()
441 .name = "of-fpga-region",
480 MODULE_DESCRIPTION("FPGA Region");