Linux-Devicetree Archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: i.MX6QDL-SabreAuto: assert GPIO hog for imx-weim
@ 2015-12-06  3:30 alchaiken
  2015-12-06  3:30 ` [PATCH 1/2] bus: imx-weim: assert GPIO at boot in order to connect NOR alchaiken
       [not found] ` <1449372657-18496-1-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
  0 siblings, 2 replies; 8+ messages in thread
From: alchaiken @ 2015-12-06  3:30 UTC (permalink / raw
  To: linux-arm-kernel
  Cc: frowand.list, shawnguo, alison_chaiken, kernel, devicetree

From: Alison Chaiken <alison_chaiken@mentor.com>

The parallel NOR that is attached to the i.MX6-SabreAuto WEIM switch
needs a GPIO asserted at boot in order to probe properly.  Employ the
GPIO hogging mechanism to set the GPIO properly.  Also, add partitions
subnode to NOR device-tree node to make MTD initialization work.

Alison Chaiken (2):
  bus: imx-weim: assert GPIO at boot in order to connect NOR
  ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR

 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi |  5 ++++
 drivers/bus/imx-weim.c                   | 45 ++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

-- 
2.6.2

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

* [PATCH 1/2] bus: imx-weim: assert GPIO at boot in order to connect NOR
  2015-12-06  3:30 [PATCH 0/2] ARM: i.MX6QDL-SabreAuto: assert GPIO hog for imx-weim alchaiken
@ 2015-12-06  3:30 ` alchaiken
       [not found]   ` <1449372657-18496-2-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
       [not found] ` <1449372657-18496-1-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: alchaiken @ 2015-12-06  3:30 UTC (permalink / raw
  To: linux-arm-kernel
  Cc: frowand.list, shawnguo, alison_chaiken, kernel, devicetree

From: Alison Chaiken <alison_chaiken@mentor.com>

PAD_EIM_D18 must be pulled low at boot in order for the parallel NOR
connected to the EIM switch to probe properly.  Otherwise
cfi_qry_present() may return "U-V-]" rather than "Q-R-Y" if the
PAD_EIM_D18 is high.  Add a nor-gpios property to the nor node in the
SabreAuto device-tree and add a function to the imx-weim probe to set
GPIO5 to drive the pad.

Signed-off-by: Alison Chaiken <alison_chaiken@mentor.com>
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi |  1 +
 drivers/bus/imx-weim.c                   | 45 ++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 8263fc1..530b4d6 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -625,5 +625,6 @@
 		bank-width = <2>;
 		fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
 				0x0000c000 0x1404a38e 0x00000000>;
+		nor-gpios = <&gpio5 4 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
index e98d15e..7b841d4 100644
--- a/drivers/bus/imx-weim.c
+++ b/drivers/bus/imx-weim.c
@@ -14,6 +14,8 @@
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
 #include <linux/regmap.h>
+#include <linux/of_gpio.h>
+#include <linux/gpio.h>
 
 struct imx_weim_devtype {
 	unsigned int	cs_count;
@@ -108,6 +110,40 @@ err:
 	return -EINVAL;
 }
 
+/* set the GPIO to control PAD_EIM_D18 so cfi_qry_present() works properly */
+static int __init nor_gpio_setup(struct device_node *np, struct device *parent)
+{
+	unsigned nor_gpio, level;
+	enum of_gpio_flags of_flags;
+	int ret;
+
+	nor_gpio = of_get_named_gpio_flags(np, "nor-gpios", 0, &of_flags);
+
+	/* this child is not a NOR chip */
+	if (!nor_gpio)
+		return 0;
+
+	if (gpio_is_valid(nor_gpio)) {
+		ret = devm_gpio_request_one(parent, nor_gpio,
+					GPIOF_DIR_OUT, "nor-gpio");
+	} else {
+		ret = -ENODEV;
+		goto out;
+	}
+
+	if (ret < 0)
+		goto out;
+
+	level = ((of_flags == OF_GPIO_ACTIVE_LOW) ? 0 : 1);
+
+	gpio_set_value(nor_gpio, level);
+
+	return 0;
+out:
+	dev_err(parent, "Unable to request EIM_D18 GPIO for NOR.\n");
+	return ret;
+}
+
 /* Parse and set the timing for this device. */
 static int __init weim_timing_setup(struct device_node *np, void __iomem *base,
 				    const struct imx_weim_devtype *devtype)
@@ -154,6 +190,15 @@ static int __init weim_parse_dt(struct platform_device *pdev,
 		if (!child->name)
 			continue;
 
+		if (of_device_is_compatible(child, "cfi-flash")) {
+			ret = nor_gpio_setup(child, &pdev->dev);
+			if (ret) {
+				dev_err(&pdev->dev, "%s gpios setup failed.\n",
+					child->full_name);
+				return ret;
+			}
+		}
+
 		ret = weim_timing_setup(child, base, devtype);
 		if (ret)
 			dev_warn(&pdev->dev, "%s set timing failed.\n",
-- 
2.6.2

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

* [PATCH 2/2] ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR
       [not found] ` <1449372657-18496-1-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
@ 2015-12-06  3:30   ` alchaiken-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 8+ messages in thread
From: alchaiken-Re5JQEeQqe8AvxtiuMwx3w @ 2015-12-06  3:30 UTC (permalink / raw
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	frowand.list-Re5JQEeQqe8AvxtiuMwx3w,
	devicetree-u79uwXL29TY76Z2rM5mHXA

From: Alison Chaiken <alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>

Add a 'partitions' property to the nor child of the WEIM bus so
that ofpart will allow partiton creation.

Signed-off-by: Alison Chaiken <alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 530b4d6..10293f2 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -626,5 +626,9 @@
 		fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
 				0x0000c000 0x1404a38e 0x00000000>;
 		nor-gpios = <&gpio5 4 GPIO_ACTIVE_LOW>;
+		partitions@0 {
+			label = "pnor";
+			reg = <0x0 0x1000000>;
+		};
 	};
 };
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] bus: imx-weim: assert GPIO at boot in order to connect NOR
       [not found]   ` <1449372657-18496-2-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
@ 2015-12-07  8:24     ` Sascha Hauer
  2015-12-08 23:48       ` [PATCH v2 0/2] ARM: dts: imx6qdl-sabreauto: employ GPIO init-val for p-NOR Alison Chaiken
  0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2015-12-07  8:24 UTC (permalink / raw
  To: alchaiken-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	frowand.list-Re5JQEeQqe8AvxtiuMwx3w,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A,
	alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA

On Sat, Dec 05, 2015 at 07:30:56PM -0800, alchaiken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> From: Alison Chaiken <alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
> 
> PAD_EIM_D18 must be pulled low at boot in order for the parallel NOR
> connected to the EIM switch to probe properly.  Otherwise
> cfi_qry_present() may return "U-V-]" rather than "Q-R-Y" if the
> PAD_EIM_D18 is high.  Add a nor-gpios property to the nor node in the
> SabreAuto device-tree and add a function to the imx-weim probe to set
> GPIO5 to drive the pad.
> 
> Signed-off-by: Alison Chaiken <alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
> ---
>  arch/arm/boot/dts/imx6qdl-sabreauto.dtsi |  1 +
>  drivers/bus/imx-weim.c                   | 45 ++++++++++++++++++++++++++++++++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
> index 8263fc1..530b4d6 100644
> --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
> @@ -625,5 +625,6 @@
>  		bank-width = <2>;
>  		fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
>  				0x0000c000 0x1404a38e 0x00000000>;
> +		nor-gpios = <&gpio5 4 GPIO_ACTIVE_LOW>;
>  	};
>  };

