Masahiro Yamada | 5ac9dfb | 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 | |
Simon Glass | 4af0d7e | 2017-05-17 17:18:07 -0600 | [diff] [blame] | 8 | #include <common.h> |
Masahiro Yamada | 0f4ec05 | 2017-01-21 18:05:24 +0900 | [diff] [blame] | 9 | #include <linux/errno.h> |
Simon Glass | 9d92245 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 10 | #include <dm.h> |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 11 | #include <dm/pinctrl.h> |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 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 | } |