Skip to contentSkip to conversation

J721e: Add HyperBus support

PATCH Superseded Vignesh Raghavendra 3 participants 13 messages Oct 10, 2019 – Oct 23, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

v2 cover J721e: Add HyperBus support

This series adds support for HyperBus Memory Controller of TI's J721e and AM654 SoCs.

Vignesh Raghavendra (6):
mtd: cfi_flash: Use CONFIG_SYS_MONITOR_BASE only when defined
mtd: Add TI HyperBus Memory Controller driver
arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node
arm: dts: k3-j721e-som-p0: Add HyperFlash node
configs: j721e_evm.h: Define CONFIG_SYS_MAX_FLASH_BANKS_DETECT
configs: j721e_evm_a72_defconfig: Add HBMC related configs

 arch/arm/dts/k3-j721e-mcu-wakeup.dtsi |  26 +++++++
 arch/arm/dts/k3-j721e-som-p0.dtsi     |  34 +++++++++
 configs/j721e_evm_a72_defconfig       |  12 +++
 drivers/mtd/Kconfig                   |   7 ++
 drivers/mtd/Makefile                  |   1 +
 drivers/mtd/cfi_flash.c               |   6 +-
 drivers/mtd/hbmc-am654.c              | 105 ++++++++++++++++++++++++++
 include/configs/j721e_evm.h           |   3 +
 8 files changed, 192 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mtd/hbmc-am654.c
Signature · 1 line
2.23.0
author maintainer
#1 lore raw

PATCH v2 1/6 mtd: cfi_flash: Use CONFIG_SYS_MONITOR_BASE only when defined

Make use of CONFIG_SYS_MONITOR_BASE only when available to avoid build error when CONFIG_SYS_MONITOR_BASE is not defined.

---
v2:
Make macro check consistent as pointed out by Stefan

 drivers/mtd/cfi_flash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/cfi_flash.c +4 -2
index c59254c76e3e..0574fa63a44d 100644
@@ -178,7 +178,8 @@ __maybe_weak u64 flash_read64(void *addr)
 /*-----------------------------------------------------------------------
  */
 #if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || \
