Skip to contentSkip to conversation

ARM: dts: at91: sama5d2: add seq for qspi1

PATCH New Eugen.Hristev at microchip.com 1 participant 5 messages Aug 26, 2019 – Sep 11, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ARM: dts: at91: sama5d2: add seq for qspi1

From: Eugen Hristev <[email protected]>

qspi1 does not have an alias/seq number. This is required for SPL default SF bus booting for the boards that have this SoC

---
 arch/arm/dts/sama5d2.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/sama5d2.dtsi +1 -0
index 830251a..5adc47b 100644
@@ -7,6 +7,7 @@
 	aliases {
 		spi0 = &spi0;
 		spi1 = &qspi0;
+		spi2 = &qspi1;
 		i2c0 = &i2c0;
 		i2c1 = &i2c1;
 	};
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 ARM: dts: at91: sama5d27_wlsom1_ek: add support for qspi

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

Add node for qspi1 memory connected on the wlsom

---
 arch/arm/dts/at91-sama5d27_wlsom1_ek-u-boot.dtsi | 12 ++++++++++++
 arch/arm/dts/at91-sama5d27_wlsom1_ek.dts         |  4 ++++
 arch/arm/dts/sama5d27_wlsom1.dtsi                | 22 ++++++++++++++++++++++
 3 files changed, 38 insertions(+)
arch/arm/dts/at91-sama5d27_wlsom1_ek-u-boot.dtsi +12 -0
index 48ab217..dae1fba 100644
@@ -13,6 +13,14 @@
 	};
 };
 
+&qspi1 {
+	u-boot,dm-pre-reloc;
+};
+
+&qspi1_flash {
+	u-boot,dm-pre-reloc;
+};
+
 &sdmmc0 {
 	u-boot,dm-pre-reloc;
 };
@@ -36,3 +44,7 @@
 &pinctrl_uart0_default {
 	u-boot,dm-pre-reloc;
 };
+
+&pinctrl_qspi1_default {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/at91-sama5d27_wlsom1_ek.dts +4 -0
index 21986ec..32d3404 100644
@@ -38,6 +38,10 @@
 		};
 
 		apb {
+			qspi1: spi at f0024000 {
+				status = "okay";
+			};
+
 			macb0: ethernet at f8008000 {
 				status = "okay";
 			};
arch/arm/dts/sama5d27_wlsom1.dtsi +22 -0
index 3d27570..889a003 100644
@@ -18,6 +18,19 @@
 
 	ahb {
 		apb {
+			qspi1: spi at f0024000 {
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_qspi1_default>;
+
+				qspi1_flash: spi_flash at 0 {
+					compatible = "jedec,spi-nor";
+					reg = <0>;
+					spi-max-frequency = <50000000>;
+					spi-rx-bus-width = <4>;
+					spi-tx-bus-width = <4>;
+				};
+			};
+
 			macb0: ethernet at f8008000 {
 				pinctrl-names = "default";
 				pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
@@ -49,6 +62,15 @@
 						bias-disable;
 					};
 
+					pinctrl_qspi1_default: qspi1_default {
+						pinmux = <PIN_PB5__QSPI1_SCK>,
+							 <PIN_PB6__QSPI1_CS>,
+							 <PIN_PB7__QSPI1_IO0>,
+							 <PIN_PB8__QSPI1_IO1>,
+							 <PIN_PB9__QSPI1_IO2>,
+							 <PIN_PB10__QSPI1_IO3>;
+						bias-pull-up;
+					};
 				};
 			};
 		};
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 board: atmel: sama5d2_wlsom1_ek: add qspi support and qspi boot config

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

Add support for qspi memory on board. Created boot support for QSPI for both u-boot proper and SPL.

---
 board/atmel/sama5d27_wlsom1_ek/MAINTAINERS         |   1 +
 .../atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c  |  17 +++
 configs/sama5d27_wlsom1_ek_qspiflash_defconfig     | 115 +++++++++++++++++++++
 include/configs/sama5d27_wlsom1_ek.h               |   4 +
 4 files changed, 137 insertions(+)
 create mode 100644 configs/sama5d27_wlsom1_ek_qspiflash_defconfig
board/atmel/sama5d27_wlsom1_ek/MAINTAINERS +1 -0
index 59671ac..ff68cf0 100644
@@ -5,3 +5,4 @@ S:	Maintained
 F:	board/atmel/sama5d27_wlsom1_ek/
 F:	include/configs/sama5d27_wlsom1_ek.h
 F:	configs/sama5d27_wlsom1_ek_mmc_defconfig
+F:	configs/sama5d27_wlsom1_ek_qspiflash_defconfig
board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c +17 -0
index 3663ae4..1930048 100644
@@ -97,11 +97,28 @@ void spl_mmc_init(void)
 }
 #endif
 
+#ifdef CONFIG_QSPI_BOOT
+void spl_qspi_init(void)
+{
+	atmel_pio4_set_d_periph(AT91_PIO_PORTB, 5, 0);	/* SCK */
+	atmel_pio4_set_d_periph(AT91_PIO_PORTB, 6, 0);	/* CS */
+	atmel_pio4_set_d_periph(AT91_PIO_PORTB, 7, 0);	/* IO0 */
+	atmel_pio4_set_d_periph(AT91_PIO_PORTB, 8, 0);	/* IO1 */
+	atmel_pio4_set_d_periph(AT91_PIO_PORTB, 9, 0);	/* IO2 */
+	atmel_pio4_set_d_periph(AT91_PIO_PORTB, 10, 0);	/* IO3 */
+
+	at91_periph_clk_enable(ATMEL_ID_QSPI1);
+}
+#endif
+
 void spl_board_init(void)
 {
 #ifdef CONFIG_SD_BOOT
 	spl_mmc_init();
 #endif
+#ifdef CONFIG_QSPI_BOOT
+	spl_qspi_init();
+#endif
 }
 
 void spl_display_print(void)
configs/sama5d27_wlsom1_ek_qspiflash_defconfig new file +115 -0

115 lines not on this page · raw message

include/configs/sama5d27_wlsom1_ek.h +4 -0
index 6bcbc06..250eb73 100644
@@ -43,4 +43,8 @@
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
 #endif
 
+#ifdef CONFIG_QSPI_BOOT
+#define CONFIG_SYS_SPI_U_BOOT_OFFS	0x40000
+#endif
+
 #endif
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 board: atmel: sama5d27_wlsom1_ek: start green led in SPL

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

When SPL boots, enable green led on the board.

---
 board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c | 8 ++++++++
 1 file changed, 8 insertions(+)
board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c +8 -0
index 1930048..fda06c8 100644
@@ -82,6 +82,13 @@ int dram_init(void)
 /* SPL */
 #ifdef CONFIG_SPL_BUILD
 
+static void board_leds_init(void)
+{
+	atmel_pio4_set_pio_output(AT91_PIO_PORTA, 6, 0); /* RED */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTA, 7, 1); /* GREEN */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTA, 8, 0); /* BLUE */
+}
+
 #ifdef CONFIG_SD_BOOT
 void spl_mmc_init(void)
 {
@@ -113,6 +120,7 @@ void spl_qspi_init(void)
 
 void spl_board_init(void)
 {
+	board_leds_init();
 #ifdef CONFIG_SD_BOOT
 	spl_mmc_init();
 #endif
Signature · 1 line
2.7.4