diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2017-04-07 15:57:11 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-04-24 15:53:58 +0300 |
commit | 7f354fd13877aae8abcd7b5a389cc85e3d2e4ed1 (patch) | |
tree | 527f44d7155492213298d45f3a2c21c9c78a1d54 /drivers/pinctrl/aspeed/pinctrl-aspeed.h | |
parent | 6de2185bc70781efd8ec26ff45329b57288d1880 (diff) | |
download | linux-7f354fd13877aae8abcd7b5a389cc85e3d2e4ed1.tar.xz |
pinctrl: aspeed: Add core pinconf support
Several pinconf parameters have a fairly straight-forward mapping onto
the Aspeed pin controller. These include management of pull-down bias,
drive-strength, and some debounce configuration.
Pin biasing largely is managed on a per-GPIO-bank basis, aside from the
ADC and RMII/RGMII pins. As the bias configuration for each pin in a
bank maps onto a single per-bank bit, configuration tables will be
introduced to describe the ranges of pins and the supported pinconf
parameter. The use of tables also helps with the sparse support of
pinconf properties, and the fact that not all GPIO banks support
biasing or drive-strength configuration.
Further, as the pin controller uses a consistent approach for bias and
drive strength configuration at the register level, a second table is
defined for looking up the the bit-state required to enable or query the
provided configuration.
Testing for pinctrl-aspeed-g4 was performed on an OpenPOWER Palmetto
system, and pinctrl-aspeed-g5 on an AST2500EVB as well as under QEMU.
The test method was to set the appropriate bits via devmem and verify
the result through the controller's pinconf-pins debugfs file. This
simultaneously validates the get() path and half of the set() path. The
remainder of the set() path was validated by configuring a handful of
pins via the devicetree with the supported pinconf properties and
verifying the appropriate registers were touched.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/aspeed/pinctrl-aspeed.h')
-rw-r--r-- | drivers/pinctrl/aspeed/pinctrl-aspeed.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.h b/drivers/pinctrl/aspeed/pinctrl-aspeed.h index 08a10d4db229..fa125db828f5 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.h +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.h @@ -514,6 +514,20 @@ struct aspeed_pin_desc { SIG_EXPR_LIST_DECL_SINGLE(gpio, gpio); \ MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(gpio)) +/** + * @param The pinconf parameter type + * @pins The pin range this config struct covers, [low, high] + * @reg The register housing the configuration bits + * @mask The mask to select the bits of interest in @reg + */ +struct aspeed_pin_config { + enum pin_config_param param; + unsigned int pins[2]; + unsigned int reg; + u8 bit; + u8 value; +}; + struct aspeed_pinctrl_data { struct regmap *maps[ASPEED_NR_PINMUX_IPS]; @@ -525,6 +539,9 @@ struct aspeed_pinctrl_data { const struct aspeed_pin_function *functions; const unsigned int nfunctions; + + const struct aspeed_pin_config *configs; + const unsigned int nconfigs; }; #define ASPEED_PINCTRL_PIN(name_) \ @@ -580,5 +597,16 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev, int aspeed_pinctrl_probe(struct platform_device *pdev, struct pinctrl_desc *pdesc, struct aspeed_pinctrl_data *pdata); +int aspeed_pin_config_get(struct pinctrl_dev *pctldev, unsigned int offset, + unsigned long *config); +int aspeed_pin_config_set(struct pinctrl_dev *pctldev, unsigned int offset, + unsigned long *configs, unsigned int num_configs); +int aspeed_pin_config_group_get(struct pinctrl_dev *pctldev, + unsigned int selector, + unsigned long *config); +int aspeed_pin_config_group_set(struct pinctrl_dev *pctldev, + unsigned int selector, + unsigned long *configs, + unsigned int num_configs); #endif /* PINCTRL_ASPEED */ |