-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
base: main
Are you sure you want to change the base?
Add Basic support for Microchip SAM D5X/E5X Family devices #93450
Conversation
Hello @ArunMCHP, and thank you very much for your first pull request to the Zephyr project! |
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
config SOC_FAMILY | ||
default "microchip_sam_d5x_e5x" if SOC_FAMILY_MCHP_SAM_D5X_E5X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
names do not match
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this.
config SOC_SERIES | ||
default "samd51" if SOC_SERIES_MCHP_SAMD51 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not match
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
drivers/pinctrl/Kconfig.mchp
Outdated
config PINCTRL_MCHP_PORT_ID_U2210_2_2_0 | ||
bool | ||
default n | ||
help | ||
Internal flag to enable PORT ID U2210_2_2_0 support. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
drivers/pinctrl/Kconfig.mchp
Outdated
|
||
config PINCTRL_MCHP_PORT_ID_U2210_2_2_0 | ||
bool | ||
default n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default n |
fix in whole PR
There was a problem hiding this comment.
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.
drivers/serial/Kconfig.mchp
Outdated
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
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.
5e8b12a
to
4981667
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
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(.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no header inside common
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this special ?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line, applies everywhere
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
4981667
to
5b8d763
Compare
Update west.yml for SAM_D5X_E5X Device family pack Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
5b8d763
to
eac3759
Compare
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; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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?.
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>
eac3759
to
ee7f4ff
Compare
@parthitce Thanks for your valuable comments and suggestions. Updated the PR as per your comments :
|
|
There was a problem hiding this comment.
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.
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