driver/mtd: Add MICRON manufacturer id in spi framework
Subsystems (3)
PATCH 1/1 driver/mtd: Add MICRON manufacturer id in spi framework
--- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/spi_flash.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/mtd/spi/sf_internal.h +1 -0
@@ -32,6 +32,7 @@ enum spi_nor_option_flags {/* CFI Manufacture ID's */ #define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_STMICRO 0x20 +#define SPI_FLASH_CFI_MFR_MICRON 0x2C#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2#define SPI_FLASH_CFI_MFR_SST 0xbf#define SPI_FLASH_CFI_MFR_WINBOND 0xef
drivers/mtd/spi/spi_flash.c +2 -0
@@ -1096,6 +1096,7 @@ static int set_quad_mode(struct spi_flash *flash,#endif #ifdef CONFIG_SPI_FLASH_STMICRO case SPI_FLASH_CFI_MFR_STMICRO : +case SPI_FLASH_CFI_MFR_MICRON :debug ("SF: QEB is volatile for %02x flash\n" ,JEDEC_MFR (info));return 0 ;#endif
@@ -1183,6 +1184,7 @@ int spi_flash_scan(struct spi_flash *flash)#if defined(CONFIG_SPI_FLASH_STMICRO ) || defined(CONFIG_SPI_FLASH_SST )/* NOR protection support for STmicro/Micron chips and similar */ if (JEDEC_MFR (info) ==SPI_FLASH_CFI_MFR_STMICRO || +JEDEC_MFR (info) ==SPI_FLASH_CFI_MFR_MICRON ||JEDEC_MFR (info) ==SPI_FLASH_CFI_MFR_SST ) { flash->flash_lock = stm_lock; flash->flash_unlock = stm_unlock;
Signature · 1 line
2.17.1
PATCH 1/1 driver/spi: Add FSPI driver for NXP FlexSPI controller
Add nxp_fspi driver for NXP FlexSPI controller.
This driver supports both IP Mode read/write and
AHB mode READ.
It supports Single Bit mode read along with Fast Read cmd support. Octal bit mode is supported for read.
Multi CS are supported tested until 4.
--- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 10 + drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/nxp_fspi.c | 1088 +++++++++++++++++++++ drivers/spi/nxp_fspi.h | 422 ++++++++ 5 files changed, 1528 insertions(+) create mode 100644 drivers/spi/nxp_fspi.c create mode 100644 drivers/spi/nxp_fspi.h
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +10 -0
@@ -317,6 +317,16 @@ config QSPI_AHB_INIT But some QSPI flash size up to 64MBytes, so initialize the QSPI AHB bus for those flashes to support the full QSPI flash size. +config SYS_FSPI_AHB_INIT + bool "Initialize the FlexSPI controller for AHB mode" + depends on NXP_FSPI + default n + help + Initialize the FlexSPI controller for AHB mode and mark default + read mode as AHB mode. In AHB mode, direct memory copying is + performed. Default LUT programmed in AHB mode is Fast Read command + with 4-byte addressing enabled. + config SYS_CCI400_OFFSET hex "Offset for CCI400 base" depends on SYS_FSL_HAS_CCI400
drivers/spi/Kconfig +7 -0
@@ -242,6 +242,13 @@ config ZYNQMP_GQSPI This option is used to enable ZynqMP QSPI controller driver which is used to communicate with qspi flash devices. +config NXP_FSPI + bool "NXP FLEXSPI driver" + help + Enable the NXP Flex-SPI (FSPI) driver. This driver can be used to + access SPI NOR flash on platforms embedding this NXP IP code. + This driver support SPI flash read, write and erase. + endif # if DM_SPI config SOFT_SPI
drivers/spi/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o obj-$(CONFIG_FSL_ESPI) += fsl_espi.o obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o +obj-$(CONFIG_NXP_FSPI) += nxp_fspi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
drivers/spi/nxp_fspi.c new file +1088 -0
1,088 lines not on this page · raw message
drivers/spi/nxp_fspi.h new file +422 -0
422 lines not on this page · raw message
Signature · 1 line
2.17.1
[U-Boot] driver/spi: Add FSPI driver for NXP FlexSPI controller
Quoted 12 lines · Ashish Kumar
Add
nxp_fspidriver for NXP FlexSPI controller.
This driver supports both IP Mode read/write and
AHB mode READ.It supports Single Bit mode read along with Fast Read cmd support. Octal bit mode is supported for read.
Multi CS are supported tested until 4.Signed-off-by Suresh Gupta <[email protected]>Signed-off-by Yogesh Gaur <[email protected]>Signed-off-by Rajat Srivastava <[email protected]>Signed-off-by Ashish Kumar <[email protected]>
Quoted 9 lines
--- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 10 + drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/nxp_fspi.c | 1088 +++++++++++++++++++++ drivers/spi/nxp_fspi.h | 422 ++++++++ 5 files changed, 1528 insertions(+) create mode 100644 drivers/spi/nxp_fspi.c create mode 100644 drivers/spi/nxp_fspi.h
Jagan,
I don't see any comment on this patch. Please review. This patch blocks SoC and board patches in my queue.
York
PATCH 1/1 driver/spi: Add FSPI driver for NXP FlexSPI controller
In reply to Ashish KumarQuoted 146 lines · Ashish Kumar
Add
nxp_fspidriver for NXP FlexSPI controller.
This driver supports both IP Mode read/write and
AHB mode READ.It supports Single Bit mode read along with Fast Read cmd support. Octal bit mode is supported for read.
Multi CS are supported tested until 4.Signed-off-by Suresh Gupta <[email protected]>Signed-off-by Yogesh Gaur <[email protected]>Signed-off-by Rajat Srivastava <[email protected]>Signed-off-by Ashish Kumar <[email protected]>--- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 10 + drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/nxp_fspi.c | 1088 +++++++++++++++++++++ drivers/spi/nxp_fspi.h | 422 ++++++++ 5 files changed, 1528 insertions(+) create mode 100644 drivers/spi/nxp_fspi.c create mode 100644 drivers/spi/nxp_fspi.harch/arm/cpu/armv8/fsl-layerscape/Kconfig +10
-0@@ -317,6 +317,16 @@ config QSPI_AHB_INIT But some QSPI flash size up to 64MBytes, so initialize the QSPI AHB bus for those flashes to support the full QSPI flash size. +config SYS_FSPI_AHB_INIT + bool "Initialize the FlexSPI controller for AHB mode" + depends on NXP_FSPI + default n + help + Initialize the FlexSPI controller for AHB mode and mark default + read mode as AHB mode. In AHB mode, direct memory copying is + performed. Default LUT programmed in AHB mode is Fast Read command + with 4-byte addressing enabled. + config SYS_CCI400_OFFSET hex "Offset for CCI400 base" depends on SYS_FSL_HAS_CCI400drivers/spi/Kconfig +7
-0@@ -242,6 +242,13 @@ config ZYNQMP_GQSPI This option is used to enable ZynqMP QSPI controller driver which is used to communicate with qspi flash devices. +config NXP_FSPI + bool "NXP FLEXSPI driver" + help + Enable the NXP Flex-SPI (FSPI) driver. This driver can be used to + access SPI NOR flash on platforms embedding this NXP IP code. + This driver support SPI flash read, write and erase. + endif # if DM_SPI config SOFT_SPIdrivers/spi/Makefile +1
-0@@ -27,6 +27,7 @@ obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o obj-$(CONFIG_FSL_ESPI) += fsl_espi.o obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o +obj-$(CONFIG_NXP_FSPI) += nxp_fspi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.odrivers/spi/nxp_fspi.c new file +66
-0@@ -0,0 +1,1088 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2018 NXP +* +* NXP Flex Serial Peripheral Interface (FSPI) driver +*/ + +#include <common.h> +#include <malloc.h> +#include <spi.h> +#include <asm/io.h> +#include <linux/sizes.h> +#include <dm.h> +#include <errno.h> +#include "nxp_fspi.h" + +DECLARE_GLOBAL_DATA_PTR ; + +/* default SCK frequency, unit: HZ */ +#define NXP_FSPI_DEFAULT_SCK_FREQ 50000000 + +/* FSPI max chipselect signals number */ +#define NXP_FSPI_MAX_CHIPSELECT_NUM 4 + +#define NXP_FSPI_MAX_TIMEOUT_AHBCMD 0xFF +#define NXP_FSPI_MAX_TIMEOUT_IPCMD 0xFF +#define NXP_FSPI_SER_CLK_DIV 0x00 + +#define FSPI_FLAG_REGMAP_ENDIAN_BIG BIT(0) + +#define FSPI_RX_MAX_IPBUF_SIZE 0x200/* 64 * 64bits */ +#define FSPI_TX_MAX_IPBUF_SIZE 0x400/* 128 * 64bits */ +#define FSPI_RX_MAX_AHBBUF_SIZE 0x800/* 256 * 64bits */ +#define FSPI_TX_MAX_AHBBUF_SIZE 0x40/* 8 * 64bits */ + +#define TX_IPBUF_SIZE FSPI_TX_MAX_IPBUF_SIZE +#define RX_IPBUF_SIZE FSPI_RX_MAX_IPBUF_SIZE +#define RX_AHBBUF_SIZE FSPI_RX_MAX_AHBBUF_SIZE +#define TX_AHBBUF_SIZE FSPI_TX_MAX_AHBBUF_SIZE + +/* SEQID */ +#define SEQID_READ 0 +#define SEQID_WREN 1 +#define SEQID_FAST_READ 2 +#define SEQID_RDSR 3 +#define SEQID_SE 4 +#define SEQID_CHIP_ERASE 5 +#define SEQID_PP 6 +#define SEQID_RDID 7 +#define SEQID_BE_4K 8 +#define SEQID_RDFSR 9 +#define SEQID_ENTR4BYTE 10 +#define SEQID_OCTAL_READ 11 + +/* FSPI CMD */ +#define FSPI_CMD_PP 0x02/* Page program (up to 256 bytes) */ +#define FSPI_CMD_RDSR 0x05/* Read status register */ +#define FSPI_CMD_RDFSR 0x70/* Read flag status register */ +#define FSPI_CMD_WREN 0x06/* Write enable */ +#define FSPI_CMD_READ 0x03/* Read data bytes */ +#define FSPI_CMD_FAST_READ 0x0b/* Read data bytes (high frequency) */ +#define FSPI_CMD_OCTAL_READ 0x8b/* Octal Read (CMD-ADDR-DATA : 1-1-8) */ +#define FSPI_CMD_BE_4K 0x20/* 4K erase */ +#define FSPI_CMD_CHIP_ERASE 0xc7/* Erase whole flash chip */ +#define FSPI_CMD_SE 0xd8/* Sector erase (usually 64KiB) */ +#define FSPI_CMD_RDID 0x9f/* Read JEDEC ID */
drivers/spi/nxp_fspi.c line 76
Quoted 10 lines
drivers/spi/nxp_fspi.c new file +10
-0+ +#define FSPI_CMD_ENTR4BYTE 0xb7/* Enter 4-Byte Address Mode */ +#define FSPI_CMD_EXIT4BYTE 0xe9/* Exit 4-Byte Address Mode */ + +/* 4-byte address QSPI CMD - used on Spansion and some Macronix flashes */ +#define FSPI_CMD_FAST_READ_4B 0x0c/* Read data bytes (high frequency) */ +#define FSPI_CMD_OCTAL_READ_4B 0x7c/* Octal Read (CMD-ADDR-DATA : 1-1-8) */ +#define FSPI_CMD_PP_4B 0x12/* Page program (up to 256 bytes) */ +#define FSPI_CMD_BE_4K_4B 0x21/* 4K erase */ +#define FSPI_CMD_SE_4B 0xdc/* Sector erase (usually 64KiB) */
Why all these flash command here? I think this driver can make use of spi_mem_op better try that?
PATCH 1/1 driver/mtd: Add MICRON manufacturer id in spi framework
In reply to Ashish KumarQuoted 14 lines · Ashish Kumar
Signed-off-by Suresh Gupta <[email protected]>Signed-off-by Yogesh Gaur <[email protected]>Signed-off-by Ashish Kumar <[email protected]>--- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/spi_flash.c | 2 ++ 2 files changed, 3 insertions(+)drivers/mtd/spi/sf_internal.h +0
-0
drivers/mtd/spi/sf_internal.h enum spi_nor_option_flags { · line 35
Quoted 4 lines
drivers/mtd/spi/sf_internal.h +1
-0@@ -32,6 +32,7 @@ enum spi_nor_option_flags {/* CFI Manufacture ID's */ #define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_STMICRO 0x20 +#define SPI_FLASH_CFI_MFR_MICRON 0x2C
Why we need this? is it to support old micron chips?
PATCH 1/1 driver/mtd: Add MICRON manufacturer id in spi framework
Quoted 21 lines
-----Original Message-----
From: Jagan Teki <[email protected]>
Sent: Wednesday, October 10, 2018 11:51 AM
To: Ashish Kumar <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Jagan Teki <[email protected]>; Rajat Srivastava <[email protected]>; Suresh Gupta <[email protected]>
Subject: Re: [U-Boot] [PATCH] driver/mtd: Add MICRON manufacturer id in spi frameworkQuoted 9 lines · Ashish Kumar
Signed-off-by Suresh Gupta <[email protected]>Signed-off-by Yogesh Gaur <[email protected]>Signed-off-by Ashish Kumar <[email protected]>--- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/spi_flash.c | 2 ++ 2 files changed, 3 insertions(+)
Quoted 11 lines
drivers/mtd/spi/sf_internal.h enum spi_nor_option_flags { · line 35
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/mtd/spi/sf_internal.hindex4f63cacc64..26f5c7c995100644drivers/mtd/spi/sf_internal.h +1
-0@@ -32,6 +32,7 @@ enum spi_nor_option_flags {/* CFI Manufacture ID's */ #define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_STMICRO 0x20 +#define SPI_FLASH_CFI_MFR_MICRON 0x2CWhy we need this? is it to support old micron chips?
NOR flash name MT35X_QLKA and MT25Q_** used on NXP board has manufacturer id as 0x2C, which are rather for newer flashes after the split of Micron from ST.
Regards
Ashish
PATCH 1/1 driver/mtd: Add MICRON manufacturer id in spi framework
Hi Jagan,
Quoted 44 lines
-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Ashish Kumar
Sent: Wednesday, October 10, 2018 4:23 PM
To: Jagan Teki <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Jagan Teki <[email protected]>; Rajat Srivastava <[email protected]>; Suresh Gupta <[email protected]>
Subject: Re: [U-Boot] [PATCH] driver/mtd: Add MICRON manufacturer id in spi frameworkQuoted 21 lines
-----Original Message-----
From: Jagan Teki <[email protected]>
Sent: Wednesday, October 10, 2018 11:51 AM
To: Ashish Kumar <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Jagan Teki <[email protected]>; Rajat Srivastava <[email protected]>; Suresh Gupta <[email protected]>
Subject: Re: [U-Boot] [PATCH] driver/mtd: Add MICRON manufacturer id in spi frameworkQuoted 9 lines · Ashish Kumar
Signed-off-by Suresh Gupta <[email protected]>Signed-off-by Yogesh Gaur <[email protected]>Signed-off-by Ashish Kumar <[email protected]>--- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/spi_flash.c | 2 ++ 2 files changed, 3 insertions(+)Quoted 11 lines
drivers/mtd/spi/sf_internal.h enum spi_nor_option_flags { · line 35
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/mtd/spi/sf_internal.hindex4f63cacc64..26f5c7c995100644drivers/mtd/spi/sf_internal.h +1
-0@@ -32,6 +32,7 @@ enum spi_nor_option_flags {/* CFI Manufacture ID's */ #define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_STMICRO 0x20 +#define SPI_FLASH_CFI_MFR_MICRON 0x2CWhy we need this? is it to support old micron chips?
Quoted 4 lines
NOR flash name
MT35X_QLKAand MT25Q_** used on NXP board has manufacturer id as0x2C, which are rather for newer flashes after the split of Micron from ST.
Same is being discussed in Linux-mtd mailing list [1]. Public data sheet of MT35x flash can be checked at[2]
--
Regards
Yogesh Gaur.
[1] https://patchwork.ozlabs.org/patch/971439/
[2] https://www.micron.com/resource-details/0b74b806-bbf1-4c24-b07b-35e2799bb6ff
Quoted 11 lines
Regards
Ashish
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.de
nx.de%2Flistinfo%2Fu- boot&data=02%7C01%7Cyogeshnarayan.gaur%40nxp.com%7Cd2c8d343b b8646a75c1b08d62e9eabc3%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C636747656373729732&sdata=58px6wLL96jaImJ6MGXC6rRHiXO3oe sj1EFfCrEmoGY%3D&reserved=0
PATCH 1/1 driver/mtd: Add MICRON manufacturer id in spi framework
In reply to Ashish KumarQuoted 4 lines · Ashish Kumar
Quoted 1 line
Signed-off-by Suresh Gupta <[email protected]>Signed-off-by Yogesh Gaur <[email protected]>Signed-off-by Ashish Kumar <[email protected]>---
Applied to u-boot-spi/master