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

remove unnecessary commit #148

Closed
wants to merge 17 commits into from
Closed
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
2 changes: 2 additions & 0 deletions boards/arm/npcm400f_evb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
if(CONFIG_PINMUX_NPCM4XX)
zephyr_include_directories(.)
endif()

set_property(GLOBAL PROPERTY CSTD c11)
4 changes: 4 additions & 0 deletions boards/arm/npcm400f_evb/fun_def_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ FUN_DEFINE(DT_NODELABEL(pinctrl_sgpio0_default), IOX1_LDSH, IOX1_DOUT, IOX1_DIN,
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sgpio1), okay) && CONFIG_SGPIO_NPCM4XX
FUN_DEFINE(DT_NODELABEL(pinctrl_sgpio1_default), IOX2_LDSH, IOX2_DOUT, IOX2_DIN, IOX2_SCLK)
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(emac), okay) && CONFIG_ETH_NPCM4XX
FUN_DEFINE(DT_NODELABEL(pinctrl_emac_default), EMAC)
#endif
14 changes: 13 additions & 1 deletion boards/arm/npcm400f_evb/npcm400f_evb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
current-speed = <115200>;
};

&twd0 {
status = "okay";
};

&peci0 {
status = "okay";
pinctrl-0 = <&pinctrl_peci0_default>;
Expand Down Expand Up @@ -233,7 +237,7 @@
tdi-gpios = <&gpio0 1 (GPIO_PUSH_PULL | GPIO_ACTIVE_HIGH)>;
tdo-gpios = <&gpio0 2 (GPIO_ACTIVE_HIGH)>;
tms-gpios = <&gpio0 3 (GPIO_PUSH_PULL | GPIO_ACTIVE_HIGH)>;
status = "okay";
status = "disabled";
};

&i3c4 {
Expand Down Expand Up @@ -608,3 +612,11 @@
pin-offset = <120>;
};
};

&emac {
status = "okay";
};

&snoop {
status = "okay";
};
28 changes: 25 additions & 3 deletions boards/arm/npcm400f_evb/npcm400f_evb_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,31 @@ CONFIG_USB=y
CONFIG_USB_DC_NPCM4XX=y

# JTAG Driver
CONFIG_JTAG=y
CONFIG_JTAG_SHELL=y
CONFIG_JTAG_NPCM4XX=y
CONFIG_JTAG=n
CONFIG_JTAG_SHELL=n
CONFIG_JTAG_NPCM4XX=n

# SGPIO Driver
CONFIG_SGPIO_NPCM4XX=n

# EMAC Driver
CONFIG_ETH_NPCM4XX=y

# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=n
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SHELL=y
CONFIG_NET_TCP_ISN_RFC6528=n
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_AUTO_INIT=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
CONFIG_NET_CONFIG_INIT_TIMEOUT=3

# Network driver config
CONFIG_TEST_RANDOM_GENERATOR=y
49 changes: 40 additions & 9 deletions drivers/espi/espi_npcm4xx.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct espi_npcm4xx_data {
#define ESPI_OOB_GET_CYCLE_TYPE 0x21
#define ESPI_OOB_TAG 0x00
#define ESPI_OOB_MAX_TIMEOUT 500ul /* 500 ms */
#define VWGPMS_DIRECTION 7

/* eSPI bus interrupt configuration structure and macro function */
struct espi_bus_isr {
Expand Down Expand Up @@ -247,6 +248,26 @@ static void espi_bus_cfg_update_isr(const struct device *dev)
}
}

