mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board
@ 2010-10-22 16:56 Dinh.Nguyen
  2010-10-22 16:56 ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Dinh.Nguyen
  2010-10-22 17:51 ` [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board Amit Kucheria
  0 siblings, 2 replies; 12+ messages in thread
From: Dinh.Nguyen @ 2010-10-22 16:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, linux, s.hauer, u.kleine-koenig,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria, Dinh Nguyen

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

Add functionality for the power button on MX51 Babbage board.

This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/configs/mx51_defconfig        |    1 +
 arch/arm/mach-mx5/board-mx51_babbage.c |   22 ++++++++++++++++++++++
 arch/arm/mach-mx5/devices-imx51.h      |    2 ++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig
index 163cfee..5c7a872 100644
--- a/arch/arm/configs/mx51_defconfig
+++ b/arch/arm/configs/mx51_defconfig
@@ -82,6 +82,7 @@ CONFIG_FEC=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_EVDEV=y
+CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_EVBUG=m
 CONFIG_MOUSE_PS2=m
 CONFIG_MOUSE_PS2_ELANTECH=y
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 23ee4a4..8458852 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -18,6 +18,8 @@
 #include <linux/io.h>
 #include <linux/fsl_devices.h>
 #include <linux/fec.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 
 #include <mach/common.h>
 #include <mach/hardware.h>
@@ -37,6 +39,7 @@
 #define BABBAGE_USBH1_STP	(0*32 + 27)	/* GPIO_1_27 */
 #define BABBAGE_PHY_RESET	(1*32 + 5)	/* GPIO_2_5 */
 #define BABBAGE_FEC_PHY_RESET	(1*32 + 14)	/* GPIO_2_14 */
+#define BABBAGE_POWER_KEY	(1*32 + 21)	/* GPIO_2_21 */
 
 /* USB_CTRL_1 */
 #define MX51_USB_CTRL_1_OFFSET			0x10
@@ -46,6 +49,21 @@
 #define	MX51_USB_PLL_DIV_19_2_MHZ	0x01
 #define	MX51_USB_PLL_DIV_24_MHZ	0x02
 
+static struct gpio_keys_button babbage_buttons[] = {
+	{
+		.gpio		= BABBAGE_POWER_KEY,
+		.code		= BTN_0,
+		.desc		= "PWR",
+		.active_low	= 1,
+		.wakeup		= 1,
+	},
+};
+
+static const struct gpio_keys_platform_data imx_button_data __initconst = {
+	.buttons	= babbage_buttons,
+	.nbuttons	= ARRAY_SIZE(babbage_buttons),
+};
+
 static struct pad_desc mx51babbage_pads[] = {
 	/* UART1 */
 	MX51_PAD_UART1_RXD__UART1_RXD,
@@ -112,6 +130,9 @@ static struct pad_desc mx51babbage_pads[] = {
 
 	/* FEC PHY reset line */
 	MX51_PAD_EIM_A20__GPIO_2_14,
+
+	/* Power Key */
+	MX51_PAD_EIM_A27__GPIO_2_21,
 };
 
 /* Serial ports */
@@ -287,6 +308,7 @@ static void __init mxc_board_init(void)
 	mxc_init_imx_uart();
 	babbage_fec_reset();
 	imx51_add_fec(NULL);
+	imx51_add_gpio_keys(&imx_button_data);
 
 	imx51_add_imx_i2c(0, &babbage_i2c_data);
 	imx51_add_imx_i2c(1, &babbage_i2c_data);
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
index 5cc910e..8c50cb5 100644
--- a/arch/arm/mach-mx5/devices-imx51.h
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -13,6 +13,8 @@ extern const struct imx_fec_data imx51_fec_data __initconst;
 #define imx51_add_fec(pdata)	\
 	imx_add_fec(&imx51_fec_data, pdata)
 
+#define imx51_add_gpio_keys(pdata) imx_add_gpio_keys(pdata)
+
 extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
 #define imx51_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
-- 
1.6.0.4



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

* [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-22 16:56 [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board Dinh.Nguyen
@ 2010-10-22 16:56 ` Dinh.Nguyen
  2010-10-22 16:56   ` [PATCHv5 3/3] ARM: imx: Add wake functionality to GPIO Dinh.Nguyen
  2010-10-22 18:28   ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Uwe Kleine-König
  2010-10-22 17:51 ` [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board Amit Kucheria
  1 sibling, 2 replies; 12+ messages in thread
From: Dinh.Nguyen @ 2010-10-22 16:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, linux, s.hauer, u.kleine-koenig,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria, Dinh Nguyen

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

Add imx_add_gpio_keys function to add gpio-keys in plat-mxc

This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/plat-mxc/devices/Kconfig               |    4 +++
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-gpio_keys.c  |   27 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    4 +++
 arch/arm/plat-mxc/include/mach/iomux-mx51.h     |    2 +-
 5 files changed, 37 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-gpio_keys.c

diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 4047994..f4772e7 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -9,6 +9,10 @@ config IMX_HAVE_PLATFORM_FLEXCAN
 	select HAVE_CAN_FLEXCAN
 	bool
 
+config IMX_HAVE_PLATFORM_GPIO_KEYS
+	bool
+	default y if ARCH_MX51
+	
 config IMX_HAVE_PLATFORM_IMX_I2C
 	bool
 
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 0a3c1f0..45aefeb 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
 obj-y += platform-imx-dma.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
new file mode 100644
index 0000000..1c53a53
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+#include <asm/sizes.h>
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+struct platform_device *__init imx_add_gpio_keys(
+		const struct gpio_keys_platform_data *pdata)
+{
+	return imx_add_platform_device("gpio-keys", -1, NULL,
+		 0, pdata, sizeof(*pdata));
+}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 86d7575..8c6896f 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -29,6 +29,10 @@ struct platform_device *__init imx_add_flexcan(int id,
 		resource_size_t irq,
 		const struct flexcan_platform_data *pdata);
 
+#include <linux/gpio_keys.h>
+struct platform_device *__init imx_add_gpio_keys(
+		const struct gpio_keys_platform_data *pdata);
+
 #include <mach/i2c.h>
 struct imx_imx_i2c_data {
 	int id;
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
index e46b1c2..7ae27e8 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
@@ -114,7 +114,7 @@ typedef enum iomux_config {
 #define MX51_PAD_EIM_A24__GPIO_2_18             IOMUX_PAD(0x450, 0x0bc, 1, 0x0,   0, NO_PAD_CTRL)
 #define MX51_PAD_EIM_A25__GPIO_2_19             IOMUX_PAD(0x454, 0x0c0, 1, 0x0,   0, NO_PAD_CTRL)
 #define MX51_PAD_EIM_A26__GPIO_2_20             IOMUX_PAD(0x458, 0x0c4, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0, NO_PAD_CTRL)
+#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0, MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_EIM_EB0__EIM_EB0               IOMUX_PAD(0x460, 0x0cc, 0, 0x0,   0, NO_PAD_CTRL)
 #define MX51_PAD_EIM_EB1__EIM_EB1               IOMUX_PAD(0x464, 0x0d0, 0, 0x0,   0, NO_PAD_CTRL)
 #define MX51_PAD_EIM_EB2__GPIO_2_22             IOMUX_PAD(0x468, 0x0d4, 1, 0x0,   0, NO_PAD_CTRL)
-- 
1.6.0.4



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

* [PATCHv5 3/3] ARM: imx: Add wake functionality to GPIO
  2010-10-22 16:56 ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Dinh.Nguyen
@ 2010-10-22 16:56   ` Dinh.Nguyen
  2010-10-22 18:28   ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Uwe Kleine-König
  1 sibling, 0 replies; 12+ messages in thread
From: Dinh.Nguyen @ 2010-10-22 16:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, linux, s.hauer, u.kleine-koenig,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria, Dinh Nguyen

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

Add function definition for irq_chip.set_wake to enable GPIO to
wake-up the system.

This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.

This patch has been tested on a MX51 Babbage system that had suspend
code implemented. The set_wake implementation is necessary for a
GPIO to wake up a system from suspend.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/plat-mxc/gpio.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 9d38da0..9c3e362 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -20,6 +20,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
@@ -201,11 +202,42 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
 	}
 }
 
+/*
+ * Set interrupt number "irq" in the GPIO as a wake-up source.
+ * While system is running, all registered GPIO interrupts need to have
+ * wake-up enabled. When system is suspended, only selected GPIO interrupts
+ * need to have wake-up enabled.
+ * @param  irq          interrupt source number
+ * @param  enable       enable as wake-up if equal to non-zero
+ * @return       This function returns 0 on success.
+ */
+static int gpio_set_wake_irq(u32 irq, u32 enable)
+{
+	u32 gpio = irq_to_gpio(irq);
+	u32 gpio_idx = gpio & 0x1F;
+	struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32];
+
+	if (enable) {
+		if (port->irq_high && (gpio_idx >= 16))
+			enable_irq_wake(port->irq_high);
+		else
+			enable_irq_wake(port->irq);
+	} else {
+		if (port->irq_high && (gpio_idx >= 16))
+			disable_irq_wake(port->irq_high);
+		else
+			disable_irq_wake(port->irq);
+	}
+
+	return 0;
+}
+
 static struct irq_chip gpio_irq_chip = {
 	.ack = gpio_ack_irq,
 	.mask = gpio_mask_irq,
 	.unmask = gpio_unmask_irq,
 	.set_type = gpio_set_irq_type,
+	.set_wake = gpio_set_wake_irq,
 };
 
 static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
-- 
1.6.0.4



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

* Re: [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board
  2010-10-22 16:56 [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board Dinh.Nguyen
  2010-10-22 16:56 ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Dinh.Nguyen
@ 2010-10-22 17:51 ` Amit Kucheria
  1 sibling, 0 replies; 12+ messages in thread
From: Amit Kucheria @ 2010-10-22 17:51 UTC (permalink / raw)
  To: Dinh.Nguyen
  Cc: linux-kernel, linux-arm-kernel, linux, s.hauer, u.kleine-koenig,
	valentin.longchamp, daniel, grant.likely, bryan.wu

In the interest of bisectability, Patch 1 and 2 should've been reversed since
imx51_add_gpio_keys() is only defined in patch 2.

On 10 Oct 22, Dinh.Nguyen@freescale.com wrote:
> From: Dinh Nguyen <Dinh.Nguyen@freescale.com>
> 
> Add functionality for the power button on MX51 Babbage board.
> 
> This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.
> 
> Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
> ---
>  arch/arm/configs/mx51_defconfig        |    1 +
>  arch/arm/mach-mx5/board-mx51_babbage.c |   22 ++++++++++++++++++++++
>  arch/arm/mach-mx5/devices-imx51.h      |    2 ++
>  3 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig
> index 163cfee..5c7a872 100644
> --- a/arch/arm/configs/mx51_defconfig
> +++ b/arch/arm/configs/mx51_defconfig
> @@ -82,6 +82,7 @@ CONFIG_FEC=y
>  CONFIG_INPUT_FF_MEMLESS=m
>  # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
>  CONFIG_INPUT_EVDEV=y
> +CONFIG_KEYBOARD_GPIO=y
>  CONFIG_INPUT_EVBUG=m
>  CONFIG_MOUSE_PS2=m
>  CONFIG_MOUSE_PS2_ELANTECH=y
> diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
> index 23ee4a4..8458852 100644
> --- a/arch/arm/mach-mx5/board-mx51_babbage.c
> +++ b/arch/arm/mach-mx5/board-mx51_babbage.c
> @@ -18,6 +18,8 @@
>  #include <linux/io.h>
>  #include <linux/fsl_devices.h>
>  #include <linux/fec.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/input.h>
>  
>  #include <mach/common.h>
>  #include <mach/hardware.h>
> @@ -37,6 +39,7 @@
>  #define BABBAGE_USBH1_STP	(0*32 + 27)	/* GPIO_1_27 */
>  #define BABBAGE_PHY_RESET	(1*32 + 5)	/* GPIO_2_5 */
>  #define BABBAGE_FEC_PHY_RESET	(1*32 + 14)	/* GPIO_2_14 */
> +#define BABBAGE_POWER_KEY	(1*32 + 21)	/* GPIO_2_21 */
>  
>  /* USB_CTRL_1 */
>  #define MX51_USB_CTRL_1_OFFSET			0x10
> @@ -46,6 +49,21 @@
>  #define	MX51_USB_PLL_DIV_19_2_MHZ	0x01
>  #define	MX51_USB_PLL_DIV_24_MHZ	0x02
>  
> +static struct gpio_keys_button babbage_buttons[] = {
> +	{
> +		.gpio		= BABBAGE_POWER_KEY,
> +		.code		= BTN_0,
> +		.desc		= "PWR",
> +		.active_low	= 1,
> +		.wakeup		= 1,
> +	},
> +};
> +
> +static const struct gpio_keys_platform_data imx_button_data __initconst = {
> +	.buttons	= babbage_buttons,
> +	.nbuttons	= ARRAY_SIZE(babbage_buttons),
> +};
> +
>  static struct pad_desc mx51babbage_pads[] = {
>  	/* UART1 */
>  	MX51_PAD_UART1_RXD__UART1_RXD,
> @@ -112,6 +130,9 @@ static struct pad_desc mx51babbage_pads[] = {
>  
>  	/* FEC PHY reset line */
>  	MX51_PAD_EIM_A20__GPIO_2_14,
> +
> +	/* Power Key */
> +	MX51_PAD_EIM_A27__GPIO_2_21,
>  };
>  
>  /* Serial ports */
> @@ -287,6 +308,7 @@ static void __init mxc_board_init(void)
>  	mxc_init_imx_uart();
>  	babbage_fec_reset();
>  	imx51_add_fec(NULL);
> +	imx51_add_gpio_keys(&imx_button_data);
>  
>  	imx51_add_imx_i2c(0, &babbage_i2c_data);
>  	imx51_add_imx_i2c(1, &babbage_i2c_data);
> diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
> index 5cc910e..8c50cb5 100644
> --- a/arch/arm/mach-mx5/devices-imx51.h
> +++ b/arch/arm/mach-mx5/devices-imx51.h
> @@ -13,6 +13,8 @@ extern const struct imx_fec_data imx51_fec_data __initconst;
>  #define imx51_add_fec(pdata)	\
>  	imx_add_fec(&imx51_fec_data, pdata)
>  
> +#define imx51_add_gpio_keys(pdata) imx_add_gpio_keys(pdata)
> +
>  extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
>  #define imx51_add_imx_i2c(id, pdata)	\
>  	imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
> -- 
> 1.6.0.4
> 
> 

-- 
----------------------------------------------------------------------
Amit Kucheria, Kernel Engineer || amit.kucheria@canonical.com
----------------------------------------------------------------------

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

* Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-22 16:56 ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Dinh.Nguyen
  2010-10-22 16:56   ` [PATCHv5 3/3] ARM: imx: Add wake functionality to GPIO Dinh.Nguyen
@ 2010-10-22 18:28   ` Uwe Kleine-König
  2010-10-22 18:58     ` Nguyen Dinh-R00091
  1 sibling, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2010-10-22 18:28 UTC (permalink / raw)
  To: Dinh.Nguyen
  Cc: linux-kernel, linux-arm-kernel, linux, s.hauer,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria

On Fri, Oct 22, 2010 at 11:56:14AM -0500, Dinh.Nguyen@freescale.com wrote:
> From: Dinh Nguyen <Dinh.Nguyen@freescale.com>
> 
> Add imx_add_gpio_keys function to add gpio-keys in plat-mxc
> 
> This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.
(This information isn't interesting once the patch is in git, so it can
better go after the tripple-dash below.)

> Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
Patch 1 depends on this one, so you should swap their order.

> ---
>  arch/arm/plat-mxc/devices/Kconfig               |    4 +++
>  arch/arm/plat-mxc/devices/Makefile              |    1 +
>  arch/arm/plat-mxc/devices/platform-gpio_keys.c  |   27 +++++++++++++++++++++++
>  arch/arm/plat-mxc/include/mach/devices-common.h |    4 +++
>  arch/arm/plat-mxc/include/mach/iomux-mx51.h     |    2 +-
>  5 files changed, 37 insertions(+), 1 deletions(-)
>  create mode 100644 arch/arm/plat-mxc/devices/platform-gpio_keys.c
> 
> diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
> index 4047994..f4772e7 100644
> --- a/arch/arm/plat-mxc/devices/Kconfig
> +++ b/arch/arm/plat-mxc/devices/Kconfig
> @@ -9,6 +9,10 @@ config IMX_HAVE_PLATFORM_FLEXCAN
>  	select HAVE_CAN_FLEXCAN
>  	bool
>  
> +config IMX_HAVE_PLATFORM_GPIO_KEYS
> +	bool
> +	default y if ARCH_MX51
> +	
>  config IMX_HAVE_PLATFORM_IMX_I2C
>  	bool
>  
> diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
> index 0a3c1f0..45aefeb 100644
> --- a/arch/arm/plat-mxc/devices/Makefile
> +++ b/arch/arm/plat-mxc/devices/Makefile
> @@ -1,6 +1,7 @@
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
> +obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
>  obj-y += platform-imx-dma.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
> diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
> new file mode 100644
> index 0000000..1c53a53
> --- /dev/null
> +++ b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
> + * Boston, MA  02110-1301, USA.
> + */
> +#include <asm/sizes.h>
> +#include <mach/hardware.h>
> +#include <mach/devices-common.h>
> +
> +struct platform_device *__init imx_add_gpio_keys(
> +		const struct gpio_keys_platform_data *pdata)
> +{
> +	return imx_add_platform_device("gpio-keys", -1, NULL,
> +		 0, pdata, sizeof(*pdata));
> +}
> diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
> index 86d7575..8c6896f 100644
> --- a/arch/arm/plat-mxc/include/mach/devices-common.h
> +++ b/arch/arm/plat-mxc/include/mach/devices-common.h
> @@ -29,6 +29,10 @@ struct platform_device *__init imx_add_flexcan(int id,
>  		resource_size_t irq,
>  		const struct flexcan_platform_data *pdata);
>  
> +#include <linux/gpio_keys.h>
> +struct platform_device *__init imx_add_gpio_keys(
> +		const struct gpio_keys_platform_data *pdata);
> +
>  #include <mach/i2c.h>
>  struct imx_imx_i2c_data {
>  	int id;
> diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
> index e46b1c2..7ae27e8 100644
> --- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
> +++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
> @@ -114,7 +114,7 @@ typedef enum iomux_config {
>  #define MX51_PAD_EIM_A24__GPIO_2_18             IOMUX_PAD(0x450, 0x0bc, 1, 0x0,   0, NO_PAD_CTRL)
>  #define MX51_PAD_EIM_A25__GPIO_2_19             IOMUX_PAD(0x454, 0x0c0, 1, 0x0,   0, NO_PAD_CTRL)
>  #define MX51_PAD_EIM_A26__GPIO_2_20             IOMUX_PAD(0x458, 0x0c4, 1, 0x0,   0, NO_PAD_CTRL)
> -#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0, NO_PAD_CTRL)
> +#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0, MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP)
I share the concerns of Arnaud.  MX51_GPIO_PAD_CTRL looks OK,
PAD_CTL_PUS_100K_UP does not.

>  #define MX51_PAD_EIM_EB0__EIM_EB0               IOMUX_PAD(0x460, 0x0cc, 0, 0x0,   0, NO_PAD_CTRL)
>  #define MX51_PAD_EIM_EB1__EIM_EB1               IOMUX_PAD(0x464, 0x0d0, 0, 0x0,   0, NO_PAD_CTRL)
>  #define MX51_PAD_EIM_EB2__GPIO_2_22             IOMUX_PAD(0x468, 0x0d4, 1, 0x0,   0, NO_PAD_CTRL)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* RE: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-22 18:28   ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Uwe Kleine-König
@ 2010-10-22 18:58     ` Nguyen Dinh-R00091
  2010-10-22 19:42       ` Uwe Kleine-König
  0 siblings, 1 reply; 12+ messages in thread
From: Nguyen Dinh-R00091 @ 2010-10-22 18:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, linux-arm-kernel, linux, s.hauer,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria

Hi Uwe,

>-----Original Message-----
>From: Uwe Kleine-König [mailto:u.kleine-koenig@pengutronix.de]
>Sent: Friday, October 22, 2010 1:28 PM
>To: Nguyen Dinh-R00091
>Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux@arm.linux.org.uk;
>s.hauer@pengutronix.de; valentin.longchamp@epfl.ch; daniel@caiaq.de; grant.likely@secretlab.ca;
>bryan.wu@canonical.com; amit.kucheria@canonical.com
>Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
>
>On Fri, Oct 22, 2010 at 11:56:14AM -0500, Dinh.Nguyen@freescale.com wrote:
>> From: Dinh Nguyen <Dinh.Nguyen@freescale.com>
>>
>> Add imx_add_gpio_keys function to add gpio-keys in plat-mxc
>>
>> This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.
>(This information isn't interesting once the patch is in git, so it can
>better go after the tripple-dash below.)
>
>> Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
>Patch 1 depends on this one, so you should swap their order.
>
>> ---
>>  arch/arm/plat-mxc/devices/Kconfig               |    4 +++
>>  arch/arm/plat-mxc/devices/Makefile              |    1 +
>>  arch/arm/plat-mxc/devices/platform-gpio_keys.c  |   27 +++++++++++++++++++++++
>>  arch/arm/plat-mxc/include/mach/devices-common.h |    4 +++
>>  arch/arm/plat-mxc/include/mach/iomux-mx51.h     |    2 +-
>>  5 files changed, 37 insertions(+), 1 deletions(-)
>>  create mode 100644 arch/arm/plat-mxc/devices/platform-gpio_keys.c
>>
>> diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
>> index 4047994..f4772e7 100644
>> --- a/arch/arm/plat-mxc/devices/Kconfig
>> +++ b/arch/arm/plat-mxc/devices/Kconfig
>> @@ -9,6 +9,10 @@ config IMX_HAVE_PLATFORM_FLEXCAN
>>  	select HAVE_CAN_FLEXCAN
>>  	bool
>>
>> +config IMX_HAVE_PLATFORM_GPIO_KEYS
>> +	bool
>> +	default y if ARCH_MX51
>> +
>>  config IMX_HAVE_PLATFORM_IMX_I2C
>>  	bool
>>
>> diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
>> index 0a3c1f0..45aefeb 100644
>> --- a/arch/arm/plat-mxc/devices/Makefile
>> +++ b/arch/arm/plat-mxc/devices/Makefile
>> @@ -1,6 +1,7 @@
>>  obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
>>  obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
>>  obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
>> +obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
>>  obj-y += platform-imx-dma.o
>>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
>>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
>> diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/plat-mxc/devices/platform-
>gpio_keys.c
>> new file mode 100644
>> index 0000000..1c53a53
>> --- /dev/null
>> +++ b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
>> @@ -0,0 +1,27 @@
>> +/*
>> + * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
>> + * Boston, MA  02110-1301, USA.
>> + */
>> +#include <asm/sizes.h>
>> +#include <mach/hardware.h>
>> +#include <mach/devices-common.h>
>> +
>> +struct platform_device *__init imx_add_gpio_keys(
>> +		const struct gpio_keys_platform_data *pdata)
>> +{
>> +	return imx_add_platform_device("gpio-keys", -1, NULL,
>> +		 0, pdata, sizeof(*pdata));
>> +}
>> diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-
>mxc/include/mach/devices-common.h
>> index 86d7575..8c6896f 100644
>> --- a/arch/arm/plat-mxc/include/mach/devices-common.h
>> +++ b/arch/arm/plat-mxc/include/mach/devices-common.h
>> @@ -29,6 +29,10 @@ struct platform_device *__init imx_add_flexcan(int id,
>>  		resource_size_t irq,
>>  		const struct flexcan_platform_data *pdata);
>>
>> +#include <linux/gpio_keys.h>
>> +struct platform_device *__init imx_add_gpio_keys(
>> +		const struct gpio_keys_platform_data *pdata);
>> +
>>  #include <mach/i2c.h>
>>  struct imx_imx_i2c_data {
>>  	int id;
>> diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-
>mx51.h
>> index e46b1c2..7ae27e8 100644
>> --- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
>> +++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
>> @@ -114,7 +114,7 @@ typedef enum iomux_config {
>>  #define MX51_PAD_EIM_A24__GPIO_2_18             IOMUX_PAD(0x450, 0x0bc, 1, 0x0,   0, NO_PAD_CTRL)
>>  #define MX51_PAD_EIM_A25__GPIO_2_19             IOMUX_PAD(0x454, 0x0c0, 1, 0x0,   0, NO_PAD_CTRL)
>>  #define MX51_PAD_EIM_A26__GPIO_2_20             IOMUX_PAD(0x458, 0x0c4, 1, 0x0,   0, NO_PAD_CTRL)
>> -#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0, NO_PAD_CTRL)
>> +#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0,
>MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP)
>I share the concerns of Arnaud.  MX51_GPIO_PAD_CTRL looks OK,
>PAD_CTL_PUS_100K_UP does not.

How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?

Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for MBIMXSD_GPIO_3_31?

>
>>  #define MX51_PAD_EIM_EB0__EIM_EB0               IOMUX_PAD(0x460, 0x0cc, 0, 0x0,   0, NO_PAD_CTRL)
>>  #define MX51_PAD_EIM_EB1__EIM_EB1               IOMUX_PAD(0x464, 0x0d0, 0, 0x0,   0, NO_PAD_CTRL)
>>  #define MX51_PAD_EIM_EB2__GPIO_2_22             IOMUX_PAD(0x468, 0x0d4, 1, 0x0,   0, NO_PAD_CTRL)
>
>Best regards
>Uwe
>
>--
>Pengutronix e.K.                           | Uwe Kleine-König            |
>Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Thanks for your review comments...

Dinh



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

* Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-22 18:58     ` Nguyen Dinh-R00091
@ 2010-10-22 19:42       ` Uwe Kleine-König
  2010-10-23  2:43         ` Nguyen Dinh-R00091
  0 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2010-10-22 19:42 UTC (permalink / raw)
  To: Nguyen Dinh-R00091
  Cc: linux-kernel, linux-arm-kernel, linux, s.hauer,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria

Hello Dinh,

On Fri, Oct 22, 2010 at 11:58:16AM -0700, Nguyen Dinh-R00091 wrote:
> >-----Original Message-----
> >From: Uwe Kleine-König [mailto:u.kleine-koenig@pengutronix.de]
> >Sent: Friday, October 22, 2010 1:28 PM
> >To: Nguyen Dinh-R00091
> >Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux@arm.linux.org.uk;
> >s.hauer@pengutronix.de; valentin.longchamp@epfl.ch; daniel@caiaq.de; grant.likely@secretlab.ca;
> >bryan.wu@canonical.com; amit.kucheria@canonical.com
> >Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
> >
> >On Fri, Oct 22, 2010 at 11:56:14AM -0500, Dinh.Nguyen@freescale.com wrote:
> >> From: Dinh Nguyen <Dinh.Nguyen@freescale.com>
> >>
> >> Add imx_add_gpio_keys function to add gpio-keys in plat-mxc
> >>
> >> This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.
> >(This information isn't interesting once the patch is in git, so it can
> >better go after the tripple-dash below.)
> >
> >> Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
> >Patch 1 depends on this one, so you should swap their order.
> >
> >> ---
> >>  arch/arm/plat-mxc/devices/Kconfig               |    4 +++
> >>  arch/arm/plat-mxc/devices/Makefile              |    1 +
> >>  arch/arm/plat-mxc/devices/platform-gpio_keys.c  |   27 +++++++++++++++++++++++
> >>  arch/arm/plat-mxc/include/mach/devices-common.h |    4 +++
> >>  arch/arm/plat-mxc/include/mach/iomux-mx51.h     |    2 +-
> >>  5 files changed, 37 insertions(+), 1 deletions(-)
> >>  create mode 100644 arch/arm/plat-mxc/devices/platform-gpio_keys.c
> >>
> >> diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
> >> index 4047994..f4772e7 100644
> >> --- a/arch/arm/plat-mxc/devices/Kconfig
> >> +++ b/arch/arm/plat-mxc/devices/Kconfig
> >> @@ -9,6 +9,10 @@ config IMX_HAVE_PLATFORM_FLEXCAN
> >>  	select HAVE_CAN_FLEXCAN
> >>  	bool
> >>
> >> +config IMX_HAVE_PLATFORM_GPIO_KEYS
> >> +	bool
> >> +	default y if ARCH_MX51
> >> +
> >>  config IMX_HAVE_PLATFORM_IMX_I2C
> >>  	bool
> >>
> >> diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
> >> index 0a3c1f0..45aefeb 100644
> >> --- a/arch/arm/plat-mxc/devices/Makefile
> >> +++ b/arch/arm/plat-mxc/devices/Makefile
> >> @@ -1,6 +1,7 @@
> >>  obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
> >>  obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
> >>  obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
> >> +obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
> >>  obj-y += platform-imx-dma.o
> >>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
> >>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
> >> diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/plat-mxc/devices/platform-
> >gpio_keys.c
> >> new file mode 100644
> >> index 0000000..1c53a53
> >> --- /dev/null
> >> +++ b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
> >> @@ -0,0 +1,27 @@
> >> +/*
> >> + * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
> >> + *
> >> + * This program is free software; you can redistribute it and/or
> >> + * modify it under the terms of the GNU General Public License
> >> + * as published by the Free Software Foundation; either version 2
> >> + * of the License, or (at your option) any later version.
> >> + * This program is distributed in the hope that it will be useful,
> >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> + * GNU General Public License for more details.
> >> + *
> >> + * You should have received a copy of the GNU General Public License
> >> + * along with this program; if not, write to the Free Software
> >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
> >> + * Boston, MA  02110-1301, USA.
> >> + */
> >> +#include <asm/sizes.h>
> >> +#include <mach/hardware.h>
> >> +#include <mach/devices-common.h>
> >> +
> >> +struct platform_device *__init imx_add_gpio_keys(
> >> +		const struct gpio_keys_platform_data *pdata)
> >> +{
> >> +	return imx_add_platform_device("gpio-keys", -1, NULL,
> >> +		 0, pdata, sizeof(*pdata));
> >> +}
> >> diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-
> >mxc/include/mach/devices-common.h
> >> index 86d7575..8c6896f 100644
> >> --- a/arch/arm/plat-mxc/include/mach/devices-common.h
> >> +++ b/arch/arm/plat-mxc/include/mach/devices-common.h
> >> @@ -29,6 +29,10 @@ struct platform_device *__init imx_add_flexcan(int id,
> >>  		resource_size_t irq,
> >>  		const struct flexcan_platform_data *pdata);
> >>
> >> +#include <linux/gpio_keys.h>
> >> +struct platform_device *__init imx_add_gpio_keys(
> >> +		const struct gpio_keys_platform_data *pdata);
> >> +
> >>  #include <mach/i2c.h>
> >>  struct imx_imx_i2c_data {
> >>  	int id;
> >> diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-
> >mx51.h
> >> index e46b1c2..7ae27e8 100644
> >> --- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
> >> +++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
> >> @@ -114,7 +114,7 @@ typedef enum iomux_config {
> >>  #define MX51_PAD_EIM_A24__GPIO_2_18             IOMUX_PAD(0x450, 0x0bc, 1, 0x0,   0, NO_PAD_CTRL)
> >>  #define MX51_PAD_EIM_A25__GPIO_2_19             IOMUX_PAD(0x454, 0x0c0, 1, 0x0,   0, NO_PAD_CTRL)
> >>  #define MX51_PAD_EIM_A26__GPIO_2_20             IOMUX_PAD(0x458, 0x0c4, 1, 0x0,   0, NO_PAD_CTRL)
> >> -#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0, NO_PAD_CTRL)
> >> +#define MX51_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0,
> >MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP)
> >I share the concerns of Arnaud.  MX51_GPIO_PAD_CTRL looks OK,
> >PAD_CTL_PUS_100K_UP does not.
> 
> How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
> #define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,   0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?
> 
> Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for MBIMXSD_GPIO_3_31?
I'd suggest something local to your machine file.  Unfortunately I don't
see an easy way to reuse the generic MX51_PAD_EIM_A27__GPIO_2_21 to
define your local symbol.  So I think something like you wrote above
should be fine.

Too bad that

	#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21 (MX51_PAD_EIM_A27__GPIO_2_21 | PAD_CTL_PUS_100K_UP)

doesn't work.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* RE: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-22 19:42       ` Uwe Kleine-König
@ 2010-10-23  2:43         ` Nguyen Dinh-R00091
  2010-10-24  8:37           ` Lothar Waßmann
  0 siblings, 1 reply; 12+ messages in thread
From: Nguyen Dinh-R00091 @ 2010-10-23  2:43 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, linux-arm-kernel, linux, s.hauer,
	valentin.longchamp, daniel, grant.likely, bryan.wu,
	amit.kucheria

Hello Uwe,

>-----Original Message-----
>From: Uwe Kleine-König [mailto:u.kleine-koenig@pengutronix.de]
>Sent: Friday, October 22, 2010 2:42 PM
>To: Nguyen Dinh-R00091
>Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux@arm.linux.org.uk;
>s.hauer@pengutronix.de; valentin.longchamp@epfl.ch; daniel@caiaq.de; grant.likely@secretlab.ca;
>bryan.wu@canonical.com; amit.kucheria@canonical.com
>Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
>
>Hello Dinh,
>
>On Fri, Oct 22, 2010 at 11:58:16AM -0700, Nguyen Dinh-R00091 wrote:
>> >-----Original Message-----
>> >From: Uwe Kleine-König [mailto:u.kleine-koenig@pengutronix.de]
>> >Sent: Friday, October 22, 2010 1:28 PM
>> >To: Nguyen Dinh-R00091
>> >Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux@arm.linux.org.uk;
>> >s.hauer@pengutronix.de; valentin.longchamp@epfl.ch; daniel@caiaq.de; grant.likely@secretlab.ca;
>> >bryan.wu@canonical.com; amit.kucheria@canonical.com
>> >Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
>> >
>> >On Fri, Oct 22, 2010 at 11:56:14AM -0500, Dinh.Nguyen@freescale.com wrote:
>> >> From: Dinh Nguyen <Dinh.Nguyen@freescale.com>
>> >>
>> >> Add imx_add_gpio_keys function to add gpio-keys in plat-mxc
>> >>
>> >> This patch is based on Sascha Hauer's imx/linux-2.6 for-rmk tree.
>> >(This information isn't interesting once the patch is in git, so it can
>> >better go after the tripple-dash below.)
>> >
>> >> Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
>> >Patch 1 depends on this one, so you should swap their order.
>> >
>> >> ---
>> >I share the concerns of Arnaud.  MX51_GPIO_PAD_CTRL looks OK,
>> >PAD_CTL_PUS_100K_UP does not.
>>
>> How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
>> #define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,
>0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?
>>
>> Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for
>MBIMXSD_GPIO_3_31?
>I'd suggest something local to your machine file.  Unfortunately I don't
>see an easy way to reuse the generic MX51_PAD_EIM_A27__GPIO_2_21 to
>define your local symbol.  So I think something like you wrote above
>should be fine.
>
>Too bad that
>
>	#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21 (MX51_PAD_EIM_A27__GPIO_2_21 | PAD_CTL_PUS_100K_UP)
>
>doesn't work.

Yes, I also wish I didn't have to redefine the pin just because of PAD setting change. I am going to send out another patch that basically sets the pad_desc.pad_ctrl=PAD_SETTING in mxc_init_board() function. I think it's a bit cleaner than having to redefine the pin.

>Best regards
>Uwe
>
>--
>Pengutronix e.K.                           | Uwe Kleine-König            |
>Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Thanks,
Dinh


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

* RE: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-23  2:43         ` Nguyen Dinh-R00091
@ 2010-10-24  8:37           ` Lothar Waßmann
  2010-10-24 19:20             ` Uwe Kleine-König
  0 siblings, 1 reply; 12+ messages in thread
From: Lothar Waßmann @ 2010-10-24  8:37 UTC (permalink / raw)
  To: Nguyen Dinh-R00091
  Cc: Uwe Kleine-König, amit.kucheria, linux, s.hauer,
	linux-kernel, grant.likely, valentin.longchamp, daniel, bryan.wu,
	linux-arm-kernel

Hi,
> >> How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
> >> #define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,
> >0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?
> >>
> >> Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for
> >MBIMXSD_GPIO_3_31?
> >I'd suggest something local to your machine file.  Unfortunately I don't
> >see an easy way to reuse the generic MX51_PAD_EIM_A27__GPIO_2_21 to
> >define your local symbol.  So I think something like you wrote above
> >should be fine.
> >
> >Too bad that
> >
> >	#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21 (MX51_PAD_EIM_A27__GPIO_2_21 | PAD_CTL_PUS_100K_UP)
> >
> >doesn't work.
> 
> Yes, I also wish I didn't have to redefine the pin just because of PAD setting change. I am going to send out another patch that basically sets the pad_desc.pad_ctrl=PAD_SETTING in mxc_init_board() function. I think it's a bit cleaner than having to redefine the pin.
> 
IMO the 'struct pad_desc' should be replaced with an u64 bitmap that
would allow for the pullup and other definitions that may be board
specific to be simply or'ed to the pad definition.

I could try to provide a patch if this is agreed on.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

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

* Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-24  8:37           ` Lothar Waßmann
@ 2010-10-24 19:20             ` Uwe Kleine-König
  2010-10-25  7:02               ` Lothar Waßmann
  0 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2010-10-24 19:20 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Nguyen Dinh-R00091, amit.kucheria, linux, s.hauer, linux-kernel,
	grant.likely, valentin.longchamp, daniel, bryan.wu,
	linux-arm-kernel

Hi Lothar,

On Sun, Oct 24, 2010 at 10:37:19AM +0200, Lothar Waßmann wrote:
> Hi,
> > >> How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
> > >> #define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,
> > >0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?
> > >>
> > >> Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for
> > >MBIMXSD_GPIO_3_31?
> > >I'd suggest something local to your machine file.  Unfortunately I don't
> > >see an easy way to reuse the generic MX51_PAD_EIM_A27__GPIO_2_21 to
> > >define your local symbol.  So I think something like you wrote above
> > >should be fine.
> > >
> > >Too bad that
> > >
> > >	#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21 (MX51_PAD_EIM_A27__GPIO_2_21 | PAD_CTL_PUS_100K_UP)
> > >
> > >doesn't work.
> > 
> > Yes, I also wish I didn't have to redefine the pin just because of PAD setting change. I am going to send out another patch that basically sets the pad_desc.pad_ctrl=PAD_SETTING in mxc_init_board() function. I think it's a bit cleaner than having to redefine the pin.
> > 
> IMO the 'struct pad_desc' should be replaced with an u64 bitmap that
> would allow for the pullup and other definitions that may be board
> specific to be simply or'ed to the pad definition.
> 
> I could try to provide a patch if this is agreed on.
Hmm, I thought about that, too, when writing my mail and when I added
the needed space for a struct pad_desc I stopped when it became >64.
Somehow I must have got it wrong.  After rechecking now it's ==64, so
yes, I'd like it.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-24 19:20             ` Uwe Kleine-König
@ 2010-10-25  7:02               ` Lothar Waßmann
  2010-10-25  7:21                 ` Uwe Kleine-König
  0 siblings, 1 reply; 12+ messages in thread
From: Lothar Waßmann @ 2010-10-25  7:02 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Nguyen Dinh-R00091, amit.kucheria, linux, s.hauer, linux-kernel,
	grant.likely, valentin.longchamp, daniel, bryan.wu,
	linux-arm-kernel

Hi Uwe,

Uwe Kleine-König writes:
> Hi Lothar,
> 
> On Sun, Oct 24, 2010 at 10:37:19AM +0200, Lothar Waßmann wrote:
> > Hi,
> > > >> How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
> > > >> #define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,
> > > >0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?
> > > >>
> > > >> Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for
> > > >MBIMXSD_GPIO_3_31?
> > > >I'd suggest something local to your machine file.  Unfortunately I don't
> > > >see an easy way to reuse the generic MX51_PAD_EIM_A27__GPIO_2_21 to
> > > >define your local symbol.  So I think something like you wrote above
> > > >should be fine.
> > > >
> > > >Too bad that
> > > >
> > > >	#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21 (MX51_PAD_EIM_A27__GPIO_2_21 | PAD_CTL_PUS_100K_UP)
> > > >
> > > >doesn't work.
> > > 
> > > Yes, I also wish I didn't have to redefine the pin just because of PAD setting change. I am going to send out another patch that basically sets the pad_desc.pad_ctrl=PAD_SETTING in mxc_init_board() function. I think it's a bit cleaner than having to redefine the pin.
> > > 
> > IMO the 'struct pad_desc' should be replaced with an u64 bitmap that
> > would allow for the pullup and other definitions that may be board
> > specific to be simply or'ed to the pad definition.
> > 
> > I could try to provide a patch if this is agreed on.
> Hmm, I thought about that, too, when writing my mail and when I added
> the needed space for a struct pad_desc I stopped when it became >64.
> Somehow I must have got it wrong.  After rechecking now it's ==64, so
> yes, I'd like it.
> 
What kernel version should I base it on?
The master branch of git://git.pengutronix.de/git/imx/linux-2.6.git?


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

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

* Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
  2010-10-25  7:02               ` Lothar Waßmann
@ 2010-10-25  7:21                 ` Uwe Kleine-König
  0 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2010-10-25  7:21 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Nguyen Dinh-R00091, amit.kucheria, linux, s.hauer, linux-kernel,
	grant.likely, valentin.longchamp, daniel, bryan.wu,
	linux-arm-kernel

Hello Lothar,

On Mon, Oct 25, 2010 at 09:02:57AM +0200, Lothar Waßmann wrote:
> Uwe Kleine-König writes:
> > On Sun, Oct 24, 2010 at 10:37:19AM +0200, Lothar Waßmann wrote:
> > > Hi,
> > > > >> How do you suggest I define this pin for Babbage board only? Do I add to iomux-mx51.h
> > > > >> #define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21             IOMUX_PAD(0x45c, 0x0c8, 1, 0x0,
> > > > >0,MX51_GPIO_PAD_CTRL | PAD_CTL_PUS_100K_UP) ?
> > > > >>
> > > > >> Or do I define the pin in the board file with a 100K_UP? Like how eukrea_mbimxsd-baseboard.c did for
> > > > >MBIMXSD_GPIO_3_31?
> > > > >I'd suggest something local to your machine file.  Unfortunately I don't
> > > > >see an easy way to reuse the generic MX51_PAD_EIM_A27__GPIO_2_21 to
> > > > >define your local symbol.  So I think something like you wrote above
> > > > >should be fine.
> > > > >
> > > > >Too bad that
> > > > >
> > > > >	#define MX51_BABBAGE_PAD_EIM_A27__GPIO_2_21 (MX51_PAD_EIM_A27__GPIO_2_21 | PAD_CTL_PUS_100K_UP)
> > > > >
> > > > >doesn't work.
> > > > 
> > > > Yes, I also wish I didn't have to redefine the pin just because of PAD setting change. I am going to send out another patch that basically sets the pad_desc.pad_ctrl=PAD_SETTING in mxc_init_board() function. I think it's a bit cleaner than having to redefine the pin.
> > > > 
> > > IMO the 'struct pad_desc' should be replaced with an u64 bitmap that
> > > would allow for the pullup and other definitions that may be board
> > > specific to be simply or'ed to the pad definition.
> > > 
> > > I could try to provide a patch if this is agreed on.
> > Hmm, I thought about that, too, when writing my mail and when I added
> > the needed space for a struct pad_desc I stopped when it became >64.
> > Somehow I must have got it wrong.  After rechecking now it's ==64, so
> > yes, I'd like it.
> > 
> What kernel version should I base it on?
> The master branch of git://git.pengutronix.de/git/imx/linux-2.6.git?
I'd use the the for-rmk branch that rmk just pulled for .37.  imx/master
is at v2.6.35-rc4 which feels wrong.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2010-10-25  7:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22 16:56 [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board Dinh.Nguyen
2010-10-22 16:56 ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Dinh.Nguyen
2010-10-22 16:56   ` [PATCHv5 3/3] ARM: imx: Add wake functionality to GPIO Dinh.Nguyen
2010-10-22 18:28   ` [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc Uwe Kleine-König
2010-10-22 18:58     ` Nguyen Dinh-R00091
2010-10-22 19:42       ` Uwe Kleine-König
2010-10-23  2:43         ` Nguyen Dinh-R00091
2010-10-24  8:37           ` Lothar Waßmann
2010-10-24 19:20             ` Uwe Kleine-König
2010-10-25  7:02               ` Lothar Waßmann
2010-10-25  7:21                 ` Uwe Kleine-König
2010-10-22 17:51 ` [PATCHv5 1/3] ARM: mx5: Add gpio-keys to mx51 babbage board Amit Kucheria

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

Powered by JetHome