FPGA Bridge¶
API to implement a new FPGA bridge¶
-
struct
fpga_bridge
¶ FPGA bridge structure
Definition
struct fpga_bridge {
const char *name;
struct device dev;
struct mutex mutex;
const struct fpga_bridge_ops *br_ops;
struct fpga_image_info *info;
struct list_head node;
void *priv;
};
Members
name
- name of low level FPGA bridge
dev
- FPGA bridge device
mutex
- enforces exclusive reference to bridge
br_ops
- pointer to struct of FPGA bridge ops
info
- fpga image specific information
node
- FPGA bridge list node
priv
- low level driver private date
-
struct
fpga_bridge_ops
¶ ops for low level FPGA bridge drivers
Definition
struct fpga_bridge_ops {
int (*enable_show)(struct fpga_bridge *bridge);
int (*enable_set)(struct fpga_bridge *bridge, bool enable);
void (*fpga_bridge_remove)(struct fpga_bridge *bridge);
const struct attribute_group **groups;
};
Members
enable_show
- returns the FPGA bridge’s status
enable_set
- set a FPGA bridge as enabled or disabled
fpga_bridge_remove
- set FPGA into a specific state during driver remove
groups
- optional attribute groups.
-
struct fpga_bridge *
fpga_bridge_create
(struct device * dev, const char * name, const struct fpga_bridge_ops * br_ops, void * priv)¶ create and initialize a struct fpga_bridge
Parameters
struct device * dev
- FPGA bridge device from pdev
const char * name
- FPGA bridge name
const struct fpga_bridge_ops * br_ops
- pointer to structure of fpga bridge ops
void * priv
- FPGA bridge private data
Return
struct fpga_bridge or NULL
-
void
fpga_bridge_free
(struct fpga_bridge * bridge)¶ free a fpga bridge and its id
Parameters
struct fpga_bridge * bridge
- FPGA bridge struct created by fpga_bridge_create
-
int
fpga_bridge_register
(struct fpga_bridge * bridge)¶ register a fpga bridge
Parameters
struct fpga_bridge * bridge
- FPGA bridge struct created by fpga_bridge_create
Return
0 for success, error code otherwise.
-
void
fpga_bridge_unregister
(struct fpga_bridge * bridge)¶ unregister and free a fpga bridge
Parameters
struct fpga_bridge * bridge
- FPGA bridge struct created by fpga_bridge_create
API to control an FPGA bridge¶
You probably won’t need these directly. FPGA regions should handle this.
-
struct fpga_bridge *
of_fpga_bridge_get
(struct device_node * np, struct fpga_image_info * info)¶ get an exclusive reference to a fpga bridge
Parameters
struct device_node * np
- node pointer of a FPGA bridge
struct fpga_image_info * info
- fpga image specific information
Description
Return fpga_bridge struct if successful. Return -EBUSY if someone already has a reference to the bridge. Return -ENODEV if np is not a FPGA Bridge.
-
struct fpga_bridge *
fpga_bridge_get
(struct device * dev, struct fpga_image_info * info)¶ get an exclusive reference to a fpga bridge
Parameters
struct device * dev
- parent device that fpga bridge was registered with
struct fpga_image_info * info
- fpga manager info
Description
Given a device, get an exclusive reference to a fpga bridge.
Return
fpga manager struct or IS_ERR()
condition containing error code.
-
void
fpga_bridge_put
(struct fpga_bridge * bridge)¶ release a reference to a bridge
Parameters
struct fpga_bridge * bridge
- FPGA bridge
-
int
fpga_bridge_get_to_list
(struct device * dev, struct fpga_image_info * info, struct list_head * bridge_list)¶ given device, get a bridge, add it to a list
Parameters
struct device * dev
- FPGA bridge device
struct fpga_image_info * info
- fpga image specific information
struct list_head * bridge_list
- list of FPGA bridges
Description
Get an exclusive reference to the bridge and and it to the list.
Return 0 for success, error code from fpga_bridge_get()
othewise.
-
int
of_fpga_bridge_get_to_list
(struct device_node * np, struct fpga_image_info * info, struct list_head * bridge_list)¶ get a bridge, add it to a list
Parameters
struct device_node * np
- node pointer of a FPGA bridge
struct fpga_image_info * info
- fpga image specific information
struct list_head * bridge_list
- list of FPGA bridges
Description
Get an exclusive reference to the bridge and and it to the list.
Return 0 for success, error code from of_fpga_bridge_get()
othewise.
-
int
fpga_bridge_enable
(struct fpga_bridge * bridge)¶ Enable transactions on the bridge
Parameters
struct fpga_bridge * bridge
- FPGA bridge
Return
0 for success, error code otherwise.
-
int
fpga_bridge_disable
(struct fpga_bridge * bridge)¶ Disable transactions on the bridge
Parameters
struct fpga_bridge * bridge
- FPGA bridge
Return
0 for success, error code otherwise.