summaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier/pinctrl-glue.c
blob: c52c6a6f6c6feefcd2d69474156b6164da121585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (C) 2016 Socionext Inc.
 *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include <linux/errno.h>
#include <dm/device.h>
#include <dm/pinctrl.h>
#include <dm/uclass.h>

#include "init.h"

int uniphier_pin_init(const char *pinconfig_name)
{
	struct udevice *pctldev, *config, *next;
	int ret;

	ret = uclass_first_device(UCLASS_PINCTRL, &pctldev);
	if (ret)
		return ret;

	device_foreach_child_safe(config, next, pctldev) {
		if (strcmp(config->name, pinconfig_name))
			continue;

		return pinctrl_generic_set_state(pctldev, config);
	}

	return -ENODEV;
}