Skip to contentSkip to conversation

sf: Add Macronix MX25U6435F device parameters

PATCH New Bin Meng 3 participants 24 messages Jul 23, 2017 – Aug 16, 2017 Memory technology devices (MTD)

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 sf: Add Macronix MX25U6435F device parameters

This adds support for Macronix flash MX25U6435F (device ID 0xc22537).

---

 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_ids.c +1 -0
index edca94e..c4ccf48 100644
@@ -81,6 +81,7 @@ const struct spi_flash_info spi_flash_ids[] = {
 	{"mx25l12805",	   INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
 	{"mx25l25635f",	   INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
 	{"mx25l51235f",	   INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
+	{"mx25u6435f",	   INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },
 	{"mx25l12855e",	   INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
 	{"mx66u51235f",    INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
 	{"mx66l1g45g",     INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | WR_QPP) },
Signature · 1 line
2.9.2
author
#1 lore raw

PATCH 1/2 sf: Add Macronix MX25U6435F device parameters

Hi Jagan,

Quoted 13 lines · Bin Meng

This adds support for Macronix flash MX25U6435F (device ID 0xc22537).

---

 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_ids.c +0 -0
index edca94e..c4ccf48 100644

drivers/mtd/spi/spi_flash_ids.c const struct spi_flash_info spi_flash_ids[] = {

Quoted 8 lines
drivers/mtd/spi/spi_flash_ids.c +1 -1
@@ -81,6 +81,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"mx25l12805",     INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
        {"mx25l51235f",    INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
+       {"mx25u6435f",     INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },
        {"mx25l12855e",    INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx66u51235f",    INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
        {"mx66l1g45g",     INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | WR_QPP) },
--

Ping.

Regards,
Bin

author
#2 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

In reply to Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +15 -2
index 0034a28..7d8c660 100644
@@ -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);
+	}
 
 	flash->name = info->name;
 	flash->memory_map = spi->memory_map;
Signature · 1 line
2.9.2
#3 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Quoted 10 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
#4 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

In reply to Bin Meng
Quoted 29 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -1
index 0034a28..7d8c660 100644
@@ -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 ||

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 10 lines
drivers/mtd/spi/spi_flash.c +7 -1
-           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);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#5 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

If you have any other alternative, please suggest.

Regards,
Bin

author
#6 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 2 lines

If you have any other alternative, please suggest.

Ping again..

Can you please comment on this? I would like this patch gets in the upcoming release.

Regards,
Bin

author
#7 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Quoted 58 lines · Bin Meng
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 8 lines
Quoted 2 lines

If you have any other alternative, please suggest.

Ping again..

Can you please comment on this? I would like this patch gets in the upcoming release.

Ping ..

#8 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Bing,

Quoted 59 lines · Bin Meng
Quoted 58 lines · Bin Meng
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If you have any other alternative, please suggest.

Ping again..

Wait for sometime, I've queue that I need to review-it and respond accordingly patches with latest may take some time. And commenting yes will respond soon.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#9 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Quoted 62 lines · Jagan Teki

Hi Bing,

Quoted 59 lines · Bin Meng
Quoted 58 lines · Bin Meng
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If you have any other alternative, please suggest.

Ping again..

Wait for sometime, I've queue that I need to review-it and respond accordingly patches with latest may take some time. And commenting yes will respond soon.

Ping!

Can you please respond with a reasonable time frame (ie: when you will have time to look at this)?

Regards,
Bin

#10 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

In reply to Bin Meng

Hi Bin,

Quoted 48 lines · Bin Meng

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

Quoted 8 lines

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

I believe QEB is same position for all Macronix chips, checked few parts true? what if the supported chips from id tables doesn't have QEB at-all means specific chip support upto dual?

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#11 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Jagan,

Quoted 60 lines · Jagan Teki

Hi Bin,

Quoted 48 lines · Bin Meng

Hi Jagan,

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +10 -2
index 0034a28..7d8c660 100644
@@ -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;
Quoted 9 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 5 lines
drivers/mtd/spi/spi_flash.c +5 -0
+
+               read_sr(flash, &sr);
+               sr &= STATUS_QEB_MXIC;
+               write_sr(flash, sr);
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

Quoted 8 lines

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 4 lines

I believe QEB is same position for all Macronix chips, checked few parts true? what if the supported chips from id tables doesn't have QEB at-all means specific chip support upto dual?

Correct, QEB is in the same position (bit6) for all Macronix chips. If a chipset that does not support QEB, that bit (bit6) is reserved, and current patch still works.

So current patch can correctly handle both situations. The issue here is that what we do here for the status register does NOT conform the comment. We only wanted to clear the #BP bits. We should NOT clear the QEB bit at all.

Regards,
Bin

#12 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Jagan,

Quoted 37 lines · Jagan Teki

Hi Bin,

Quoted 34 lines · Bin Meng

Hi Jagan,

Quoted 31 lines · Jagan Teki
Quoted 30 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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 ||
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 8 lines
drivers/mtd/spi/spi_flash.c +6 -0
            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.

Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
Quoted 5 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 1 line
drivers/mtd/spi/spi_flash.c +1 -0
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

Quoted 8 lines

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 4 lines

I believe QEB is same position for all Macronix chips, checked few parts true? what if the supported chips from id tables doesn't have QEB at-all means specific chip support upto dual?

Quoted 8 lines

Correct, QEB is in the same position (bit6) for all Macronix chips. If a chipset that does not support QEB, that bit (bit6) is reserved, and current patch still works.

So current patch can correctly handle both situations. The issue here is that what we do here for the status register does NOT conform the comment. We only wanted to clear the #BP bits. We should NOT clear the QEB bit at all.

OK, thanks.

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#13 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Jagan,

Quoted 45 lines · Jagan Teki

Hi Bin,

Quoted 42 lines · Bin Meng

Hi Jagan,

Quoted 39 lines · Jagan Teki

Hi Bin,

Quoted 36 lines · Bin Meng

Hi Jagan,

Quoted 33 lines · Jagan Teki
Quoted 32 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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);
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 6 lines
drivers/mtd/spi/spi_flash.c +6 -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.

Quoted 25 lines
Quoted 25 lines
Quoted 16 lines
Quoted 7 lines
Quoted 6 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 967

Quoted 2 lines
drivers/mtd/spi/spi_flash.c +1 -0
+       }

It doesn't make sense to have one(specific) controller fix to be generic to all macronix chips, think about alternative.

Quoted 8 lines

This is no way to fix at the controller level. Actually this is nothing related to controller level. It's just the bootstrap settings (QE bit in this case) that cannot be overwritten by someone else (although it's seen on Intel, it might happen on some other architecture). The logic in the codes are having issues. Its comment
says: clear BP# bits, but it clears QE bit for Macronix flash as well, which is wrong. The update was just to make sure the codes do as what its comment says.

Quoted 4 lines

I believe QEB is same position for all Macronix chips, checked few parts true? what if the supported chips from id tables doesn't have QEB at-all means specific chip support upto dual?

Correct, QEB is in the same position (bit6) for all Macronix chips. If a chipset that does not support QEB, that bit (bit6) is reserved, and current patch still works.

Quoted 6 lines
Quoted 4 lines

So current patch can correctly handle both situations. The issue here is that what we do here for the status register does NOT conform the comment. We only wanted to clear the #BP bits. We should NOT clear the QEB bit at all.

OK, thanks.

Regards,
Bin

#14 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 45 lines · Jagan Teki

Hi Bin,

Quoted 42 lines · Bin Meng

Hi Jagan,

Quoted 39 lines · Jagan Teki

Hi Bin,

Quoted 36 lines · Bin Meng

Hi Jagan,

Quoted 33 lines · Jagan Teki
Quoted 32 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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);
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 6 lines
drivers/mtd/spi/spi_flash.c +6 -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.

