Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
43a7923
board: ip_k66f: Add support for RTT based console
Mar 25, 2020
c3a551c
dts: ip_k66f: Enable eth on the ip_k66f board
Mar 25, 2020
72fd3c6
dts: ip_k66f: Enable spi1 on the ip_k66f board
Mar 25, 2020
46524b7
samples: Setup default ping IP to 192.168.x.y
Mar 28, 2020
df0e97d
ip_k66f: pinmux: eth: Add ETH support
Mar 25, 2020
98adb6a
ip_k66f: pinmux: Add pins configuration for SPI1
Mar 25, 2020
71b81c3
ip_k66f: pinmux: Add support for PTE26 to work as clock source for RMII
Apr 3, 2020
8ef41af
ip_k66f: Set reset and PME ETH pins to high
Mar 28, 2020
034cf2d
defconfig: Enable support for SPI on ip_k66f
Mar 25, 2020
3439af4
defconfig: Enable support for ETH on ip_k66f
Mar 29, 2020
aa5333d
defconfig: ip_k66f: Add SHELL support via RTT
Mar 28, 2020
a22fe65
defconfig: Increase the size of RTT console "UP" buffer
Apr 9, 2020
d42de3a
defconfig: ip_k66f: Set proper CONFIG_OSC_XTAL0_FREQ to 12MHz
Mar 29, 2020
aa61681
eth: Kconfig: Add ETH_MCUX_RMII_EXT_CLK option to enable external RMI…
Apr 10, 2020
4e60551
nxp: k6x: Modify clock_init to enable external RMII clock source
Apr 3, 2020
f354046
clk: ip_k66f: Use 120MHz as a source clock on ip_k66f as it is in FRD…
Mar 29, 2020
fe2a627
Kconfig: Cleanup the ip_k66f_defconfig and move defines to Kconfig.de…
Apr 3, 2020
7c91da7
defconfig: Enable RMII_EXT_CLK
Apr 10, 2020
78803a5
eth: mcux: Add support to NXP's Kinetics ENET for devices not using S…
Apr 11, 2020
a6f1daa
eth: Kconfig: Add ETH_MCUX_NO_PHY_SMI option to disable PHY communica…
Apr 11, 2020
5f884f8
defconfig: ip_k66f: Enable ETH_MCUX_NO_PHY_SMI on ip_k66f board
Apr 11, 2020
b85d9a1
eth: mcux: Add support to NXP's Kinetics ENET for FIXED PHY setup
Apr 12, 2020
9d9edc4
eth: Kconfig: Add ETH_MCUX_FIXED_PHY option to configure PHY in Kconfig
Apr 12, 2020
fb31c15
defconfig: ip_k66f: Enable ETH_MCUX_FIXED_PHY on ip_k66f board
Apr 12, 2020
e604d4e
net: dsa: Add support for KSZ8794 DSA device
Mar 26, 2020
4bbf4d5
eth: Add support for Distributed Switch Architecture [DSA] switches
Apr 13, 2020
ca8731c
eth: mcux: Add support for Distributed Switch Architecture devices
Apr 13, 2020
2b3c6f8
defconfig: ip_k66f: Enable support for KSZ8794 DSA device on ip_k66f …
Apr 13, 2020
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
43 changes: 42 additions & 1 deletion boards/arm/ip_k66f/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config BOARD
default "ip_k66f"

config OSC_XTAL0_FREQ
default 50000000
default 12000000

config MCG_PRDIV0
default 0x0
Expand All @@ -20,6 +20,41 @@ config MCG_VDIV0
config MCG_FCRDIV
default 1

if SPI
config SPI_1
default y

endif # SPI

if NETWORKING

config NET_L2_ETHERNET
default y if !MODEM

config ETH_MCUX
default y if NET_L2_ETHERNET

config ETH_MCUX_0
default y if ETH_MCUX

config ETH_MCUX_RMII_EXT_CLK
default y if ETH_MCUX

config ETH_MCUX_NO_PHY_SMI
default y if ETH_MCUX

config ETH_MCUX_FIXED_PHY
default y if ETH_MCUX

endif # NETWORKING

if DSA

config DSA_KSZ8794
default y if SPI

endif # DSA

if PINMUX_MCUX

config PINMUX_MCUX_PORTA
Expand All @@ -28,6 +63,9 @@ config PINMUX_MCUX_PORTA
config PINMUX_MCUX_PORTB
default y if SPI_1

