boards: arm: Add ip_k66f board support

IP ethernet switch board includes K66F MCU from NXP
and Micrel/Microchip KSZ8794CNX switch. Board support
includes basic GPIO LED and common functions.

Switch function needs support either based on DSA or
relative feature in Zephyr which is tracked with issue
22061.

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
This commit is contained in:
Parthiban Nallathambi 2020-02-11 22:48:20 +01:00 committed by Maureen Helm
parent b2d020bdbf
commit 19d9ecc309
12 changed files with 382 additions and 0 deletions

View file

@ -74,6 +74,7 @@
/boards/arm/google_*/ @jackrosenthal
/boards/arm/hexiwear*/ @MaureenHelm
/boards/arm/hexiwear*/doc/ @MaureenHelm @MeganHansen
/boards/arm/ip_k66f/ @parthitce
/boards/arm/lpcxpresso*/ @MaureenHelm
/boards/arm/lpcxpresso*/doc/ @MaureenHelm @MeganHansen
/boards/arm/mimxrt*/ @MaureenHelm

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_PINMUX_MCUX)
zephyr_library()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_library_sources(pinmux.c)
endif()

View file

@ -0,0 +1,7 @@
# Copyright (c) 2020 DENX Software Engineering GmbH
# SPDX-License-Identifier: Apache-2.0
config BOARD_IP_K66F
bool "Segger IP-K66F"
depends on SOC_SERIES_KINETIS_K6X
select SOC_PART_NUMBER_MK66FN2M0VMD18

View file

@ -0,0 +1,43 @@
# IP-K66F board
# Copyright (c) 2020 DENX Software Engineering GmbH
# SPDX-License-Identifier: Apache-2.0
if BOARD_IP_K66F
config BOARD
default "ip_k66f"
config OSC_XTAL0_FREQ
default 50000000
config MCG_PRDIV0
default 0x0
config MCG_VDIV0
default 0x4
config MCG_FCRDIV
default 1
if PINMUX_MCUX
config PINMUX_MCUX_PORTA
default y
config PINMUX_MCUX_PORTB
default y if SPI_1
endif # PINMUX_MCUX
if GPIO_MCUX
config GPIO_MCUX_PORTA
default y
config GPIO_MCUX_PORTB
default y
endif # GPIO_MCUX
endif # BOARD_IP_K66F

View file

