@@ -21,6 +21,9 @@ if PCCARD
config PCMCIA
tristate "16-bit PCMCIA support"
select CRC32
+ depends on X86_32 || ARCH_PXA || ARCH_SA1100 || ARCH_OMAP1 || \
+ MIPS_ALCHEMY || PPC_PASEMI || COMPILE_TEST
+ depends on CARDBUS=n
default y
help
This option enables support for 16-bit PCMCIA cards. Most older
@@ -51,8 +54,9 @@ config PCMCIA_LOAD_CIS
If unsure, say Y.
config CARDBUS
- bool "32-bit CardBus support"
+ tristate "32-bit CardBus support"
depends on PCI
+ select YENTA
default y
help
CardBus is a bus mastering architecture for PC-cards, which allows
@@ -71,10 +75,9 @@ config PCMCIA_MAX1600
comment "PC-card bridges"
config YENTA
- tristate "CardBus yenta-compatible bridge support"
- depends on PCI
- select CARDBUS if !EXPERT
- select PCCARD_NONSTATIC if PCMCIA != n
+ tristate "CardBus yenta-compatible bridge support" if EXPERT
+ depends on PCI && CARDBUS
+ default y
help
This option enables support for CardBus host bridges. Virtually
all modern PCMCIA bridges are CardBus compatible. A "bridge" is
@@ -3,17 +3,17 @@
# Makefile for the kernel pcmcia subsystem (c/o David Hinds)
#
-pcmcia_core-y += cs.o socket_sysfs.o
-pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o
-obj-$(CONFIG_PCCARD) += pcmcia_core.o
+cardbus_core-y += cardbus.o cs.o socket_sysfs.o rsrc_mgr.o
+obj-$(CONFIG_CARDBUS) += cardbus_core.o
-pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o
+pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o \
+ cs.o socket_sysfs.o
obj-$(CONFIG_PCMCIA) += pcmcia.o
pcmcia_rsrc-y += rsrc_mgr.o
pcmcia_rsrc-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o
pcmcia_rsrc-$(CONFIG_PCCARD_IODYN) += rsrc_iodyn.o
-obj-$(CONFIG_PCCARD) += pcmcia_rsrc.o
+obj-$(CONFIG_PCMCIA) += pcmcia_rsrc.o
# socket drivers
@@ -121,4 +121,5 @@ void cb_free(struct pcmcia_socket *s)
pci_stop_and_remove_bus_device(dev);
pci_unlock_rescan_remove();
+
}
@@ -133,7 +133,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
list_add_tail(&socket->socket_list, &pcmcia_socket_list);
up_write(&pcmcia_socket_list_rwsem);
-#ifndef CONFIG_CARDBUS
+#if !IS_ENABLED(CONFIG_CARDBUS)
/*
* If we do not support Cardbus, ensure that
* the Cardbus socket capability is disabled.
@@ -313,7 +313,7 @@ static void socket_shutdown(struct pcmcia_socket *s)
*/
mutex_unlock(&s->ops_mutex);
-#ifdef CONFIG_CARDBUS
+#if IS_ENABLED(CONFIG_CARDBUS)
cb_free(s);
#endif
@@ -428,7 +428,7 @@ static int socket_insert(struct pcmcia_socket *skt)
(skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
skt->sock);
-#ifdef CONFIG_CARDBUS
+#if IS_ENABLED(CONFIG_CARDBUS)
if (skt->state & SOCKET_CARDBUS) {
cb_alloc(skt);
skt->state |= SOCKET_CARDBUS_CONFIG;
@@ -522,7 +522,7 @@ static int socket_late_resume(struct pcmcia_socket *skt)
static int socket_complete_resume(struct pcmcia_socket *skt)
{
int ret = 0;
-#ifdef CONFIG_CARDBUS
+#if IS_ENABLED(CONFIG_CARDBUS)
if (skt->state & SOCKET_CARDBUS) {
/* We can't be sure the CardBus card is the same
* as the one previously inserted. Therefore, remove
@@ -822,7 +822,7 @@ static int pcmcia_socket_uevent(const struct device *dev,
}
-static struct completion pcmcia_unload;
+static DECLARE_COMPLETION(pcmcia_unload);
static void pcmcia_release_socket_class(struct class *data)
{
@@ -901,18 +901,3 @@ struct class pcmcia_socket_class = {
EXPORT_SYMBOL(pcmcia_socket_class);
-static int __init init_pcmcia_cs(void)
-{
- init_completion(&pcmcia_unload);
- return class_register(&pcmcia_socket_class);
-}
-
-static void __exit exit_pcmcia_cs(void)
-{
- class_unregister(&pcmcia_socket_class);
- wait_for_completion(&pcmcia_unload);
-}
-
-subsys_initcall(init_pcmcia_cs);
-module_exit(exit_pcmcia_cs);
-
@@ -18,6 +18,7 @@
#define _LINUX_CS_INTERNAL_H
#include <linux/kref.h>
+#include <pcmcia/cistpl.h>
/* Flags in client state */
#define CLIENT_WIN_REQ(i) (0x1<<(i))
@@ -1419,9 +1419,16 @@ static int __init init_pcmcia_bus(void)
{
int ret;
+ ret = class_register(&pcmcia_socket_class);
+ if (ret < 0) {
+ printk(KERN_WARNING "pcmcia: class register error %d\n", ret);
+ return ret;
+ }
+
ret = bus_register(&pcmcia_bus_type);
if (ret < 0) {
printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret);
+ class_unregister(&pcmcia_socket_class);
return ret;
}
ret = class_interface_register(&pcmcia_bus_interface);
@@ -1429,20 +1436,21 @@ static int __init init_pcmcia_bus(void)
printk(KERN_WARNING
"pcmcia: class_interface_register error: %d\n", ret);
bus_unregister(&pcmcia_bus_type);
+ class_unregister(&pcmcia_socket_class);
return ret;
}
return 0;
}
-fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that
- * pcmcia_socket_class is already registered */
-
+subsys_initcall(init_pcmcia_bus);
static void __exit exit_pcmcia_bus(void)
{
class_interface_unregister(&pcmcia_bus_interface);
bus_unregister(&pcmcia_bus_type);
+
+ class_unregister(&pcmcia_socket_class);
}
module_exit(exit_pcmcia_bus);
@@ -123,7 +123,7 @@
#define RL5C4XX_MISC3 0x00A2 /* 16 bit */
#define RL5C47X_MISC3_CB_CLKRUN_DIS BIT(1)
-#ifdef __YENTA_H
+#if IS_ENABLED(CONFIG_CARDBUS)
#define rl_misc(socket) ((socket)->private[0])
#define rl_ctl(socket) ((socket)->private[1])
@@ -24,6 +24,7 @@
#include "yenta_socket.h"
#include "i82365.h"
+#include "cs_internal.h"
static bool disable_clkrun;
module_param(disable_clkrun, bool, 0444);
@@ -228,17 +229,8 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)
val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT;
val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0;
} else if (state & CB_16BITCARD) {
- u8 status = exca_readb(socket, I365_STATUS);
- val |= ((status & I365_CS_DETECT) == I365_CS_DETECT) ? SS_DETECT : 0;
- if (exca_readb(socket, I365_INTCTL) & I365_PC_IOCARD) {
- val |= (status & I365_CS_STSCHG) ? 0 : SS_STSCHG;
- } else {
- val |= (status & I365_CS_BVD1) ? 0 : SS_BATDEAD;
- val |= (status & I365_CS_BVD2) ? 0 : SS_BATWARN;
- }
- val |= (status & I365_CS_WRPROT) ? SS_WRPROT : 0;
- val |= (status & I365_CS_READY) ? SS_READY : 0;
- val |= (status & I365_CS_POWERON) ? SS_POWERON : 0;
+ dev_warn_once(&socket->dev->dev,
+ "16-bit PCMCIA cards are no longer supported\n");
}
*value = val;
@@ -1176,7 +1168,7 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)
/* prepare pcmcia_socket */
socket->socket.ops = ¥ta_socket_operations;
- socket->socket.resource_ops = &pccard_nonstatic_ops;
+ socket->socket.resource_ops = &pccard_static_ops;
socket->socket.dev.parent = &dev->dev;
socket->socket.driver_data = socket;
socket->socket.owner = THIS_MODULE;
@@ -1450,6 +1442,27 @@ static struct pci_driver yenta_cardbus_driver = {
.driver.pm = YENTA_PM_OPS,
};
-module_pci_driver(yenta_cardbus_driver);
+static int __init yenta_init(void)
+{
+ int ret;
+
+ ret = class_register(&pcmcia_socket_class);
+ if (ret)
+ return ret;
+
+ ret = pci_register_driver(¥ta_cardbus_driver);
+ if (ret)
+ class_unregister(&pcmcia_socket_class);
+
+ return ret;
+}
+module_init(yenta_init);
+
+static void __exit yenta_exit(void)
+{
+ pci_unregister_driver(¥ta_cardbus_driver);
+ class_unregister(&pcmcia_socket_class);
+}
+module_exit(yenta_exit);
MODULE_LICENSE("GPL");
@@ -16,7 +16,7 @@
#include <linux/sched.h> /* task_struct, completion */
#include <linux/mutex.h>
-#ifdef CONFIG_CARDBUS
+#if IS_ENABLED(CONFIG_CARDBUS)
#include <linux/pci.h>
#endif
@@ -176,7 +176,7 @@ struct pcmcia_socket {
int (*power_hook)(struct pcmcia_socket *sock, int operation);
/* allows tuning the CB bridge before loading driver for the CB card */
-#ifdef CONFIG_CARDBUS
+#if IS_ENABLED(CONFIG_CARDBUS)
void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus);
#endif