From 2594aa4e531b29bd85e64c8419b794432667dc98 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Wed, 6 Nov 2019 15:07:52 -0700 Subject: [PATCH 1/2] soc: stm32f0: Add support for STM32F098xx SOC This adds a Kconfig options and device tree configs for the STM32F098 series of SoC. Signed-off-by: Jack Rosenthal --- dts/arm/st/f0/stm32f098Xc.dtsi | 21 +++++++++++++++++++ .../stm32f0/Kconfig.defconfig.stm32f098xx | 14 +++++++++++++ soc/arm/st_stm32/stm32f0/Kconfig.soc | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 dts/arm/st/f0/stm32f098Xc.dtsi create mode 100644 soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f098xx diff --git a/dts/arm/st/f0/stm32f098Xc.dtsi b/dts/arm/st/f0/stm32f098Xc.dtsi new file mode 100644 index 0000000000000..d1028a6920584 --- /dev/null +++ b/dts/arm/st/f0/stm32f098Xc.dtsi @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2019 The Chromium OS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +/ { + sram0: memory@20000000 { + reg = <0x20000000 DT_SIZE_K(32)>; + }; + + soc { + flash-controller@40022000 { + flash0: flash@8000000 { + reg = <0x08000000 DT_SIZE_K(256)>; + }; + }; + }; +}; diff --git a/soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f098xx b/soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f098xx new file mode 100644 index 0000000000000..0a877cb26f746 --- /dev/null +++ b/soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f098xx @@ -0,0 +1,14 @@ +# ST Microelectronics STM32F098XX MCU + +# Copyright (c) 2019 The Chromium OS Authors +# SPDX-License-Identifier: Apache-2.0 + +if SOC_STM32F098XX + +config SOC + default "stm32f098xx" + +config NUM_IRQS + default 31 + +endif # SOC_STM32F098xx diff --git a/soc/arm/st_stm32/stm32f0/Kconfig.soc b/soc/arm/st_stm32/stm32f0/Kconfig.soc index 98b3a5ecf5318..993cc2c77c57d 100644 --- a/soc/arm/st_stm32/stm32f0/Kconfig.soc +++ b/soc/arm/st_stm32/stm32f0/Kconfig.soc @@ -25,4 +25,7 @@ config SOC_STM32F072XB config SOC_STM32F091XC bool "STM32F091XC" +config SOC_STM32F098XX + bool "STM32F098XX" + endchoice From 0ce78271050443452ab27085e99b8a93f3321db5 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Fri, 25 Oct 2019 16:16:32 -0600 Subject: [PATCH 2/2] board: arm: Add google_kukui board This adds support for the EC (embedded controller) on a Google reference board with codename "kukui". This board uses the STM32F098RC chip. We built an application for the board and verified UART functionality on the board. Signed-off-by: Jack Rosenthal Signed-off-by: Simon Glass --- CODEOWNERS | 1 + boards/arm/google_kukui/CMakeLists.txt | 7 ++ boards/arm/google_kukui/Kconfig.board | 8 ++ boards/arm/google_kukui/Kconfig.defconfig | 18 +++++ boards/arm/google_kukui/board.cmake | 1 + boards/arm/google_kukui/doc/index.rst | 81 +++++++++++++++++++ boards/arm/google_kukui/google_kukui.dts | 40 +++++++++ boards/arm/google_kukui/google_kukui.yaml | 14 ++++ .../arm/google_kukui/google_kukui_defconfig | 34 ++++++++ boards/arm/google_kukui/pinmux.c | 32 ++++++++ 10 files changed, 236 insertions(+) create mode 100644 boards/arm/google_kukui/CMakeLists.txt create mode 100644 boards/arm/google_kukui/Kconfig.board create mode 100644 boards/arm/google_kukui/Kconfig.defconfig create mode 100644 boards/arm/google_kukui/board.cmake create mode 100644 boards/arm/google_kukui/doc/index.rst create mode 100644 boards/arm/google_kukui/google_kukui.dts create mode 100644 boards/arm/google_kukui/google_kukui.yaml create mode 100644 boards/arm/google_kukui/google_kukui_defconfig create mode 100644 boards/arm/google_kukui/pinmux.c diff --git a/CODEOWNERS b/CODEOWNERS index 692b58f182c6c..d8708112a2a5b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -62,6 +62,7 @@ /boards/arm/disco_l475_iot1/ @erwango /boards/arm/frdm*/ @MaureenHelm /boards/arm/frdm*/doc/ @MaureenHelm @MeganHansen +/boards/arm/google_*/ @jackrosenthal /boards/arm/hexiwear*/ @MaureenHelm /boards/arm/hexiwear*/doc/ @MaureenHelm @MeganHansen /boards/arm/lpcxpresso*/ @MaureenHelm diff --git a/boards/arm/google_kukui/CMakeLists.txt b/boards/arm/google_kukui/CMakeLists.txt new file mode 100644 index 0000000000000..d1b8108cfed55 --- /dev/null +++ b/boards/arm/google_kukui/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_PINMUX) +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) +endif() diff --git a/boards/arm/google_kukui/Kconfig.board b/boards/arm/google_kukui/Kconfig.board new file mode 100644 index 0000000000000..5a13e2fcaa999 --- /dev/null +++ b/boards/arm/google_kukui/Kconfig.board @@ -0,0 +1,8 @@ +# Google Kukui EC + +# Copyright 2019 The Chromium OS Authors +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_GOOGLE_KUKUI + bool "Google Kukui EC" + depends on SOC_STM32F098XX diff --git a/boards/arm/google_kukui/Kconfig.defconfig b/boards/arm/google_kukui/Kconfig.defconfig new file mode 100644 index 0000000000000..6bc03e057ca63 --- /dev/null +++ b/boards/arm/google_kukui/Kconfig.defconfig @@ -0,0 +1,18 @@ +# Google Kukui EC + +# Copyright 2019 The Chromium OS Authors +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_GOOGLE_KUKUI + +config BOARD + default "google_kukui" + +if UART_CONSOLE + +config UART_1 + default y + +endif # UART_CONSOLE + +endif # BOARD_GOOGLE_KUKUI diff --git a/boards/arm/google_kukui/board.cmake b/boards/arm/google_kukui/board.cmake new file mode 100644 index 0000000000000..9881313609aae --- /dev/null +++ b/boards/arm/google_kukui/board.cmake @@ -0,0 +1 @@ +# SPDX-License-Identifier: Apache-2.0 diff --git a/boards/arm/google_kukui/doc/index.rst b/boards/arm/google_kukui/doc/index.rst new file mode 100644 index 0000000000000..db9e62fa9d448 --- /dev/null +++ b/boards/arm/google_kukui/doc/index.rst @@ -0,0 +1,81 @@ +.. _google_kukui_board: + +Google Kukui EC +############### + +Overview +******** + +Kukui is a reference board for Chromium OS-based devices Krane and +Kodama. Zephyr has support for the STM32-based embedded controller +(EC) on-board. + +Hardware +******** + +- STM32F098RCH6 +- MT6370 battery charger +- BMM150 compass +- BMM160 gyroscope +- Connections to the MediaTek AP + +Supported Features +================== + +The following features are supported: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| CLOCK | on-chip | reset and clock control | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | flash memory | ++-----------+------------+-------------------------------------+ +| WATCHDOG | on-chip | independent watchdog | ++-----------+------------+-------------------------------------+ + +Other features (such as I2C) are not available in Zephyr. + +The default configuration can be found in the defconfig file: +``boards/arm/google_kukui/google_kukui_defconfig`` + +Connections and IOs +=================== + +Each of the GPIO pins can be configured by software as output +(push-pull or open-drain), as input (with or without pull-up or +pull-down), or as peripheral alternate function. + +Default Zephyr Peripheral Mapping: +---------------------------------- + +- UART_1 TX/RX : PA10/PA9 + +Programming and Debugging +************************* + +Build application as usual for the ``google_kukui`` board, and flash +using Servo V2, μServo, or Servo V4 (CCD). See the +`Chromium EC Flashing Documentation`_ for more information. + +Debugging +========= + +Use SWD with a J-Link or ST-Link. + +References +********** + +.. target-notes:: + +.. _Chromium EC Flashing Documentation: + https://chromium.googlesource.com/chromiumos/platform/ec#Flashing-via-the-servo-debug-board diff --git a/boards/arm/google_kukui/google_kukui.dts b/boards/arm/google_kukui/google_kukui.dts new file mode 100644 index 0000000000000..d6b21a4d3bf6a --- /dev/null +++ b/boards/arm/google_kukui/google_kukui.dts @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 The Chromium OS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Google Kukui EC"; + compatible = "st,stm32f098rc", "st,stm32f098"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; +}; + +&usart1 { + current-speed = <115200>; + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Set 6Kb of storage at the end of the 256Kb of flash */ + storage_partition: partition@3e800 { + label = "storage"; + reg = <0x0003e800 0x00001800>; + }; + }; +}; + diff --git a/boards/arm/google_kukui/google_kukui.yaml b/boards/arm/google_kukui/google_kukui.yaml new file mode 100644 index 0000000000000..f0c170231d761 --- /dev/null +++ b/boards/arm/google_kukui/google_kukui.yaml @@ -0,0 +1,14 @@ +identifier: google_kukui +name: Google Kukui EC +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 32 +flash: 256 +testing: + ignore_tags: + - net + - bluetooth diff --git a/boards/arm/google_kukui/google_kukui_defconfig b/boards/arm/google_kukui/google_kukui_defconfig new file mode 100644 index 0000000000000..a6357b07d295f --- /dev/null +++ b/boards/arm/google_kukui/google_kukui_defconfig @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Zephyr Kernel Configuration +CONFIG_ARM=y +CONFIG_SOC_SERIES_STM32F0X=y + +# Platform Configuration +CONFIG_SOC_STM32F098XX=y +CONFIG_BOARD_GOOGLE_KUKUI=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 + +# Ideally, we would use HSI48, but this is not supported in +# Zephyr. Use "basic" HSI (8 MHz). +CONFIG_CORTEX_M_SYSTICK=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=8000000 + +# SYSCLK selection +CONFIG_CLOCK_STM32_SYSCLK_SRC_HSI=y diff --git a/boards/arm/google_kukui/pinmux.c b/boards/arm/google_kukui/pinmux.c new file mode 100644 index 0000000000000..035ff79032b47 --- /dev/null +++ b/boards/arm/google_kukui/pinmux.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 The Chromium OS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include + +static const struct pin_config pinconf[] = { +#ifdef CONFIG_UART_1 + {STM32_PIN_PA9, STM32F0_PINMUX_FUNC_PA9_USART1_TX}, + {STM32_PIN_PA10, STM32F0_PINMUX_FUNC_PA10_USART1_RX}, +#endif /* CONFIG_UART_1 */ +}; + +static int pinmux_stm32_init(struct device *port) +{ + ARG_UNUSED(port); + + stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf)); + + return 0; +} + +SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, + CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);