-	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE)
+	(defined(CONFIG_SYS_MONITOR_BASE) && \
+	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE))
 static flash_info_t *flash_get_info(ulong base)
 {
 	int i;
@@ -2329,7 +2330,8 @@ static void flash_protect_default(void)
 #endif
 
 	/* Monitor protection ON by default */
-#if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
+#if defined(CONFIG_SYS_MONITOR_BASE) && \
+	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
 	(!defined(CONFIG_MONITOR_IS_IN_RAM))
 	flash_protect(FLAG_PROTECT_SET,
 		      CONFIG_SYS_MONITOR_BASE,
Signature · 1 line
2.23.0
author maintainer
#3 lore raw

PATCH v2 2/6 mtd: Add TI HyperBus Memory Controller driver

In reply to Vignesh Raghavendra

AM654/J721e has HyperBus Memory Controller that supports HyperFlash and HyperRAM devices. It provides a memory mapped interface to interact with these devices. Add a driver to support the same.
Driver calibrates the controller, setups up for MMIO access and probes HyperFlash child node.

---
v2: No change

 drivers/mtd/Kconfig      |   7 +++
 drivers/mtd/Makefile     |   1 +
 drivers/mtd/hbmc-am654.c | 105 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+)
 create mode 100644 drivers/mtd/hbmc-am654.c
drivers/mtd/Kconfig +7 -0
index 0050fb2b9bf1..37f379d47803 100644
@@ -94,6 +94,13 @@ config RENESAS_RPC_HF
 	  This enables access to Hyperflash memory through the Renesas
 	  RCar Gen3 RPC controller.
 
+config HBMC_AM654
+	bool "HyperBus controller driver for AM65x SoC"
+	depends on SYSCON
+	help
+	 This is the driver for HyperBus controller on TI's AM65x and
+	 other SoCs
+
 source "drivers/mtd/nand/Kconfig"
 
 source "drivers/mtd/spi/Kconfig"
drivers/mtd/Makefile +1 -0
index 22ceda93c06d..293079d709aa 100644
@@ -18,5 +18,6 @@ obj-$(CONFIG_FLASH_PIC32) += pic32_flash.o
 obj-$(CONFIG_ST_SMI) += st_smi.o
 obj-$(CONFIG_STM32_FLASH) += stm32_flash.o
 obj-$(CONFIG_RENESAS_RPC_HF) += renesas_rpc_hf.o
+obj-$(CONFIG_HBMC_AM654) += hbmc-am654.o
 
 obj-y += nand/
drivers/mtd/hbmc-am654.c new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.23.0
#4 lore raw

PATCH v2 2/6 mtd: Add TI HyperBus Memory Controller driver

Quoted 9 lines · Vignesh Raghavendra

AM654/J721e has HyperBus Memory Controller that supports HyperFlash and HyperRAM devices. It provides a memory mapped interface to interact with these devices. Add a driver to support the same.
Driver calibrates the controller, setups up for MMIO access and probes HyperFlash child node.

---
v2: No change

Thanks,
Stefan

author maintainer
#5 lore raw

PATCH v2 3/6 arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node

In reply to Vignesh Raghavendra

Add DT node for HyperBus Memory Controller in the FSS. On J721e, its not possible to use OSPI0 and HBMC simultaneously as they are muxed within the Flash Subsystem hence disable HBMC by default as keep OSPI enabled. Bootloader will fixup DT when it detects HyperFlash instead of OSPI.

---
 arch/arm/dts/k3-j721e-mcu-wakeup.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/arm/dts/k3-j721e-mcu-wakeup.dtsi +26 -0
index c217866e9a2b..8838771dc1a1 100644
@@ -80,4 +80,30 @@
 		clocks = <&k3_clks 149 0>;
 		clock-names = "fclk";
 	};
+
+	fss: fss at 47000000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x0 0x47000000 0x0 0x100>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		hbmc_mux: hbmc-mux {
+			compatible = "mmio-mux";
+			#mux-control-cells = <1>;
+			mux-reg-masks = <0x4 0x2>; /* HBMC select */
+		};
+
+		hbmc: hyperbus at 47034000 {
+			compatible = "ti,j721e-hbmc", "ti,am654-hbmc";
+			reg = <0x0 0x47034000 0x0 0x100>,
+				<0x5 0x00000000 0x1 0x0000000>;
+			power-domains = <&k3_pds 102 TI_SCI_PD_EXCLUSIVE>;
+			#address-cells = <2>;
+			#size-cells = <1>;
+			mux-controls = <&hbmc_mux 0>;
+			assigned-clocks = <&k3_clks 102 0>;
+			assigned-clock-rates = <166666666>;
+		};
+	};
 };
Signature · 1 line
2.23.0
#6 lore raw

PATCH v2 3/6 arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node

Hi Vignesh,

Quoted 36 lines · Vignesh Raghavendra

Add DT node for HyperBus Memory Controller in the FSS. On J721e, its not possible to use OSPI0 and HBMC simultaneously as they are muxed within the Flash Subsystem hence disable HBMC by default as keep OSPI enabled. Bootloader will fixup DT when it detects HyperFlash instead of OSPI.

---
  arch/arm/dts/k3-j721e-mcu-wakeup.dtsi | 26 ++++++++++++++++++++++++++
  1 file changed, 26 insertions(+)
arch/arm/dts/k3-j721e-mcu-wakeup.dtsi +17 -0
index c217866e9a2b..8838771dc1a1 100644
@@ -80,4 +80,30 @@
  		clocks = <&k3_clks 149 0>;
  		clock-names = "fclk";
  	};
