diff mbox

[U-Boot,v3,1/3] spi: spi_flash: Dont set quad enable for micron in all cases

Message ID 1468919422-39845-2-git-send-email-sivadur@xilinx.com
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Siva Durga Prasad Paladugu July 19, 2016, 9:10 a.m. UTC
Dont set quad enable for micron devices in all cases
Setting the quad enable bit in micron expects all other
commands like register reads on quad lines which may
not be supported by some controllers. Hence, dont
set the quad enable if controller driver sets the
no_all_quad.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
---
Changes for v3:
- None
Changes for v2:
- Newly added in series.
---
 drivers/mtd/spi/spi_flash.c | 13 ++++++++++++-
 include/spi.h               |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Jagan Teki July 27, 2016, 7:54 a.m. UTC | #1
On 19 July 2016 at 14:40, Siva Durga Prasad Paladugu
<siva.durga.paladugu@xilinx.com> wrote:
> Dont set quad enable for micron devices in all cases
> Setting the quad enable bit in micron expects all other
> commands like register reads on quad lines which may
> not be supported by some controllers. Hence, dont
> set the quad enable if controller driver sets the
> no_all_quad.

Sorry, I'm not fond of controller hacks, please try for any other
solution and even planning to remove existing ones.

thanks!
Siva Durga Prasad Paladugu July 27, 2016, 9:01 a.m. UTC | #2
Hi Jagan,

> -----Original Message-----
> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> Sent: Wednesday, July 27, 2016 1:24 PM
> To: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> Cc: u-boot@lists.denx.de; Michal Simek <michals@xilinx.com>; Siva Durga
> Prasad Paladugu <sivadur@xilinx.com>
> Subject: Re: [PATCH v3 1/3] spi: spi_flash: Dont set quad enable for micron in all
> cases
> 
> On 19 July 2016 at 14:40, Siva Durga Prasad Paladugu
> <siva.durga.paladugu@xilinx.com> wrote:
> > Dont set quad enable for micron devices in all cases Setting the quad
> > enable bit in micron expects all other commands like register reads on
> > quad lines which may not be supported by some controllers. Hence, dont
> > set the quad enable if controller driver sets the no_all_quad.
> 
> Sorry, I'm not fond of controller hacks, please try for any other solution and
> even planning to remove existing ones.
Definitely there should be a way to mention about controller capabilities to the
Framework. As of now I can see this is only way. Do you have any other
Suggested way which is already in place.
I can see that Linux mainline has already removed Micron quad enable functionality with this patch. Probably because of same kind of reason
https://github.com/torvalds/linux/commit/3b5394a3ccffbfa1d1d448d48742853a862822c4

Thanks,
Siva
> 
> thanks!
> --
> Jagan.
Jagan Teki July 27, 2016, 9:56 a.m. UTC | #3
On 27 July 2016 at 14:31, Siva Durga Prasad Paladugu
<siva.durga.paladugu@xilinx.com> wrote:
> Hi Jagan,
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>> Sent: Wednesday, July 27, 2016 1:24 PM
>> To: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
>> Cc: u-boot@lists.denx.de; Michal Simek <michals@xilinx.com>; Siva Durga
>> Prasad Paladugu <sivadur@xilinx.com>
>> Subject: Re: [PATCH v3 1/3] spi: spi_flash: Dont set quad enable for micron in all
>> cases
>>
>> On 19 July 2016 at 14:40, Siva Durga Prasad Paladugu
>> <siva.durga.paladugu@xilinx.com> wrote:
>> > Dont set quad enable for micron devices in all cases Setting the quad
>> > enable bit in micron expects all other commands like register reads on
>> > quad lines which may not be supported by some controllers. Hence, dont
>> > set the quad enable if controller driver sets the no_all_quad.
>>
>> Sorry, I'm not fond of controller hacks, please try for any other solution and
>> even planning to remove existing ones.
> Definitely there should be a way to mention about controller capabilities to the
> Framework. As of now I can see this is only way. Do you have any other
> Suggested way which is already in place.
> I can see that Linux mainline has already removed Micron quad enable functionality with this patch. Probably because of same kind of reason
> https://github.com/torvalds/linux/commit/3b5394a3ccffbfa1d1d448d48742853a862822c4

The reason to remov this support from Linux is different than this,
and u-boot have support for quad write ie not supported by Linux.
Siva Durga Prasad Paladugu Oct. 20, 2016, 11:38 a.m. UTC | #4
Hi Jagan,

On Wed, Jul 27, 2016 at 3:26 PM, Jagan Teki <jagannadh.teki@gmail.com>
wrote:

