Skip to contentSkip to conversation

imx: imx7d-sdb: Add DM QSPI support

PATCH New Ye Li 2 participants 4 messages Jun 27, 2018

Subsystems (2)
lore
Share & tools
lore

Ye Li

author
#0 lore raw

PATCH 1/1 imx: imx7d-sdb: Add DM QSPI support

On iMX7D SabreSD board, the QSPI has pins conflict with EPDC (default). To use QSPI, users have to rework the board (de-populate R388-R391, R396-R399 populate R392-R395, R299, R300). So we add new DTS file and new defconfig dedicated for QSPI.

Other changes to support the DM QSPI:
- Add QSPI node and alias spi0.
- Modify spi4 (spi-gpio) node and add alias spi5 for it to avoid req conflict
- Add EPDC node in imx7d.dtsi and disable it in imx7d-sdb-qspi.dts, to present the conflict.
- Remove iomux settings of qspi in board codes which is not needed for DM driver.

---
 arch/arm/dts/Makefile                     |  3 +-
 arch/arm/dts/imx7d-sdb-qspi.dts           | 44 ++++++++++++++++
 arch/arm/dts/imx7d-sdb.dts                |  6 ++-
 arch/arm/dts/imx7d.dtsi                   | 12 +++++
 arch/arm/dts/imx7s.dtsi                   | 22 ++++++--
 board/freescale/mx7dsabresd/mx7dsabresd.c | 16 ------
 configs/mx7dsabresd_qspi_defconfig        | 83 +++++++++++++++++++++++++++++++
 include/configs/mx7dsabresd.h             |  4 +-
 8 files changed, 165 insertions(+), 25 deletions(-)
 create mode 100644 arch/arm/dts/imx7d-sdb-qspi.dts
 create mode 100644 configs/mx7dsabresd_qspi_defconfig
arch/arm/dts/Makefile +2 -1
index 493652e..dfabec0 100644
@@ -433,7 +433,8 @@ dtb-$(CONFIG_MX6UL) += \
 dtb-$(CONFIG_MX6ULL) += imx6ull-14x14-evk.dtb
 
 dtb-$(CONFIG_MX7) += imx7-colibri.dtb \
-	imx7d-sdb.dtb
+	imx7d-sdb.dtb \
+	imx7d-sdb-qspi.dtb
 
 dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
 
arch/arm/dts/imx7d-sdb-qspi.dts new file +44 -0

44 lines not on this page · raw message

arch/arm/dts/imx7d-sdb.dts +5 -1
index bafcc79..76aa69a 100644
@@ -11,11 +11,15 @@
 	model = "Freescale i.MX7 SabreSD Board";
 	compatible = "fsl,imx7d-sdb", "fsl,imx7d";
 
+	aliases {
+		spi5 = &soft_spi;
+	};
+
 	memory {
 		reg = <0x80000000 0x80000000>;
 	};
 
-	spi4 {
+	soft_spi: soft-spi {
 		compatible = "spi-gpio";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_spi1>;
arch/arm/dts/imx7d.dtsi +12 -0
index f6dee41..30b0589 100644
@@ -86,6 +86,18 @@
 	};
 };
 
