This patch introduces a new helper routine - fwnode_iomap(), which allows to map the memory mapped IO for a given device node. This implementation does not cover the ACPI case and may be expanded in the future. The main purpose here is to be able to develop resource provider agnostic drivers.
Showing the changes to drivers (1 of 2 files). Show all
Unified · Split
| @@ -958,6 +958,22 @@ int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) · 957 unmodified lines | |||
| 958 | } | 958 | } |
| 959 | EXPORT_SYMBOL(fwnode_irq_get); | 959 | EXPORT_SYMBOL(fwnode_irq_get); |
| 960 | 960 | ||
| 961 | /** | ||
| 962 | * fwnode_iomap - Maps the memory mapped IO for a given fwnode | ||
| 963 | * @fwnode: Pointer to the firmware node | ||
| 964 | * @index: Index of the IO range | ||
| 965 | * | ||
| 966 | * Returns a pointer to the mapped memory. | ||
| 967 | */ | ||
| 968 | void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index) | ||
| 969 | { | ||
| 970 | if (IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode)) | ||
| 971 | return of_iomap(to_of_node(fwnode), index); | ||
| 972 | |||
| 973 | return NULL; | ||
| 974 | } | ||
| 975 | EXPORT_SYMBOL(fwnode_iomap); | ||
| 976 | |||
| 961 | /** | 977 | /** |
| 962 | * fwnode_graph_get_next_endpoint - Get next endpoint firmware node | 978 | * fwnode_graph_get_next_endpoint - Get next endpoint firmware node |
| 963 | * @fwnode: Pointer to the parent firmware node | 979 | * @fwnode: Pointer to the parent firmware node |