Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I3c controller driver #50

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ TAGS
tags

.idea
*.bak
2 changes: 1 addition & 1 deletion arch/arm/include/aarch32/cortex_m/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
extern "C" {
#endif

extern K_KERNEL_STACK_ARRAY_DEFINE(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
K_KERNEL_STACK_ARRAY_EXTERN(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
CONFIG_ISR_STACK_SIZE);

/**
Expand Down
8 changes: 8 additions & 0 deletions boards/arm/npcm400f_evb/fun_def_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ FUN_DEFINE(DT_NODELABEL(pinctrl_vin3_default), VIN3)
FUN_DEFINE(DT_NODELABEL(pinctrl_spip_default), SPIP_CS, SPIP_SCLK, SPIP_DIO0, SPIP_DIO1)
FUN_DEFINE(DT_NODELABEL(pinctrl_spip_quad), SPIP_DIO2, SPIP_DIO3)
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(i3c0), okay) && CONFIG_I3C_NPCM4XX
FUN_DEFINE(DT_NODELABEL(pinctrl_i3c0_default), I3C1_SCL, I3C1_SDA)
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(i3c1), okay) && CONFIG_I3C_NPCM4XX
FUN_DEFINE(DT_NODELABEL(pinctrl_i3c1_default), I3C2_SCL, I3C2_SDA)
#endif
45 changes: 44 additions & 1 deletion boards/arm/npcm400f_evb/npcm400f_evb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

&i2c6a {
clock-frequency = <200000>;
status = "okay";
status = "disabled";
};

&i2c1b {
Expand Down Expand Up @@ -164,3 +164,46 @@
&spip {
status = "okay";
};

&i3c0 {
status = "okay";
assigned-address = <0x20>;
i2c-scl-hz = <100000>;
i3c-scl-hz = <12500000>;
/* part-id = <0x1234>; */
/* vendor-def-id = <0x567>; */
bcr = <0x66>;
dcr = <0xCC>;
busno = <0x0>;
pinctrl-0 = <&pinctrl_i3c0_default>;
};

&i3c1 {
status = "okay";
assigned-address = <0x21>;
i2c-scl-hz = <100000>;
i3c-scl-hz = <12500000>;
/* part-id = <0x1234>; */
/* vendor-def-id = <0x5607>; */
bcr = <0x66>;
dcr = <0xCC>;
slave;
secondary;
busno = <0x0>;
pinctrl-0 = <&pinctrl_i3c1_default>;

/* #address-cells = <1>; */
/* #size-cells = <0>; */

/*
* i3c1_smq:i3c-slave-mqueue@21 {
* compatible = "aspeed,i3c-slave-mqueue";
* reg = <0x21>;
* msg-size = <256>;
* num-of-msgs = <4>;
* mandatory-data-byte = <0xbf>;
* label = "I3C_1_SMQ";
* status = "okay";
* };
*/
};
10 changes: 7 additions & 3 deletions boards/arm/npcm400f_evb/npcm400f_evb_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ CONFIG_WDT_NPCM4XX=y
CONFIG_NPCM4XX_MIWU=y

# PECI driver
CONFIG_PECI=y
CONFIG_PECI_NPCM4XX=y
#CONFIG_PECI=y
#CONFIG_PECI_NPCM4XX=y

#Counter Driver
CONFIG_COUNTER=y
Expand Down Expand Up @@ -77,4 +77,8 @@ CONFIG_ADC_NPCM4XX=y

#SPIP Driver
CONFIG_SPI=y
CONFIG_SPIP_NPCM4XX=y
CONFIG_SPIP_NPCM4XX=y

# I3C driver
CONFIG_I3C=y
CONFIG_I3C_NPCM4XX=y
1 change: 1 addition & 0 deletions drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ add_subdirectory_ifdef(CONFIG_GPIO gpio)
add_subdirectory_ifdef(CONFIG_EC_HOST_CMD_PERIPH ec_host_cmd_periph)
add_subdirectory_ifdef(CONFIG_I2C i2c)
add_subdirectory_ifdef(CONFIG_I2S i2s)
add_subdirectory_ifdef(CONFIG_I3C i3c)
add_subdirectory_ifdef(CONFIG_IEEE802154 ieee802154)
add_subdirectory_ifdef(CONFIG_IPM ipm)
add_subdirectory_ifdef(CONFIG_IPMI ipmi)
Expand Down
2 changes: 2 additions & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ source "drivers/i2c/Kconfig"

source "drivers/i2s/Kconfig"

source "drivers/i3c/Kconfig"

source "drivers/pwm/Kconfig"

source "drivers/pinmux/Kconfig"
Expand Down
13 changes: 13 additions & 0 deletions drivers/i3c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources(i3c_common.c)

zephyr_library_sources_ifdef(CONFIG_I3C_ASPEED i3c_global_aspeed.c)
#zephyr_library_sources_ifdef(CONFIG_I3C_ASPEED i3c_aspeed.c)

add_subdirectory_ifdef(CONFIG_I3C_NPCM4XX NPCM4XX)
zephyr_library_sources_ifdef(CONFIG_I3C_NPCM4XX i3c_npcm4xx.c)
#zephyr_library_sources_ifdef(CONFIG_I3C_SHELL i3c_shell.c)
#add_subdirectory_ifdef(CONFIG_I3C_SLAVE slave)
27 changes: 27 additions & 0 deletions drivers/i3c/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# I3C options

menuconfig I3C
bool "I3C Drivers"
help
Enable I3C Driver.

if I3C

config I3C_SHELL
bool "Enable I3C Shell"
default y
depends on SHELL
select SHELL_GETOPT
help
Enable I3C Shell.

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

#source "drivers/i3c/slave/Kconfig"

# Include these first so that any properties (e.g. defaults) below can be
# overridden (by defining symbols in multiple locations)
source "drivers/i3c/Kconfig.npcm4xx"
endif # I3C
10 changes: 10 additions & 0 deletions drivers/i3c/Kconfig.npcm4xx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# NPCM4XX I3C driver configuration options

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

config I3C_NPCM4XX
bool "NPCM4XX I3C driver"
depends on SOC_FAMILY_NPCM4XX
help
This option enables the I3C master driver for SOC_NPCM400F SoCs.
7 changes: 7 additions & 0 deletions drivers/i3c/NPCM4XX/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2023 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0

zephyr_sources_ifdef(CONFIG_I3C_NPCM4XX i3c_core.c)
zephyr_sources_ifdef(CONFIG_I3C_NPCM4XX i3c_master.c)
zephyr_sources_ifdef(CONFIG_I3C_NPCM4XX i3c_slave.c)
zephyr_sources_ifdef(CONFIG_I3C_NPCM4XX api_i3c.c)
Loading
Loading