config PINMUX_MCUX_PORTE
default y if ETH_MCUX_0

endif # PINMUX_MCUX

if GPIO_MCUX
Expand All @@ -38,6 +76,9 @@ config GPIO_MCUX_PORTA
config GPIO_MCUX_PORTB
default y

config GPIO_MCUX_PORTE
default y

endif # GPIO_MCUX

endif # BOARD_IP_K66F
12 changes: 12 additions & 0 deletions boards/arm/ip_k66f/ip_k66f.dts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
aliases {
led0 = &red0_led;
led2 = &red2_led;
dsa-spi = &spi1;
};

chosen {
Expand Down Expand Up @@ -81,3 +82,14 @@
};
};
};

&eth {
status = "okay";
};

&spi1 {
status = "okay";

cs-gpios = <&gpiob 10 GPIO_ACTIVE_LOW>;
clock-frequency = <10000000>;
};
23 changes: 21 additions & 2 deletions boards/arm/ip_k66f/ip_k66f_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,30 @@ CONFIG_BOARD_IP_K66F=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_GPIO=y
CONFIG_PINMUX=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=180000000
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000
CONFIG_OSC_LOW_POWER=y
CONFIG_OSC_XTAL0_FREQ=12000000
CONFIG_K6X_FLEXBUS_CLOCK_DIVIDER=2
CONFIG_USE_SEGGER_RTT=y

# Add RTT console support
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN=64

# Add RTT SHELL support -> Instead of LOG_BACKEND_RTT
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_RTT=y
CONFIG_SHELL_BACKEND_SERIAL=n

# Enable MPU
CONFIG_ARM_MPU=y

# Setup ETH
CONFIG_NETWORKING=y
CONFIG_DSA=y

# The KSZ8794 needs SPI to get MII registers data
CONFIG_SPI=y

# Set default LOG level to DBG
#CONFIG_LOG_DEFAULT_LEVEL=4
40 changes: 40 additions & 0 deletions boards/arm/ip_k66f/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <init.h>
#include <drivers/pinmux.h>
#include <fsl_port.h>
#include <drivers/gpio.h>

static int ip_k66f_pinmux_init(struct device *dev)
{
Expand All @@ -17,10 +18,49 @@ static int ip_k66f_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTA_NAME);
#endif

#ifdef CONFIG_PINMUX_MCUX_PORTB
struct device *portb =
device_get_binding(CONFIG_PINMUX_MCUX_PORTB_NAME);
#endif

#ifdef CONFIG_PINMUX_MCUX_PORTE
struct device *porte =
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif

