SAMV7 QSPI: Rounding up buffer length for memcpy style transfer is un-necessary
This commit is contained in:
parent
553ba1a682
commit
17c8cbceaf
@ -990,11 +990,6 @@ static int qspi_memory_nodma(struct sam_qspidev_s *priv,
|
|||||||
struct qspi_meminfo_s *meminfo)
|
struct qspi_meminfo_s *meminfo)
|
||||||
{
|
{
|
||||||
uintptr_t qspimem = SAM_QSPIMEM_BASE + meminfo->addr;
|
uintptr_t qspimem = SAM_QSPIMEM_BASE + meminfo->addr;
|
||||||
size_t buflen;
|
|
||||||
|
|
||||||
/* Get the length as an even multiple of 32-bit words. */
|
|
||||||
|
|
||||||
buflen = ALIGN_UP(meminfo->buflen);
|
|
||||||
|
|
||||||
/* Enable the memory transfer */
|
/* Enable the memory transfer */
|
||||||
|
|
||||||
@ -1004,13 +999,13 @@ static int qspi_memory_nodma(struct sam_qspidev_s *priv,
|
|||||||
|
|
||||||
if (QSPIMEM_ISWRITE(meminfo->flags))
|
if (QSPIMEM_ISWRITE(meminfo->flags))
|
||||||
{
|
{
|
||||||
qspi_memcpy((uint8_t *)qspimem,
|
qspi_memcpy((uint8_t *)qspimem, (const uint8_t *)meminfo->buffer,
|
||||||
(const uint8_t *)meminfo->buffer, buflen);
|
meminfo->buflen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qspi_memcpy((uint8_t *)meminfo->buffer,
|
qspi_memcpy((uint8_t *)meminfo->buffer, (const uint8_t *)qspimem,
|
||||||
(const uint8_t *)qspimem, buflen);
|
meminfo->buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMORY_SYNC();
|
MEMORY_SYNC();
|
||||||
@ -1443,15 +1438,9 @@ static int qspi_command(struct qspi_dev_s *dev,
|
|||||||
|
|
||||||
if (QSPICMD_ISDATA(cmdinfo->flags))
|
if (QSPICMD_ISDATA(cmdinfo->flags))
|
||||||
{
|
{
|
||||||
uint16_t buflen;
|
|
||||||
|
|
||||||
DEBUGASSERT(cmdinfo->buffer != NULL && cmdinfo->buflen > 0);
|
DEBUGASSERT(cmdinfo->buffer != NULL && cmdinfo->buflen > 0);
|
||||||
DEBUGASSERT(IS_ALIGNED(cmdinfo->buffer));
|
DEBUGASSERT(IS_ALIGNED(cmdinfo->buffer));
|
||||||
|
|
||||||
/* Get the length as an even multiple of 32-bit words. */
|
|
||||||
|
|
||||||
buflen = ALIGN_UP(cmdinfo->buflen);
|
|
||||||
|
|
||||||
/* Write Instruction Frame Register:
|
/* Write Instruction Frame Register:
|
||||||
*
|
*
|
||||||
* QSPI_IFR_WIDTH_SINGLE Instruction=single bit/Data single bit
|
* QSPI_IFR_WIDTH_SINGLE Instruction=single bit/Data single bit
|
||||||
@ -1494,7 +1483,7 @@ static int qspi_command(struct qspi_dev_s *dev,
|
|||||||
/* Copy the data to write to QSPI_RAM */
|
/* Copy the data to write to QSPI_RAM */
|
||||||
|
|
||||||
qspi_memcpy((uint8_t *)SAM_QSPIMEM_BASE,
|
qspi_memcpy((uint8_t *)SAM_QSPIMEM_BASE,
|
||||||
(const uint8_t *)cmdinfo->buffer, buflen);
|
(const uint8_t *)cmdinfo->buffer, cmdinfo->buflen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1518,7 +1507,7 @@ static int qspi_command(struct qspi_dev_s *dev,
|
|||||||
/* Copy the data from QSPI memory into the user buffer */
|
/* Copy the data from QSPI memory into the user buffer */
|
||||||
|
|
||||||
qspi_memcpy((uint8_t *)cmdinfo->buffer,
|
qspi_memcpy((uint8_t *)cmdinfo->buffer,
|
||||||
(const uint8_t *)SAM_QSPIMEM_BASE, buflen);
|
(const uint8_t *)SAM_QSPIMEM_BASE, cmdinfo->buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMORY_SYNC();
|
MEMORY_SYNC();
|
||||||
|
Loading…
Reference in New Issue
Block a user