"Das U-Boot" Source Tree

serial: mxc: Support bulk enabling clocks

Depending on the platform, there may be multiple clock sources
required to enable a UART. Use the bulk functions to get and
enable the clocks when the UART probes. This can facilitate
the removal of functions to manually enable the clock.

This is made dependent on CLK_CCF which is used on imx6q,
imx8m[mnqp], several imxrt, imx9. If/when the UART clock
registration is done for older boards, this limitation
could be updated.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>

authored by

Adam Ford and committed by
Fabio Estevam
dda454e9 8999b76f

+14
+11
drivers/serial/serial_mxc.c
··· 3 3 * (c) 2007 Sascha Hauer <s.hauer@pengutronix.de> 4 4 */ 5 5 6 + #include <clk.h> 6 7 #include <dm.h> 7 8 #include <errno.h> 8 9 #include <watchdog.h> ··· 312 313 static int mxc_serial_probe(struct udevice *dev) 313 314 { 314 315 struct mxc_serial_plat *plat = dev_get_plat(dev); 316 + #if CONFIG_IS_ENABLED(CLK_CCF) 317 + int ret; 315 318 319 + ret = clk_get_bulk(dev, &plat->clks); 320 + if (ret) 321 + return ret; 322 + 323 + ret = clk_enable_bulk(&plat->clks); 324 + if (ret) 325 + return ret; 326 + #endif 316 327 _mxc_serial_init(plat->reg, plat->use_dte); 317 328 318 329 return 0;
+3
include/dm/platform_data/serial_mxc.h
··· 9 9 /* Information about a serial port */ 10 10 struct mxc_serial_plat { 11 11 struct mxc_uart *reg; /* address of registers in physical memory */ 12 + #if CONFIG_IS_ENABLED(CLK_CCF) 13 + struct clk_bulk clks; 14 + #endif 12 15 bool use_dte; 13 16 }; 14 17