Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / arm / mach-uniphier / pinctrl-glue.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016 Socionext Inc.
4  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5  */
6
7 #include <linux/errno.h>
8 #include <dm.h>
9 #include <dm/pinctrl.h>
10
11 #include "init.h"
12
13 int uniphier_pin_init(const char *pinconfig_name)
14 {
15         struct udevice *pctldev, *config;
16         int ret;
17
18         ret = uclass_first_device(UCLASS_PINCTRL, &pctldev);
19         if (ret)
20                 return ret;
21
22         device_foreach_child(config, pctldev) {
23                 if (strcmp(config->name, pinconfig_name))
24                         continue;
25
26                 return pinctrl_generic_set_state(pctldev, config);
27         }
28
29         return -ENODEV;
30 }