All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
To: haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
	alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-discuss@list
Cc: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH v2 7/7] i2c: pxa: support to parse property
Date: Thu, 28 Jul 2011 14:41:33 +0800	[thread overview]
Message-ID: <1311835293-18125-8-git-send-email-haojian.zhuang@marvell.com> (raw)
In-Reply-To: <1311835293-18125-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>

Support to parse some optional properties. These three properties are
mrvl,use-polling, mrvl,i2c-frequency, mrvl,i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform
data except for slave mode.

Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
 .../devicetree/bindings/i2c/pxa255-i2c.txt         |   38 ++++++++++++++++++++
 drivers/i2c/busses/i2c-pxa.c                       |   20 +++++++---
 2 files changed, 52 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
new file mode 100644
index 0000000..4b5afae
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
@@ -0,0 +1,38 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+	- mrvl,use-polling: Specifies whether I2C-Controller is used in polling
+	  mode or interrupt mode. The type of property should be <empty>.
+
+	- mrvl,i2c-frequency: Specifies the frequency that the I2C-Controller
+	  is working. It indicates I2C-Controller running in standard(100Kb/s)
+	  or fast(400Kb/s) speed.
+	  The type of property should be <string>. The value should be "fast".
+
+	- mrvl,i2c-class: Specifies the adaptor class of I2C-Controller, such as
+	  hwmon or ddc bus. The type of property should be <u32>.
+
+Example:
+	i2c0: i2c@d4011000 {
+		compatible = "pxa2xx-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0xd4011000 0x60>;
+		/* I2C-Controller works in polling mode. */
+		mrvl,use-polling;
+		/* I2C-Controller's frequency is FAST. */
+		mrvl,i2c-frequency = "fast";
+		/* interrupt of I2C-Controller */
+		interrupts = <7>;
+		interrupt-parent = <&mmp_intc>;
+
+		pm860x: pmic@34 {
+			interrupt-controller;
+			/* interrupt of pm860x */
+			interrupts = <4>;
+			interrupt-parent = <&mmp_intc>;
+		};
+	};
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 8c27733..cebcd26 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1061,6 +1061,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	enum pxa_i2c_types i2c_type;
 	struct resource *res;
 	int irq, ret;
+	char *p = NULL;
 	static int idx = 0;
 
 	if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 	if (np) {
+		if (of_get_property(np, "mrvl,use-polling", NULL))
+			i2c->use_pio = 1;
+		of_property_read_string(np, "mrvl,i2c-frequency", &p);
+		if (p && !strncmp(p, "fast", 4))
+			i2c->fast_mode = 1;
+		of_property_read_u32(np, "mrvl,i2c-class", &i2c->adap.class);
+
 		i2c->adap.nr = idx++;
 		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 			"pxa2xx-i2c.%u", i2c->adap.nr);
 		i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 	} else {
+		if (plat) {
+			i2c->adap.class = plat->class;
+			i2c->use_pio = plat->use_pio;
+			i2c->fast_mode = plat->fast_mode;
+		}
+
 		/*
 		 * If "dev->id" is negative we consider it as zero.
 		 * The reason to do so is to avoid sysfs names that only make
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	clk_enable(i2c->clk);
 
-	if (plat) {
-		i2c->adap.class = plat->class;
-		i2c->use_pio = plat->use_pio;
-		i2c->fast_mode = plat->fast_mode;
-	}
-
 	if (i2c->use_pio) {
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;
 	} else {
-- 
1.5.6.5

WARNING: multiple messages have this Message-ID (diff)
From: haojian.zhuang@marvell.com (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/7] i2c: pxa: support to parse property
Date: Thu, 28 Jul 2011 14:41:33 +0800	[thread overview]
Message-ID: <1311835293-18125-8-git-send-email-haojian.zhuang@marvell.com> (raw)
In-Reply-To: <1311835293-18125-7-git-send-email-haojian.zhuang@marvell.com>

Support to parse some optional properties. These three properties are
mrvl,use-polling, mrvl,i2c-frequency, mrvl,i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform
data except for slave mode.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
 .../devicetree/bindings/i2c/pxa255-i2c.txt         |   38 ++++++++++++++++++++
 drivers/i2c/busses/i2c-pxa.c                       |   20 +++++++---
 2 files changed, 52 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
new file mode 100644
index 0000000..4b5afae
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
@@ -0,0 +1,38 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+	- mrvl,use-polling: Specifies whether I2C-Controller is used in polling
+	  mode or interrupt mode. The type of property should be <empty>.
+
+	- mrvl,i2c-frequency: Specifies the frequency that the I2C-Controller
+	  is working. It indicates I2C-Controller running in standard(100Kb/s)
+	  or fast(400Kb/s) speed.
+	  The type of property should be <string>. The value should be "fast".
+
+	- mrvl,i2c-class: Specifies the adaptor class of I2C-Controller, such as
+	  hwmon or ddc bus. The type of property should be <u32>.
+
+Example:
+	i2c0: i2c at d4011000 {
+		compatible = "pxa2xx-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0xd4011000 0x60>;
+		/* I2C-Controller works in polling mode. */
+		mrvl,use-polling;
+		/* I2C-Controller's frequency is FAST. */
+		mrvl,i2c-frequency = "fast";
+		/* interrupt of I2C-Controller */
+		interrupts = <7>;
+		interrupt-parent = <&mmp_intc>;
+
+		pm860x: pmic at 34 {
+			interrupt-controller;
+			/* interrupt of pm860x */
+			interrupts = <4>;
+			interrupt-parent = <&mmp_intc>;
+		};
+	};
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 8c27733..cebcd26 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1061,6 +1061,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	enum pxa_i2c_types i2c_type;
 	struct resource *res;
 	int irq, ret;