> On 27 July 2016 at 14:31, Siva Durga Prasad Paladugu
> <siva.durga.paladugu@xilinx.com> wrote:
> > Hi Jagan,
> >
> >> -----Original Message-----
> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> >> Sent: Wednesday, July 27, 2016 1:24 PM
> >> To: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> >> Cc: u-boot@lists.denx.de; Michal Simek <michals@xilinx.com>; Siva Durga
> >> Prasad Paladugu <sivadur@xilinx.com>
> >> Subject: Re: [PATCH v3 1/3] spi: spi_flash: Dont set quad enable for
> micron in all
> >> cases
> >>
> >> On 19 July 2016 at 14:40, Siva Durga Prasad Paladugu
> >> <siva.durga.paladugu@xilinx.com> wrote:
> >> > Dont set quad enable for micron devices in all cases Setting the quad
> >> > enable bit in micron expects all other commands like register reads on
> >> > quad lines which may not be supported by some controllers. Hence, dont
> >> > set the quad enable if controller driver sets the no_all_quad.
> >>
> >> Sorry, I'm not fond of controller hacks, please try for any other
> solution and
> >> even planning to remove existing ones.
> > Definitely there should be a way to mention about controller
> capabilities to the
> > Framework. As of now I can see this is only way. Do you have any other
> > Suggested way which is already in place.
> > I can see that Linux mainline has already removed Micron quad enable
> functionality with this patch. Probably because of same kind of reason
> > https://github.com/torvalds/linux/commit/3b5394a3ccffbfa1d1d448d4874285
> 3a862822c4
>
> The reason to remov this support from Linux is different than this,
> and u-boot have support for quad write ie not supported by Linux.
>

We can still have quad write with out quad enable bit set for micron
as it supports quad page program in extended spi(command on single and data
on 4 lines).
The issue for me is when the quad enable bit was set for micron, it expects
everything on
four lines even for register reads.

Thanks,
Siva


> --
> Jagan.
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Jagan Teki Oct. 26, 2016, 7:02 a.m. UTC | #5
On Thu, Oct 20, 2016 at 5:08 PM, S Durga Prasad Paladugu
<durgaprasad.psdp@gmail.com> wrote:
> Hi Jagan,
>
> On Wed, Jul 27, 2016 at 3:26 PM, Jagan Teki <jagannadh.teki@gmail.com>
> wrote:
>>
>> On 27 July 2016 at 14:31, Siva Durga Prasad Paladugu
>> <siva.durga.paladugu@xilinx.com> wrote:
>> > Hi Jagan,
>> >
>> >> -----Original Message-----
>> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>> >> Sent: Wednesday, July 27, 2016 1:24 PM
>> >> To: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
>> >> Cc: u-boot@lists.denx.de; Michal Simek <michals@xilinx.com>; Siva Durga
>> >> Prasad Paladugu <sivadur@xilinx.com>
>> >> Subject: Re: [PATCH v3 1/3] spi: spi_flash: Dont set quad enable for
>> >> micron in all
>> >> cases
>> >>
>> >> On 19 July 2016 at 14:40, Siva Durga Prasad Paladugu
>> >> <siva.durga.paladugu@xilinx.com> wrote:
>> >> > Dont set quad enable for micron devices in all cases Setting the quad
>> >> > enable bit in micron expects all other commands like register reads
>> >> > on
>> >> > quad lines which may not be supported by some controllers. Hence,
>> >> > dont
>> >> > set the quad enable if controller driver sets the no_all_quad.
>> >>
>> >> Sorry, I'm not fond of controller hacks, please try for any other
>> >> solution and
>> >> even planning to remove existing ones.
>> > Definitely there should be a way to mention about controller
>> > capabilities to the
>> > Framework. As of now I can see this is only way. Do you have any other
>> > Suggested way which is already in place.
>> > I can see that Linux mainline has already removed Micron quad enable
>> > functionality with this patch. Probably because of same kind of reason
>> >
>> > https://github.com/torvalds/linux/commit/3b5394a3ccffbfa1d1d448d48742853a862822c4
>>
>> The reason to remov this support from Linux is different than this,
>> and u-boot have support for quad write ie not supported by Linux.
>
>
> We can still have quad write with out quad enable bit set for micron
> as it supports quad page program in extended spi(command on single and data
> on 4 lines).
> The issue for me is when the quad enable bit was set for micron, it expects
> everything on
> four lines even for register reads.

I need to investigate further on this, will update you if I find any.

thanks!
diff mbox

Patch

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 64d4e0f..1be3e56 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -926,6 +926,8 @@  static int micron_quad_enable(struct spi_flash *flash)
 
 static int set_quad_mode(struct spi_flash *flash, u8 idcode0)
 {
+	struct spi_slave *spi = flash->spi;
+
 	switch (idcode0) {
 #ifdef CONFIG_SPI_FLASH_MACRONIX
 	case SPI_FLASH_CFI_MFR_MACRONIX:
@@ -938,7 +940,16 @@  static int set_quad_mode(struct spi_flash *flash, u8 idcode0)
 #endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case SPI_FLASH_CFI_MFR_STMICRO:
-		return micron_quad_enable(flash);
+		/*
+		 * Set quad enable for micron only
+		 * if controller supports sending of
+		 * all commands on quad lines, otherwise
+		 * dont enable it
+		 */
+		if (spi->no_all_quad)
+			return 0;
+		else
+			return micron_quad_enable(flash);
 #endif
 	default:
 		printf("SF: Need set QEB func for %02x flash\n", idcode0);
diff --git a/include/spi.h b/include/spi.h
index ca96fa4..e43c864 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -117,7 +117,7 @@  struct spi_slave {
 	unsigned int max_write_size;
 	void *memory_map;
 	u8 option;
-
+	u8 no_all_quad;
 	u8 flags;
 #define SPI_XFER_BEGIN		BIT(0)	/* Assert CS before transfer */
 #define SPI_XFER_END		BIT(1)	/* Deassert CS after transfer */