This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRA821U: About OSPI

Part Number: DRA821U
Other Parts Discussed in Thread: J7200XSOMXEVM

Tool/software:

Hi Team,

We have designed a custom board based on the J7200XSOMXEVM reference design.

The custom board is connected to FRAM (MB85RS4MT) via QSPI (MCU_OSPI).

According to the above circuit, We wrote the device tree as follows:

&wkup_pmx0 {
	fram_pins_default: fram-default-pins {
		pinctrl-single,pins = <
			J721E_WKUP_IOPAD(0x0, PIN_OUTPUT, 0) /* (B6) MCU_OSPI0_CLK */
			J721E_WKUP_IOPAD(0x2c, PIN_OUTPUT, 0) /* (D6) MCU_OSPI0_CSn0 */
			J721E_WKUP_IOPAD(0xc, PIN_INPUT, 0) /* (D8) MCU_OSPI0_D0 */
			J721E_WKUP_IOPAD(0x10, PIN_INPUT, 0) /* (C7) MCU_OSPI0_D1 */
			J721E_WKUP_IOPAD(0x14, PIN_INPUT, 0) /* (C5) MCU_OSPI0_D2 */
			J721E_WKUP_IOPAD(0x18, PIN_INPUT, 0) /* (A5) MCU_OSPI0_D3 */
			J721E_WKUP_IOPAD(0x8, PIN_INPUT, 0) /* (B7) MCU_OSPI0_DQS */
			J721E_WKUP_IOPAD(0x4, PIN_INPUT, 0) /* (C8) MCU_OSPI0_LBCLKO */
		>;
	};
};


&ospi0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&fram_pins_default>;

	mb85rs4mt@0 {
		status = "okay";
		compatible = "jedec,spi-nor", "fujitsu,mb85rs4mt";
		reg = <0x0>;
		spi-tx-bus-width = <4>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <40000000>;
		cdns,tshsl-ns = <60>;
		cdns,tsd2d-ns = <60>;
		cdns,tchsh-ns = <60>;
		cdns,tslch-ns = <60>;
		cdns,read-delay = <4>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "fram.data";
				reg = <0x00000000 0x000080000>;
			};
		};
	};
};

Also, there was no information on compatibility with mb85rq4ml in "board-support/ti-linux-kernel-6.6.32+git-ti-rt/Documentation/devicetree/bindings/eeprom/at25.yaml". Therefore, we were able to make it compatible by modifying "board-support/ti-linux-kernel-6.6.32+git-ti-rt/drivers/mtd/spi-nor/fujitsu.c" as follows.

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2005, Intec Automation Inc.
 * Copyright (C) 2014, Freescale Semiconductor, Inc.
 */

#include <linux/mtd/spi-nor.h>

#include "core.h"

static const struct flash_info fujitsu_nor_parts[] = {
	/* Fujitsu */
	{ "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1)
		FLAGS(SPI_NOR_NO_ERASE) },
+	{ "mb85rq4ml", INFO(0x047f29, 0, 512 * 1024, 1)
+		FLAGS(SPI_NOR_NO_ERASE)
+		NO_SFDP_FLAGS(SPI_NOR_QUAD_READ) },
};

const struct spi_nor_manufacturer spi_nor_fujitsu = {
	.name = "fujitsu",
	.parts = fujitsu_nor_parts,
	.nparts = ARRAY_SIZE(fujitsu_nor_parts),
};

When We made these settings and started the program, the following message was displayed and the program failed to recognize the FRAM.

~# dmesg | grep spi
[    0.738259] cadence-qspi 47040000.spi: registered master spi0
[    0.738292] spi spi0.0: setup mode 0, 8 bits/w, 40000000 Hz max --> 0
[    0.738857] spi-nor spi0.0: unrecognized JEDEC id bytes: 08 fe 53 0b ff ff
[    0.738884] cadence-qspi 47040000.spi: registered child spi0.0

Since the obtained JEDEC id was different from MB85RS4MT, we checked the following signal lines with an oscilloscope and found no change in the signal.
-MCU_OSPI0_CLK
-MCU_OSPI0_CSn0
-MCU_OSPI0_D0
-MCU_OSPI0_D1

