Lines Matching full:feature

3  * Driver for FPGA Device Feature List (DFL) Support
24 * when adding a new feature dev support in DFL framework, it's required to
30 * if the new feature dev needs chardev support, then it's required to add
49 * struct dfl_dev_info - dfl feature device information.
50 * @name: name string of the feature platform device.
51 * @dfh_id: id value in Device Feature Header (DFH) register by DFL spec.
52 * @id: idr id of the feature dev.
71 * struct dfl_chardev_info - chardev information of dfl feature device
146 * in such list, then other feature devices (e.g. FME), could use the port
355 struct dfl_feature *feature) in dfl_dev_add() argument
384 ddev->feature_id = feature->id; in dfl_dev_add()
385 ddev->revision = feature->revision; in dfl_dev_add()
386 ddev->dfh_version = feature->dfh_version; in dfl_dev_add()
388 if (feature->param_size) { in dfl_dev_add()
389 ddev->params = kmemdup(feature->params, feature->param_size, GFP_KERNEL); in dfl_dev_add()
394 ddev->param_size = feature->param_size; in dfl_dev_add()
398 parent_res = &pdev->resource[feature->resource_index]; in dfl_dev_add()
411 if (feature->nr_irqs) { in dfl_dev_add()
412 ddev->irqs = kcalloc(feature->nr_irqs, in dfl_dev_add()
419 for (i = 0; i < feature->nr_irqs; i++) in dfl_dev_add()
420 ddev->irqs[i] = feature->irq_ctx[i].irq; in dfl_dev_add()
422 ddev->num_irqs = feature->nr_irqs; in dfl_dev_add()
440 struct dfl_feature *feature; in dfl_devs_remove() local
442 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_devs_remove()
443 if (feature->ddev) { in dfl_devs_remove()
444 device_unregister(&feature->ddev->dev); in dfl_devs_remove()
445 feature->ddev = NULL; in dfl_devs_remove()
452 struct dfl_feature *feature; in dfl_devs_add() local
456 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_devs_add()
457 if (feature->ioaddr) in dfl_devs_add()
460 if (feature->ddev) { in dfl_devs_add()
465 ddev = dfl_dev_add(pdata, feature); in dfl_devs_add()
471 feature->ddev = ddev; in dfl_devs_add()
499 #define is_header_feature(feature) ((feature)->id == FEATURE_ID_FIU_HEADER) argument
502 * dfl_fpga_dev_feature_uinit - uinit for sub features of dfl feature device
503 * @pdev: feature device.
508 struct dfl_feature *feature; in dfl_fpga_dev_feature_uinit() local
512 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_fpga_dev_feature_uinit()
513 if (feature->ops) { in dfl_fpga_dev_feature_uinit()
514 if (feature->ops->uinit) in dfl_fpga_dev_feature_uinit()
515 feature->ops->uinit(pdev, feature); in dfl_fpga_dev_feature_uinit()
516 feature->ops = NULL; in dfl_fpga_dev_feature_uinit()
524 struct dfl_feature *feature, in dfl_feature_instance_init() argument
530 if (!is_header_feature(feature)) { in dfl_feature_instance_init()
532 feature->resource_index); in dfl_feature_instance_init()
535 "ioremap failed for feature 0x%x!\n", in dfl_feature_instance_init()
536 feature->id); in dfl_feature_instance_init()
540 feature->ioaddr = base; in dfl_feature_instance_init()
544 ret = drv->ops->init(pdev, feature); in dfl_feature_instance_init()
549 feature->ops = drv->ops; in dfl_feature_instance_init()
554 static bool dfl_feature_drv_match(struct dfl_feature *feature, in dfl_feature_drv_match() argument
561 if (ids->id == feature->id) in dfl_feature_drv_match()
570 * dfl_fpga_dev_feature_init - init for sub features of dfl feature device
571 * @pdev: feature device.
574 * This function will match sub features with given feature drvs list and
575 * use matched drv to init related sub feature.
584 struct dfl_feature *feature; in dfl_fpga_dev_feature_init() local
588 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_fpga_dev_feature_init()
589 if (dfl_feature_drv_match(feature, drv)) { in dfl_fpga_dev_feature_init()
591 feature, drv); in dfl_fpga_dev_feature_init()
649 * dfl_fpga_dev_ops_register - register cdev ops for feature dev
651 * @pdev: feature dev.
652 * @fops: file operations for feature dev's cdev.
667 * set parent to the feature device so that its refcount is in dfl_fpga_dev_ops_register()
669 * makes sure the feature device is valid during device in dfl_fpga_dev_ops_register()
679 * dfl_fpga_dev_ops_unregister - unregister cdev ops for feature dev
680 * @pdev: feature dev.
691 * struct build_feature_devs_info - info collected during feature dev build.
694 * @cdev: the container device for all feature devices.
695 * @nr_irqs: number of irqs for all feature devices.
698 * @feature_dev: current feature device.
702 * @sub_features: a sub features linked list for feature device in enumeration.
703 * @feature_num: number of sub features for feature device in enumeration.
720 * struct dfl_feature_info - sub feature info collected during feature dev build
722 * @fid: id of this sub feature.
723 * @revision: revision of this sub feature
724 * @dfh_version: version of Device Feature Header (DFH)
725 * @mmio_res: mmio resource of this sub feature.
728 * @irq_base: start of irq index in this sub feature.
729 * @nr_irqs: number of irqs of this sub feature.
758 * register current feature device, it is called when we need to switch to
759 * another feature parsing or we have parsed all features on given device
760 * feature list.
802 /* each sub feature has one MMIO resource */ in build_info_commit_dev()
809 /* fill features and resource information for feature dev */ in build_info_commit_dev()
811 struct dfl_feature *feature = &pdata->features[index++]; in build_info_commit_dev() local
815 /* save resource information for each feature */ in build_info_commit_dev()
816 feature->dev = fdev; in build_info_commit_dev()
817 feature->id = finfo->fid; in build_info_commit_dev()
818 feature->revision = finfo->revision; in build_info_commit_dev()
819 feature->dfh_version = finfo->dfh_version; in build_info_commit_dev()
822 feature->params = devm_kmemdup(binfo->dev, in build_info_commit_dev()
825 if (!feature->params) in build_info_commit_dev()
828 feature->param_size = finfo->param_size; in build_info_commit_dev()
831 * the FIU header feature has some fundamental functions (sriov in build_info_commit_dev()
834 * DFL bus device. And we should not assign it to feature in build_info_commit_dev()
837 if (is_header_feature(feature)) { in build_info_commit_dev()
838 feature->resource_index = -1; in build_info_commit_dev()
839 feature->ioaddr = in build_info_commit_dev()
842 if (IS_ERR(feature->ioaddr)) in build_info_commit_dev()
843 return PTR_ERR(feature->ioaddr); in build_info_commit_dev()
845 feature->resource_index = res_idx; in build_info_commit_dev()
859 feature->irq_ctx = ctx; in build_info_commit_dev()
860 feature->nr_irqs = finfo->nr_irqs; in build_info_commit_dev()
878 * The resource of successfully registered feature devices in build_info_commit_dev()
1023 * DFHv0 only provides MMIO resource information for each feature in parse_feature_irqs()
1026 * the information in feature specific registers. in parse_feature_irqs()
1078 dev_dbg(binfo->dev, "feature: 0x%x, irq_base: %u, nr_irqs: %u\n", in parse_feature_irqs()
1083 "Invalid interrupt number in feature 0x%x\n", fid); in parse_feature_irqs()
1091 "Invalid irq table entry for feature 0x%x\n", in parse_feature_irqs()
1129 * when create sub feature instances, for private features, it doesn't need
1130 * to provide resource size and feature id as they could be read from DFH
1131 * register. For afu sub feature, its register region only contains user
1151 /* read feature size and id if inputs are invalid */ in create_feature_instance()
1297 /* create platform device for dfl feature dev */ in parse_feature_fiu()
1324 dev_err(binfo->dev, "the private feature 0x%x does not belong to any AFU.\n", in parse_feature_private()
1333 * parse_feature - parse a feature on given device feature list
1335 * @binfo: build feature devices information.
1356 "Feature Type %x is not supported.\n", type); in parse_feature()
1374 /* walk through the device feature list via DFH's next DFH pointer. */ in parse_feature_list()
1377 dev_err(binfo->dev, "The region is too small to contain a feature.\n"); in parse_feature_list()
1393 /* commit current feature device when reach the end of list */ in parse_feature_list()
1431 /* remove all device feature lists in the list. */ in dfl_fpga_enum_info_free()
1447 * dfl_fpga_enum_info_add_dfl - add info of a device feature list to enum info
1450 * @start: mmio resource address of the device feature list.
1451 * @len: mmio resource length of the device feature list.
1453 * One FPGA device may have one or more Device Feature Lists (DFLs), use this
1535 * dfl_fpga_feature_devs_enumerate - enumerate feature devices
1539 * feature devices based on the enumeration info and creates platform devices
1584 * start enumeration for all feature devices based on Device Feature in dfl_fpga_feature_devs_enumerate()
1609 * dfl_fpga_feature_devs_remove - remove all feature devices
1612 * Remove the container device and all feature devices under given container
1879 static int do_set_irq_trigger(struct dfl_feature *feature, unsigned int idx, in do_set_irq_trigger() argument
1882 struct platform_device *pdev = feature->dev; in do_set_irq_trigger()
1886 irq = feature->irq_ctx[idx].irq; in do_set_irq_trigger()
1888 if (feature->irq_ctx[idx].trigger) { in do_set_irq_trigger()
1889 free_irq(irq, feature->irq_ctx[idx].trigger); in do_set_irq_trigger()
1890 kfree(feature->irq_ctx[idx].name); in do_set_irq_trigger()
1891 eventfd_ctx_put(feature->irq_ctx[idx].trigger); in do_set_irq_trigger()
1892 feature->irq_ctx[idx].trigger = NULL; in do_set_irq_trigger()
1898 feature->irq_ctx[idx].name = in do_set_irq_trigger()
1900 dev_name(&pdev->dev), feature->id); in do_set_irq_trigger()
1901 if (!feature->irq_ctx[idx].name) in do_set_irq_trigger()
1911 feature->irq_ctx[idx].name, trigger); in do_set_irq_trigger()
1913 feature->irq_ctx[idx].trigger = trigger; in do_set_irq_trigger()
1919 kfree(feature->irq_ctx[idx].name); in do_set_irq_trigger()
1925 * dfl_fpga_set_irq_triggers - set eventfd triggers for dfl feature interrupts
1927 * @feature: dfl sub feature.
1928 * @start: start of irq index in this dfl sub feature.
1933 * Bind given eventfds with irqs in this dfl sub feature. Unbind related irq if
1939 int dfl_fpga_set_irq_triggers(struct dfl_feature *feature, unsigned int start, in dfl_fpga_set_irq_triggers() argument
1950 if (start + count > feature->nr_irqs) in dfl_fpga_set_irq_triggers()
1956 ret = do_set_irq_trigger(feature, start + i, fd); in dfl_fpga_set_irq_triggers()
1959 do_set_irq_trigger(feature, start + i, -1); in dfl_fpga_set_irq_triggers()
1969 * dfl_feature_ioctl_get_num_irqs - dfl feature _GET_IRQ_NUM ioctl interface.
1970 * @pdev: the feature device which has the sub feature
1971 * @feature: the dfl sub feature
1977 struct dfl_feature *feature, in dfl_feature_ioctl_get_num_irqs() argument
1980 return put_user(feature->nr_irqs, (__u32 __user *)arg); in dfl_feature_ioctl_get_num_irqs()
1985 * dfl_feature_ioctl_set_irq - dfl feature _SET_IRQ ioctl interface.
1986 * @pdev: the feature device which has the sub feature
1987 * @feature: the dfl sub feature
1993 struct dfl_feature *feature, in dfl_feature_ioctl_set_irq() argument
2001 if (!feature->nr_irqs) in dfl_feature_ioctl_set_irq()
2007 if (!hdr.count || (hdr.start + hdr.count > feature->nr_irqs) || in dfl_feature_ioctl_set_irq()
2017 ret = dfl_fpga_set_irq_triggers(feature, hdr.start, hdr.count, fds); in dfl_feature_ioctl_set_irq()
2035 MODULE_DESCRIPTION("FPGA Device Feature List (DFL) Support");