Skip to content
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

Initial support for Ambiq Apollo4 Plus #59470

Merged
merged 18 commits into from
Aug 4, 2023

Conversation

msobkowski
Copy link
Contributor

@msobkowski msobkowski commented Jun 21, 2023

This PR provides initial support for the Ambiq Apollo4 Plus SoC and the Apollo4P EVB board.

The PR consists of:

  • Adding Ambiq HAL module
  • Ambiq Apollo4 Plus SoC support
  • Ambiq Apollo4P EVB board support
  • Ambiq System Timer (STIMER) driver
  • Changes to PL011 UART driver to support variant present in Apollo4 Plus SoC

Initial support was verified on hardware by running the following samples:

  • hello_world
  • philosophers
  • subsys/shell/shell_module

This PR should be merged only after zephyrproject-rtos/hal_ambiq#1 is merged and hal_ambiq revision in west.yml is bumped to the newest one.

@zephyrbot zephyrbot added area: Timer Timer area: Devicetree Binding PR modifies or adds a Device Tree binding area: UART Universal Asynchronous Receiver-Transmitter area: Process labels Jun 21, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello @msobkowski, and thank you very much for your first pull request to the Zephyr project!

A project maintainer just triggered our CI pipeline to run it against your PR and ensure it's compliant and doesn't cause any issues. You might want to take this opportunity to review the project's Contributor Expectations and make any updates to your pull request if necessary. 😊

@zephyrbot zephyrbot added manifest manifest-hal_ambiq DNM This PR should not be merged (Do Not Merge) labels Jun 21, 2023
@zephyrbot
Copy link
Collaborator

zephyrbot commented Jun 21, 2023

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_ambiq N/A zephyrproject-rtos/hal_ambiq@c8203b6 (main) N/A

Note: This message is automatically posted and updated by the Manifest GitHub Action.

soc/arm/ambiq/apollo4x/soc.c Outdated Show resolved Hide resolved
@msobkowski
Copy link
Contributor Author

I've added a commit (f9012b4) that sets remote for Ambiq HAL in west.yml to github.com/antmicro (where the repo is available currently) to enable building Zephyr for Apollo4P. Request for HAL module repo is tracked here: #59473.

@msobkowski msobkowski force-pushed the ambiq-apollo4p-initial branch 3 times, most recently from 5e970eb to 8d0704d Compare June 27, 2023 11:21
dts/arm/ambiq/ambiq_apollo4p.dtsi Outdated Show resolved Hide resolved
boards/arm/apollo4p_evb/apollo4p_evb_defconfig Outdated Show resolved Hide resolved
drivers/serial/uart_pl011.c Outdated Show resolved Hide resolved
drivers/serial/uart_pl011.c Outdated Show resolved Hide resolved
drivers/serial/Kconfig.pl011 Outdated Show resolved Hide resolved
drivers/timer/ambiq_stimer.c Outdated Show resolved Hide resolved
soc/arm/ambiq/Kconfig.defconfig Show resolved Hide resolved
soc/arm/ambiq/apollo4x/Kconfig.series Show resolved Hide resolved
soc/arm/ambiq/apollo4x/soc.c Outdated Show resolved Hide resolved
soc/arm/ambiq/apollo4x/soc.h Outdated Show resolved Hide resolved
@msierszulski
Copy link
Member

Hi @gmarull @carlescufi, can you take another look at this PR? Thanks.

msobkowski and others added 18 commits August 1, 2023 14:55
Add the Ambiq HAL module to the West manifest.

Signed-off-by: Maciej Sobkowski <[email protected]>
This commit introduces the Ambiq HAL module required for the
Ambiq Apollo4 Plus SoC support.

Signed-off-by: Maciej Sobkowski <[email protected]>
Added Ambiq Micro vendor prefix to enable dts bindings for peripherals in
Ambiq SoCs.

Signed-off-by: Maciej Sobkowski <[email protected]>
Add all required parts (new SoC family/series, device tree) for
the Ambiq Apollo4 Plus SoC.

