1 From d3fbbef13853a695cdea75a980a3d6bd150a68c1 Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Mon, 11 Jan 2021 10:17:15 +0800
4 Subject: [PATCH 05/21] pinctrl: mediatek: do not probe gpio driver if not
7 The mtk pinctrl driver is a combination driver with support for both
8 pinctrl and gpio. When this driver is used in SPL, gpio support may not be
9 enabled, and this will result in a compilation error.
11 To fix this, macros are added to make sure gpio related code will only be
12 compiled when gpio support is enabled.
14 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
16 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 ++++++++----
17 1 file changed, 8 insertions(+), 4 deletions(-)
19 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
20 +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
21 @@ -540,6 +540,8 @@ const struct pinctrl_ops mtk_pinctrl_ops
22 .set_state = pinctrl_generic_set_state,
25 +#if CONFIG_IS_ENABLED(DM_GPIO) || \
26 + (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
27 static int mtk_gpio_get(struct udevice *dev, unsigned int off)
30 @@ -647,12 +649,13 @@ static int mtk_gpiochip_register(struct
36 int mtk_pinctrl_common_probe(struct udevice *dev,
37 struct mtk_pinctrl_soc *soc)
39 struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
43 priv->base = dev_read_addr_ptr(dev);
45 @@ -660,9 +663,10 @@ int mtk_pinctrl_common_probe(struct udev
49 +#if CONFIG_IS_ENABLED(DM_GPIO) || \
50 + (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
51 ret = mtk_gpiochip_register(dev);