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