Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add __ioread32_copy() and use it
@ 2015-09-17 19:02 Stephen Boyd
  2015-09-17 19:02 ` [PATCH v2 3/3] FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding Stephen Boyd
  2015-09-17 19:56 ` [PATCH v2 0/3] Add __ioread32_copy() and use it Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-09-17 19:02 UTC (permalink / raw)
  To: Andy Gross
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, linux-soc,
	linux-mips, Hauke Mehrtens, Paul Walmsley, Andrew Morton,
	Rafał Miłecki, Bjorn Andersson

The SMD driver is reading and writing chunks of data to iomem,
and there's an __iowrite32_copy() function for the writing part, but
no __ioread32_copy() function for the reading part. This series
adds __ioread32_copy() and uses it in two places. Andrew is on Cc in
case this should go through the -mm tree. Otherwise the target
of this patch series is SMD, so I've sent it to Andy.

Note this patch series relies on a previous patch on the list that
changes the readl() to __raw_readl() in the smd driver[1].

Changes since v1:
 * Dropped weak from __ioread32_copy()

Stephen Boyd (3):
  lib: iomap_copy: Add __ioread32_copy()
  soc: qcom: smd: Use __ioread32_copy() instead of open-coding it
  FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding

 drivers/firmware/broadcom/bcm47xx_nvram.c | 11 +++--------
 drivers/soc/qcom/smd.c                    | 13 ++++---------
 include/linux/io.h                        |  1 +
 lib/iomap_copy.c                          | 21 +++++++++++++++++++++
 4 files changed, 29 insertions(+), 17 deletions(-)

[1] http://lkml.kernel.org/g/1441234011-4259-7-git-send-email-sboyd@codeaurora.org

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH v2 3/3] FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding
  2015-09-17 19:02 [PATCH v2 0/3] Add __ioread32_copy() and use it Stephen Boyd
@ 2015-09-17 19:02 ` Stephen Boyd
  2015-09-22 16:29   ` Ralf Baechle
  2015-09-17 19:56 ` [PATCH v2 0/3] Add __ioread32_copy() and use it Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2015-09-17 19:02 UTC (permalink / raw)
  To: Andy Gross
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Andrew Morton,
	Bjorn Andersson, Hauke Mehrtens, Rafał Miłecki,
	Paul Walmsley, linux-mips

Now that we have a generic library function for this, replace the
open-coded instance.

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: linux-mips@linux-mips.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/firmware/broadcom/bcm47xx_nvram.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c
index e41594510b97..8f46e6e394b1 100644
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
@@ -56,9 +56,7 @@ static u32 find_nvram_size(void __iomem *end)
 static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
 {
 	struct nvram_header __iomem *header;
-	int i;
 	u32 off;
-	u32 *src, *dst;
 	u32 size;
 
 	if (nvram_len) {
@@ -95,10 +93,7 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
 	return -ENXIO;
 
 found:
-	src = (u32 *)header;
-	dst = (u32 *)nvram_buf;
-	for (i = 0; i < sizeof(struct nvram_header); i += 4)
-		*dst++ = __raw_readl(src++);
+	__ioread32_copy(nvram_buf, header, sizeof(*header) / 4);
 	header = (struct nvram_header *)nvram_buf;
 	nvram_len = header->len;
 	if (nvram_len > size) {
@@ -111,8 +106,8 @@ found:
 		nvram_len = NVRAM_SPACE - 1;
 	}
 	/* proceed reading data after header */
-	for (; i < nvram_len; i += 4)
-		*dst++ = readl(src++);
+	__ioread32_copy(nvram_buf + sizeof(*header), header + 1,
+			DIV_ROUND_UP(nvram_len / 4));
 	nvram_buf[NVRAM_SPACE - 1] = '\0';
 
 	return 0;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v2 0/3] Add __ioread32_copy() and use it
  2015-09-17 19:02 [PATCH v2 0/3] Add __ioread32_copy() and use it Stephen Boyd
  2015-09-17 19:02 ` [PATCH v2 3/3] FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding Stephen Boyd
@ 2015-09-17 19:56 ` Andrew Morton
  2015-09-17 21:42   ` Andy Gross
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2015-09-17 19:56 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Andy Gross, linux-kernel, linux-arm-msm, linux-arm-kernel,
	linux-soc, linux-mips, Hauke Mehrtens, Paul Walmsley,
	Rafał Miłecki, Bjorn Andersson

On Thu, 17 Sep 2015 12:02:08 -0700 Stephen Boyd <sboyd@codeaurora.org> wrote:

> The SMD driver is reading and writing chunks of data to iomem,
> and there's an __iowrite32_copy() function for the writing part, but
> no __ioread32_copy() function for the reading part. This series
> adds __ioread32_copy() and uses it in two places. Andrew is on Cc in
> case this should go through the -mm tree. Otherwise the target
> of this patch series is SMD, so I've sent it to Andy.
> 
> Note this patch series relies on a previous patch on the list that
> changes the readl() to __raw_readl() in the smd driver[1].

Well that's awkward.

"[PATCH v2 6/8] soc: qcom: smd: Handle big endian CPUs" is one patch in
an eight-patch series.  My usual approach would be to suck in the whole
series, stage it behind linux-next, drop patches if/when others merge
them into subsystem trees and thus retain all the dependencies for this
patch series in a maintainable-by-me fashion.

