diff --git a/components/drivers/core/platform.c b/components/drivers/core/platform.c index d308dd08065..48b7077a03d 100644 --- a/components/drivers/core/platform.c +++ b/components/drivers/core/platform.c @@ -18,6 +18,7 @@ #ifdef RT_USING_CLK #include #endif +#include #include #include #include @@ -122,6 +123,13 @@ static rt_err_t platform_probe(rt_device_t dev) struct rt_ofw_node *np = dev->ofw_node; #endif +#ifdef RT_USING_PINCTRL + if (rt_pin_ctrl_confs_apply_by_name(dev, RT_NULL)) + { + rt_pin_ctrl_confs_apply(dev, 0); + } +#endif + #ifdef RT_USING_CLK if ((err = rt_ofw_clk_set_defaults(dev->ofw_node))) { diff --git a/components/drivers/serial/dev_serial.c b/components/drivers/serial/dev_serial.c index 3ebe3063ace..45bf97c3289 100644 --- a/components/drivers/serial/dev_serial.c +++ b/components/drivers/serial/dev_serial.c @@ -664,11 +664,6 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag) /* get open flags */ dev->open_flag = oflag & 0xff; -#ifdef RT_USING_PINCTRL - /* initialize iomux in DM */ - rt_pin_ctrl_confs_apply_by_name(dev, RT_NULL); -#endif - /* initialize the Rx/Tx structure according to open flag */ if (serial->serial_rx == RT_NULL) {