Looking at the source code, it looks like the RDID command is being sent from the OSPI port, but for some reason We can't get the signal waveform.
Do you know what the reason is?

Also, I wanted to check the signals with the SPI driver without using the FRAM driver, but looking at the following forum, it seems that spidev_test cannot be used with OSPI.

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1365216/am6422-need-to-use-ospi-as-generic-spi-device/5211543?tisearch=e2e-sitesearch&keymatch=OSPI%25252525252520spidev-test#5211543

Could you please tell me how to investigate the cause?

Regards,

mizutani

  • Hi,

    Have you added the device details in '[ti-u-boot-source]/drivers/mtd/spi/spi-nor-ids.c"?

    Regards,
    Tanmay

  • Hi,

    We have not modified '[ti-u-boot-source]/drivers/mtd/spi/spi-nor-ids.c'.

    The following description has been removed from ***-u-boot.dtsi because FRAM is not used during boot.

    &ospi0 {
    	bootph-all;
    
    	flash@0 {
    		cdns,phy-mode;
    		bootph-all;
    	};
    };

    In this case, is it still necessary to modify '[ti-u-boot-source]/drivers/mtd/spi/spi-nor-ids.c'?

    Regards,

    mizutani

  • Hi,

    Yes. On order for fixups and custom hooks to works, u-boot would need to know the jedec id of the part. So that should be added.

    Regards,
    Tanmay

  • Hi,

    We have made the following fixes:

    -[board-support/ti-u-boot-2024.04+git/arch/arm/dts/custom_board-u-boot.dtsi]
         Add the following code:
         

    &ospi0 {
    	bootph-all;
    
    	mb85rs4mt@0 {
    		cdns,phy-mode;
    		bootph-all;
    	};
    };

    -[board-support/ti-u-boot-2024.04+git/configs/custom_board_a72_defconfig]
         Enable SPI and MTD related features in the configuration file:
         

    CONFIG_ARM=y
    CONFIG_ARCH_K3=y
    CONFIG_SYS_MALLOC_LEN=0x2000000
    CONFIG_SYS_MALLOC_F_LEN=0x8000
    CONFIG_SPL_GPIO=y
    CONFIG_SPL_LIBCOMMON_SUPPORT=y
    CONFIG_SPL_LIBGENERIC_SUPPORT=y
    CONFIG_NR_DRAM_BANKS=2
    CONFIG_SOC_K3_J721E=y
    CONFIG_TARGET_J7200_A72_EVM=y
    CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
    CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
    CONFIG_SF_DEFAULT_SPEED=25000000
    CONFIG_SF_DEFAULT_MODE=0
    CONFIG_ENV_SIZE=0x20000
    CONFIG_DM_GPIO=y
    CONFIG_SPL_DM_SPI=y
    CONFIG_DEFAULT_DEVICE_TREE="custom-board-a72"
    CONFIG_SPL_TEXT_BASE=0x80080000
    CONFIG_OF_LIBFDT_OVERLAY=y
    CONFIG_DM_RESET=y
    CONFIG_SPL_MMC=y
    CONFIG_SPL_SERIAL=y
    CONFIG_SPL_DRIVERS_MISC=y
    CONFIG_SPL_STACK_R_ADDR=0x82000000
    CONFIG_SPL_FS_FAT=y
    CONFIG_SPL_LIBDISK_SUPPORT=y
    CONFIG_SPL_SPI_FLASH_SUPPORT=y
    CONFIG_SPL_SPI=y
    # CONFIG_PSCI_RESET is not set
    # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
    CONFIG_SPL_LOAD_FIT=y
    CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
    CONFIG_BOOTSTD_FULL=y
    CONFIG_OF_BOARD_SETUP=y
    CONFIG_OF_SYSTEM_SETUP=y
    CONFIG_LOGLEVEL=7
    CONFIG_SPL_MAX_SIZE=0xc0000
    CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
    CONFIG_SPL_BSS_START_ADDR=0x80a00000
    CONFIG_SPL_BSS_MAX_SIZE=0x80000
    CONFIG_SPL_BOARD_INIT=y
    CONFIG_SPL_SYS_MALLOC_SIMPLE=y
    CONFIG_SPL_STACK_R=y
    CONFIG_SPL_SYS_MALLOC=y
    CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1800
    CONFIG_SPL_DMA=y
    CONFIG_SPL_ENV_SUPPORT=y
    CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
    CONFIG_SPL_I2C=y
    CONFIG_SPL_DM_MAILBOX=y
    CONFIG_SPL_MTD=y
    CONFIG_SPL_DM_SPI_FLASH=y
    CONFIG_SPL_NOR_SUPPORT=y
    CONFIG_SPL_DM_RESET=y
    CONFIG_SPL_POWER_DOMAIN=y
    CONFIG_SPL_RAM_SUPPORT=y
    CONFIG_SPL_RAM_DEVICE=y
    # CONFIG_SPL_SPI_FLASH_TINY is not set
    CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
    CONFIG_SPL_SPI_LOAD=y
    CONFIG_SYS_SPI_U_BOOT_OFFS=0x300000
    CONFIG_SPL_THERMAL=y
    CONFIG_SPL_YMODEM_SUPPORT=y
    CONFIG_CMD_ASKENV=y
    CONFIG_CMD_DFU=y
    # CONFIG_CMD_FLASH is not set
    CONFIG_CMD_GPIO=y
    CONFIG_CMD_GPT=y
    CONFIG_CMD_I2C=y
    CONFIG_CMD_MMC=y
    CONFIG_CMD_MTD=y
    # CONFIG_CMD_REMOTEPROC=y
    CONFIG_CMD_UFS=y
    # CONFIG_CMD_USB=y
    # CONFIG_CMD_USB_MASS_STORAGE=y
    CONFIG_CMD_TIME=y
    CONFIG_CMD_EXT4_WRITE=y
    # CONFIG_CMD_UBI=y
    # CONFIG_ISO_PARTITION is not set
    # CONFIG_SPL_EFI_PARTITION is not set
    CONFIG_OF_CONTROL=y
    CONFIG_SPL_OF_CONTROL=y
    CONFIG_SPL_MULTI_DTB_FIT=y
    CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
    CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
    CONFIG_SYS_RELOC_GD_ENV_ADDR=y
    CONFIG_NET_RANDOM_ETHADDR=y
    CONFIG_SPL_DM=y
    CONFIG_SPL_DM_SEQ_ALIAS=y
    CONFIG_REGMAP=y
    CONFIG_SPL_REGMAP=y
    CONFIG_SPL_SYSCON=y
    CONFIG_SPL_OF_TRANSLATE=y
    CONFIG_CLK=y
    CONFIG_SPL_CLK=y
    CONFIG_CLK_CCF=y
    CONFIG_CLK_TI_SCI=y
    CONFIG_DFU_MMC=y
    CONFIG_DFU_RAM=y
    CONFIG_DFU_SF=y
    CONFIG_SYS_DFU_DATA_BUF_SIZE=0x40000
    CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
    CONFIG_DMA_CHANNELS=y
    CONFIG_TI_K3_NAVSS_UDMA=y
    CONFIG_USB_FUNCTION_FASTBOOT=y
    CONFIG_FASTBOOT_BUF_ADDR=0x82000000
    CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
    CONFIG_FASTBOOT_FLASH=y
    CONFIG_FASTBOOT_FLASH_MMC_DEV=0
    CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
    CONFIG_TI_SCI_PROTOCOL=y
    CONFIG_GPIO_HOG=y
    CONFIG_DA8XX_GPIO=y
    # CONFIG_DM_PCA953X=y
    CONFIG_DM_I2C=y
    CONFIG_DM_I2C_GPIO=y
    CONFIG_SYS_I2C_OMAP24XX=y
    CONFIG_DM_MAILBOX=y
    CONFIG_K3_SEC_PROXY=y
    CONFIG_SUPPORT_EMMC_BOOT=y
    CONFIG_MMC_IO_VOLTAGE=y
    CONFIG_MMC_UHS_SUPPORT=y
    CONFIG_MMC_HS400_SUPPORT=y
    CONFIG_SPL_MMC_HS400_SUPPORT=y
    CONFIG_MMC_SDHCI=y
    CONFIG_MMC_SDHCI_ADMA=y
    CONFIG_SPL_MMC_SDHCI_ADMA=y
    CONFIG_MMC_SDHCI_AM654=y
    CONFIG_MTD=y
    CONFIG_DM_MTD=y
    # CONFIG_MTD_NOR_FLASH=y
    # CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
    # CONFIG_FLASH_SHOW_PROGRESS=0
    # 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_SYS_MAX_FLASH_BANKS_DETECT=y
    CONFIG_DM_SPI_FLASH=y
    CONFIG_SPI_FLASH_SFDP_SUPPORT=y
    CONFIG_SPI_FLASH_SOFT_RESET=y
    CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
    # CONFIG_SPI_FLASH_SPANSION=y
    # CONFIG_SPI_FLASH_S28HX_T=y
    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
    CONFIG_SPI_FLASH_MTD=y
    CONFIG_MULTIPLEXER=y
    CONFIG_MUX_MMIO=y
    CONFIG_PHY_TI_DP83867=y
    CONFIG_PHY_FIXED=y
    CONFIG_TI_AM65_CPSW_NUSS=y
    CONFIG_PHY=y
    CONFIG_SPL_PHY=y
    CONFIG_PHY_CADENCE_TORRENT=y
    CONFIG_PHY_J721E_WIZ=y
    CONFIG_PINCTRL=y
    # CONFIG_PINCTRL_GENERIC is not set
    CONFIG_SPL_PINCTRL=y
    # CONFIG_SPL_PINCTRL_GENERIC is not set
    CONFIG_PINCTRL_SINGLE=y
    CONFIG_POWER_DOMAIN=y
    CONFIG_TI_SCI_POWER_DOMAIN=y
    CONFIG_DM_REGULATOR=y
    CONFIG_DM_REGULATOR_FIXED=y
    CONFIG_DM_REGULATOR_GPIO=y
    CONFIG_RAM=y
    CONFIG_SPL_RAM=y
    CONFIG_REMOTEPROC_TI_K3_R5F=y
    CONFIG_RESET_TI_SCI=y
    CONFIG_SCSI=y
    CONFIG_DM_SERIAL=y
    CONFIG_SOC_DEVICE=y
    CONFIG_SOC_DEVICE_TI_K3=y
    CONFIG_SOC_TI=y
    CONFIG_SPI=y
    CONFIG_DM_SPI=y
    CONFIG_CADENCE_QSPI=y
    CONFIG_CADENCE_QSPI_PHY=y
    CONFIG_SYSRESET=y
    CONFIG_SPL_SYSRESET=y
    CONFIG_SYSRESET_TI_SCI=y
    CONFIG_DM_THERMAL=y
    # CONFIG_USB=y
    # CONFIG_DM_USB_GADGET=y
    # CONFIG_SPL_DM_USB_GADGET=y
    # CONFIG_USB_XHCI_HCD=y
    # CONFIG_USB_CDNS3=y
    # CONFIG_USB_CDNS3_GADGET=y
    # CONFIG_USB_CDNS3_HOST=y
    # CONFIG_SPL_USB_CDNS3_GADGET=y
    # CONFIG_USB_GADGET=y
    # CONFIG_SPL_USB_GADGET=y
    # CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
    # CONFIG_USB_GADGET_VENDOR_NUM=0x0451
    # CONFIG_USB_GADGET_PRODUCT_NUM=0x6164
    CONFIG_SPL_DFU=y
    CONFIG_UFS=y
    CONFIG_CADENCE_UFS=y
    CONFIG_TI_J721E_UFS=y

    -[board-support/ti-u-boot-2024.04+git/drivers/mtd/spi/spi-nor-ids.c]
        Added parameters for FRAM (MB85RS4MT):
        

    ...
    
    #ifdef CONFIG_SPI_FLASH_ZBIT
    	/* Zbit Semiconductor Inc. */
    	{ INFO("zb25vq128", 0x5e4018, 0, 64 * 1024, 256,
    	       SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
    #endif
    +	{ INFO("MB85RQ4ML", 0x047f29, 0, 512 * 1024, 1, SPI_NOR_QUAD_READ) },
    	{ },
    };

    After, We ran "mtd list" in u-boot, and the JEDEC ID that was read out was the same as before.
    Also, we checked the following signal lines with an oscilloscope and found no change in the signal.
    -MCU_OSPI0_CLK
    -MCU_OSPI0_CSn0
    -MCU_OSPI0_D0
    -MCU_OSPI0_D1

    => mtd list
    jedec_spi_nor mb85rs4mt@0: Software reset enable failed: -524
    jedec_spi_nor mb85rs4mt@0: unrecognized JEDEC id bytes: 08, fe, 53
    List of MTD devices:
    No MTD device found
    

    Please inform me if there are any inaccuracies in the changes.

    Regards,

    mizutani

  • Hi,

    There was an error in the device tree.
    By correcting it, memory access was possible.

    However, access at 108MHz fails.

    Is it correct to assume that operation at frequencies above 50MHz is possible by doing the following?
    -Connect MCU_OSPI0_DQS and MCU_OSPI0_LBCLKO at the OPSI pins.
    -Operate in PHY mode in u-boot (cdns,phy-mode).

    What other settings are necessary to access at 108 MHz?

    Regards,

    mizutani

  • Hi,

    Yes, you would need to have the OSPI controller in phy mode and have the spi tuning parameters in the flash. 

    Regards,
    Tanmay

  • Hi

    I checked the datasheet for the mb85rq4ml but couldn't find any tuning parameters.

    MB85RQ4ML.pdf

    I set the dummy cycle to 6, but it doesn't work at 108MHz (See page 12).

    Is the only remaining adjustment to be made in the device tree, such as in 'cdns,tshsl-ns'?

    &ospi0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&fram_pins_default>;
    
    	mb85rq4ml@0 {
    		compatible = "jedec,spi-nor", "fujitsu,mb85rq4ml";
    		reg = <0x0>;
    		spi-tx-bus-width = <4>;
    		spi-rx-bus-width = <4>;
    		spi-max-frequency = <108000000>;
    		cdns,tshsl-ns = <7>;
    		cdns,tsd2d-ns = <7>;
    		cdns,tchsh-ns = <7>;
    		cdns,tslch-ns = <7>;
    		cdns,read-delay = <0>;
    		m25p,fast-read;
    
    		partitions {
    			#address-cells = <1>;
    			#size-cells = <1>;
    
    			partition@0 {
    				label = "fram.data";
    				reg = <0x00000000 0x000080000>;
    			};
    		};
    	};
    };

    Regards,

    mizutani

  • Hi,

    You can get the tuning parameters from here : https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-jacinto7/10_01_00_04/exports/docs/linux/Foundational_Components/U-Boot/UG-QSPI.html#:~:text=loadaddr%200x6C0000%20%24filesize-,PHY%20Calibration,-PHY%20calibration%20allows

    Is the only remaining adjustment to be made in the device tree, such as in 'cdns,tshsl-ns'?

    Don't change this. can you try with the phy calibration pattern I attached above.

    Regards,
    Tanmay

  • Hi

    I understood that I need to write the PHY pattern to the flash.

    Going back to the very basics, is the MB85RQ4ML, which is a FRAM, capable of supporting PHY mode?

    If PHY mode is supported, in which area should the PHY pattern be written?

    Regards,

    mizutani

  • Hi,

    I just saw that it is an QSPI and not OSPI. Also phy mode is not possible here.

    Let me consult with our experts for this and get back to you by end of this week.

    Regards,
    Tanmay

  • Hi

    I apologize for the repeated follow-up, but could you please provide an update on this matter?

    Also, is the following understanding of the maximum frequency of MCU_OSPI correct?

    Tap Mode: This mode of operation can go up to 50 MHz maximum.
    PHY Mode: This mode of operation can go up to 166 MHz maximum.

    Regards,

    mizutani

  • Hi Mizutani-san,

    Tap Mode: This mode of operation can go up to 50 MHz maximum.
    PHY Mode: This mode of operation can go up to 166 MHz maximum.

    We do not have phy mode for QSPI controllers. The TAP mode we use operates at 40MHz for QSPI.

    We can go higher than that, but it mostly depends on the timing requirements of the controller and Flash.

    Regards,
    Tanmay