]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/pcmcia/sa1100_generic.c
8139cp: fix checksum broken
[net-next-2.6.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>
5a0e3ad6 35#include <linux/slab.h>
d052d1be 36#include <linux/platform_device.h>
1da177e4 37
1da177e4
LT
38#include <pcmcia/ss.h>
39
77bb86a1
PM
40#include <asm/hardware/scoop.h>
41
1da177e4
LT
42#include "sa1100_generic.h"
43
77bb86a1
PM
44int __init pcmcia_collie_init(struct device *dev);
45
1da177e4
LT
46static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
47#ifdef CONFIG_SA1100_ASSABET
48 pcmcia_assabet_init,
49#endif
50#ifdef CONFIG_SA1100_CERF
51 pcmcia_cerf_init,
52#endif
e7435f86 53#if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600)
1da177e4
LT
54 pcmcia_h3600_init,
55#endif
56#ifdef CONFIG_SA1100_SHANNON
57 pcmcia_shannon_init,
58#endif
59#ifdef CONFIG_SA1100_SIMPAD
60 pcmcia_simpad_init,
61#endif
77bb86a1
PM
62#ifdef CONFIG_SA1100_COLLIE
63 pcmcia_collie_init,
64#endif
1da177e4
LT
65};
66
7a192ec3 67static int sa11x0_drv_pcmcia_probe(struct platform_device *dev)
1da177e4
LT
68{
69 int i, ret = -ENODEV;
70
71 /*
72 * Initialise any "on-board" PCMCIA sockets.
73 */
74 for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) {
7a192ec3 75 ret = sa11x0_pcmcia_hw_init[i](&dev->dev);
1da177e4
LT
76 if (ret == 0)
77 break;
78 }
79
80 return ret;
81}
82
7a192ec3
ML
83static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
84{
be85458e
RKAL
85 struct skt_dev_info *sinfo = platform_get_drvdata(dev);
86 int i;
87
88 platform_set_drvdata(dev, NULL);
89
90 for (i = 0; i < sinfo->nskt; i++)
91 soc_pcmcia_remove_one(&sinfo->skt[i]);
92
93 kfree(sinfo);
94 return 0;
7a192ec3
ML
95}
96
7a192ec3
ML
97static struct platform_driver sa11x0_pcmcia_driver = {
98 .driver = {
99 .name = "sa11x0-pcmcia",
100 .owner = THIS_MODULE,
101 },
1da177e4 102 .probe = sa11x0_drv_pcmcia_probe,
7a192ec3 103 .remove = sa11x0_drv_pcmcia_remove,
1da177e4
LT
104};
105
106/* sa11x0_pcmcia_init()
107 * ^^^^^^^^^^^^^^^^^^^^
108 *
109 * This routine performs low-level PCMCIA initialization and then
110 * registers this socket driver with Card Services.
111 *
112 * Returns: 0 on success, -ve error code on failure
113 */
114static int __init sa11x0_pcmcia_init(void)
115{
7a192ec3 116 return platform_driver_register(&sa11x0_pcmcia_driver);
1da177e4
LT
117}
118
119/* sa11x0_pcmcia_exit()
120 * ^^^^^^^^^^^^^^^^^^^^
121 * Invokes the low-level kernel service to free IRQs associated with this
122 * socket controller and reset GPIO edge detection.
123 */
124static void __exit sa11x0_pcmcia_exit(void)
125{
7a192ec3 126 platform_driver_unregister(&sa11x0_pcmcia_driver);
1da177e4
LT
127}
128
129MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
130MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11x0 Socket Controller");
131MODULE_LICENSE("Dual MPL/GPL");
132
f36598ae 133fs_initcall(sa11x0_pcmcia_init);
1da177e4 134module_exit(sa11x0_pcmcia_exit);