@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
board_runner_args(jlink "--device=MK66FN2M0xxx18")
board_runner_args(pyocd "--target=k66f")
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,162 @@
.. _ip_k66f:
SEGGER IP Switch Board
######################
Overview
********
The Segger IP Switch Board is a Evaluation board based on NXP Kinetis K66 MCU.
It comes with Micrel/Microchip KSZ8794CNX integrated 4-port 10/100 managed
Ethernet switch with Gigabit RGMII/MII/RMII interface.
- KSZ8794CNX enables evaluation for switch functions
- On-board debug probe J-Link-OB for programming
.. image:: ./ip_k66f.png
:width: 720px
:align: center
:alt: IP-K66F
Hardware
********
- MK66FN2M0VMD18 MCU (180 MHz, 2 MB flash memory, 256 KB RAM, low-power,
crystal-less USB
- Dual role USB interface with micro-B USB connector
- 2 User LED
- On-board debug probe J-Link-OB for programming
- Micrel/Microchip Ethernet Switch KSZ8794CNX with 3 RJ45 connectors
For more information about the K66F SoC and IP-K66F board:
- `K66F Website`_
- `K66F Datasheet`_
- `K66F Reference Manual`_
- `IP-K66F Website`_
- `IP-K66F User Guide`_
- `IP-K66F Schematics`_
Supported Features
==================
The ip_k66f board configuration supports the following hardware features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| SYSTICK | on-chip | systick |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| WATCHDOG | on-chip | watchdog |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | soc flash |
+-----------+------------+-------------------------------------+
| RTC | on-chip | rtc |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file:
``boards/arm/ip_k66f/ip_k66f_defconfig``
Micrel/Microchip KSZ8794CNX Ethernet Switch is not currently
supported.
Connections and IOs
===================
The K66F SoC has five pairs of pinmux/gpio controllers.
+-------+-----------------+---------------------------+
| Name | Function | Usage |
+=======+=================+===========================+
| PTA8 | GPIO | Red LED |
+-------+-----------------+---------------------------+
| PTA10 | GPIO | RED LED |
+-------+-----------------+---------------------------+
System Clock
============
The K66F SoC is configured to use the 12 MHz low gain crystal oscillator on the
board with the on-chip PLL to generate a 180 MHz system clock.
Serial Port
===========
The K66F SoC has six UARTs. None of them are used.
Programming and Debugging
*************************
Build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Configuring a Debug Probe
=========================
A debug probe is used for both flashing and debugging the board. This board is
configured by default to use the :ref:`opensda-jlink-onboard-debug-probe`.
:ref:`opensda-jlink-onboard-debug-probe`
--------------------------------------------------
Install the :ref:`jlink-debug-host-tools` and make sure they are in your search
path.
Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program
the `OpenSDA J-Link Generic Firmware for V3.2 Bootloader`_. Note that Segger
does provide an OpenSDA J-Link Board-Specific Firmware for this board, however
it is not compatible with the DAPLink bootloader.
The default flasher is ``jlink`` using the built-in SEGGER Jlink interface.
Flashing
========
Here is an example for the :ref:`blinky-sample` application.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: ip_k66f
:goals: flash
Red LED0 should blink at 1 second delay.
Debugging
=========
Here is an example for the :ref:`blinky-sample` application.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: ip_k66f
:goals: debug
Step through the application in your debugger.
.. _IP-K66F Website:
https://www.segger.com/evaluate-our-software/segger/embosip-switch-board/
.. _IP-K66F User Guide:
https://www.segger.com/downloads/emnet/UM06002
.. _IP-K66F Schematics:
https://www.segger.com/downloads/emnet/embOSIP_SwitchBoard_V2.0_WEB_Schematic.pdf
.. _K66F Website:
https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/k-series-cortex-m4/k6x-ethernet/kinetis-k66-180-mhz-dual-high-speed-full-speed-usbs-2mb-flash-microcontrollers-mcus-based-on-arm-cortex-m4-core:K66_180
.. _K66F Datasheet:
https://www.nxp.com/docs/en/data-sheet/K66P144M180SF5V2.pdf
.. _K66F Reference Manual:
https://www.nxp.com/docs/en/reference-manual/K66P144M180SF5RMV2.pdf
.. _OpenSDA J-Link Generic Firmware for V3.2 Bootloader:
https://www.segger.com/downloads/jlink/OpenSDA_V3_2

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View file

@ -0,0 +1,83 @@
/*
* Copyright (c) 2020 DENX Software Engineering GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nxp/nxp_k66.dtsi>
/ {
model = "SEGGER MK66F IP Switch board";
compatible = "nxp,mk66f18", "nxp,k66f", "nxp,k6x";
aliases {
led0 = &red0_led;
led2 = &red2_led;
};
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};
leds {
compatible = "gpio-leds";
red0_led: led_0 {
gpios = <&gpioa 8 GPIO_ACTIVE_HIGH>;
label = "User LD1";
};
red2_led: led_2 {
gpios = <&gpioa 10 GPIO_ACTIVE_HIGH>;
label = "User LD2";
};
};
};
&cpu0 {
clock-frequency = <120000000>;
};
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x00010000>;
read-only;
};
/*
* The flash starting at 0x00010000 and ending at
* 0x0001ffff (sectors 16-31) is reserved for use
* by the application.
*/
storage_partition: partition@1e000 {
label = "storage";
reg = <0x0001e000 0x00002000>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 0x00060000>;
};
slot1_partition: partition@80000 {
label = "image-1";
reg = <0x00080000 0x00060000>;
};
scratch_partition: partition@e0000 {
label = "image-scratch";
reg = <0x000e0000 0x00020000>;
};
};
};

View file

@ -0,0 +1,17 @@
identifier: ip_k66f
name: SEGGER IP-K66F
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- counter
- gpio
- nvs
- watchdog
testing:
default: true
ram: 256
flash: 2048

View file

@ -0,0 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_MK66F18=y
CONFIG_SOC_SERIES_KINETIS_K6X=y
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_OSC_LOW_POWER=y
CONFIG_OSC_XTAL0_FREQ=12000000
CONFIG_K6X_FLEXBUS_CLOCK_DIVIDER=2
CONFIG_USE_SEGGER_RTT=y
# Enable MPU
CONFIG_ARM_MPU=y

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 DENX Software Engineering GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <init.h>
#include <drivers/pinmux.h>
#include <fsl_port.h>
static int ip_k66f_pinmux_init(struct device *dev)
{
ARG_UNUSED(dev);
#ifdef CONFIG_PINMUX_MCUX_PORTA
struct device *porta =
device_get_binding(CONFIG_PINMUX_MCUX_PORTA_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));
return 0;
}
SYS_INIT(ip_k66f_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);

View file

@ -0,0 +1,8 @@
# Copyright (c) 2020 DENX Software Engineering GmbH
#
# SPDX-License-Identifier: Apache-2.0
source [find interface/jlink.cfg]
source [find target/k60.cfg]
transport select hla_swd