All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK
@ 2015-12-14 10:36 Gong Qianyu
  2015-12-14 10:36 ` [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform Gong Qianyu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gong Qianyu @ 2015-12-14 10:36 UTC (permalink / raw)
  To: u-boot

This commit fixes the change of bad490a24212c068c5b718b9189f47ea4075d078.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
---
 drivers/spi/fsl_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index ed39114..d8d37cd 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define TX_BUFFER_SIZE		0x40
 #endif
 
-#define OFFSET_BITS_MASK	GENMASK(24, 0)
+#define OFFSET_BITS_MASK	GENMASK(23, 0)
 
 #define FLASH_STATUS_WEL	0x02
 
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform
  2015-12-14 10:36 [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Gong Qianyu
@ 2015-12-14 10:36 ` Gong Qianyu
  2015-12-14 10:36 ` [U-Boot] [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue Gong Qianyu
  2016-01-07 15:27 ` [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Jagan Teki
  2 siblings, 0 replies; 7+ messages in thread
From: Gong Qianyu @ 2015-12-14 10:36 UTC (permalink / raw)
  To: u-boot

This patch fixes the following compile warning:
drivers/spi/fsl_qspi.c: In function 'fsl_qspi_probe':
drivers/spi/fsl_qspi.c:937:15:
  warning: cast to pointer from integer of different size
					 [-Wint-to-pointer-cast]
  priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
               ^
Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
---
 drivers/spi/fsl_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index d8d37cd..755cc27 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -931,7 +931,7 @@ static int fsl_qspi_probe(struct udevice *bus)
 
 	dm_spi_bus->max_hz = plat->speed_hz;
 
-	priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
+	priv->regs = (struct fsl_qspi_regs *)(unsigned long)plat->reg_base;
 	priv->flags = plat->flags;
 
 	priv->speed_hz = plat->speed_hz;
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue
  2015-12-14 10:36 [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Gong Qianyu
  2015-12-14 10:36 ` [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform Gong Qianyu
@ 2015-12-14 10:36 ` Gong Qianyu
  2015-12-14 10:46   ` Gong Q.Y.
  2016-01-07 15:27 ` [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Jagan Teki
  2 siblings, 1 reply; 7+ messages in thread
From: Gong Qianyu @ 2015-12-14 10:36 UTC (permalink / raw)
  To: u-boot

In current driver everytime we memcpy 4 bytes to the dest memory
regardless of the remaining length.
This patch add checking the remaining length before memcpy.
If the length is shorter than 4 bytes, memcpy the actual length of data
to the dest memory.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
---
 drivers/spi/fsl_qspi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 755cc27..b41b226 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -499,7 +499,10 @@ static void qspi_op_rdid(struct fsl_qspi_priv *priv, u32 *rxbuf, u32 len)
 		if (rbsr_reg & QSPI_RBSR_RDBFL_MASK) {
 			data = qspi_read32(priv->flags, &regs->rbdr[i]);
 			data = qspi_endian_xchg(data);
-			memcpy(rxbuf, &data, 4);
+			if (size < 4)
+				memcpy(rxbuf, &data, size);
+			else
+				memcpy(rxbuf, &data, 4);
 			rxbuf++;
 			size -= 4;
 			i++;
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue
  2015-12-14 10:36 ` [U-Boot] [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue Gong Qianyu
@ 2015-12-14 10:46   ` Gong Q.Y.
  0 siblings, 0 replies; 7+ messages in thread
From: Gong Q.Y. @ 2015-12-14 10:46 UTC (permalink / raw)
  To: u-boot

Oh, so sorry for the mess... The network seems to get problems..:(

Regards,
Qianyu

> -----Original Message-----
> From: Gong Qianyu [mailto:Qianyu.Gong at freescale.com]
> Sent: Monday, December 14, 2015 6:37 PM
> To: u-boot at lists.denx.de
> Cc: Hu Mingkai-B21284; Sun York-R58495; Yuan Yao-B46683;
> jteki at openedev.com; Gong Qianyu-B52263
> Subject: [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue
> 
> In current driver everytime we memcpy 4 bytes to the dest memory
> regardless of the remaining length.
> This patch add checking the remaining length before memcpy.
> If the length is shorter than 4 bytes, memcpy the actual length of data
> to the dest memory.
> 
> Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
> ---
>  drivers/spi/fsl_qspi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index
> 755cc27..b41b226 100644
> --- a/drivers/spi/fsl_qspi.c
> +++ b/drivers/spi/fsl_qspi.c
> @@ -499,7 +499,10 @@ static void qspi_op_rdid(struct fsl_qspi_priv *priv,
> u32 *rxbuf, u32 len)
>  		if (rbsr_reg & QSPI_RBSR_RDBFL_MASK) {
>  			data = qspi_read32(priv->flags, &regs->rbdr[i]);
>  			data = qspi_endian_xchg(data);
> -			memcpy(rxbuf, &data, 4);
> +			if (size < 4)
> +				memcpy(rxbuf, &data, size);
> +			else
> +				memcpy(rxbuf, &data, 4);
>  			rxbuf++;
>  			size -= 4;
>  			i++;
> --
> 2.1.0.27.g96db324

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK
  2015-12-14 10:36 [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Gong Qianyu
  2015-12-14 10:36 ` [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform Gong Qianyu
  2015-12-14 10:36 ` [U-Boot] [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue Gong Qianyu
@ 2016-01-07 15:27 ` Jagan Teki
  2 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2016-01-07 15:27 UTC (permalink / raw)
  To: u-boot

On 14 December 2015 at 16:06, Gong Qianyu <Qianyu.Gong@freescale.com> wrote:
> This commit fixes the change of bad490a24212c068c5b718b9189f47ea4075d078.
>
> Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
> ---
>  drivers/spi/fsl_qspi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
> index ed39114..d8d37cd 100644
> --- a/drivers/spi/fsl_qspi.c
> +++ b/drivers/spi/fsl_qspi.c
> @@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define TX_BUFFER_SIZE         0x40
>  #endif
>
> -#define OFFSET_BITS_MASK       GENMASK(24, 0)
> +#define OFFSET_BITS_MASK       GENMASK(23, 0)
>
>  #define FLASH_STATUS_WEL       0x02
>

Applied to u-boot-spi/master

-- 
Jagan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform
  2015-12-14 10:32 Gong Qianyu
@ 2015-12-14 10:32 ` Gong Qianyu
  0 siblings, 0 replies; 7+ messages in thread
From: Gong Qianyu @ 2015-12-14 10:32 UTC (permalink / raw)
  To: u-boot

This patch fixes the following compile warning:
drivers/spi/fsl_qspi.c: In function 'fsl_qspi_probe':
drivers/spi/fsl_qspi.c:937:15:
  warning: cast to pointer from integer of different size
					 [-Wint-to-pointer-cast]
  priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
               ^
Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
---
 drivers/spi/fsl_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index d8d37cd..755cc27 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -931,7 +931,7 @@ static int fsl_qspi_probe(struct udevice *bus)
 
 	dm_spi_bus->max_hz = plat->speed_hz;
 
-	priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
+	priv->regs = (struct fsl_qspi_regs *)(unsigned long)plat->reg_base;
 	priv->flags = plat->flags;
 
 	priv->speed_hz = plat->speed_hz;
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform
  2015-12-14 10:26 [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Gong Qianyu
@ 2015-12-14 10:26 ` Gong Qianyu
  0 siblings, 0 replies; 7+ messages in thread
From: Gong Qianyu @ 2015-12-14 10:26 UTC (permalink / raw)
  To: u-boot

This patch fixes the following compile warning:
drivers/spi/fsl_qspi.c: In function 'fsl_qspi_probe':
drivers/spi/fsl_qspi.c:937:15:
  warning: cast to pointer from integer of different size
					 [-Wint-to-pointer-cast]
  priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
               ^
Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
---
 drivers/spi/fsl_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index d8d37cd..755cc27 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -931,7 +931,7 @@ static int fsl_qspi_probe(struct udevice *bus)
 
 	dm_spi_bus->max_hz = plat->speed_hz;
 
-	priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
+	priv->regs = (struct fsl_qspi_regs *)(unsigned long)plat->reg_base;
 	priv->flags = plat->flags;
 
 	priv->speed_hz = plat->speed_hz;
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-07 15:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 10:36 [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Gong Qianyu
2015-12-14 10:36 ` [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform Gong Qianyu
2015-12-14 10:36 ` [U-Boot] [PATCH 3/3] spi: fsl_quadspi: Fix qspi_op_rdid memcpy issue Gong Qianyu
2015-12-14 10:46   ` Gong Q.Y.
2016-01-07 15:27 ` [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Jagan Teki
  -- strict thread matches above, loose matches on Subject: below --
2015-12-14 10:32 Gong Qianyu
2015-12-14 10:32 ` [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform Gong Qianyu
2015-12-14 10:26 [U-Boot] [PATCH 1/3] spi: fsl_qspi: fix an error of using GENMASK Gong Qianyu
2015-12-14 10:26 ` [U-Boot] [PATCH 2/3] spi: fsl_qspi: fix compile warning for 64-bit platform Gong Qianyu

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.