soc: realrek: ec: Add debug_swj initial version of RTS5912.
Add swj driver for Realtek RTS5912. Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
This commit is contained in:
parent
2c25182572
commit
471cc3512d
5 changed files with 54 additions and 0 deletions
|
@ -80,6 +80,13 @@
|
|||
reg = <0x40090000 0x300>;
|
||||
};
|
||||
};
|
||||
|
||||
swj_port: swj-port {
|
||||
compatible = "swj-connector";
|
||||
pinctrl-0 = <&jtag_tdi_gpio87 &jtag_tdo_gpio88 &jtag_rst_gpio89
|
||||
&jtag_clk_gpio90 &jtag_tms_gpio91>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
||||
|
||||
&nvic {
|
||||
|
|
|
@ -12,4 +12,6 @@ zephyr_sources_ifdef(CONFIG_PM
|
|||
power.c
|
||||
)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_DT_HAS_SWJ_CONNECTOR_ENABLED debug_swj.c)
|
||||
|
||||
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")
|
||||
|
|
27
soc/realtek/ec/rts5912/debug_swj.c
Normal file
27
soc/realtek/ec/rts5912/debug_swj.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2024 Realtek Semiconductor Corporation, SIBG-SD7
|
||||
* Author: Titan Chen <titan.chen@realtek.com>
|
||||
*/
|
||||
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#include <zephyr/init.h>
|
||||
|
||||
#define SWJ_NODE DT_NODELABEL(swj_port)
|
||||
|
||||
PINCTRL_DT_DEFINE(SWJ_NODE);
|
||||
|
||||
const struct pinctrl_dev_config *swj_pcfg = PINCTRL_DT_DEV_CONFIG_GET(SWJ_NODE);
|
||||
|
||||
int swj_connector_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pinctrl_apply_state(swj_pcfg, PINCTRL_STATE_DEFAULT);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
8
soc/realtek/ec/rts5912/debug_swj.h
Normal file
8
soc/realtek/ec/rts5912/debug_swj.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2024 Realtek Semiconductor Corporation, SIBG-SD7
|
||||
* Author: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
|
||||
*/
|
||||
|
||||
int swj_connector_init(void);
|
|
@ -8,6 +8,10 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include "debug_swj.h"
|
||||
|
||||
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
|
||||
|
||||
#if defined(CONFIG_RTS5912_ON_ENTER_CPU_IDLE_HOOK)
|
||||
bool z_arm_on_enter_cpu_idle(void)
|
||||
|
@ -24,5 +28,11 @@ bool z_arm_on_enter_cpu_idle(void)
|
|||
*/
|
||||
void soc_early_init_hook(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Apply device related preinit configuration */
|
||||
ret = swj_connector_init();
|
||||
if (ret < 0) {
|
||||
LOG_ERR("SWJ init failed");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue