Skip to content

Add Basic support for Microchip SAM D5X/E5X Family devices #93450

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 10 commits into
base: main
Choose a base branch
from

Conversation

ArunMCHP
Copy link

This PR adds initial support for Microchip’s SAM D5x/E5x family of SoCs, along with board support for the SAM E54 Xplained Pro development kit (ATSAME54-XPRO). It includes the basic SoC integration, devicetree files, and minimal configuration needed to bring up the board with a working UART console.

Associated pull request for the addition of the SAM D5x/E5x devices to hal_microchip:
zephyrproject-rtos/hal_microchip#33

The naming convention of driver files and device organization is as per the RFC : #92168

@zephyrbot zephyrbot added platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) area: Pinctrl area: Flash area: UART Universal Asynchronous Receiver-Transmitter labels Jul 21, 2025
Copy link

Hello @ArunMCHP, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Copy link

github-actions bot commented Jul 21, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_microchip zephyrproject-rtos/hal_microchip@32a79d4 zephyrproject-rtos/hal_microchip@97485f8 (master) zephyrproject-rtos/hal_microchip@32a79d48..97485f8d

All manifest checks OK

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

@github-actions github-actions bot added manifest manifest-hal_microchip DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jul 21, 2025
Comment on lines 7 to 8
config SOC_FAMILY
default "microchip_sam_d5x_e5x" if SOC_FAMILY_MCHP_SAM_D5X_E5X
Copy link
Contributor

Choose a reason for hiding this comment

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

names do not match

Copy link
Author

Choose a reason for hiding this comment

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

Renamed to mchp_sam_d5x_e5x

Copy link
Member

Choose a reason for hiding this comment

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

Hi @nordicjm ,

It is not clear what naming you are referring for:

Is the default "microchip_sam_d5x_e5x" that should match with the folder structure ?

soc/microchip/sam/sam_d5x_e5x or soc/microchip/sam/d5x_e5x
or even

SOC_FAMILY_MCHP_SAM_D5X_E5X should be SOC_FAMILY_MICROCHIP_SAM_D5X_E5X ?

Copy link
Contributor

Choose a reason for hiding this comment

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

soc.yml values e.g family must match the string here and Kconfig name for the family

Comment on lines 10 to 18
config SOC_SERIES_REVISION_N
bool
depends on SOC_FAMILY_MCHP_SAM_D5X_E5X

config SOC_SERIES_REVISION
string
default "n" if SOC_SERIES_REVISION_N
default ""
depends on SOC_FAMILY_MCHP_SAM_D5X_E5X
Copy link
Contributor

Choose a reason for hiding this comment

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

do not think this should be here @tejlmand

Copy link
Author

Choose a reason for hiding this comment

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

Removed this.

Comment on lines 10 to 11
config SOC_SERIES
default "samd51" if SOC_SERIES_MCHP_SAMD51
Copy link
Contributor

Choose a reason for hiding this comment

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

does not match

Copy link
Author

Choose a reason for hiding this comment

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

Renamed to mchp_samd51.


config SOC_SERIES
default "samd51" if SOC_SERIES_MCHP_SAMD51

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Copy link
Author

Choose a reason for hiding this comment

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

fixed.

config SOC_ATSAMD51P20A
bool
select SOC_SERIES_MCHP_SAMD51

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Copy link
Author

Choose a reason for hiding this comment

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

fixed.

Comment on lines 4 to 8
config PINCTRL_MCHP_PORT_ID_U2210_2_2_0
bool
default n
help
Internal flag to enable PORT ID U2210_2_2_0 support.
Copy link
Contributor

Choose a reason for hiding this comment

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

put this in an if so it's not bleeding into other devices

Copy link
Author

Choose a reason for hiding this comment

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

We moved this symbol to family kconfig.soc, and kept inside if SOC_FAMILY_MCHP_SAM_D5X_E5X.
path : soc/microchip/sam/sam_d5x_e5x/Kconfig.soc


config PINCTRL_MCHP_PORT_ID_U2210_2_2_0
bool
default n
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
default n

fix in whole PR

Copy link
Author

@ArunMCHP ArunMCHP Jul 22, 2025

Choose a reason for hiding this comment

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

