1# Copyright (c) 2023 Andriy Gelman 2# SPDX-License-Identifier: Apache-2.0 3 4description: | 5 An external clock signal driven by a PWM pin. 6 7 The devicetree must define a clock node: 8 9 pwmclock: pwmclock { 10 status = "okay"; 11 compatible = "pwm-clock"; 12 #clock-cells = <1>; 13 pwms = <&pwm_ccu40 2 PWM_HZ(1000000) PWM_POLARITY_NORMAL>; 14 }; 15 16 This will create a device node with a clock-controller 17 API. Internally the device node will use PWM API to start the 18 clock signals at 1MHz. Note that the PWM_HZ() macro converts the 19 frequency to time (nanoseconds units). This may result in rounding 20 errors if the clock frequency is not an integer number of nanoseconds. 21 The clock frequency can be explicitly set using the clock-frequency 22 property. 23 24 The PWM node may need to be properly configured to generate 25 the target period (i.e. using prescaler options). See the documentation 26 for the target PWM driver. 27 28compatible: "pwm-clock" 29 30include: [clock-controller.yaml, base.yaml] 31 32properties: 33 pwms: 34 type: phandle-array 35 required: true 36 37 clock-frequency: 38 type: int 39 description: | 40 Exact output frequency, in case the PWM period is not exact 41 but was rounded to nanoseconds. This property is optional. 42 43 pwm-on-delay: 44 type: int 45 default: 0 46 description: 47 Optional blocking delay in micro seconds to make sure that the PWM 48 clock has started after returning from clock_control_on(). 49 50 "#clock-cells": 51 const: 1 52 53clock-cells: 54 - id 55