Message ID | 1ece86a9473a5f45ab36afd843c6e25cbaf08e4b.1614909515.git.weijie.gao@mediatek.com |
---|---|
State | Accepted |
Commit | 70a2b4220e55105aa6c970589a6a96d2714751f4 |
Delegated to: | Tom Rini |
Headers | show |
Series | Minor fixes for MediaTek pinctrl driver | expand |
On Fri, Mar 05, 2021 at 10:22:26AM +0800, Weijie Gao wrote: > The mtk pinctrl driver is a combination driver with support for both > pinctrl and gpio. When this driver is used in SPL, gpio support may not be > enabled, and this will result in a compilation error. > > To fix this, macros are added to make sure gpio related code will only be > compiled when gpio support is enabled. > > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> Applied to u-boot/next, thanks!
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index b2212c2559..264c6458c9 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -540,6 +540,8 @@ const struct pinctrl_ops mtk_pinctrl_ops = { .set_state = pinctrl_generic_set_state, }; +#if CONFIG_IS_ENABLED(DM_GPIO) || \ + (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT)) static int mtk_gpio_get(struct udevice *dev, unsigned int off) { int val, err; @@ -647,12 +649,13 @@ static int mtk_gpiochip_register(struct udevice *parent) return 0; } +#endif int mtk_pinctrl_common_probe(struct udevice *dev, struct mtk_pinctrl_soc *soc) { struct mtk_pinctrl_priv *priv = dev_get_priv(dev); - int ret; + int ret = 0; priv->base = dev_read_addr_ptr(dev); if (!priv->base) @@ -660,9 +663,10 @@ int mtk_pinctrl_common_probe(struct udevice *dev, priv->soc = soc; +#if CONFIG_IS_ENABLED(DM_GPIO) || \ + (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT)) ret = mtk_gpiochip_register(dev); - if (ret) - return ret; +#endif - return 0; + return ret; }
The mtk pinctrl driver is a combination driver with support for both pinctrl and gpio. When this driver is used in SPL, gpio support may not be enabled, and this will result in a compilation error. To fix this, macros are added to make sure gpio related code will only be compiled when gpio support is enabled. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> --- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)