blob: c4d3b17c39d8457817ea514acc6552bbca1f41c3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadac21e19a2016-09-17 03:33:04 +09002/*
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadac21e19a2016-09-17 03:33:04 +09005 */
6
Simon Glass51a3ec32017-05-17 17:18:07 -06007#include <common.h>
Masahiro Yamadae4e789d2017-01-21 18:05:24 +09008#include <linux/errno.h>
Simon Glass11c89f32017-05-17 17:18:03 -06009#include <dm.h>
Masahiro Yamadac21e19a2016-09-17 03:33:04 +090010#include <dm/pinctrl.h>
Masahiro Yamadac21e19a2016-09-17 03:33:04 +090011
12#include "init.h"
13
14int uniphier_pin_init(const char *pinconfig_name)
15{
16 struct udevice *pctldev, *config, *next;
17 int ret;
18
19 ret = uclass_first_device(UCLASS_PINCTRL, &pctldev);
20 if (ret)
21 return ret;
22
23 device_foreach_child_safe(config, next, pctldev) {
24 if (strcmp(config->name, pinconfig_name))
25 continue;
26
27 return pinctrl_generic_set_state(pctldev, config);
28 }
29
30 return -ENODEV;
31}