Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support ospi driver for Renesas RA8 devices #80799

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/renesas/ek_ra8d1/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ The below features are currently supported on Zephyr OS for EK-RA8D1 board:
+--------------+------------+-----------------------------------+
| SDHC | on-chip | sdhc |
+--------------+------------+-----------------------------------+
| OSPI | on-chip | ospi flash |
+--------------+------------+-----------------------------------+

**Note:**

Expand Down
18 changes: 18 additions & 0 deletions boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,22 @@
drive-strength = "highspeed-high";
};
};

ospi0_default: ospi0_default {
group1 {
/* sclk dqs sio0-7 */
psels = <RA_PSEL(RA_PSEL_OSPI, 8, 8)>, <RA_PSEL(RA_PSEL_OSPI, 8, 1)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 0)>, <RA_PSEL(RA_PSEL_OSPI, 8, 3)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 3)>, <RA_PSEL(RA_PSEL_OSPI, 1, 1)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 2)>, <RA_PSEL(RA_PSEL_OSPI, 8, 0)>,
<RA_PSEL(RA_PSEL_OSPI, 8, 2)>, <RA_PSEL(RA_PSEL_OSPI, 8, 4)>;
drive-strength = "highspeed-high";
};
group2 {
/* cs1 rst ecsint1 */
psels = <RA_PSEL(RA_PSEL_OSPI, 1, 4)>, <RA_PSEL(RA_PSEL_OSPI, 1, 6)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 5)>;
drive-strength = "high";
};
};
};
58 changes: 58 additions & 0 deletions boards/renesas/ek_ra8d1/ek_ra8d1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/dts-v1/;

#include <renesas/ra/ra8/r7fa8d1bhecbd.dtsi>
#include <zephyr/dt-bindings/flash_controller/xspi.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
Expand Down Expand Up @@ -111,6 +112,17 @@
};
};

&pll2 {
status = "okay";
clocks = <&xtal>;
div = <2>;
mul = <80 0>;
pll2p {
status = "okay";
freq = <DT_FREQ_M(400)>;
div = <2>;
};
};

&sciclk {
clocks = <&pllp>;
Expand All @@ -130,6 +142,12 @@
status = "okay";
};

&octaspiclk {
clocks = <&pll2p>;
div = <2>;
status = "okay";
};

&ioport0 {
status = "okay";
};
Expand Down Expand Up @@ -300,3 +318,43 @@ zephyr_mipi_dsi: &mipi_dsi {};
renesas_mipi_i2c: &iic1{};

pmod_sd_shield: &sdhc1 {};

&ospi0 {
pinctrl-0 = <&ospi0_default>;
pinctrl-names = "default";
status = "okay";
s28hl512t: s28hl512t@90000000 {
compatible = "renesas,ra-ospi-b-nor";
protocol-mode = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
ospi-max-frequency = <DT_FREQ_M(200)>;
reg = <0x90000000 DT_SIZE_M(64)>;
write-block-size = <1>;
pages_layout: pages_layout {
pages_layout_4k: pages_layout_4k {
pages-count = <32>;
pages-size = <DT_SIZE_K(4)>;
};
pages_layout_128k: pages_layout_128k {
pages-count = <1>;
pages-size = <DT_SIZE_K(128)>;
};
pages_layout_256k: pages_layout_256k {
pages-count = <255>;
pages-size = <DT_SIZE_K(256)>;
};
};
status = "okay";

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "nor";
reg = <0x00000000 DT_SIZE_M(64)>;
};
};
};
};
2 changes: 2 additions & 0 deletions boards/renesas/ek_ra8m1/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ The below features are currently supported on Zephyr OS for EK-RA8M1 board:
+-----------+------------+----------------------+
| SDHC | on-chip | sdhc |
+-----------+------------+----------------------+
| OSPI | on-chip | ospi flash |
+-----------+------------+----------------------+

**Note:**

Expand Down
18 changes: 18 additions & 0 deletions boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,22 @@
drive-strength = "highspeed-high";
};
};

ospi0_default: ospi0_default {
group1 {
/* sclk dqs sio0-7 */
psels = <RA_PSEL(RA_PSEL_OSPI, 8, 8)>, <RA_PSEL(RA_PSEL_OSPI, 8, 1)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 0)>, <RA_PSEL(RA_PSEL_OSPI, 8, 3)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 3)>, <RA_PSEL(RA_PSEL_OSPI, 1, 1)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 2)>, <RA_PSEL(RA_PSEL_OSPI, 8, 0)>,
<RA_PSEL(RA_PSEL_OSPI, 8, 2)>, <RA_PSEL(RA_PSEL_OSPI, 8, 4)>;
drive-strength = "highspeed-high";
};
group2 {
/* cs1 rst ecsint1 */
psels = <RA_PSEL(RA_PSEL_OSPI, 1, 4)>, <RA_PSEL(RA_PSEL_OSPI, 1, 6)>,
<RA_PSEL(RA_PSEL_OSPI, 1, 5)>;
drive-strength = "high";
};
};
};
58 changes: 58 additions & 0 deletions boards/renesas/ek_ra8m1/ek_ra8m1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <renesas/ra/ra8/r7fa8m1ahecbd.dtsi>
#include <dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/flash_controller/xspi.h>
#include <zephyr/dt-bindings/adc/adc.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include "ek_ra8m1-pinctrl.dtsi"
Expand Down Expand Up @@ -148,6 +149,17 @@
};
};

&pll2 {
status = "okay";
clocks = <&xtal>;
div = <2>;
mul = <80 0>;
pll2p {
status = "okay";
freq = <DT_FREQ_M(400)>;
div = <2>;
};
};

&sciclk {
clocks = <&pllp>;
Expand All @@ -161,6 +173,12 @@
status = "okay";
};

&octaspiclk {
clocks = <&pll2p>;
div = <2>;
status = "okay";
};

&ioport0 {
status = "okay";
};
Expand Down Expand Up @@ -349,3 +367,43 @@ pmod_header: &pmod1_header {};
};

pmod_sd_shield: &sdhc0 {};

&ospi0 {
pinctrl-0 = <&ospi0_default>;
pinctrl-names = "default";
status = "okay";
s28hl512t: s28hl512t@90000000 {
compatible = "renesas,ra-ospi-b-nor";
protocol-mode = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
ospi-max-frequency = <DT_FREQ_M(200)>;
reg = <0x90000000 DT_SIZE_M(64)>;
write-block-size = <1>;
pages_layout: pages_layout {
pages_layout_4k: pages_layout_4k {
pages-count = <32>;
pages-size = <DT_SIZE_K(4)>;
};
pages_layout_128k: pages_layout_128k {
pages-count = <1>;
pages-size = <DT_SIZE_K(128)>;
};
pages_layout_256k: pages_layout_256k {
pages-count = <255>;
pages-size = <DT_SIZE_K(256)>;
};
};
status = "okay";

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "nor";
reg = <0x00000000 DT_SIZE_M(64)>;
};
};
};
};
1 change: 1 addition & 0 deletions drivers/flash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,4 @@ if(CONFIG_RA_FLASH_HP)
zephyr_library_sources(flash_hp_ra.c)
zephyr_library_sources_ifdef(CONFIG_FLASH_EX_OP_ENABLED flash_hp_ra_ex_op.c)
endif()
zephyr_library_sources_ifdef(CONFIG_FLASH_OSPI_B_RENESAS_RA flash_renesas_ra_ospi_b.c)
1 change: 1 addition & 0 deletions drivers/flash/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ source "drivers/flash/Kconfig.numaker"
source "drivers/flash/Kconfig.numaker_rmc"
source "drivers/flash/Kconfig.nxp_s32"
source "drivers/flash/Kconfig.renesas_ra"
source "drivers/flash/Kconfig.renesas_ra_flash_ospi_b"
source "drivers/flash/Kconfig.rpi_pico"
source "drivers/flash/Kconfig.rv32m1"
source "drivers/flash/Kconfig.sam"
Expand Down
18 changes: 18 additions & 0 deletions drivers/flash/Kconfig.renesas_ra_flash_ospi_b
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Renesas RA Family

# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0

config FLASH_OSPI_B_RENESAS_RA
bool "Renesas RA Octal-SPI driver"
default y
depends on DT_HAS_RENESAS_RA_OSPI_B_NOR_ENABLED
select FLASH_HAS_DRIVER_ENABLED
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_EXPLICIT_ERASE
select USE_RA_FSP_OSPI_B_NOR_FLASH
select FLASH_JESD216
select FLASH_HAS_EX_OP
select PINCTRL
help
Enable Octal-SPI Nor flash driver for RA series
Loading
Loading