imxrt: FlexSPI allow RWW
This commit is contained in:
parent
2886fddc0f
commit
430c79ff89
4 changed files with 92 additions and 0 deletions
|
@ -1871,12 +1871,28 @@ menuconfig IMXRT_FLEXSPI1
|
||||||
default n
|
default n
|
||||||
select IMXRT_FLEXSPI
|
select IMXRT_FLEXSPI
|
||||||
|
|
||||||
|
menuconfig IMXRT_FLEXSPI1_XIP
|
||||||
|
bool "FLEXSPI1 is used for XIP"
|
||||||
|
default n
|
||||||
|
depends on IMXRT_FLEXSPI1
|
||||||
|
---help---
|
||||||
|
FlexSPI1 is used as XIP thus already
|
||||||
|
initialized by the bootloader
|
||||||
|
|
||||||
menuconfig IMXRT_FLEXSPI2
|
menuconfig IMXRT_FLEXSPI2
|
||||||
bool "FLEXSPI2"
|
bool "FLEXSPI2"
|
||||||
default n
|
default n
|
||||||
select IMXRT_FLEXSPI
|
select IMXRT_FLEXSPI
|
||||||
depends on IMXRT_HAVE_FLEXSPI2
|
depends on IMXRT_HAVE_FLEXSPI2
|
||||||
|
|
||||||
|
menuconfig IMXRT_FLEXSPI2_XIP
|
||||||
|
bool "FLEXSPI2 is used for XIP"
|
||||||
|
default n
|
||||||
|
depends on IMXRT_FLEXSPI2
|
||||||
|
---help---
|
||||||
|
FlexSPI2 is used as XIP thus already
|
||||||
|
initialized by the bootloader
|
||||||
|
|
||||||
endmenu # FLEXSPI Peripherals
|
endmenu # FLEXSPI Peripherals
|
||||||
|
|
||||||
menu "ADC Peripherals"
|
menu "ADC Peripherals"
|
||||||
|
|
|
@ -83,6 +83,8 @@ static int imxrt_flexspi_lock(struct flexspi_dev_s *dev, bool lock);
|
||||||
static int imxrt_flexspi_transfer_blocking(struct flexspi_dev_s *dev,
|
static int imxrt_flexspi_transfer_blocking(struct flexspi_dev_s *dev,
|
||||||
struct flexspi_transfer_s *xfer);
|
struct flexspi_transfer_s *xfer);
|
||||||
static void imxrt_flexspi_software_reset(struct flexspi_dev_s *dev);
|
static void imxrt_flexspi_software_reset(struct flexspi_dev_s *dev);
|
||||||
|
static void imxrt_flexspi_configure_prefetch(struct flexspi_dev_s *dev,
|
||||||
|
bool enable);
|
||||||
static void imxrt_flexspi_update_lut(struct flexspi_dev_s *dev,
|
static void imxrt_flexspi_update_lut(struct flexspi_dev_s *dev,
|
||||||
uint32_t index,
|
uint32_t index,
|
||||||
const uint32_t *cmd,
|
const uint32_t *cmd,
|
||||||
|
@ -102,6 +104,7 @@ static const struct flexspi_ops_s g_flexspi0ops =
|
||||||
.lock = imxrt_flexspi_lock,
|
.lock = imxrt_flexspi_lock,
|
||||||
.transfer_blocking = imxrt_flexspi_transfer_blocking,
|
.transfer_blocking = imxrt_flexspi_transfer_blocking,
|
||||||
.software_reset = imxrt_flexspi_software_reset,
|
.software_reset = imxrt_flexspi_software_reset,
|
||||||
|
.configure_prefetch = imxrt_flexspi_configure_prefetch,
|
||||||
.update_lut = imxrt_flexspi_update_lut,
|
.update_lut = imxrt_flexspi_update_lut,
|
||||||
.set_device_config = imxrt_flexspi_set_device_config,
|
.set_device_config = imxrt_flexspi_set_device_config,
|
||||||
};
|
};
|
||||||
|
@ -118,6 +121,9 @@ static struct imxrt_flexspidev_s g_flexspi0dev =
|
||||||
},
|
},
|
||||||
.base = (struct flexspi_type_s *)IMXRT_FLEXSPIC_BASE,
|
.base = (struct flexspi_type_s *)IMXRT_FLEXSPIC_BASE,
|
||||||
.lock = NXMUTEX_INITIALIZER,
|
.lock = NXMUTEX_INITIALIZER,
|
||||||
|
#ifdef CONFIG_IMXRT_FLEXSPI1_XIP
|
||||||
|
.initialized = true,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,6 +137,9 @@ static struct imxrt_flexspidev_s g_flexspi1dev =
|
||||||
.ops = &g_flexspi0ops,
|
.ops = &g_flexspi0ops,
|
||||||
},
|
},
|
||||||
.base = (struct flexspi_type_s *) IMXRT_FLEXSPI2C_BASE,
|
.base = (struct flexspi_type_s *) IMXRT_FLEXSPI2C_BASE,
|
||||||
|
#ifdef CONFIG_IMXRT_FLEXSPI2_XIP
|
||||||
|
.initialized = true,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -330,6 +339,31 @@ static inline void imxrt_flexspi_software_reset_private(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Configure FLEXSPI preftech.
|
||||||
|
*
|
||||||
|
* This function enables/disabled the prefetcher
|
||||||
|
* Which is needed to do RWW see NXP AN12564
|
||||||
|
*
|
||||||
|
* @param base FLEXSPI peripheral base address.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline void imxrt_flexspi_configure_prefetch_private(
|
||||||
|
struct flexspi_type_s *base, bool enable)
|
||||||
|
{
|
||||||
|
uint32_t config_value = base->AHBCR;
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
config_value |= FLEXSPI_AHBCR_PREFETCHEN(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_value &= ~FLEXSPI_AHBCR_PREFETCHEN(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
base->AHBCR = config_value;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns whether the bus is idle.
|
/* Returns whether the bus is idle.
|
||||||
*
|
*
|
||||||
* @param base FLEXSPI peripheral base address.
|
* @param base FLEXSPI peripheral base address.
|
||||||
|
@ -1173,6 +1207,29 @@ static void imxrt_flexspi_software_reset(struct flexspi_dev_s *dev)
|
||||||
imxrt_flexspi_software_reset_private(priv->base);
|
imxrt_flexspi_software_reset_private(priv->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: imxrt_flexspi_configure_prefetch
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configures prefetch
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* dev - Device-specific state data
|
||||||
|
* enable - Enable prefetch
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void imxrt_flexspi_configure_prefetch(struct flexspi_dev_s *dev,
|
||||||
|
bool enable)
|
||||||
|
{
|
||||||
|
struct imxrt_flexspidev_s *priv = (struct imxrt_flexspidev_s *)dev;
|
||||||
|
|
||||||
|
imxrt_flexspi_configure_prefetch_private(priv->base, enable);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: imxrt_flexspi_update_lut
|
* Name: imxrt_flexspi_update_lut
|
||||||
*
|
*
|
||||||
|
|
|
@ -127,6 +127,23 @@
|
||||||
|
|
||||||
#define FLEXSPI_TRANSFER(d,x) (d)->ops->transfer_blocking(d,x)
|
#define FLEXSPI_TRANSFER(d,x) (d)->ops->transfer_blocking(d,x)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: FLEXSPI_CONFIGURE_PREFTECH
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Enable / disable prefetch
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* dev - Device-specific state data
|
||||||
|
* enable - Enable prefetch
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* none
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define FLEXSPI_CONFIGURE_PREFETCH(d,e) (d)->ops->configure_prefetch(d,e)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: FLEXSPI_SOFTWARE_RESET
|
* Name: FLEXSPI_SOFTWARE_RESET
|
||||||
*
|
*
|
||||||
|
@ -508,6 +525,7 @@ struct flexspi_ops_s
|
||||||
int (*transfer_blocking)(struct flexspi_dev_s *dev,
|
int (*transfer_blocking)(struct flexspi_dev_s *dev,
|
||||||
struct flexspi_transfer_s *xfer);
|
struct flexspi_transfer_s *xfer);
|
||||||
void (*software_reset)(struct flexspi_dev_s *dev);
|
void (*software_reset)(struct flexspi_dev_s *dev);
|
||||||
|
void (*configure_prefetch)(struct flexspi_dev_s *dev, bool enable);
|
||||||
void (*update_lut)(struct flexspi_dev_s *dev,
|
void (*update_lut)(struct flexspi_dev_s *dev,
|
||||||
uint32_t index, const uint32_t *cmd,
|
uint32_t index, const uint32_t *cmd,
|
||||||
uint32_t count);
|
uint32_t count);
|
||||||
|
|
|
@ -259,6 +259,7 @@
|
||||||
#define imxrt_clockrun_flexram() imxrt_periphclk_configure(CCM_CCGR_FLEXRAM, CCM_CG_RUN)
|
#define imxrt_clockrun_flexram() imxrt_periphclk_configure(CCM_CCGR_FLEXRAM, CCM_CG_RUN)
|
||||||
#ifndef CONFIG_ARCH_FAMILY_IMXRT117x
|
#ifndef CONFIG_ARCH_FAMILY_IMXRT117x
|
||||||
# define imxrt_clockrun_flexspi() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI, CCM_CG_RUN)
|
# define imxrt_clockrun_flexspi() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI, CCM_CG_RUN)
|
||||||
|
# define imxrt_clockrun_flexspi2() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI2, CCM_CG_RUN)
|
||||||
#else
|
#else
|
||||||
# define imxrt_clockrun_flexspi() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI1, CCM_CG_RUN)
|
# define imxrt_clockrun_flexspi() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI1, CCM_CG_RUN)
|
||||||
# define imxrt_clockrun_flexspi2() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI2, CCM_CG_RUN)
|
# define imxrt_clockrun_flexspi2() imxrt_periphclk_configure(CCM_CCGR_FLEXSPI2, CCM_CG_RUN)
|
||||||
|
|
Loading…
Reference in a new issue