diff options
author | Marek VaĊĦut <marek.vasut@gmail.com> | 2008-07-07 12:28:59 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-10 07:15:32 -0400 |
commit | 359784084f3da86e2c7621fd9266e04b50287834 (patch) | |
tree | 371c9f83d2a2765043580aa83002036eaf09da5d | |
parent | b5e4ad57eeffef0ac274413f83be4ef903719ea4 (diff) |
[ARM] 5154/1: PalmTX PCMCIA
This patch adds PCMCIA support for PalmTX handheld computer.
There is one chip hard-soldered to slot0, another slot is
not in use and not accessible.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-pxa/palmtx.c | 12 | ||||
-rw-r--r-- | drivers/pcmcia/Kconfig | 3 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_palmtx.c | 118 |
4 files changed, 133 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index ae8973279c20..0ca2f17402b7 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -69,6 +69,18 @@ static unsigned long palmtx_pin_config[] __initdata = { | |||
69 | 69 | ||
70 | /* USB */ | 70 | /* USB */ |
71 | GPIO13_GPIO, | 71 | GPIO13_GPIO, |
72 | |||
73 | /* PCMCIA */ | ||
74 | GPIO48_nPOE, | ||
75 | GPIO49_nPWE, | ||
76 | GPIO50_nPIOR, | ||
77 | GPIO51_nPIOW, | ||
78 | GPIO85_nPCE_1, | ||
79 | GPIO54_nPCE_2, | ||
80 | GPIO79_PSKTSEL, | ||
81 | GPIO55_nPREG, | ||
82 | GPIO56_nPWAIT, | ||
83 | GPIO57_nIOIS16, | ||
72 | }; | 84 | }; |
73 | 85 | ||
74 | /****************************************************************************** | 86 | /****************************************************************************** |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 1b0eb5aaf650..86dd324c8ce0 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -219,7 +219,8 @@ config PCMCIA_SA1111 | |||
219 | config PCMCIA_PXA2XX | 219 | config PCMCIA_PXA2XX |
220 | tristate "PXA2xx support" | 220 | tristate "PXA2xx support" |
221 | depends on ARM && ARCH_PXA && PCMCIA | 221 | depends on ARM && ARCH_PXA && PCMCIA |
222 | depends on ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL || MACH_ARMCORE | 222 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ |
223 | || MACH_ARMCORE || ARCH_PXA_PALM) | ||
223 | help | 224 | help |
224 | Say Y here to include support for the PXA2xx PCMCIA controller | 225 | Say Y here to include support for the PXA2xx PCMCIA controller |
225 | 226 | ||
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 6f6478ba7174..8e6dd22e9300 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -71,4 +71,5 @@ pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o | |||
71 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o | 71 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o |
72 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o | 72 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o |
73 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o | 73 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o |
74 | pxa2xx_cs-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o | ||
74 | 75 | ||
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c new file mode 100644 index 000000000000..4abde190c1f5 --- /dev/null +++ b/drivers/pcmcia/pxa2xx_palmtx.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * linux/drivers/pcmcia/pxa2xx_palmtx.c | ||
3 | * | ||
4 | * Driver for Palm T|X PCMCIA | ||
5 | * | ||
6 | * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <asm/mach-types.h> | ||
18 | |||
19 | #include <asm/arch/gpio.h> | ||
20 | #include <asm/arch/palmtx.h> | ||
21 | |||
22 | #include "soc_common.h" | ||
23 | |||
24 | static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
25 | { | ||
26 | skt->irq = IRQ_GPIO(GPIO_NR_PALMTX_PCMCIA_READY); | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | ||
35 | struct pcmcia_state *state) | ||
36 | { | ||
37 | state->detect = 1; /* always inserted */ | ||
38 | state->ready = !!gpio_get_value(GPIO_NR_PALMTX_PCMCIA_READY); | ||
39 | state->bvd1 = 1; | ||
40 | state->bvd2 = 1; | ||
41 | state->wrprot = 0; | ||
42 | state->vs_3v = 1; | ||
43 | state->vs_Xv = 0; | ||
44 | } | ||
45 | |||
46 | static int | ||
47 | palmtx_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
48 | const socket_state_t *state) | ||
49 | { | ||
50 | gpio_set_value(GPIO_NR_PALMTX_PCMCIA_POWER1, 1); | ||
51 | gpio_set_value(GPIO_NR_PALMTX_PCMCIA_POWER2, 1); | ||
52 | gpio_set_value(GPIO_NR_PALMTX_PCMCIA_RESET, | ||
53 | !!(state->flags & SS_RESET)); | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static void palmtx_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
59 | { | ||
60 | } | ||
61 | |||
62 | static void palmtx_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | static struct pcmcia_low_level palmtx_pcmcia_ops = { | ||
67 | .owner = THIS_MODULE, | ||
68 | |||
69 | .first = 0, | ||
70 | .nr = 1, | ||
71 | |||
72 | .hw_init = palmtx_pcmcia_hw_init, | ||
73 | .hw_shutdown = palmtx_pcmcia_hw_shutdown, | ||
74 | |||
75 | .socket_state = palmtx_pcmcia_socket_state, | ||
76 | .configure_socket = palmtx_pcmcia_configure_socket, | ||
77 | |||
78 | .socket_init = palmtx_pcmcia_socket_init, | ||
79 | .socket_suspend = palmtx_pcmcia_socket_suspend, | ||
80 | }; | ||
81 | |||
82 | static struct platform_device *palmtx_pcmcia_device; | ||
83 | |||
84 | static int __init palmtx_pcmcia_init(void) | ||
85 | { | ||
86 | int ret; | ||
87 | |||
88 | if (!machine_is_palmtx()) | ||
89 | return -ENODEV; | ||
90 | |||
91 | palmtx_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | ||
92 | if (!palmtx_pcmcia_device) | ||
93 | return -ENOMEM; | ||
94 | |||
95 | ret = platform_device_add_data(palmtx_pcmcia_device, &palmtx_pcmcia_ops, | ||
96 | sizeof(palmtx_pcmcia_ops)); | ||
97 | |||
98 | if (!ret) | ||
99 | ret = platform_device_add(palmtx_pcmcia_device); | ||
100 | |||
101 | if (ret) | ||
102 | platform_device_put(palmtx_pcmcia_device); | ||
103 | |||
104 | return ret; | ||
105 | } | ||
106 | |||
107 | static void __exit palmtx_pcmcia_exit(void) | ||
108 | { | ||
109 | platform_device_unregister(palmtx_pcmcia_device); | ||
110 | } | ||
111 | |||
112 | fs_initcall(palmtx_pcmcia_init); | ||
113 | module_exit(palmtx_pcmcia_exit); | ||
114 | |||
115 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | ||
116 | MODULE_DESCRIPTION("PCMCIA support for Palm T|X"); | ||
117 | MODULE_ALIAS("platform:pxa2xx-pcmcia"); | ||
118 | MODULE_LICENSE("GPL"); | ||