Skip to content

soc: dts: drivers: add SoCs for amebad series #91933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3530,6 +3530,19 @@
labels:
- "platform: bouffalolab"

realtek ameba Platforms:
status: maintained
maintainers:
- zjian-zhang
files:
- drivers/*/*ameba*
- boards/realtek/
- soc/realtek/
- dts/arm/realtek/
- dts/bindings/*/*ameba*
labels:
- "platform: ameba"

Broadcom Platforms:
status: odd fixes
files:
Expand Down Expand Up @@ -5000,6 +5013,14 @@
labels:
- "platform: Ambiq"

"West project: hal_realtek":
status: maintained
maintainers:
- zjian-zhang
files: []
labels:
- "platform: ameba"

"West project: hal_atmel":
status: maintained
maintainers:
Expand Down Expand Up @@ -5059,7 +5080,7 @@
- "platform: ARM"

"West project: hal_gigadevice":
status: maintained

Check failure on line 5083 in MAINTAINERS.yml

View workflow job for this annotation

GitHub Actions / Check MAINTAINERS.yml changes

User lacks access

zjian-zhang does not have needed access level to zephyrproject-rtos/zephyr
maintainers:
- nandojve
collaborators:
Expand Down
5 changes: 5 additions & 0 deletions boards/realtek/rtl872xd_evb/Kconfig.rtl872xd_evb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Realtek Semiconductor Corp.
# SPDX-License-Identifier: Apache-2.0

config BOARD_RTL872XD_EVB
select SOC_AMEBAD
6 changes: 6 additions & 0 deletions boards/realtek/rtl872xd_evb/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 Realtek Semiconductor Corp.
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=Cortex-M33" "--speed=4000")

include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
5 changes: 5 additions & 0 deletions boards/realtek/rtl872xd_evb/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
board:
name: rtl872xd_evb
vendor: realtek
socs:
- name: amebad
77 changes: 77 additions & 0 deletions boards/realtek/rtl872xd_evb/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
.. zephyr:board:: rtl872xd_evb

Overview
********

The Realtek RTL872xD Series is a Combo SoC that supports dual-band Wi-Fi 4 (2.4GHz + 5GHz) and
BLE 5.0 specifications. With ultra-low power consumption, complete encryption strategy and abundant
peripheral resources, it is widely in various products such as Home appliance control panel,
Smart door, Smart toy, Smart voice, Smart remote control, Bluetooth gateway, Headset, Wi-Fi gamepad,
Smart POS, etc. For more information, check `RTL872XD-EVB`_.

The features include the following:

- Dual cores: Real-M300 and Real-M200
- 512KB + 64KB on-chip SRAM
- 802.11 a/b/g/n 1 x 1, 2.4GHz + 5GHz
- Supports BLE 5.0
- Peripheral Interface:

- Multi-communication interfaces: SPI x 2, UART x 4, I2C x 1
- Hardware Key-scan interface supports up to 36 keys
- Hardware Quad-decoder supports statistical and comparison functions
- Hardware IR transceiver can easily adapt to various IR protocols
- SDIO/USB high speed interface (both host and slave)
- Supports real-time clock together with 18 channels of PWM output
- Supports 5 channels of touch pad and 6 channels of GDMA
- Supports 7 channels of normal 12-bit ADC and 1 channel of VBAT
- Integrated LCDC supports both RGB and I8080 interfaces
- Integrated hardware crypto engine supports AES256/192/128 and SHA256
- Integrated audio codec

For more information, Get application note and datasheet at `RTL872xCS/D Series`_ depending on chip you use.

Supported Features
==================

.. zephyr:board-supported-hw::

Building
********

Here is an example for building the :zephyr:code-sample:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: rtl872xd_evb
:goals: build

Flashing
********

When the build finishes, downloading images into flash by `AmebaImageTool`_:

See the ApplicationNote chapter Image Tool from documentation links for more details.

#. Environment Requirements: EX. WinXP, Win 7 or later, Microsoft .NET Framework 4.0.
#. Connect chip and PC with USB wire.
#. Choose the Device profiles according to the chip you use.
#. Select the corresponding serial port and transmission baud rate. The default baud rate is 1500000.
#. Select the images to be programmed and set the start address and end address according to the flash layout, refer to [ameba_flashcfg.c/Flash_layout].
#. Click the Download button and start. The progress bar will show the download progress of each image and the log window will show the operation status.

