blob: 2e07264695956de7c685f33b0fc73b42c92274ce [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +09002/*
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +09005 */
6
Masahiro Yamada0f4ec052017-01-21 18:05:24 +09007#include <linux/errno.h>
Simon Glass9d922452017-05-17 17:18:03 -06008#include <dm.h>
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +09009#include <dm/pinctrl.h>
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +090010
11#include "init.h"
12
13int uniphier_pin_init(const char *pinconfig_name)
14{
Simon Glasse5f73902019-09-25 08:55:56 -060015 struct udevice *pctldev, *config;
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +090016 int ret;
17
18 ret = uclass_first_device(UCLASS_PINCTRL, &pctldev);
19 if (ret)
20 return ret;
21
Simon Glasse5f73902019-09-25 08:55:56 -060022 device_foreach_child(config, pctldev) {
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +090023 if (strcmp(config->name, pinconfig_name))
24 continue;
25
26 return pinctrl_generic_set_state(pctldev, config);
27 }
28
29 return -ENODEV;
30}