diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2017-04-07 08:57:12 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-04-24 08:55:03 -0400 |
commit | 47b50b3743cd6a9c2a90372181cfc9ee5b10186d (patch) | |
tree | f29db5639124ff3ca165eb1b23e226d7c241a41a | |
parent | 7f354fd13877aae8abcd7b5a389cc85e3d2e4ed1 (diff) |
pinctrl: aspeed: g4: Add pinconf support
Testing for pinctrl-aspeed-g4 was performed on an OpenPOWER Palmetto
system, using the strategy outlined in the commit message for the
change to the Aspeed pinctrl core.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 117 |
1 files changed, 116 insertions, 1 deletions
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c index 731dc2352c71..cf3106cec048 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | |||
@@ -2234,6 +2234,110 @@ static const struct aspeed_pin_function aspeed_g4_functions[] = { | |||
2234 | ASPEED_PINCTRL_FUNC(WDTRST2), | 2234 | ASPEED_PINCTRL_FUNC(WDTRST2), |
2235 | }; | 2235 | }; |
2236 | 2236 | ||
2237 | static const struct aspeed_pin_config aspeed_g4_configs[] = { | ||
2238 | /* GPIO banks ranges [A, B], [D, J], [M, R] */ | ||
2239 | { PIN_CONFIG_BIAS_PULL_DOWN, { D6, D5 }, SCU8C, 16 }, | ||
2240 | { PIN_CONFIG_BIAS_DISABLE, { D6, D5 }, SCU8C, 16 }, | ||
2241 | { PIN_CONFIG_BIAS_PULL_DOWN, { J21, E18 }, SCU8C, 17 }, | ||
2242 | { PIN_CONFIG_BIAS_DISABLE, { J21, E18 }, SCU8C, 17 }, | ||
2243 | { PIN_CONFIG_BIAS_PULL_DOWN, { A18, E15 }, SCU8C, 19 }, | ||
2244 | { PIN_CONFIG_BIAS_DISABLE, { A18, E15 }, SCU8C, 19 }, | ||
2245 | { PIN_CONFIG_BIAS_PULL_DOWN, { D15, B14 }, SCU8C, 20 }, | ||
2246 | { PIN_CONFIG_BIAS_DISABLE, { D15, B14 }, SCU8C, 20 }, | ||
2247 | { PIN_CONFIG_BIAS_PULL_DOWN, { D18, C17 }, SCU8C, 21 }, | ||
2248 | { PIN_CONFIG_BIAS_DISABLE, { D18, C17 }, SCU8C, 21 }, | ||
2249 | { PIN_CONFIG_BIAS_PULL_DOWN, { A14, U18 }, SCU8C, 22 }, | ||
2250 | { PIN_CONFIG_BIAS_DISABLE, { A14, U18 }, SCU8C, 22 }, | ||
2251 | { PIN_CONFIG_BIAS_PULL_DOWN, { A8, E7 }, SCU8C, 23 }, | ||
2252 | { PIN_CONFIG_BIAS_DISABLE, { A8, E7 }, SCU8C, 23 }, | ||
2253 | { PIN_CONFIG_BIAS_PULL_DOWN, { C22, E20 }, SCU8C, 24 }, | ||
2254 | { PIN_CONFIG_BIAS_DISABLE, { C22, E20 }, SCU8C, 24 }, | ||
2255 | { PIN_CONFIG_BIAS_PULL_DOWN, { J5, T1 }, SCU8C, 25 }, | ||
2256 | { PIN_CONFIG_BIAS_DISABLE, { J5, T1 }, SCU8C, 25 }, | ||
2257 | { PIN_CONFIG_BIAS_PULL_DOWN, { U1, U5 }, SCU8C, 26 }, | ||
2258 | { PIN_CONFIG_BIAS_DISABLE, { U1, U5 }, SCU8C, 26 }, | ||
2259 | { PIN_CONFIG_BIAS_PULL_DOWN, { V3, V5 }, SCU8C, 27 }, | ||
2260 | { PIN_CONFIG_BIAS_DISABLE, { V3, V5 }, SCU8C, 27 }, | ||
2261 | { PIN_CONFIG_BIAS_PULL_DOWN, { W4, AB2 }, SCU8C, 28 }, | ||
2262 | { PIN_CONFIG_BIAS_DISABLE, { W4, AB2 }, SCU8C, 28 }, | ||
2263 | { PIN_CONFIG_BIAS_PULL_DOWN, { V6, V7 }, SCU8C, 29 }, | ||
2264 | { PIN_CONFIG_BIAS_DISABLE, { V6, V7 }, SCU8C, 29 }, | ||
2265 | { PIN_CONFIG_BIAS_PULL_DOWN, { Y6, AB7 }, SCU8C, 30 }, | ||
2266 | { PIN_CONFIG_BIAS_DISABLE, { Y6, AB7 }, SCU8C, 30 }, | ||
2267 | { PIN_CONFIG_BIAS_PULL_DOWN, { V20, A5 }, SCU8C, 31 }, | ||
2268 | { PIN_CONFIG_BIAS_DISABLE, { V20, A5 }, SCU8C, 31 }, | ||
2269 | |||
2270 | /* GPIOs T[0-5] (RGMII1 Tx pins) */ | ||
2271 | { PIN_CONFIG_DRIVE_STRENGTH, { A12, A13 }, SCU90, 9 }, | ||
2272 | { PIN_CONFIG_BIAS_PULL_DOWN, { A12, A13 }, SCU90, 12 }, | ||
2273 | { PIN_CONFIG_BIAS_DISABLE, { A12, A13 }, SCU90, 12 }, | ||
2274 | |||
2275 | /* GPIOs T[6-7], U[0-3] (RGMII2 TX pins) */ | ||
2276 | { PIN_CONFIG_DRIVE_STRENGTH, { D9, D10 }, SCU90, 11 }, | ||
2277 | { PIN_CONFIG_BIAS_PULL_DOWN, { D9, D10 }, SCU90, 14 }, | ||
2278 | { PIN_CONFIG_BIAS_DISABLE, { D9, D10 }, SCU90, 14 }, | ||
2279 | |||
2280 | /* GPIOs U[4-7], V[0-1] (RGMII1 Rx pins) */ | ||
2281 | { PIN_CONFIG_BIAS_PULL_DOWN, { E11, E10 }, SCU90, 13 }, | ||
2282 | { PIN_CONFIG_BIAS_DISABLE, { E11, E10 }, SCU90, 13 }, | ||
2283 | |||
2284 | /* GPIOs V[2-7] (RGMII2 Rx pins) */ | ||
2285 | { PIN_CONFIG_BIAS_PULL_DOWN, { C9, C8 }, SCU90, 15 }, | ||
2286 | { PIN_CONFIG_BIAS_DISABLE, { C9, C8 }, SCU90, 15 }, | ||
2287 | |||
2288 | /* ADC pull-downs (SCUA8[19:4]) */ | ||
2289 | { PIN_CONFIG_BIAS_PULL_DOWN, { L5, L5 }, SCUA8, 4 }, | ||
2290 | { PIN_CONFIG_BIAS_DISABLE, { L5, L5 }, SCUA8, 4 }, | ||
2291 | { PIN_CONFIG_BIAS_PULL_DOWN, { L4, L4 }, SCUA8, 5 }, | ||
2292 | { PIN_CONFIG_BIAS_DISABLE, { L4, L4 }, SCUA8, 5 }, | ||
2293 | { PIN_CONFIG_BIAS_PULL_DOWN, { L3, L3 }, SCUA8, 6 }, | ||
2294 | { PIN_CONFIG_BIAS_DISABLE, { L3, L3 }, SCUA8, 6 }, | ||
2295 | { PIN_CONFIG_BIAS_PULL_DOWN, { L2, L2 }, SCUA8, 7 }, | ||
2296 | { PIN_CONFIG_BIAS_DISABLE, { L2, L2 }, SCUA8, 7 }, | ||
2297 | { PIN_CONFIG_BIAS_PULL_DOWN, { L1, L1 }, SCUA8, 8 }, | ||
2298 | { PIN_CONFIG_BIAS_DISABLE, { L1, L1 }, SCUA8, 8 }, | ||
2299 | { PIN_CONFIG_BIAS_PULL_DOWN, { M5, M5 }, SCUA8, 9 }, | ||
2300 | { PIN_CONFIG_BIAS_DISABLE, { M5, M5 }, SCUA8, 9 }, | ||
2301 | { PIN_CONFIG_BIAS_PULL_DOWN, { M4, M4 }, SCUA8, 10 }, | ||
2302 | { PIN_CONFIG_BIAS_DISABLE, { M4, M4 }, SCUA8, 10 }, | ||
2303 | { PIN_CONFIG_BIAS_PULL_DOWN, { M3, M3 }, SCUA8, 11 }, | ||
2304 | { PIN_CONFIG_BIAS_DISABLE, { M3, M3 }, SCUA8, 11 }, | ||
2305 | { PIN_CONFIG_BIAS_PULL_DOWN, { M2, M2 }, SCUA8, 12 }, | ||
2306 | { PIN_CONFIG_BIAS_DISABLE, { M2, M2 }, SCUA8, 12 }, | ||
2307 | { PIN_CONFIG_BIAS_PULL_DOWN, { M1, M1 }, SCUA8, 13 }, | ||
2308 | { PIN_CONFIG_BIAS_DISABLE, { M1, M1 }, SCUA8, 13 }, | ||
2309 | { PIN_CONFIG_BIAS_PULL_DOWN, { N5, N5 }, SCUA8, 14 }, | ||
2310 | { PIN_CONFIG_BIAS_DISABLE, { N5, N5 }, SCUA8, 14 }, | ||
2311 | { PIN_CONFIG_BIAS_PULL_DOWN, { N4, N4 }, SCUA8, 15 }, | ||
2312 | { PIN_CONFIG_BIAS_DISABLE, { N4, N4 }, SCUA8, 15 }, | ||
2313 | { PIN_CONFIG_BIAS_PULL_DOWN, { N3, N3 }, SCUA8, 16 }, | ||
2314 | { PIN_CONFIG_BIAS_DISABLE, { N3, N3 }, SCUA8, 16 }, | ||
2315 | { PIN_CONFIG_BIAS_PULL_DOWN, { N2, N2 }, SCUA8, 17 }, | ||
2316 | { PIN_CONFIG_BIAS_DISABLE, { N2, N2 }, SCUA8, 17 }, | ||
2317 | { PIN_CONFIG_BIAS_PULL_DOWN, { N1, N1 }, SCUA8, 18 }, | ||
2318 | { PIN_CONFIG_BIAS_DISABLE, { N1, N1 }, SCUA8, 18 }, | ||
2319 | { PIN_CONFIG_BIAS_PULL_DOWN, { P5, P5 }, SCUA8, 19 }, | ||
2320 | { PIN_CONFIG_BIAS_DISABLE, { P5, P5 }, SCUA8, 19 }, | ||
2321 | |||
2322 | /* | ||
2323 | * Debounce settings for GPIOs D and E passthrough mode are in | ||
2324 | * SCUA8[27:20] and so are managed by pinctrl. Normal GPIO debounce for | ||
2325 | * banks D and E is handled by the GPIO driver - GPIO passthrough is | ||
2326 | * treated like any other non-GPIO mux function. There is a catch | ||
2327 | * however, in that the debounce period is configured in the GPIO | ||
2328 | * controller. Due to this tangle between GPIO and pinctrl we don't yet | ||
2329 | * fully support pass-through debounce. | ||
2330 | */ | ||
2331 | { PIN_CONFIG_INPUT_DEBOUNCE, { A18, D16 }, SCUA8, 20 }, | ||
2332 | { PIN_CONFIG_INPUT_DEBOUNCE, { B17, A17 }, SCUA8, 21 }, | ||
2333 | { PIN_CONFIG_INPUT_DEBOUNCE, { C16, B16 }, SCUA8, 22 }, | ||
2334 | { PIN_CONFIG_INPUT_DEBOUNCE, { A16, E15 }, SCUA8, 23 }, | ||
2335 | { PIN_CONFIG_INPUT_DEBOUNCE, { D15, C15 }, SCUA8, 24 }, | ||
2336 | { PIN_CONFIG_INPUT_DEBOUNCE, { B15, A15 }, SCUA8, 25 }, | ||
2337 | { PIN_CONFIG_INPUT_DEBOUNCE, { E14, D14 }, SCUA8, 26 }, | ||
2338 | { PIN_CONFIG_INPUT_DEBOUNCE, { C14, B14 }, SCUA8, 27 }, | ||
2339 | }; | ||
2340 | |||
2237 | static struct aspeed_pinctrl_data aspeed_g4_pinctrl_data = { | 2341 | static struct aspeed_pinctrl_data aspeed_g4_pinctrl_data = { |
2238 | .pins = aspeed_g4_pins, | 2342 | .pins = aspeed_g4_pins, |
2239 | .npins = ARRAY_SIZE(aspeed_g4_pins), | 2343 | .npins = ARRAY_SIZE(aspeed_g4_pins), |
@@ -2241,6 +2345,8 @@ static struct aspeed_pinctrl_data aspeed_g4_pinctrl_data = { | |||
2241 | .ngroups = ARRAY_SIZE(aspeed_g4_groups), | 2345 | .ngroups = ARRAY_SIZE(aspeed_g4_groups), |
2242 | .functions = aspeed_g4_functions, | 2346 | .functions = aspeed_g4_functions, |
2243 | .nfunctions = ARRAY_SIZE(aspeed_g4_functions), | 2347 | .nfunctions = ARRAY_SIZE(aspeed_g4_functions), |
2348 | .configs = aspeed_g4_configs, | ||
2349 | .nconfigs = ARRAY_SIZE(aspeed_g4_configs), | ||
2244 | }; | 2350 | }; |
2245 | 2351 | ||
2246 | static struct pinmux_ops aspeed_g4_pinmux_ops = { | 2352 | static struct pinmux_ops aspeed_g4_pinmux_ops = { |
@@ -2257,16 +2363,25 @@ static struct pinctrl_ops aspeed_g4_pinctrl_ops = { | |||
2257 | .get_group_name = aspeed_pinctrl_get_group_name, | 2363 | .get_group_name = aspeed_pinctrl_get_group_name, |
2258 | .get_group_pins = aspeed_pinctrl_get_group_pins, | 2364 | .get_group_pins = aspeed_pinctrl_get_group_pins, |
2259 | .pin_dbg_show = aspeed_pinctrl_pin_dbg_show, | 2365 | .pin_dbg_show = aspeed_pinctrl_pin_dbg_show, |
2260 | .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, | 2366 | .dt_node_to_map = pinconf_generic_dt_node_to_map_all, |
2261 | .dt_free_map = pinctrl_utils_free_map, | 2367 | .dt_free_map = pinctrl_utils_free_map, |
2262 | }; | 2368 | }; |
2263 | 2369 | ||
2370 | static const struct pinconf_ops aspeed_g4_conf_ops = { | ||
2371 | .is_generic = true, | ||
2372 | .pin_config_get = aspeed_pin_config_get, | ||
2373 | .pin_config_set = aspeed_pin_config_set, | ||
2374 | .pin_config_group_get = aspeed_pin_config_group_get, | ||
2375 | .pin_config_group_set = aspeed_pin_config_group_set, | ||
2376 | }; | ||
2377 | |||
2264 | static struct pinctrl_desc aspeed_g4_pinctrl_desc = { | 2378 | static struct pinctrl_desc aspeed_g4_pinctrl_desc = { |
2265 | .name = "aspeed-g4-pinctrl", | 2379 | .name = "aspeed-g4-pinctrl", |
2266 | .pins = aspeed_g4_pins, | 2380 | .pins = aspeed_g4_pins, |
2267 | .npins = ARRAY_SIZE(aspeed_g4_pins), | 2381 | .npins = ARRAY_SIZE(aspeed_g4_pins), |
2268 | .pctlops = &aspeed_g4_pinctrl_ops, | 2382 | .pctlops = &aspeed_g4_pinctrl_ops, |
2269 | .pmxops = &aspeed_g4_pinmux_ops, | 2383 | .pmxops = &aspeed_g4_pinmux_ops, |
2384 | .confops = &aspeed_g4_conf_ops, | ||
2270 | }; | 2385 | }; |
2271 | 2386 | ||
2272 | static int aspeed_g4_pinctrl_probe(struct platform_device *pdev) | 2387 | static int aspeed_g4_pinctrl_probe(struct platform_device *pdev) |