Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612875

Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash controller

From Marek Vasut <marek.vasut@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash controller
Date 2017-03-30 12:20 +0200
Message-ID <tqFlp-4ME-47@gated-at.bofh.it> (permalink)
References (3 earlier) <tqkTD-6On-1@gated-at.bofh.it> <tqlG1-7mo-5@gated-at.bofh.it> <tqlZo-7yI-23@gated-at.bofh.it> <tqmiL-7Hz-31@gated-at.bofh.it> <tqoXf-188-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03/29/2017 06:38 PM, Ludovic BARRE wrote:
> 
> 
> On 03/29/2017 03:57 PM, Marek Vasut wrote:
>> On 03/29/2017 03:35 PM, Ludovic BARRE wrote:
>>
>> [...]
>>
>>>>>>> +    writel_relaxed(CR_PRESC(presc) | CR_FTHRES(3) | CR_TCEN |
>>>>>>> CR_SSHIFT
>>>>>>> +               | CR_EN, qspi->io_base + QUADSPI_CR);
>>>>>>> +
>>>>>>> +    /* a minimum fsize must be set to sent the command id */
>>>>>>> +    flash->fsize = 25;
>>>>>> I don't understand why this is needed and the comment doesn't make
>>>>>> sense. Please fix.
>>>>> fsize field defines the size of external memory.
>>>> What external memory ? Unclear
>>> oops, fsize field defined the size of "flash memory" in stm32 qspi
>>> controller.
>> Errr, now I am totally lost :) Is that some internal SPI NOR ? Shouldn't
>> the size be coming from DT or something ?
>>
>>> Number of bytes in Flash memory = 2 ^[FSIZE+1].
>>> To sent a nor cmd this field must be set (hardware issue),
>>> but before "spi_nor_scan" the size of flash nor is not know.
>>> So I set a temporary value (workaround).
>> Is it needed before the scan ?
> yes it's needed before scan (fix a "stm32 qspi controller" issue)
> 
> sorry, I try to reformulate:
> 
> The nor flash (external component like micron n25q128a13
> or spansion s25fl512s ...) is connected to stm32 by classic
> spi-nor interface cs, clock and 1/2/4 IO lines.
> 
> the stm32 microprocessor has a dedicated controller to
> manage spi-nor interface, it's stm32 qspi.
> 
> In stm32 qspi controller there is a register with fsize field
> which define the size of nor flash (n25q128a13 or s25fl512s...).
> 
> fsize can't be null, else the stm32 qspi controller doesn't send
> spi-nor command. it's "stm32 qspi controller" issue.
> 
> Before the "spi_nor_scan" the size of nor flash (n25q128a13
> or s25fl512s...) is not know. So we set a temporary value just
> to discover the nor flash with "spi_nor_scan". After we can
> set the right value (mtd->size) in fsize.

I see, now it makes sense. Such a beefy comment would be nice :)

-- 
Best regards,
Marek Vasut

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Marek Vasut <marek.vasut@gmail.com> - 2017-03-29 13:00 +0200
  Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Ludovic BARRE <ludovic.barre@st.com> - 2017-03-29 14:30 +0200
    Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Marek Vasut <marek.vasut@gmail.com> - 2017-03-29 15:20 +0200
      Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Ludovic BARRE <ludovic.barre@st.com> - 2017-03-29 15:40 +0200
        Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Marek Vasut <marek.vasut@gmail.com> - 2017-03-29 16:00 +0200
          Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Ludovic BARRE <ludovic.barre@st.com> - 2017-03-29 18:50 +0200
            Re: [PATCH 2/2] mtd: spi-nor: add driver for STM32 quad spi flash  controller Marek Vasut <marek.vasut@gmail.com> - 2017-03-30 12:20 +0200

csiph-web