]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/pcmcia/sa1100_generic.c
Merge refs/heads/ieee80211-wifi from master.kernel.org:/pub/scm/linux/kernel/git...
[mirror_ubuntu-artful-kernel.git] / drivers / pcmcia / sa1100_generic.c
CommitLineData
1da177e4
LT
1/*======================================================================
2
3 Device driver for the PCMCIA control functionality of StrongARM
4 SA-1100 microprocessors.
5
6 The contents of this file are subject to the Mozilla Public
7 License Version 1.1 (the "License"); you may not use this file
8 except in compliance with the License. You may obtain a copy of
9 the License at http://www.mozilla.org/MPL/
10
11 Software distributed under the License is distributed on an "AS
12 IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13 implied. See the License for the specific language governing
14 rights and limitations under the License.
15
16 The initial developer of the original code is John G. Dorsey
17 <john+@cs.cmu.edu>. Portions created by John G. Dorsey are
18 Copyright (C) 1999 John G. Dorsey. All Rights Reserved.
19
20 Alternatively, the contents of this file may be used under the
21 terms of the GNU Public License version 2 (the "GPL"), in which
22 case the provisions of the GPL are applicable instead of the
23 above. If you wish to allow the use of your version of this file
24 only under the terms of the GPL and not to allow others to use
25 your version of this file under the MPL, indicate your decision
26 by deleting the provisions above and replace them with the notice
27 and other provisions required by the GPL. If you do not delete
28 the provisions above, a recipient may use your version of this
29 file under either the MPL or the GPL.
30
31======================================================================*/
32
33#include <linux/module.h>
34#include <linux/init.h>
35#include <linux/config.h>
36
1da177e4
LT
37#include <pcmcia/cs_types.h>
38#include <pcmcia/cs.h>
39#include <pcmcia/ss.h>
40
41#include "sa1100_generic.h"
42
43static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
44#ifdef CONFIG_SA1100_ASSABET
45 pcmcia_assabet_init,
46#endif
47#ifdef CONFIG_SA1100_CERF
48 pcmcia_cerf_init,
49#endif
50#ifdef CONFIG_SA1100_H3600
51 pcmcia_h3600_init,
52#endif
53#ifdef CONFIG_SA1100_SHANNON
54 pcmcia_shannon_init,
55#endif
56#ifdef CONFIG_SA1100_SIMPAD
57 pcmcia_simpad_init,
58#endif
59};
60
61static int sa11x0_drv_pcmcia_probe(struct device *dev)
62{
63 int i, ret = -ENODEV;
64
65 /*
66 * Initialise any "on-board" PCMCIA sockets.
67 */
68 for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) {
69 ret = sa11x0_pcmcia_hw_init[i](dev);
70 if (ret == 0)
71 break;
72 }
73
74 return ret;
75}
76
8bf28030 77static int sa11x0_drv_pcmcia_suspend(struct device *dev, pm_message_t state, u32 level)
1da177e4
LT
78{
79 int ret = 0;
80 if (level == SUSPEND_SAVE_STATE)
81 ret = pcmcia_socket_dev_suspend(dev, state);
82 return ret;
83}
84
85static int sa11x0_drv_pcmcia_resume(struct device *dev, u32 level)
86{
87 int ret = 0;
88 if (level == RESUME_RESTORE_STATE)
89 ret = pcmcia_socket_dev_resume(dev);
90 return ret;
91}
92
93static struct device_driver sa11x0_pcmcia_driver = {
94 .probe = sa11x0_drv_pcmcia_probe,
95 .remove = soc_common_drv_pcmcia_remove,
96 .name = "sa11x0-pcmcia",
97 .bus = &platform_bus_type,
98 .suspend = sa11x0_drv_pcmcia_suspend,
99 .resume = sa11x0_drv_pcmcia_resume,
100};
101
102/* sa11x0_pcmcia_init()
103 * ^^^^^^^^^^^^^^^^^^^^
104 *
105 * This routine performs low-level PCMCIA initialization and then
106 * registers this socket driver with Card Services.
107 *
108 * Returns: 0 on success, -ve error code on failure
109 */
110static int __init sa11x0_pcmcia_init(void)
111{
112 return driver_register(&sa11x0_pcmcia_driver);
113}
114
115/* sa11x0_pcmcia_exit()
116 * ^^^^^^^^^^^^^^^^^^^^
117 * Invokes the low-level kernel service to free IRQs associated with this
118 * socket controller and reset GPIO edge detection.
119 */
120static void __exit sa11x0_pcmcia_exit(void)
121{
122 driver_unregister(&sa11x0_pcmcia_driver);
123}
124
125MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
126MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11x0 Socket Controller");
127MODULE_LICENSE("Dual MPL/GPL");
128
129module_init(sa11x0_pcmcia_init);
130module_exit(sa11x0_pcmcia_exit);