All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagannadh.teki@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] sf: Preserve QE bit when clearing BP# bits for Macronix flash
Date: Mon, 14 Aug 2017 10:47:56 +0530	[thread overview]
Message-ID: <CAD6G_RQV0qYAvCETg0-CSv+_5POHmQ7qpA8voazugkhK3Cxq=w@mail.gmail.com> (raw)
In-Reply-To: <CAEUhbmVfXqno4HzP_q2MSTEeAkc+c9n8MmrKL-7ePwtbw96g1Q@mail.gmail.com>

On Mon, Aug 14, 2017 at 10:34 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Jagan,
>
> On Mon, Aug 14, 2017 at 12:58 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>> Hi Bin,
>>
>> On Mon, Aug 14, 2017 at 8:07 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
>>> Hi Jagan,
>>>
>>> On Mon, Aug 14, 2017 at 1:22 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>>> Hi Bin,
>>>>
>>>> On Wed, Aug 2, 2017 at 3:56 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>>> Hi Jagan,
>>>>>
>>>>> On Wed, Aug 2, 2017 at 12:01 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>>>>> On Sun, Jul 23, 2017 at 8:14 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>>>>> On some flash (like Macronix), QE (quad enable) bit is in the same
>>>>>>> status register as BP# bits, and we need preserve its original value
>>>>>>> during a reboot cycle as this is required by some platforms (like
>>>>>>> Intel ICH SPI controller working under descriptor mode).
>>>>>>>
>>>>>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>>>>> ---
>>>>>>>
>>>>>>>  drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
>>>>>>>  1 file changed, 15 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
>>>>>>> index 0034a28..7d8c660 100644
>>>>>>> --- a/drivers/mtd/spi/spi_flash.c
>>>>>>> +++ b/drivers/mtd/spi/spi_flash.c
>>>>>>> @@ -947,11 +947,24 @@ int spi_flash_scan(struct spi_flash *flash)
>>>>>>>         if (IS_ERR_OR_NULL(info))
>>>>>>>                 return -ENOENT;
>>>>>>>
>>>>>>> -       /* Flash powers up read-only, so clear BP# bits */
>>>>>>> +       /*
>>>>>>> +        * Flash powers up read-only, so clear BP# bits.
>>>>>>> +        *
>>>>>>> +        * Note on some flash (like Macronix), QE (quad enable) bit is in the
>>>>>>> +        * same status register as BP# bits, and we need preserve its original
>>>>>>> +        * value during a reboot cycle as this is required by some platforms
>>>>>>> +        * (like Intel ICH SPI controller working under descriptor mode).
>>>>>>> +        */
>>>>>>>         if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_ATMEL ||
>>>>>>> -           JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX ||
>>>>>>>             JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST)
>>>>>>>                 write_sr(flash, 0);
>>>>>>> +       if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX) {
>>>>>>> +               u8 sr = 0;
>>>>>>> +
>>>>>>> +               read_sr(flash, &sr);
>>>>>>> +               sr &= STATUS_QEB_MXIC;
>>>>>>> +               write_sr(flash, sr);
>>
>> Better assign sr with QEB for macronix and call write_sr once.
>
> For these Macronix flashes that does not support quard RW, QEB bit is
> reserved. Writing 1 to a reserved bit is not a good practice.

Yeah, i.e what I'm concern here. (apart from fixing comment) this
issue came-up with your controller along with specific connected chip
which support RW WEB.

What if we couldn't preserve QEB? because if user need quad operation
anyway code will check QEB if not it will enable.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.

  reply	other threads:[~2017-08-14  5:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-23 14:44 [U-Boot] [PATCH 1/2] sf: Add Macronix MX25U6435F device parameters Bin Meng
2017-07-23 14:44 ` [U-Boot] [PATCH 2/2] sf: Preserve QE bit when clearing BP# bits for Macronix flash Bin Meng
2017-08-01  9:10   ` Simon Glass
2017-08-01 16:01   ` Jagan Teki
2017-08-01 22:26     ` Bin Meng
2017-08-04  4:21       ` Bin Meng
2017-08-07  7:39         ` Bin Meng
2017-08-07  7:54           ` Jagan Teki
2017-08-11  6:20             ` Bin Meng
2017-08-13 17:22       ` Jagan Teki
2017-08-14  2:37         ` Bin Meng
2017-08-14  4:58           ` Jagan Teki
2017-08-14  5:04             ` Bin Meng
2017-08-14  5:17               ` Jagan Teki [this message]
2017-08-14  5:35                 ` Bin Meng
2017-08-16  1:59                   ` Bin Meng
2017-08-16 10:34                     ` Jagan Teki
2017-08-16 12:26                       ` Bin Meng
2017-08-16 12:57                         ` Jagan Teki
2017-07-31  7:46 ` [U-Boot] [PATCH 1/2] sf: Add Macronix MX25U6435F device parameters Bin Meng
2017-07-31  9:33 ` Jagan Teki
2017-07-31 11:33   ` Bin Meng
2017-08-07  7:41     ` Bin Meng
2017-08-01  9:11 ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD6G_RQV0qYAvCETg0-CSv+_5POHmQ7qpA8voazugkhK3Cxq=w@mail.gmail.com' \
    --to=jagannadh.teki@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.