Quoted 2 lines

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!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#15 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Jagan,

Quoted 58 lines · Jagan Teki
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 53 lines · Jagan Teki

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Jagan,

Quoted 37 lines · Jagan Teki

Hi Bin,

Quoted 34 lines · Bin Meng

Hi Jagan,

Quoted 31 lines · Jagan Teki
Quoted 30 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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 ||
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 8 lines
drivers/mtd/spi/spi_flash.c +6 -0
            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.

Quoted 6 lines
Quoted 2 lines

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.

As I said, this is nothing related to the SPI controller driver. It can (technically) happen on other platforms. I don't understand what your concerns here. Your suggestion of writing SR once does not work.

Quoted 3 lines

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

The board simply bricks after a successful boot once. Because the QE bit is cleared by U-Boot during this successful boot, next time when the board powers-up, the SoC won't get a valid bootstrap setting from SPI flash. The bootstrap settings are stored in the SPI flash and there is a QE bit enable in the bootstrap setting. When SoC finds out the QE bit is turned on in the bootstrap setting but SPI flash's QE bit is off, the SoC refuses to boot.

Regards,
Bin

author
#16 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Jagan,

Quoted 76 lines · Bin Meng

Hi Jagan,

Quoted 58 lines · Jagan Teki
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 53 lines · Jagan Teki

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Jagan,