moved to family kconfig.soc and fixed.

select PINCTRL
select UART_MCHP_SERCOM_ID_U2201_5_0_0 if SOC_FAMILY_MCHP_SAM_D5X_E5X
help
This option enables the USART driver for Microchip sercom-g1 IPs.
Copy link
Contributor

Choose a reason for hiding this comment

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

help text indent in 1x tab followed by 2x spaces

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

reduce resolution and put through https://tinypng.com/

Copy link
Author

Choose a reason for hiding this comment

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

Reduced resolution using https://tinypng.com/ and updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

reduce resolution and put through https://tinypng.com/

Copy link
Author

Choose a reason for hiding this comment

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

Reduced resolution using https://tinypng.com/ and updated.

@ArunMCHP ArunMCHP force-pushed the sam_d5x_e5x_minimal_support branch from 5e8b12a to 4981667 Compare July 22, 2025 14:19
@ArunMCHP ArunMCHP requested a review from nordicjm July 22, 2025 14:37
Copy link
Member

@parthitce parthitce left a comment

Choose a reason for hiding this comment

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

Please re-order the commits.

# List of Peripheral IPs available in SOC_FAMILY_MCHP_SAM_D5X_E5X family
if SOC_FAMILY_MCHP_SAM_D5X_E5X

config UART_MCHP_SERCOM_U2201_5_0_0
Copy link
Member

Choose a reason for hiding this comment

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

this shall be part of board IMO

Copy link
Author

Choose a reason for hiding this comment

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

Here, we define peripheral IP versions as Kconfig symbols at the SoC family level, since these IPs are shared across multiple SoCs in the SAM D5X/E5X family. Keeping them here avoids duplication when supporting multiple boards, for example, if we later add support for the SAME54 Curiosity board, we won’t need to redefine the same IP symbols again.

help
Enable SERCOM UART peripheral IP version 5.0.0 (U2201).

config PINCTRL_MCHP_PORT_U2210_2_2_0
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Author

@ArunMCHP ArunMCHP Jul 23, 2025

Choose a reason for hiding this comment

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

Refer the response to previous comment.


zephyr_sources(soc.c)

zephyr_include_directories(.)
Copy link
Member

Choose a reason for hiding this comment

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

no header inside common

Copy link
Author

Choose a reason for hiding this comment

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

Removed zephyr_include_directories(.)


zephyr_include_directories(.)

zephyr_include_directories(${ZEPHYR_BASE}/drivers)
Copy link
Member

Choose a reason for hiding this comment

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

There is no header under drivers

Copy link
Author

Choose a reason for hiding this comment

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

Removed zephyr_include_directories(${ZEPHYR_BASE}/drivers)


