1/*
2 * Copyright (c) 2024 Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6/dts-v1/;
7#include <st/g4/stm32g431X8.dtsi>
8#include <st/g4/stm32g431c(6-8-b)tx-pinctrl.dtsi>
9
10/ {
11	model = "Makerbase MKS CANable V2.0";
12	compatible = "makerbase,mks-canable-v20";
13
14	chosen {
15		zephyr,sram = &sram0;
16		zephyr,flash = &flash0;
17		zephyr,canbus = &fdcan1;
18	};
19
20	aliases {
21		led0 = &blue_led;
22		led1 = &green_led;
23	};
24
25	leds: leds {
26		compatible = "gpio-leds";
27		blue_led: led_2 {
28			gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
29			label = "blue-status D2";
30		};
31		green_led: led_3 {
32			gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
33			label = "green-word D3";
34		};
35	};
36};
37
38&clk_hsi {
39	/* Internal 16 MHz clock used to drive PLL */
40	status = "okay";
41};
42
43&clk_hsi48 {
44	/* Internal 48 MHz clock used to drive USB */
45	status = "okay";
46};
47
48/* Adjust the pll for a SYSTEM Clock of 160 MHz  */
49&pll {
50	div-m = <4>;
51	mul-n = <80>;
52	div-p = <2>;
53	div-q = <4>;
54	div-r = <2>;
55	clocks = <&clk_hsi>;
56	status = "okay";
57};
58
59&rcc {
60	clocks = <&pll>;
61	clock-frequency = <DT_FREQ_M(160)>;
62	ahb-prescaler = <1>;
63	apb1-prescaler = <1>;
64	apb2-prescaler = <1>;
65};
66
67stm32_lp_tick_source: &lptim1 {
68	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
69		 <&rcc STM32_SRC_LSE LPTIM1_SEL(3)>;
70	status = "okay";
71};
72
73zephyr_udc0: &usb {
74	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
75	pinctrl-names = "default";
76	clocks = <&rcc STM32_CLOCK(APB1, 23U)>,
77		 <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>;
78	status = "okay";
79};
80
81&fdcan1 {
82	pinctrl-0 = <&fdcan1_rx_pb8 &fdcan1_tx_pb9>;
83	pinctrl-names = "default";
84	clocks = <&rcc STM32_CLOCK(APB1, 25U)>,
85		 <&rcc STM32_SRC_PLL_Q FDCAN_SEL(1)>;
86	status = "okay";
87};
88