Skip to contentSkip to conversation

spi: zynq_qspi: Add configuration to disable LQSPI feature

PATCH New Nathan Rossi 5 participants 9 messages Dec 8, 2015 – Dec 9, 2015

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

PATCH 1/1 spi: zynq_qspi: Add configuration to disable LQSPI feature

When the Zynq Boot ROM code loads the payload from QSPI it uses the LQSPI feature of the QSPI device, however it does not clean up its configuration before handing over to the payload which leaves the device confgured to by-pass the standard non-linear operating mode.

This ensures the Linear QSPI mode is disabled before re-enabling the device.

Cc Jagan Teki <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
Cc Simon Glass <[email protected]>
---
 drivers/spi/zynq_qspi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/zynq_qspi.c +9 -0
index 5825c6d..b98663c 100644
@@ -30,6 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ZYNQ_QSPI_IXR_TXOW_MASK		BIT(2)	/* TX_FIFO_not_full */
 #define ZYNQ_QSPI_IXR_ALL_MASK		GENMASK(6, 0)	/* All IXR bits */
 #define ZYNQ_QSPI_ENR_SPI_EN_MASK	BIT(0)	/* SPI Enable */
+#define ZYNQ_QSPI_LQSPICFG_LQMODE_MASK	BIT(31) /* Linear QSPI Mode */
 
 /* zynq qspi Transmit Data Register */
 #define ZYNQ_QSPI_TXD_00_00_OFFSET	0x1C	/* Transmit 4-byte inst */
@@ -68,6 +69,9 @@ struct zynq_qspi_regs {
 	u32 txd1r;	/* 0x80 */
 	u32 txd2r;	/* 0x84 */
 	u32 txd3r;	/* 0x88 */
+	u32 reserved1[5];
+	u32 lqspicfg;	/* 0xA0 */
+	u32 lqspists;	/* 0xA4 */
 };
 
 /* zynq qspi platform data */
@@ -143,6 +147,11 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
 		ZYNQ_QSPI_CR_MSTREN_MASK;
 	writel(confr, &regs->cr);
 
+	/* Disable the LQSPI feature */
+	confr = readl(&regs->lqspicfg);
+	confr &= ~ZYNQ_QSPI_LQSPICFG_LQMODE_MASK;
+	writel(confr, &regs->lqspicfg);
+
 	/* Enable SPI */
 	writel(ZYNQ_QSPI_ENR_SPI_EN_MASK, &regs->enr);
 }
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 spl: dm: Enable DM_SEQ_ALIAS

The Device Model sequence alias feature is required by some Uclasses.

Specifically SPI which picks the bus to use based on the sequence. Without this the SPI Uclass will not probe any bus and will fail which prevents SPL from using SPI flash as a boot location.

Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Linus Walleij <[email protected]>
---
 include/config_uncmd_spl.h | 1 -
 1 file changed, 1 deletion(-)
include/config_uncmd_spl.h +0 -1
index 6e299f6..3b198ae 100644
@@ -29,7 +29,6 @@
 #endif
 
 #undef CONFIG_DM_WARN
-#undef CONFIG_DM_SEQ_ALIAS
 #undef CONFIG_DM_STDIO
 
 #endif /* CONFIG_SPL_BUILD */
Signature · 1 line
2.6.2
#2 lore raw

PATCH 1/1 spl: dm: Enable DM_SEQ_ALIAS

Hi Nathan,

Quoted 27 lines · Nathan Rossi

The Device Model sequence alias feature is required by some Uclasses.

Specifically SPI which picks the bus to use based on the sequence. Without this the SPI Uclass will not probe any bus and will fail which prevents SPL from using SPI flash as a boot location.

Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Linus Walleij <[email protected]>
---
 include/config_uncmd_spl.h | 1 -
 1 file changed, 1 deletion(-)
include/config_uncmd_spl.h +0 -2
index 6e299f6..3b198ae 100644
@@ -29,7 +29,6 @@
 #endif
 
 #undef CONFIG_DM_WARN
-#undef CONFIG_DM_SEQ_ALIAS
 #undef CONFIG_DM_STDIO
 
 #endif /* CONFIG_SPL_BUILD */
--
Quoted 2 lines

2.6.2

