1/*
2 * Copyright (c) 2024 Ian Morris
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <renesas/ra/r7fa4m1ab3cfm.dtsi>
9#include <zephyr/dt-bindings/gpio/gpio.h>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11#include <zephyr/dt-bindings/pinctrl/renesas/pinctrl-ra.h>
12
13/ {
14	model = "Mikroe Clicker RA4M1";
15	compatible = "renesas,r7fa4m1ab3cfm";
16
17	chosen {
18		zephyr,console = &uart0;
19		zephyr,shell-uart = &uart0;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		ld1: led_1 {
27			gpios = <&ioport4 9 GPIO_ACTIVE_HIGH>;
28			label = "User LED 1";
29		};
30		ld2: led_2 {
31			gpios = <&ioport4 8 GPIO_ACTIVE_HIGH>;
32			label = "User LED 2";
33		};
34	};
35
36	buttons {
37		compatible = "gpio-keys";
38		btn1: button_1 {
39			gpios = <&ioport3 4 GPIO_ACTIVE_LOW>;
40			label = "User Button 1";
41			zephyr,code = <INPUT_KEY_0>;
42		};
43	};
44
45	mikrobus_header: mikrobus-connector {
46		compatible = "mikro-bus";
47		#gpio-cells = <2>;
48		gpio-map-mask = <0xffffffff 0xffffffc0>;
49		gpio-map-pass-thru = <0 0x3f>;
50		gpio-map =	<0 0 &ioport0 0 0>,	/* AN  */
51				<1 0 &ioport4 7 0>,		/* RST */
52				<2 0 &ioport1 3 0>,		/* CS   */
53				<3 0 &ioport1 2 0>,		/* SCK  */
54				<4 0 &ioport1 0 0>,		/* MISO */
55				<5 0 &ioport1 1 0>,		/* MOSI */
56							/* +3.3V */
57							/* GND */
58				<6 0 &ioport1 7 0>,		/* PWM  */
59				<7 0 &ioport3 2 0>,		/* INT  */
60				<8 0 &ioport4 10 0>,	/* RX   */
61				<9 0 &ioport4 11 0>,	/* TX   */
62				<10 0 &ioport2 5 0>,	/* SCL  */
63				<11 0 &ioport2 6 0>;	/* SDA  */
64							/* +5V */
65							/* GND */
66	};
67
68	aliases {
69		led0 = &ld1;
70		led1 = &ld2;
71		sw0 = &btn1;
72	};
73};
74
75&pinctrl {
76	sci0_default: sci0_default {
77		group1 {
78			/* tx */
79			psels = <RA_PSEL(RA_PSEL_SCI_0, 4, 11)>;
80		};
81		group2 {
82			/* rx */
83			psels = <RA_PSEL(RA_PSEL_SCI_0, 4, 10)>;
84		};
85	};
86};
87
88&sci0 {
89	status = "okay";
90	pinctrl-0 = <&sci0_default>;
91	pinctrl-names = "default";
92	uart0: uart {
93		current-speed = <115200>;
94		status = "okay";
95	};
96};
97
98&ioport0 {
99	status = "okay";
100};
101
102&ioport1 {
103	status = "okay";
104};
105
106&ioport2 {
107	status = "okay";
108};
109
110&ioport3 {
111	status = "okay";
112};
113
114&ioport4 {
115	status = "okay";
116};
117
118&fcu {
119	status = "okay";
120};
121
122&xtal {
123	status = "okay";
124	clock-frequency = <12000000>;
125};
126
127&pclkblock {
128	clocks = <&xtal>;
129};
130
131&iclk {
132	div = <1>;
133};
134
135&pclka {
136	div = <1>;
137};
138
139&pclkb {
140	div = <2>;
141};
142
143&pclkc {
144	div = <1>;
145};
146
147&pclkd {
148	div = <1>;
149};
150
151&fclk {
152	div = <2>;
153};
154