Skip to content

soc: dts: drivers: add SoCs for amebadplus series #78036

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 @@ Bouffalolab Platforms:
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 @@ West:
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
5 changes: 5 additions & 0 deletions boards/realtek/rtl872xda_evb/Kconfig.rtl872xda_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_RTL872XDA_EVB
select SOC_AMEBADPLUS
6 changes: 6 additions & 0 deletions boards/realtek/rtl872xda_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-M55" "--speed=4000")

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

Overview
********

The Realtek RTL8721Dx Series is a Combo SoC that supports dual-band Wi-Fi 4 (2.4GHz + 5GHz) and
BLE 5.0 specifications. With excellent ultra-low power consumption, enhanced encryption strategy
(PSA Level 2), and abundant peripheral resources, it is widely used in smart home appliance,
line controller, smart door lock, battery camera, smart remote controller, Wi-Fi Speaker, Wi-Fi
Full MAC NIC, BLE gateway, and smart POS, etc. For more information, check `RTL872XDA-EVB`_.

The features include the following:

- Dual cores: Real-M300 and Real-M200
- 512KB 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 2
- Hardware Key-Scan interface supports up to 8*8 (64) keys
- Hardware IR transceiver can easily adapt to various IR protocols
- Supports Real-Time Clock timer together with 10 basic timers
- Supports 8 channels of PWM timer and 1 capture timer
- Supports 7 channels of general 12-bit ADC and 1 channel of VBAT
- Supports 4 channels of touch pad
- Supports 8 independent channels of GDMA
- Supports USB 2.0 full-speed device mode
- Supports SDIO device with 1-bit and 4-bit mode
- Embeds a serial LEDC to control the external LED lamps
- Integrated Pixel Processing Engine (PPE) to process pixel data faster
- Integrated OSPI display interface supports screens with OSPI/QSPI/SPI interfaces
- Integrated audio codec supports 2 channels DMIC interface
- I2S x 2: up to 384kHz sampling rate

- Cryptographic hardware acceleration (TRNG, ECC, SHA-2, AES)

For more information, Get application note and datasheet at `RTL8721Dx 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: rtl872xda_evb
:goals: buil

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this device is completely unusable on linux or mac? west flash also cannot work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not support the ‘west flash’ command. In the future, we will provide a Python script to enable downloading across all platforms by loguart.

#. 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 PA30(SWD_CLK) and PA31(SWD_DAT).

References
**********

.. _`RTL872XDA-EVB`: https://www.realmcu.com/en/Home/Product/add965ea-d661-4a63-9514-d18b6912f8ab#
.. _`RTL8721Dx Series`: https://www.realmcu.com
.. _`AmebaImageTool`: https://github.com/Ameba-AIoT/ameba-rtos/blob/master/tools/ameba/ImageTool/AmebaImageTool.exe
Binary file not shown.
20 changes: 20 additions & 0 deletions boards/realtek/rtl872xda_evb/rtl872xda_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/amebadplus-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('B', 4, AMEBA_LOG_UART)>, /* RXD */
<AMEBA_PINMUX('B', 5, AMEBA_LOG_UART)>; /* TXD */
bias-pull-up;
};
};
};
31 changes: 31 additions & 0 deletions boards/realtek/rtl872xda_evb/rtl872xda_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/amebadplus/amebadplus.dtsi>
#include "rtl872xda_evb-pinctrl.dtsi"

/ {
model = "RealTek AmebaDplus RTL872XDA EVB";
compatible = "realtek,rtl872xda_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/rtl872xda_evb/rtl872xda_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: rtl872xda_evb
name: Realtek rtl872xda evaluation board
vendor: realtek
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
ram: 512
flash: 4096
supported:
- pinctrl
- serial
9 changes: 9 additions & 0 deletions boards/realtek/rtl872xda_evb/rtl872xda_evb_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024 Realtek Semiconductor Corp.
# SPDX-License-Identifier: Apache-2.0

# 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