Skip to content

Commit 27c8320

Browse files
thenguyenyfjhedberg
authored andcommitted
boards: renesas: enable support for SDRAM on ek_ra8d1 board
Add support for SDRAM on Renesas RA EK-RA8D1 Signed-off-by: The Nguyen <[email protected]>
1 parent 3245faa commit 27c8320

File tree

4 files changed

+149
-0
lines changed

4 files changed

+149
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(.)
5+
6+
zephyr_linker_sources_ifdef(CONFIG_MEMC
7+
SECTIONS sdram.ld)

boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,97 @@
8585
renesas,analog-enable;
8686
};
8787
};
88+
89+
sdram_default: sdram_default{
90+
group1 {
91+
/* SDRAM_DQM1 */
92+
psels = <RA_PSEL(RA_PSEL_BUS, 1, 12)>,
93+
/* SDRAM_CKE */
94+
<RA_PSEL(RA_PSEL_BUS, 1, 13)>,
95+
/* SDRAM_WE */
96+
<RA_PSEL(RA_PSEL_BUS, 1, 14)>,
97+
/* SDRAM_CS */
98+
<RA_PSEL(RA_PSEL_BUS, 1, 15)>,
99+
/* SDRAM_A0 */
100+
<RA_PSEL(RA_PSEL_BUS, 3, 0)>,
101+
/* SDRAM_A1 */
102+
<RA_PSEL(RA_PSEL_BUS, 3, 1)>,
103+
/* SDRAM_A2 */
104+
<RA_PSEL(RA_PSEL_BUS, 3, 2)>,
105+
/* SDRAM_A3 */
106+
<RA_PSEL(RA_PSEL_BUS, 3, 3)>,
107+
/* SDRAM_A4 */
108+
<RA_PSEL(RA_PSEL_BUS, 3, 4)>,
109+
/* SDRAM_A5 */
110+
<RA_PSEL(RA_PSEL_BUS, 3, 5)>,
111+
/* SDRAM_A6 */
112+
<RA_PSEL(RA_PSEL_BUS, 3, 6)>,
113+
/* SDRAM_A7 */
114+
<RA_PSEL(RA_PSEL_BUS, 3, 7)>,
115+
/* SDRAM_A8 */
116+
<RA_PSEL(RA_PSEL_BUS, 3, 8)>,
117+
/* SDRAM_A9 */
118+
<RA_PSEL(RA_PSEL_BUS, 3, 9)>,
119+
/* SDRAM_A10 */
120+
<RA_PSEL(RA_PSEL_BUS, 3, 10)>,
121+
/* SDRAM_A11 */
122+
<RA_PSEL(RA_PSEL_BUS, 3, 11)>,
123+
/* SDRAM_A12 */
124+
<RA_PSEL(RA_PSEL_BUS, 3, 12)>,
125+
/* SDRAM_D0 */
126+
<RA_PSEL(RA_PSEL_BUS, 6, 1)>,
127+
/* SDRAM_D1 */
128+
<RA_PSEL(RA_PSEL_BUS, 6, 2)>,
129+
/* SDRAM_D2 */
130+
<RA_PSEL(RA_PSEL_BUS, 6, 3)>,
131+
/* SDRAM_D3 */
132+
<RA_PSEL(RA_PSEL_BUS, 6, 4)>,
133+
/* SDRAM_D4 */
134+
<RA_PSEL(RA_PSEL_BUS, 6, 5)>,
135+
/* SDRAM_D5 */
136+
<RA_PSEL(RA_PSEL_BUS, 6, 6)>,
137+
/* SDRAM_D6 */
138+
<RA_PSEL(RA_PSEL_BUS, 6, 7)>,
139+
/* SDRAM_D8 */
140+
<RA_PSEL(RA_PSEL_BUS, 6, 9)>,
141+
/* SDRAM_D9 */
142+
<RA_PSEL(RA_PSEL_BUS, 6, 10)>,
143+
/* SDRAM_D10 */
144+
<RA_PSEL(RA_PSEL_BUS, 6, 11)>,
145+
/* SDRAM_D11 */
146+
<RA_PSEL(RA_PSEL_BUS, 6, 12)>,
147+
/* SDRAM_D12 */
148+
<RA_PSEL(RA_PSEL_BUS, 6, 13)>,
149+
/* SDRAM_D13 */
150+
<RA_PSEL(RA_PSEL_BUS, 6, 14)>,
151+
/* SDRAM_D14 */
152+
<RA_PSEL(RA_PSEL_BUS, 6, 15)>,
153+
/* SDRAM_BA0 */
154+
<RA_PSEL(RA_PSEL_BUS, 9, 5)>,
155+
/* SDRAM_BA1 */
156+
<RA_PSEL(RA_PSEL_BUS, 9, 6)>,
157+
/* SDRAM_RAS */
158+
<RA_PSEL(RA_PSEL_BUS, 9, 8)>,
159+
/* SDRAM_CAS */
160+
<RA_PSEL(RA_PSEL_BUS, 9, 9)>,
161+
/* SDRAM_SDCLK */
162+
<RA_PSEL(RA_PSEL_BUS, 10, 9)>;
163+
drive-strength = "high";
164+
};
165+
166+
group2 {
167+
/* SDRAM_SDCLK */
168+
psels = <RA_PSEL(RA_PSEL_BUS, 10, 9)>;
169+
drive-strength = "highspeed-high";
170+
};
171+
172+
group3 {
173+
/* SDRAM_D7 */
174+
psels = <RA_PSEL(RA_PSEL_BUS, 10, 0)>,
175+
/* SDRAM_D15 */
176+
<RA_PSEL(RA_PSEL_BUS, 10, 8)>,
177+
/* SDRAM_DQM0 */
178+
<RA_PSEL(RA_PSEL_BUS, 10, 10)>;
179+
};
180+
};
88181
};

