Skip to content

Commit

Permalink
drivers: jtag: refactor npcm4xx jtag driver
Browse files Browse the repository at this point in the history
refactor npcm4xx jtag driver

1. add jtag driver from soc.
1. use dts to setup jtag gpio setting.

shell command:
ir_scan 0x8 0x16
dr_scan 0x20 0xffffffff

read lattice LC4128 device id ok.

Signed-off-by: cpchiang <[email protected]>
  • Loading branch information
cpchiang authored and maxdog988 committed Sep 7, 2023
1 parent 2f5fe91 commit cb2c743
Show file tree
Hide file tree
Showing 17 changed files with 1,403 additions and 458 deletions.
8 changes: 8 additions & 0 deletions boards/arm/npcm400f_evb/npcm400f_evb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,11 @@
&usbd0 {
status = "okay";
};

&jtag1 {
tck-gpios = <&gpiof 0 (GPIO_PUSH_PULL | GPIO_ACTIVE_HIGH)>;
tdi-gpios = <&gpiof 1 (GPIO_PUSH_PULL | GPIO_ACTIVE_HIGH)>;
tdo-gpios = <&gpiof 2 (GPIO_ACTIVE_HIGH)>;
tms-gpios = <&gpiof 3 (GPIO_PUSH_PULL | GPIO_ACTIVE_HIGH)>;
status = "okay";
};
5 changes: 5 additions & 0 deletions boards/arm/npcm400f_evb/npcm400f_evb_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ CONFIG_SPIP_NPCM4XX=y
# USB Driver
CONFIG_USB=y
CONFIG_USB_DC_NPCM4XX=y

# JTAG Driver
CONFIG_JTAG=y
CONFIG_JTAG_SHELL=y
CONFIG_JTAG_NPCM4XX=y
1 change: 1 addition & 0 deletions drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ add_subdirectory_ifdef(CONFIG_NEURAL_NET_ACCEL neural_net)
add_subdirectory_ifdef(CONFIG_PTP_CLOCK ptp_clock)
add_subdirectory_ifdef(CONFIG_EDAC edac)
add_subdirectory_ifdef(CONFIG_CACHE_MANAGEMENT cache)
add_subdirectory_ifdef(CONFIG_JTAG jtag)
2 changes: 2 additions & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@ source "drivers/disk/Kconfig"

source "drivers/cache/Kconfig"

source "drivers/jtag/Kconfig"

endmenu
6 changes: 6 additions & 0 deletions drivers/jtag/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources_ifdef(CONFIG_JTAG_SHELL jtag_shell.c)
zephyr_library_sources_ifdef(CONFIG_JTAG_NPCM4XX jtag_npcm4xx.c)
29 changes: 29 additions & 0 deletions drivers/jtag/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# JTAG configuration options

# Copyright (c) 2023 Zephyr
# SPDX-License-Identifier: Apache-2.0

#
# JTAG options
#
menuconfig JTAG
bool "JTAG drivers"
help
Enable JTAG driver configuration.

if JTAG

config JTAG_SHELL
bool "Enable JTAG Shell"
default y
depends on SHELL
help
Enable JTAG Shell for testing.

module = JTAG
module-str = JTAG
source "subsys/logging/Kconfig.template.log_config"

source "drivers/jtag/Kconfig.npcm4xx"

endif
12 changes: 12 additions & 0 deletions drivers/jtag/Kconfig.npcm4xx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# NPCM4XX JTAG driver configuration options

# Copyright (c) 2023 Nuvoton Technology Inc.
# SPDX-License-Identifier: Apache-2.0

config JTAG_NPCM4XX
bool "NPCM4XX JTAG driver"
depends on SOC_FAMILY_NPCM4XX
help
This option enables the JTAG driver for NPCM4XX family of
processors.
Say y if you wish to use JTAG channels on NPCM4XX MCU.
Loading

0 comments on commit cb2c743

Please sign in to comment.