Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 5ac9dfb | 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 | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
Masahiro Yamada | 0f4ec05 | 2017-01-21 18:05:24 +0900 | [diff] [blame] | 7 | #include <linux/errno.h> |
Simon Glass | 9d92245 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 8 | #include <dm.h> |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 9 | #include <dm/pinctrl.h> |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 10 | |
| 11 | #include "init.h" |
| 12 | |
| 13 | int uniphier_pin_init(const char *pinconfig_name) |
| 14 | { |
Simon Glass | e5f7390 | 2019-09-25 08:55:56 -0600 | [diff] [blame] | 15 | struct udevice *pctldev, *config; |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 16 | int ret; |
| 17 | |
| 18 | ret = uclass_first_device(UCLASS_PINCTRL, &pctldev); |
| 19 | if (ret) |
| 20 | return ret; |
| 21 | |
Simon Glass | e5f7390 | 2019-09-25 08:55:56 -0600 | [diff] [blame] | 22 | device_foreach_child(config, pctldev) { |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 23 | if (strcmp(config->name, pinconfig_name)) |
| 24 | continue; |
| 25 | |
| 26 | return pinctrl_generic_set_state(pctldev, config); |
| 27 | } |
| 28 | |
| 29 | return -ENODEV; |
| 30 | } |