boards/renesas/ek_ra8d1/ek_ra8d1.dts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <renesas/ra/ra8/r7fa8d1bhecbd.dtsi>
99
#include <dt-bindings/gpio/gpio.h>
1010
#include <dt-bindings/input/input-event-codes.h>
11+
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
12+
#include <zephyr/dt-bindings/memory-controller/renesas,ra-sdram.h>
1113
#include <zephyr/dt-bindings/adc/adc.h>
1214
#include "ek_ra8d1-pinctrl.dtsi"
1315

@@ -55,6 +57,14 @@
5557
};
5658
};
5759

60+
sdram1: sdram@68000000 {
61+
compatible = "zephyr,memory-region", "mmio-sram";
62+
device_type = "memory";
63+
reg = <0x68000000 DT_SIZE_M(64)>; /* 512 Mbits */
64+
zephyr,memory-region = "SDRAM";
65+
status = "okay";
66+
};
67+
5868
aliases {
5969
led0 = &led1;
6070
sw0 = &button0;
@@ -229,3 +239,26 @@
229239
interrupts = <89 12>;
230240
status = "okay";
231241
};
242+
243+
&sdram {
244+
pinctrl-0 = <&sdram_default>;
245+
pinctrl-names = "default";
246+
status = "okay";
247+
auto-refresh-interval = <SDRAM_AUTO_REFREDSH_INTERVEL_10CYCLES>;
248+
auto-refresh-count = <SDRAM_AUTO_REFREDSH_COUNT_8TIMES>;
249+
precharge-cycle-count = <SDRAM_AUTO_PRECHARGE_CYCLE_3CYCLES>;
250+
multiplex-addr-shift = "10-bit";
251+
edian-mode = "little-endian";
252+
continuous-access;
253+
bus-width = "16-bit";
254+
bank@0 {
255+
reg = <0>;
256+
renesas,ra-sdram-timing = <SDRAM_TRAS_6CYCLES
257+
SDRAM_TRCD_3CYCLES
258+
SDRAM_TRP_3CYCLES
259+
SDRAM_TWR_2CYCLES
260+
SDRAM_TCL_3CYCLES
261+
937
262+
SDRAM_TREFW_8CYCLES>;
263+
};
264+
};

boards/renesas/ek_ra8d1/sdram.ld

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram1), okay)
8+
9+
SECTION_DATA_PROLOGUE(.sdram,(NOLOAD),)
10+
{
11+
__SDRAM_Start = .;
12+
KEEP(*(.sdram*))
13+
__SDRAM_End = .;
14+
} GROUP_LINK_IN(SDRAM)
15+
16+
#endif

0 commit comments

Comments
 (0)