diff mbox

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

Message ID 1464245901-3983-1-git-send-email-sivadur@xilinx.com
State Superseded
Delegated to: Michal Simek
Headers show

Commit Message

Siva Durga Prasad Paladugu May 26, 2016, 6:58 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 v2:
- Newly added in series.
---
 drivers/mtd/spi/spi_flash.c |   13 ++++++++++++-
 include/spi.h               |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Michal Simek May 26, 2016, 11:02 a.m. UTC | #1
On 26.5.2016 08:58, Siva Durga Prasad Paladugu 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.
> 
> Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> ---
> 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(-)
> 
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 5451725..5b22ae2 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 4b88d39..17c6e4d 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 */
> 


Tested-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal
Siva Durga Prasad Paladugu June 21, 2016, 11:52 a.m. UTC | #2
Hi Tom,

> -----Original Message-----
> From: Siva Durga Prasad Paladugu
> Sent: Tuesday, June 14, 2016 2:48 PM
> To: jagannadh.teki@gmail.com; 'Siva Durga Prasad Paladugu'
> <siva.durga.paladugu@xilinx.com>; u-boot@lists.denx.de
> Cc: Michal Simek <michals@xilinx.com>
> Subject: RE: [PATCH v2 1/3] spi: spi_flash: Dont set quad enable for micron in all
> cases
> 
> -----Original Message-----
> From: Siva Durga Prasad Paladugu [mailto:siva.durga.paladugu@xilinx.com]
> Sent: Thursday, May 26, 2016 12:28 PM
> To: u-boot@lists.denx.de
> Cc: Michal Simek <michals@xilinx.com>; jagannadh.teki@gmail.com; Siva Durga
> Prasad Paladugu <sivadur@xilinx.com>
> Subject: [PATCH v2 1/3] spi: spi_flash: Dont set quad enable for micron in all
> cases
> 
> 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.
> 
> Hi Jagan,
> 
> Any comments on this series. If not, Please take this series.
> 
> Regards,
> Siva

If Jagan is busy, Is it possible to get it acked/reviewed from some other person and can go through your tree/Michal tree.

Regards,
Siva
> 
> Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> ---
> 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(-)
> 
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index
> 5451725..5b22ae2 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 4b88d39..17c6e4d 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 */
> --
> 1.7.1
Jagan Teki July 14, 2016, 6:07 a.m. UTC | #3
On 21 June 2016 at 17:22, Siva Durga Prasad Paladugu
<siva.durga.paladugu@xilinx.com> wrote:
> Hi Tom,
>
>> -----Original Message-----
>> From: Siva Durga Prasad Paladugu
>> Sent: Tuesday, June 14, 2016 2:48 PM
>> To: jagannadh.teki@gmail.com; 'Siva Durga Prasad Paladugu'
>> <siva.durga.paladugu@xilinx.com>; u-boot@lists.denx.de
>> Cc: Michal Simek <michals@xilinx.com>
>> Subject: RE: [PATCH v2 1/3] spi: spi_flash: Dont set quad enable for micron in all
>> cases
>>
>> -----Original Message-----
>> From: Siva Durga Prasad Paladugu [mailto:siva.durga.paladugu@xilinx.com]
>> Sent: Thursday, May 26, 2016 12:28 PM
>> To: u-boot@lists.denx.de
>> Cc: Michal Simek <michals@xilinx.com>; jagannadh.teki@gmail.com; Siva Durga
>> Prasad Paladugu <sivadur@xilinx.com>
>> Subject: [PATCH v2 1/3] spi: spi_flash: Dont set quad enable for micron in all
>> cases
>>
>> 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.
>>
>> Hi Jagan,
>>
>> Any comments on this series. If not, Please take this series.
>>
>> Regards,
>> Siva
>
> If Jagan is busy, Is it possible to get it acked/reviewed from some other person and can go through your tree/Michal tree.

These are big changes on common code, please add cover-letter,
describe the text and send again.

thanks!
diff mbox

Patch

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 5451725..5b22ae2 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 4b88d39..17c6e4d 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 */