Signed-off-by: Maciej Sobkowski <[email protected]>
This commit addst pinctrl support for Apollo4 SoCs.

Co-authored-by: Mateusz Sierszulski <[email protected]>
Signed-off-by: Maciej Sobkowski <[email protected]>
This commit instantiates pinctrl node in the dts file for Apollo4
Plus SoC.

Signed-off-by: Maciej Sobkowski <[email protected]>
The registers definitions will be needed when adding vendor-specific quirks
to this driver, so this commits moves them to a dedicated header file.

Signed-off-by: Maciej Sobkowski <[email protected]>
This commit adds Ambiq power control dedicated compatible.

Signed-off-by: Mateusz Sierszulski <[email protected]>
This commit adds Ambiq power configuration dedicated
compatible.

Signed-off-by: Mateusz Sierszulski <[email protected]>
UART controllers present on Ambiq SoCs implement a PL011 compatible
interface, with some minor differences that require certain quirks.
To support them a dedicated compatible is needed.

Signed-off-by: Maciej Sobkowski <[email protected]>
Add definitions for CLKEN/CLKSEL registers, which are used to control
peripheral clock on the variant of the PL011 UART present in Ambiq SoCs.

Signed-off-by: Maciej Sobkowski <[email protected]>
UART controller present in Ambiq SoCs is mostly compatible with PL011, but
requires some quirks that are implemented in this commit:
- the peripheral needs to be powered on first, via the PWRCTRL core,
- peripheral clock needs to be enabled and configured via the CLKEN/CLKSEL.
  registers.

The quirks mechanism was inspired by support for STM32F4 SoC in the
usb_dc_dw driver (fce0b85).

Co-authored-by: Mateusz Sierszulski <[email protected]>
Signed-off-by: Maciej Sobkowski <[email protected]>
Signed-off-by: Mateusz Sierszulski <[email protected]>
PINCTRL needs to be enabled for the driver to work on the Apollo4 family
SoCs.

Signed-off-by: Maciej Sobkowski <[email protected]>
This commit adds PL011 UART instances to the apollo4p dts.

Signed-off-by: Maciej Sobkowski <[email protected]>
This commit addst support for the system timer peripheral which
can be found in Apollo4 SoCs.

Signed-off-by: Maciej Sobkowski <[email protected]>
Disable SysTick when STIMER is in use and configure
SYS_CLOCK_HW_CYCLES_PER_SEC setting for it.

Signed-off-by: Maciej Sobkowski <[email protected]>
This commit adds support for the Ambiq Apollo4P EVB board (AMAP4PEVB).

Signed-off-by: Maciej Sobkowski <[email protected]>
Add people responsible for maintaining Zephyr on Ambiq SoCs.

Signed-off-by: Maciej Sobkowski <[email protected]>
@msierszulski msierszulski removed the DNM This PR should not be merged (Do Not Merge) label Aug 1, 2023
@msierszulski
Copy link
Member

It looks like the DNM label is added automatically because the hal_ambiq is currently not present in the west.yml file on the main branch, and this triggers Zephyrbot to add the DNM label: https://github.com/zephyrproject-rtos/zephyr/actions/runs/5727067842/job/15518735602?pr=59470#step:3:102. It seems that this is handled by the manifest action.

Normally, when the HAL PR is merged, i.e. west.yml doesn't point to the pull/x/head revision, the DNM label is dropped automatically, so I have removed it manually in this case.

Copy link
Collaborator

@kgugala kgugala left a comment

Choose a reason for hiding this comment

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

LGTM

@carlescufi carlescufi merged commit 5838b62 into zephyrproject-rtos:main Aug 4, 2023
20 of 21 checks passed
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hi @msobkowski!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

@tgorochowik tgorochowik deleted the ambiq-apollo4p-initial branch August 4, 2023 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: Pinctrl area: Process area: Timer Timer area: UART Universal Asynchronous Receiver-Transmitter manifest manifest-hal_ambiq
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants