Skip to content

Commit 30b22c1

Browse files
committed
Add Zephyr support for SPI Flash
1 parent d4d0c5d commit 30b22c1

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

zephyr/boards/riscv/swervolf_nexys/Kconfig.defconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ if BOARD_SWERVOLF_NEXYS
33
config BOARD
44
default "swervolf_nexys"
55

6+
if FLASH
7+
8+
config SPI_NOR
9+
def_bool y
10+
11+
endif
12+
613
endif

zephyr/boards/riscv/swervolf_nexys/swervolf_nexys.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@
2929
clock-frequency = <50000000>;
3030
};
3131

32+
&spi0 {
33+
status = "okay";
34+
35+
flash0: flash@0 {
36+
compatible = "jedec,spi-nor";
37+
label = "FLASH0";
38+
jedec-id = [01 20 18];
39+
size = <0x1000000>;
40+
reg = <0>;
41+
spi-max-frequency = <2000000>;
42+
};
43+
};

zephyr/dts/riscv/riscv32-swerv.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,15 @@
4545
interrupts = <12 15>;
4646
status = "disabled";
4747
};
48+
49+
spi0: spi@80001040 {
50+
compatible = "opencores,spi-simple";
51+
reg = <0x80001040 0x40>;
52+
reg-names = "control";
53+
label = "SPI0";
54+
status = "disabled";
55+
#address-cells = <1>;
56+
#size-cells = <0>;
57+
};
4858
};
4959
};

zephyr/soc/riscv/swervolf/Kconfig.defconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ config GPIO_MMIO32
3838

3939
endif # GPIO
4040

41+
if SPI
42+
43+
config SPI_OC_SIMPLE
44+
def_bool y
45+
46+
config SPI_OC_SIMPLE_BUS_WIDTH
47+
def_int 64
48+
49+
endif # SPI
50+
4151
config XIP
4252
def_bool n
4353

0 commit comments

Comments
 (0)