+	char *p = NULL;
 	static int idx = 0;
 
 	if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 	if (np) {
+		if (of_get_property(np, "mrvl,use-polling", NULL))
+			i2c->use_pio = 1;
+		of_property_read_string(np, "mrvl,i2c-frequency", &p);
+		if (p && !strncmp(p, "fast", 4))
+			i2c->fast_mode = 1;
+		of_property_read_u32(np, "mrvl,i2c-class", &i2c->adap.class);
+
 		i2c->adap.nr = idx++;
 		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 			"pxa2xx-i2c.%u", i2c->adap.nr);
 		i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 	} else {
+		if (plat) {
+			i2c->adap.class = plat->class;
+			i2c->use_pio = plat->use_pio;
+			i2c->fast_mode = plat->fast_mode;
+		}
+
 		/*
 		 * If "dev->id" is negative we consider it as zero.
 		 * The reason to do so is to avoid sysfs names that only make
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	clk_enable(i2c->clk);
 
-	if (plat) {
-		i2c->adap.class = plat->class;
-		i2c->use_pio = plat->use_pio;
-		i2c->fast_mode = plat->fast_mode;
-	}
-
 	if (i2c->use_pio) {
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;
 	} else {
-- 
1.5.6.5

  parent reply	other threads:[~2011-07-28  6:41 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28  6:41 [PATCH v2 00/07] enable devicetree on arch-mmp Haojian Zhuang
2011-07-28  6:41 ` Haojian Zhuang
     [not found] ` <1311835293-18125-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41   ` [PATCH v2 1/7] ARM: mmp: parse irq from DT Haojian Zhuang
2011-07-28  6:41     ` Haojian Zhuang
     [not found]     ` <1311835293-18125-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41       ` [PATCH v2 2/7] ARM: mmp: parse timer configuration " Haojian Zhuang
2011-07-28  6:41         ` Haojian Zhuang
     [not found]         ` <1311835293-18125-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41           ` [PATCH v2 3/7] ARM: mmp: support DT on both dkb and brownstone Haojian Zhuang
2011-07-28  6:41             ` Haojian Zhuang
     [not found]             ` <1311835293-18125-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41               ` [PATCH v2 4/7] tty: serial: support device tree in pxa Haojian Zhuang
2011-07-28  6:41                 ` Haojian Zhuang
     [not found]                 ` <1311835293-18125-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41                   ` [PATCH v2 5/7] tty: serial: check ops before registering console Haojian Zhuang
2011-07-28  6:41                     ` Haojian Zhuang
     [not found]                     ` <1311835293-18125-6-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41                       ` [PATCH v2 6/7] i2c: pxa: support i2c controller from DT Haojian Zhuang
2011-07-28  6:41                         ` Haojian Zhuang
     [not found]                         ` <1311835293-18125-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41                           ` Haojian Zhuang [this message]
2011-07-28  6:41                             ` [PATCH v2 7/7] i2c: pxa: support to parse property Haojian Zhuang
2011-07-29 16:52                           ` [PATCH v2 6/7] i2c: pxa: support i2c controller from DT Grant Likely
2011-07-29 16:52                             ` Grant Likely
     [not found]                             ` <20110729165222.GN11164-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-29 16:55                               ` Russell King - ARM Linux
2011-07-29 16:55                                 ` Russell King - ARM Linux
2011-07-30 14:29                                 ` Mitch Bradley
2011-07-30 14:29                                   ` Mitch Bradley
     [not found]                                   ` <4E34155E.8010606-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2011-07-30 15:37                                     ` Russell King - ARM Linux
2011-07-30 15:37                                       ` Russell King - ARM Linux
     [not found]                                       ` <20110730153728.GA17570-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-07-31  0:38                                         ` Grant Likely
2011-07-31  0:38                                           ` Grant Likely
2011-07-29 16:45                   ` [PATCH v2 4/7] tty: serial: support device tree in pxa Grant Likely
2011-07-29 16:45                     ` Grant Likely
2011-07-29 16:49                     ` Russell King - ARM Linux
2011-07-29 16:49                       ` Russell King - ARM Linux
     [not found]                       ` <20110729164922.GA30298-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-07-29 16:53                         ` Grant Likely
2011-07-29 16:53                           ` Grant Likely
2011-08-01  2:50                       ` Haojian Zhuang
2011-08-01  2:50                         ` Haojian Zhuang
     [not found]                         ` <CAN1soZwYjQp5c=4f=CbqjrXFxzSURSv6i9QHMyjyPszs=kzh9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-01  8:27                           ` Russell King - ARM Linux
2011-08-01  8:27                             ` Russell King - ARM Linux
2011-07-29 16:42               ` [PATCH v2 3/7] ARM: mmp: support DT on both dkb and brownstone Grant Likely
2011-07-29 16:42                 ` Grant Likely
     [not found]                 ` <20110729164218.GL11164-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-08-01  2:48                   ` Haojian Zhuang
2011-08-01  2:48                     ` Haojian Zhuang
2011-07-29 16:40           ` [PATCH v2 2/7] ARM: mmp: parse timer configuration from DT Grant Likely
2011-07-29 16:40             ` Grant Likely
2011-07-29 16:36       ` [PATCH v2 1/7] ARM: mmp: parse irq " Grant Likely
2011-07-29 16:36         ` Grant Likely
2011-08-01  2:47         ` Haojian Zhuang
2011-08-01  2:47           ` Haojian Zhuang
     [not found]           ` <CAN1soZxX6EBRPvzV_00njioBn1NfiAbLBoD7EYc-wV-uQM_VoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-01 14:10             ` Grant Likely
2011-08-01 14:10               ` Grant Likely
     [not found]               ` <20110801141036.GA21627-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-08-01 14:42                 ` Haojian Zhuang
2011-08-01 14:42                   ` Haojian Zhuang
2011-08-01 14:43                   ` Grant Likely
2011-08-01 14:43                     ` Grant Likely
2011-08-01  8:26     ` Russell King - ARM Linux
2011-08-01  8:26       ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311835293-18125-8-git-send-email-haojian.zhuang@marvell.com \
    --to=haojian.zhuang-eyqppykdwxrbdgjk7y7tuq@public.gmane.org \
    --cc=alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=devicetree-discuss@list \
    --cc=eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.