Quoted 37 lines · Jagan Teki

Hi Bin,

Quoted 34 lines · Bin Meng

Hi Jagan,

Quoted 31 lines · Jagan Teki
Quoted 30 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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 ||
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 8 lines
drivers/mtd/spi/spi_flash.c +6 -0
            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.

Quoted 6 lines
Quoted 2 lines

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.

As I said, this is nothing related to the SPI controller driver. It can (technically) happen on other platforms. I don't understand what your concerns here. Your suggestion of writing SR once does not work.

Quoted 3 lines

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

Quoted 8 lines

The board simply bricks after a successful boot once. Because the QE bit is cleared by U-Boot during this successful boot, next time when the board powers-up, the SoC won't get a valid bootstrap setting from SPI flash. The bootstrap settings are stored in the SPI flash and there is a QE bit enable in the bootstrap setting. When SoC finds out the QE bit is turned on in the bootstrap setting but SPI flash's QE bit is off, the SoC refuses to boot.

Sadly, this discussion ends to nowhere again. Can you please indicate your clear opinion on how to proceed?

Regards,
Bin

#17 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Bin,

Quoted 74 lines · Bin Meng

Hi Jagan,

Quoted 71 lines · Bin Meng

Hi Jagan,

Quoted 58 lines · Jagan Teki
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 53 lines · Jagan Teki

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Jagan,

Quoted 37 lines · Jagan Teki

Hi Bin,

Quoted 34 lines · Bin Meng

Hi Jagan,

Quoted 31 lines · Jagan Teki
Quoted 30 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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 ||
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 8 lines
drivers/mtd/spi/spi_flash.c +6 -0
            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.

Quoted 6 lines
Quoted 2 lines

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.

As I said, this is nothing related to the SPI controller driver. It can (technically) happen on other platforms. I don't understand what your concerns here. Your suggestion of writing SR once does not work.

OK, then lets proceed with this.

finally, I've made a change for easy readability [1], If you're OK I will apply this otherwise suggest any?

[1] https://paste.ubuntu.com/25324972/

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#18 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Hi Jagan,

Quoted 78 lines · Jagan Teki

Hi Bin,

Quoted 74 lines · Bin Meng

Hi Jagan,

Quoted 71 lines · Bin Meng

Hi Jagan,

Quoted 58 lines · Jagan Teki
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 53 lines · Jagan Teki

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Jagan,

Quoted 37 lines · Jagan Teki

Hi Bin,

Quoted 34 lines · Bin Meng

Hi Jagan,

Quoted 31 lines · Jagan Teki
Quoted 30 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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 ||
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 8 lines
drivers/mtd/spi/spi_flash.c +6 -0
            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.

Quoted 6 lines
Quoted 2 lines

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.

As I said, this is nothing related to the SPI controller driver. It can (technically) happen on other platforms. I don't understand what your concerns here. Your suggestion of writing SR once does not work.

Quoted 7 lines

OK, then lets proceed with this.

finally, I've made a change for easy readability [1], If you're OK I will apply this otherwise suggest any?

[1] https://paste.ubuntu.com/25324972/

Looks good. Please apply. Thanks!

Regards,
Bin

#19 lore raw

PATCH 2/2 sf: Preserve QE bit when clearing BP# bits for Macronix flash

Quoted 87 lines · Bin Meng

Hi Jagan,