Please do not make board specific and driver specific changes in a
single patch. Also this would need an update to the binding
documentation.

How is this pin connected? Is this a problem of this NOR flash,
something i.MX6 specific or some problem of this particular board?
Depending on the answer we may find a better place to implement the
handling of this gpio. If it's a board problem Markus Pargmanns
gpio-initval series is better suited, if it's a problem of the NOR flash
the parallel NOR flash driver is a better place.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 0/2] ARM: dts: imx6qdl-sabreauto: employ GPIO init-val for p-NOR
  2015-12-07  8:24     ` Sascha Hauer
@ 2015-12-08 23:48       ` Alison Chaiken
  2015-12-08 23:48         ` [PATCH v2 1/2] ARM: dts: imx6qdl-sabreauto: assert GPIO at boot in order to connect NOR Alison Chaiken
  2015-12-08 23:48         ` [PATCH v2 2/2] ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR Alison Chaiken
  0 siblings, 2 replies; 8+ messages in thread
From: Alison Chaiken @ 2015-12-08 23:48 UTC (permalink / raw
  To: linux-arm-kernel
  Cc: devicetree, alison, rowand.list, kernel, shawnguo, alison_chaiken

The parallel NOR that is attached to the i.MX6-SabreAuto WEIM switch
needs a GPIO asserted at boot in order to probe properly.  Employ the
GPIO init-val mechanism to set the GPIO.  Also, add partitions subnode
to NOR device-tree node to make MTD initialization work.

Alison Chaiken (2):
  ARM: dts: imx6qdl-sabreauto: assert GPIO at boot in order to connect
    NOR
  ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR

 arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi | 43 ++++++++++++++++++++++++
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi         |  4 +++
 2 files changed, 47 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi

-- 
2.6.2

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

* [PATCH v2 1/2] ARM: dts: imx6qdl-sabreauto: assert GPIO at boot in order to connect NOR
  2015-12-08 23:48       ` [PATCH v2 0/2] ARM: dts: imx6qdl-sabreauto: employ GPIO init-val for p-NOR Alison Chaiken
@ 2015-12-08 23:48         ` Alison Chaiken
       [not found]           ` <1449618520-3432-2-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
  2015-12-08 23:48         ` [PATCH v2 2/2] ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR Alison Chaiken
  1 sibling, 1 reply; 8+ messages in thread
From: Alison Chaiken @ 2015-12-08 23:48 UTC (permalink / raw
  To: linux-arm-kernel
  Cc: devicetree, alison, rowand.list, kernel, shawnguo, alison_chaiken

PAD_EIM_D18 must be pulled low at boot in order for the parallel NOR
connected to the EIM switch to probe properly.  Otherwise the imx-weim
device will register properly, but cfi_qry_present() will return
"U-V-]" rather than "Q-R-Y".  Employ the gpio-initval mechanism in
GPIO5 node in the SabreAuto device-tree in order to set the pin.

Signed-off-by: Alison Chaiken <alison_chaiken@mentor.com>
---
 arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi | 43 ++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi
new file mode 100644
index 0000000..66a9aa2
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto-eim-nor.dtsi
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ * Copyright (c) 2012-2015 Mentor Graphics Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+&weim {
+	status = "okay";
+};
+
+&gpio5 {
+	p4 {
+		/* Select NOR or I2C3 via setting of port-expander
+		 * steering logic.
+		 * Low: Attach p-NOR line D18.
+		 * High: Attach I2C3 line SDA.
+		 */
+		gpio-initval;
+		gpios = <4 GPIO_ACTIVE_HIGH>;
+		output-low;
+		line-name = "SelNORorI2C3";
+	};
+};
+
+&i2c3 {
+	status = "disabled";
+};
+
+/* the following devices have pinmux conflicts with NOR */
+&uart3 {
+	status = "disabled";
+};
+
+&ecspi1 {
+	status = "disabled";
+};
-- 
2.6.2

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

* [PATCH v2 2/2] ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR
  2015-12-08 23:48       ` [PATCH v2 0/2] ARM: dts: imx6qdl-sabreauto: employ GPIO init-val for p-NOR Alison Chaiken
  2015-12-08 23:48         ` [PATCH v2 1/2] ARM: dts: imx6qdl-sabreauto: assert GPIO at boot in order to connect NOR Alison Chaiken
@ 2015-12-08 23:48         ` Alison Chaiken
  1 sibling, 0 replies; 8+ messages in thread
From: Alison Chaiken @ 2015-12-08 23:48 UTC (permalink / raw
  To: linux-arm-kernel
  Cc: devicetree, alison, rowand.list, kernel, shawnguo, alison_chaiken

Add a 'partitions' property to the nor child of the WEIM bus so
that ofpart will allow partition creation.

Signed-off-by: Alison Chaiken <alison_chaiken@mentor.com>
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 8263fc1..1a29fff 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -625,5 +625,9 @@
 		bank-width = <2>;
 		fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
 				0x0000c000 0x1404a38e 0x00000000>;
+		partitions@0 {
+			label = "pnor";
+			reg = <0x0 0x1000000>;
+		};
 	};
 };
-- 
2.6.2

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

* Re: [PATCH v2 1/2] ARM: dts: imx6qdl-sabreauto: assert GPIO at boot in order to connect NOR
       [not found]           ` <1449618520-3432-2-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
@ 2015-12-09 13:25             ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2015-12-09 13:25 UTC (permalink / raw
  To: Alison Chaiken
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	alison-hh6fLRYtCEIS+FvcfC7Uqw, rowand.list-Re5JQEeQqe8AvxtiuMwx3w,
	Shawn Guo, Sascha Hauer,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Dec 8, 2015 at 9:48 PM, Alison Chaiken
<alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org> wrote:

> +&gpio5 {
> +       p4 {
> +               /* Select NOR or I2C3 via setting of port-expander
> +                * steering logic.
> +                * Low: Attach p-NOR line D18.
> +                * High: Attach I2C3 line SDA.
> +                */
> +               gpio-initval;

Markus' series that add gpio-initval property has not been applied
yet. I could not see it in linux-next.

It seems you need his series to be applied first.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-12-09 13:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-06  3:30 [PATCH 0/2] ARM: i.MX6QDL-SabreAuto: assert GPIO hog for imx-weim alchaiken
2015-12-06  3:30 ` [PATCH 1/2] bus: imx-weim: assert GPIO at boot in order to connect NOR alchaiken
     [not found]   ` <1449372657-18496-2-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
2015-12-07  8:24     ` Sascha Hauer
2015-12-08 23:48       ` [PATCH v2 0/2] ARM: dts: imx6qdl-sabreauto: employ GPIO init-val for p-NOR Alison Chaiken
2015-12-08 23:48         ` [PATCH v2 1/2] ARM: dts: imx6qdl-sabreauto: assert GPIO at boot in order to connect NOR Alison Chaiken
     [not found]           ` <1449618520-3432-2-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
2015-12-09 13:25             ` Fabio Estevam
2015-12-08 23:48         ` [PATCH v2 2/2] ARM: dts: imx6qdl-sabreauto: enable partitions for parallel NOR Alison Chaiken
     [not found] ` <1449372657-18496-1-git-send-email-alison_chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
2015-12-06  3:30   ` [PATCH " alchaiken-Re5JQEeQqe8AvxtiuMwx3w

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 read-only IMAP folder(s) and NNTP newsgroup(s).