/* Red0, Red2 LEDs */
pinmux_pin_set(porta, 8, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(porta, 10, PORT_PCR_MUX(kPORT_MuxAsGpio));

#if CONFIG_ETH_MCUX_0
pinmux_pin_set(porta, 12, PORT_PCR_MUX(kPORT_MuxAlt4));/* RMII_RXD1 */
pinmux_pin_set(porta, 13, PORT_PCR_MUX(kPORT_MuxAlt4));/* RMII_RXD0 */
pinmux_pin_set(porta, 14, PORT_PCR_MUX(kPORT_MuxAlt4));/* RMII_CRS_DV */
pinmux_pin_set(porta, 15, PORT_PCR_MUX(kPORT_MuxAlt4));/* RMII_RX_EN */
pinmux_pin_set(porta, 16, PORT_PCR_MUX(kPORT_MuxAlt4));/* RMII_TXD0 */
pinmux_pin_set(porta, 17, PORT_PCR_MUX(kPORT_MuxAlt4));/* RMII_TXD1 */
pinmux_pin_set(porta, 24, PORT_PCR_MUX(kPORT_MuxAsGpio));/* !ETH_RST */
pinmux_pin_set(porta, 25, PORT_PCR_MUX(kPORT_MuxAsGpio));/* !ETH_PME */
pinmux_pin_set(porta, 26, PORT_PCR_MUX(kPORT_MuxAsGpio));/* !ETH_INT */
/* RMII_REF_CLK */
pinmux_pin_set(porte, 26, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif

#if CONFIG_SPI_1
/* SPI1 CS0, SCK, SOUT, SIN - Control of KSZ8794 */
pinmux_pin_set(portb, 10, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portb, 11, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portb, 16, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portb, 17, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif

struct device *gpioa = device_get_binding(DT_ALIAS_GPIO_A_LABEL);

/* Set !ETH_RST */
gpio_pin_configure(gpioa, 24, GPIO_OUTPUT_HIGH);
/* Set !ETH_PME */
gpio_pin_configure(gpioa, 25, GPIO_OUTPUT_HIGH);

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/ethernet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ zephyr_sources_ifdef(CONFIG_ETH_MCUX eth_mcux.c)
zephyr_sources_ifdef(CONFIG_ETH_SMSC911X eth_smsc911x.c)
zephyr_sources_ifdef(CONFIG_ETH_STM32_HAL eth_stm32_hal.c)
zephyr_sources_ifdef(CONFIG_ETH_LITEETH eth_liteeth.c)
zephyr_sources_ifdef(CONFIG_DSA_KSZ8794 dsa_ksz8794.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 @@ -43,5 +43,6 @@ source "drivers/ethernet/Kconfig.native_posix"
source "drivers/ethernet/Kconfig.stellaris"
source "drivers/ethernet/Kconfig.liteeth"
source "drivers/ethernet/Kconfig.gecko"
source "drivers/ethernet/Kconfig.dsa"

endmenu # "Ethernet Drivers"
21 changes: 21 additions & 0 deletions drivers/ethernet/Kconfig.dsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Distributed Switch Architecture [DSA] configuration options

# Copyright (c) 2020 DENX Software Engineering GmbH
# Lukasz Majewski <[email protected]>
# SPDX-License-Identifier: Apache-2.0

menuconfig DSA
bool "Distributed Switch Architecture support"
depends on NETWORKING
help
Enable Distributed Switch Architecture support. For now it only supports
Kinetics ENET driver.

if DSA

config DSA_KSZ8794
bool "Enable support for KSZ8794"
help
Add support for KSZ8794 DSA device driver.

endif # DSA
51 changes: 51 additions & 0 deletions drivers/ethernet/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,57 @@ config ETH_MCUX_PROMISCUOUS_MODE
Place the Ethernet receiver in promiscuous mode. This may be useful
for debugging and not needed for normal work.

config ETH_MCUX_RMII_EXT_CLK
bool "Enable RMII clock from external sources"
help
Setting this option will configure MCUX clock block to feed RMII
reference clock from external source (ENET_1588_CLKIN)

config ETH_MCUX_NO_PHY_SMI
bool "Do not use SMI for PHY communication"
help
Some PHY devices, with DSA capabilities do not use SMI for
communication with MAC ENET controller. Other busses - like SPI or I2C
are used instead.

config ETH_MCUX_FIXED_PHY
bool "Enable fixed PHY setup"
help
Some PHY devices, with DSA capabilities, have the communicaton between
ENET and switch fixed.

if ETH_MCUX_FIXED_PHY

choice ETH_MCUX_FIXED_PHY_SPEED
prompt "Fixed PHY speed"
default ETH_MCUX_FIXED_PHY_SPEED_100
help
Choose transmission speed for fixed PHY

config ETH_MCUX_FIXED_PHY_SPEED_100
bool "Set fixed PHY transmission speed to 100 Mbps"

config ETH_MCUX_FIXED_PHY_SPEED_10
bool "Set fixed PHY transmission speed to 10 Mbps"

endchoice

choice ETH_MCUX_FIXED_PHY_DUPLEX
prompt "Fixed PHY duplex"
default ETH_MCUX_FIXED_PHY_DUPLEX_FULL
help
Choose duplex setup for fixed PHY

config ETH_MCUX_FIXED_PHY_DUPLEX_FULL
bool "Set fixed PHY transmission to full duplex"

config ETH_MCUX_FIXED_PHY_DUPLEX_HALF
bool "Set fixed PHY transmission to half duplex"

endchoice

endif # ETH_MCUX_FIXED_PHY

config ETH_MCUX_PHY_TICK_MS
int "PHY poll period (ms)"
default 1000
Expand Down
15 changes: 15 additions & 0 deletions drivers/ethernet/dsa.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2020 DENX Software Engineering GmbH
* Lukasz Majewski <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __DSA_H__
#define __DSA_H__

#include <device.h>
#include <drivers/spi.h>

extern int dsa_init(struct device *dev);

#endif /* __DSA_H__ */
Loading