2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-09-16 18:33:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Socionext Inc.
|
|
|
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
|
|
*/
|
|
|
|
|
2017-05-17 23:18:07 +00:00
|
|
|
#include <common.h>
|
2017-01-21 09:05:24 +00:00
|
|
|
#include <linux/errno.h>
|
2017-05-17 23:18:03 +00:00
|
|
|
#include <dm.h>
|
2016-09-16 18:33:04 +00:00
|
|
|
#include <dm/pinctrl.h>
|
|
|
|
|
|
|
|
#include "init.h"
|
|
|
|
|
|
|
|
int uniphier_pin_init(const char *pinconfig_name)
|
|
|
|
{
|
2019-09-25 14:55:56 +00:00
|
|
|
struct udevice *pctldev, *config;
|
2016-09-16 18:33:04 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = uclass_first_device(UCLASS_PINCTRL, &pctldev);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2019-09-25 14:55:56 +00:00
|
|
|
device_foreach_child(config, pctldev) {
|
2016-09-16 18:33:04 +00:00
|
|
|
if (strcmp(config->name, pinconfig_name))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
return pinctrl_generic_set_state(pctldev, config);
|
|
|
|
}
|
|
|
|
|
|
|
|
return -ENODEV;
|
|
|
|
}
|