static void espi_bus_vw_update_isr(const struct device *dev)
{
LOG_DBG("ESPI VW Updated!");

struct espi_reg *const inst = HAL_INSTANCE(dev);
struct espi_npcm4xx_data *const data = DRV_DATA(dev);
uint8_t i;
struct espi_event evt = { ESPI_BUS_EVENT_VWIRE_RECEIVED, 0, 0 };


for (i = 0; i < ARRAY_SIZE(inst->VWGPMS); i++) {
if (IS_BIT_SET(inst->VWGPMS[i], NPCM4XX_VWGPMS_MODIFIED)) {
inst->VWGPMS[i] |= BIT(NPCM4XX_VWGPMS_MODIFIED);
evt.evt_details = (NPCM4XX_VWGP_M_TO_S << VWGPMS_DIRECTION) | i;
evt.evt_data = (uint8_t)(inst->VWGPMS[i] & 0xFF);
espi_send_callbacks(&data->callbacks, dev, evt);
}
}
}

#if defined(CONFIG_ESPI_OOB_CHANNEL)
static void espi_bus_oob_rx_isr(const struct device *dev)
{
Expand All @@ -262,6 +283,7 @@ const struct espi_bus_isr espi_bus_isr_tbl[] = {
NPCM4XX_ESPI_BUS_INT_ITEM(IBRST, espi_bus_inband_rst_isr),
NPCM4XX_ESPI_BUS_INT_ITEM(ESPIRST, espi_bus_reset_isr),
NPCM4XX_ESPI_BUS_INT_ITEM(CFGUPD, espi_bus_cfg_update_isr),
NPCM4XX_ESPI_BUS_INT_ITEM(VWUPD, espi_bus_vw_update_isr),
#if defined(CONFIG_ESPI_OOB_CHANNEL)
NPCM4XX_ESPI_BUS_INT_ITEM(OOBRX, espi_bus_oob_rx_isr),
#endif
Expand Down Expand Up @@ -337,17 +359,17 @@ static void espi_vw_notify_system_state(const struct device *dev,
enum espi_vwire_signal signal)
{
struct espi_npcm4xx_data *const data = DRV_DATA(dev);
struct espi_event evt = { ESPI_BUS_EVENT_VWIRE_RECEIVED, 0, 0 };
//struct espi_event evt = { ESPI_BUS_EVENT_VWIRE_RECEIVED, 0, 0 };
uint8_t wire = 0;

espi_npcm4xx_receive_vwire(dev, signal, &wire);
if (!wire) {
data->sx_state = signal;
}

evt.evt_details = signal;
evt.evt_data = wire;
espi_send_callbacks(&data->callbacks, dev, evt);
//evt.evt_details = signal;
//evt.evt_data = wire;
//espi_send_callbacks(&data->callbacks, dev, evt);
}

static void espi_vw_notify_host_warning(const struct device *dev,
Expand Down Expand Up @@ -381,9 +403,9 @@ static void espi_vw_notify_plt_rst(const struct device *dev)
{
struct espi_npcm4xx_data *const data = DRV_DATA(dev);
struct espi_reg *const inst = HAL_INSTANCE(dev);
struct espi_event evt = { ESPI_BUS_EVENT_VWIRE_RECEIVED,
ESPI_VWIRE_SIGNAL_PLTRST, 0
};
//struct espi_event evt = { ESPI_BUS_EVENT_VWIRE_RECEIVED,
// ESPI_VWIRE_SIGNAL_PLTRST, 0
//};
uint8_t wire = 0;

espi_npcm4xx_receive_vwire(dev, ESPI_VWIRE_SIGNAL_PLTRST, &wire);
Expand All @@ -398,8 +420,8 @@ static void espi_vw_notify_plt_rst(const struct device *dev)
/* PLT_RST will be received several times */
if (wire != data->plt_rst_asserted) {
data->plt_rst_asserted = wire;
evt.evt_data = wire;
espi_send_callbacks(&data->callbacks, dev, evt);
//evt.evt_data = wire;
//espi_send_callbacks(&data->callbacks, dev, evt);
}
}

Expand Down Expand Up @@ -913,6 +935,15 @@ static int espi_npcm4xx_init(const struct device *dev)
espi_init_wui_callback(dev, &espi_rst_callback,
&config->espi_rst_wui, espi_vw_espi_rst_isr);

for (i = 0; i < ARRAY_SIZE(inst->VWGPMS); i++) {
inst->VWGPMS[i] |= (BIT(NPCM4XX_VWGPMS_INDEX_EN) | BIT(NPCM4XX_VWGPMS_IE));
inst->VWGPMS[i] &= ~BIT(NPCM4XX_VWGPMS_ENESPIRST);
}

for (i = 0; i < ARRAY_SIZE(inst->VWGPSM); i++) {
inst->VWGPSM[i] |= (BIT(NPCM4XX_VWGPSM_INDEX_EN) | BIT(NPCM4XX_VWGPSM_IE));
}

espi_npcm4xx_configure(dev, &cfg);
/* Configure host sub-modules which HW blocks belong to core domain */
npcm4xx_host_init_subs_core_domain(dev, &data->callbacks);
Expand Down
1 change: 1 addition & 0 deletions drivers/ethernet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ zephyr_sources_ifdef(CONFIG_ETH_STM32_HAL eth_stm32_hal.c)
zephyr_sources_ifdef(CONFIG_ETH_LITEETH eth_liteeth.c)
zephyr_sources_ifdef(CONFIG_ETH_W5500 eth_w5500.c)
zephyr_sources_ifdef(CONFIG_DSA_KSZ8794 dsa_ksz8794.c)
zephyr_sources_ifdef(CONFIG_ETH_NPCM4XX eth_npcm4xx.c)

if(CONFIG_ETH_NATIVE_POSIX)
zephyr_library()
Expand Down
1 change: 1 addition & 0 deletions drivers/ethernet/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ source "drivers/ethernet/Kconfig.liteeth"
source "drivers/ethernet/Kconfig.gecko"
source "drivers/ethernet/Kconfig.w5500"
source "drivers/ethernet/Kconfig.dsa"
source "drivers/ethernet/Kconfig.npcm4xx"

endmenu # "Ethernet Drivers"
71 changes: 71 additions & 0 deletions drivers/ethernet/Kconfig.npcm4xx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Nuvoton Ethernet driver configuration options

# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_NUVOTON_NPCM4XX_ETHERNET := nuvoton,npcm4xx-ethernet

config ETH_NPCM4XX
bool "Nuvoton NPCM4XX Ethernet driver"
depends on SOC_FAMILY_NPCM4XX
help
This option enables the ethernet driver for NPCM4XX family of
processors.
Say y if you wish to use ethernet on NPCM4XX MCU.

config ETH_NPCM4XX_RX_THREAD_STACK_SIZE
int "RX thread stack size"
default 4096
help
RX thread stack size

config ETH_NPCM4XX_RX_THREAD_PRIO
int "RX thread priority"
default 3
help
RX thread priority

config ETH_NPCM4XX_PHY_ADDRESS
int "Phy address"
default 1
help
The phy address to use.

config ETH_NPCM4XX_RANDOM_MAC
bool "Random MAC address"
depends on ENTROPY_GENERATOR
default y
help
Generate a random MAC address dynamically.

if !ETH_NPCM4XX_RANDOM_MAC

config ETH_NPCM4XX_MAC3
hex "MAC Address Byte 3"
default 0
range 0 0xff
help
This is the byte 3 of the MAC address.

config ETH_NPCM4XX_MAC4
hex "MAC Address Byte 4"
default 0
range 0 0xff
help
This is the byte 4 of the MAC address.

config ETH_NPCM4XX_MAC5
hex "MAC Address Byte 5"
default 0
range 0 0xff
help
This is the byte 5 of the MAC address.

endif # !ETH_NPCM4XX_RANDOM_MAC

config ETH_NPCM4XX_CARRIER_CHECK_RX_IDLE_TIMEOUT_MS
int "Carrier check timeout period (ms)"
default 500
range 100 30000
help
Set the RX idle timeout period in milliseconds after which the
PHY's carrier status is re-evaluated.
Loading
Loading