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

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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

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

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")
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

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

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>
---
 .../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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: maps: physmap: Store gpio_values correctly
  2019-03-28  4:02 ` [PATCH 1/2] mtd: maps: physmap: Store gpio_values correctly Chris Packham
@ 2019-03-28  8:32   ` Boris Brezillon
  2019-03-28 19:59     ` Chris Packham
  0 siblings, 1 reply; 5+ messages in thread
From: Boris Brezillon @ 2019-03-28  8:32 UTC (permalink / raw)
  To: Chris Packham
  Cc: mark.rutland, devicetree, bbrezillon, richard, linux-kernel,
	marek.vasut, robh+dt, linux-mtd, computersforpeace, dwmw2

On Thu, 28 Mar 2019 17:02:15 +1300
Chris Packham <chris.packham@alliedtelesis.co.nz> wrote:

> 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")

You miss

Cc: <stable@vger.kernel.org>

> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
>  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)


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: maps: physmap: Store gpio_values correctly
  2019-03-28  8:32   ` Boris Brezillon
@ 2019-03-28 19:59     ` Chris Packham
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Packham @ 2019-03-28 19:59 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: mark.rutland, devicetree, bbrezillon, richard, linux-kernel,
	marek.vasut, robh+dt, linux-mtd, computersforpeace, dwmw2

On 28/03/19 9:32 PM, Boris Brezillon wrote:
> On Thu, 28 Mar 2019 17:02:15 +1300
> Chris Packham <chris.packham@alliedtelesis.co.nz> wrote:
> 
>> 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")
> 
> You miss
> 
> Cc: <stable@vger.kernel.org>
> 

I wasn't sure. As the original commit said there are no in-tree users of 
  addr-gpios so maybe no-one else noticed. I'll wait for any other 
comments and send a v2 with a Cc for stable.

>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> 
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> 
>> ---
>>   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)
> 
> 


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2019-03-28 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-28  4:02 [PATCH 0/2] mtd: physmap: Using gpio-addrs Chris Packham
2019-03-28  4:02 ` [PATCH 1/2] mtd: maps: physmap: Store gpio_values correctly Chris Packham
2019-03-28  8:32   ` Boris Brezillon
2019-03-28 19:59     ` Chris Packham
2019-03-28  4:02 ` [PATCH 2/2] dt-binding: mtd: physmap: Add example using addr-gpios property Chris Packham

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).