2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-09-11 11:17:32 +00:00
|
|
|
/*
|
2016-07-19 12:56:13 +00:00
|
|
|
* Copyright (C) 2015-2016 Socionext Inc.
|
|
|
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
|
2015-09-11 11:17:32 +00:00
|
|
|
*/
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
#include <common.h>
|
2017-05-17 23:18:03 +00:00
|
|
|
#include <dm.h>
|
2020-02-03 14:36:16 +00:00
|
|
|
#include <dm/device_compat.h>
|
2015-09-11 11:17:32 +00:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/err.h>
|
2017-10-13 10:21:54 +00:00
|
|
|
#include <linux/kernel.h>
|
2016-03-24 13:32:43 +00:00
|
|
|
#include <linux/sizes.h>
|
2015-09-11 11:17:32 +00:00
|
|
|
#include <dm/pinctrl.h>
|
|
|
|
|
|
|
|
#include "pinctrl-uniphier.h"
|
|
|
|
|
2016-09-13 16:06:05 +00:00
|
|
|
#define UNIPHIER_PINCTRL_PINMUX_BASE 0x1000
|
|
|
|
#define UNIPHIER_PINCTRL_LOAD_PINMUX 0x1700
|
2018-05-05 10:53:55 +00:00
|
|
|
#define UNIPHIER_PINCTRL_DRVCTRL_BASE 0x1800
|
|
|
|
#define UNIPHIER_PINCTRL_DRV2CTRL_BASE 0x1900
|
|
|
|
#define UNIPHIER_PINCTRL_DRV3CTRL_BASE 0x1980
|
2017-02-12 09:21:15 +00:00
|
|
|
#define UNIPHIER_PINCTRL_PUPDCTRL_BASE 0x1a00
|
2016-09-13 16:06:05 +00:00
|
|
|
#define UNIPHIER_PINCTRL_IECTRL 0x1d00
|
|
|
|
|
2016-06-29 10:39:00 +00:00
|
|
|
static const char *uniphier_pinctrl_dummy_name = "_dummy";
|
|
|
|
|
2018-05-05 10:53:54 +00:00
|
|
|
static int uniphier_pinctrl_get_pins_count(struct udevice *dev)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
const struct uniphier_pinctrl_pin *pins = priv->socdata->pins;
|
|
|
|
int pins_count = priv->socdata->pins_count;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We do not list all pins in the pin table to save memory footprint.
|
|
|
|
* Report the max pin number + 1 to fake the framework.
|
|
|
|
*/
|
|
|
|
return pins[pins_count - 1].number + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *uniphier_pinctrl_get_pin_name(struct udevice *dev,
|
|
|
|
unsigned int selector)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
const struct uniphier_pinctrl_pin *pins = priv->socdata->pins;
|
|
|
|
int pins_count = priv->socdata->pins_count;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < pins_count; i++)
|
|
|
|
if (pins[i].number == selector)
|
|
|
|
return pins[i].name;
|
|
|
|
|
|
|
|
return uniphier_pinctrl_dummy_name;
|
|
|
|
}
|
|
|
|
|
2015-09-11 11:17:32 +00:00
|
|
|
static int uniphier_pinctrl_get_groups_count(struct udevice *dev)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
|
|
|
|
return priv->socdata->groups_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *uniphier_pinctrl_get_group_name(struct udevice *dev,
|
|
|
|
unsigned selector)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
|
2016-06-29 10:39:00 +00:00
|
|
|
if (!priv->socdata->groups[selector].name)
|
|
|
|
return uniphier_pinctrl_dummy_name;
|
|
|
|
|
2015-09-11 11:17:32 +00:00
|
|
|
return priv->socdata->groups[selector].name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uniphier_pinmux_get_functions_count(struct udevice *dev)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
|
|
|
|
return priv->socdata->functions_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *uniphier_pinmux_get_function_name(struct udevice *dev,
|
|
|
|
unsigned selector)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
|
2016-06-29 10:39:00 +00:00
|
|
|
if (!priv->socdata->functions[selector])
|
|
|
|
return uniphier_pinctrl_dummy_name;
|
|
|
|
|
2015-09-11 11:17:32 +00:00
|
|
|
return priv->socdata->functions[selector];
|
|
|
|
}
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
static int uniphier_pinconf_input_enable_perpin(struct udevice *dev,
|
|
|
|
unsigned int pin, int enable)
|
2016-03-24 13:32:45 +00:00
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
unsigned reg;
|
|
|
|
u32 mask, tmp;
|
|
|
|
|
|
|
|
reg = UNIPHIER_PINCTRL_IECTRL + pin / 32 * 4;
|
|
|
|
mask = BIT(pin % 32);
|
|
|
|
|
|
|
|
tmp = readl(priv->base + reg);
|
2017-02-12 09:21:15 +00:00
|
|
|
if (enable)
|
|
|
|
tmp |= mask;
|
|
|
|
else
|
|
|
|
tmp &= ~mask;
|
2016-03-24 13:32:45 +00:00
|
|
|
writel(tmp, priv->base + reg);
|
2017-02-12 09:21:15 +00:00
|
|
|
|
|
|
|
return 0;
|
2016-03-24 13:32:45 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
static int uniphier_pinconf_input_enable_legacy(struct udevice *dev,
|
|
|
|
unsigned int pin, int enable)
|
2015-09-11 11:17:32 +00:00
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
/*
|
|
|
|
* Multiple pins share one input enable, per-pin disabling is
|
|
|
|
* impossible.
|
|
|
|
*/
|
|
|
|
if (!enable)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2017-10-13 10:21:54 +00:00
|
|
|
/* Set all bits instead of having a bunch of pin data */
|
|
|
|
writel(U32_MAX, priv->base + UNIPHIER_PINCTRL_IECTRL);
|
2017-02-12 09:21:15 +00:00
|
|
|
|
|
|
|
return 0;
|
2015-09-11 11:17:32 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
static int uniphier_pinconf_input_enable(struct udevice *dev,
|
|
|
|
unsigned int pin, int enable)
|
2016-03-24 13:32:45 +00:00
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
|
|
|
|
if (priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL)
|
2017-02-12 09:21:15 +00:00
|
|
|
return uniphier_pinconf_input_enable_perpin(dev, pin, enable);
|
|
|
|
else
|
|
|
|
return uniphier_pinconf_input_enable_legacy(dev, pin, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if CONFIG_IS_ENABLED(PINCONF)
|
|
|
|
|
|
|
|
static const struct pinconf_param uniphier_pinconf_params[] = {
|
|
|
|
{ "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 },
|
|
|
|
{ "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 1 },
|
|
|
|
{ "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 1 },
|
|
|
|
{ "bias-pull-pin-default", PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, 1 },
|
2018-05-05 10:53:55 +00:00
|
|
|
{ "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 },
|
2017-02-12 09:21:15 +00:00
|
|
|
{ "input-enable", PIN_CONFIG_INPUT_ENABLE, 1 },
|
|
|
|
{ "input-disable", PIN_CONFIG_INPUT_ENABLE, 0 },
|
|
|
|
};
|
|
|
|
|
2018-05-05 10:53:55 +00:00
|
|
|
static const struct uniphier_pinctrl_pin *
|
|
|
|
uniphier_pinctrl_pin_get(struct uniphier_pinctrl_priv *priv, unsigned int pin)
|
|
|
|
{
|
|
|
|
const struct uniphier_pinctrl_pin *pins = priv->socdata->pins;
|
|
|
|
int pins_count = priv->socdata->pins_count;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < pins_count; i++)
|
|
|
|
if (pins[i].number == pin)
|
|
|
|
return &pins[i];
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
static int uniphier_pinconf_bias_set(struct udevice *dev, unsigned int pin,
|
|
|
|
unsigned int param, unsigned int arg)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
unsigned int enable = 1;
|
|
|
|
unsigned int reg;
|
|
|
|
u32 mask, tmp;
|
|
|
|
|
|
|
|
if (!(priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_PUPD_SIMPLE))
|
|
|
|
return -ENOTSUPP;
|
|
|
|
|
|
|
|
switch (param) {
|
|
|
|
case PIN_CONFIG_BIAS_DISABLE:
|
|
|
|
enable = 0;
|
|
|
|
break;
|
|
|
|
case PIN_CONFIG_BIAS_PULL_UP:
|
|
|
|
case PIN_CONFIG_BIAS_PULL_DOWN:
|
|
|
|
if (arg == 0) /* total bias is not supported */
|
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
|
|
|
|
if (arg == 0) /* configuration ignored */
|
|
|
|
return 0;
|
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
reg = UNIPHIER_PINCTRL_PUPDCTRL_BASE + pin / 32 * 4;
|
|
|
|
mask = BIT(pin % 32);
|
|
|
|
|
|
|
|
tmp = readl(priv->base + reg);
|
|
|
|
if (enable)
|
|
|
|
tmp |= mask;
|
2016-03-24 13:32:45 +00:00
|
|
|
else
|
2017-02-12 09:21:15 +00:00
|
|
|
tmp &= ~mask;
|
|
|
|
writel(tmp, priv->base + reg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-05-05 10:53:55 +00:00
|
|
|
static const unsigned int uniphier_pinconf_drv_strengths_1bit[] = {
|
|
|
|
4, 8,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const unsigned int uniphier_pinconf_drv_strengths_2bit[] = {
|
|
|
|
8, 12, 16, 20,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const unsigned int uniphier_pinconf_drv_strengths_3bit[] = {
|
|
|
|
4, 5, 7, 9, 11, 12, 14, 16,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int uniphier_pinconf_drive_set(struct udevice *dev, unsigned int pin,
|
|
|
|
unsigned int strength)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
const struct uniphier_pinctrl_pin *desc;
|
|
|
|
const unsigned int *strengths;
|
|
|
|
unsigned int base, stride, width, drvctrl, reg, shift;
|
|
|
|
u32 val, mask, tmp;
|
|
|
|
|
|
|
|
desc = uniphier_pinctrl_pin_get(priv, pin);
|
|
|
|
if (WARN_ON(!desc))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
switch (uniphier_pin_get_drv_type(desc->data)) {
|
|
|
|
case UNIPHIER_PIN_DRV_1BIT:
|
|
|
|
strengths = uniphier_pinconf_drv_strengths_1bit;
|
|
|
|
base = UNIPHIER_PINCTRL_DRVCTRL_BASE;
|
|
|
|
stride = 1;
|
|
|
|
width = 1;
|
|
|
|
break;
|
|
|
|
case UNIPHIER_PIN_DRV_2BIT:
|
|
|
|
strengths = uniphier_pinconf_drv_strengths_2bit;
|
|
|
|
base = UNIPHIER_PINCTRL_DRV2CTRL_BASE;
|
|
|
|
stride = 2;
|
|
|
|
width = 2;
|
|
|
|
break;
|
|
|
|
case UNIPHIER_PIN_DRV_3BIT:
|
|
|
|
strengths = uniphier_pinconf_drv_strengths_3bit;
|
|
|
|
base = UNIPHIER_PINCTRL_DRV3CTRL_BASE;
|
|
|
|
stride = 4;
|
|
|
|
width = 3;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* drive strength control is not supported for this pin */
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
drvctrl = uniphier_pin_get_drvctrl(desc->data);
|
|
|
|
drvctrl *= stride;
|
|
|
|
|
|
|
|
reg = base + drvctrl / 32 * 4;
|
|
|
|
shift = drvctrl % 32;
|
|
|
|
mask = (1U << width) - 1;
|
|
|
|
|
|
|
|
for (val = 0; val <= mask; val++) {
|
|
|
|
if (strengths[val] > strength)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (val == 0) {
|
|
|
|
dev_err(dev, "unsupported drive strength %u mA for pin %s\n",
|
|
|
|
strength, desc->name);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mask)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
val--;
|
|
|
|
|
|
|
|
tmp = readl(priv->base + reg);
|
|
|
|
tmp &= ~(mask << shift);
|
|
|
|
tmp |= (mask & val) << shift;
|
|
|
|
writel(tmp, priv->base + reg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-05-05 10:53:54 +00:00
|
|
|
static int uniphier_pinconf_set(struct udevice *dev, unsigned int pin,
|
|
|
|
unsigned int param, unsigned int arg)
|
2017-02-12 09:21:15 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
switch (param) {
|
|
|
|
case PIN_CONFIG_BIAS_DISABLE:
|
|
|
|
case PIN_CONFIG_BIAS_PULL_UP:
|
|
|
|
case PIN_CONFIG_BIAS_PULL_DOWN:
|
|
|
|
case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
|
|
|
|
ret = uniphier_pinconf_bias_set(dev, pin, param, arg);
|
|
|
|
break;
|
2018-05-05 10:53:55 +00:00
|
|
|
case PIN_CONFIG_DRIVE_STRENGTH:
|
|
|
|
ret = uniphier_pinconf_drive_set(dev, pin, arg);
|
|
|
|
break;
|
2017-02-12 09:21:15 +00:00
|
|
|
case PIN_CONFIG_INPUT_ENABLE:
|
|
|
|
ret = uniphier_pinconf_input_enable(dev, pin, arg);
|
|
|
|
break;
|
|
|
|
default:
|
2018-05-05 10:53:52 +00:00
|
|
|
dev_err(dev, "unsupported configuration parameter %u\n", param);
|
2017-02-12 09:21:15 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2016-03-24 13:32:45 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 09:21:15 +00:00
|
|
|
static int uniphier_pinconf_group_set(struct udevice *dev,
|
|
|
|
unsigned int group_selector,
|
|
|
|
unsigned int param, unsigned int arg)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
const struct uniphier_pinctrl_group *grp =
|
|
|
|
&priv->socdata->groups[group_selector];
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for (i = 0; i < grp->num_pins; i++) {
|
2018-05-05 10:53:54 +00:00
|
|
|
ret = uniphier_pinconf_set(dev, grp->pins[i], param, arg);
|
2017-02-12 09:21:15 +00:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_IS_ENABLED(PINCONF) */
|
|
|
|
|
2015-09-11 11:17:32 +00:00
|
|
|
static void uniphier_pinmux_set_one(struct udevice *dev, unsigned pin,
|
2016-06-29 10:38:59 +00:00
|
|
|
int muxval)
|
2015-09-11 11:17:32 +00:00
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
2016-09-16 18:32:58 +00:00
|
|
|
unsigned reg, reg_end, shift, mask;
|
|
|
|
unsigned mux_bits = 8;
|
|
|
|
unsigned reg_stride = 4;
|
|
|
|
bool load_pinctrl = false;
|
2015-09-11 11:17:32 +00:00
|
|
|
u32 tmp;
|
|
|
|
|
2016-03-04 06:56:16 +00:00
|
|
|
/* some pins need input-enabling */
|
2017-02-12 09:21:15 +00:00
|
|
|
uniphier_pinconf_input_enable(dev, pin, 1);
|
2016-03-04 06:56:16 +00:00
|
|
|
|
2016-06-29 10:38:59 +00:00
|
|
|
if (muxval < 0)
|
|
|
|
return; /* dedicated pin; nothing to do for pin-mux */
|
|
|
|
|
2016-09-16 18:32:58 +00:00
|
|
|
if (priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_MUX_4BIT)
|
|
|
|
mux_bits = 4;
|
|
|
|
|
2016-03-24 13:32:44 +00:00
|
|
|
if (priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE) {
|
|
|
|
/*
|
|
|
|
* Mode offset bit
|
|
|
|
* Normal 4 * n shift+3:shift
|
|
|
|
* Debug 4 * n shift+7:shift+4
|
|
|
|
*/
|
2016-09-16 18:32:58 +00:00
|
|
|
mux_bits /= 2;
|
2016-03-24 13:32:44 +00:00
|
|
|
reg_stride = 8;
|
|
|
|
load_pinctrl = true;
|
|
|
|
}
|
|
|
|
|
2015-09-11 11:17:32 +00:00
|
|
|
reg = UNIPHIER_PINCTRL_PINMUX_BASE + pin * mux_bits / 32 * reg_stride;
|
|
|
|
reg_end = reg + reg_stride;
|
|
|
|
shift = pin * mux_bits % 32;
|
|
|
|
mask = (1U << mux_bits) - 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If reg_stride is greater than 4, the MSB of each pinsel shall be
|
|
|
|
* stored in the offset+4.
|
|
|
|
*/
|
|
|
|
for (; reg < reg_end; reg += 4) {
|
|
|
|
tmp = readl(priv->base + reg);
|
|
|
|
tmp &= ~(mask << shift);
|
|
|
|
tmp |= (mask & muxval) << shift;
|
|
|
|
writel(tmp, priv->base + reg);
|
|
|
|
|
|
|
|
muxval >>= mux_bits;
|
|
|
|
}
|
|
|
|
|
2016-03-24 13:32:44 +00:00
|
|
|
if (load_pinctrl)
|
2015-09-11 11:17:32 +00:00
|
|
|
writel(1, priv->base + UNIPHIER_PINCTRL_LOAD_PINMUX);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uniphier_pinmux_group_set(struct udevice *dev,
|
|
|
|
unsigned group_selector,
|
|
|
|
unsigned func_selector)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
const struct uniphier_pinctrl_group *grp =
|
|
|
|
&priv->socdata->groups[group_selector];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < grp->num_pins; i++)
|
|
|
|
uniphier_pinmux_set_one(dev, grp->pins[i], grp->muxvals[i]);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct pinctrl_ops uniphier_pinctrl_ops = {
|
2018-05-05 10:53:54 +00:00
|
|
|
.get_pins_count = uniphier_pinctrl_get_pins_count,
|
|
|
|
.get_pin_name = uniphier_pinctrl_get_pin_name,
|
2015-09-11 11:17:32 +00:00
|
|
|
.get_groups_count = uniphier_pinctrl_get_groups_count,
|
|
|
|
.get_group_name = uniphier_pinctrl_get_group_name,
|
|
|
|
.get_functions_count = uniphier_pinmux_get_functions_count,
|
|
|
|
.get_function_name = uniphier_pinmux_get_function_name,
|
|
|
|
.pinmux_group_set = uniphier_pinmux_group_set,
|
2017-02-12 09:21:15 +00:00
|
|
|
#if CONFIG_IS_ENABLED(PINCONF)
|
|
|
|
.pinconf_num_params = ARRAY_SIZE(uniphier_pinconf_params),
|
|
|
|
.pinconf_params = uniphier_pinconf_params,
|
2018-05-05 10:53:54 +00:00
|
|
|
.pinconf_set = uniphier_pinconf_set,
|
2017-02-12 09:21:15 +00:00
|
|
|
.pinconf_group_set = uniphier_pinconf_group_set,
|
|
|
|
#endif
|
2015-09-11 11:17:32 +00:00
|
|
|
.set_state = pinctrl_generic_set_state,
|
|
|
|
};
|
|
|
|
|
|
|
|
int uniphier_pinctrl_probe(struct udevice *dev,
|
|
|
|
struct uniphier_pinctrl_socdata *socdata)
|
|
|
|
{
|
|
|
|
struct uniphier_pinctrl_priv *priv = dev_get_priv(dev);
|
|
|
|
fdt_addr_t addr;
|
|
|
|
|
2017-05-17 23:18:05 +00:00
|
|
|
addr = devfdt_get_addr(dev->parent);
|
2015-09-11 11:17:32 +00:00
|
|
|
if (addr == FDT_ADDR_T_NONE)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2016-07-19 12:56:13 +00:00
|
|
|
priv->base = devm_ioremap(dev, addr, SZ_4K);
|
2015-09-11 11:17:32 +00:00
|
|
|
if (!priv->base)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
priv->socdata = socdata;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|