aboutsummaryrefslogtreecommitdiffstats
path: root/include/pcmcia
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-08-04 14:05:07 +0200
committerMichal Marek <mmarek@suse.cz>2010-08-04 14:05:07 +0200
commit7a996d3ab150bb0e1b71fa182f70199a703efdd1 (patch)
tree96a36947d90c9b96580899abd38cb3b70cd9d40b /include/pcmcia
parent7cf3d73b4360e91b14326632ab1aeda4cb26308d (diff)
parent9fe6206f400646a2322096b56c59891d530e8d51 (diff)
downloadkernel_samsung_smdk4412-7a996d3ab150bb0e1b71fa182f70199a703efdd1.zip
kernel_samsung_smdk4412-7a996d3ab150bb0e1b71fa182f70199a703efdd1.tar.gz
kernel_samsung_smdk4412-7a996d3ab150bb0e1b71fa182f70199a703efdd1.tar.bz2
Merge commit 'v2.6.35' into kbuild/kconfig
Conflicts: scripts/kconfig/Makefile
Diffstat (limited to 'include/pcmcia')
-rw-r--r--include/pcmcia/cs.h19
-rw-r--r--include/pcmcia/device_id.h5
-rw-r--r--include/pcmcia/ds.h38
-rw-r--r--include/pcmcia/mem_op.h116
-rw-r--r--include/pcmcia/ss.h57
5 files changed, 54 insertions, 181 deletions
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 75fa353..57d8d03 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -85,6 +85,7 @@ typedef struct config_req_t {
#define CONF_ENABLE_IRQ 0x01
#define CONF_ENABLE_DMA 0x02
#define CONF_ENABLE_SPKR 0x04
+#define CONF_ENABLE_PULSE_IRQ 0x08
#define CONF_VALID_CLIENT 0x100
/* IntType field */
@@ -113,25 +114,7 @@ typedef struct io_req_t {
#define IO_DATA_PATH_WIDTH_16 0x08
#define IO_DATA_PATH_WIDTH_AUTO 0x10
-/* For RequestIRQ and ReleaseIRQ */
-typedef struct irq_req_t {
- u_int Attributes;
- u_int AssignedIRQ;
- irq_handler_t Handler;
-} irq_req_t;
-
-/* Attributes for RequestIRQ and ReleaseIRQ */
-#define IRQ_TYPE 0x03
-#define IRQ_TYPE_EXCLUSIVE 0x00
-#define IRQ_TYPE_TIME 0x01
-#define IRQ_TYPE_DYNAMIC_SHARING 0x02
-#define IRQ_FORCED_PULSE 0x04
-#define IRQ_FIRST_SHARED 0x08 /* unused */
-#define IRQ_HANDLE_PRESENT 0x10 /* unused */
-#define IRQ_PULSE_ALLOCATED 0x100
-
/* Bits in IRQInfo1 field */
-#define IRQ_MASK 0x0f
#define IRQ_NMI_ID 0x01
#define IRQ_IOCK_ID 0x02
#define IRQ_BERR_ID 0x04
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h
index c33ea08..63e5b8f 100644
--- a/include/pcmcia/device_id.h
+++ b/include/pcmcia/device_id.h
@@ -34,6 +34,11 @@
.prod_id = { NULL, (v2), NULL, NULL }, \
.prod_id_hash = { 0, (vh2), 0, 0 }, }
+#define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \
+ .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \
+ .prod_id = { NULL, NULL, (v3), NULL }, \
+ .prod_id_hash = { 0, 0, (vh3), 0 }, }
+
#define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \
.match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
PCMCIA_DEV_ID_MATCH_PROD_ID2, \
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index ee14857..c180165 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -26,6 +26,7 @@
#ifdef __KERNEL__
#include <linux/device.h>
#include <pcmcia/ss.h>
+#include <asm/atomic.h>
/*
* PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus
@@ -40,7 +41,7 @@ struct net_device;
* Documentation/pcmcia/driver.txt for details.
*/
struct pcmcia_dynids {
- spinlock_t lock;
+ struct mutex lock;
struct list_head list;
};
@@ -61,15 +62,6 @@ struct pcmcia_driver {
int pcmcia_register_driver(struct pcmcia_driver *driver);
void pcmcia_unregister_driver(struct pcmcia_driver *driver);
-/* Some drivers use dev_node_t to store char or block device information.
- * Don't use this in new drivers, though.
- */
-typedef struct dev_node_t {
- char dev_name[DEV_NAME_LEN];
- u_short major, minor;
- struct dev_node_t *next;
-} dev_node_t;
-
struct pcmcia_device {
/* the socket and the device_no [for multifunction devices]
uniquely define a pcmcia_device */
@@ -87,17 +79,16 @@ struct pcmcia_device {
struct list_head socket_device_list;
/* deprecated, will be cleaned up soon */
- dev_node_t *dev_node;
u_int open;
io_req_t io;
- irq_req_t irq;
config_req_t conf;
window_handle_t win;
- /* Is the device suspended, or in the process of
- * being removed? */
+ /* device setup */
+ unsigned int irq;
+
+ /* Is the device suspended? */
u16 suspended:1;
- u16 _removed:1;
/* Flags whether io, irq, win configurations were
* requested, and whether the configuration is "locked" */
@@ -115,7 +106,7 @@ struct pcmcia_device {
u16 has_card_id:1;
u16 has_func_id:1;
- u16 reserved:3;
+ u16 reserved:4;
u8 func_id;
u16 manf_id;
@@ -192,7 +183,20 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
/* device configuration */
int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
-int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
+
+int __must_check
+__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
+ irq_handler_t handler);
+static inline __must_check __deprecated int
+pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
+ irq_handler_t handler)
+{
+ return __pcmcia_request_exclusive_irq(p_dev, handler);
+}
+
+int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev,
+ irq_handler_t handler);
+
int pcmcia_request_configuration(struct pcmcia_device *p_dev,
config_req_t *req);
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h
deleted file mode 100644
index 0fa06e5..0000000
--- a/include/pcmcia/mem_op.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * mem_op.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * The initial developer of the original code is David A. Hinds
- * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
- * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
- *
- * (C) 1999 David A. Hinds
- */
-
-#ifndef _LINUX_MEM_OP_H
-#define _LINUX_MEM_OP_H
-
-#include <linux/io.h>
-#include <asm/uaccess.h>
-
-/*
- If UNSAFE_MEMCPY is defined, we use the (optimized) system routines
- to copy between a card and kernel memory. These routines do 32-bit
- operations which may not work with all PCMCIA controllers. The
- safe versions defined here will do only 8-bit and 16-bit accesses.
-*/
-
-#ifdef UNSAFE_MEMCPY
-
-#define copy_from_pc memcpy_fromio
-#define copy_to_pc memcpy_toio
-
-static inline void copy_pc_to_user(void *to, const void *from, size_t n)
-{
- size_t odd = (n & 3);
- n -= odd;
- while (n) {
- put_user(__raw_readl(from), (int *)to);
- (char *)from += 4; (char *)to += 4; n -= 4;
- }
- while (odd--)
- put_user(readb((char *)from++), (char *)to++);
-}
-
-static inline void copy_user_to_pc(void *to, const void *from, size_t n)
-{
- int l;
- char c;
- size_t odd = (n & 3);
- n -= odd;
- while (n) {
- get_user(l, (int *)from);
- __raw_writel(l, to);
- (char *)to += 4; (char *)from += 4; n -= 4;
- }
- while (odd--) {
- get_user(c, (char *)from++);
- writeb(c, (char *)to++);
- }
-}
-
-#else /* UNSAFE_MEMCPY */
-
-static inline void copy_from_pc(void *to, void __iomem *from, size_t n)
-{
- __u16 *t = to;
- __u16 __iomem *f = from;
- size_t odd = (n & 1);
- for (n >>= 1; n; n--)
- *t++ = __raw_readw(f++);
- if (odd)
- *(__u8 *)t = readb(f);
-}
-
-static inline void copy_to_pc(void __iomem *to, const void *from, size_t n)
-{
- __u16 __iomem *t = to;
- const __u16 *f = from;
- size_t odd = (n & 1);
- for (n >>= 1; n ; n--)
- __raw_writew(*f++, t++);
- if (odd)
- writeb(*(__u8 *)f, t);
-}
-
-static inline void copy_pc_to_user(void __user *to, void __iomem *from, size_t n)
-{
- __u16 __user *t = to;
- __u16 __iomem *f = from;
- size_t odd = (n & 1);
- for (n >>= 1; n ; n--)
- put_user(__raw_readw(f++), t++);
- if (odd)
- put_user(readb(f), (char __user *)t);
-}
-
-static inline void copy_user_to_pc(void __iomem *to, void __user *from, size_t n)
-{
- __u16 __user *f = from;
- __u16 __iomem *t = to;
- short s;
- char c;
- size_t odd = (n & 1);
- for (n >>= 1; n; n--) {
- get_user(s, f++);
- __raw_writew(s, t++);
- }
- if (odd) {
- get_user(c, (char __user *)f);
- writeb(c, t);
- }
-}
-
-#endif /* UNSAFE_MEMCPY */
-
-#endif /* _LINUX_MEM_OP_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index cbfba88..764281b 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -134,17 +134,13 @@ struct pccard_operations {
struct pcmcia_socket {
struct module *owner;
- spinlock_t lock;
socket_state_t socket;
u_int state;
+ u_int suspended_state; /* state before suspend */
u_short functions;
u_short lock_count;
pccard_mem_map cis_mem;
void __iomem *cis_virt;
- struct {
- u_int AssignedIRQ;
- u_int Config;
- } irq;
io_window_t io[MAX_IO_WIN];
pccard_mem_map win[MAX_WIN];
struct list_head cis_cache;
@@ -200,9 +196,14 @@ struct pcmcia_socket {
struct task_struct *thread;
struct completion thread_done;
unsigned int thread_events;
- /* protects socket h/w state */
+ unsigned int sysfs_events;
+
+ /* For the non-trivial interaction between these locks,
+ * see Documentation/pcmcia/locking.txt */
struct mutex skt_mutex;
- /* protects thread_events */
+ struct mutex ops_mutex;
+
+ /* protects thread_events and sysfs_events */
spinlock_t thread_lock;
/* pcmcia (16-bit) */
@@ -219,23 +220,19 @@ struct pcmcia_socket {
/* 16-bit state: */
struct {
- /* PCMCIA card is present in socket */
- u8 present:1;
/* "master" ioctl is used */
u8 busy:1;
- /* pcmcia module is being unloaded */
- u8 dead:1;
- /* a multifunction-device add event is pending */
- u8 device_add_pending:1;
- /* the pending event adds a mfc (1) or pfc (0) */
- u8 mfc_pfc:1;
-
- u8 reserved:3;
+ /* the PCMCIA card consists of two pseudo devices */
+ u8 has_pfc:1;
+
+ u8 reserved:6;
} pcmcia_state;
+ /* non-zero if PCMCIA card is present */
+ atomic_t present;
- /* for adding further pseudo-multifunction devices */
- struct work_struct device_add;
+ /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */
+ unsigned int pcmcia_irq;
#ifdef CONFIG_PCMCIA_IOCTL
struct user_info_t *user;
@@ -243,12 +240,6 @@ struct pcmcia_socket {
#endif /* CONFIG_PCMCIA_IOCTL */
#endif /* CONFIG_PCMCIA */
- /* cardbus (32-bit) */
-#ifdef CONFIG_CARDBUS
- struct resource *cb_cis_res;
- void __iomem *cb_cis_virt;
-#endif /* CONFIG_CARDBUS */
-
/* socket device */
struct device dev;
/* data internal to the socket driver */
@@ -263,19 +254,25 @@ struct pcmcia_socket {
* - pccard_static_ops iomem and ioport areas are assigned statically
* - pccard_iodyn_ops iomem areas is assigned statically, ioport
* areas dynamically
+ * If this option is selected, use
+ * "select PCCARD_IODYN" in Kconfig.
* - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically.
* If this option is selected, use
* "select PCCARD_NONSTATIC" in Kconfig.
+ *
*/
extern struct pccard_resource_ops pccard_static_ops;
+#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
extern struct pccard_resource_ops pccard_iodyn_ops;
extern struct pccard_resource_ops pccard_nonstatic_ops;
+#else
+/* If PCMCIA is not used, but only CARDBUS, these functions are not used
+ * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module
+ */
+#define pccard_iodyn_ops pccard_static_ops
+#define pccard_nonstatic_ops pccard_static_ops
+#endif
-/* socket drivers are expected to use these callbacks in their .drv struct */
-extern int pcmcia_socket_dev_suspend(struct device *dev);
-extern void pcmcia_socket_dev_early_resume(struct device *dev);
-extern void pcmcia_socket_dev_late_resume(struct device *dev);
-extern int pcmcia_socket_dev_resume(struct device *dev);
/* socket drivers use this callback in their IRQ handler */
extern void pcmcia_parse_events(struct pcmcia_socket *socket,