blob: c52c6a6f6c6feefcd2d69474156b6164da121585 [file] [log] [blame]
Masahiro Yamadac21e19a2016-09-17 03:33:04 +09001/*
2 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Masahiro Yamadae4e789d2017-01-21 18:05:24 +09008#include <linux/errno.h>
Masahiro Yamadac21e19a2016-09-17 03:33:04 +09009#include <dm/device.h>
10#include <dm/pinctrl.h>
11#include <dm/uclass.h>
12
13#include "init.h"
14
15int 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}