+&aips2 {
+	epdc: epdc at 306f0000 {
+		compatible = "fsl,imx7d-epdc";
+		interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+		reg = <0x306f0000 0x10000>;
+		clocks = <&clks IMX7D_CLK_DUMMY>, <&clks IMX7D_EPDC_PIXEL_ROOT_CLK>;
+		clock-names = "epdc_axi", "epdc_pix";
+		epdc-ram = <&gpr 0x4 30>;
+		status = "disabled";
+	};
+};
+
 &aips3 {
 	usbotg2: usb at 30b20000 {
 		compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
arch/arm/dts/imx7s.dtsi +18 -4
index a7d48e7..540de6c 100644
@@ -81,10 +81,11 @@
 		serial4 = &uart5;
 		serial5 = &uart6;
 		serial6 = &uart7;
-		spi0 = &ecspi1;
-		spi1 = &ecspi2;
-		spi2 = &ecspi3;
-		spi3 = &ecspi4;
+		spi0 = &qspi1;
+		spi1 = &ecspi1;
+		spi2 = &ecspi2;
+		spi3 = &ecspi3;
+		spi4 = &ecspi4;
 	};
 
 	cpus {
@@ -966,6 +967,19 @@
 				status = "disabled";
 			};
 
+			qspi1: qspi at 30bb0000 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,imx7d-qspi";
+				reg = <0x30bb0000 0x10000>, <0x60000000 0x10000000>;
+				reg-names = "QuadSPI", "QuadSPI-memory";
+				interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks IMX7D_QSPI_ROOT_CLK>,
+					<&clks IMX7D_QSPI_ROOT_CLK>;
+				clock-names = "qspi_en", "qspi";
+				status = "disabled";
+			};
+
 			sdma: sdma at 30bd0000 {
 				compatible = "fsl,imx7d-sdma", "fsl,imx35-sdma";
 				reg = <0x30bd0000 0x10000>;
board/freescale/mx7dsabresd/mx7dsabresd.c +0 -16
index 90e2d1a..191b59a 100644
@@ -36,9 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define LCD_PAD_CTRL    (PAD_CTL_HYS | PAD_CTL_PUS_PU100KOHM | \
 	PAD_CTL_DSE_3P3V_49OHM)
 
-#define QSPI_PAD_CTRL	\
-	(PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUE | PAD_CTL_PUS_PU47KOHM)
-
 #define NAND_PAD_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_SRE_SLOW | PAD_CTL_HYS)
 
 #define SPI_PAD_CTRL \
@@ -278,21 +275,8 @@ int board_phy_config(struct phy_device *phydev)
 #endif
 
 #ifdef CONFIG_FSL_QSPI
-static iomux_v3_cfg_t const quadspi_pads[] = {
-	MX7D_PAD_EPDC_DATA00__QSPI_A_DATA0 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
-	MX7D_PAD_EPDC_DATA01__QSPI_A_DATA1 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
-	MX7D_PAD_EPDC_DATA02__QSPI_A_DATA2 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
-	MX7D_PAD_EPDC_DATA03__QSPI_A_DATA3 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
-	MX7D_PAD_EPDC_DATA05__QSPI_A_SCLK  | MUX_PAD_CTRL(QSPI_PAD_CTRL),
-	MX7D_PAD_EPDC_DATA06__QSPI_A_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL),
-};
-
 int board_qspi_init(void)
 {
-	/* Set the iomux */
-	imx_iomux_v3_setup_multiple_pads(quadspi_pads,
-					 ARRAY_SIZE(quadspi_pads));
-
 	/* Set the clock */
 	set_clk_qspi();
 
configs/mx7dsabresd_qspi_defconfig new file +83 -0

83 lines not on this page · raw message

include/configs/mx7dsabresd.h +1 -3
index 87d2b52..3cd32ea 100644
@@ -227,9 +227,7 @@
 #endif
 
 #ifdef CONFIG_FSL_QSPI
-#define CONFIG_SPI_FLASH
-#define CONFIG_SPI_FLASH_MACRONIX
-#define CONFIG_SPI_FLASH_BAR
+#define CONFIG_SYS_FSL_QSPI_AHB
 #define CONFIG_SF_DEFAULT_BUS		0
 #define CONFIG_SF_DEFAULT_CS		0
 #define CONFIG_SF_DEFAULT_SPEED		40000000
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 imx: imx7d-sdb: Add DM QSPI support

Quoted 21 lines · Ye Li

On iMX7D SabreSD board, the QSPI has pins conflict with EPDC (default). To use QSPI, users have to rework the board (de-populate R388-R391, R396-R399 populate R392-R395, R299, R300). So we add new DTS file and new defconfig dedicated for QSPI.

Other changes to support the DM QSPI:
- Add QSPI node and alias spi0.
- Modify spi4 (spi-gpio) node and add alias spi5 for it to avoid req conflict
- Add EPDC node in imx7d.dtsi and disable it in imx7d-sdb-qspi.dts, to present the conflict.
- Remove iomux settings of qspi in board codes which is not needed for DM driver.

---
 arch/arm/dts/Makefile                     |  3 +-
 arch/arm/dts/imx7d-sdb-qspi.dts           | 44 ++++++++++++++++
 arch/arm/dts/imx7d-sdb.dts                |  6 ++-
 arch/arm/dts/imx7d.dtsi                   | 12 +++++
 arch/arm/dts/imx7s.dtsi                   | 22 ++++++--

[snip]

Quoted 19 lines
configs/mx7dsabresd_qspi_defconfig new file +19 -0
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y

configs/mx7dsabresd_qspi_defconfig line 50

Quoted 10 lines
configs/mx7dsabresd_qspi_defconfig new file +10 -0
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_74X164=y
+CONFIG_DM_I2C=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_FSL_ESDHC=y

fyi, this will soon remove if no further update on dm- conversion [1]

Quoted 1 line

+CONFIG_FSL_QSPI=y

Better to do full dm conversion before using, otherwise we have migration expire rule [2]

[1] https://patchwork.ozlabs.org/patch/911785/
[2] doc/driver-model/MIGRATION.txt

author
#2 lore raw

PATCH 1/1 imx: imx7d-sdb: Add DM QSPI support

Quoted 48 lines · Jagan Teki
Quoted 21 lines · Ye Li

On iMX7D SabreSD board, the QSPI has pins conflict with EPDC (default). To use QSPI, users have to rework the board (de-populate R388-R391, R396-R399 populate R392-R395, R299, R300). So we add new DTS file and new defconfig dedicated for QSPI.

Other changes to support the DM QSPI:
- Add QSPI node and alias spi0.
- Modify spi4 (spi-gpio) node and add alias spi5 for it to avoid req conflict
- Add EPDC node in imx7d.dtsi and disable it in imx7d-sdb-qspi.dts, to present the conflict.
- Remove iomux settings of qspi in board codes which is not needed for DM driver.

---
 arch/arm/dts/Makefile                     |  3 +-
 arch/arm/dts/imx7d-sdb-qspi.dts           | 44 ++++++++++++++++
 arch/arm/dts/imx7d-sdb.dts                |  6 ++-
 arch/arm/dts/imx7d.dtsi                   | 12 +++++
 arch/arm/dts/imx7s.dtsi                   | 22 ++++++--

[snip]

Quoted 23 lines
configs/mx7dsabresd_qspi_defconfig new file +23 -0
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_74X164=y
Quoted 8 lines

configs/mx7dsabresd_qspi_defconfig line 50

Quoted 6 lines
configs/mx7dsabresd_qspi_defconfig new file +6 -0
+CONFIG_DM_I2C=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_FSL_ESDHC=y

fyi, this will soon remove if no further update on dm- conversion [1]

It is CONFIG_FSL_ESPI in [1] not the CONFIG_FSL_ESDHC used here. Will the CONFIG_FSL_ESDHC be removed as well?

Quoted 5 lines
Quoted 2 lines

+CONFIG_FSL_QSPI=y

Better to do full dm conversion before using, otherwise we have migration expire rule [2]

Ashish will do the full dm conversion for FSL_QSPI driver. Before that, we need to migrate all boards codes to use DM SPI driver to avoid break build.

Best regards,
Ye Li

Quoted 4 lines

[1] https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F911785%2F&data=02%7C01%7Cye.li%40nxp.com%7C6ccd2b315cfc47a1308108d5dc195de0%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636656923865087981&sdata=8PyH66o2XHpa2vJ04FTv9keoT55uBM%2Bn2YUQwCmvBJ8%3D&reserved=0
[2] doc/driver-model/MIGRATION.txt

#3 lore raw

PATCH 1/1 imx: imx7d-sdb: Add DM QSPI support

Quoted 58 lines · Ye Li
Quoted 48 lines · Jagan Teki
Quoted 21 lines · Ye Li

On iMX7D SabreSD board, the QSPI has pins conflict with EPDC (default). To use QSPI, users have to rework the board (de-populate R388-R391, R396-R399 populate R392-R395, R299, R300). So we add new DTS file and new defconfig dedicated for QSPI.

Other changes to support the DM QSPI:
- Add QSPI node and alias spi0.
- Modify spi4 (spi-gpio) node and add alias spi5 for it to avoid req conflict
- Add EPDC node in imx7d.dtsi and disable it in imx7d-sdb-qspi.dts, to present the conflict.
- Remove iomux settings of qspi in board codes which is not needed for DM driver.

---
 arch/arm/dts/Makefile                     |  3 +-
 arch/arm/dts/imx7d-sdb-qspi.dts           | 44 ++++++++++++++++
 arch/arm/dts/imx7d-sdb.dts                |  6 ++-
 arch/arm/dts/imx7d.dtsi                   | 12 +++++
 arch/arm/dts/imx7s.dtsi                   | 22 ++++++--

[snip]

Quoted 23 lines
configs/mx7dsabresd_qspi_defconfig new file +23 -0
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_74X164=y
Quoted 8 lines

configs/mx7dsabresd_qspi_defconfig line 50

Quoted 6 lines
configs/mx7dsabresd_qspi_defconfig new file +6 -0
+CONFIG_DM_I2C=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_FSL_ESDHC=y

fyi, this will soon remove if no further update on dm- conversion [1]

Quoted 1 line

It is CONFIG_FSL_ESPI in [1] not the CONFIG_FSL_ESDHC used here. Will the CONFIG_FSL_ESDHC be removed as well?

OK, yes if not converted before v2018.09

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

+CONFIG_FSL_QSPI=y

Better to do full dm conversion before using, otherwise we have migration expire rule [2]

Ashish will do the full dm conversion for FSL_QSPI driver. Before that, we need to migrate all boards codes to use DM SPI driver to avoid break build.

Nice.