arch/arm64/src/imx9: Add an mtd driver for NOR flash on FlexSPI interface

This is an initial FlexSPI SPI NOR MTD driver for IMX9

This supprts M25P SPI NOR on FlexSPI for now, and can later be extended to other
SPINOR devices if needed. The following configurations are needed to use this driver:
  CONFIG_IMX9_FLEXSPI_NOR=y
  CONFIG_MTD_M25P=y

In addition, board initialization logic needs to call the imx9_flexspi_nor_initialize
to receive a pointer to the mtd device.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Co-authored-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
This commit is contained in:
Jukka Laitinen 2024-07-03 15:27:44 +03:00 committed by archer
parent 31a6a4f5d0
commit 31644ec0f5
4 changed files with 1172 additions and 0 deletions

View File

@ -250,6 +250,10 @@ config IMX9_FLEXSPI
bool "ENABLE FLEXSPI interface"
default n
config IMX9_FLEXSPI_NOR
bool "Enable NOR flash on FLEXSPI interface"
select IMX9_FLEXSPI
default n
config IMX9_FLEXIO1_PWM
depends on PWM

View File

@ -71,3 +71,7 @@ endif
ifeq ($(CONFIG_IMX9_FLEXSPI), y)
CHIP_CSRCS += imx9_flexspi.c
endif
ifeq ($(CONFIG_IMX9_FLEXSPI_NOR), y)
CHIP_CSRCS += imx9_flexspi_nor.c
endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
/****************************************************************************
* arch/arm64/src/imx9/imx9_flexspi_nor.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM64_SRC_IMX9_IMX9_FLEXSPI_NOR_H
#define __ARCH_ARM64_SRC_IMX9_IMX9_FLEXSPI_NOR_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/mtd/mtd.h>
#ifdef CONFIG_IMX9_FLEXSPI_NOR
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Inline Functions
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: imx9_flexspi_nor_initialize
*
* Description:
* Initialize a NOR FLASH on FlexSPI interface
*
* Input Parameters:
* intf: FlexSPI interface number
*
* Returned Value:
* Pointer to an mtd device, NULL on any error
*
****************************************************************************/
struct mtd_dev_s *imx9_flexspi_nor_initialize(int intf);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_IMX9_FLEXSPI_NOR */
#endif /* __ARCH_ARM_SRC_IMX9_IMX9_FLEXSPI_NOR_H */