| 155 | } |
| 156 | |
| 157 | static int |
| 158 | mtk_pinctrl_configure(device_t dev, phandle_t cfgxref) |
| 159 | { |
| 160 | struct mtk_pin_group *pintable; |
| 161 | phandle_t node, child; |
| 162 | uint32_t socid; |
| 163 | int ret; |
| 164 | |
| 165 | node = OF_node_from_xref(cfgxref); |
| 166 | ret = 0; |
| 167 | |
| 168 | /* Now, get the system type, so we can get the proper GPIO mode array */ |
| 169 | socid = mtk_soc_get_socid(); |
| 170 | |
| 171 | switch (socid) { |
| 172 | case MTK_SOC_RT2880: |
| 173 | pintable = rt2880_pintable; |
| 174 | break; |
| 175 | case MTK_SOC_RT3050: /* fallthrough */ |
| 176 | case MTK_SOC_RT3052: |
| 177 | case MTK_SOC_RT3350: |
| 178 | pintable = rt3050_pintable; |
| 179 | break; |
| 180 | case MTK_SOC_RT3352: |
| 181 | pintable = rt3352_pintable; |
| 182 | break; |
| 183 | case MTK_SOC_RT3662: /* fallthrough */ |
| 184 | case MTK_SOC_RT3883: |
| 185 | pintable = rt3883_pintable; |
| 186 | break; |
| 187 | case MTK_SOC_RT5350: |
| 188 | pintable = rt5350_pintable; |
| 189 | break; |
| 190 | case MTK_SOC_MT7620A: /* fallthrough */ |
| 191 | case MTK_SOC_MT7620N: |
| 192 | pintable = mt7620_pintable; |
| 193 | break; |
| 194 | case MTK_SOC_MT7628: /* fallthrough */ |
| 195 | case MTK_SOC_MT7688: |
| 196 | pintable = mt7628_pintable; |
| 197 | break; |
| 198 | case MTK_SOC_MT7621: |
| 199 | pintable = mt7621_pintable; |
| 200 | break; |
| 201 | default: |
| 202 | ret = ENOENT; |
| 203 | goto out; |
| 204 | } |
| 205 | |
| 206 | /* |
| 207 | * OpenWRT dts files have single child within the pinctrl nodes, which |
| 208 | * contains the 'ralink,group' and 'ralink,function' properties. |
| 209 | */ |
| 210 | for (child = OF_child(node); child != 0 && child != -1; |
| 211 | child = OF_peer(child)) { |
| 212 | if ((ret = mtk_pinctrl_process_node(dev, pintable, child)) != 0) |
| 213 | return (ret); |
| 214 | } |
nothing calls this directly
no test coverage detected