linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jun Nie <niej0001@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/8] pxa: add gpio expander on pxa168 aspenite platform
Date: Mon, 16 Nov 2009 09:34:50 +0000	[thread overview]
Message-ID: <7c34ac520911160134s50f387a3s91485a797a37ce0a@mail.gmail.com> (raw)
In-Reply-To: <7c34ac520911100012s176bff7bk7d57e86cd660632f@mail.gmail.com>

From: Jun Nie <njun@marvell.com>
Date: Fri, 13 Nov 2009 14:19:05 +0800
Subject: [PATCH] pxa: add gpio expander on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/mach-mmp/aspenite.c |   46 ++++++++++++++++++++++++++++++++++++++++++
 drivers/gpio/pca953x.c       |    1 +
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 115f728..21cecfc 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -16,6 +16,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
+#include <linux/i2c/pca953x.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -24,9 +25,14 @@
 #include <mach/pxa168.h>
 #include <mach/gpio.h>
 #include <plat/pxa3xx_nand.h>
+#include <video/pxa168fb.h>

 #include "common.h"

+/*used by expander max7312, 16 pins gpio expander */
+#define GPIO_EXT0(x)		(NR_BUILTIN_GPIO + (x))
+#define GPIO_EXT1(x)		(NR_BUILTIN_GPIO + 16 + (x))
+
 static unsigned long common_pin_config[] __initdata = {
 	/* Data Flash Interface */
 	GPIO0_DFI_D15,
@@ -134,6 +140,44 @@ static void __init apn_init_nand(void)
 static void __init apn_init_nand(void) {}
 #endif

+static struct i2c_pxa_platform_data pwri2c_info __initdata = {
+	.use_pio		= 1,
+};
+
+#if defined(CONFIG_GPIO_PCA953X)
+/* GPIO expander max7312 could reuse PCA953X */
+static struct pca953x_platform_data max7312_data[] = {
+	/* two max7312 in system */
+
+	[0] = {
+		.gpio_base      = GPIO_EXT0(0),
+	},
+
+	[1] = {
+		.gpio_base      = GPIO_EXT1(0),
+	},
+};
+#endif
+
+static struct i2c_board_info aspenite_i2c_board_info[] = {
+
+#if defined(CONFIG_GPIO_PCA953X)
+	{
+		.type           = "max7312",
+		.addr           = 0x10,                 /* 0x20/0x21 */
+		.irq            = IRQ_GPIO(122),
+		.platform_data  = &max7312_data[0],
+	},
+
+	{
+		.type           = "max7312",
+		.addr           = 0x20,                 /* 0x40/0x41 */
+		.irq            = IRQ_GPIO(120),
+		.platform_data  = &max7312_data[1],
+	},
+#endif
+};
+
 static void __init common_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -142,6 +186,8 @@ static void __init common_init(void)
 	pxa168_add_uart(1);

 	apn_init_nand();
+	pxa168_add_twsi(0, &pwri2c_info,
+			ARRAY_AND_SIZE(aspenite_i2c_board_info));

 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 6a2fb3f..7822684 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -39,6 +39,7 @@ static const struct i2c_device_id pca953x_id[] = {
 	{ "pca9557", 8, },

 	{ "max7310", 8, },
+	{ "max7312", 16, },
 	{ "max7315", 8, },
 	{ "pca6107", 8, },
 	{ "tca6408", 8, },
-- 
1.5.4.3

  parent reply	other threads:[~2009-11-16  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10  8:12 [PATCH 6/8] pxa: add gpio expander on pxa168 aspenite platform Jun Nie
2009-11-12  2:18 ` Jun Nie
2009-11-16  9:34 ` Jun Nie [this message]
2009-11-19  9:02   ` Jun Nie

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=7c34ac520911160134s50f387a3s91485a797a37ce0a@mail.gmail.com \
    --to=niej0001@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 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).