drivers: can: mcux_flexcan: Add clock configuration and enable
Add explicit clock configuration and enable calls during driver initialization. Note: -ENOSYS is temporarily ignored as not all clock control drivers currently implement the configure API. This handling should be removed once all clock drivers support configure. Signed-off-by: Albort Xue <yao.xue@nxp.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2026 Vestas Wind Systems A/S
|
||||
* Copyright 2025 NXP
|
||||
* Copyright 2025-2026 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -1176,6 +1176,24 @@ static int mcux_flexcan_init(const struct device *dev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
err = clock_control_configure(config->clock_dev, config->clock_subsys, NULL);
|
||||
if (err) {
|
||||
/* Check if error is due to lack of support */
|
||||
if (err != -ENOSYS) {
|
||||
/* Real error occurred */
|
||||
LOG_ERR("Failed to configure clock: %d", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
#if FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL
|
||||
err = clock_control_on(config->clock_dev, config->clock_subsys);
|
||||
if (err) {
|
||||
LOG_ERR("Failed to enable clock: %d", err);
|
||||
return err;
|
||||
}
|
||||
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
|
||||
|
||||
DEVICE_MMIO_NAMED_MAP(dev, flexcan_mmio, K_MEM_CACHE_NONE | K_MEM_DIRECT_MAP);
|
||||
|
||||
LOG_DBG("Message Buffers: %d, RX MB: %d, TX MB: %d",
|
||||
|
||||
Reference in New Issue
Block a user