But that 8-patch series doesn't apply:

checking file drivers/soc/qcom/smd.c
Hunk #6 FAILED at 360.
Hunk #15 FAILED at 733.
Hunk #16 FAILED at 741.
3 out of 19 hunks FAILED
Failed to apply soc-qcom-smd-handle-big-endian-cpus


ho hum.  I think I'll go with plan B: merge just "lib: iomap_copy: Add
__ioread32_copy()" and send that into Linus promptly.  That way you
guys can sort out the driver patches in the usual fashion.

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

* Re: [PATCH v2 0/3] Add __ioread32_copy() and use it
  2015-09-17 19:56 ` [PATCH v2 0/3] Add __ioread32_copy() and use it Andrew Morton
@ 2015-09-17 21:42   ` Andy Gross
  2015-09-17 21:44     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Gross @ 2015-09-17 21:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Stephen Boyd, linux-kernel, linux-arm-msm, linux-arm-kernel,
	linux-soc, linux-mips, Hauke Mehrtens, Paul Walmsley,
	Rafał Miłecki, Bjorn Andersson

On Thu, Sep 17, 2015 at 12:56:51PM -0700, Andrew Morton wrote:
> On Thu, 17 Sep 2015 12:02:08 -0700 Stephen Boyd <sboyd@codeaurora.org> wrote:
> 
> > The SMD driver is reading and writing chunks of data to iomem,
> > and there's an __iowrite32_copy() function for the writing part, but
> > no __ioread32_copy() function for the reading part. This series
> > adds __ioread32_copy() and uses it in two places. Andrew is on Cc in
> > case this should go through the -mm tree. Otherwise the target
> > of this patch series is SMD, so I've sent it to Andy.
> > 
> > Note this patch series relies on a previous patch on the list that
> > changes the readl() to __raw_readl() in the smd driver[1].
> 
> Well that's awkward.
> 
> "[PATCH v2 6/8] soc: qcom: smd: Handle big endian CPUs" is one patch in
> an eight-patch series.  My usual approach would be to suck in the whole
> series, stage it behind linux-next, drop patches if/when others merge
> them into subsystem trees and thus retain all the dependencies for this
> patch series in a maintainable-by-me fashion.
> 
> But that 8-patch series doesn't apply:
> 
> checking file drivers/soc/qcom/smd.c
> Hunk #6 FAILED at 360.
> Hunk #15 FAILED at 733.
> Hunk #16 FAILED at 741.
> 3 out of 19 hunks FAILED
> Failed to apply soc-qcom-smd-handle-big-endian-cpus
> 
> 
> ho hum.  I think I'll go with plan B: merge just "lib: iomap_copy: Add
> __ioread32_copy()" and send that into Linus promptly.  That way you
> guys can sort out the driver patches in the usual fashion.
> 

I just pulled in the original 8 patches and rebased.  My plans were to stage
those in linux-next through my for-next.  Then add those on top just like you
specified.  But i could go either way.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v2 0/3] Add __ioread32_copy() and use it
  2015-09-17 21:42   ` Andy Gross
@ 2015-09-17 21:44     ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2015-09-17 21:44 UTC (permalink / raw)
  To: Andy Gross
  Cc: Stephen Boyd, linux-kernel, linux-arm-msm, linux-arm-kernel,
	linux-soc, linux-mips, Hauke Mehrtens, Paul Walmsley,
	Rafał Miłecki, Bjorn Andersson

On Thu, 17 Sep 2015 16:42:18 -0500 Andy Gross <agross@codeaurora.org> wrote:

> > ho hum.  I think I'll go with plan B: merge just "lib: iomap_copy: Add
> > __ioread32_copy()" and send that into Linus promptly.  That way you
> > guys can sort out the driver patches in the usual fashion.
> > 
> 
> I just pulled in the original 8 patches and rebased.  My plans were to stage
> those in linux-next through my for-next.  Then add those on top just like you
> specified.  But i could go either way.

OK, please do that.

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

* Re: [PATCH v2 3/3] FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding
  2015-09-17 19:02 ` [PATCH v2 3/3] FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding Stephen Boyd
@ 2015-09-22 16:29   ` Ralf Baechle
  0 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2015-09-22 16:29 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Andy Gross, linux-kernel, linux-arm-msm, linux-arm-kernel,
	Andrew Morton, Bjorn Andersson, Hauke Mehrtens,
	Rafał Miłecki, Paul Walmsley, linux-mips

On Thu, Sep 17, 2015 at 12:02:11PM -0700, Stephen Boyd wrote:

> Now that we have a generic library function for this, replace the
> open-coded instance.
> 
> Cc: Hauke Mehrtens <hauke@hauke-m.de>
> Cc: Rafał Miłecki <zajec5@gmail.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: linux-mips@linux-mips.org
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Looking good.

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

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

end of thread, other threads:[~2015-09-22 16:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 19:02 [PATCH v2 0/3] Add __ioread32_copy() and use it Stephen Boyd
2015-09-17 19:02 ` [PATCH v2 3/3] FIRMWARE: bcm47xx_nvram: Use __ioread32_copy() instead of open-coding Stephen Boyd
2015-09-22 16:29   ` Ralf Baechle
2015-09-17 19:56 ` [PATCH v2 0/3] Add __ioread32_copy() and use it Andrew Morton
2015-09-17 21:42   ` Andy Gross
2015-09-17 21:44     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox