blob: 3a9ec9c7bc533b46a12e8e7267976ac0abe365b8 [file] [log] [blame]
Masahiro Yamada5ac9dfb2016-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
Simon Glass4af0d7e2017-05-17 17:18:07 -06008#include <common.h>
Masahiro Yamada0f4ec052017-01-21 18:05:24 +09009#include <linux/errno.h>
Simon Glass9d922452017-05-17 17:18:03 -060010#include <dm.h>
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +090011#include <dm/pinctrl.h>
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +090012
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}