2005-04-17 05:20:36 +07:00
|
|
|
/*======================================================================
|
|
|
|
|
|
|
|
Device driver for the PCMCIA control functionality of StrongARM
|
|
|
|
SA-1100 microprocessors.
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public
|
|
|
|
License Version 1.1 (the "License"); you may not use this file
|
|
|
|
except in compliance with the License. You may obtain a copy of
|
|
|
|
the License at http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS
|
|
|
|
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
implied. See the License for the specific language governing
|
|
|
|
rights and limitations under the License.
|
|
|
|
|
|
|
|
The initial developer of the original code is John G. Dorsey
|
|
|
|
<john+@cs.cmu.edu>. Portions created by John G. Dorsey are
|
|
|
|
Copyright (C) 1999 John G. Dorsey. All Rights Reserved.
|
|
|
|
|
|
|
|
Alternatively, the contents of this file may be used under the
|
|
|
|
terms of the GNU Public License version 2 (the "GPL"), in which
|
|
|
|
case the provisions of the GPL are applicable instead of the
|
|
|
|
above. If you wish to allow the use of your version of this file
|
|
|
|
only under the terms of the GPL and not to allow others to use
|
|
|
|
your version of this file under the MPL, indicate your decision
|
|
|
|
by deleting the provisions above and replace them with the notice
|
|
|
|
and other provisions required by the GPL. If you do not delete
|
|
|
|
the provisions above, a recipient may use your version of this
|
|
|
|
file under either the MPL or the GPL.
|
|
|
|
|
|
|
|
======================================================================*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
2005-10-30 01:07:23 +07:00
|
|
|
#include <linux/platform_device.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include <pcmcia/cs_types.h>
|
|
|
|
#include <pcmcia/cs.h>
|
|
|
|
#include <pcmcia/ss.h>
|
|
|
|
|
2005-10-31 06:39:02 +07:00
|
|
|
#include <asm/hardware/scoop.h>
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#include "sa1100_generic.h"
|
|
|
|
|
2005-10-31 06:39:02 +07:00
|
|
|
int __init pcmcia_collie_init(struct device *dev);
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
|
|
|
|
#ifdef CONFIG_SA1100_ASSABET
|
|
|
|
pcmcia_assabet_init,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SA1100_CERF
|
|
|
|
pcmcia_cerf_init,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SA1100_H3600
|
|
|
|
pcmcia_h3600_init,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SA1100_SHANNON
|
|
|
|
pcmcia_shannon_init,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SA1100_SIMPAD
|
|
|
|
pcmcia_simpad_init,
|
|
|
|
#endif
|
2005-10-31 06:39:02 +07:00
|
|
|
#ifdef CONFIG_SA1100_COLLIE
|
|
|
|
pcmcia_collie_init,
|
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2009-02-06 22:40:12 +07:00
|
|
|
static int sa11x0_drv_pcmcia_probe(struct platform_device *dev)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
int i, ret = -ENODEV;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise any "on-board" PCMCIA sockets.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) {
|
2009-02-06 22:40:12 +07:00
|
|
|
ret = sa11x0_pcmcia_hw_init[i](&dev->dev);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (ret == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-02-06 22:40:12 +07:00
|
|
|
static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
|
|
|
|
{
|
2009-03-27 05:21:18 +07:00
|
|
|
struct skt_dev_info *sinfo = platform_get_drvdata(dev);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
platform_set_drvdata(dev, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < sinfo->nskt; i++)
|
|
|
|
soc_pcmcia_remove_one(&sinfo->skt[i]);
|
|
|
|
|
|
|
|
kfree(sinfo);
|
|
|
|
return 0;
|
2009-02-06 22:40:12 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev,
|
|
|
|
pm_message_t state)
|
|
|
|
{
|
2009-09-29 05:10:41 +07:00
|
|
|
return pcmcia_socket_dev_suspend(&dev->dev);
|
2009-02-06 22:40:12 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
return pcmcia_socket_dev_resume(&dev->dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver sa11x0_pcmcia_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "sa11x0-pcmcia",
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
},
|
2005-04-17 05:20:36 +07:00
|
|
|
.probe = sa11x0_drv_pcmcia_probe,
|
2009-02-06 22:40:12 +07:00
|
|
|
.remove = sa11x0_drv_pcmcia_remove,
|
|
|
|
.suspend = sa11x0_drv_pcmcia_suspend,
|
|
|
|
.resume = sa11x0_drv_pcmcia_resume,
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* sa11x0_pcmcia_init()
|
|
|
|
* ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
*
|
|
|
|
* This routine performs low-level PCMCIA initialization and then
|
|
|
|
* registers this socket driver with Card Services.
|
|
|
|
*
|
|
|
|
* Returns: 0 on success, -ve error code on failure
|
|
|
|
*/
|
|
|
|
static int __init sa11x0_pcmcia_init(void)
|
|
|
|
{
|
2009-02-06 22:40:12 +07:00
|
|
|
return platform_driver_register(&sa11x0_pcmcia_driver);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sa11x0_pcmcia_exit()
|
|
|
|
* ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
* Invokes the low-level kernel service to free IRQs associated with this
|
|
|
|
* socket controller and reset GPIO edge detection.
|
|
|
|
*/
|
|
|
|
static void __exit sa11x0_pcmcia_exit(void)
|
|
|
|
{
|
2009-02-06 22:40:12 +07:00
|
|
|
platform_driver_unregister(&sa11x0_pcmcia_driver);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
|
|
|
|
MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11x0 Socket Controller");
|
|
|
|
MODULE_LICENSE("Dual MPL/GPL");
|
|
|
|
|
2005-09-04 01:39:25 +07:00
|
|
|
fs_initcall(sa11x0_pcmcia_init);
|
2005-04-17 05:20:36 +07:00
|
|
|
module_exit(sa11x0_pcmcia_exit);
|