Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | c21e19a | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Socionext Inc. |
| 4 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | c21e19a | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
Simon Glass | 51a3ec3 | 2017-05-17 17:18:07 -0600 | [diff] [blame] | 7 | #include <common.h> |
Masahiro Yamada | e4e789d | 2017-01-21 18:05:24 +0900 | [diff] [blame] | 8 | #include <linux/errno.h> |
Simon Glass | 11c89f3 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 9 | #include <dm.h> |
Masahiro Yamada | c21e19a | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 10 | #include <dm/pinctrl.h> |
Masahiro Yamada | c21e19a | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 11 | |
| 12 | #include "init.h" |
| 13 | |
| 14 | int uniphier_pin_init(const char *pinconfig_name) |
| 15 | { |
| 16 | struct udevice *pctldev, *config, *next; |
| 17 | int ret; |
| 18 | |
| 19 | ret = uclass_first_device(UCLASS_PINCTRL, &pctldev); |
| 20 | if (ret) |
| 21 | return ret; |
| 22 | |
| 23 | device_foreach_child_safe(config, next, pctldev) { |
| 24 | if (strcmp(config->name, pinconfig_name)) |
| 25 | continue; |
| 26 | |
| 27 | return pinctrl_generic_set_state(pctldev, config); |
| 28 | } |
| 29 | |
| 30 | return -ENODEV; |
| 31 | } |