.. note::

For an empty chip, the bootloader and app image shall be downloaded.

Debugging
*********

Using SWD through PB3(SWD_CLK) and PA27(SWD_DAT).

References
**********

.. _`RTL872XD-EVB`: https://www.realmcu.com/en/Home/Products/RTL872xCS-RTL872xD-Series#
.. _`RTL872xCS/D Series`: https://www.realmcu.com
.. _`AmebaImageTool`: https://github.com/Ameba-AIoT/ameba-rtos/tree/master/tools/ameba/ImageTool_Legacy/AmebaImageTool.exe
Binary file not shown.
20 changes: 20 additions & 0 deletions boards/realtek/rtl872xd_evb/rtl872xd_evb-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 Realtek Semiconductor Corp.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/pinctrl/amebad-pinctrl.h>

&pinctrl {
compatible = "realtek,ameba-pinctrl";

/*PA30 is SWD_CLK, PA31 is SWD_DAT(both pull-up internally)*/
loguart_default: loguart_default {
group1 {
pinmux = <AMEBA_PINMUX('A', 8, AMEBA_LOGUART)>, /* RXD */
<AMEBA_PINMUX('A', 7, AMEBA_LOGUART)>; /* TXD */
bias-pull-up;
};
};
};
31 changes: 31 additions & 0 deletions boards/realtek/rtl872xd_evb/rtl872xd_evb.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 Realtek Semiconductor Corp.
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <realtek/amebad/amebad.dtsi>
#include "rtl872xd_evb-pinctrl.dtsi"

/ {
model = "RealTek AmebaD RTL872XD EVB";
compatible = "realtek,rtl872xd_evb";

chosen {
zephyr,console = &loguart;
zephyr,shell-uart = &loguart;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};

/* 4MB flash */
&flash0 {
reg = <0x0e000020 DT_SIZE_M(4)>;
};

&loguart {
status = "okay";
};
16 changes: 16 additions & 0 deletions boards/realtek/rtl872xd_evb/rtl872xd_evb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2024 Realtek Semiconductor Corp.
# SPDX-License-Identifier: Apache-2.0

identifier: rtl872xd_evb
name: Realtek rtl872xd evaluation board
vendor: realtek
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
ram: 512
flash: 4096
supported:
- pinctrl
- serial
19 changes: 19 additions & 0 deletions boards/realtek/rtl872xd_evb/rtl872xd_evb_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2024 Realtek Semiconductor Corp.
# SPDX-License-Identifier: Apache-2.0

CONFIG_RUNTIME_NMI=y

CONFIG_CORTEX_M_SYSTICK=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# This board implies building Non-Secure firmware
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

# Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable LogUart
CONFIG_SERIAL=y
1 change: 1 addition & 0 deletions drivers/gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_ADP5585 gpio_adp5585.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_ADS1X4S0X gpio_ads1x4s0x.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_ALTERA_PIO gpio_altera_pio.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_AMBIQ gpio_ambiq.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_AMEBA gpio_ameba.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_ANDES_ATCGPIO100 gpio_andes_atcgpio100.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_AW9523B gpio_aw9523b.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_AXP192 gpio_axp192.c)
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,6 @@ source "drivers/gpio/Kconfig.xlnx_ps"
source "drivers/gpio/Kconfig.xmc4xxx"
# zephyr-keep-sorted-stop

source "drivers/gpio/Kconfig.ameba"

endif # GPIO
18 changes: 18 additions & 0 deletions drivers/gpio/Kconfig.ameba
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2024 Realtek Semiconductor Corp.
# SPDX-License-Identifier: Apache-2.0

config GPIO_AMEBA
bool "GPIO controller driver for Realtek Ameba series SoC"
default y
depends on DT_HAS_REALTEK_AMEBA_GPIO_ENABLED
help
Enable GPIO controller driver for Realtek Ameba series SoC

config GPIO_DEBOUNCE_EN
bool "Ameba GPIO Interrupt Debounce Enable"
depends on GPIO_AMEBA
default y
help
When Enable GPIO Interrupt Debounce, the external signal can be debounced to
remove any spurious glitches that are less than one period(about 32us) of
the external debouncing clock.
Loading
Loading