Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80525098 authored by Zhiyong Tao's avatar Zhiyong Tao Committed by Linus Walleij
Browse files

pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings



Add pinctrl-paris core that implements vendor dt-binding which MediaTek
tablet, box and smartphone-based SoCs such as MT81xx, MT27xx, and MT67xx
SoCs really want to depend on. The driver is just completely rewritten
according to pinctrl-mtk-common.c but uses the new logic from
pinctrl-mtk-common-v2.c to have an elegant way to support new SoCs in the
future.

Signed-off-by: default avatarZhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b7d7f9ee
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,15 @@ config PINCTRL_MTK_MOORE
	select GPIOLIB
	select GPIOLIB
	select OF_GPIO
	select OF_GPIO


config PINCTRL_MTK_PARIS
	bool "MediaTek Paris Core that implements vendor binding"
	depends on OF
	select PINMUX
	select GENERIC_PINCONF
	select GPIOLIB
	select EINT_MTK
	select OF_GPIO

# For ARMv7 SoCs
# For ARMv7 SoCs
config PINCTRL_MT2701
config PINCTRL_MT2701
	bool "Mediatek MT2701 pin control"
	bool "Mediatek MT2701 pin control"
+1 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@
obj-$(CONFIG_EINT_MTK)		+= mtk-eint.o
obj-$(CONFIG_EINT_MTK)		+= mtk-eint.o
obj-$(CONFIG_PINCTRL_MTK)	+= pinctrl-mtk-common.o
obj-$(CONFIG_PINCTRL_MTK)	+= pinctrl-mtk-common.o
obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o pinctrl-mtk-common-v2.o
obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o pinctrl-mtk-common-v2.o
obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o pinctrl-mtk-common-v2.o


# SoC Drivers
# SoC Drivers
obj-$(CONFIG_PINCTRL_MT2701)	+= pinctrl-mt2701.o
obj-$(CONFIG_PINCTRL_MT2701)	+= pinctrl-mt2701.o
+8 −0
Original line number Original line Diff line number Diff line
@@ -174,6 +174,12 @@ struct mtk_pin_desc {
	struct mtk_func_desc *funcs;
	struct mtk_func_desc *funcs;
};
};


struct mtk_pinctrl_group {
	const char	*name;
	unsigned long	config;
	unsigned	pin;
};

struct mtk_pinctrl;
struct mtk_pinctrl;


/* struct mtk_pin_soc - the structure that holds SoC-specific data */
/* struct mtk_pin_soc - the structure that holds SoC-specific data */
@@ -228,6 +234,8 @@ struct mtk_pinctrl {
	struct gpio_chip		chip;
	struct gpio_chip		chip;
	const struct mtk_pin_soc        *soc;
	const struct mtk_pin_soc        *soc;
	struct mtk_eint			*eint;
	struct mtk_eint			*eint;
	struct mtk_pinctrl_group	*groups;
	const char          **grp_names;
};
};


void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set);
void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set);
+884 −0

File added.

Preview size limit exceeded, changes collapsed.

+65 −0
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2018 MediaTek Inc.
 *
 * Author: Sean Wang <sean.wang@mediatek.com>
 *	   Zhiyong Tao <zhiyong.tao@mediatek.com>
 *	   Hongzhou.Yang <hongzhou.yang@mediatek.com>
 */
#ifndef __PINCTRL_PARIS_H
#define __PINCTRL_PARIS_H

#include <linux/gpio.h>
#include <linux/gpio/driver.h>
#include <linux/io.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinconf-generic.h>

#include "../core.h"
#include "../pinconf.h"
#include "../pinctrl-utils.h"
#include "../pinmux.h"
#include "mtk-eint.h"
#include "pinctrl-mtk-common-v2.h"

#define MTK_RANGE(_a)		{ .range = (_a), .nranges = ARRAY_SIZE(_a), }

#define MTK_EINT_FUNCTION(_eintmux, _eintnum)				\
	{							\
		.eint_m = _eintmux,					\
		.eint_n = _eintnum,					\
	}

#define MTK_FUNCTION(_val, _name)				\
	{							\
		.muxval = _val,					\
		.name = _name,					\
	}

#define MTK_PIN(_number, _name, _eint, _drv_n, ...) {	\
		.number = _number,			\
		.name = _name,				\
		.eint = _eint,				\
		.drv_n = _drv_n,			\
		.funcs = (struct mtk_func_desc[]){	\
			__VA_ARGS__, { } },				\
	}

#define PINCTRL_PIN_GROUP(name, id)			\
	{						\
		name,					\
		id##_pins,				\
		ARRAY_SIZE(id##_pins),			\
		id##_funcs,				\
	}

int mtk_paris_pinctrl_probe(struct platform_device *pdev,
			    const struct mtk_pin_soc *soc);

#endif /* __PINCTRL_PARIS_H */