linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mtd: physmap: Using gpio-addrs
@ 2019-03-29  2:13 Chris Packham
  2019-03-29  2:13 ` [PATCH v2 1/2] mtd: maps: physmap: Store gpio_values correctly Chris Packham
  2019-03-29  2:13 ` [PATCH v2 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property Chris Packham
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Packham @ 2019-03-29  2:13 UTC (permalink / raw)
  To: bbrezillon, computersforpeace, dwmw2, marek.vasut, richard,
	robh+dt, mark.rutland
  Cc: linux-mtd, devicetree, linux-kernel, Chris Packham

I have a system with ADDR24 of the flash chip connected to a gpio pin. This
series fixes a bug in physmap-core.c and adds an example for using gpio-addrs
to the dt-binding based on the system I'm using.

Chris Packham (2):
  mtd: maps: physmap: Store gpio_values correctly
  dt-binding: mtd: physmap: Add example using addr-gpios property

 .../devicetree/bindings/mtd/mtd-physmap.txt      | 16 ++++++++++++++++
 drivers/mtd/maps/physmap-core.c                  |  2 ++
 2 files changed, 18 insertions(+)

-- 
2.21.0


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

* [PATCH v2 1/2] mtd: maps: physmap: Store gpio_values correctly
  2019-03-29  2:13 [PATCH v2 0/2] mtd: physmap: Using gpio-addrs Chris Packham
@ 2019-03-29  2:13 ` Chris Packham
  2019-03-29  2:13 ` [PATCH v2 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property Chris Packham
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Packham @ 2019-03-29  2:13 UTC (permalink / raw)
  To: bbrezillon, computersforpeace, dwmw2, marek.vasut, richard,
	robh+dt, mark.rutland
  Cc: linux-mtd, devicetree, linux-kernel, Chris Packham, stable,
	Boris Brezillon

When the gpio-addr-flash.c driver was merged with physmap-core.c the
code to store the current gpio_values was lost. This meant that once a
gpio was asserted it was never de-asserted. Fix this by storing the
current offset in gpio_values like the old driver used to.

Fixes: commit ba32ce95cbd9 ("mtd: maps: Merge gpio-addr-flash.c into physmap-core.c")
Cc: <stable@vger.kernel.org>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Changes in v2:
- Cc stable, add Boris' review

 drivers/mtd/maps/physmap-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
index d9a3e4bebe5d..21b556afc305 100644
--- a/drivers/mtd/maps/physmap-core.c
+++ b/drivers/mtd/maps/physmap-core.c
@@ -132,6 +132,8 @@ static void physmap_set_addr_gpios(struct physmap_flash_info *info,
 
 		gpiod_set_value(info->gpios->desc[i], !!(BIT(i) & ofs));
 	}
+
+	info->gpio_values = ofs;
 }
 
 #define win_mask(order)		(BIT(order) - 1)
-- 
2.21.0


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

* [PATCH v2 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property
  2019-03-29  2:13 [PATCH v2 0/2] mtd: physmap: Using gpio-addrs Chris Packham
  2019-03-29  2:13 ` [PATCH v2 1/2] mtd: maps: physmap: Store gpio_values correctly Chris Packham
@ 2019-03-29  2:13 ` Chris Packham
  2019-04-06  6:05   ` Rob Herring
  1 sibling, 1 reply; 4+ messages in thread
From: Chris Packham @ 2019-03-29  2:13 UTC (permalink / raw)
  To: bbrezillon, computersforpeace, dwmw2, marek.vasut, richard,
	robh+dt, mark.rutland
  Cc: linux-mtd, devicetree, linux-kernel, Chris Packham

Add an example showing how to use the addr-gpios property to deal with a
system with limited IO space.

Cc: devicetree@vger.kernel.org
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Changes in v2:
- None

 .../devicetree/bindings/mtd/mtd-physmap.txt      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/mtd-physmap.txt b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
index 7df0dcaccb7d..c69f4f065d23 100644
--- a/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
+++ b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
@@ -96,3 +96,19 @@ An example using SRAM:
 		bank-width = <2>;
 	};
 
+An example using gpio-addrs
+
+	flash@20000000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "cfi-flash", "jedec-flash";
+		reg = <0x20000000 0x02000000>;
+		ranges = <0 0x00000000 0x02000000
+		          1 0x02000000 0x02000000>;
+		bank-width = <2>;
+		addr-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+		partition@0 {
+			label = "test-part1";
+			reg = <0 0x04000000>;
+		};
+	};
-- 
2.21.0


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

* Re: [PATCH v2 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property
  2019-03-29  2:13 ` [PATCH v2 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property Chris Packham
@ 2019-04-06  6:05   ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2019-04-06  6:05 UTC (permalink / raw)
  To: Chris Packham
  Cc: bbrezillon, computersforpeace, dwmw2, marek.vasut, richard,
	robh+dt, mark.rutland, linux-mtd, devicetree, linux-kernel,
	Chris Packham

On Fri, 29 Mar 2019 15:13:22 +1300, Chris Packham wrote:
> Add an example showing how to use the addr-gpios property to deal with a
> system with limited IO space.
> 
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> Changes in v2:
> - None
> 
>  .../devicetree/bindings/mtd/mtd-physmap.txt      | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

end of thread, other threads:[~2019-04-06  6:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29  2:13 [PATCH v2 0/2] mtd: physmap: Using gpio-addrs Chris Packham
2019-03-29  2:13 ` [PATCH v2 1/2] mtd: maps: physmap: Store gpio_values correctly Chris Packham
2019-03-29  2:13 ` [PATCH v2 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property Chris Packham
2019-04-06  6:05   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).