On Mon, Jun 21, 2021 at 7:14 PM Kuninori Morimoto kuninori.morimoto.gx@renesas.com wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
We have endpoint base functions - of_graph_get_next_endpoint() - of_graph_get_endpoint_count() - for_each_endpoint_of_node()
for_each_endpoint_of_node() loop finds endpoint.
ports { port@0 {
(1) endpoint {...}; }; port@1 { (2) endpoint {...}; }; ... };
In above case, for_each_endpoint_of_node() loop finds endpoint as (1) -> (2) -> ...
Wanting to iterate endpoints across ports like that is odd given the ports represent different things. I think you will find there aren't too many users as I tried to get rid of most of them some time ago. (I'm sure more have slipped in)
If we want to get port@0 -> port@1 -> ... instead of endpoint, we need do like below
for_each_endpoint_of_node(node, endpoint) { port = of_get_parent(endpoint); ... }
But port might have multi endpoints.
ports { port@0 {
(1) endpoint@0 {...}; (2) endpoint@1 {...}; }; port@1 { (3) endpoint {...}; }; ... };
In such case, people want to have "port base" loop instead of "endpoints base" loop. This patch adds such functions/macros.
As bindings should be defining what each port number represents, I don't think iterating thru them without regard to port numbers is the right model. Drivers should be requesting specific port numbers.
Rob