diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2010-12-01 08:11:47 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-01-12 08:50:45 -0500 |
commit | a5fcfef0b8db574098f2e42827117bc4accf2efd (patch) | |
tree | c7c2223b26ae5d37ef10203af2e781e51e43b0cf /arch/arm/mach-mx5 | |
parent | 076762aa52de48688f6e1b6999fe58d736479f37 (diff) |
ARM: mx5: dynamically allocate imx-keypad devices
Add support for dynamical allocation of imx-keypad on mx5 platform.
After moving to dynamically registration of the keypad, the keypad clock
name needs to change accordingly.
The reason is that the original mx5 keypad platform_device id was 0,
now we use id=-1 as per arch/arm/plat-mxc/devices/platform-imx-keypad.c.
Tested keypad successfully on a MX51_3DS board.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx5')
-rw-r--r-- | arch/arm/mach-mx5/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-mx51_3ds.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-mx5/clock-mx51-mx53.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx5/devices-imx51.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-mx5/devices.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-mx5/devices.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | 5 |
7 files changed, 11 insertions, 27 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index 777740b9ffdd..f2f07315fd35 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig | |||
@@ -50,6 +50,7 @@ config MACH_MX51_BABBAGE | |||
50 | config MACH_MX51_3DS | 50 | config MACH_MX51_3DS |
51 | bool "Support MX51PDK (3DS)" | 51 | bool "Support MX51PDK (3DS)" |
52 | select SOC_IMX51 | 52 | select SOC_IMX51 |
53 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | ||
53 | select IMX_HAVE_PLATFORM_IMX_UART | 54 | select IMX_HAVE_PLATFORM_IMX_UART |
54 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX | 55 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX |
55 | select IMX_HAVE_PLATFORM_SPI_IMX | 56 | select IMX_HAVE_PLATFORM_SPI_IMX |
@@ -77,6 +78,7 @@ choice | |||
77 | config MACH_EUKREA_MBIMX51_BASEBOARD | 78 | config MACH_EUKREA_MBIMX51_BASEBOARD |
78 | prompt "Eukrea MBIMX51 development board" | 79 | prompt "Eukrea MBIMX51 development board" |
79 | bool | 80 | bool |
81 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | ||
80 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX | 82 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX |
81 | help | 83 | help |
82 | This adds board specific devices that can be found on Eukrea's | 84 | This adds board specific devices that can be found on Eukrea's |
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c index e42bd2eb034e..49d644842379 100644 --- a/arch/arm/mach-mx5/board-mx51_3ds.c +++ b/arch/arm/mach-mx5/board-mx51_3ds.c | |||
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/input/matrix_keypad.h> | ||
16 | #include <linux/spi/spi.h> | 15 | #include <linux/spi/spi.h> |
17 | 16 | ||
18 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
@@ -120,14 +119,14 @@ static int mx51_3ds_board_keymap[] = { | |||
120 | KEY(3, 5, KEY_BACK) | 119 | KEY(3, 5, KEY_BACK) |
121 | }; | 120 | }; |
122 | 121 | ||
123 | static struct matrix_keymap_data mx51_3ds_map_data = { | 122 | static const struct matrix_keymap_data mx51_3ds_map_data __initconst = { |
124 | .keymap = mx51_3ds_board_keymap, | 123 | .keymap = mx51_3ds_board_keymap, |
125 | .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap), | 124 | .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap), |
126 | }; | 125 | }; |
127 | 126 | ||
128 | static void mxc_init_keypad(void) | 127 | static void mxc_init_keypad(void) |
129 | { | 128 | { |
130 | mxc_register_device(&mxc_keypad_device, &mx51_3ds_map_data); | 129 | imx51_add_imx_keypad(&mx51_3ds_map_data); |
131 | } | 130 | } |
132 | #else | 131 | #else |
133 | static inline void mxc_init_keypad(void) | 132 | static inline void mxc_init_keypad(void) |
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c index 8f142294e10e..f1f45b63f455 100644 --- a/arch/arm/mach-mx5/clock-mx51-mx53.c +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c | |||
@@ -1295,7 +1295,7 @@ static struct clk_lookup mx51_lookups[] = { | |||
1295 | _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk) | 1295 | _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk) |
1296 | _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) | 1296 | _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) |
1297 | _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) | 1297 | _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) |
1298 | _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk) | 1298 | _REGISTER_CLOCK("imx-keypad", NULL, kpp_clk) |
1299 | _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk) | 1299 | _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk) |
1300 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) | 1300 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) |
1301 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) | 1301 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) |
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index 39183ee56dd6..531f4544dc95 100644 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h | |||
@@ -51,3 +51,7 @@ extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst; | |||
51 | extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst; | 51 | extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst; |
52 | #define imx51_add_mxc_pwm(id, pdata) \ | 52 | #define imx51_add_mxc_pwm(id, pdata) \ |
53 | imx_add_mxc_pwm(&imx51_mxc_pwm_data[id], pdata) | 53 | imx_add_mxc_pwm(&imx51_mxc_pwm_data[id], pdata) |
54 | |||
55 | extern const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst; | ||
56 | #define imx51_add_imx_keypad(pdata) \ | ||
57 | imx_add_imx_keypad(&imx51_imx_keypad_data, pdata) | ||
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c index 1bda5cb339dc..153ada53e575 100644 --- a/arch/arm/mach-mx5/devices.c +++ b/arch/arm/mach-mx5/devices.c | |||
@@ -120,25 +120,6 @@ struct platform_device mxc_usbh2_device = { | |||
120 | }, | 120 | }, |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static struct resource mxc_kpp_resources[] = { | ||
124 | { | ||
125 | .start = MX51_MXC_INT_KPP, | ||
126 | .end = MX51_MXC_INT_KPP, | ||
127 | .flags = IORESOURCE_IRQ, | ||
128 | } , { | ||
129 | .start = MX51_KPP_BASE_ADDR, | ||
130 | .end = MX51_KPP_BASE_ADDR + 0x8 - 1, | ||
131 | .flags = IORESOURCE_MEM, | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | struct platform_device mxc_keypad_device = { | ||
136 | .name = "imx-keypad", | ||
137 | .id = 0, | ||
138 | .num_resources = ARRAY_SIZE(mxc_kpp_resources), | ||
139 | .resource = mxc_kpp_resources, | ||
140 | }; | ||
141 | |||
142 | static struct mxc_gpio_port mxc_gpio_ports[] = { | 123 | static struct mxc_gpio_port mxc_gpio_ports[] = { |
143 | { | 124 | { |
144 | .chip.label = "gpio-0", | 125 | .chip.label = "gpio-0", |
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h index 16891aa3573c..55a5129bc29f 100644 --- a/arch/arm/mach-mx5/devices.h +++ b/arch/arm/mach-mx5/devices.h | |||
@@ -3,4 +3,3 @@ extern struct platform_device mxc_usbh1_device; | |||
3 | extern struct platform_device mxc_usbh2_device; | 3 | extern struct platform_device mxc_usbh2_device; |
4 | extern struct platform_device mxc_usbdr_udc_device; | 4 | extern struct platform_device mxc_usbdr_udc_device; |
5 | extern struct platform_device mxc_hsi2c_device; | 5 | extern struct platform_device mxc_hsi2c_device; |
6 | extern struct platform_device mxc_keypad_device; | ||
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c index c96d018ff8a2..e83ffadb65f8 100644 --- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/fsl_devices.h> | 21 | #include <linux/fsl_devices.h> |
22 | #include <linux/i2c/tsc2007.h> | 22 | #include <linux/i2c/tsc2007.h> |
23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
24 | #include <linux/input/matrix_keypad.h> | ||
25 | 24 | ||
26 | #include <mach/common.h> | 25 | #include <mach/common.h> |
27 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
@@ -157,7 +156,7 @@ static int mbimx51_keymap[] = { | |||
157 | KEY(3, 3, KEY_ENTER), | 156 | KEY(3, 3, KEY_ENTER), |
158 | }; | 157 | }; |
159 | 158 | ||
160 | static struct matrix_keymap_data mbimx51_map_data = { | 159 | static const struct matrix_keymap_data mbimx51_map_data __initconst = { |
161 | .keymap = mbimx51_keymap, | 160 | .keymap = mbimx51_keymap, |
162 | .keymap_size = ARRAY_SIZE(mbimx51_keymap), | 161 | .keymap_size = ARRAY_SIZE(mbimx51_keymap), |
163 | }; | 162 | }; |
@@ -209,7 +208,7 @@ void __init eukrea_mbimx51_baseboard_init(void) | |||
209 | 208 | ||
210 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 209 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
211 | 210 | ||
212 | mxc_register_device(&mxc_keypad_device, &mbimx51_map_data); | 211 | imx51_add_imx_keypad(&mbimx51_map_data); |
213 | 212 | ||
214 | gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq"); | 213 | gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq"); |
215 | gpio_direction_input(MBIMX51_TSC2007_GPIO); | 214 | gpio_direction_input(MBIMX51_TSC2007_GPIO); |