+
+	fss: fss at 47000000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x0 0x47000000 0x0 0x100>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		hbmc_mux: hbmc-mux {
+			compatible = "mmio-mux";
+			#mux-control-cells = <1>;
+			mux-reg-masks = <0x4 0x2>; /* HBMC select */
+		};
+
+		hbmc: hyperbus at 47034000 {
+			compatible = "ti,j721e-hbmc", "ti,am654-hbmc";
+			reg = <0x0 0x47034000 0x0 0x100>,

arch/arm/dts/k3-j721e-mcu-wakeup.dtsi line 109

Quoted 10 lines
arch/arm/dts/k3-j721e-mcu-wakeup.dtsi +9 -0
+				<0x5 0x00000000 0x1 0x0000000>;
+			power-domains = <&k3_pds 102 TI_SCI_PD_EXCLUSIVE>;
+			#address-cells = <2>;
+			#size-cells = <1>;
+			mux-controls = <&hbmc_mux 0>;
+			assigned-clocks = <&k3_clks 102 0>;
+			assigned-clock-rates = <166666666>;
+		};
+	};
  };

This patch does not apply any more. Could you please rebase and resubmit?

Thanks,
Stefan

author maintainer
#7 lore raw

PATCH v2 3/6 arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node

Hi Stefan,

Quoted 3 lines · Stefan Roese

Hi Vignesh,

On 10.10.19 07:52, Vignesh Raghavendra wrote:

[...]

Quoted 16 lines
Quoted 6 lines

+
+        hbmc: hyperbus at 47034000 {
+            compatible = "ti,j721e-hbmc", "ti,am654-hbmc"; +            reg = <0x0 0x47034000 0x0 0x100>,
+                <0x5 0x00000000 0x1 0x0000000>;
+            power-domains = <&k3_pds 102 TI_SCI_PD_EXCLUSIVE>;

Quoted 9 lines

+            #address-cells = <2>;
+            #size-cells = <1>;
+            mux-controls = <&hbmc_mux 0>;
+            assigned-clocks = <&k3_clks 102 0>;
+            assigned-clock-rates = <166666666>;
+        };
+    };
  };

Quoted 3 lines

This patch does not apply any more. Could you please rebase and resubmit?

I have rebased the patches and posted v3 here:
http://patchwork.ozlabs.org/project/uboot/list/?series=137974

Signature · 2 lines
Regards
Vignesh
author maintainer
#8 lore raw

PATCH v2 4/6 arm: dts: k3-j721e-som-p0: Add HyperFlash node

In reply to Vignesh Raghavendra

J721e SoM as a 64MB HyperFlash on board. Add pinmux and DT node for the same.

---
 arch/arm/dts/k3-j721e-som-p0.dtsi | 34 +++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/arm/dts/k3-j721e-som-p0.dtsi +34 -0
index 1884fc70148f..1e1519f1c900 100644
@@ -27,3 +27,37 @@
 		};
 	};
 };