We'd like to drop this file. Can you instead please add CONFIG_SPL_DM_SEQ_ALIAS as a new Kconfig. There is only one place in the code (device.c) that you need to change. I think for now it should default to n, but you could enable it for your board? I'm not sure of the size impact of enabling it by default.

Regards,
Simon

#3 lore raw

PATCH 1/1 arm: zynq: Update ZYBO config options

In reply to Nathan Rossi

Update the ZYBO device tree and enable config options that relate to the added devices in the device tree.

Cc Albert Aribaud <[email protected]>
Cc Michal Simek <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/dts/zynq-zybo.dts  | 18 ++++++++++++++++++
 configs/zynq_zybo_defconfig |  3 +++
 include/configs/zynq_zybo.h |  1 +
 3 files changed, 22 insertions(+)
arch/arm/dts/zynq-zybo.dts +18 -0
index dcfc00e..fbbb891 100644
@@ -16,6 +16,8 @@
 	aliases {
 		ethernet0 = &gem0;
 		serial0 = &uart1;
+		spi0 = &qspi;
+		mmc0 = &sdhci0;
 	};
 
 	memory {
@@ -28,6 +30,10 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	usb_phy0: phy0 {
+		compatible = "usb-nop-xceiv";
+		#phy-cells = <0>;
+	};
 };
 
 &clkc {
@@ -45,6 +51,7 @@
 };
 
 &sdhci0 {
+	u-boot,dm-pre-reloc;
 	status = "okay";
 };
 
@@ -52,3 +59,14 @@
 	u-boot,dm-pre-reloc;
 	status = "okay";
 };
+
+&qspi {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&usb0 {
+	status = "okay";
+	dr_mode = "host";
+	usb-phy = <&usb_phy0>;
+};
configs/zynq_zybo_defconfig +3 -0
index 6f0bd0b..d443e92 100644
@@ -17,3 +17,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEBUG_UART_ZYNQ=y
 CONFIG_DEBUG_UART_BASE=0xe0001000
 CONFIG_DEBUG_UART_CLOCK=50000000
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_ZYNQ_QSPI=y
include/configs/zynq_zybo.h +1 -0
index 5d1a9d5..c53ba79 100644
@@ -15,6 +15,7 @@
 
 #define CONFIG_SYS_NO_FLASH
 
+#define CONFIG_ZYNQ_USB
 #define CONFIG_ZYNQ_SDHCI0
 #define CONFIG_ZYNQ_BOOT_FREEBSD
 
Signature · 1 line
2.6.2
Applied
#4 lore raw

PATCH 1/1 arm: zynq: Update ZYBO config options

Quoted 77 lines · Nathan Rossi

Update the ZYBO device tree and enable config options that relate to the added devices in the device tree.

Cc Albert Aribaud <[email protected]>
Cc Michal Simek <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/dts/zynq-zybo.dts  | 18 ++++++++++++++++++
 configs/zynq_zybo_defconfig |  3 +++
 include/configs/zynq_zybo.h |  1 +
 3 files changed, 22 insertions(+)
arch/arm/dts/zynq-zybo.dts +18 -0
index dcfc00e..fbbb891 100644
@@ -16,6 +16,8 @@
 	aliases {
 		ethernet0 = &gem0;
 		serial0 = &uart1;
+		spi0 = &qspi;
+		mmc0 = &sdhci0;
 	};
 
 	memory {
@@ -28,6 +30,10 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	usb_phy0: phy0 {
+		compatible = "usb-nop-xceiv";
+		#phy-cells = <0>;
+	};
 };
 
 &clkc {
@@ -45,6 +51,7 @@
 };
 
 &sdhci0 {
+	u-boot,dm-pre-reloc;
 	status = "okay";
 };
 
@@ -52,3 +59,14 @@
 	u-boot,dm-pre-reloc;
 	status = "okay";
 };
