Skip to content

Commit 33009f5

Browse files
committed
soc: microchip: add new soc sama7d65
Product URL: https://www.microchip.com/en-us/product/SAMA7D65 Signed-off-by: Tony Han <tony.han@microchip.com>
1 parent 2d35c7c commit 33009f5

File tree

8 files changed

+141
-0
lines changed

8 files changed

+141
-0
lines changed

soc/microchip/sam/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# SPDX-License-Identifier: Apache-2.0
44
#
55

6+
config SOC_SERIES_SAMA7D6
7+
select ARM
8+
select CPU_CORTEX_A7
9+
select SOC_EARLY_INIT_HOOK
10+
611
config SOC_SERIES_SAMA7G5
712
select ARM
813
select CPU_CORTEX_A7
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
zephyr_sources(soc.c)
7+
zephyr_include_directories(.)
8+
9+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld CACHE INTERNAL "")
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
if SOC_SERIES_SAMA7D6
7+
8+
config NUM_IRQS
9+
default 189
10+
11+
config SYS_CLOCK_HW_CYCLES_PER_SEC
12+
default $(dt_node_int_prop_int,/soc/timer@e1800000,clock-frequency)
13+
14+
config MMU
15+
default y
16+
17+
endif # SOC_SERIES_SAMA7D6

soc/microchip/sam/sama7d6/Kconfig.soc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
config SOC_SERIES_SAMA7D6
7+
bool
8+
select SOC_FAMILY_MICROCHIP_SAM
9+
help
10+
Enable support for Microchip SAM Microprocessors.
11+
12+
config SOC_SERIES
13+
default "sama7d6" if SOC_SERIES_SAMA7D6
14+
15+
rsource "Kconfig.soc.sam*"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
config SOC_SAMA7D65
7+
bool
8+
select SOC_SERIES_SAMA7D6
9+
10+
config SOC
11+
default "sama7d65" if SOC_SAMA7D65

soc/microchip/sam/sama7d6/soc.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
*/
7+
8+
#include <zephyr/init.h>
9+
#include <zephyr/arch/arm/mmu/arm_mmu.h>
10+
#include <zephyr/kernel.h>
11+
12+
#define MMU_REGION_FLEXCOM_DEFN(idx, n) \
13+
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flx##n)), \
14+
(MMU_REGION_FLAT_ENTRY("flexcom"#n, FLEXCOM##n##_BASE_ADDRESS, 0x4000, \
15+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),), \
16+
())
17+
18+
static const struct arm_mmu_region mmu_regions[] = {
19+
MMU_REGION_FLAT_ENTRY("vectors", CONFIG_KERNEL_VM_BASE, 0x1000,
20+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_X),
21+
22+
FOR_EACH_IDX(MMU_REGION_FLEXCOM_DEFN, (), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
23+
24+
MMU_REGION_FLAT_ENTRY("gic", GIC_DISTRIBUTOR_BASE, 0x1100,
25+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
26+
27+
MMU_REGION_FLAT_ENTRY("pioa", PIO_BASE_ADDRESS, 0x4000,
28+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
29+
30+
MMU_REGION_FLAT_ENTRY("pit64b0", PIT64B0_BASE_ADDRESS, 0x4000,
31+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
32+
33+
MMU_REGION_FLAT_ENTRY("pmc", PMC_BASE_ADDRESS, 0x200,
34+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
35+
36+
MMU_REGION_FLAT_ENTRY("sckc", SCKC_BASE_ADDRESS, 0x4,
37+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
38+
};
39+
40+
const struct arm_mmu_config mmu_config = {
41+
.num_regions = ARRAY_SIZE(mmu_regions),
42+
.mmu_regions = mmu_regions,
43+
};
44+
45+
void relocate_vector_table(void)
46+
{
47+
write_vbar(CONFIG_KERNEL_VM_BASE);
48+
}
49+
50+
void soc_early_init_hook(void)
51+
{
52+
/* Enable Generic clock for PIT64B0 for system tick */
53+
PMC_REGS->PMC_PCR = PMC_PCR_CMD(1) | PMC_PCR_GCLKEN(1) | PMC_PCR_EN(1) |
54+
PMC_PCR_GCLKDIV(20 - 1) | PMC_PCR_GCLKCSS_MCK1 |
55+
PMC_PCR_PID(ID_PIT64B0);
56+
}

soc/microchip/sam/sama7d6/soc.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __SAMA7D6_SOC__H_
8+
#define __SAMA7D6_SOC__H_
9+
10+
#ifdef CONFIG_SOC_SAMA7D65
11+
#define __SAMA7D65__
12+
#endif
13+
14+
#include "sam.h"
15+
16+
/* number of clocks registered */
17+
#define SOC_NUM_CLOCK_PLL_FRAC 9
18+
#define SOC_NUM_CLOCK_PLL_DIV (SOC_NUM_CLOCK_PLL_FRAC + 1) /* AUDIO PLL: DIVPMC, DIVIO */
19+
#define SOC_NUM_CLOCK_MASTER 10 /* MCK 0 ~ 9 */
20+
#define SOC_NUM_CLOCK_PROGRAMMABLE 8 /* MCK 0 ~ 7 */
21+
#define SOC_NUM_CLOCK_SYSTEM 8 /* PCK 0 ~ 7 */
22+
#define SOC_NUM_CLOCK_PERIPHERAL 72
23+
#define SOC_NUM_CLOCK_GENERATED 44
24+
25+
#endif /* __SAMA7D6_SOC__H_ */

soc/microchip/sam/soc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
family:
22
- name: microchip_sam
33
series:
4+
- name: sama7d6
5+
socs:
6+
- name: sama7d65
47
- name: sama7g5
58
socs:
69
- name: sama7g54

0 commit comments

Comments
 (0)