2018-09-08 11:07:17 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 MediaTek Inc.
|
|
|
|
*
|
|
|
|
* Author: Sean Wang <sean.wang@mediatek.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PINCTRL_MTK_COMMON_V2_H
|
|
|
|
#define __PINCTRL_MTK_COMMON_V2_H
|
|
|
|
|
2018-09-18 22:03:13 +00:00
|
|
|
#include <linux/gpio/driver.h>
|
|
|
|
|
2018-09-08 11:07:17 +00:00
|
|
|
#define MTK_INPUT 0
|
|
|
|
#define MTK_OUTPUT 1
|
|
|
|
#define MTK_DISABLE 0
|
|
|
|
#define MTK_ENABLE 1
|
2018-09-08 11:07:27 +00:00
|
|
|
#define MTK_PULLDOWN 0
|
|
|
|
#define MTK_PULLUP 1
|
2018-09-08 11:07:17 +00:00
|
|
|
|
2018-09-21 04:07:35 +00:00
|
|
|
#define EINT_NA U16_MAX
|
2018-09-21 04:07:36 +00:00
|
|
|
#define NO_EINT_SUPPORT EINT_NA
|
2018-09-08 11:07:20 +00:00
|
|
|
|
2018-09-08 11:07:30 +00:00
|
|
|
#define PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, \
|
|
|
|
_s_bit, _x_bits, _sz_reg, _fixed) { \
|
2018-09-08 11:07:19 +00:00
|
|
|
.s_pin = _s_pin, \
|
|
|
|
.e_pin = _e_pin, \
|
2018-09-08 11:07:30 +00:00
|
|
|
.i_base = _i_base, \
|
2018-09-08 11:07:19 +00:00
|
|
|
.s_addr = _s_addr, \
|
|
|
|
.x_addrs = _x_addrs, \
|
|
|
|
.s_bit = _s_bit, \
|
|
|
|
.x_bits = _x_bits, \
|
|
|
|
.sz_reg = _sz_reg, \
|
|
|
|
.fixed = _fixed, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define PIN_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
|
2018-09-08 11:07:30 +00:00
|
|
|
PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit, \
|
2018-09-08 11:07:19 +00:00
|
|
|
_x_bits, 32, 0)
|
|
|
|
|
|
|
|
#define PINS_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
|
2018-09-08 11:07:30 +00:00
|
|
|
PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit, \
|
2018-09-08 11:07:19 +00:00
|
|
|
_x_bits, 32, 1)
|
|
|
|
|
2018-09-08 11:07:17 +00:00
|
|
|
/* List these attributes which could be modified for the pin */
|
|
|
|
enum {
|
|
|
|
PINCTRL_PIN_REG_MODE,
|
|
|
|
PINCTRL_PIN_REG_DIR,
|
|
|
|
PINCTRL_PIN_REG_DI,
|
|
|
|
PINCTRL_PIN_REG_DO,
|
|
|
|
PINCTRL_PIN_REG_SR,
|
|
|
|
PINCTRL_PIN_REG_SMT,
|
|
|
|
PINCTRL_PIN_REG_PD,
|
|
|
|
PINCTRL_PIN_REG_PU,
|
|
|
|
PINCTRL_PIN_REG_E4,
|
|
|
|
PINCTRL_PIN_REG_E8,
|
|
|
|
PINCTRL_PIN_REG_TDSEL,
|
|
|
|
PINCTRL_PIN_REG_RDSEL,
|
2018-09-08 11:07:22 +00:00
|
|
|
PINCTRL_PIN_REG_DRV,
|
2018-09-08 11:07:25 +00:00
|
|
|
PINCTRL_PIN_REG_PUPD,
|
|
|
|
PINCTRL_PIN_REG_R0,
|
|
|
|
PINCTRL_PIN_REG_R1,
|
2018-09-08 11:07:26 +00:00
|
|
|
PINCTRL_PIN_REG_IES,
|
2018-09-08 11:07:27 +00:00
|
|
|
PINCTRL_PIN_REG_PULLEN,
|
|
|
|
PINCTRL_PIN_REG_PULLSEL,
|
pinctrl: add drive for I2C related pins on MT8183
This patch provides the advanced drive for I2C used pins on MT8183.
The detail strength specification description of the I2C pin:
When E1=0/E0=0, the strength is 0.125mA.
When E1=0/E0=1, the strength is 0.25mA.
When E1=1/E0=0, the strength is 0.5mA.
When E1=1/E0=1, the strength is 1mA.
For I2C pins, there are existing generic driving setup and the above
specific driving setup. I2C pins can only support 2/4/6/8/10/12/14/16mA
driving adjustment in generic driving setup. But in specific driving
setup, they can support 0.125/0.25/0.5/1mA adjustment.
If we enable specific driving setup for I2C pins,
the existing generic driving setup will be disabled.
For some special features, we need the I2C pins specific driving setup.
The specific driving setup is controlled by E1E0EN.
So we need add extra vendor driving preperty instead of the generic
driving property. We can add "mediatek,drive-strength-adv = <XXX>;"
to describe the specific driving setup property.
"XXX" means the value of E1E0EN. So the valid arguments of
"mediatek,drive-strength-adv" are from 0 to 7.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2019-04-01 03:35:35 +00:00
|
|
|
PINCTRL_PIN_REG_DRV_EN,
|
|
|
|
PINCTRL_PIN_REG_DRV_E0,
|
|
|
|
PINCTRL_PIN_REG_DRV_E1,
|
2018-09-08 11:07:17 +00:00
|
|
|
PINCTRL_PIN_REG_MAX,
|
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:20 +00:00
|
|
|
/* Group the pins by the driving current */
|
|
|
|
enum {
|
|
|
|
DRV_FIXED,
|
|
|
|
DRV_GRP0,
|
|
|
|
DRV_GRP1,
|
|
|
|
DRV_GRP2,
|
|
|
|
DRV_GRP3,
|
|
|
|
DRV_GRP4,
|
|
|
|
DRV_GRP_MAX,
|
|
|
|
};
|
|
|
|
|
2020-07-13 14:49:15 +00:00
|
|
|
static const char * const mtk_default_register_base_names[] __maybe_unused = {
|
2018-09-08 11:07:30 +00:00
|
|
|
"base",
|
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:17 +00:00
|
|
|
/* struct mtk_pin_field - the structure that holds the information of the field
|
|
|
|
* used to describe the attribute for the pin
|
2018-09-08 11:07:30 +00:00
|
|
|
* @base: the index pointing to the entry in base address list
|
2018-09-08 11:07:17 +00:00
|
|
|
* @offset: the register offset relative to the base address
|
|
|
|
* @mask: the mask used to filter out the field from the register
|
|
|
|
* @bitpos: the start bit relative to the register
|
|
|
|
* @next: the indication that the field would be extended to the
|
|
|
|
next register
|
|
|
|
*/
|
|
|
|
struct mtk_pin_field {
|
2018-09-08 11:07:30 +00:00
|
|
|
u8 index;
|
2018-09-08 11:07:17 +00:00
|
|
|
u32 offset;
|
|
|
|
u32 mask;
|
|
|
|
u8 bitpos;
|
|
|
|
u8 next;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* struct mtk_pin_field_calc - the structure that holds the range providing
|
|
|
|
* the guide used to look up the relevant field
|
|
|
|
* @s_pin: the start pin within the range
|
|
|
|
* @e_pin: the end pin within the range
|
2018-09-08 11:07:30 +00:00
|
|
|
* @i_base: the index pointing to the entry in base address list
|
2018-09-08 11:07:17 +00:00
|
|
|
* @s_addr: the start address for the range
|
|
|
|
* @x_addrs: the address distance between two consecutive registers
|
|
|
|
* within the range
|
|
|
|
* @s_bit: the start bit for the first register within the range
|
|
|
|
* @x_bits: the bit distance between two consecutive pins within
|
|
|
|
* the range
|
2018-09-08 11:07:19 +00:00
|
|
|
* @sz_reg: the size of bits in a register
|
|
|
|
* @fixed: the consecutive pins share the same bits with the 1st
|
|
|
|
* pin
|
2018-09-08 11:07:17 +00:00
|
|
|
*/
|
|
|
|
struct mtk_pin_field_calc {
|
|
|
|
u16 s_pin;
|
|
|
|
u16 e_pin;
|
2018-09-08 11:07:30 +00:00
|
|
|
u8 i_base;
|
2018-09-08 11:07:17 +00:00
|
|
|
u32 s_addr;
|
|
|
|
u8 x_addrs;
|
|
|
|
u8 s_bit;
|
|
|
|
u8 x_bits;
|
2018-09-08 11:07:19 +00:00
|
|
|
u8 sz_reg;
|
|
|
|
u8 fixed;
|
2018-09-08 11:07:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* struct mtk_pin_reg_calc - the structure that holds all ranges used to
|
|
|
|
* determine which register the pin would make use of
|
|
|
|
* for certain pin attribute.
|
|
|
|
* @range: the start address for the range
|
|
|
|
* @nranges: the number of items in the range
|
|
|
|
*/
|
|
|
|
struct mtk_pin_reg_calc {
|
|
|
|
const struct mtk_pin_field_calc *range;
|
|
|
|
unsigned int nranges;
|
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:32 +00:00
|
|
|
/**
|
|
|
|
* struct mtk_func_desc - the structure that providing information
|
|
|
|
* all the funcs for this pin
|
|
|
|
* @name: the name of function
|
|
|
|
* @muxval: the mux to the function
|
|
|
|
*/
|
|
|
|
struct mtk_func_desc {
|
|
|
|
const char *name;
|
|
|
|
u8 muxval;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct mtk_eint_desc - the structure that providing information
|
|
|
|
* for eint data per pin
|
|
|
|
* @eint_m: the eint mux for this pin
|
|
|
|
* @eitn_n: the eint number for this pin
|
|
|
|
*/
|
|
|
|
struct mtk_eint_desc {
|
2018-10-08 19:14:10 +00:00
|
|
|
u16 eint_m;
|
2018-09-08 11:07:32 +00:00
|
|
|
u16 eint_n;
|
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:20 +00:00
|
|
|
/**
|
|
|
|
* struct mtk_pin_desc - the structure that providing information
|
|
|
|
* for each pin of chips
|
|
|
|
* @number: unique pin number from the global pin number space
|
|
|
|
* @name: name for this pin
|
2018-09-08 11:07:32 +00:00
|
|
|
* @eint: the eint data for this pin
|
2018-09-08 11:07:20 +00:00
|
|
|
* @drv_n: the index with the driving group
|
2018-09-08 11:07:32 +00:00
|
|
|
* @funcs: all available functions for this pins (only used in
|
|
|
|
* those drivers compatible to pinctrl-mtk-common.c-like
|
|
|
|
* ones)
|
2018-09-08 11:07:20 +00:00
|
|
|
*/
|
|
|
|
struct mtk_pin_desc {
|
|
|
|
unsigned int number;
|
|
|
|
const char *name;
|
2018-09-08 11:07:32 +00:00
|
|
|
struct mtk_eint_desc eint;
|
2018-09-08 11:07:20 +00:00
|
|
|
u8 drv_n;
|
2018-09-08 11:07:32 +00:00
|
|
|
struct mtk_func_desc *funcs;
|
2018-09-08 11:07:20 +00:00
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:33 +00:00
|
|
|
struct mtk_pinctrl_group {
|
|
|
|
const char *name;
|
|
|
|
unsigned long config;
|
|
|
|
unsigned pin;
|
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:22 +00:00
|
|
|
struct mtk_pinctrl;
|
|
|
|
|
2018-09-08 11:07:17 +00:00
|
|
|
/* struct mtk_pin_soc - the structure that holds SoC-specific data */
|
|
|
|
struct mtk_pin_soc {
|
|
|
|
const struct mtk_pin_reg_calc *reg_cal;
|
2018-09-08 11:07:32 +00:00
|
|
|
const struct mtk_pin_desc *pins;
|
2018-09-08 11:07:17 +00:00
|
|
|
unsigned int npins;
|
|
|
|
const struct group_desc *grps;
|
|
|
|
unsigned int ngrps;
|
|
|
|
const struct function_desc *funcs;
|
|
|
|
unsigned int nfuncs;
|
|
|
|
const struct mtk_eint_regs *eint_regs;
|
|
|
|
const struct mtk_eint_hw *eint_hw;
|
2018-09-08 11:07:21 +00:00
|
|
|
|
|
|
|
/* Specific parameters per SoC */
|
|
|
|
u8 gpio_m;
|
2018-09-08 11:07:26 +00:00
|
|
|
bool ies_present;
|
2018-09-08 11:07:30 +00:00
|
|
|
const char * const *base_names;
|
|
|
|
unsigned int nbase_names;
|
2018-09-08 11:07:22 +00:00
|
|
|
|
|
|
|
/* Specific pinconfig operations */
|
2018-09-08 11:07:24 +00:00
|
|
|
int (*bias_disable_set)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc);
|
|
|
|
int (*bias_disable_get)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, int *res);
|
|
|
|
int (*bias_set)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup);
|
|
|
|
int (*bias_get)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup, int *res);
|
|
|
|
|
2020-01-22 06:53:13 +00:00
|
|
|
int (*bias_set_combo)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 pullup, u32 arg);
|
|
|
|
int (*bias_get_combo)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 *pullup, u32 *arg);
|
|
|
|
|
2018-09-08 11:07:22 +00:00
|
|
|
int (*drive_set)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 arg);
|
|
|
|
int (*drive_get)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, int *val);
|
2018-09-08 11:07:25 +00:00
|
|
|
|
|
|
|
int (*adv_pull_set)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup,
|
|
|
|
u32 arg);
|
|
|
|
int (*adv_pull_get)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup,
|
|
|
|
u32 *val);
|
pinctrl: add drive for I2C related pins on MT8183
This patch provides the advanced drive for I2C used pins on MT8183.
The detail strength specification description of the I2C pin:
When E1=0/E0=0, the strength is 0.125mA.
When E1=0/E0=1, the strength is 0.25mA.
When E1=1/E0=0, the strength is 0.5mA.
When E1=1/E0=1, the strength is 1mA.
For I2C pins, there are existing generic driving setup and the above
specific driving setup. I2C pins can only support 2/4/6/8/10/12/14/16mA
driving adjustment in generic driving setup. But in specific driving
setup, they can support 0.125/0.25/0.5/1mA adjustment.
If we enable specific driving setup for I2C pins,
the existing generic driving setup will be disabled.
For some special features, we need the I2C pins specific driving setup.
The specific driving setup is controlled by E1E0EN.
So we need add extra vendor driving preperty instead of the generic
driving property. We can add "mediatek,drive-strength-adv = <XXX>;"
to describe the specific driving setup property.
"XXX" means the value of E1E0EN. So the valid arguments of
"mediatek,drive-strength-adv" are from 0 to 7.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2019-04-01 03:35:35 +00:00
|
|
|
int (*adv_drive_set)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 arg);
|
|
|
|
int (*adv_drive_get)(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 *val);
|
2018-09-08 11:07:32 +00:00
|
|
|
|
|
|
|
/* Specific driver data */
|
|
|
|
void *driver_data;
|
2018-09-08 11:07:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mtk_pinctrl {
|
|
|
|
struct pinctrl_dev *pctrl;
|
2018-09-08 11:07:30 +00:00
|
|
|
void __iomem **base;
|
|
|
|
u8 nbase;
|
2018-09-08 11:07:17 +00:00
|
|
|
struct device *dev;
|
|
|
|
struct gpio_chip chip;
|
|
|
|
const struct mtk_pin_soc *soc;
|
|
|
|
struct mtk_eint *eint;
|
2018-09-08 11:07:33 +00:00
|
|
|
struct mtk_pinctrl_group *groups;
|
|
|
|
const char **grp_names;
|
2018-09-08 11:07:17 +00:00
|
|
|
};
|
|
|
|
|
2018-09-08 11:07:30 +00:00
|
|
|
void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set);
|
2018-09-08 11:07:17 +00:00
|
|
|
|
2018-09-08 11:07:29 +00:00
|
|
|
int mtk_hw_set_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
|
|
|
|
int field, int value);
|
|
|
|
int mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
|
|
|
|
int field, int *value);
|
2018-09-08 11:07:17 +00:00
|
|
|
|
2018-09-08 11:07:37 +00:00
|
|
|
int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev);
|
|
|
|
|
2018-09-08 11:07:24 +00:00
|
|
|
int mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc);
|
|
|
|
int mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, int *res);
|
|
|
|
int mtk_pinconf_bias_set(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup);
|
|
|
|
int mtk_pinconf_bias_get(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup,
|
|
|
|
int *res);
|
|
|
|
|
2018-09-08 11:07:27 +00:00
|
|
|
int mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc);
|
|
|
|
int mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc,
|
|
|
|
int *res);
|
|
|
|
int mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup);
|
|
|
|
int mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup,
|
|
|
|
int *res);
|
2020-01-22 06:53:13 +00:00
|
|
|
int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc,
|
|
|
|
u32 pullup, u32 enable);
|
|
|
|
int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc,
|
|
|
|
u32 *pullup, u32 *enable);
|
2018-09-08 11:07:27 +00:00
|
|
|
|
2018-09-08 11:07:22 +00:00
|
|
|
int mtk_pinconf_drive_set(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 arg);
|
|
|
|
int mtk_pinconf_drive_get(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, int *val);
|
|
|
|
|
2018-09-08 11:07:23 +00:00
|
|
|
int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 arg);
|
|
|
|
int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, int *val);
|
|
|
|
|
pinctrl: mediatek: Supporting driving setting without mapping current to register value
MediaTek's smartphone project actual usage does need to know current value
(in mA) in procedure of finding the best driving setting.
The steps in the procedure is like as follow:
1. set driving setting field in setting register as 0, measure waveform,
perform test, and etc.
2. set driving setting field in setting register as 1, measure waveform,
perform test, and etc.
...
n. set driving setting field in setting register as n-1, measure
waveform, perform test, and etc.
Check the results of steps 1~n and adopt the setting that get best result.
This procedure does need to know the mapping between current to register
value.
Therefore, setting driving without mapping current is more practical for
MediaTek's smartphone usage.
Signed-off-by: Light Hsieh <light.hsieh@mediatek.com>
Link: https://lore.kernel.org/r/1579675994-7001-2-git-send-email-light.hsieh@mediatek.com
Acked-by: Sean Wang <sean.wang@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-22 06:53:10 +00:00
|
|
|
int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 arg);
|
|
|
|
int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, int *val);
|
|
|
|
|
2018-09-08 11:07:25 +00:00
|
|
|
int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup,
|
|
|
|
u32 arg);
|
|
|
|
int mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, bool pullup,
|
|
|
|
u32 *val);
|
pinctrl: add drive for I2C related pins on MT8183
This patch provides the advanced drive for I2C used pins on MT8183.
The detail strength specification description of the I2C pin:
When E1=0/E0=0, the strength is 0.125mA.
When E1=0/E0=1, the strength is 0.25mA.
When E1=1/E0=0, the strength is 0.5mA.
When E1=1/E0=1, the strength is 1mA.
For I2C pins, there are existing generic driving setup and the above
specific driving setup. I2C pins can only support 2/4/6/8/10/12/14/16mA
driving adjustment in generic driving setup. But in specific driving
setup, they can support 0.125/0.25/0.5/1mA adjustment.
If we enable specific driving setup for I2C pins,
the existing generic driving setup will be disabled.
For some special features, we need the I2C pins specific driving setup.
The specific driving setup is controlled by E1E0EN.
So we need add extra vendor driving preperty instead of the generic
driving property. We can add "mediatek,drive-strength-adv = <XXX>;"
to describe the specific driving setup property.
"XXX" means the value of E1E0EN. So the valid arguments of
"mediatek,drive-strength-adv" are from 0 to 7.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2019-04-01 03:35:35 +00:00
|
|
|
int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 arg);
|
|
|
|
int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw,
|
|
|
|
const struct mtk_pin_desc *desc, u32 *val);
|
2018-09-08 11:07:25 +00:00
|
|
|
|
2020-07-23 11:19:53 +00:00
|
|
|
bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n);
|
2018-09-08 11:07:17 +00:00
|
|
|
#endif /* __PINCTRL_MTK_COMMON_V2_H */
|