Quoted 84 lines · Jagan Teki

Hi Bin,

Quoted 74 lines · Bin Meng

Hi Jagan,

Quoted 71 lines · Bin Meng

Hi Jagan,

Quoted 58 lines · Jagan Teki
Quoted 57 lines · Bin Meng

Hi Jagan,

Quoted 53 lines · Jagan Teki

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Jagan,

Quoted 37 lines · Jagan Teki

Hi Bin,

Quoted 34 lines · Bin Meng

Hi Jagan,

Quoted 31 lines · Jagan Teki
Quoted 30 lines · Bin Meng

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).

---

 drivers/mtd/spi/spi_flash.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +8 -2
index 0034a28..7d8c660 100644
@@ -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 ||
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mtd/spi/spi_flash.c int spi_flash_scan(struct spi_flash *flash) · line 966

Quoted 8 lines
drivers/mtd/spi/spi_flash.c +6 -0
            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.

Quoted 6 lines
Quoted 2 lines

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.

As I said, this is nothing related to the SPI controller driver. It can (technically) happen on other platforms. I don't understand what your concerns here. Your suggestion of writing SR once does not work.

OK, then lets proceed with this.

finally, I've made a change for easy readability [1], If you're OK I will apply this otherwise suggest any?

[1] https://paste.ubuntu.com/25324972/

Applied to u-boot-spi/master

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#20 lore raw

PATCH 1/2 sf: Add Macronix MX25U6435F device parameters

In reply to Bin Meng
Quoted 13 lines · Bin Meng

This adds support for Macronix flash MX25U6435F (device ID 0xc22537).

---

 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_ids.c +0 -0
index edca94e..c4ccf48 100644

drivers/mtd/spi/spi_flash_ids.c const struct spi_flash_info spi_flash_ids[] = { · line 84

Quoted 4 lines
drivers/mtd/spi/spi_flash_ids.c +1 -0
@@ -81,6 +81,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"mx25l12805",     INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
        {"mx25l51235f",    INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
+       {"mx25u6435f",     INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },

Applied to u-boot-spi/master

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#21 lore raw

PATCH 1/2 sf: Add Macronix MX25U6435F device parameters

Hi Jagan,

Quoted 9 lines · Jagan Teki
Quoted 8 lines · Bin Meng

This adds support for Macronix flash MX25U6435F (device ID 0xc22537).

---

 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

drivers/mtd/spi/spi_flash_ids.c const struct spi_flash_info spi_flash_ids[] = { · line 84

Quoted 9 lines
drivers/mtd/spi/spi_flash_ids.c +1 -0
index edca94e..c4ccf48 100644
@@ -81,6 +81,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"mx25l12805",     INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
        {"mx25l51235f",    INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
+       {"mx25u6435f",     INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },

Applied to u-boot-spi/master

What about the 2nd patch [1] in this series?

And I don't see this patch showing in
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=summary. Am I missing anything?

[1] http://patchwork.ozlabs.org/patch/792565/

Regards,
Bin

author
#22 lore raw

PATCH 1/2 sf: Add Macronix MX25U6435F device parameters

Hi Jagan,

Quoted 24 lines · Bin Meng

Hi Jagan,

Quoted 20 lines · Jagan Teki
Quoted 13 lines · Bin Meng

This adds support for Macronix flash MX25U6435F (device ID 0xc22537).

---

 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_ids.c +0 -0
index edca94e..c4ccf48 100644

drivers/mtd/spi/spi_flash_ids.c const struct spi_flash_info spi_flash_ids[] = { · line 84

Quoted 4 lines
drivers/mtd/spi/spi_flash_ids.c +1 -0
@@ -81,6 +81,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"mx25l12805",     INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
        {"mx25l51235f",    INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
+       {"mx25u6435f",     INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },

Applied to u-boot-spi/master

I don't see this patch gets applied anywhere. Can you please make sure the patch state is consistent when you reply the email?

Quoted 7 lines

What about the 2nd patch [1] in this series?

And I don't see this patch showing in
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=summary. Am I missing anything?

[1] http://patchwork.ozlabs.org/patch/792565/

Also I don't see your response for the 2nd patch for some days.

Regards,
Bin