2019-09-25 09:45:26 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 MediaTek Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Author: Weijie Gao <weijie.gao@mediatek.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PINCTRL_MTMIPS_COMMON_H_
|
|
|
|
#define _PINCTRL_MTMIPS_COMMON_H_
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
|
|
|
|
struct mtmips_pmx_func {
|
|
|
|
const char *name;
|
|
|
|
int value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mtmips_pmx_group {
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
u32 reg;
|
|
|
|
u32 shift;
|
|
|
|
char mask;
|
|
|
|
|
2022-05-20 03:22:49 +00:00
|
|
|
int pconf_avail;
|
|
|
|
u32 pconf_reg;
|
|
|
|
u32 pconf_shift;
|
|
|
|
|
2019-09-25 09:45:26 +00:00
|
|
|
int nfuncs;
|
|
|
|
const struct mtmips_pmx_func *funcs;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mtmips_pinctrl_priv {
|
|
|
|
void __iomem *base;
|
|
|
|
|
|
|
|
u32 ngroups;
|
|
|
|
const struct mtmips_pmx_group *groups;
|
|
|
|
|
|
|
|
u32 nfuncs;
|
|
|
|
const struct mtmips_pmx_func **funcs;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FUNC(name, value) { name, value }
|
|
|
|
|
|
|
|
#define GRP(_name, _funcs, _reg, _shift, _mask) \
|
|
|
|
{ .name = (_name), .reg = (_reg), .shift = (_shift), .mask = (_mask), \
|
|
|
|
.funcs = (_funcs), .nfuncs = ARRAY_SIZE(_funcs) }
|
|
|
|
|
2022-05-20 03:22:49 +00:00
|
|
|
#define GRP_PCONF(_name, _funcs, _reg, _shift, _mask, _pconf_reg, _pconf_shift) \
|
|
|
|
{ .name = (_name), .reg = (_reg), .shift = (_shift), .mask = (_mask), \
|
|
|
|
.funcs = (_funcs), .nfuncs = ARRAY_SIZE(_funcs), .pconf_avail = 1, \
|
|
|
|
.pconf_reg = (_pconf_reg), .pconf_shift = (_pconf_shift) }
|
|
|
|
|
|
|
|
void mtmips_pinctrl_reg_set(struct mtmips_pinctrl_priv *priv,
|
|
|
|
u32 reg, u32 shift, u32 mask, u32 value);
|
|
|
|
|
2019-09-25 09:45:26 +00:00
|
|
|
int mtmips_get_functions_count(struct udevice *dev);
|
|
|
|
const char *mtmips_get_function_name(struct udevice *dev,
|
|
|
|
unsigned int selector);
|
|
|
|
int mtmips_pinmux_group_set(struct udevice *dev, unsigned int group_selector,
|
|
|
|
unsigned int func_selector);
|
|
|
|
int mtmips_pinctrl_probe(struct mtmips_pinctrl_priv *priv, u32 ngroups,
|
|
|
|
const struct mtmips_pmx_group *groups);
|
|
|
|
|
|
|
|
#endif /* _PINCTRL_MTMIPS_COMMON_H_ */
|