mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
Cosmetic changes from review of last PR
This commit is contained in:
@@ -45,10 +45,6 @@
|
|||||||
|
|
||||||
.file "arm_restorefpu.S"
|
.file "arm_restorefpu.S"
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Symbols
|
* Public Symbols
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|||||||
@@ -42,28 +42,12 @@
|
|||||||
|
|
||||||
.file "arm_saveusercontext.S"
|
.file "arm_saveusercontext.S"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Symbols
|
* Public Symbols
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
.globl up_saveusercontext
|
.globl up_saveusercontext
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -48,12 +48,12 @@
|
|||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
/* General Characteristics **************************************************************/
|
/* General Characteristics **************************************************************/
|
||||||
|
|
||||||
#define STM32L4_QSPI_MINBITS 8 /* Minimum word width */
|
#define STM32L4_QSPI_MINBITS 8 /* Minimum word width */
|
||||||
#define STM32L4_QSPI_MAXBITS 32 /* Maximum word width */
|
#define STM32L4_QSPI_MAXBITS 32 /* Maximum word width */
|
||||||
|
|
||||||
|
|
||||||
/* QSPI register offsets ****************************************************************/
|
/* QSPI register offsets ****************************************************************/
|
||||||
|
|
||||||
#define STM32L4_QUADSPI_CR_OFFSET 0x0000 /* Control Register */
|
#define STM32L4_QUADSPI_CR_OFFSET 0x0000 /* Control Register */
|
||||||
|
|||||||
@@ -77,8 +77,7 @@
|
|||||||
|
|
||||||
#define MEMORY_SYNC() do { ARM_DSB(); ARM_ISB(); } while (0)
|
#define MEMORY_SYNC() do { ARM_DSB(); ARM_ISB(); } while (0)
|
||||||
|
|
||||||
/* Ensure that the DMA buffers are word-aligned.
|
/* Ensure that the DMA buffers are word-aligned. */
|
||||||
*/
|
|
||||||
|
|
||||||
#define ALIGN_SHIFT 2
|
#define ALIGN_SHIFT 2
|
||||||
#define ALIGN_MASK 3
|
#define ALIGN_MASK 3
|
||||||
@@ -134,7 +133,8 @@
|
|||||||
#undef QSPI_USE_INTERRUPTS
|
#undef QSPI_USE_INTERRUPTS
|
||||||
#undef CONFIG_STM32L4_QSPI_DMA
|
#undef CONFIG_STM32L4_QSPI_DMA
|
||||||
|
|
||||||
/* sanity check that board.h defines requisite QSPI pinmap options for */
|
/* Sanity check that board.h defines requisite QSPI pinmap options for */
|
||||||
|
|
||||||
#if (!defined(GPIO_QSPI_CS) || !defined(GPIO_QSPI_IO0) || !defined(GPIO_QSPI_IO1) || \
|
#if (!defined(GPIO_QSPI_CS) || !defined(GPIO_QSPI_IO0) || !defined(GPIO_QSPI_IO1) || \
|
||||||
!defined(GPIO_QSPI_IO2) || !defined(GPIO_QSPI_IO3) || !defined(GPIO_QSPI_SCK))
|
!defined(GPIO_QSPI_IO2) || !defined(GPIO_QSPI_IO3) || !defined(GPIO_QSPI_SCK))
|
||||||
# error you must define QSPI pinmapping options for GPIO_QSPI_CS GPIO_QSPI_IO0 \
|
# error you must define QSPI pinmapping options for GPIO_QSPI_CS GPIO_QSPI_IO0 \
|
||||||
@@ -231,7 +231,6 @@ struct qspi_xctnspec_s
|
|||||||
uint32_t issioo; /* true if 'send instruction only once' mode */
|
uint32_t issioo; /* true if 'send instruction only once' mode */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -322,10 +321,6 @@ static struct stm32l4_qspidev_s g_qspi0dev =
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -603,14 +598,17 @@ static int qspi_setupxctnfromcmd(struct qspi_xctnspec_s *xctn,
|
|||||||
DEBUGASSERT(cmdinfo->cmd < 256);
|
DEBUGASSERT(cmdinfo->cmd < 256);
|
||||||
|
|
||||||
/* Specify the instruction as per command info */
|
/* Specify the instruction as per command info */
|
||||||
|
|
||||||
/* XXX III instruction mode, single dual quad option bits */
|
/* XXX III instruction mode, single dual quad option bits */
|
||||||
|
|
||||||
xctn->instrmode = CCR_IMODE_SINGLE;
|
xctn->instrmode = CCR_IMODE_SINGLE;
|
||||||
xctn->instr = cmdinfo->cmd;
|
xctn->instr = cmdinfo->cmd;
|
||||||
|
|
||||||
/* XXX III option bits for 'send instruction only once' */
|
/* XXX III option bits for 'send instruction only once' */
|
||||||
|
|
||||||
xctn->issioo = 0;
|
xctn->issioo = 0;
|
||||||
|
|
||||||
/* XXX III options for alt bytes, dummy cycles */
|
/* XXX III options for alt bytes, dummy cycles */
|
||||||
|
|
||||||
xctn->altbytesmode = CCR_ABMODE_NONE;
|
xctn->altbytesmode = CCR_ABMODE_NONE;
|
||||||
xctn->altbytessize = CCR_ABSIZE_8;
|
xctn->altbytessize = CCR_ABSIZE_8;
|
||||||
xctn->altbytes = 0;
|
xctn->altbytes = 0;
|
||||||
@@ -621,6 +619,7 @@ static int qspi_setupxctnfromcmd(struct qspi_xctnspec_s *xctn,
|
|||||||
if (QSPICMD_ISADDRESS(cmdinfo->flags))
|
if (QSPICMD_ISADDRESS(cmdinfo->flags))
|
||||||
{
|
{
|
||||||
/* XXX III address mode mode, single, dual, quad option bits */
|
/* XXX III address mode mode, single, dual, quad option bits */
|
||||||
|
|
||||||
xctn->addrmode = CCR_ADMODE_SINGLE;
|
xctn->addrmode = CCR_ADMODE_SINGLE;
|
||||||
if (cmdinfo->addrlen == 1)
|
if (cmdinfo->addrlen == 1)
|
||||||
{
|
{
|
||||||
@@ -642,6 +641,7 @@ static int qspi_setupxctnfromcmd(struct qspi_xctnspec_s *xctn,
|
|||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
xctn->addr = cmdinfo->addr;
|
xctn->addr = cmdinfo->addr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -657,9 +657,12 @@ static int qspi_setupxctnfromcmd(struct qspi_xctnspec_s *xctn,
|
|||||||
if (QSPICMD_ISDATA(cmdinfo->flags))
|
if (QSPICMD_ISDATA(cmdinfo->flags))
|
||||||
{
|
{
|
||||||
/* XXX III data mode mode, single, dual, quad option bits */
|
/* XXX III data mode mode, single, dual, quad option bits */
|
||||||
|
|
||||||
xctn->datamode = CCR_DMODE_SINGLE;
|
xctn->datamode = CCR_DMODE_SINGLE;
|
||||||
xctn->datasize = cmdinfo->buflen;
|
xctn->datasize = cmdinfo->buflen;
|
||||||
|
|
||||||
/* XXX III double data rate option bits */
|
/* XXX III double data rate option bits */
|
||||||
|
|
||||||
xctn->isddr = 0;
|
xctn->isddr = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -707,12 +710,16 @@ static int qspi_setupxctnfrommem(struct qspi_xctnspec_s *xctn,
|
|||||||
/* Specify the instruction as per command info */
|
/* Specify the instruction as per command info */
|
||||||
|
|
||||||
/* XXX III instruction mode, single dual quad option bits */
|
/* XXX III instruction mode, single dual quad option bits */
|
||||||
|
|
||||||
xctn->instrmode = CCR_IMODE_SINGLE;
|
xctn->instrmode = CCR_IMODE_SINGLE;
|
||||||
xctn->instr = meminfo->cmd;
|
xctn->instr = meminfo->cmd;
|
||||||
|
|
||||||
/* XXX III option bits for 'send instruction only once' */
|
/* XXX III option bits for 'send instruction only once' */
|
||||||
|
|
||||||
xctn->issioo = 0;
|
xctn->issioo = 0;
|
||||||
|
|
||||||
/* XXX III options for alt bytes */
|
/* XXX III options for alt bytes */
|
||||||
|
|
||||||
xctn->altbytesmode = CCR_ABMODE_NONE;
|
xctn->altbytesmode = CCR_ABMODE_NONE;
|
||||||
xctn->altbytessize = CCR_ABSIZE_8;
|
xctn->altbytessize = CCR_ABSIZE_8;
|
||||||
xctn->altbytes = 0;
|
xctn->altbytes = 0;
|
||||||
@@ -721,13 +728,22 @@ static int qspi_setupxctnfrommem(struct qspi_xctnspec_s *xctn,
|
|||||||
|
|
||||||
/* Specify the address size as needed */
|
/* Specify the address size as needed */
|
||||||
|
|
||||||
/* XXX III there should be a separate flags for single/dual/quad for each of i,a,d */
|
/* XXX III there should be a separate flags for single/dual/quad for each
|
||||||
|
* of i,a,d
|
||||||
|
*/
|
||||||
|
|
||||||
if (QSPIMEM_ISDUALIO(meminfo->flags))
|
if (QSPIMEM_ISDUALIO(meminfo->flags))
|
||||||
|
{
|
||||||
xctn->addrmode = CCR_ADMODE_DUAL;
|
xctn->addrmode = CCR_ADMODE_DUAL;
|
||||||
|
}
|
||||||
else if (QSPIMEM_ISQUADIO(meminfo->flags))
|
else if (QSPIMEM_ISQUADIO(meminfo->flags))
|
||||||
|
{
|
||||||
xctn->addrmode = CCR_ADMODE_QUAD;
|
xctn->addrmode = CCR_ADMODE_QUAD;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
xctn->addrmode = CCR_ADMODE_SINGLE;
|
xctn->addrmode = CCR_ADMODE_SINGLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (meminfo->addrlen == 1)
|
if (meminfo->addrlen == 1)
|
||||||
{
|
{
|
||||||
@@ -749,23 +765,33 @@ static int qspi_setupxctnfrommem(struct qspi_xctnspec_s *xctn,
|
|||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
xctn->addr = meminfo->addr;
|
xctn->addr = meminfo->addr;
|
||||||
|
|
||||||
/* Specify the data as needed */
|
/* Specify the data as needed */
|
||||||
|
|
||||||
xctn->buffer = meminfo->buffer;
|
xctn->buffer = meminfo->buffer;
|
||||||
|
|
||||||
/* XXX III there should be a separate flags for single/dual/quad for each of i,a,d */
|
/* XXX III there should be a separate flags for single/dual/quad for each of i,a,d */
|
||||||
|
|
||||||
if (QSPIMEM_ISDUALIO(meminfo->flags))
|
if (QSPIMEM_ISDUALIO(meminfo->flags))
|
||||||
|
{
|
||||||
xctn->datamode = CCR_DMODE_DUAL;
|
xctn->datamode = CCR_DMODE_DUAL;
|
||||||
|
}
|
||||||
else if (QSPIMEM_ISQUADIO(meminfo->flags))
|
else if (QSPIMEM_ISQUADIO(meminfo->flags))
|
||||||
|
{
|
||||||
xctn->datamode = CCR_DMODE_QUAD;
|
xctn->datamode = CCR_DMODE_QUAD;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
xctn->datamode = CCR_DMODE_SINGLE;
|
xctn->datamode = CCR_DMODE_SINGLE;
|
||||||
|
}
|
||||||
|
|
||||||
xctn->datasize = meminfo->buflen;
|
xctn->datasize = meminfo->buflen;
|
||||||
/* XXX III double data rate option bits */
|
|
||||||
xctn->isddr = 0;
|
|
||||||
|
|
||||||
|
/* XXX III double data rate option bits */
|
||||||
|
|
||||||
|
xctn->isddr = 0;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,21 +848,21 @@ static void qspi_ccrconfig(struct stm32l4_qspidev_s *priv,
|
|||||||
{
|
{
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
/* if we have data, and it's not memory mapped, write the length */
|
/* If we have data, and it's not memory mapped, write the length */
|
||||||
|
|
||||||
if (CCR_DMODE_NONE != xctn->datamode && CCR_FMODE_MEMMAP != fctn)
|
if (CCR_DMODE_NONE != xctn->datamode && CCR_FMODE_MEMMAP != fctn)
|
||||||
{
|
{
|
||||||
qspi_putreg(priv, xctn->datasize-1, STM32L4_QUADSPI_DLR_OFFSET);
|
qspi_putreg(priv, xctn->datasize-1, STM32L4_QUADSPI_DLR_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we have alternate bytes, stick them in now */
|
/* If we have alternate bytes, stick them in now */
|
||||||
|
|
||||||
if (CCR_ABMODE_NONE != xctn->altbytesmode)
|
if (CCR_ABMODE_NONE != xctn->altbytesmode)
|
||||||
{
|
{
|
||||||
qspi_putreg(priv, xctn->altbytes, STM32L4_QUADSPI_ABR_OFFSET);
|
qspi_putreg(priv, xctn->altbytes, STM32L4_QUADSPI_ABR_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build the CCR value and set it */
|
/* Build the CCR value and set it */
|
||||||
|
|
||||||
regval = QSPI_CCR_INST(xctn->instr) |
|
regval = QSPI_CCR_INST(xctn->instr) |
|
||||||
QSPI_CCR_IMODE(xctn->instrmode) |
|
QSPI_CCR_IMODE(xctn->instrmode) |
|
||||||
@@ -851,7 +877,7 @@ static void qspi_ccrconfig(struct stm32l4_qspidev_s *priv,
|
|||||||
(xctn->issioo ? QSPI_CCR_DDRM : 0);
|
(xctn->issioo ? QSPI_CCR_DDRM : 0);
|
||||||
qspi_putreg(priv, regval, STM32L4_QUADSPI_CCR_OFFSET);
|
qspi_putreg(priv, regval, STM32L4_QUADSPI_CCR_OFFSET);
|
||||||
|
|
||||||
/* if we have and need and address, set that now, too */
|
/* If we have and need and address, set that now, too */
|
||||||
|
|
||||||
if (CCR_ADMODE_NONE != xctn->addrmode && CCR_FMODE_MEMMAP != fctn)
|
if (CCR_ADMODE_NONE != xctn->addrmode && CCR_FMODE_MEMMAP != fctn)
|
||||||
{
|
{
|
||||||
@@ -886,10 +912,11 @@ static int qspi_receive_blocking(struct stm32l4_qspidev_s *priv,
|
|||||||
addrval = qspi_getreg(priv, STM32L4_QUADSPI_AR_OFFSET);
|
addrval = qspi_getreg(priv, STM32L4_QUADSPI_AR_OFFSET);
|
||||||
if (dest != NULL)
|
if (dest != NULL)
|
||||||
{
|
{
|
||||||
/* counter of remaining data */
|
/* Counter of remaining data */
|
||||||
|
|
||||||
uint32_t remaining = xctn->datasize;
|
uint32_t remaining = xctn->datasize;
|
||||||
|
|
||||||
/* ensure CCR register specifies indirect read */
|
/* Ensure CCR register specifies indirect read */
|
||||||
|
|
||||||
regval = qspi_getreg(priv, STM32L4_QUADSPI_CCR_OFFSET);
|
regval = qspi_getreg(priv, STM32L4_QUADSPI_CCR_OFFSET);
|
||||||
regval &= ~QSPI_CCR_FMODE_MASK;
|
regval &= ~QSPI_CCR_FMODE_MASK;
|
||||||
@@ -900,7 +927,7 @@ static int qspi_receive_blocking(struct stm32l4_qspidev_s *priv,
|
|||||||
|
|
||||||
qspi_putreg(priv, addrval, STM32L4_QUADSPI_AR_OFFSET);
|
qspi_putreg(priv, addrval, STM32L4_QUADSPI_AR_OFFSET);
|
||||||
|
|
||||||
/* transfer loop */
|
/* Transfer loop */
|
||||||
|
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
@@ -920,7 +947,7 @@ static int qspi_receive_blocking(struct stm32l4_qspidev_s *priv,
|
|||||||
qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
|
qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
|
||||||
qspi_putreg(priv, QSPI_FCR_CTCF, STM32L4_QUADSPI_FCR);
|
qspi_putreg(priv, QSPI_FCR_CTCF, STM32L4_QUADSPI_FCR);
|
||||||
|
|
||||||
/* use Abort to clear the busy flag, and ditch any extra bytes in fifo */
|
/* Use Abort to clear the busy flag, and ditch any extra bytes in fifo */
|
||||||
|
|
||||||
regval = qspi_getreg(priv, STM32L4_QUADSPI_CR_OFFSET);
|
regval = qspi_getreg(priv, STM32L4_QUADSPI_CR_OFFSET);
|
||||||
regval |= QSPI_CR_ABORT;
|
regval |= QSPI_CR_ABORT;
|
||||||
@@ -960,10 +987,11 @@ static int qspi_transmit_blocking(struct stm32l4_qspidev_s *priv,
|
|||||||
|
|
||||||
if (src != NULL)
|
if (src != NULL)
|
||||||
{
|
{
|
||||||
/* counter of remaining data */
|
/* Counter of remaining data */
|
||||||
|
|
||||||
uint32_t remaining = xctn->datasize;
|
uint32_t remaining = xctn->datasize;
|
||||||
|
|
||||||
/* transfer loop */
|
/* Transfer loop */
|
||||||
|
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
@@ -982,7 +1010,7 @@ static int qspi_transmit_blocking(struct stm32l4_qspidev_s *priv,
|
|||||||
qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
|
qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
|
||||||
qspi_putreg(priv, QSPI_FCR_CTCF, STM32L4_QUADSPI_FCR);
|
qspi_putreg(priv, QSPI_FCR_CTCF, STM32L4_QUADSPI_FCR);
|
||||||
|
|
||||||
/* use Abort to cler the Busy flag */
|
/* Use Abort to cler the Busy flag */
|
||||||
|
|
||||||
regval = qspi_getreg(priv, STM32L4_QUADSPI_CR_OFFSET);
|
regval = qspi_getreg(priv, STM32L4_QUADSPI_CR_OFFSET);
|
||||||
regval |= QSPI_CR_ABORT;
|
regval |= QSPI_CR_ABORT;
|
||||||
@@ -1021,7 +1049,6 @@ static int qspi0_interrupt(int irq, void *context)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: qspi_lock
|
* Name: qspi_lock
|
||||||
*
|
*
|
||||||
@@ -1054,8 +1081,8 @@ static int qspi_lock(struct qspi_dev_s *dev, bool lock)
|
|||||||
|
|
||||||
while (sem_wait(&priv->exclsem) != 0)
|
while (sem_wait(&priv->exclsem) != 0)
|
||||||
{
|
{
|
||||||
/* The only case that an error should occur here is if the wait was awakened
|
/* The only case that an error should occur here is if the wait
|
||||||
* by a signal.
|
* was awakened by a signal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ASSERT(errno == EINTR);
|
ASSERT(errno == EINTR);
|
||||||
@@ -1083,6 +1110,7 @@ static int qspi_lock(struct qspi_dev_s *dev, bool lock)
|
|||||||
* Returns the actual frequency selected
|
* Returns the actual frequency selected
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/*XXX partial*/
|
/*XXX partial*/
|
||||||
static uint32_t qspi_setfrequency(struct qspi_dev_s *dev, uint32_t frequency)
|
static uint32_t qspi_setfrequency(struct qspi_dev_s *dev, uint32_t frequency)
|
||||||
{
|
{
|
||||||
@@ -1245,7 +1273,8 @@ static void qspi_setmode(struct qspi_dev_s *dev, enum qspi_mode_e mode)
|
|||||||
|
|
||||||
static void qspi_setbits(struct qspi_dev_s *dev, int nbits)
|
static void qspi_setbits(struct qspi_dev_s *dev, int nbits)
|
||||||
{
|
{
|
||||||
/* not meaningful for the STM32L4x6 */
|
/* Not meaningful for the STM32L4x6 */
|
||||||
|
|
||||||
if (8 != nbits)
|
if (8 != nbits)
|
||||||
{
|
{
|
||||||
qspivdbg("unsupported nbits=%d\n", nbits);
|
qspivdbg("unsupported nbits=%d\n", nbits);
|
||||||
@@ -1285,15 +1314,18 @@ static int qspi_command(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
/* Prepare for transaction */
|
/* Prepare for transaction */
|
||||||
|
|
||||||
/* wait 'till non-busy */
|
/* Wait 'till non-busy */
|
||||||
|
|
||||||
qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
|
qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
|
||||||
|
|
||||||
/* Clear flags */
|
/* Clear flags */
|
||||||
|
|
||||||
qspi_putreg(priv, QSPI_FCR_CTEF | QSPI_FCR_CTCF | QSPI_FCR_CSMF | QSPI_FCR_CTOF, STM32L4_QUADSPI_FCR);
|
qspi_putreg(priv, QSPI_FCR_CTEF | QSPI_FCR_CTCF | QSPI_FCR_CSMF | QSPI_FCR_CTOF,
|
||||||
|
STM32L4_QUADSPI_FCR);
|
||||||
|
|
||||||
/* XXX III this is for polling mode; support interrupt and dma modes also and 'autopolling' */
|
/* XXX III this is for polling mode; support interrupt and dma modes also
|
||||||
|
* and 'autopolling'
|
||||||
|
*/
|
||||||
|
|
||||||
/* Set up the Communications Configuration Register as per command info */
|
/* Set up the Communications Configuration Register as per command info */
|
||||||
|
|
||||||
@@ -1309,17 +1341,21 @@ static int qspi_command(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
if (QSPICMD_ISWRITE(cmdinfo->flags))
|
if (QSPICMD_ISWRITE(cmdinfo->flags))
|
||||||
{
|
{
|
||||||
/* XXX III we are going to do polling; revisit when we get interrupt and/or DMA up. */
|
/* XXX III we are going to do polling; revisit when we get
|
||||||
|
* interrupt and/or DMA up.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = qspi_transmit_blocking(priv, &xctn);
|
ret = qspi_transmit_blocking(priv, &xctn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* XXX III we are going to do polling; revisit when we get interrupt and/or DMA up. */
|
/* XXX III we are going to do polling; revisit when we get
|
||||||
|
* interrupt and/or DMA up.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = qspi_receive_blocking(priv, &xctn);
|
ret = qspi_receive_blocking(priv, &xctn);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMORY_SYNC();
|
MEMORY_SYNC();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1329,7 +1365,8 @@ static int qspi_command(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
/* XXX III this is for polling mode; support interrupt and dma modes also */
|
/* XXX III this is for polling mode; support interrupt and dma modes also */
|
||||||
|
|
||||||
/* wait for Transfer complete, and not busy */
|
/* Wait for Transfer complete, and not busy */
|
||||||
|
|
||||||
qspi_waitstatusflags(priv, QSPI_SR_TCF,1);
|
qspi_waitstatusflags(priv, QSPI_SR_TCF,1);
|
||||||
qspi_waitstatusflags(priv, QSPI_SR_BUSY,0);
|
qspi_waitstatusflags(priv, QSPI_SR_BUSY,0);
|
||||||
|
|
||||||
@@ -1368,15 +1405,18 @@ static int qspi_memory(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
/* Prepare for transaction */
|
/* Prepare for transaction */
|
||||||
|
|
||||||
/* wait 'till non-busy */
|
/* Wait 'till non-busy */
|
||||||
|
|
||||||
qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
|
qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
|
||||||
|
|
||||||
/* Clear flags */
|
/* Clear flags */
|
||||||
|
|
||||||
qspi_putreg(priv, QSPI_FCR_CTEF | QSPI_FCR_CTCF | QSPI_FCR_CSMF | QSPI_FCR_CTOF, STM32L4_QUADSPI_FCR);
|
qspi_putreg(priv, QSPI_FCR_CTEF | QSPI_FCR_CTCF | QSPI_FCR_CSMF | QSPI_FCR_CTOF,
|
||||||
|
STM32L4_QUADSPI_FCR);
|
||||||
|
|
||||||
/* XXX III this is for polling mode; support interrupt and dma modes also and 'autopolling' */
|
/* XXX III this is for polling mode; support interrupt and dma modes also
|
||||||
|
* nd 'autopolling'
|
||||||
|
*/
|
||||||
|
|
||||||
/* Set up the Communications Configuration Register as per command info */
|
/* Set up the Communications Configuration Register as per command info */
|
||||||
|
|
||||||
@@ -1390,13 +1430,17 @@ static int qspi_memory(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
if (QSPICMD_ISWRITE(meminfo->flags))
|
if (QSPICMD_ISWRITE(meminfo->flags))
|
||||||
{
|
{
|
||||||
/* XXX III we are going to do polling; revisit when we get interrupt and/or DMA up. */
|
/* XXX III we are going to do polling; revisit when we get interrupt
|
||||||
|
* and/or DMA up.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = qspi_transmit_blocking(priv, &xctn);
|
ret = qspi_transmit_blocking(priv, &xctn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* XXX III we are going to do polling; revisit when we get interrupt and/or DMA up. */
|
/* XXX III we are going to do polling; revisit when we get interrupt
|
||||||
|
* and/or DMA up.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = qspi_receive_blocking(priv, &xctn);
|
ret = qspi_receive_blocking(priv, &xctn);
|
||||||
}
|
}
|
||||||
@@ -1405,6 +1449,7 @@ static int qspi_memory(struct qspi_dev_s *dev,
|
|||||||
#if 0
|
#if 0
|
||||||
#ifdef CONFIG_STM32L4_QSPI_DMA
|
#ifdef CONFIG_STM32L4_QSPI_DMA
|
||||||
/* Can we perform DMA? Should we perform DMA? */
|
/* Can we perform DMA? Should we perform DMA? */
|
||||||
|
|
||||||
if (priv->candma &&
|
if (priv->candma &&
|
||||||
meminfo->buflen > CONFIG_STM32L4_QSPI_DMATHRESHOLD &&
|
meminfo->buflen > CONFIG_STM32L4_QSPI_DMATHRESHOLD &&
|
||||||
IS_ALIGNED((uintptr_t)meminfo->buffer) &&
|
IS_ALIGNED((uintptr_t)meminfo->buffer) &&
|
||||||
@@ -1421,7 +1466,8 @@ static int qspi_memory(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
/* XXX III this is for polling mode; support interrupt and dma modes also */
|
/* XXX III this is for polling mode; support interrupt and dma modes also */
|
||||||
|
|
||||||
/* wait for Transfer complete, and not busy */
|
/* Wait for Transfer complete, and not busy */
|
||||||
|
|
||||||
qspi_waitstatusflags(priv, QSPI_SR_TCF,1);
|
qspi_waitstatusflags(priv, QSPI_SR_TCF,1);
|
||||||
qspi_waitstatusflags(priv, QSPI_SR_BUSY,0);
|
qspi_waitstatusflags(priv, QSPI_SR_BUSY,0);
|
||||||
|
|
||||||
|
|||||||
@@ -122,9 +122,7 @@
|
|||||||
#define GPIO_I2C1_SDA_GPIO \
|
#define GPIO_I2C1_SDA_GPIO \
|
||||||
(GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7)
|
(GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7)
|
||||||
|
|
||||||
/*
|
/* XXX Is I2C2 used on Disco? */
|
||||||
* XXX Is I2C2 used on Disco?
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
@@ -146,18 +144,19 @@
|
|||||||
#define GPIO_QSPI_IO3 (GPIO_QSPI_BK1_IO3_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz)
|
#define GPIO_QSPI_IO3 (GPIO_QSPI_BK1_IO3_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz)
|
||||||
#define GPIO_QSPI_SCK (GPIO_QSPI_CLK_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz)
|
#define GPIO_QSPI_SCK (GPIO_QSPI_CLK_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz)
|
||||||
|
|
||||||
//XXX hmm, elsewhere
|
#if 0
|
||||||
//#define QSPI_USE_INTERRUPTS 1
|
/* XXX hmm, elsewhere */
|
||||||
//XXX hmm, better? (2^(23+1)); this is the value that goes into FSIZE
|
|
||||||
//#define QSPI_FLASH_SIZE 23
|
|
||||||
|
|
||||||
|
#define QSPI_USE_INTERRUPTS 1
|
||||||
|
|
||||||
/* SPI
|
/* XXX hmm, better? (2^(23+1)); this is the value that goes into FSIZE */
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
#define QSPI_FLASH_SIZE 23
|
||||||
* XXX is SPI1 used on Disco?
|
#endif
|
||||||
*/
|
|
||||||
|
/* SPI */
|
||||||
|
|
||||||
|
/* XXX is SPI1 used on Disco? */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
@@ -167,7 +166,6 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* SPI2 is used for several peripherals on the Discovery board, including
|
/* SPI2 is used for several peripherals on the Discovery board, including
|
||||||
* L3GD20 - 3 axis Gyroscope
|
* L3GD20 - 3 axis Gyroscope
|
||||||
* LSM303CTR - eCompass, comprising an accelerometer and magnetometer
|
* LSM303CTR - eCompass, comprising an accelerometer and magnetometer
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ int board_app_initialize(void)
|
|||||||
|
|
||||||
(void)ret;
|
(void)ret;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
/* Configure CPU load estimation */
|
/* Configure CPU load estimation */
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
|
||||||
cpuload_initialize_once();
|
cpuload_initialize_once();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user