Skip to content

Commit 3cc6331

Browse files
committed
dts: clock: PIC32CM_JH: Add clock control driver bindings
Add bindings for dfll, fdpll, gclk generator, mclk cpu, osc32k, rtc clock and xosc. Signed-off-by: Sunil Abraham <[email protected]>
1 parent 9ae10ea commit 3cc6331

13 files changed

+1084
-0
lines changed

dts/arm/microchip/pic32c/pic32cm_jh/common/pic32cm_jh.dtsi

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <arm/armv6-m.dtsi>
1010
#include <zephyr/dt-bindings/gpio/gpio.h>
11+
#include <zephyr/dt-bindings/clock/mchp_pic32cm_jh_clock.h>
1112

1213
/ {
1314
cpus {
@@ -38,6 +39,59 @@
3839
compatible = "mmio-sram";
3940
};
4041

42+
clock: clock@40000800 {
43+
compatible = "microchip,pic32cm-jh-clock";
44+
reg = <0x40000800 0x24>, <0x40001000 0x58>,
45+
<0x40001400 0x20>, <0x40001c00 0x140>;
46+
reg-names = "mclk", "oscctrl",
47+
"osc32kctrl", "gclk";
48+
49+
xosc: xosc {
50+
compatible = "microchip,pic32cm-jh-xosc";
51+
};
52+
53+
osc48m: osc48m {
54+
compatible = "microchip,pic32cm-jh-osc48m";
55+
};
56+
57+
fdpll: fdpll {
58+
compatible = "microchip,pic32cm-jh-fdpll";
59+
};
60+
61+
rtcclock: rtcclock {
62+
compatible = "microchip,pic32cm-jh-rtc";
63+
#clock-cells = <1>;
64+
};
65+
66+
xosc32k: xosc32k {
67+
compatible = "microchip,pic32cm-jh-xosc32k";
68+
};
69+
70+
osc32k: osc32k {
71+
compatible = "microchip,pic32cm-jh-osc32k";
72+
};
73+
74+
gclkgen: gclkgen {
75+
compatible = "microchip,pic32cm-jh-gclkgen";
76+
77+
};
78+
79+
gclkperiph: gclkperiph {
80+
compatible = "microchip,pic32cm-jh-gclkperiph";
81+
#clock-cells = <1>;
82+
};
83+
84+
mclkcpu: mclkcpu {
85+
compatible = "microchip,pic32cm-jh-mclkcpu";
86+
mclk-cpu-div = <1>;
87+
};
88+
89+
mclkperiph: mclkperiph {
90+
compatible = "microchip,pic32cm-jh-mclkperiph";
91+
#clock-cells = <1>;
92+
};
93+
};
94+
4195
pinctrl: pinctrl@41000000 {
4296
compatible = "microchip,port-g1-pinctrl";
4397
#address-cells = <1>;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2025 Microchip Technology Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
title: Microchip PIC32CM_JH SOC family clock
5+
6+
description: |
7+
Microchip PIC32CM_JH SOC family clock (OSCCTRL, OSC32KCTRL, GCLK, MCLK)
8+
9+
include:
10+
- name: base.yaml
11+
- name: pinctrl-device.yaml
12+
13+
compatible: "microchip,pic32cm-jh-clock"
14+
15+
properties:
16+
on-timeout-ms:
17+
type: int
18+
default: 5
19+
description: |
20+
Timeout in milliseconds for clock to be on.
21+
22+
Driver waits in clock on API to check if the clock is actually on,
23+
so that the waiting time is not indefinite.
24+
25+
flash-wait-states:
26+
type: int
27+
default: 0
28+
description: |
29+
Number of wait states for a flash read operation.
30+
31+
Change this value based on the NVM access time and system frequency
32+
up to 15 wait states.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Copyright (c) 2025 Microchip Technology Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
title: PIC32CM_JH FDPLL clock
5+
6+
description: |
7+
Digital Phase Locked Loop (FDPLL), 48 MHz to 96 MHz output frequency from a 32 kHz to 2 MHz
8+
reference clock.
9+
10+
include: [base.yaml]
11+
12+
compatible: "microchip,pic32cm-jh-fdpll"
13+
14+
properties:
15+
fdpll-on-demand-en:
16+
type: int
17+
enum:
18+
- 0
19+
- 1
20+
default: 0
21+
description: |
22+
0: The oscillator is always on
23+
1: The oscillator is running when a peripheral is requesting the oscillator to be used as a
24+
clock source. The oscillator is not running if no peripheral is requesting the clock source.
25+
Important: Initializing it with 1, along with clock enabled, can lead to indefinite wait
26+
for the clock to be on, if there is no peripheral request for the clock in the sequence of
27+
clock Initialization. If required, better to turn on the clock using API, instead of
28+
enabling both during startup.
29+
30+
fdpll-run-in-standby-en:
31+
type: int
32+
enum:
33+
- 0
34+
- 1
35+
default: 1
36+
description: |
37+
0: The DPLLn is not running in standby sleep mode if no peripheral requests the clock.
38+
1: The DPLLn is running in standby sleep mode.
39+
If ONDEMAND is one, the DPLLn will be running when a peripheral is requesting the clock. If
40+
ONDEMAND is false, the clock source will always be running in standby sleep mode.
41+
42+
fdpll-en:
43+
type: int
44+
enum:
45+
- 0
46+
- 1
47+
default: 0
48+
description: |
49+
Oscillator Enable
50+
0: to disable, 1: to enable
51+
52+
fdpll-divider-ratio-frac:
53+
type: int
54+
default: 0
55+
description: |
56+
Set the fractional part of the frequency multiplier. (0 - 31)
57+
58+
fdpll-divider-ratio-int:
59+
type: int
60+
default: 0
61+
description: |
62+
Set the integer part of the frequency multiplier. (0 - 4095)
63+
64+
fdpll-xosc-clock-divider:
65+
type: int
66+
default: 0
67+
description: |
68+
Set the XOSC clock division factor (0 - 2047)
69+
70+
fdpll-lock-bypass-en:
71+
type: int
72+
enum:
73+
- 0
74+
- 1
75+
default: 0
76+
description: |
77+
Lock Bypass
78+
0: to disable, 1: to enable
79+
80+
fdpll-src:
81+
type: string
82+
enum:
83+
- "gclk0"
84+
- "gclk1"
85+
- "gclk2"
86+
- "gclk3"
87+
- "gclk4"
88+
- "gclk5"
89+
- "gclk6"
90+
- "gclk7"
91+
- "gclk8"
92+
- "xosc32k"
93+
- "xosc"
94+
default: "xosc32k"
95+
description: |
96+
Reference source clock selection
97+
98+
fdpll-wakeup-fast-en:
99+
type: int
100+
enum:
101+
- 0
102+
- 1
103+
default: 0
104+
description: |
105+
Wake Up Fast
106+
0: to disable, 1: to enable
107+
108+
fdpll-low-power-en:
109+
type: int
110+
enum:
111+
- 0
112+
- 1
113+
default: 0
114+
description: |
115+
When enabled, Time to Digital Converter is disabled (increase the output jitter).
116+
0: to disable, 1: to enable
117+
118+
fdpll-pi-filter-type:
119+
type: string
120+
enum:
121+
- "default"
122+
- "low-bandwidth"
123+
- "high-bandwidth"
124+
- "high-damping"
125+
default: "default"
126+
description: |
127+
Proportional Integral Filter Selection
128+
129+
fdpll-output-prescalar:
130+
type: string
131+
enum:
132+
- "div1"
133+
- "div2"
134+
- "div4"
135+
default: "div1"
136+
description: |
137+
Output prescalar divider.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Copyright (c) 2025 Microchip Technology Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
title: PIC32CM_JH Generic clock generator
5+
6+
description: |
7+
The Generic Clock controller (GCLK) features 9 Generic Clock Generators 0..8 that can
8+
provide a wide range of clock frequencies.
9+
10+
include: [base.yaml]
11+
12+
compatible: "microchip,pic32cm-jh-gclkgen"
13+
14+
child-binding:
15+
properties:
16+
subsystem:
17+
type: int
18+
required: true
19+
description: |
20+
Clock subsystem
21+
22+
gclkgen-div-factor:
23+
type: int
24+
default: 0
25+
description: |
26+
Represent a division value for the corresponding Generator. The actual division factor is
27+
dependent on the state of div-select (gclk1 0 - 65535, others 0 - 255)
28+
29+
gclkgen-run-in-standby-en:
30+
type: int
31+
enum:
32+
- 0
33+
- 1
34+
default: 0
35+
description: |
36+
Keep the Generator running in Standby as long as it is configured to output to a dedicated
37+
GCLK_IOn pin. If output is not configured to a pin, this field has no effect and the
38+
generator will only be running if a peripheral requires the clock.
39+
0: to disable, 1: to enable
40+
41+
gclkgen-div-select:
42+
type: string
43+
enum:
44+
- "div-factor"
45+
- "div-factor-power"
46+
default: "div-factor"
47+
description: |
48+
The Generator clock frequency equals the clock source frequency divided by div-factor
49+
DIV_FACTOR_POWER: The Generator clock frequency equals the clock source frequency divided
50+
by 2^(N+1), where N is the div-factor
51+
52+
gclkgen-pin-output-en:
53+
type: int
54+
enum:
55+
- 0
56+
- 1
57+
default: 0
58+
description: |
59+
Generator clock output to the corresponding pin, if that pin is not configured as input
60+
source.
61+
0: to disable, 1: to enable
62+
63+
gclkgen-pin-output-off-val:
64+
type: string
65+
enum:
66+
- "low"
67+
- "high"
68+
default: "low"
69+
description: |
70+
Output value of the corresponding pin, when the Generator is turned off or the output-en is
71+
false, as long as the pin is not source.
72+
73+
gclkgen-improve-duty-cycle-en:
74+
type: int
75+
enum:
76+
- 0
77+
- 1
78+
default: 0
79+
description: |
80+
Improve the duty cycle of the Generator output to 50/50 for odd division factors
81+
0: to disable, 1: to enable
82+
83+
gclkgen-en:
84+
type: int
85+
enum:
86+
- 0
87+
- 1
88+
default: 0
89+
description: |
90+
Enable gclk generator
91+
0: to disable, 1: to enable
92+
93+
gclkgen-src:
94+
type: string
95+
enum:
96+
- "xosc"
97+
- "gclk-pin"
98+
- "gclk1"
99+
- "osculp32k"
100+
- "osc32k"
101+
- "xosc32k"
102+
- "osc48m"
103+
- "fdpll"
104+
default: "xosc"
105+
description: |
106+
Generator source clock selection
107+
108+
gclkgen-pin-src-freq:
109+
type: int
110+
default: 0
111+
description: |
112+
External input clock frequency of the pin, when used as source. (0 - 200000000)

0 commit comments

Comments
 (0)