ARM: mx5: Add gpio-keys to mx51 babbage board
Subsystems (3)
PATCH v5 1/3 ARM: mx5: Add gpio-keys to mx51 babbage board
From: Dinh Nguyen <[email protected]>
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.
--- 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(-)
arch/arm/configs/mx51_defconfig +1 -0
@@ -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
arch/arm/mach-mx5/board-mx51_babbage.c +22 -0
@@ -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);
arch/arm/mach-mx5/devices-imx51.h +2 -0
@@ -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)
Signature · 1 line
1.6.0.4
PATCH v5 2/3 ARM: imx: Add gpio-keys to plat-mxc
From: Dinh Nguyen <[email protected]>
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.
--- 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
arch/arm/plat-mxc/devices/Kconfig +4 -0
@@ -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
arch/arm/plat-mxc/devices/Makefile +1 -0
@@ -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
arch/arm/plat-mxc/devices/platform-gpio_keys.c new file +27 -0
@@ -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)); +}
arch/arm/plat-mxc/include/mach/devices-common.h +4 -0
@@ -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;
arch/arm/plat-mxc/include/mach/iomux-mx51.h +1 -1
@@ -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)
Signature · 1 line
1.6.0.4
PATCH v5 3/3 ARM: imx: Add wake functionality to GPIO
From: Dinh Nguyen <[email protected]>
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.
--- arch/arm/plat-mxc/gpio.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/plat-mxc/gpio.c +32 -0
@@ -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,
Signature · 1 line
1.6.0.4
Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
In reply to [email protected]Quoted 5 lines · Dinh.Nguyen at freescale.com
From: Dinh Nguyen <[email protected]>
Add
imx_add_gpio_keysfunction to add gpio-keys in plat-mxcThis 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.)
Quoted 1 line
Signed-off-by Dinh Nguyen <[email protected]>
Patch 1 depends on this one, so you should swap their order.
Quoted 89 lines
--- 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.carch/arm/plat-mxc/devices/Kconfig +4
-0@@ -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 boolarch/arm/plat-mxc/devices/Makefile +1
-0@@ -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.oarch/arm/plat-mxc/devices/platform-gpio_keys.c new file +27
-0@@ -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)); +}arch/arm/plat-mxc/include/mach/devices-common.h +4
-0@@ -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;arch/arm/plat-mxc/include/mach/iomux-mx51.h +0
-0
arch/arm/plat-mxc/include/mach/iomux-mx51.h typedef enum iomux_config { · line 117
Quoted 5 lines
arch/arm/plat-mxc/include/mach/iomux-mx51.h +1
-1@@ -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.
arch/arm/plat-mxc/include/mach/iomux-mx51.h typedef enum iomux_config { · line 120
Quoted 3 lines
arch/arm/plat-mxc/include/mach/iomux-mx51.h +0
-0#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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
RE: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hi Uwe,
Quoted 109 lines
-----Original Message-----
From: Uwe Kleine-K?nig [mailto:u.kleine-koenig at pengutronix.de]
Sent: Friday, October 22, 2010 1:28 PM
To: Nguyen Dinh-R00091
Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux at arm.linux.org.uk; s.hauer at pengutronix.de; valentin.longchamp at epfl.ch; daniel at caiaq.de; grant.likely at secretlab.ca; bryan.wu at canonical.com; amit.kucheria at canonical.com
Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxcQuoted 5 lines · Dinh.Nguyen at freescale.com
From: Dinh Nguyen <[email protected]>
Add
imx_add_gpio_keysfunction to add gpio-keys in plat-mxcThis 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.)
Quoted 1 line
Signed-off-by Dinh Nguyen <[email protected]>Patch 1 depends on this one, so you should swap their order.
arch/arm/plat-mxc/devices/platform-
Quoted 37 lines
--- 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.carch/arm/plat-mxc/devices/Kconfig +4
-0@@ -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 boolarch/arm/plat-mxc/devices/Makefile +1
-0@@ -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.oarch/arm/plat-mxc/devices/platform- renamed from arch/arm/plat-mxc/devices/platform-gpio_keys.c +0
-0
gpio_keys.carch/arm/plat-
Quoted 33 lines
new file mode 100644
index 0000000..1c53a53arch/arm/plat-mxc/devices/platform-gpio_keys.c new file +27
-0@@ -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)); +}arch/arm/plat- renamed from arch/arm/plat-mxc/include/mach/devices-common.h +0
-0
mxc/include/mach/devices-common.harch/arm/plat-mxc/include/mach/iomux-
Quoted 15 lines
index 86d7575..8c6896f 100644
arch/arm/plat-mxc/include/mach/devices-common.h +4
-0@@ -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;arch/arm/plat-mxc/include/mach/iomux- renamed from arch/arm/plat-mxc/include/mach/iomux-mx51.h +0
-0
mx51.h
Quoted 12 lines
arch/arm/plat-mxc/include/mach/iomux-mx51.h typedef enum iomux_config { · line 117
Quoted 9 lines
index e46b1c2..7ae27e8 100644
arch/arm/plat-mxc/include/mach/iomux-mx51.h +1
-1@@ -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_CTRLlooks OK,PAD_CTL_PUS_100K_UPdoes 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?
Quoted 11 lines
arch/arm/plat-mxc/include/mach/iomux-mx51.h typedef enum iomux_config { · line 120
Quoted 4 lines
arch/arm/plat-mxc/include/mach/iomux-mx51.h +0
-0#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
Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hello Dinh,
Quoted 122 lines · On Fri, Oct 22, 2010 at 11:58:16AM -0700, Nguyen Dinh-R00091 wrote:
Quoted 109 lines
-----Original Message-----
From: Uwe Kleine-K?nig [mailto:u.kleine-koenig at pengutronix.de]
Sent: Friday, October 22, 2010 1:28 PM
To: Nguyen Dinh-R00091
Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux at arm.linux.org.uk; s.hauer at pengutronix.de; valentin.longchamp at epfl.ch; daniel at caiaq.de; grant.likely at secretlab.ca; bryan.wu at canonical.com; amit.kucheria at canonical.com
Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxcQuoted 5 lines · Dinh.Nguyen at freescale.com
From: Dinh Nguyen <[email protected]>
Add
imx_add_gpio_keysfunction to add gpio-keys in plat-mxcThis 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.)
Quoted 1 line
Signed-off-by Dinh Nguyen <[email protected]>Patch 1 depends on this one, so you should swap their order.
arch/arm/plat-mxc/devices/platform-
Quoted 37 lines
--- 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.carch/arm/plat-mxc/devices/Kconfig +4
-0@@ -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 boolarch/arm/plat-mxc/devices/Makefile +1
-0@@ -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.oarch/arm/plat-mxc/devices/platform- renamed from arch/arm/plat-mxc/devices/platform-gpio_keys.c +0
-0
gpio_keys.carch/arm/plat-
Quoted 33 lines
new file mode 100644
index 0000000..1c53a53arch/arm/plat-mxc/devices/platform-gpio_keys.c new file +27
-0@@ -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)); +}arch/arm/plat- renamed from arch/arm/plat-mxc/include/mach/devices-common.h +0
-0
mxc/include/mach/devices-common.harch/arm/plat-mxc/include/mach/iomux-
Quoted 15 lines
index 86d7575..8c6896f 100644
arch/arm/plat-mxc/include/mach/devices-common.h +4
-0@@ -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;arch/arm/plat-mxc/include/mach/iomux- renamed from arch/arm/plat-mxc/include/mach/iomux-mx51.h +0
-0
mx51.hQuoted 12 lines
arch/arm/plat-mxc/include/mach/iomux-mx51.h typedef enum iomux_config { · line 117
Quoted 9 lines
index e46b1c2..7ae27e8 100644
arch/arm/plat-mxc/include/mach/iomux-mx51.h +1
-1@@ -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_CTRLlooks OK,PAD_CTL_PUS_100K_UPdoes not.
Quoted 4 lines
How do you suggest I define this pin for Babbage board only? Do I add to
iomux-mx51.h
#defineMX51_BABBAGE_PAD_EIM_A27__GPIO_2_21IOMUX_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.cdid forMBIMXSD_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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
RE: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hello Uwe,
Quoted 48 lines
-----Original Message-----
From: Uwe Kleine-König [mailto:[email protected]]
Sent: Friday, October 22, 2010 2:42 PM
To: Nguyen Dinh-R00091
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxcHello Dinh,
Quoted 19 lines · On Fri, Oct 22, 2010 at 11:58:16AM -0700, Nguyen Dinh-R00091 wrote:
Quoted 19 lines
-----Original Message-----
From: Uwe Kleine-König [mailto:[email protected]]
Sent: Friday, October 22, 2010 1:28 PM
To: Nguyen Dinh-R00091
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxcQuoted 5 lines · On Fri, Oct 22, 2010 at 11:56:14AM -0500, [email protected] wrote:
From: Dinh Nguyen <[email protected]>
Add
imx_add_gpio_keysfunction to add gpio-keys in plat-mxcThis 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.)
Quoted 1 line
Signed-off-by Dinh Nguyen <[email protected]>Quoted 8 lines
Quoted 5 lines
Patch 1 depends on this one, so you should swap their order.
Quoted 1 line
---
I share the concerns of Arnaud.
MX51_GPIO_PAD_CTRLlooks OK,PAD_CTL_PUS_100K_UPdoes not.How do you suggest I define this pin for Babbage board only? Do I add to
iomux-mx51.h
#defineMX51_BABBAGE_PAD_EIM_A27__GPIO_2_21IOMUX_PAD(0x45c,0x0c8, 1,0x0,0,MX51_GPIO_PAD_CTRL |
PAD_CTL_PUS_100K_UP) ?Quoted 2 lines
Or do I define the pin in the board file with a 100K_UP? Like how
eukrea_mbimxsd-baseboard.cdid 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 genericMX51_PAD_EIM_A27__GPIO_2_21to define your local symbol. So I think something like you wrote above should be fine.
Quoted 5 lines
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.
Quoted 6 lines
Best regards
Uwe--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Thanks,
Dinh
RE: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hi,
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
How do you suggest I define this pin for Babbage board only? Do I add to
iomux-mx51.h
#defineMX51_BABBAGE_PAD_EIM_A27__GPIO_2_21IOMUX_PAD(0x45c,0x0c8, 1,0x0,0,MX51_GPIO_PAD_CTRL |
PAD_CTL_PUS_100K_UP) ?Quoted 2 lines
Or do I define the pin in the board file with a 100K_UP? Like how
eukrea_mbimxsd-baseboard.cdid 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 genericMX51_PAD_EIM_A27__GPIO_2_21to define your local symbol. So I think something like you wrote above should be fine.
Quoted 8 lines
Quoted 5 lines
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
Signature · 9 lines
___________________________________________________________ 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 at karo-electronics.de ___________________________________________________________
Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hi Lothar,
Quoted 18 lines · Lothar Wa?mann
Hi,
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
How do you suggest I define this pin for Babbage board only? Do I add to
iomux-mx51.h
#defineMX51_BABBAGE_PAD_EIM_A27__GPIO_2_21IOMUX_PAD(0x45c,0x0c8, 1,0x0,0,MX51_GPIO_PAD_CTRL |
PAD_CTL_PUS_100K_UP) ?Quoted 2 lines
Or do I define the pin in the board file with a 100K_UP? Like how
eukrea_mbimxsd-baseboard.cdid 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 genericMX51_PAD_EIM_A27__GPIO_2_21to 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.
Quoted 7 lines
Quoted 2 lines
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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hi Uwe,
Quoted 27 lines · Uwe Kleine-K?nig
Hi Lothar,
Quoted 24 lines · Lothar Wa?mann
Hi,
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
How do you suggest I define this pin for Babbage board only? Do I add to
iomux-mx51.h
#defineMX51_BABBAGE_PAD_EIM_A27__GPIO_2_21IOMUX_PAD(0x45c,0x0c8, 1,0x0,0,MX51_GPIO_PAD_CTRL |
PAD_CTL_PUS_100K_UP) ?Quoted 2 lines
Or do I define the pin in the board file with a 100K_UP? Like how
eukrea_mbimxsd-baseboard.cdid 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 genericMX51_PAD_EIM_A27__GPIO_2_21to define your local symbol. So I think something like you wrote above should be fine.Quoted 8 lines
Quoted 5 lines
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.
Quoted 6 lines
Quoted 1 line
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_descI 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
Signature · 9 lines
___________________________________________________________ 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 at karo-electronics.de ___________________________________________________________
Re: [PATCHv5 2/3] ARM: imx: Add gpio-keys to plat-mxc
Hello Lothar,
Quoted 26 lines · Lothar Wa?mann
Quoted 25 lines · Uwe Kleine-K?nig
Quoted 24 lines · Lothar Wa?mann
Hi,
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
How do you suggest I define this pin for Babbage board only? Do I add to
iomux-mx51.h
#defineMX51_BABBAGE_PAD_EIM_A27__GPIO_2_21IOMUX_PAD(0x45c,0x0c8, 1,0x0,0,MX51_GPIO_PAD_CTRL |
PAD_CTL_PUS_100K_UP) ?Quoted 2 lines
Or do I define the pin in the board file with a 100K_UP? Like how
eukrea_mbimxsd-baseboard.cdid 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 genericMX51_PAD_EIM_A27__GPIO_2_21to define your local symbol. So I think something like you wrote above should be fine.Quoted 8 lines
Quoted 5 lines
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.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
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_descI 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 ofgit://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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
RFC PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie
The following patch is a first step to convert the 'struct pad_desc' to a bitmapped cookie to facilitate adding platform specific pullup or drive strength definitions to existing pad definitions without need to rewrite the complete pad def.
The patch wraps 'struct pad_desc' in an opaque data type and introduces macros to access the individual members. This patch does not constitute any functional change!
BTW: 'mx51_defconfig' produces the following compile error:
|fs/built-in.o: In function `nfs_callback_authenticate':
|file.c:(.text+0xd9274): undefined reference to `svc_gss_principal'
and 'mx3_defconfig':
|/usr/local/src/arm/linux-2.6-ptx/arch/arm/mach-mx3/devices.c:91: error: 'MX35_INT_MMC_SDHC2' undeclared here (not in a function)
--- mach-mx25/eukrea_mbimxsd-baseboard.c | 2 +- mach-mx25/mach-cpuimx25.c | 2 +- mach-mx25/mach-mx25_3ds.c | 2 +- mach-mx3/eukrea_mbimxsd-baseboard.c | 2 +- mach-mx3/mach-cpuimx35.c | 2 +- mach-mx3/mach-mx35_3ds.c | 2 +- mach-mx3/mach-pcm043.c | 16 ++++++++-------- mach-mx5/board-cpuimx51.c | 2 +- mach-mx5/board-cpuimx51sd.c | 2 +- mach-mx5/board-mx51_3ds.c | 2 +- mach-mx5/board-mx51_babbage.c | 8 ++++---- mach-mx5/board-mx51_efikamx.c | 2 +- mach-mx5/eukrea_mbimx51-baseboard.c | 2 +- mach-mx5/eukrea_mbimxsd-baseboard.c | 2 +- plat-mxc/include/mach/iomux-v3.h | 15 +++++++++++---- plat-mxc/iomux-v3.c | 22 +++++++++++----------- 16 files changed, 46 insertions(+), 39 deletions(-)
arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c +1 -1
@@ -39,7 +39,7 @@#include "devices-imx25.h" #include "devices.h" -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LCD */ MX25_PAD_LD0__LD0 ,MX25_PAD_LD1__LD1 ,
arch/arm/mach-mx25/mach-cpuimx25.c +1 -1
@@ -49,7 +49,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static struct pad_desc eukrea_cpuimx25_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = {/* FEC - RMII */ MX25_PAD_FEC_MDC__FEC_MDC ,MX25_PAD_FEC_MDIO__FEC_MDIO ,
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
@@ -49,7 +49,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static struct pad_desc mx25pdk_pads[] = { +static iomux_v3_cfg_t mx25pdk_pads[] = {MX25_PAD_FEC_MDC__FEC_MDC ,MX25_PAD_FEC_MDIO__FEC_MDIO ,MX25_PAD_FEC_TDATA0__FEC_TDATA0 ,
arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c +1 -1
@@ -111,7 +111,7 @@ static struct mx3fb_platform_data mx3fb_pdata = { .num_modes = ARRAY_SIZE(fb_modedb), }; -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LCD */ MX35_PAD_LD0__IPU_DISPB_DAT_0 ,MX35_PAD_LD1__IPU_DISPB_DAT_1 ,
arch/arm/mach-mx3/mach-cpuimx35.c +1 -1
@@ -78,7 +78,7 @@ static struct platform_device *devices[] __initdata = { &imx_wdt_device0, }; -static struct pad_desc eukrea_cpuimx35_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
arch/arm/mach-mx3/mach-mx35_3ds.c +1 -1
@@ -77,7 +77,7 @@ static struct platform_device *devices[] __initdata = { &mx35pdk_flash, }; -static struct pad_desc mx35pdk_pads[] = { +static iomux_v3_cfg_t mx35pdk_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
arch/arm/mach-mx3/mach-pcm043.c +8 -8
@@ -143,7 +143,7 @@ static struct platform_device *devices[] __initdata = { &imx_wdt_device0, }; -static struct pad_desc pcm043_pads[] = { +static iomux_v3_cfg_t pcm043_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
@@ -230,8 +230,8 @@ static struct pad_desc pcm043_pads[] = {static void pcm043_ac97_warm_reset (struct snd_ac97 *ac97) { -struct pad_desc txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; -struct pad_desc txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; +iomux_v3_cfg_t txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; +iomux_v3_cfg_t txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ;int ret; ret =gpio_request (AC97_GPIO_TXFS ,"SSI" );
@@ -253,11 +253,11 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)static void pcm043_ac97_cold_reset (struct snd_ac97 *ac97) { -struct pad_desc txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; -struct pad_desc txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; -struct pad_desc txd_gpio =MX35_PAD_STXD4__GPIO2_28 ; -struct pad_desc txd =MX35_PAD_STXD4__AUDMUX_AUD4_TXD ; -struct pad_desc reset_gpio =MX35_PAD_SD2_CMD__GPIO2_0 ; +iomux_v3_cfg_t txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; +iomux_v3_cfg_t txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; +iomux_v3_cfg_t txd_gpio =MX35_PAD_STXD4__GPIO2_28 ; +iomux_v3_cfg_t txd =MX35_PAD_STXD4__AUDMUX_AUD4_TXD ; +iomux_v3_cfg_t reset_gpio =MX35_PAD_SD2_CMD__GPIO2_0 ;int ret; ret =gpio_request (AC97_GPIO_TXFS ,"SSI" );
arch/arm/mach-mx5/board-cpuimx51.c +1 -1
@@ -113,7 +113,7 @@ static struct platform_device *devices[] __initdata = {#endif }; -static struct pad_desc eukrea_cpuimx51_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-cpuimx51sd.c +1 -1
@@ -68,7 +68,7 @@#define CPUIMX51SD_GPIO_3_12 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, \ MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) -static struct pad_desc eukrea_cpuimx51sd_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-mx51_3ds.c +1 -1
@@ -30,7 +30,7 @@#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6)#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28) -static struct pad_desc mx51_3ds_pads[] = { +static iomux_v3_cfg_t mx51_3ds_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-mx51_babbage.c +4 -4
@@ -46,7 +46,7 @@#define MX51_USB_PLL_DIV_19_2_MHZ 0x01#define MX51_USB_PLL_DIV_24_MHZ 0x02 -static struct pad_desc mx51babbage_pads[] = { +static iomux_v3_cfg_t mx51babbage_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
@@ -142,8 +142,8 @@ static struct imxi2c_platform_data babbage_hsi2c_data = {static int gpio_usbh1_active (void ) { -struct pad_desc usbh1stp_gpio =MX51_PAD_USBH1_STP__GPIO_1_27 ; -struct pad_desc phyreset_gpio =MX51_PAD_EIM_D21__GPIO_2_5 ; +iomux_v3_cfg_t usbh1stp_gpio =MX51_PAD_USBH1_STP__GPIO_1_27 ; +iomux_v3_cfg_t phyreset_gpio =MX51_PAD_EIM_D21__GPIO_2_5 ;int ret;/* Set USBH1_STP to GPIO and toggle it */
@@ -280,7 +280,7 @@ __setup("otg_mode=", babbage_otg_mode);*/ static void __init mxc_board_init (void ) { -struct pad_desc usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ; +iomux_v3_cfg_t usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ;mxc_iomux_v3_setup_multiple_pads (mx51babbage_pads,ARRAY_SIZE (mx51babbage_pads));
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -1
@@ -39,7 +39,7 @@#define MX51_USB_PLL_DIV_24_MHZ 0x01 -static struct pad_desc mx51efikamx_pads[] = { +static iomux_v3_cfg_t mx51efikamx_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +1 -1
@@ -84,7 +84,7 @@ static struct platform_device *devices[] __initdata = { &mbimx51_leds_gpio, }; -static struct pad_desc mbimx51_pads[] = { +static iomux_v3_cfg_t mbimx51_pads[] = {/* UART2 */ MX51_PAD_UART2_RXD__UART2_RXD ,MX51_PAD_UART2_TXD__UART2_TXD ,
arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c +1 -1
@@ -48,7 +48,7 @@#define MBIMXSD_GPIO_3_31 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, \ MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LED */ MX51_PAD_NANDF_D10__GPIO_3_30 ,/* SWITCH */
arch/arm/plat-mxc/include/mach/iomux-v3.h +11 -4
@@ -44,7 +44,7 @@* */ -struct pad_desc { +typedef struct pad_desc { unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ unsigned mux_mode:8; unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */
@@ -52,7 +52,14 @@ struct pad_desc { unsigned pad_ctrl:17; unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ unsigned select_input:3; -}; +} iomux_v3_cfg_t; + +#define MUX_CTRL_OFS (pad) (pad)->mux_ctrl_ofs +#define MUX_MODE (pad) (pad)->mux_mode +#define MUX_SELECT_INPUT_OFS (pad) (pad)->select_input_ofs +#define MUX_SELECT_INPUT (pad) (pad)->select_input +#define MUX_PAD_CTRL_OFS (pad) (pad)->pad_ctrl_ofs +#define MUX_PAD_CTRL (pad) (pad)->pad_ctrl#define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ _select_input, _pad_ctrl) \
@@ -107,13 +114,13 @@ struct pad_desc {/* * setups a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad); +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad);/* * setups mutliple pads * convenient way to call the above function with tables */ -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count); +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count);/* * Initialise the iomux controller
arch/arm/plat-mxc/iomux-v3.c +11 -11
@@ -32,26 +32,26 @@static void __iomem *base;/* -* setups a single pad in the iomuxer +* configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad) +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad) { -if (pad->mux_ctrl_ofs) -__raw_writel (pad->mux_mode, base + pad->mux_ctrl_ofs); +if (MUX_CTRL_OFS (pad)) +__raw_writel (MUX_MODE (pad), base +MUX_CTRL_OFS (pad)); -if (pad->select_input_ofs) -__raw_writel (pad->select_input, - base + pad->select_input_ofs); +if (MUX_SELECT_INPUT_OFS (pad)) +__raw_writel (MUX_SELECT_INPUT (pad), + base +MUX_SELECT_INPUT (pad)); -if (!(pad->pad_ctrl &NO_PAD_CTRL ) && pad->pad_ctrl_ofs) -__raw_writel (pad->pad_ctrl, base + pad->pad_ctrl_ofs); +if (!(MUX_PAD_CTRL (pad) &NO_PAD_CTRL ) &&MUX_PAD_CTRL_OFS (pad)) +__raw_writel (MUX_PAD_CTRL (pad), base +MUX_PAD_CTRL_OFS (pad));return 0 ; }EXPORT_SYMBOL (mxc_iomux_v3_setup_pad); -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count) +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count) { -struct pad_desc *p = pad_list; +iomux_v3_cfg_t *p = pad_list;int i;int ret;
RFC PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie
-static struct pad_desc eukrea_mbimxsd_pads[] = {
+static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
/* LCD */
MX25_PAD_LD0__LD0,
MX25_PAD_LD1__LD1,
arch/arm/mach-mx25/mach-cpuimx25.c +1 -1
@@ -49,7 +49,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static struct pad_desc eukrea_cpuimx25_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = {/* FEC - RMII */ MX25_PAD_FEC_MDC__FEC_MDC ,MX25_PAD_FEC_MDIO__FEC_MDIO ,
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
@@ -49,7 +49,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static struct pad_desc mx25pdk_pads[] = { +static iomux_v3_cfg_t mx25pdk_pads[] = {MX25_PAD_FEC_MDC__FEC_MDC ,MX25_PAD_FEC_MDIO__FEC_MDIO ,MX25_PAD_FEC_TDATA0__FEC_TDATA0 ,
arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c +1 -1
@@ -111,7 +111,7 @@ static struct mx3fb_platform_data mx3fb_pdata = { .num_modes = ARRAY_SIZE(fb_modedb), }; -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LCD */ MX35_PAD_LD0__IPU_DISPB_DAT_0 ,MX35_PAD_LD1__IPU_DISPB_DAT_1 ,
arch/arm/mach-mx3/mach-cpuimx35.c +1 -1
@@ -78,7 +78,7 @@ static struct platform_device *devices[] __initdata = { &imx_wdt_device0, }; -static struct pad_desc eukrea_cpuimx35_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
arch/arm/mach-mx3/mach-mx35_3ds.c +1 -1
@@ -77,7 +77,7 @@ static struct platform_device *devices[] __initdata = { &mx35pdk_flash, }; -static struct pad_desc mx35pdk_pads[] = { +static iomux_v3_cfg_t mx35pdk_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
arch/arm/mach-mx3/mach-pcm043.c +8 -8
@@ -143,7 +143,7 @@ static struct platform_device *devices[] __initdata = { &imx_wdt_device0, }; -static struct pad_desc pcm043_pads[] = { +static iomux_v3_cfg_t pcm043_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
@@ -230,8 +230,8 @@ static struct pad_desc pcm043_pads[] = {static void pcm043_ac97_warm_reset (struct snd_ac97 *ac97) { -struct pad_desc txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; -struct pad_desc txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; +iomux_v3_cfg_t txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; +iomux_v3_cfg_t txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ;int ret; ret =gpio_request (AC97_GPIO_TXFS ,"SSI" );
@@ -253,11 +253,11 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)static void pcm043_ac97_cold_reset (struct snd_ac97 *ac97) { -struct pad_desc txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; -struct pad_desc txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; -struct pad_desc txd_gpio =MX35_PAD_STXD4__GPIO2_28 ; -struct pad_desc txd =MX35_PAD_STXD4__AUDMUX_AUD4_TXD ; -struct pad_desc reset_gpio =MX35_PAD_SD2_CMD__GPIO2_0 ; +iomux_v3_cfg_t txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; +iomux_v3_cfg_t txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; +iomux_v3_cfg_t txd_gpio =MX35_PAD_STXD4__GPIO2_28 ; +iomux_v3_cfg_t txd =MX35_PAD_STXD4__AUDMUX_AUD4_TXD ; +iomux_v3_cfg_t reset_gpio =MX35_PAD_SD2_CMD__GPIO2_0 ;int ret; ret =gpio_request (AC97_GPIO_TXFS ,"SSI" );
arch/arm/mach-mx5/board-cpuimx51.c +1 -1
@@ -113,7 +113,7 @@ static struct platform_device *devices[] __initdata = {#endif }; -static struct pad_desc eukrea_cpuimx51_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-cpuimx51sd.c +1 -1
@@ -68,7 +68,7 @@#define CPUIMX51SD_GPIO_3_12 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, \ MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) -static struct pad_desc eukrea_cpuimx51sd_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-mx51_3ds.c +1 -1
@@ -30,7 +30,7 @@#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6)#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28) -static struct pad_desc mx51_3ds_pads[] = { +static iomux_v3_cfg_t mx51_3ds_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-mx51_babbage.c +4 -4
@@ -46,7 +46,7 @@#define MX51_USB_PLL_DIV_19_2_MHZ 0x01#define MX51_USB_PLL_DIV_24_MHZ 0x02 -static struct pad_desc mx51babbage_pads[] = { +static iomux_v3_cfg_t mx51babbage_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
@@ -142,8 +142,8 @@ static struct imxi2c_platform_data babbage_hsi2c_data = {static int gpio_usbh1_active (void ) { -struct pad_desc usbh1stp_gpio =MX51_PAD_USBH1_STP__GPIO_1_27 ; -struct pad_desc phyreset_gpio =MX51_PAD_EIM_D21__GPIO_2_5 ; +iomux_v3_cfg_t usbh1stp_gpio =MX51_PAD_USBH1_STP__GPIO_1_27 ; +iomux_v3_cfg_t phyreset_gpio =MX51_PAD_EIM_D21__GPIO_2_5 ;int ret;/* Set USBH1_STP to GPIO and toggle it */
@@ -280,7 +280,7 @@ __setup("otg_mode=", babbage_otg_mode);*/ static void __init mxc_board_init (void ) { -struct pad_desc usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ; +iomux_v3_cfg_t usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ;mxc_iomux_v3_setup_multiple_pads (mx51babbage_pads,ARRAY_SIZE (mx51babbage_pads));
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -1
@@ -39,7 +39,7 @@#define MX51_USB_PLL_DIV_24_MHZ 0x01 -static struct pad_desc mx51efikamx_pads[] = { +static iomux_v3_cfg_t mx51efikamx_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +1 -1
@@ -84,7 +84,7 @@ static struct platform_device *devices[] __initdata = { &mbimx51_leds_gpio, }; -static struct pad_desc mbimx51_pads[] = { +static iomux_v3_cfg_t mbimx51_pads[] = {/* UART2 */ MX51_PAD_UART2_RXD__UART2_RXD ,MX51_PAD_UART2_TXD__UART2_TXD ,
arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c +1 -1
@@ -48,7 +48,7 @@#define MBIMXSD_GPIO_3_31 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, \ MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LED */ MX51_PAD_NANDF_D10__GPIO_3_30 ,/* SWITCH */
arch/arm/plat-mxc/include/mach/iomux-v3.h +11 -4
@@ -44,7 +44,7 @@* */ -struct pad_desc { +typedef struct pad_desc { unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ unsigned mux_mode:8; unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */
@@ -52,7 +52,14 @@ struct pad_desc { unsigned pad_ctrl:17; unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ unsigned select_input:3; -}; +} iomux_v3_cfg_t; + +#define MUX_CTRL_OFS (pad) (pad)->mux_ctrl_ofs +#define MUX_MODE (pad) (pad)->mux_mode +#define MUX_SELECT_INPUT_OFS (pad) (pad)->select_input_ofs +#define MUX_SELECT_INPUT (pad) (pad)->select_input +#define MUX_PAD_CTRL_OFS (pad) (pad)->pad_ctrl_ofs +#define MUX_PAD_CTRL (pad) (pad)->pad_ctrl#define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ _select_input, _pad_ctrl) \
@@ -107,13 +114,13 @@ struct pad_desc {/* * setups a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad); +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad);/* * setups mutliple pads * convenient way to call the above function with tables */ -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count); +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count);/* * Initialise the iomux controller
arch/arm/plat-mxc/iomux-v3.c +11 -11
@@ -32,26 +32,26 @@static void __iomem *base;/* -* setups a single pad in the iomuxer +* configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad) +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad) { -if (pad->mux_ctrl_ofs) -__raw_writel (pad->mux_mode, base + pad->mux_ctrl_ofs); +if (MUX_CTRL_OFS (pad)) +__raw_writel (MUX_MODE (pad), base +MUX_CTRL_OFS (pad)); -if (pad->select_input_ofs) -__raw_writel (pad->select_input, - base + pad->select_input_ofs); +if (MUX_SELECT_INPUT_OFS (pad)) +__raw_writel (MUX_SELECT_INPUT (pad), + base +MUX_SELECT_INPUT (pad)); -if (!(pad->pad_ctrl &NO_PAD_CTRL ) && pad->pad_ctrl_ofs) -__raw_writel (pad->pad_ctrl, base + pad->pad_ctrl_ofs); +if (!(MUX_PAD_CTRL (pad) &NO_PAD_CTRL ) &&MUX_PAD_CTRL_OFS (pad)) +__raw_writel (MUX_PAD_CTRL (pad), base +MUX_PAD_CTRL_OFS (pad));return 0 ; }EXPORT_SYMBOL (mxc_iomux_v3_setup_pad); -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count) +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count) { -struct pad_desc *p = pad_list; +iomux_v3_cfg_t *p = pad_list;int i;int ret;
RFC PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie
In reply to Lothar Wa�mannHello Lothar,
great you follow up on this.
Quoted 8 lines · Lothar Wa?mann
The following patch is a first step to convert the 'struct
pad_desc' to a bitmapped cookie to facilitate adding platform specific pullup or drive strength definitions to existing pad definitions without need to rewrite the complete pad def.The patch wraps 'struct
pad_desc' in an opaque data type and introduces macros to access the individual members. This patch does not constitute any functional change!
great
Quoted 3 lines
BTW: '
mx51_defconfig' produces the following compile error:
|fs/built-in.o: In function `nfs_callback_authenticate':
|file.c:(.text+0xd9274): undefined reference to `svc_gss_principal'
If you enable CRYPTO or disable NFSv4 this is gone. See
http://thread.gmane.org/gmane.linux.kernel/1027380 for some details. Linus tree doesn't have this problem anymore.
Quoted 2 lines
and '
mx3_defconfig':
|/usr/local/src/arm/linux-2.6-ptx/arch/arm/mach-mx3/devices.c:91: error: 'MX35_INT_MMC_SDHC2' undeclared here (not in a function)
This is already fixed in Saschas imx-for-2.6.37 branch.
Quoted 1 line
Signed-off-by Lothar Wa?mann <[email protected]>
Something between your fingers and my eyes messed up the encoding of your mail.
Quoted 23 lines
--- mach-mx25/eukrea_mbimxsd-baseboard.c | 2 +- mach-mx25/mach-cpuimx25.c | 2 +- mach-mx25/mach-mx25_3ds.c | 2 +- mach-mx3/eukrea_mbimxsd-baseboard.c | 2 +- mach-mx3/mach-cpuimx35.c | 2 +- mach-mx3/mach-mx35_3ds.c | 2 +- mach-mx3/mach-pcm043.c | 16 ++++++++-------- mach-mx5/board-cpuimx51.c | 2 +- mach-mx5/board-cpuimx51sd.c | 2 +- mach-mx5/board-mx51_3ds.c | 2 +- mach-mx5/board-mx51_babbage.c | 8 ++++---- mach-mx5/board-mx51_efikamx.c | 2 +- mach-mx5/eukrea_mbimx51-baseboard.c | 2 +- mach-mx5/eukrea_mbimxsd-baseboard.c | 2 +- plat-mxc/include/mach/iomux-v3.h | 15 +++++++++++---- plat-mxc/iomux-v3.c | 22 +++++++++++----------- 16 files changed, 46 insertions(+), 39 deletions(-)[...]
arch/arm/plat-mxc/include/mach/iomux-v3.h line 47
Quoted 5 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +1
-1@@ -44,7 +44,7 @@* */ -struct pad_desc { +typedef struct pad_desc {
if you remove the "pad_desc" here all users of the old name are catched by the compiler.
Quoted 6 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +0
-0unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ unsigned mux_mode:8; unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */@@ -52,7 +52,14 @@ struct pad_desc { unsigned pad_ctrl:17; unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */
arch/arm/plat-mxc/include/mach/iomux-v3.h struct pad_desc { · line 62
Quoted 10 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +8
-1unsigned select_input:3; -}; +} iomux_v3_cfg_t; + +#define MUX_CTRL_OFS (pad) (pad)->mux_ctrl_ofs +#define MUX_MODE (pad) (pad)->mux_mode +#define MUX_SELECT_INPUT_OFS (pad) (pad)->select_input_ofs +#define MUX_SELECT_INPUT (pad) (pad)->select_input +#define MUX_PAD_CTRL_OFS (pad) (pad)->pad_ctrl_ofs +#define MUX_PAD_CTRL (pad) (pad)->pad_ctrl
Maybe make these static inlines? This adds basic type-checking and doesn't have any downsides AFAIK.
Quoted 38 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +2
-2#define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ _select_input, _pad_ctrl) \@@ -107,13 +114,13 @@ struct pad_desc {/* * setups a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad); +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad);/* * setups mutliple pads * convenient way to call the above function with tables */ -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count); +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count);/* * Initialise the iomux controller arch/arm/plat-mxc/iomux-v3.c +4
-5@@ -32,26 +32,26 @@static void __iomem *base;/* -* setups a single pad in the iomuxer +* configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad) +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad) { -if (pad->mux_ctrl_ofs) -__raw_writel (pad->mux_mode, base + pad->mux_ctrl_ofs); +if (MUX_CTRL_OFS (pad)) +__raw_writel (MUX_MODE (pad), base +MUX_CTRL_OFS (pad)); -if (pad->select_input_ofs)
arch/arm/plat-mxc/iomux-v3.c line 47
Quoted 10 lines
arch/arm/plat-mxc/iomux-v3.c +5
-4-__raw_writel (pad->select_input, - base + pad->select_input_ofs); +if (MUX_SELECT_INPUT_OFS (pad)) +__raw_writel (MUX_SELECT_INPUT (pad), + base +MUX_SELECT_INPUT (pad)); -if (!(pad->pad_ctrl &NO_PAD_CTRL ) && pad->pad_ctrl_ofs) -__raw_writel (pad->pad_ctrl, base + pad->pad_ctrl_ofs); +if (!(MUX_PAD_CTRL (pad) &NO_PAD_CTRL ) &&MUX_PAD_CTRL_OFS (pad)) +__raw_writel (MUX_PAD_CTRL (pad), base +MUX_PAD_CTRL_OFS (pad));
unrelated to this patch: I wonder if this is correct. Maybe something like:
if (MUX_PAD_CTRL_OFS(pad)) __raw_writel(MUX_PAD_CTRL(pad) & ~NO_PAD_CTRL, ...);
to get a defined value (here 0) into the MUX_PAD_CTRL register? Not sure this is needed/correct though.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
RFC PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie
Hi,
Quoted 4 lines · Uwe Kleine-K?nig
Quoted 1 line
Signed-off-by Lothar Wa?mann <[email protected]>Something between your fingers and my eyes messed up the encoding of your mail.
That was the first time I used git-send-email... Probably need to configure the default git-encoding.
Quoted 11 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h line 47
Quoted 8 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +1
-1@@ -44,7 +44,7 @@* */ -struct pad_desc { +typedef struct pad_desc {if you remove the "
pad_desc" here all users of the old name are catched by the compiler.
OK.
Quoted 10 lines
Quoted 10 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +2
-1unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ unsigned mux_mode:8; unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */@@ -52,7 +52,14 @@ struct pad_desc { unsigned pad_ctrl:17; unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ unsigned select_input:3; -}; +} iomux_v3_cfg_t; +
Quoted 9 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h struct pad_desc { · line 62
Quoted 6 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +6
-0+#define MUX_CTRL_OFS (pad) (pad)->mux_ctrl_ofs +#define MUX_MODE (pad) (pad)->mux_mode +#define MUX_SELECT_INPUT_OFS (pad) (pad)->select_input_ofs +#define MUX_SELECT_INPUT (pad) (pad)->select_input +#define MUX_PAD_CTRL_OFS (pad) (pad)->pad_ctrl_ofs +#define MUX_PAD_CTRL (pad) (pad)->pad_ctrlMaybe make these static inlines? This adds basic type-checking and doesn't have any downsides AFAIK.
OK. The code is even better with inline functions.
Quoted 7 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h struct pad_desc { · line 64
Quoted 4 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +2
-2-if (!(pad->pad_ctrl &NO_PAD_CTRL ) && pad->pad_ctrl_ofs) -__raw_writel (pad->pad_ctrl, base + pad->pad_ctrl_ofs); +if (!(MUX_PAD_CTRL (pad) &NO_PAD_CTRL ) &&MUX_PAD_CTRL_OFS (pad)) +__raw_writel (MUX_PAD_CTRL (pad), base +MUX_PAD_CTRL_OFS (pad));unrelated to this patch: I wonder if this is correct. Maybe something like:
Quoted 6 lines
if (MUX_PAD_CTRL_OFS(pad)) __raw_writel(MUX_PAD_CTRL(pad) & ~NO_PAD_CTRL, ...);to get a defined value (here 0) into the
MUX_PAD_CTRLregister? Not sure this is needed/correct though.
As far as I understand the logic, the flag NO_PAD_CTRL means that the pad_ctl register should not be touched. This could be one way to have platform specific pad_ctl values, but with the new apporach there is a better possibility to achieve this. Thus this flag could be removed in the final version and explicit pad_ctl values (reset default) given for all pads. But this may break existing configurations that rely on some other value being set up by the bootloader or platform init code.
Here is an updated patch:
arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c +1 -1
@@ -39,7 +39,7 @@#include "devices-imx25.h" #include "devices.h" -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LCD */ MX25_PAD_LD0__LD0 ,MX25_PAD_LD1__LD1 ,
arch/arm/mach-mx25/mach-cpuimx25.c +1 -1
@@ -49,7 +49,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static struct pad_desc eukrea_cpuimx25_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = {/* FEC - RMII */ MX25_PAD_FEC_MDC__FEC_MDC ,MX25_PAD_FEC_MDIO__FEC_MDIO ,
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
@@ -49,7 +49,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static struct pad_desc mx25pdk_pads[] = { +static iomux_v3_cfg_t mx25pdk_pads[] = {MX25_PAD_FEC_MDC__FEC_MDC ,MX25_PAD_FEC_MDIO__FEC_MDIO ,MX25_PAD_FEC_TDATA0__FEC_TDATA0 ,
arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c +1 -1
@@ -111,7 +111,7 @@ static struct mx3fb_platform_data mx3fb_pdata = { .num_modes = ARRAY_SIZE(fb_modedb), }; -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LCD */ MX35_PAD_LD0__IPU_DISPB_DAT_0 ,MX35_PAD_LD1__IPU_DISPB_DAT_1 ,
arch/arm/mach-mx3/mach-cpuimx35.c +1 -1
@@ -78,7 +78,7 @@ static struct platform_device *devices[] __initdata = { &imx_wdt_device0, }; -static struct pad_desc eukrea_cpuimx35_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
arch/arm/mach-mx3/mach-mx35_3ds.c +1 -1
@@ -77,7 +77,7 @@ static struct platform_device *devices[] __initdata = { &mx35pdk_flash, }; -static struct pad_desc mx35pdk_pads[] = { +static iomux_v3_cfg_t mx35pdk_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
arch/arm/mach-mx3/mach-pcm043.c +8 -8
@@ -143,7 +143,7 @@ static struct platform_device *devices[] __initdata = { &imx_wdt_device0, }; -static struct pad_desc pcm043_pads[] = { +static iomux_v3_cfg_t pcm043_pads[] = {/* UART1 */ MX35_PAD_CTS1__UART1_CTS ,MX35_PAD_RTS1__UART1_RTS ,
@@ -230,8 +230,8 @@ static struct pad_desc pcm043_pads[] = {static void pcm043_ac97_warm_reset (struct snd_ac97 *ac97) { -struct pad_desc txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; -struct pad_desc txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; +iomux_v3_cfg_t txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; +iomux_v3_cfg_t txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ;int ret; ret =gpio_request (AC97_GPIO_TXFS ,"SSI" );
@@ -253,11 +253,11 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)static void pcm043_ac97_cold_reset (struct snd_ac97 *ac97) { -struct pad_desc txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; -struct pad_desc txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; -struct pad_desc txd_gpio =MX35_PAD_STXD4__GPIO2_28 ; -struct pad_desc txd =MX35_PAD_STXD4__AUDMUX_AUD4_TXD ; -struct pad_desc reset_gpio =MX35_PAD_SD2_CMD__GPIO2_0 ; +iomux_v3_cfg_t txfs_gpio =MX35_PAD_STXFS4__GPIO2_31 ; +iomux_v3_cfg_t txfs =MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS ; +iomux_v3_cfg_t txd_gpio =MX35_PAD_STXD4__GPIO2_28 ; +iomux_v3_cfg_t txd =MX35_PAD_STXD4__AUDMUX_AUD4_TXD ; +iomux_v3_cfg_t reset_gpio =MX35_PAD_SD2_CMD__GPIO2_0 ;int ret; ret =gpio_request (AC97_GPIO_TXFS ,"SSI" );
arch/arm/mach-mx5/board-cpuimx51.c +1 -1
@@ -113,7 +113,7 @@ static struct platform_device *devices[] __initdata = {#endif }; -static struct pad_desc eukrea_cpuimx51_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-cpuimx51sd.c +1 -1
@@ -68,7 +68,7 @@#define CPUIMX51SD_GPIO_3_12 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, \ MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) -static struct pad_desc eukrea_cpuimx51sd_pads[] = { +static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-mx51_3ds.c +1 -1
@@ -30,7 +30,7 @@#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6)#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28) -static struct pad_desc mx51_3ds_pads[] = { +static iomux_v3_cfg_t mx51_3ds_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/board-mx51_babbage.c +4 -4
@@ -46,7 +46,7 @@#define MX51_USB_PLL_DIV_19_2_MHZ 0x01#define MX51_USB_PLL_DIV_24_MHZ 0x02 -static struct pad_desc mx51babbage_pads[] = { +static iomux_v3_cfg_t mx51babbage_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
@@ -142,8 +142,8 @@ static struct imxi2c_platform_data babbage_hsi2c_data = {static int gpio_usbh1_active (void ) { -struct pad_desc usbh1stp_gpio =MX51_PAD_USBH1_STP__GPIO_1_27 ; -struct pad_desc phyreset_gpio =MX51_PAD_EIM_D21__GPIO_2_5 ; +iomux_v3_cfg_t usbh1stp_gpio =MX51_PAD_USBH1_STP__GPIO_1_27 ; +iomux_v3_cfg_t phyreset_gpio =MX51_PAD_EIM_D21__GPIO_2_5 ;int ret;/* Set USBH1_STP to GPIO and toggle it */
@@ -280,7 +280,7 @@ __setup("otg_mode=", babbage_otg_mode);*/ static void __init mxc_board_init (void ) { -struct pad_desc usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ; +iomux_v3_cfg_t usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ;mxc_iomux_v3_setup_multiple_pads (mx51babbage_pads,ARRAY_SIZE (mx51babbage_pads));
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -1
@@ -39,7 +39,7 @@#define MX51_USB_PLL_DIV_24_MHZ 0x01 -static struct pad_desc mx51efikamx_pads[] = { +static iomux_v3_cfg_t mx51efikamx_pads[] = {/* UART1 */ MX51_PAD_UART1_RXD__UART1_RXD ,MX51_PAD_UART1_TXD__UART1_TXD ,
arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +1 -1
@@ -84,7 +84,7 @@ static struct platform_device *devices[] __initdata = { &mbimx51_leds_gpio, }; -static struct pad_desc mbimx51_pads[] = { +static iomux_v3_cfg_t mbimx51_pads[] = {/* UART2 */ MX51_PAD_UART2_RXD__UART2_RXD ,MX51_PAD_UART2_TXD__UART2_TXD ,
arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c +1 -1
@@ -48,7 +48,7 @@#define MBIMXSD_GPIO_3_31 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, \ MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) -static struct pad_desc eukrea_mbimxsd_pads[] = { +static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {/* LED */ MX51_PAD_NANDF_D10__GPIO_3_30 ,/* SWITCH */
arch/arm/plat-mxc/include/mach/iomux-v3.h +34 -4
@@ -44,7 +44,7 @@* */ -struct pad_desc { +typedef struct deprecated_pad_desc { unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ unsigned mux_mode:8; unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */
@@ -52,7 +52,37 @@ struct pad_desc { unsigned pad_ctrl:17; unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ unsigned select_input:3; -}; +} iomux_v3_cfg_t; + +static inline unsigned int MUX_CTRL_OFS (iomux_v3_cfg_t *pad) +{ +return pad->mux_ctrl_ofs; +} + +static inline unsigned int MUX_MODE (iomux_v3_cfg_t *pad) +{ +return pad->mux_mode; +} + +static inline unsigned int MUX_SELECT_INPUT_OFS (iomux_v3_cfg_t *pad) +{ +return pad->select_input_ofs; +} + +static inline unsigned int MUX_SELECT_INPUT (iomux_v3_cfg_t *pad) +{ +return pad->select_input; +} + +static inline unsigned int MUX_PAD_CTRL_OFS (iomux_v3_cfg_t *pad) +{ +return pad->pad_ctrl_ofs; +} + +static inline unsigned int MUX_PAD_CTRL (iomux_v3_cfg_t *pad) +{ +return pad->pad_ctrl; +}#define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ _select_input, _pad_ctrl) \
@@ -107,13 +137,13 @@ struct pad_desc {/* * setups a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad); +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad);/* * setups mutliple pads * convenient way to call the above function with tables */ -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count); +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count);/* * Initialise the iomux controller
arch/arm/plat-mxc/iomux-v3.c +11 -11
@@ -32,26 +32,26 @@static void __iomem *base;/* -* setups a single pad in the iomuxer +* configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (struct pad_desc *pad) +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad) { -if (pad->mux_ctrl_ofs) -__raw_writel (pad->mux_mode, base + pad->mux_ctrl_ofs); +if (MUX_CTRL_OFS (pad)) +__raw_writel (MUX_MODE (pad), base +MUX_CTRL_OFS (pad)); -if (pad->select_input_ofs) -__raw_writel (pad->select_input, - base + pad->select_input_ofs); +if (MUX_SELECT_INPUT_OFS (pad)) +__raw_writel (MUX_SELECT_INPUT (pad), + base +MUX_SELECT_INPUT (pad)); -if (!(pad->pad_ctrl &NO_PAD_CTRL ) && pad->pad_ctrl_ofs) -__raw_writel (pad->pad_ctrl, base + pad->pad_ctrl_ofs); +if (!(MUX_PAD_CTRL (pad) &NO_PAD_CTRL ) &&MUX_PAD_CTRL_OFS (pad)) +__raw_writel (MUX_PAD_CTRL (pad), base +MUX_PAD_CTRL_OFS (pad));return 0 ; }EXPORT_SYMBOL (mxc_iomux_v3_setup_pad); -int mxc_iomux_v3_setup_multiple_pads (struct pad_desc *pad_list,unsigned count) +int mxc_iomux_v3_setup_multiple_pads (iomux_v3_cfg_t *pad_list,unsigned count) { -struct pad_desc *p = pad_list; +iomux_v3_cfg_t *p = pad_list;int i;int ret;
Lothar Wa?mann
Signature · 9 lines
___________________________________________________________ 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 at karo-electronics.de ___________________________________________________________
Sascha Hauer
maintainerRFC PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie
In reply to Lothar Wa�mannHi Lothar,
Quoted 4 lines · Lothar Wa?mann
The following patch is a first step to convert the 'struct
pad_desc' to a bitmapped cookie to facilitate adding platform specific pullup or drive strength definitions to existing pad definitions without need to rewrite the complete pad def.
I'm all in favour for this patch. I regret that I haven't implemented it this way in the first time.
I think we should delay this to the next merge window though because it introduces a change for many i.MX boards. Some more testing for this patch is a good thing.
Sascha
Signature · 4 lines
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 |
PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie (step 2)
In reply to Lothar Wa�mannThis patch actually replaces the 'struct pad_desc' with a u64 cookie to facilitate adding platform specific pad_ctrl settings to an existing pad definition.
So, instead of:
iomux_v3_cfg_t power_key = MX51_PAD_EIM_A27__GPIO_2_21; power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2; mxc_iomux_v3_setup_pad(&power_key); one can write: mxc_iomux_v3_setup_pad((MX51_PAD_EIM_A27__GPIO_2_21 & ~MUX_PAD_CTRL_MASK) | MX51_GPIO_PAD_CTRL_2);
Patch applies to branch 'imx-for-2.6.38' of git://git.pengutronix.de/git/imx/linux-2.6
--- mach-mx3/mach-pcm043.c | 14 +++--- mach-mx5/board-mx51_babbage.c | 11 ++--- plat-mxc/include/mach/iomux-v3.h | 84 ++++++++++++++++++++++----------------- plat-mxc/iomux-v3.c | 4 - 4 files changed, 63 insertions(+), 50 deletions(-)
arch/arm/mach-mx3/mach-pcm043.c +7 -7
@@ -240,7 +240,7 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)return ; } -mxc_iomux_v3_setup_pad (&txfs_gpio); +mxc_iomux_v3_setup_pad (txfs_gpio);/* warm reset */ gpio_direction_output (AC97_GPIO_TXFS ,1 );
@@ -248,7 +248,7 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)gpio_set_value (AC97_GPIO_TXFS ,0 );gpio_free (AC97_GPIO_TXFS ); -mxc_iomux_v3_setup_pad (&txfs); +mxc_iomux_v3_setup_pad (txfs); }static void pcm043_ac97_cold_reset (struct snd_ac97 *ac97)
@@ -272,9 +272,9 @@ static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)if (ret) goto err3; -mxc_iomux_v3_setup_pad (&txfs_gpio); -mxc_iomux_v3_setup_pad (&txd_gpio); -mxc_iomux_v3_setup_pad (&reset_gpio); +mxc_iomux_v3_setup_pad (txfs_gpio); +mxc_iomux_v3_setup_pad (txd_gpio); +mxc_iomux_v3_setup_pad (reset_gpio);gpio_direction_output (AC97_GPIO_TXFS ,0 );gpio_direction_output (AC97_GPIO_TXD ,0 );
@@ -284,8 +284,8 @@ static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)udelay (10 );gpio_direction_output (AC97_GPIO_RESET ,1 ); -mxc_iomux_v3_setup_pad (&txd); -mxc_iomux_v3_setup_pad (&txfs); +mxc_iomux_v3_setup_pad (txd); +mxc_iomux_v3_setup_pad (txfs);gpio_free (AC97_GPIO_RESET ); err3:
arch/arm/mach-mx5/board-mx51_babbage.c +6 -6
@@ -193,7 +193,7 @@ static int gpio_usbh1_active(void)int ret;/* Set USBH1_STP to GPIO and toggle it */ -mxc_iomux_v3_setup_pad (&usbh1stp_gpio); +mxc_iomux_v3_setup_pad (usbh1stp_gpio); ret =gpio_request (BABBAGE_USBH1_STP ,"usbh1_stp" );if (ret) {
@@ -206,7 +206,7 @@ static int gpio_usbh1_active(void)gpio_free (BABBAGE_USBH1_STP );/* De-assert USB PHY RESETB */ -mxc_iomux_v3_setup_pad (&phyreset_gpio); +mxc_iomux_v3_setup_pad (phyreset_gpio); ret =gpio_request (BABBAGE_PHY_RESET ,"phy_reset" );if (ret) {
@@ -348,7 +348,8 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {static void __init mxc_board_init (void ) {iomux_v3_cfg_t usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ; -iomux_v3_cfg_t power_key =MX51_PAD_EIM_A27__GPIO_2_21 ; +iomux_v3_cfg_t power_key = (MX51_PAD_EIM_A27__GPIO_2_21 & + ~MUX_PAD_CTRL_MASK ) |MX51_GPIO_PAD_CTRL_2 ;#if defined(CONFIG_CPU_FREQ_IMX ) get_cpu_op = mx51_get_cpu_op;
@@ -360,8 +361,7 @@ static void __init mxc_board_init(void)imx51_add_fec (NULL );/* Set the PAD settings for the pwr key. */ - power_key.pad_ctrl =MX51_GPIO_PAD_CTRL_2 ; -mxc_iomux_v3_setup_pad (&power_key); +mxc_iomux_v3_setup_pad (power_key);imx51_add_gpio_keys (&imx_button_data);imx51_add_imx_i2c (0 , &babbage_i2c_data);
@@ -378,7 +378,7 @@ static void __init mxc_board_init(void)gpio_usbh1_active ();mxc_register_device (&mxc_usbh1_device, &usbh1_config);/* setback USBH1_STP to be function */ -mxc_iomux_v3_setup_pad (&usbh1stp); +mxc_iomux_v3_setup_pad (usbh1stp);babbage_usbhub_reset ();imx51_add_esdhc (0 ,NULL );
arch/arm/plat-mxc/include/mach/iomux-v3.h +49 -35
114 lines not on this page · raw message
arch/arm/plat-mxc/iomux-v3.c +2 -2
@@ -34,7 +34,7 @@ static void __iomem *base;/* * configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad) +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t pad) {if (MUX_CTRL_OFS (pad))__raw_writel (MUX_MODE (pad), base +MUX_CTRL_OFS (pad));
@@ -56,7 +56,7 @@ int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count)int ret;for (i =0 ; i < count; i++) { - ret =mxc_iomux_v3_setup_pad (p); + ret =mxc_iomux_v3_setup_pad (*p);if (ret)return ret; p++;
Lothar Wa?mann
Signature · 9 lines
___________________________________________________________ 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 | [email protected] ___________________________________________________________
PATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie (step 2)
Quoted 4 lines · Lothar Wa?mann
This patch actually replaces the 'struct
pad_desc' with a u64 cookie to facilitate adding platform specificpad_ctrlsettings to an existing pad definition.
Quoted 8 lines
So, instead of:
iomux_v3_cfg_t power_key = MX51_PAD_EIM_A27__GPIO_2_21; power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2; mxc_iomux_v3_setup_pad(&power_key); one can write: mxc_iomux_v3_setup_pad((MX51_PAD_EIM_A27__GPIO_2_21 & ~MUX_PAD_CTRL_MASK) | MX51_GPIO_PAD_CTRL_2);Patch applies to branch 'imx-for-2.6.38' of
git://git.pengutronix.de/git/imx/linux-2.6
minor nitpick: This doens't belong here, but after the triple dash below (IMHO).
Quoted 1 line
Signed-off-by Lothar Wa?mann <[email protected]>
minor nitpick: The more usual way to write that is:
Signed-off-by: ...
(i.e. off and by in lower case). This might prevent you to appear in the various hit lists like http://www.remword.com/kps_result/ :-)
Quoted 130 lines
--- mach-mx3/mach-pcm043.c | 14 +++--- mach-mx5/board-mx51_babbage.c | 11 ++--- plat-mxc/include/mach/iomux-v3.h | 84 ++++++++++++++++++++++----------------- plat-mxc/iomux-v3.c | 4 - 4 files changed, 63 insertions(+), 50 deletions(-)arch/arm/mach-mx3/mach-pcm043.c +7
-7@@ -240,7 +240,7 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)return ; } -mxc_iomux_v3_setup_pad (&txfs_gpio); +mxc_iomux_v3_setup_pad (txfs_gpio);/* warm reset */ gpio_direction_output (AC97_GPIO_TXFS ,1 );@@ -248,7 +248,7 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)gpio_set_value (AC97_GPIO_TXFS ,0 );gpio_free (AC97_GPIO_TXFS ); -mxc_iomux_v3_setup_pad (&txfs); +mxc_iomux_v3_setup_pad (txfs); }static void pcm043_ac97_cold_reset (struct snd_ac97 *ac97)@@ -272,9 +272,9 @@ static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)if (ret) goto err3; -mxc_iomux_v3_setup_pad (&txfs_gpio); -mxc_iomux_v3_setup_pad (&txd_gpio); -mxc_iomux_v3_setup_pad (&reset_gpio); +mxc_iomux_v3_setup_pad (txfs_gpio); +mxc_iomux_v3_setup_pad (txd_gpio); +mxc_iomux_v3_setup_pad (reset_gpio);gpio_direction_output (AC97_GPIO_TXFS ,0 );gpio_direction_output (AC97_GPIO_TXD ,0 );@@ -284,8 +284,8 @@ static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)udelay (10 );gpio_direction_output (AC97_GPIO_RESET ,1 ); -mxc_iomux_v3_setup_pad (&txd); -mxc_iomux_v3_setup_pad (&txfs); +mxc_iomux_v3_setup_pad (txd); +mxc_iomux_v3_setup_pad (txfs);gpio_free (AC97_GPIO_RESET ); err3:arch/arm/mach-mx5/board-mx51_babbage.c +6
-6@@ -193,7 +193,7 @@ static int gpio_usbh1_active(void)int ret;/* Set USBH1_STP to GPIO and toggle it */ -mxc_iomux_v3_setup_pad (&usbh1stp_gpio); +mxc_iomux_v3_setup_pad (usbh1stp_gpio); ret =gpio_request (BABBAGE_USBH1_STP ,"usbh1_stp" );if (ret) {@@ -206,7 +206,7 @@ static int gpio_usbh1_active(void)gpio_free (BABBAGE_USBH1_STP );/* De-assert USB PHY RESETB */ -mxc_iomux_v3_setup_pad (&phyreset_gpio); +mxc_iomux_v3_setup_pad (phyreset_gpio); ret =gpio_request (BABBAGE_PHY_RESET ,"phy_reset" );if (ret) {@@ -348,7 +348,8 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {static void __init mxc_board_init (void ) {iomux_v3_cfg_t usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ; -iomux_v3_cfg_t power_key =MX51_PAD_EIM_A27__GPIO_2_21 ; +iomux_v3_cfg_t power_key = (MX51_PAD_EIM_A27__GPIO_2_21 & + ~MUX_PAD_CTRL_MASK ) |MX51_GPIO_PAD_CTRL_2 ;#if defined(CONFIG_CPU_FREQ_IMX ) get_cpu_op = mx51_get_cpu_op;@@ -360,8 +361,7 @@ static void __init mxc_board_init(void)imx51_add_fec (NULL );/* Set the PAD settings for the pwr key. */ - power_key.pad_ctrl =MX51_GPIO_PAD_CTRL_2 ; -mxc_iomux_v3_setup_pad (&power_key); +mxc_iomux_v3_setup_pad (power_key);imx51_add_gpio_keys (&imx_button_data);imx51_add_imx_i2c (0 , &babbage_i2c_data);@@ -378,7 +378,7 @@ static void __init mxc_board_init(void)gpio_usbh1_active ();mxc_register_device (&mxc_usbh1_device, &usbh1_config);/* setback USBH1_STP to be function */ -mxc_iomux_v3_setup_pad (&usbh1stp); +mxc_iomux_v3_setup_pad (usbh1stp);babbage_usbhub_reset ();imx51_add_esdhc (0 ,NULL );arch/arm/plat-mxc/include/mach/iomux-v3.h +5
-13@@ -42,58 +42,72 @@* If <padname> or <padmode> refers to a GPIO, it is named * GPIO_<unit>_<num> * -*/ - -typedef struct deprecated_pad_desc { -unsigned mux_ctrl_ofs:12 ;/* IOMUXC_SW_MUX_CTL_PAD offset */ -unsigned mux_mode:8 ; -unsigned pad_ctrl_ofs:12 ;/* IOMUXC_SW_PAD_CTRL offset */ -#define NO_PAD_CTRL (1 << 16) -unsigned pad_ctrl:17 ; -unsigned select_input_ofs:12 ;/* IOMUXC_SELECT_INPUT offset */ -unsigned select_input:3 ; -}iomux_v3_cfg_t ; - -static inline unsigned int MUX_CTRL_OFS (iomux_v3_cfg_t *pad) +* IOMUX/PAD Bit field definitions +* +* MUX_CTRL_OFS: 0..11 (12) +* PAD_CTRL_OFS: 12..23 (12) +* SEL_INPUT_OFS: 24..35 (12)
arch/arm/plat-mxc/include/mach/iomux-v3.h line 59
Quoted 10 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +10
-0+* MUX_MODE + SION: 36..40 (5) +* PAD_CTRL + NO_PAD_CTRL: 41..57 (17) +* SEL_INP: 58..61 (4) +* reserved: 63 (1) +*/ + +typedef u64 iomux_v3_cfg_t ; + +#define MUX_CTRL_OFS_SHIFT 0 +#define MUX_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)
It doesn't matter for the compiler, but for the reader
((iomux_v3_cfg_t)(0xfff << MUX_CTRL_OFS_SHIFT))
might be clearer?! Ah, I see the problem:
((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT) != ((iomux_v3_cfg_t)(0x1f << MUX_MODE_SHIFT))
Well, OK.
And these constants should be named (e.g.)
IMX_IOMUXV3_CTRL_OFS_MASK
to use the proper namespace. IMHO this applies to NO_PAD_CTRL and IOMUX_PAD, too. Maybe fix the name and define the old name to the new for now?
Quoted 120 lines
arch/arm/plat-mxc/include/mach/iomux-v3.h +34
-22+#define MUX_PAD_CTRL_OFS_SHIFT 12 +#define MUX_PAD_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_PAD_CTRL_OFS_SHIFT) +#define MUX_SEL_INPUT_OFS_SHIFT 24 +#define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_SEL_INPUT_OFS_SHIFT) + +#define MUX_MODE_SHIFT 36 +#define MUX_MODE_MASK ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT) +#define MUX_PAD_CTRL_SHIFT 41 +#define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x1ffff << MUX_PAD_CTRL_SHIFT) +#define NO_PAD_CTRL ((iomux_v3_cfg_t)1 << (MUX_PAD_CTRL_SHIFT + 16)) +#define MUX_SEL_INPUT_SHIFT 58 +#define MUX_SEL_INPUT_MASK ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT) + +static inline unsigned int MUX_CTRL_OFS (iomux_v3_cfg_t pad) { -return pad->mux_ctrl_ofs; +return (pad &MUX_CTRL_OFS_MASK ) >>MUX_CTRL_OFS_SHIFT ; } -static inline unsigned int MUX_MODE (iomux_v3_cfg_t *pad) +static inline unsigned int MUX_MODE (iomux_v3_cfg_t pad) { -return pad->mux_mode; +return (pad &MUX_MODE_MASK ) >>MUX_MODE_SHIFT ; } -static inline unsigned int MUX_SELECT_INPUT_OFS (iomux_v3_cfg_t *pad) +static inline unsigned int MUX_SELECT_INPUT_OFS (iomux_v3_cfg_t pad) { -return pad->select_input_ofs; +return (pad &MUX_SEL_INPUT_OFS_MASK ) >>MUX_SEL_INPUT_OFS_SHIFT ; } -static inline unsigned int MUX_SELECT_INPUT (iomux_v3_cfg_t *pad) +static inline unsigned int MUX_SELECT_INPUT (iomux_v3_cfg_t pad) { -return pad->select_input; +return (pad &MUX_SEL_INPUT_MASK ) >>MUX_SEL_INPUT_SHIFT ; } -static inline unsigned int MUX_PAD_CTRL_OFS (iomux_v3_cfg_t *pad) +static inline unsigned int MUX_PAD_CTRL_OFS (iomux_v3_cfg_t pad) { -return pad->pad_ctrl_ofs; +return (pad &MUX_PAD_CTRL_OFS_MASK ) >>MUX_PAD_CTRL_OFS_SHIFT ; } -static inline unsigned int MUX_PAD_CTRL (iomux_v3_cfg_t *pad) +static inline unsigned int MUX_PAD_CTRL (iomux_v3_cfg_t pad) { -return pad->pad_ctrl; +return (pad &MUX_PAD_CTRL_MASK ) >>MUX_PAD_CTRL_SHIFT ; } -#define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ - _select_input, _pad_ctrl) \ - { \ - .mux_ctrl_ofs = _mux_ctrl_ofs, \ - .mux_mode = _mux_mode, \ - .pad_ctrl_ofs = _pad_ctrl_ofs, \ - .pad_ctrl = _pad_ctrl, \ - .select_input_ofs = _select_input_ofs, \ - .select_input = _select_input, \ - } +#define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, \ + _sel_input, _pad_ctrl) \ + (((iomux_v3_cfg_t)(_mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) | \ + ((iomux_v3_cfg_t)(_mux_mode) << MUX_MODE_SHIFT) | \ + ((iomux_v3_cfg_t)(_pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \ + ((iomux_v3_cfg_t)(_pad_ctrl) << MUX_PAD_CTRL_SHIFT) | \ + ((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \ + ((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT))/* * Use to set PAD control @@ -137,7 +151,7 @@ static inline unsigned int MUX_PAD_CTRL(iomux_v3_cfg_t *pad)/* * setups a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad); +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t pad);/* * setups mutliple pads arch/arm/plat-mxc/iomux-v3.c +2
-2@@ -34,7 +34,7 @@ static void __iomem *base;/* * configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t *pad) +int mxc_iomux_v3_setup_pad (iomux_v3_cfg_t pad) {if (MUX_CTRL_OFS (pad))__raw_writel (MUX_MODE (pad), base +MUX_CTRL_OFS (pad));@@ -56,7 +56,7 @@ int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count)int ret;for (i =0 ; i < count; i++) { - ret =mxc_iomux_v3_setup_pad (p); + ret =mxc_iomux_v3_setup_pad (*p);if (ret)return ret; p++;Lothar Wa?mann
Signature · 9 lines
___________________________________________________________ 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 at karo-electronics.de ___________________________________________________________
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Sascha Hauer
maintainerPATCH 1/1 MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie (step 2)
In reply to Lothar WaßmannHi Lothar,
Quoted 26 lines · Lothar Wa?mann
This patch actually replaces the 'struct
pad_desc' with a u64 cookie to facilitate adding platform specificpad_ctrlsettings to an existing pad definition.So, instead of:
iomux_v3_cfg_t power_key = MX51_PAD_EIM_A27__GPIO_2_21; power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2; mxc_iomux_v3_setup_pad(&power_key); one can write: mxc_iomux_v3_setup_pad((MX51_PAD_EIM_A27__GPIO_2_21 & ~MUX_PAD_CTRL_MASK) | MX51_GPIO_PAD_CTRL_2);Patch applies to branch 'imx-for-2.6.38' of
git://git.pengutronix.de/git/imx/linux-2.6Signed-off-by Lothar Wa?mann <[email protected]>--- mach-mx3/mach-pcm043.c | 14 +++--- mach-mx5/board-mx51_babbage.c | 11 ++--- plat-mxc/include/mach/iomux-v3.h | 84 ++++++++++++++++++++++----------------- plat-mxc/iomux-v3.c | 4 - 4 files changed, 63 insertions(+), 50 deletions(-)arch/arm/mach-mx5/board-mx51_babbage.c +0
-0
arch/arm/mach-mx5/board-mx51_babbage.c static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = { · line 353
Quoted 7 lines
arch/arm/mach-mx5/board-mx51_babbage.c +2
-1@@ -348,7 +348,8 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {static void __init mxc_board_init (void ) {iomux_v3_cfg_t usbh1stp =MX51_PAD_USBH1_STP__USBH1_STP ; -iomux_v3_cfg_t power_key =MX51_PAD_EIM_A27__GPIO_2_21 ; +iomux_v3_cfg_t power_key = (MX51_PAD_EIM_A27__GPIO_2_21 & + ~MUX_PAD_CTRL_MASK ) |MX51_GPIO_PAD_CTRL_2 ;
This does not work. MX51_GPIO_PAD_CTRL_2 is defined as:
#define MX51_GPIO_PAD_CTRL_2 (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \ PAD_CTL_PUS_100K_UP)
It has to be shifted to the correct location in the bit field. The following fixes this, but it does not look particularly nice:
+ iomux_v3_cfg_t power_key = (MX51_PAD_EIM_A27__GPIO_2_21 &
+ ~MUX_PAD_CTRL_MASK) | ((iomux_v3_cfg_t)(MX51_GPIO_PAD_CTRL_2) << MUX_PAD_CTRL_SHIFT);
How do we proceed from here?
Some
#define MUX_PAD_CTRL(mode) ((iomux_v3_cfg_t)(mode) << MUX_PAD_CTRL_SHIFT)
Macro would be nice. Unfortunately the name is already used for a function doing the opposite.
Sascha
Signature · 4 lines
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 |
In the interest of bisectability, Patch 1 and 2 should've been reversed since imx51_add_gpio_keys() is only defined in patch 2.
Quoted 103 lines · On 10 Oct 22, [email protected] wrote:
From: Dinh Nguyen <[email protected]>
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 <[email protected]>--- 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(-)arch/arm/configs/mx51_defconfig +1
-0@@ -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=yarch/arm/mach-mx5/board-mx51_babbage.c +22
-0@@ -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);arch/arm/mach-mx5/devices-imx51.h +2
-0@@ -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)Signature · 1 line
1.6.0.4
Signature · 3 lines
---------------------------------------------------------------------- Amit Kucheria, Kernel Engineer || [email protected] ----------------------------------------------------------------------