+
+&wkup_pmx0 {
+	mcu_fss0_hpb0_pins_default: mcu-fss0-hpb0-pins-default {
+		pinctrl-single,pins = <
+			J721E_WKUP_IOPAD(0x0, PIN_OUTPUT, 1) /* (E20) MCU_OSPI0_CLK.MCU_HYPERBUS0_CK */
+			J721E_WKUP_IOPAD(0x4, PIN_OUTPUT, 1) /* (C21) MCU_OSPI0_LBCLKO.MCU_HYPERBUS0_CKn */
+			J721E_WKUP_IOPAD(0x2c, PIN_OUTPUT, 1) /* (F19) MCU_OSPI0_CSn0.MCU_HYPERBUS0_CSn0 */
+			J721E_WKUP_IOPAD(0x54, PIN_OUTPUT, 3) /* (E22) MCU_OSPI1_CSn1.MCU_HYPERBUS0_CSn1 */
+			J721E_WKUP_IOPAD(0x30, PIN_OUTPUT, 1) /* (E19) MCU_OSPI0_CSn1.MCU_HYPERBUS0_RESETn */
+			J721E_WKUP_IOPAD(0x8, PIN_INPUT, 1) /* (D21) MCU_OSPI0_DQS.MCU_HYPERBUS0_RWDS */
+			J721E_WKUP_IOPAD(0xc, PIN_INPUT, 1) /* (D20) MCU_OSPI0_D0.MCU_HYPERBUS0_DQ0 */
+			J721E_WKUP_IOPAD(0x10, PIN_INPUT, 1) /* (G19) MCU_OSPI0_D1.MCU_HYPERBUS0_DQ1 */
+			J721E_WKUP_IOPAD(0x14, PIN_INPUT, 1) /* (G20) MCU_OSPI0_D2.MCU_HYPERBUS0_DQ2 */
+			J721E_WKUP_IOPAD(0x18, PIN_INPUT, 1) /* (F20) MCU_OSPI0_D3.MCU_HYPERBUS0_DQ3 */
+			J721E_WKUP_IOPAD(0x1c, PIN_INPUT, 1) /* (F21) MCU_OSPI0_D4.MCU_HYPERBUS0_DQ4 */
+			J721E_WKUP_IOPAD(0x20, PIN_INPUT, 1) /* (E21) MCU_OSPI0_D5.MCU_HYPERBUS0_DQ5 */
+			J721E_WKUP_IOPAD(0x24, PIN_INPUT, 1) /* (B22) MCU_OSPI0_D6.MCU_HYPERBUS0_DQ6 */
+			J721E_WKUP_IOPAD(0x28, PIN_INPUT, 1) /* (G21) MCU_OSPI0_D7.MCU_HYPERBUS0_DQ7 */
+		>;
+	};
+};
+
+&hbmc {
+	status = "disabled";
+	pinctrl-names = "default";
+	pinctrl-0 = <&mcu_fss0_hpb0_pins_default>;
+	ranges = <0x0 0x0 0x5 0x0 0x4000000>, /* 64MB Flash on CS0 */
+		 <0x1 0x0 0x5 0x4000000 0x800000>; /* 8MB RAM on CS1 */
+
+	flash at 0,0 {
+		compatible = "cypress,hyperflash", "cfi-flash";
+		reg = <0x0 0x0 0x4000000>;
+	};
+};
Signature · 1 line
2.23.0
author maintainer
#9 lore raw

PATCH v2 5/6 configs: j721e_evm.h: Define CONFIG_SYS_MAX_FLASH_BANKS_DETECT

In reply to Vignesh Raghavendra

Define CONFIG_SYS_MAX_FLASH_BANKS_DETECT so that number of flash banks are automatically detected by CFI flash driver

---
 include/configs/j721e_evm.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/j721e_evm.h +3 -0
index 5fe77ef16dc0..e766be23364d 100644
@@ -55,6 +55,9 @@
 #define CONFIG_SYS_BOOTM_LEN		SZ_64M
 #define CONFIG_CQSPI_REF_CLK		133333333
 
+/* HyperFlash related configuration */
+#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
+
 /* U-Boot general configuration */
 #define EXTRA_ENV_J721E_BOARD_SETTINGS					\
 	"default_device_tree=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"	\
Signature · 1 line
2.23.0
author maintainer
#10 lore raw

PATCH v2 6/6 configs: j721e_evm_a72_defconfig: Add HBMC related configs

In reply to Vignesh Raghavendra

Enable HBMC and HyperFlash in A72 SPL and A72 U-Boot

---
 configs/j721e_evm_a72_defconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)
