|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 MASSDRIVER EI (massdriver.space) |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +#include <freq.h> |
| 8 | +#include <mem.h> |
| 9 | +#include <wch/qingke-v4b.dtsi> |
| 10 | +#include <zephyr/dt-bindings/gpio/gpio.h> |
| 11 | +#include <zephyr/dt-bindings/i2c/i2c.h> |
| 12 | +#include <zephyr/dt-bindings/clock/ch32v20x_30x-clocks.h> |
| 13 | + |
| 14 | +/ { |
| 15 | + clocks { |
| 16 | + clk_hse: clk-hse { |
| 17 | + #clock-cells = <0>; |
| 18 | + compatible = "wch,ch32v00x-hse-clock"; |
| 19 | + clock-frequency = <DT_FREQ_M(8)>; |
| 20 | + status = "disabled"; |
| 21 | + }; |
| 22 | + |
| 23 | + clk_hsi: clk-hsi { |
| 24 | + #clock-cells = <0>; |
| 25 | + compatible = "wch,ch32v00x-hsi-clock"; |
| 26 | + clock-frequency = <DT_FREQ_M(8)>; |
| 27 | + status = "disabled"; |
| 28 | + }; |
| 29 | + |
| 30 | + clk_lsi: clk-lsi { |
| 31 | + #clock-cells = <0>; |
| 32 | + compatible = "fixed-clock"; |
| 33 | + clock-frequency = <DT_FREQ_K(32)>; |
| 34 | + status = "disabled"; |
| 35 | + }; |
| 36 | + |
| 37 | + pll: pll { |
| 38 | + #clock-cells = <0>; |
| 39 | + compatible = "wch,ch32v20x_30x-pll-clock"; |
| 40 | + mul = <15>; |
| 41 | + status = "disabled"; |
| 42 | + }; |
| 43 | + }; |
| 44 | + |
| 45 | + soc { |
| 46 | + sram0: memory@20000000 { |
| 47 | + compatible = "mmio-sram"; |
| 48 | + }; |
| 49 | + |
| 50 | + flash: flash-controller@40022000 { |
| 51 | + compatible = "wch,ch32v20x_30x-flash-controller"; |
| 52 | + reg = <0x40022000 0x400>; |
| 53 | + #address-cells = <1>; |
| 54 | + #size-cells = <1>; |
| 55 | + |
| 56 | + flash0: flash@8000000 { |
| 57 | + compatible = "soc-nv-flash"; |
| 58 | + reg = <0x08000000 DT_SIZE_K(224)>; |
| 59 | + }; |
| 60 | + }; |
| 61 | + |
| 62 | + pwr: pwr@40007000 { |
| 63 | + compatible = "wch,pwr"; |
| 64 | + reg = <0x40007000 16>; |
| 65 | + }; |
| 66 | + |
| 67 | + pinctrl: pin-controller@40010000 { |
| 68 | + compatible = "wch,20x_30x-afio"; |
| 69 | + reg = <0x40010000 16>; |
| 70 | + #address-cells = <1>; |
| 71 | + #size-cells = <1>; |
| 72 | + |
| 73 | + gpioa: gpio@40010800 { |
| 74 | + compatible = "wch,gpio"; |
| 75 | + reg = <0x40010800 0x20>; |
| 76 | + gpio-controller; |
| 77 | + #gpio-cells = <2>; |
| 78 | + ngpios = <8>; |
| 79 | + clocks = <&rcc CH32V20X_V30X_CLOCK_IOPA>; |
| 80 | + }; |
| 81 | + |
| 82 | + gpiob: gpio@40010C00 { |
| 83 | + compatible = "wch,gpio"; |
| 84 | + reg = <0x40010C00 0x20>; |
| 85 | + gpio-controller; |
| 86 | + #gpio-cells = <2>; |
| 87 | + ngpios = <8>; |
| 88 | + clocks = <&rcc CH32V20X_V30X_CLOCK_IOPB>; |
| 89 | + }; |
| 90 | + |
| 91 | + gpioc: gpio@40011000 { |
| 92 | + compatible = "wch,gpio"; |
| 93 | + reg = <0x40011000 0x20>; |
| 94 | + gpio-controller; |
| 95 | + #gpio-cells = <2>; |
| 96 | + ngpios = <8>; |
| 97 | + clocks = <&rcc CH32V20X_V30X_CLOCK_IOPC>; |
| 98 | + }; |
| 99 | + |
| 100 | + gpiod: gpio@40011400 { |
| 101 | + compatible = "wch,gpio"; |
| 102 | + reg = <0x40011400 0x20>; |
| 103 | + gpio-controller; |
| 104 | + #gpio-cells = <2>; |
| 105 | + ngpios = <8>; |
| 106 | + clocks = <&rcc CH32V20X_V30X_CLOCK_IOPD>; |
| 107 | + }; |
| 108 | + }; |
| 109 | + |
| 110 | + usart1: uart@40013800 { |
| 111 | + compatible = "wch,usart"; |
| 112 | + reg = <0x40013800 0x20>; |
| 113 | + clocks = <&rcc CH32V20X_V30X_CLOCK_USART1>; |
| 114 | + interrupt-parent = <&pfic>; |
| 115 | + interrupts = <53>; |
| 116 | + status = "disabled"; |
| 117 | + }; |
| 118 | + |
| 119 | + usart2: uart@40004400 { |
| 120 | + compatible = "wch,usart"; |
| 121 | + reg = <0x40004400 0x20>; |
| 122 | + clocks = <&rcc CH32V20X_V30X_CLOCK_USART2>; |
| 123 | + interrupt-parent = <&pfic>; |
| 124 | + interrupts = <54>; |
| 125 | + status = "disabled"; |
| 126 | + }; |
| 127 | + |
| 128 | + rcc: rcc@40021000 { |
| 129 | + compatible = "wch,rcc"; |
| 130 | + reg = <0x40021000 16>; |
| 131 | + #clock-cells = <1>; |
| 132 | + }; |
| 133 | + }; |
| 134 | +}; |
| 135 | + |
| 136 | +&cpu0 { |
| 137 | + clock-frequency = <DT_FREQ_M(120)>; |
| 138 | +}; |
0 commit comments