zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts
Ruibin Chang 5f3bba54e8 ITE drivers/pwm: support tests/drivers/pwm/pwm_api
Add pwm-0 to support tests/drivers/pwm/pwm_api.

Solve tests code runtime error on it8xxx2_evb:
1.If the pwm channel target frequency is < 1, then we will
  return an error code.

2.If the target_freq is <= 324Hz, we will configure that this pwm
  channel need to output in EC power saving mode.
  In test_pwm_cycle() case, the period is 64000, then the
  target_freq is 8000000 / 64000 = 125Hz and <= 324Hz, so we will
  switch the prescaler clock source from 8MHz to 32.768kHz.
  Then the target_freq is 32768 / 64000 = 0.512Hz and < 1Hz,
  this will return an error code. In order to get the same
  target_freq, we always return PWM_FREQ in
  pwm_it8xxx2_get_cycles_per_sec().

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-02-21 20:44:41 -05:00

141 lines
2.5 KiB
Text

/*
* Copyright (c) ITE, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <it8xxx2.dtsi>
#include <it8xxx2-alts-map.dtsi>
/ {
model = "IT8XXX2 EV-Board";
compatible = "riscv,it8xxx2-evb";
aliases {
i2c-0 = &i2c0;
peci-0 = &peci0;
};
chosen {
zephyr,console = &uart1;
zephyr,shell-uart = &uart1;
zephyr,bt-uart = &uart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,flash-controller = &flashctrl;
zephyr,code-partition = &slot0_partition;
zephyr,keyboard-scan = &kscan0;
};
aliases {
led0 = &led0;
kscan0 = &kscan0;
watchdog0 = &twd0;
pwm-0 = &pwm0;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
label = "Green LED";
};
};
};
&adc0 {
status = "okay";
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&i2c2 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&i2c3 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&i2c4 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&i2c5 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&uart1 {
status = "okay";
current-speed = <115200>;
clock-frequency = <1804800>;
};
&uart2 {
status = "okay";
current-speed = <460800>;
clock-frequency = <1804800>;
};
&ite_uart1_wrapper {
status = "okay";
};
&ite_uart2_wrapper {
status = "okay";
};
/* pwm for test */
&pwm0 {
status = "okay";
prescaler-cx = <PWM_PRESCALER_C6>;
/*
* If we need pwm output in ITE chip power saving mode,
* then we should set frequency <=324Hz.
*/
pwm-output-frequency = <324>;
};
/* pwm for fan */
&pwm7 {
status = "okay";
prescaler-cx = <PWM_PRESCALER_C4>;
pwm-output-frequency = <30000>;
};
/* fan tachometer sensor */
&tach0 {
status = "okay";
channel = <IT8XXX2_TACH_CHANNEL_A>;
pulses-per-round = <2>;
};
&kscan0 {
status = "okay";
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x20000>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 0x20000>;
};
slot1_partition: partition@40000 {
label = "image-1";
reg = <0x00040000 0x10000>;
};
scratch_partition: partition@50000 {
label = "image-scratch";
reg = <0x00050000 0x10000>;
};
storage_partition: partition@60000 {
label = "storage";
reg = <0x00060000 0x20000>;
};
};
};