fdt_pinctrl.c (f7604b1b275455fc5506c3c83a4876f567bbc6b3) | fdt_pinctrl.c (413d07ea3e71296c89bc89bfc910df4cdd325adf) |
---|---|
1/*- 2 * Copyright (c) 2014 Ian Lepore <ian@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 92 unchanged lines hidden (view full) --- 101 } 102 return (0); 103} 104 105int 106fdt_pinctrl_register(device_t pinctrl, const char *pinprop) 107{ 108 phandle_t node; | 1/*- 2 * Copyright (c) 2014 Ian Lepore <ian@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 92 unchanged lines hidden (view full) --- 101 } 102 return (0); 103} 104 105int 106fdt_pinctrl_register(device_t pinctrl, const char *pinprop) 107{ 108 phandle_t node; |
109 int ret; |
|
109 | 110 |
111 TSENTER(); |
|
110 node = ofw_bus_get_node(pinctrl); 111 OF_device_register_xref(OF_xref_from_node(node), pinctrl); | 112 node = ofw_bus_get_node(pinctrl); 113 OF_device_register_xref(OF_xref_from_node(node), pinctrl); |
112 return (pinctrl_register_children(pinctrl, node, pinprop)); | 114 ret = pinctrl_register_children(pinctrl, node, pinprop); 115 TSEXIT(); 116 117 return (ret); |
113} 114 115static int 116pinctrl_configure_children(device_t pinctrl, phandle_t parent) 117{ 118 phandle_t node, *configs; 119 int i, nconfigs; 120 | 118} 119 120static int 121pinctrl_configure_children(device_t pinctrl, phandle_t parent) 122{ 123 phandle_t node, *configs; 124 int i, nconfigs; 125 |
126 TSENTER(); 127 |
|
121 for (node = OF_child(parent); node != 0; node = OF_peer(node)) { 122 if (!ofw_bus_node_status_okay(node)) 123 continue; 124 pinctrl_configure_children(pinctrl, node); 125 nconfigs = OF_getencprop_alloc_multi(node, "pinctrl-0", 126 sizeof(*configs), (void **)&configs); 127 if (nconfigs <= 0) 128 continue; --- 4 unchanged lines hidden (view full) --- 133 nconfigs, name); 134 } 135 for (i = 0; i < nconfigs; i++) { 136 if (OF_device_from_xref(configs[i]) == pinctrl) 137 FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]); 138 } 139 OF_prop_free(configs); 140 } | 128 for (node = OF_child(parent); node != 0; node = OF_peer(node)) { 129 if (!ofw_bus_node_status_okay(node)) 130 continue; 131 pinctrl_configure_children(pinctrl, node); 132 nconfigs = OF_getencprop_alloc_multi(node, "pinctrl-0", 133 sizeof(*configs), (void **)&configs); 134 if (nconfigs <= 0) 135 continue; --- 4 unchanged lines hidden (view full) --- 140 nconfigs, name); 141 } 142 for (i = 0; i < nconfigs; i++) { 143 if (OF_device_from_xref(configs[i]) == pinctrl) 144 FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]); 145 } 146 OF_prop_free(configs); 147 } |
148 TSEXIT(); |
|
141 return (0); 142} 143 144int 145fdt_pinctrl_configure_tree(device_t pinctrl) 146{ 147 148 return (pinctrl_configure_children(pinctrl, OF_peer(0))); 149} 150 | 149 return (0); 150} 151 152int 153fdt_pinctrl_configure_tree(device_t pinctrl) 154{ 155 156 return (pinctrl_configure_children(pinctrl, OF_peer(0))); 157} 158 |