+
+&qspi {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&usb0 {
+	status = "okay";
+	dr_mode = "host";
+	usb-phy = <&usb_phy0>;
+};
configs/zynq_zybo_defconfig +3 -0
index 6f0bd0b..d443e92 100644
@@ -17,3 +17,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEBUG_UART_ZYNQ=y
 CONFIG_DEBUG_UART_BASE=0xe0001000
 CONFIG_DEBUG_UART_CLOCK=50000000
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_ZYNQ_QSPI=y
include/configs/zynq_zybo.h +0 -0
index 5d1a9d5..c53ba79 100644

include/configs/zynq_zybo.h line 21

Quoted 7 lines
include/configs/zynq_zybo.h +1 -0
@@ -15,6 +15,7 @@
 
 #define CONFIG_SYS_NO_FLASH
 
+#define CONFIG_ZYNQ_USB
 #define CONFIG_ZYNQ_SDHCI0
 #define CONFIG_ZYNQ_BOOT_FREEBSD
 

Applied. There is a conflict with the patch I sent before this one but I will resolve it.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151209/10e0c324/attachment.sig>
#5 lore raw

PATCH 1/1 tools: zynqimage: Clean up check_params

In reply to Nathan Rossi

Clean up the param checking, removing some code paths that will never happen.

Cc Michal Simek <[email protected]>
Cc Tom Rini <[email protected]>
---
 tools/zynqimage.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/zynqimage.c +1 -2
index 25f558d..c43bd5d 100644
@@ -212,8 +212,7 @@ static int zynqimage_check_params(struct image_tool_params *params)
 		return -1;
 	}
 
-	return !((params->lflag || params->dflag) ||
-			(params->dflag && params->eflag));
+	return !(params->lflag || params->dflag);
 }
 
 static int zynqimage_check_image_types(uint8_t type)
Signature · 1 line
2.6.2
#6 lore raw

PATCH 1/1 tools: zynqimage: Clean up check_params

Quoted 6 lines · Nathan Rossi

Clean up the param checking, removing some code paths that will never happen.

Cc Michal Simek <[email protected]>
Cc Tom Rini <[email protected]>
Reported-by Coverity (CID 133251)
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151208/efda7159/attachment.sig>
Applied
#8 lore raw

PATCH 1/1 spi: zynq_qspi: Add configuration to disable LQSPI feature

In reply to Nathan Rossi
Quoted 41 lines · Nathan Rossi

When the Zynq Boot ROM code loads the payload from QSPI it uses the LQSPI feature of the QSPI device, however it does not clean up its configuration before handing over to the payload which leaves the device confgured to by-pass the standard non-linear operating mode.

This ensures the Linear QSPI mode is disabled before re-enabling the device.

Cc Jagan Teki <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
Cc Simon Glass <[email protected]>
---
 drivers/spi/zynq_qspi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/zynq_qspi.c +4 -0
index 5825c6d..b98663c 100644
@@ -30,6 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ZYNQ_QSPI_IXR_TXOW_MASK		BIT(2)	/* TX_FIFO_not_full */
 #define ZYNQ_QSPI_IXR_ALL_MASK		GENMASK(6, 0)	/* All IXR bits */
 #define ZYNQ_QSPI_ENR_SPI_EN_MASK	BIT(0)	/* SPI Enable */
+#define ZYNQ_QSPI_LQSPICFG_LQMODE_MASK	BIT(31) /* Linear QSPI Mode */
 
 /* zynq qspi Transmit Data Register */
 #define ZYNQ_QSPI_TXD_00_00_OFFSET	0x1C	/* Transmit 4-byte inst */
@@ -68,6 +69,9 @@ struct zynq_qspi_regs {
 	u32 txd1r;	/* 0x80 */
 	u32 txd2r;	/* 0x84 */
 	u32 txd3r;	/* 0x88 */
+	u32 reserved1[5];
+	u32 lqspicfg;	/* 0xA0 */
+	u32 lqspists;	/* 0xA4 */
 };
 
 /* zynq qspi platform data */
@@ -143,6 +147,11 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
 		ZYNQ_QSPI_CR_MSTREN_MASK;

drivers/spi/zynq_qspi.c static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv) · line 157

Quoted 10 lines
drivers/spi/zynq_qspi.c +5 -0
 	writel(confr, &regs->cr);
 
+	/* Disable the LQSPI feature */
+	confr = readl(&regs->lqspicfg);
+	confr &= ~ZYNQ_QSPI_LQSPICFG_LQMODE_MASK;
+	writel(confr, &regs->lqspicfg);
+
 	/* Enable SPI */
 	writel(ZYNQ_QSPI_ENR_SPI_EN_MASK, &regs->enr);
 }

Applied to zynq tree.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151209/fe2753ce/attachment.sig>