configs/j721e_evm_a72_defconfig +12 -0
index 5cb933d87886..7ddf85fea743 100644
@@ -34,6 +34,7 @@ CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_SF=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
@@ -62,6 +63,15 @@ CONFIG_MISC=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_MTD_DEVICE=y
+CONFIG_FLASH_CFI_DRIVER=y
+CONFIG_CFI_FLASH=y
+CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
+CONFIG_FLASH_CFI_MTD=y
+CONFIG_SYS_FLASH_CFI=y
+CONFIG_HBMC_AM654=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
@@ -82,3 +92,5 @@ CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_MTDIDS_DEFAULT="nor0=47040000.spi.0,nor0=47034000.hyperbus"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=47034000.hyperbus:512k(hbmc.tiboot3),2m(hbmc.tispl),4m(hbmc.u-boot),256k(hbmc.env),1m(hbmc.sysfw),- at 8m(hbmc.rootfs)"
Signature · 1 line
2.23.0
author maintainer
#11 lore raw

v2 cover J721e: Add HyperBus support

In reply to Vignesh Raghavendra

Hi Tom,

Quoted 3 lines · Vignesh Raghavendra

This series adds support for HyperBus Memory Controller of TI's J721e and AM654 SoCs.

Stefan has provided Reviewed-bys for CFI related changes. Could you please pull in this series if there no further comments?

Regards
Vignesh

Quoted 20 lines

Vignesh Raghavendra (6):
mtd: cfi_flash: Use CONFIG_SYS_MONITOR_BASE only when defined
mtd: Add TI HyperBus Memory Controller driver
arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node
arm: dts: k3-j721e-som-p0: Add HyperFlash node
configs: j721e_evm.h: Define CONFIG_SYS_MAX_FLASH_BANKS_DETECT
configs: j721e_evm_a72_defconfig: Add HBMC related configs

 arch/arm/dts/k3-j721e-mcu-wakeup.dtsi |  26 +++++++
 arch/arm/dts/k3-j721e-som-p0.dtsi     |  34 +++++++++
 configs/j721e_evm_a72_defconfig       |  12 +++
 drivers/mtd/Kconfig                   |   7 ++
 drivers/mtd/Makefile                  |   1 +
 drivers/mtd/cfi_flash.c               |   6 +-
 drivers/mtd/hbmc-am654.c              | 105 ++++++++++++++++++++++++++
 include/configs/j721e_evm.h           |   3 +
 8 files changed, 192 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mtd/hbmc-am654.c
Signature · 2 lines
Regards
Vignesh
#12 lore raw

v2 cover J721e: Add HyperBus support

Quoted 7 lines · Vignesh Raghavendra

Hi Tom,

Quoted 3 lines · Vignesh Raghavendra

This series adds support for HyperBus Memory Controller of TI's J721e and AM654 SoCs.

Quoted 25 lines

Stefan has provided Reviewed-bys for CFI related changes. Could you please pull in this series if there no further comments?

Regards
Vignesh

Quoted 19 lines

Vignesh Raghavendra (6):
mtd: cfi_flash: Use CONFIG_SYS_MONITOR_BASE only when defined
mtd: Add TI HyperBus Memory Controller driver
arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node
arm: dts: k3-j721e-som-p0: Add HyperFlash node
configs: j721e_evm.h: Define CONFIG_SYS_MAX_FLASH_BANKS_DETECT
configs: j721e_evm_a72_defconfig: Add HBMC related configs

 arch/arm/dts/k3-j721e-mcu-wakeup.dtsi |  26 +++++++
 arch/arm/dts/k3-j721e-som-p0.dtsi     |  34 +++++++++
 configs/j721e_evm_a72_defconfig       |  12 +++
 drivers/mtd/Kconfig                   |   7 ++
 drivers/mtd/Makefile                  |   1 +
 drivers/mtd/cfi_flash.c               |   6 +-
 drivers/mtd/hbmc-am654.c              | 105 ++++++++++++++++++++++++++
 include/configs/j721e_evm.h           |   3 +
 8 files changed, 192 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mtd/hbmc-am654.c

So, since Stefan is happy I guess this should go through the CFI tree that he maintains and I'll go correct patchwork, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191018/cd279efb/attachment.sig>