diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2021-06-24 16:46:31 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-28 12:56:38 +0000 |
commit | 5d9859ffa6bc1687818bbc3c955a20c7e0a2db07 (patch) | |
tree | 6617b0d31f24257d8eb906747fb665e0f50c6c3b | |
parent | bcaeebb1efb5f26ee6ef63e19b97894a3b89ab22 (diff) | |
download | chrome-ec-5d9859ffa6bc1687818bbc3c955a20c7e0a2db07.tar.gz |
zephyr: shim: use DEVICE_DT_GET for clock control
This changes the clock control calls to use DEVICE_DT_GET instead of
device_get_binding. DEVICE_DT_GET is more efficient since it's allocated
at link time.
These are then used by clock_control_on, which already checks for
device_is_ready, so no extra safety checks are needed.
BRANCH=none
BUG=none
TEST=zmake configure -b -B ~/build-volteer/ zephyr/projects/volteer/volteer
TEST=zmake configure -b -B ~/build-it8xxx2_evb/ zephyr/projects/it8xxx2_evb
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: I76a2c47165d197c799be25d8e7e40a1a0873777d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2985462
Reviewed-by: Yuval Peress <peress@chromium.org>
-rw-r--r-- | zephyr/drivers/cros_flash/cros_flash_npcx.c | 3 | ||||
-rw-r--r-- | zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c | 3 | ||||
-rw-r--r-- | zephyr/drivers/cros_shi/cros_shi_npcx.c | 3 | ||||
-rw-r--r-- | zephyr/shim/chip/npcx/clock.c | 2 |
4 files changed, 4 insertions, 7 deletions
diff --git a/zephyr/drivers/cros_flash/cros_flash_npcx.c b/zephyr/drivers/cros_flash/cros_flash_npcx.c index 92ebc98c2f..5c81353ef8 100644 --- a/zephyr/drivers/cros_flash/cros_flash_npcx.c +++ b/zephyr/drivers/cros_flash/cros_flash_npcx.c @@ -491,8 +491,7 @@ static const struct cros_flash_driver_api cros_flash_npcx_driver_api = { static int flash_npcx_init(const struct device *dev) { const struct cros_flash_npcx_config *const config = DRV_CONFIG(dev); - const struct device *const clk_dev = - device_get_binding(NPCX_CLK_CTRL_NAME); + const struct device *clk_dev = DEVICE_DT_GET(DT_NODELABEL(pcc)); int ret; diff --git a/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c b/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c index 99164e46fd..c704e45738 100644 --- a/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c +++ b/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c @@ -71,8 +71,7 @@ static void kb_raw_npcx_init_ksi_wui_callback( static int kb_raw_npcx_init(const struct device *dev) { const struct cros_kb_raw_npcx_config *const config = DRV_CONFIG(dev); - const struct device *const clk_dev = - device_get_binding(NPCX_CLK_CTRL_NAME); + const struct device *clk_dev = DEVICE_DT_GET(DT_NODELABEL(pcc)); int ret; /* Turn on device clock first and get source clock freq. */ diff --git a/zephyr/drivers/cros_shi/cros_shi_npcx.c b/zephyr/drivers/cros_shi/cros_shi_npcx.c index df5d9dfda1..5027d0eeaf 100644 --- a/zephyr/drivers/cros_shi/cros_shi_npcx.c +++ b/zephyr/drivers/cros_shi/cros_shi_npcx.c @@ -804,8 +804,7 @@ static int shi_npcx_init(const struct device *dev) int ret; const struct cros_shi_npcx_config *const config = DRV_CONFIG(dev); struct shi_reg *const inst = HAL_INSTANCE(dev); - const struct device *const clk_dev = - device_get_binding(NPCX_CLK_CTRL_NAME); + const struct device *clk_dev = DEVICE_DT_GET(DT_NODELABEL(pcc)); /* Turn on shi device clock first */ ret = clock_control_on(clk_dev, diff --git a/zephyr/shim/chip/npcx/clock.c b/zephyr/shim/chip/npcx/clock.c index 24ae45d107..cd483682b8 100644 --- a/zephyr/shim/chip/npcx/clock.c +++ b/zephyr/shim/chip/npcx/clock.c @@ -22,7 +22,7 @@ LOG_MODULE_REGISTER(shim_clock, LOG_LEVEL_ERR); int clock_get_freq(void) { - const struct device *clk_dev = device_get_binding(NPCX_CLK_CTRL_NAME); + const struct device *clk_dev = DEVICE_DT_GET(DT_NODELABEL(pcc)); const struct npcx_clk_cfg clk_cfg = { .bus = NPCX_CLOCK_BUS_CORE, }; |