fwnode_graph_get_endpoint_by_id() is intended for obtaining local endpoints by a given local port. fwnode_graph_get_endpoint_by_id() is slightly different from its OF counterpart, of_graph_get_endpoint_by_regs(): instead of using -1 as a value to indicate that a port or an endpoint number does not matter, it uses flags to look for equal or greater endpoint. The port number is always fixed. It also returns only remote endpoints that belong to an available device, a behaviour that can be turned off with a flag.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #ifndef _LINUX_PROPERTY_H_ | 13 | #ifndef _LINUX_PROPERTY_H_ |
| 14 | #define _LINUX_PROPERTY_H_ | 14 | #define _LINUX_PROPERTY_H_ |
| 15 | 15 | ||
| 16 | #include <linux/bits.h> | ||
| 16 | #include <linux/fwnode.h> | 17 | #include <linux/fwnode.h> |
| 17 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 18 | 19 | ||
| @@ -304,6 +305,23 @@ struct fwnode_handle * · 285 unmodified lines | |||
| 304 | fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port, | 305 | fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port, |
| 305 | u32 endpoint); | 306 | u32 endpoint); |
| 306 | 307 | ||
| 308 | /* | ||
| 309 | * Fwnode lookup flags | ||
| 310 | * | ||
| 311 | * @FWNODE_GRAPH_ENDPOINT_NEXT: In the case of no exact match, look for the | ||
| 312 | * closest endpoint ID greater than the specified | ||
| 313 | * one. | ||
| 314 | * @FWNODE_GRAPH_DEVICE_DISABLED: That the device to which the remote | ||
| 315 | * endpoint of the given endpoint belongs to, | ||
| 316 | * may be disabled. | ||
| 317 | */ | ||
| 318 | #define FWNODE_GRAPH_ENDPOINT_NEXT BIT(0) | ||
| 319 | #define FWNODE_GRAPH_DEVICE_DISABLED BIT(1) | ||
| 320 | |||
| 321 | struct fwnode_handle * | ||
| 322 | fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode, | ||
| 323 | u32 port, u32 endpoint, unsigned long flags); | ||
| 324 | |||
| 307 | #define fwnode_graph_for_each_endpoint(fwnode, child) \ | 325 | #define fwnode_graph_for_each_endpoint(fwnode, child) \ |
| 308 | for (child = NULL; \ | 326 | for (child = NULL; \ |
| 309 | (child = fwnode_graph_get_next_endpoint(fwnode, child)); ) | 327 | (child = fwnode_graph_get_next_endpoint(fwnode, child)); ) |