summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Denardin <gustavo.denardin@gmail.com>2017-04-03 15:38:40 -0300
committerKumar Gala <kumar.gala@linaro.org>2017-04-28 15:26:38 -0500
commit94abb1f7fb43b8fe64470c372f18b70a18a017a6 (patch)
tree459322315be330516cbdca43d1ac69a3518f2a0f
parent567b733e7662da1aed1c179bdeaf8ab5ef635522 (diff)
arm: Support for new ARM board FRDM-KL25Z
In order to allow the use of such board, a very preliminar port was developed. It consists of board files, as well as pinmux, uart, gpio, spi drivers and device tree files. Change-Id: I5753064e39e0b023cf4481744c176de26d8dbebb Signed-off-by: Gustavo Denardin <gustavo.denardin@gmail.com> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
-rw-r--r--boards/arm/frdm_kl25z/Kconfig.board11
-rw-r--r--boards/arm/frdm_kl25z/Kconfig.defconfig108
-rw-r--r--boards/arm/frdm_kl25z/Makefile10
-rw-r--r--boards/arm/frdm_kl25z/board.h44
-rw-r--r--boards/arm/frdm_kl25z/doc/frdm_kl25z.jpgbin0 -> 15127 bytes
-rw-r--r--boards/arm/frdm_kl25z/doc/frdm_kl25z.rst173
-rw-r--r--boards/arm/frdm_kl25z/frdm_kl25z_defconfig12
-rw-r--r--boards/arm/frdm_kl25z/pinmux.c70
-rw-r--r--dts/arm/Makefile1
-rw-r--r--dts/arm/frdm_kl25z.dts23
-rw-r--r--dts/arm/frdm_kl25z.fixup1
-rw-r--r--dts/arm/nxp/nxp_kl25z.dtsi32
-rw-r--r--scripts/sanity_chk/arches/arm.ini2
13 files changed, 486 insertions, 1 deletions
diff --git a/boards/arm/frdm_kl25z/Kconfig.board b/boards/arm/frdm_kl25z/Kconfig.board
new file mode 100644
index 000000000..954cf64c7
--- /dev/null
+++ b/boards/arm/frdm_kl25z/Kconfig.board
@@ -0,0 +1,11 @@
+# Kconfig - FRDM-KL25Z board
+#
+# Copyright (c) 2017, NXP
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+config BOARD_FRDM_KL25Z
+ bool "NXP FRDM-KL25Z"
+ depends on SOC_SERIES_KINETIS_KL2X
+ select SOC_PART_NUMBER_MKL25Z128VLK4
diff --git a/boards/arm/frdm_kl25z/Kconfig.defconfig b/boards/arm/frdm_kl25z/Kconfig.defconfig
new file mode 100644
index 000000000..5f8e2a005
--- /dev/null
+++ b/boards/arm/frdm_kl25z/Kconfig.defconfig
@@ -0,0 +1,108 @@
+# Kconfig - FRDM-KL25Z board
+#
+# Copyright (c) 2017, NXP
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+if BOARD_FRDM_KL25Z
+
+config BOARD
+ default frdm_kl25z
+
+config OSC_XTAL0_FREQ
+ default 8000000
+
+config MCG_PRDIV0
+ default 0x01
+
+config MCG_VDIV0
+ default 0x00
+
+config MCG_FRDIV
+ default 5
+
+config MCG_FCRDIV
+ default 0
+
+config PINMUX
+ def_bool y
+
+if PINMUX_MCUX
+
+config PINMUX_MCUX_PORTA
+ def_bool y
+
+config PINMUX_MCUX_PORTB
+ def_bool y
+
+config PINMUX_MCUX_PORTC
+ def_bool y if SPI_0
+
+config PINMUX_MCUX_PORTD
+ def_bool y
+
+config PINMUX_MCUX_PORTE
+ def_bool y if I2C_0
+
+endif # PINMUX_MCUX
+
+if GPIO_MCUX
+
+config GPIO_MCUX_PORTA
+ def_bool y
+
+config GPIO_MCUX_PORTB
+ def_bool y
+
+config GPIO_MCUX_PORTC
+ def_bool n
+
+config GPIO_MCUX_PORTD
+ def_bool y
+
+config GPIO_MCUX_PORTE
+ def_bool n
+
+endif # GPIO_MCUX
+
+if UART_MCUX_LPSCI
+
+config UART_MCUX_LPSCI_0
+ def_bool y if UART_CONSOLE
+
+endif # UART_MCUX_LPSCI
+
+if I2C
+
+config I2C_0
+ def_bool y
+
+if I2C_0
+
+config I2C_0_DEFAULT_CFG
+ default 0x12
+
+config I2C_0_IRQ_PRI
+ default 0
+
+endif # I2C_0
+
+endif # I2C
+
+if SPI
+
+config SPI_0
+ def_bool y
+
+if SPI_0
+
+config SPI_0_IRQ_PRI
+ default 0
+
+endif # SPI_0
+
+endif # SPI
+
+
+endif # BOARD_FRDM_KL25Z
diff --git a/boards/arm/frdm_kl25z/Makefile b/boards/arm/frdm_kl25z/Makefile
new file mode 100644
index 000000000..1e47c1fca
--- /dev/null
+++ b/boards/arm/frdm_kl25z/Makefile
@@ -0,0 +1,10 @@
+# Makefile - FRDM-KL25Z board
+#
+# Copyright (c) 2017, NXP
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+ccflags-y +=-I$(srctree)/drivers
+
+obj-$(CONFIG_PINMUX_MCUX) += pinmux.o
diff --git a/boards/arm/frdm_kl25z/board.h b/boards/arm/frdm_kl25z/board.h
new file mode 100644
index 000000000..cde0e67b7
--- /dev/null
+++ b/boards/arm/frdm_kl25z/board.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017, NXP
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef __INC_BOARD_H
+#define __INC_BOARD_H
+
+#include <soc.h>
+
+/* Push button switch for test purposes */
+#define SW0_TEST_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME
+#define SW0_TEST_GPIO_PIN 16
+
+/* Push button switch for test purposes */
+#define SW1_TEST_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME
+#define SW1_TEST_GPIO_PIN 17
+
+/* Red LED */
+#define RED_GPIO_NAME CONFIG_GPIO_MCUX_PORTB_NAME
+#define RED_GPIO_PIN 18
+
+/* Green LED */
+#define GREEN_GPIO_NAME CONFIG_GPIO_MCUX_PORTB_NAME
+#define GREEN_GPIO_PIN 19
+
+/* Blue LED */
+#define BLUE_GPIO_NAME CONFIG_GPIO_MCUX_PORTD_NAME
+#define BLUE_GPIO_PIN 1
+
+/* LED0. There is no physical LED on the board with this name, so create an
+ * alias to the green LED to make the basic blinky sample work.
+ */
+#define LED0_GPIO_PORT GREEN_GPIO_NAME
+#define LED0_GPIO_PIN GREEN_GPIO_PIN
+
+/* Push button switch 0. There is no physical switch on the board,
+ * so an push button must be added to such pins for basic button sample work.
+ */
+#define SW0_GPIO_NAME SW0_TEST_GPIO_NAME
+#define SW0_GPIO_PIN SW0_TEST_GPIO_PIN
+
+#endif /* __INC_BOARD_H */
diff --git a/boards/arm/frdm_kl25z/doc/frdm_kl25z.jpg b/boards/arm/frdm_kl25z/doc/frdm_kl25z.jpg
new file mode 100644
index 000000000..29b9e2125
--- /dev/null
+++ b/boards/arm/frdm_kl25z/doc/frdm_kl25z.jpg
Binary files differ
diff --git a/boards/arm/frdm_kl25z/doc/frdm_kl25z.rst b/boards/arm/frdm_kl25z/doc/frdm_kl25z.rst
new file mode 100644
index 000000000..b5e1b837d
--- /dev/null
+++ b/boards/arm/frdm_kl25z/doc/frdm_kl25z.rst
@@ -0,0 +1,173 @@
+.. _frdm_kl25z:
+
+NXP FRDM-KL25Z
+##############
+
+Overview
+********
+
+The Freedom KL25Z is an ultra-low-cost development platform for
+Kinetis |reg| L Series KL1x (KL14/15) and KL2x (KL24/25) MCUs built
+on ARM |reg| Cortex |reg|-M0+ processor.
+
+The FRDM-KL25Z features include easy access to MCU I/O, battery-ready,
+low-power operation, a standard-based form factor with expansion board
+options and a built-in debug interface for flash programming and run-control.
+
+
+.. image:: frdm_kl25z.jpg
+ :width: 272px
+ :align: center
+ :alt: FRDM-KL25Z
+
+Hardware
+********
+
+- MKL25Z128VLK4 MCU @ 48 MHz, 128 KB flash, 16 KB SRAM, USB OTG (FS), 80LQFP
+- On board capacitive touch "slider", MMA8451Q accelerometer, and tri-color LED
+- OpenSDA debug interface
+
+For more information about the KL25Z SoC and FRDM-KL25Z board:
+
+- `KL25Z Website`_
+- `KL25Z Datasheet`_
+- `KL25Z Reference Manual`_
+- `FRDM-KL25Z Website`_
+- `FRDM-KL25Z User Guide`_
+- `FRDM-KL25Z Schematics`_
+
+Supported Features
+==================
+
+The frdm_kl25z 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 |
++-----------+------------+-------------------------------------+
+| UART | on-chip | serial port-polling; |
+| | | serial port-interrupt |
++-----------+------------+-------------------------------------+
+| I2C | on-chip | i2c |
++-----------+------------+-------------------------------------+
+| SPI | on-chip | spi |
++-----------+------------+-------------------------------------+
+| FLASH | on-chip | soc flash |
++-----------+------------+-------------------------------------+
+
+The default configuration can be found in the defconfig file:
+
+ ``boards/arm/frdm_kl25z/frdm_kl25z_defconfig``
+
+Other hardware features are not currently supported by the port.
+
+Connections and IOs
+===================
+
+The KL25Z SoC has five pairs of pinmux/gpio controllers, and all are currently enabled
+(PORTA/GPIOA, PORTB/GPIOB, PORTC/GPIOC, PORTD/GPIOD, and PORTE/GPIOE) for the FRDM-KL25Z board.
+
++-------+-------------+---------------------------+
+| Name | Function | Usage |
++=======+=============+===========================+
+| PTB18 | GPIO | Red LED |
++-------+-------------+---------------------------+
+| PTB19 | GPIO | Green LED |
++-------+-------------+---------------------------+
+| PTD1 | GPIO | Blue LED |
++-------+-------------+---------------------------+
+| PTA1 | UART0_RX | UART Console |
++-------+-------------+---------------------------+
+| PTA2 | UART0_TX | UART Console |
++-------+-------------+---------------------------+
+| PTE24 | I2C0_SCL | I2C |
++-------+-------------+---------------------------+
+| PTE25 | I2C0_SDA | I2C |
++-------+-------------+---------------------------+
+| PTC4 | SPI0_PSC0 | SPI |
++-------+-------------+---------------------------+
+| PTC5 | SPI0_SCK | SPI |
++-------+-------------+---------------------------+
+| PTC6 | SPI0_MOSI | SPI |
++-------+-------------+---------------------------+
+| PTC7 | SPI0_MISO | SPI |
++-------+-------------+---------------------------+
+
+
+System Clock
+============
+
+The KL25Z SoC is configured to use the 8 MHz external oscillator on the board
+with the on-chip FLL to generate a 48 MHz system clock.
+
+Serial Port
+===========
+
+The KL25Z UART0 is used for the console.
+
+Programming and Debugging
+*************************
+
+Flashing
+========
+
+The FRDM-KL25Z includes an `OpenSDA`_ serial and debug adaptor built into the
+board. The adaptor provides:
+
+- A USB connection to the host computer, which exposes on-board Mass Storage and a
+ USB Serial Port.
+- A Serial Flash device, which implements the USB flash disk file storage.
+- A physical UART connection, which is relayed over interface USB Serial port.
+
+Flashing an application to FRDM-KL25Z
+-------------------------------------
+
+The sample application :ref:`hello_world` is used for this example.
+Build the Zephyr kernel and application:
+
+.. code-block:: console
+
+ $ cd $ZEPHYR_BASE
+ $ . zephyr-env.sh
+ $ cd $ZEPHYR_BASE/samples/hello_world/
+ $ make BOARD=frdm_kl25z
+
+Connect the FRDM-KL25Z to your host computer using the USB port and you should
+see a USB connection which exposes on-board Mass Storage (FRDM-KL25ZJ) and a USB Serial
+Port. Copy the generated zephyr.bin to the FRDM-KL25ZJ drive.
+
+Run a serial console app on your host computer. Reset the board and you'll see the
+following message written to the serial port:
+
+.. code-block:: console
+
+ Hello World! arm
+
+
+.. _FRDM-KL25Z Website:
+ http://www.nxp.com/products/software-and-tools/hardware-development-tools/freedom-development-boards/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z?tid=vanFRDM-KL25Z
+
+.. _FRDM-KL25Z User Guide:
+ http://www.nxp.com/assets/documents/data/en/user-guides/FRDMKL25ZUM.zip
+
+.. _FRDM-KL25Z Schematics:
+ http://www.nxp.com/assets/downloads/data/en/schematics/FRDM-KL25Z_SCH_REV_E.pdf
+
+.. _OpenSDA:
+ http://www.nxp.com/assets/documents/data/en/user-guides/OPENSDAUG.pdf
+
+.. _KL25Z Website:
+ http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x?lang_cd=en
+
+.. _KL25Z Datasheet:
+ http://www.nxp.com/assets/documents/data/en/data-sheets/KL25P80M48SF0.pdf
+
+.. _KL25Z Reference Manual:
+ http://www.nxp.com/assets/documents/data/en/reference-manuals/KL25P80M48SF0RM.pdf
diff --git a/boards/arm/frdm_kl25z/frdm_kl25z_defconfig b/boards/arm/frdm_kl25z/frdm_kl25z_defconfig
new file mode 100644
index 000000000..b79f99b9c
--- /dev/null
+++ b/boards/arm/frdm_kl25z/frdm_kl25z_defconfig
@@ -0,0 +1,12 @@
+CONFIG_ARM=y
+CONFIG_SOC_MKL25Z=y
+CONFIG_SOC_SERIES_KINETIS_KL2X=y
+CONFIG_BOARD_FRDM_KL25Z=y
+CONFIG_CONSOLE=y
+CONFIG_UART_CONSOLE=y
+CONFIG_SERIAL=y
+CONFIG_CORTEX_M_SYSTICK=y
+CONFIG_GPIO=y
+CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
+CONFIG_OSC_LOW_POWER=y
+CONFIG_HAS_DTS=y
diff --git a/boards/arm/frdm_kl25z/pinmux.c b/boards/arm/frdm_kl25z/pinmux.c
new file mode 100644
index 000000000..ed535e67a
--- /dev/null
+++ b/boards/arm/frdm_kl25z/pinmux.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, NXP
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <init.h>
+#include <pinmux.h>
+#include <fsl_port.h>
+
+static int frdm_kl25z_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
+#ifdef CONFIG_PINMUX_MCUX_PORTB
+ struct device *portb =
+ device_get_binding(CONFIG_PINMUX_MCUX_PORTB_NAME);
+#endif
+#if defined(CONFIG_PINMUX_MCUX_PORTC)
+ struct device *portc =
+ device_get_binding(CONFIG_PINMUX_MCUX_PORTC_NAME);
+#endif
+#ifdef CONFIG_PINMUX_MCUX_PORTD
+ struct device *portd =
+ device_get_binding(CONFIG_PINMUX_MCUX_PORTD_NAME);
+#endif
+#if defined(CONFIG_PINMUX_MCUX_PORTE)
+ struct device *porte =
+ device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
+#endif
+
+#ifdef CONFIG_UART_MCUX_LPSCI_0
+ /* UART0 RX, TX */
+ pinmux_pin_set(porta, 1, PORT_PCR_MUX(kPORT_MuxAlt2));
+ pinmux_pin_set(porta, 2, PORT_PCR_MUX(kPORT_MuxAlt2));
+#endif
+
+ /* SW0 and SW1 */
+ pinmux_pin_set(porta, 16, PORT_PCR_MUX(kPORT_MuxAsGpio));
+ pinmux_pin_set(porta, 17, PORT_PCR_MUX(kPORT_MuxAsGpio));
+
+ /* Red, green, blue LEDs. */
+ pinmux_pin_set(portd, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
+ pinmux_pin_set(portb, 18, PORT_PCR_MUX(kPORT_MuxAsGpio));
+ pinmux_pin_set(portb, 19, PORT_PCR_MUX(kPORT_MuxAsGpio));
+
+#if defined(CONFIG_SPI_0)
+ /* SPI0 CLK, MOSI, MISO */
+ pinmux_pin_set(portc, 4, PORT_PCR_MUX(kPORT_MuxAlt2));
+ pinmux_pin_set(portc, 5, PORT_PCR_MUX(kPORT_MuxAlt2));
+ pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt2));
+ pinmux_pin_set(portc, 7, PORT_PCR_MUX(kPORT_MuxAlt2));
+#endif
+
+#if defined(CONFIG_I2C_0)
+ /* I2C0 SCL, SDA */
+ pinmux_pin_set(porte, 24, PORT_PCR_MUX(kPORT_MuxAlt5)
+ | PORT_PCR_PS_MASK);
+ pinmux_pin_set(porte, 25, PORT_PCR_MUX(kPORT_MuxAlt5)
+ | PORT_PCR_PS_MASK);
+#endif
+
+ return 0;
+}
+
+SYS_INIT(frdm_kl25z_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
diff --git a/dts/arm/Makefile b/dts/arm/Makefile
index b980b726b..67d7c332d 100644
--- a/dts/arm/Makefile
+++ b/dts/arm/Makefile
@@ -1,6 +1,7 @@
ifeq ($(CONFIG_HAS_DTS),y)
dtb-$(CONFIG_BOARD_FRDM_K64F) = frdm_k64f.dts_compiled
dtb-$(CONFIG_BOARD_FRDM_KW41Z) = frdm_kw41z.dts_compiled
+dtb-$(CONFIG_BOARD_FRDM_KL25Z) = frdm_kl25z.dts_compiled
dtb-$(CONFIG_BOARD_HEXIWEAR_K64) = hexiwear_k64.dts_compiled
dtb-$(CONFIG_BOARD_HEXIWEAR_KW40Z) = hexiwear_kw40z.dts_compiled
dtb-$(CONFIG_BOARD_CC3200_LAUNCHXL) = cc3200_launchxl.dts_compiled
diff --git a/dts/arm/frdm_kl25z.dts b/dts/arm/frdm_kl25z.dts
new file mode 100644
index 000000000..d8f358fdd
--- /dev/null
+++ b/dts/arm/frdm_kl25z.dts
@@ -0,0 +1,23 @@
+/dts-v1/;
+
+#include <nxp/nxp_kl25z.dtsi>
+
+/ {
+ model = "NXP Freedom KL25Z board";
+ compatible = "nxp,frdm-kl25z", "nxp,kl25z", "nxp,mkl25z4";
+
+ aliases {
+ uart_0 = &uart0;
+ };
+
+ chosen {
+ zephyr,sram = &sram0;
+ zephyr,flash = &flash0;
+ zephyr,console = &uart0;
+ };
+};
+
+&uart0 {
+ status = "ok";
+ current-speed = <115200>;
+};
diff --git a/dts/arm/frdm_kl25z.fixup b/dts/arm/frdm_kl25z.fixup
new file mode 100644
index 000000000..1627806ea
--- /dev/null
+++ b/dts/arm/frdm_kl25z.fixup
@@ -0,0 +1 @@
+#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
diff --git a/dts/arm/nxp/nxp_kl25z.dtsi b/dts/arm/nxp/nxp_kl25z.dtsi
new file mode 100644
index 000000000..e43895f68
--- /dev/null
+++ b/dts/arm/nxp/nxp_kl25z.dtsi
@@ -0,0 +1,32 @@
+#include "armv6-m.dtsi"
+
+/ {
+ cpus {
+ cpu@0 {
+ compatible = "arm,cortex-m0+";
+ };
+ };
+
+ sram0: memory {
+ compatible = "mmio-sram";
+ reg = <0x1FFFF000 0x4000>;
+ };
+
+ soc {
+ flash0: flash@0 {
+ reg = <0 0x20000>;
+ };
+
+ uart0: uart@4006A000 {
+ compatible = "nxp,kinetis-lpsci";
+ reg = <0x4006A000 0xc>;
+ interrupts = <12 0>;
+
+ status = "disabled";
+ };
+ };
+};
+
+&nvic {
+ arm,num-irq-priority-bits = <2>;
+};
diff --git a/scripts/sanity_chk/arches/arm.ini b/scripts/sanity_chk/arches/arm.ini
index 0ce81048f..67902c4a5 100644
--- a/scripts/sanity_chk/arches/arm.ini
+++ b/scripts/sanity_chk/arches/arm.ini
@@ -7,7 +7,7 @@ platforms = qemu_cortex_m3 frdm_k64f arduino_due nucleo_f103rb stm32_mini_a15
v2m_beetle nucleo_l476rg nrf52840_pca10056 nucleo_f411re
stm3210c_eval nucleo_f334r8 stm32373c_eval mps2_an385 frdm_kw41z
sam_e70_xplained curie_ble nrf52_blenano2 hexiwear_kw40z
- cc3220sf_launchxl
+ cc3220sf_launchxl frdm_kl25z
supported_toolchains = zephyr gccarmemb