mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-27 07:51:38 +00:00
pinctrl: mediatek: Bind gpio while binding pinctrl
Mediatek pinctrl drivers call mtk_gpiochip_register() to bind the child gpio controller as part of mtk_pinctrl_common_probe(). This breaks gpiohog support because the gpio controller is bound too late for DM_FLAG_PROBE_AFTER_BIND (set while binding hogs) to work. Move the mtk_gpiochip_register() to mtk_pinctrl_common_bind() and call this as the .bind method of each of the mediatek pinctrl drivers. Signed-off-by: Chris Webb <chris@arachsys.com>
This commit is contained in:
parent
c530f6079c
commit
f4df9f53b7
11 changed files with 21 additions and 7 deletions
|
@ -749,6 +749,7 @@ U_BOOT_DRIVER(mt7622_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt7622_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt7622_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -1410,6 +1410,7 @@ U_BOOT_DRIVER(mt7623_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt7623_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt7623_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -413,6 +413,7 @@ U_BOOT_DRIVER(mt7629_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt7629_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt7629_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -1048,6 +1048,7 @@ U_BOOT_DRIVER(mt7981_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt7981_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt7981_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
|
|
|
@ -773,6 +773,7 @@ U_BOOT_DRIVER(mt7986_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt7986_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt7986_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -1269,6 +1269,7 @@ U_BOOT_DRIVER(mt7988_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt7988_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt7988_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -382,6 +382,7 @@ U_BOOT_DRIVER(mt8512_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt8512_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt8512_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -388,6 +388,7 @@ U_BOOT_DRIVER(mt8516_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt8516_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt8516_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -408,6 +408,7 @@ U_BOOT_DRIVER(mt8518_pinctrl) = {
|
|||
.id = UCLASS_PINCTRL,
|
||||
.of_match = mt8518_pctrl_match,
|
||||
.ops = &mtk_pinctrl_ops,
|
||||
.bind = mtk_pinctrl_common_bind,
|
||||
.probe = mtk_pinctrl_mt8518_probe,
|
||||
.priv_auto = sizeof(struct mtk_pinctrl_priv),
|
||||
};
|
||||
|
|
|
@ -791,11 +791,20 @@ bind:
|
|||
}
|
||||
#endif
|
||||
|
||||
int mtk_pinctrl_common_bind(struct udevice *dev)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(DM_GPIO) || \
|
||||
(defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO))
|
||||
return mtk_gpiochip_register(dev);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int mtk_pinctrl_common_probe(struct udevice *dev,
|
||||
const struct mtk_pinctrl_soc *soc)
|
||||
{
|
||||
struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
int ret = 0;
|
||||
u32 i = 0;
|
||||
fdt_addr_t addr;
|
||||
u32 base_calc = soc->base_calc;
|
||||
|
@ -813,10 +822,5 @@ int mtk_pinctrl_common_probe(struct udevice *dev,
|
|||
priv->base[i] = (void __iomem *)addr;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(DM_GPIO) || \
|
||||
(defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO))
|
||||
ret = mtk_gpiochip_register(dev);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -241,6 +241,7 @@ extern const struct pinctrl_ops mtk_pinctrl_ops;
|
|||
/* A common read-modify-write helper for MediaTek chips */
|
||||
void mtk_rmw(struct udevice *dev, u32 reg, u32 mask, u32 set);
|
||||
void mtk_i_rmw(struct udevice *dev, u8 i, u32 reg, u32 mask, u32 set);
|
||||
int mtk_pinctrl_common_bind(struct udevice *dev);
|
||||
int mtk_pinctrl_common_probe(struct udevice *dev,
|
||||
const struct mtk_pinctrl_soc *soc);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue