public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] AB8500 GPIO : Board Support for  AB8500 GPIO Driver
@ 2011-02-16  3:34 Bibek Basu
  2011-02-16  3:34 ` [PATCH] AB8500 GPIO : Driver for 42 AB8500 GPIO pins Bibek Basu
  0 siblings, 1 reply; 16+ messages in thread
From: Bibek Basu @ 2011-02-16  3:34 UTC (permalink / raw)
  To: linus.walleij, sameo; +Cc: dbrownell, lee.jones, linux-kernel, bibek.basu

This is the board support patch for ab8500 gpio driver
on mach-ux500.Patch implements 16 virtual
IRQ mapped to 16 interrupt capable AB8500 GPIOs.

Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
---
 arch/arm/mach-ux500/board-mop500.c                 |   23 ++++++++++++++++++++
 arch/arm/mach-ux500/board-mop500.h                 |    3 +-
 .../mach-ux500/include/mach/irqs-board-mop500.h    |   15 +++++++++++-
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 67d9c63..8a4785b 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -21,6 +21,7 @@
 #include <linux/spi/spi.h>
 #include <linux/mfd/ab8500.h>
 #include <linux/mfd/tc3589x.h>
+#include <linux/mfd/ab8500/ab8500-gpio.h>
 #include <linux/leds-lp5521.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
@@ -102,10 +103,32 @@ static pin_cfg_t mop500_pins[] = {
 	GPIO267_USB_DAT0	| PIN_PULL_DOWN,
 };
 
+static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
+	.gpio_base		= MOP500_AB8500_GPIO(0),
+	/* config_reg is the initial configuration of ab8500 pins.
+	 * The pins can be configured as GPIO or alt functions based
+	 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
+	 * register. This is the array of 7 configuration settings.
+	 * One has to compile time decide these settings. Below is the
+	 * explaination of these setting
+	 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
+	 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
+	 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
+	 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
+	 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
+	 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
+	 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
+	 * as GPIO then this register selectes the alternate fucntions
+	 */
+	.config_reg		= {0x00, 0x1E, 0x80, 0x01,
+					0x7A, 0x00, 0x00},
+};
+
 static struct ab8500_platform_data ab8500_platdata = {
 	.irq_base	= MOP500_AB8500_IRQ_BASE,
 	.regulator	= ab8500_regulators,
 	.num_regulator	= ARRAY_SIZE(ab8500_regulators),
+	.gpio = &ab8500_gpio_pdata,
 };
 
 static struct resource ab8500_resources[] = {
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 19b6c27..d00ea06 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -8,7 +8,8 @@
 #define __BOARD_MOP500_H
 
 #define MOP500_EGPIO(x)			(NOMADIK_NR_GPIO + (x))
-
+#define MOP500_EGPIO_END		MOP500_EGPIO(24)
+#define MOP500_AB8500_GPIO(x)		(MOP500_EGPIO_END + (x))
 /* GPIOs on the TC35892 expander */
 #define GPIO_SDMMC_CD			MOP500_EGPIO(3)
 #define GPIO_PROX_SENSOR		MOP500_EGPIO(7)
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
index 7cdeb2a..97ef55f 100644
--- a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
+++ b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
@@ -35,9 +35,20 @@
 #define MOP500_STMPE1601_IRQBASE        MOP500_EGPIO_IRQ_END
 #define MOP500_STMPE1601_IRQ(x)         (MOP500_STMPE1601_IRQBASE + (x))
 
-#define MOP500_NR_IRQS          MOP500_STMPE1601_IRQ(STMPE_NR_INTERNAL_IRQS)
+#define MOP500_STMPE1601_IRQ_END	\
+	MOP500_STMPE1601_IRQ(STMPE_NR_INTERNAL_IRQS)
 
-#define MOP500_IRQ_END          MOP500_NR_IRQS
+/* AB8500 virtual gpio IRQ */
+#define AB8500_VIR_GPIO_NR_IRQS			16
+
+#define MOP500_AB8500_VIR_GPIO_IRQ_BASE		\
+	MOP500_STMPE1601_IRQ_END
+#define MOP500_AB8500_VIR_GPIO_IRQ_END		\
+	(MOP500_AB8500_VIR_GPIO_IRQ_BASE + AB8500_VIR_GPIO_NR_IRQS)
+
+#define MOP500_NR_IRQS		MOP500_AB8500_VIR_GPIO_IRQ_END
+
+#define MOP500_IRQ_END		MOP500_NR_IRQS
 
 #if MOP500_IRQ_END > IRQ_BOARD_END
 #undef IRQ_BOARD_END
-- 
1.7.2.dirty


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

end of thread, other threads:[~2011-03-24  4:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16  3:34 [PATCH] AB8500 GPIO : Board Support for AB8500 GPIO Driver Bibek Basu
2011-02-16  3:34 ` [PATCH] AB8500 GPIO : Driver for 42 AB8500 GPIO pins Bibek Basu
2011-02-16  8:32   ` Linus Walleij
2011-02-28  0:19     ` Samuel Ortiz
2011-03-07 14:32   ` Linus Walleij
2011-03-14 16:37     ` Linus Walleij
2011-03-14 16:46       ` Grant Likely
2011-03-15  9:10         ` Linus Walleij
2011-03-15 14:33           ` Grant Likely
2011-03-15 14:51             ` Linus Walleij
2011-03-17 19:11               ` Grant Likely
2011-03-18  3:38                 ` Bibek BASU
2011-03-18  8:29                   ` Linus Walleij
2011-03-24  4:00                     ` Grant Likely
2011-03-18  3:37               ` [PATCH] AB8500 GPIO : Board Support for AB8500 GPIO Driver Bibek Basu
2011-03-18  3:37               ` [PATCH] AB8500 GPIO : Driver for 42 AB8500 GPIO pins Bibek Basu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox