summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-03-10 14:30:47 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-11 23:43:21 +0000
commit8224f153994ec70661259ec0de49e473eefce359 (patch)
tree360f6c9a912c422572bfaae66b1cec157a2a432f
parent97e22d467763dace5df64c9869cd8d4984f4ab39 (diff)
downloadchrome-ec-8224f153994ec70661259ec0de49e473eefce359.tar.gz
zephyr: add support for trogdor/lazor
Initial bringup for Lazor, featuring just a UART console, flash access, and basic commands. I structured the directories to look a little more like what we discussed in last week's meeting (putting the Zephyr "board" directory to be common to the baseboard, and putting variants under a directory categorized by baseboard). I hope we can go back to volteer/delbin and re-adopt this layout there too, as it's much cleaner and leads to less repeated code. BUG=b:182398910 BRANCH=none TEST=flash on lazor, test out UART and basic commands ("gettime", "flashinfo", etc.) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I411c47e9b9563d78349abbeebf71223ae41748a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2749765 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.board12
-rw-r--r--zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.defconfig10
-rw-r--r--zephyr/projects/trogdor/boards/arm/trogdor/board.cmake5
-rw-r--r--zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts55
-rw-r--r--zephyr/projects/trogdor/boards/arm/trogdor/trogdor_defconfig50
-rw-r--r--zephyr/projects/trogdor/lazor/CMakeLists.txt12
-rw-r--r--zephyr/projects/trogdor/lazor/gpio.dts10
-rw-r--r--zephyr/projects/trogdor/lazor/include/gpio_map.h32
-rw-r--r--zephyr/projects/trogdor/lazor/include/i2c_map.h13
-rw-r--r--zephyr/projects/trogdor/lazor/prj.conf17
-rw-r--r--zephyr/projects/trogdor/lazor/zmake.yaml11
11 files changed, 227 insertions, 0 deletions
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.board b/zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.board
new file mode 100644
index 0000000000..13f6616d08
--- /dev/null
+++ b/zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.board
@@ -0,0 +1,12 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# "BOARD" below refers to a Zephyr board, which does not have a 1:1
+# mapping with the Chrome OS concept of a board. By Zephyr's
+# conventions, we'll still call it "BOARD_*" to make this more
+# applicable to be upstreamed, even though this code is shared by all
+# projects using Trogdor baseboard.
+config BOARD_TROGDOR
+ bool "Google Trogdor Baseboard"
+ depends on SOC_NPCX7M6FC
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.defconfig b/zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.defconfig
new file mode 100644
index 0000000000..bfd2e43bbf
--- /dev/null
+++ b/zephyr/projects/trogdor/boards/arm/trogdor/Kconfig.defconfig
@@ -0,0 +1,10 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+if BOARD_TROGDOR
+
+config BOARD
+ default "trogdor"
+
+endif # BOARD_TROGDOR
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/board.cmake b/zephyr/projects/trogdor/boards/arm/trogdor/board.cmake
new file mode 100644
index 0000000000..5c02f2707f
--- /dev/null
+++ b/zephyr/projects/trogdor/boards/arm/trogdor/board.cmake
@@ -0,0 +1,5 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set(ECST_CHIP_ARG npcx7m7)
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts
new file mode 100644
index 0000000000..512915323b
--- /dev/null
+++ b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts
@@ -0,0 +1,55 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/dts-v1/;
+
+#include <cros/nuvoton/npcx.dtsi>
+#include <dt-bindings/gpio_defines.h>
+#include <nuvoton/npcx7m6fc.dtsi>
+
+/ {
+ model = "Google Trogdor Baseboard";
+
+ chosen {
+ zephyr,sram = &sram0;
+ zephyr,console = &uart1;
+ zephyr,shell-uart = &uart1;
+ zephyr,flash = &flash0;
+ };
+
+ named-i2c-ports {
+ compatible = "named-i2c-ports";
+ };
+
+ def_lvol_io_list {
+ compatible = "nuvoton,npcx-lvolctrl-def";
+
+ /* I2C_SDA0 & SCL0 */
+ lvol_io_pads = <&lvol_iob4 &lvol_iob5>;
+ };
+
+ soc {
+ fiu0: cros-flash@40020000 {
+ compatible = "nuvoton,npcx-cros-flash";
+ reg = <0x40020000 0x2000>;
+ clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL1 2>;
+ size = <0x80000>;
+ label = "FLASH_INTERFACE_UNIT0";
+ pinctrl-0 = <>;
+ };
+ };
+
+ /* Update flash size to 512KB from 196KB since we are using C variant */
+ /delete-node/ flash@10090000;
+ flash0: flash@10070000 {
+ reg = <0x10070000 0x40000>;
+ };
+};
+
+&uart1 {
+ status = "okay";
+ current-speed = <115200>;
+ pinctrl-0 = <&altc_uart1_sl2>; /* Use UART1_SL2 ie. PIN64.65 */
+};
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor_defconfig b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor_defconfig
new file mode 100644
index 0000000000..ec830d6fcb
--- /dev/null
+++ b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor_defconfig
@@ -0,0 +1,50 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Zephyr Kernel Configuration
+CONFIG_SOC_SERIES_NPCX7=y
+
+# Platform Configuration
+CONFIG_SOC_NPCX7M6FC=y
+CONFIG_BOARD_TROGDOR=y
+
+# Serial Drivers
+CONFIG_SERIAL=y
+CONFIG_UART_INTERRUPT_DRIVEN=y
+
+# Enable console
+CONFIG_CONSOLE=y
+CONFIG_UART_CONSOLE=y
+
+# Pinmux Driver
+CONFIG_PINMUX=y
+
+# GPIO Controller
+CONFIG_GPIO=y
+
+# Clock configuration
+CONFIG_CLOCK_CONTROL=y
+
+# PLL configuration
+CONFIG_CLOCK_NPCX_OSC_CYCLES_PER_SEC=90000000
+CONFIG_CLOCK_NPCX_APB1_PRESCALER=6
+CONFIG_CLOCK_NPCX_APB2_PRESCALER=6
+CONFIG_CLOCK_NPCX_APB3_PRESCALER=6
+
+CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=15000000
+
+# Code RAM base for NPCX797FC
+CONFIG_CROS_EC_PROGRAM_MEMORY_BASE=0x10070000
+CONFIG_CROS_EC_RAM_BASE=0x200c0000
+CONFIG_CROS_EC_DATA_RAM_SIZE=0x00010000
+CONFIG_CROS_EC_RAM_SIZE=0x0000f800
+
+CONFIG_FLASH_SIZE=512
+CONFIG_CROS_EC_RO_MEM_OFF=0x0
+CONFIG_CROS_EC_RO_SIZE=0x40000
+# (CONFIG_CROS_EC_RO_MEM_OFF + CONFIG_CROS_EC_RO_SIZE)
+CONFIG_CROS_EC_RW_MEM_OFF=0x0
+# (CONFIG_CROS_EC_FLASH_SIZE - CONFIG_CROS_EC_RW_MEM_OFF -
+# CONFIG_CROS_EC_RO_MEM_OFF)
+CONFIG_CROS_EC_RW_SIZE=0x40000
diff --git a/zephyr/projects/trogdor/lazor/CMakeLists.txt b/zephyr/projects/trogdor/lazor/CMakeLists.txt
new file mode 100644
index 0000000000..9d7af5b200
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+cmake_minimum_required(VERSION 3.13.1)
+
+set(BOARD_ROOT "${CMAKE_CURRENT_LIST_DIR}/..")
+
+find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
+project(lazor)
+
+zephyr_include_directories(include)
diff --git a/zephyr/projects/trogdor/lazor/gpio.dts b/zephyr/projects/trogdor/lazor/gpio.dts
new file mode 100644
index 0000000000..5de0a5e422
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/gpio.dts
@@ -0,0 +1,10 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ named-gpios {
+ compatible = "named-gpios";
+ };
+};
diff --git a/zephyr/projects/trogdor/lazor/include/gpio_map.h b/zephyr/projects/trogdor/lazor/include/gpio_map.h
new file mode 100644
index 0000000000..dad1d91ff7
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/include/gpio_map.h
@@ -0,0 +1,32 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __ZEPHYR_GPIO_MAP_H
+#define __ZEPHYR_GPIO_MAP_H
+
+#include <devicetree.h>
+#include <gpio_signal.h>
+
+#define GPIO_ENTERING_RW GPIO_UNIMPLEMENTED
+#define GPIO_WP_L GPIO_UNIMPLEMENTED
+
+/*
+ * Set EC_CROS_GPIO_INTERRUPTS to a space-separated list of GPIO_INT items.
+ *
+ * Each GPIO_INT requires three parameters:
+ * gpio_signal - The enum gpio_signal for the interrupt gpio
+ * interrupt_flags - The interrupt-related flags (e.g. GPIO_INT_EDGE_BOTH)
+ * handler - The platform/ec interrupt handler.
+ *
+ * Ensure that this files includes all necessary headers to declare all
+ * referenced handler functions.
+ *
+ * For example, one could use the follow definition:
+ * #define EC_CROS_GPIO_INTERRUPTS \
+ * GPIO_INT(NAMED_GPIO(h1_ec_pwr_btn_odl), GPIO_INT_EDGE_BOTH, button_print)
+ */
+#define EC_CROS_GPIO_INTERRUPTS
+
+#endif /* __ZEPHYR_GPIO_MAP_H */
diff --git a/zephyr/projects/trogdor/lazor/include/i2c_map.h b/zephyr/projects/trogdor/lazor/include/i2c_map.h
new file mode 100644
index 0000000000..898d5c398c
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/include/i2c_map.h
@@ -0,0 +1,13 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __ZEPHYR_I2C_MAP_H
+#define __ZEPHYR_I2C_MAP_H
+
+#include <devicetree.h>
+
+#include "i2c/i2c.h"
+
+#endif /* __ZEPHYR_I2C_MAP_H */
diff --git a/zephyr/projects/trogdor/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf
new file mode 100644
index 0000000000..66857bb292
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/prj.conf
@@ -0,0 +1,17 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+CONFIG_CROS_EC=y
+CONFIG_SHIMMED_TASKS=y
+CONFIG_PLATFORM_EC=y
+CONFIG_PLATFORM_EC_BRINGUP=y
+
+# Trogdor family does not use EFS2 (toggled by PLATFORM_EC_VBOOT).
+CONFIG_PLATFORM_EC_VBOOT=n
+
+# TODO(b/182398910): bringup these features
+CONFIG_PLATFORM_EC_BOARD_VERSION=n
+CONFIG_PLATFORM_EC_HOSTCMD=n
+CONFIG_PLATFORM_EC_KEYBOARD=n
+CONFIG_CROS_KB_RAW_NPCX=n
diff --git a/zephyr/projects/trogdor/lazor/zmake.yaml b/zephyr/projects/trogdor/lazor/zmake.yaml
new file mode 100644
index 0000000000..e583271e09
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/zmake.yaml
@@ -0,0 +1,11 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+board: trogdor
+dts-overlays:
+ - gpio.dts
+supported-zephyr-versions:
+ - v2.5
+toolchain: coreboot-sdk
+output-type: npcx