void soc_reset_hook(void)
{
/* Intentionally empty */
Copy link
Member

Choose a reason for hiding this comment

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

then it's not required

Choose a reason for hiding this comment

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

The soc_reset_hook has been included to maintain a consistent structure. Although this file is currently empty, it serves as a placeholder for future peripheral driver additions and enables users to add custom code to execute during reset.

Copy link
Author

Choose a reason for hiding this comment

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

@parthitce Yes, removed this file. Thanks.

/* Validate subsystem. */
if (CLOCK_SUCCESS != clock_check_subsys(subsys)) {
ret_val = -ENOTSUP;
break;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link

Choose a reason for hiding this comment

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

Refer the response to previous comment

# Common features for all SOC families
if CLOCK_CONTROL_MCHP

config CLOCK_CONTROL_MCHP_GET_RATE
Copy link
Member

Choose a reason for hiding this comment

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

why is this special ?

Choose a reason for hiding this comment

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

Since the clock rates for multiple levels of clock sources need to be calculated, this feature increases the program size. Therefore, it has been made optional, allowing the user to decide whether to enable it.

do {
/* Check if turning on all clocks is requested. */
if (subsys.val == (uint32_t)CLOCK_CONTROL_SUBSYS_ALL) {
break;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Choose a reason for hiding this comment

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

Please refer the response to previous comment

default:
LOG_ERR("Unsupported mclkbus");
break;
}
Copy link
Member

Choose a reason for hiding this comment

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

new line, applies everywhere

Copy link
Author

Choose a reason for hiding this comment

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

New line provided.

bool is_wait = false;
uint32_t on_timeout_ms = 0;

subsys.val = (uint32_t)sys;
Copy link
Member

Choose a reason for hiding this comment

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

move to declaration + init form

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@ArunMCHP ArunMCHP force-pushed the sam_d5x_e5x_minimal_support branch from 4981667 to 5b8d763 Compare July 23, 2025 15:06
Update west.yml for SAM_D5X_E5X Device family pack

Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
@ArunMCHP ArunMCHP force-pushed the sam_d5x_e5x_minimal_support branch from 5b8d763 to eac3759 Compare July 23, 2025 18:04
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Jul 23, 2025
@ArunMCHP ArunMCHP requested a review from parthitce July 23, 2025 18:15
gclkgen_src = (gclk_regs->GCLK_GENCTRL[gclkgen_id] & GCLK_GENCTRL_SRC_Msk) >>
GCLK_GENCTRL_SRC_Pos;
if (gclkgen_called_src == gclkgen_src) {
ret_val = -ELOOP;
Copy link
Member

Choose a reason for hiding this comment

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

ELOOP? Have you read clock_control_get_rate ?

Choose a reason for hiding this comment

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

Hi @parthitce, do You suggest to use -ENOTSUP here?
-ELOOP was used to show circular clock dependency error.
Is it not allowed to use a different error code from those mentioned in API header, to show a specific error cause, which can make debug easier?.

ArunMCHP and others added 9 commits July 24, 2025 16:35
Adds initial SoC-level support for the Microchip SAM D5x
and E5x series, including SoC definition files.

Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
Add minimal set of binding parameters for clock_control driver.

Signed-off-by: Sunil Abraham <sunil.abraham@microchip.com>
Add clock control driver with minimal functionality.
Implement basic on, off, get_status and get_rate API.

Signed-off-by: Sunil Abraham <sunil.abraham@microchip.com>
Add binding parameters for Microchip Pinctrl Port G1 IP

Signed-off-by: Mohamed Azhar <mohamed.azhar@microchip.com>
Add pinctrl driver for Microchip Port G1 Peripheral IPs

Signed-off-by: Mohamed Azhar <mohamed.azhar@microchip.com>
Add minimal set of binding parameters for sercom uart driver.

Signed-off-by: Sunil Abraham <sunil.abraham@microchip.com>
Add uart driver with minimal features.
Implement polling receive and transmit functionality.

Signed-off-by: Sunil Abraham <sunil.abraham@microchip.com>
Adds common and SoC-specific .dtsi files for the Microchip
SAM D5x/E5x family. These files define core peripherals,
address maps, and interrupt controller structure shared
across the SAM D5x/E5x variants.

Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
Add initial support for the Microchip SAM E54 Xplained Pro board
(ATSAME54-XPRO).

Product page: https://www.microchip.com/en-us/development-tool/atsame54-xpro

Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
@ArunMCHP ArunMCHP force-pushed the sam_d5x_e5x_minimal_support branch from eac3759 to ee7f4ff Compare July 24, 2025 11:59
@ArunMCHP ArunMCHP requested a review from parthitce July 24, 2025 12:06
@ArunMCHP
Copy link
Author

@parthitce Thanks for your valuable comments and suggestions.

Updated the PR as per your comments :

  • Reordered the commits as per your suggestion.
  • Removed empty files.
  • Corrected CMakeLists.txt.
  • Fixed camel case issues in DTS files.
  • Updated clock source files based on your comments.
  • Moved DTSI files into a single commit.
  • And provided comments for do-while usage, ELOOP and IP version Kconfig symbols.

Copy link

Copy link
Member

Choose a reason for hiding this comment

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

The SoC DTS must be before SoC. Why ? There is usually a dependency order that must be take in consideration.
BTW, keep the dts with only the nodes that are really necessary. Let nodes from the drivers in their own commit together with the bindings.

We need to establish the correct order to avoid bisect issues in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Clock Control area: Flash area: Pinctrl area: UART Universal Asynchronous Receiver-Transmitter manifest manifest-hal_microchip platform: Microchip MEC Microchip MEC Platform platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants