aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-09-24 16:22:33 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-24 16:22:33 -0400
commitbaea7b946f00a291b166ccae7fcfed6c01530cc6 (patch)
tree4aa275fbdbec9c7b9b4629e8bee2bbecd3c6a6af /drivers/pcmcia
parentae19ffbadc1b2100285a5b5b3d0a4e0a11390904 (diff)
parent94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff)
Merge branch 'origin' into for-linus
Conflicts: MAINTAINERS
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c36
-rw-r--r--drivers/pcmcia/sa1100_jornada720.c156
-rw-r--r--drivers/pcmcia/yenta_socket.c2
3 files changed, 106 insertions, 88 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 7b424e0b0449..32c44040c1e8 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -27,6 +27,7 @@
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/seq_file.h>
30#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
31#include <linux/workqueue.h> 32#include <linux/workqueue.h>
32 33
@@ -105,37 +106,40 @@ static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info)
105#ifdef CONFIG_PROC_FS 106#ifdef CONFIG_PROC_FS
106static struct proc_dir_entry *proc_pccard = NULL; 107static struct proc_dir_entry *proc_pccard = NULL;
107 108
108static int proc_read_drivers_callback(struct device_driver *driver, void *d) 109static int proc_read_drivers_callback(struct device_driver *driver, void *_m)
109{ 110{
110 char **p = d; 111 struct seq_file *m = _m;
111 struct pcmcia_driver *p_drv = container_of(driver, 112 struct pcmcia_driver *p_drv = container_of(driver,
112 struct pcmcia_driver, drv); 113 struct pcmcia_driver, drv);
113 114
114 *p += sprintf(*p, "%-24.24s 1 %d\n", p_drv->drv.name, 115 seq_printf(m, "%-24.24s 1 %d\n", p_drv->drv.name,
115#ifdef CONFIG_MODULE_UNLOAD 116#ifdef CONFIG_MODULE_UNLOAD
116 (p_drv->owner) ? module_refcount(p_drv->owner) : 1 117 (p_drv->owner) ? module_refcount(p_drv->owner) : 1
117#else 118#else
118 1 119 1
119#endif 120#endif
120 ); 121 );
121 d = (void *) p;
122
123 return 0; 122 return 0;
124} 123}
125 124
126static int proc_read_drivers(char *buf, char **start, off_t pos, 125static int pccard_drivers_proc_show(struct seq_file *m, void *v)
127 int count, int *eof, void *data)
128{ 126{
129 char *p = buf; 127 return bus_for_each_drv(&pcmcia_bus_type, NULL,
130 int rc; 128 m, proc_read_drivers_callback);
131 129}
132 rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
133 (void *) &p, proc_read_drivers_callback);
134 if (rc < 0)
135 return rc;
136 130
137 return (p - buf); 131static int pccard_drivers_proc_open(struct inode *inode, struct file *file)
132{
133 return single_open(file, pccard_drivers_proc_show, NULL);
138} 134}
135
136static const struct file_operations pccard_drivers_proc_fops = {
137 .owner = THIS_MODULE,
138 .open = pccard_drivers_proc_open,
139 .read = seq_read,
140 .llseek = seq_lseek,
141 .release = single_release,
142};
139#endif 143#endif
140 144
141 145
@@ -1011,7 +1015,7 @@ void __init pcmcia_setup_ioctl(void) {
1011#ifdef CONFIG_PROC_FS 1015#ifdef CONFIG_PROC_FS
1012 proc_pccard = proc_mkdir("bus/pccard", NULL); 1016 proc_pccard = proc_mkdir("bus/pccard", NULL);
1013 if (proc_pccard) 1017 if (proc_pccard)
1014 create_proc_read_entry("drivers",0,proc_pccard,proc_read_drivers,NULL); 1018 proc_create("drivers", 0, proc_pccard, &pccard_drivers_proc_fops);
1015#endif 1019#endif
1016} 1020}
1017 1021
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c
index 57ca085473d5..7eedb42f800c 100644
--- a/drivers/pcmcia/sa1100_jornada720.c
+++ b/drivers/pcmcia/sa1100_jornada720.c
@@ -16,89 +16,103 @@
16 16
17#include "sa1111_generic.h" 17#include "sa1111_generic.h"
18 18
19#define SOCKET0_POWER GPIO_GPIO0 19/* Does SOCKET1_3V actually do anything? */
20#define SOCKET0_3V GPIO_GPIO2 20#define SOCKET0_POWER GPIO_GPIO0
21#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) 21#define SOCKET0_3V GPIO_GPIO2
22#warning *** Does SOCKET1_3V actually do anything? 22#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3)
23#define SOCKET1_3V GPIO_GPIO3 23#define SOCKET1_3V GPIO_GPIO3
24 24
25static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 25static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
26{ 26{
27 /* 27 unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3;
28 * What is all this crap for? 28
29 */ 29 /*
30 GRER |= 0x00000002; 30 * What is all this crap for?
31 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ 31 */
32 sa1111_set_io_dir(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 32 GRER |= 0x00000002;
33 sa1111_set_io(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 33 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */
34 sa1111_set_sleep_io(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 34 sa1111_set_io_dir(SA1111_DEV(skt->dev), pin, 0, 0);
35 35 sa1111_set_io(SA1111_DEV(skt->dev), pin, 0);
36 return sa1111_pcmcia_hw_init(skt); 36 sa1111_set_sleep_io(SA1111_DEV(skt->dev), pin, 0);
37
38 return sa1111_pcmcia_hw_init(skt);
37} 39}
38 40
39static int 41static int
40jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) 42jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
41{ 43{
42 unsigned int pa_dwr_mask, pa_dwr_set; 44 unsigned int pa_dwr_mask, pa_dwr_set;
43 int ret; 45 int ret;
44 46
45printk("%s(): config socket %d vcc %d vpp %d\n", __func__, 47 printk(KERN_INFO "%s(): config socket %d vcc %d vpp %d\n", __func__,
46 skt->nr, state->Vcc, state->Vpp); 48 skt->nr, state->Vcc, state->Vpp);
47 49
48 switch (skt->nr) { 50 switch (skt->nr) {
49 case 0: 51 case 0:
50 pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V; 52 pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V;
51 53
52 switch (state->Vcc) { 54 switch (state->Vcc) {
53 default: 55 default:
54 case 0: pa_dwr_set = 0; break; 56 case 0:
55 case 33: pa_dwr_set = SOCKET0_POWER | SOCKET0_3V; break; 57 pa_dwr_set = 0;
56 case 50: pa_dwr_set = SOCKET0_POWER; break; 58 break;
57 } 59 case 33:
58 break; 60 pa_dwr_set = SOCKET0_POWER | SOCKET0_3V;
59 61 break;
60 case 1: 62 case 50:
61 pa_dwr_mask = SOCKET1_POWER; 63 pa_dwr_set = SOCKET0_POWER;
62 64 break;
63 switch (state->Vcc) { 65 }
64 default: 66 break;
65 case 0: pa_dwr_set = 0; break; 67
66 case 33: pa_dwr_set = SOCKET1_POWER; break; 68 case 1:
67 case 50: pa_dwr_set = SOCKET1_POWER; break; 69 pa_dwr_mask = SOCKET1_POWER;
68 } 70
69 break; 71 switch (state->Vcc) {
70 72 default:
71 default: 73 case 0:
72 return -1; 74 pa_dwr_set = 0;
73 } 75 break;
74 76 case 33:
75 if (state->Vpp != state->Vcc && state->Vpp != 0) { 77 pa_dwr_set = SOCKET1_POWER;
76 printk(KERN_ERR "%s(): slot cannot support VPP %u\n", 78 break;
77 __func__, state->Vpp); 79 case 50:
78 return -1; 80 pa_dwr_set = SOCKET1_POWER;
79 } 81 break;
80 82 }
81 ret = sa1111_pcmcia_configure_socket(skt, state); 83 break;
82 if (ret == 0) { 84
83 unsigned long flags; 85 default:
84 86 return -1;
85 local_irq_save(flags); 87 }
86 sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); 88
87 local_irq_restore(flags); 89 if (state->Vpp != state->Vcc && state->Vpp != 0) {
88 } 90 printk(KERN_ERR "%s(): slot cannot support VPP %u\n",
89 91 __func__, state->Vpp);
90 return ret; 92 return -EPERM;
93 }
94
95 ret = sa1111_pcmcia_configure_socket(skt, state);
96 if (ret == 0) {
97 unsigned long flags;
98
99 local_irq_save(flags);
100 sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set);
101 local_irq_restore(flags);
102 }
103
104 return ret;
91} 105}
92 106
93static struct pcmcia_low_level jornada720_pcmcia_ops = { 107static struct pcmcia_low_level jornada720_pcmcia_ops = {
94 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
95 .hw_init = jornada720_pcmcia_hw_init, 109 .hw_init = jornada720_pcmcia_hw_init,
96 .hw_shutdown = sa1111_pcmcia_hw_shutdown, 110 .hw_shutdown = sa1111_pcmcia_hw_shutdown,
97 .socket_state = sa1111_pcmcia_socket_state, 111 .socket_state = sa1111_pcmcia_socket_state,
98 .configure_socket = jornada720_pcmcia_configure_socket, 112 .configure_socket = jornada720_pcmcia_configure_socket,
99 113
100 .socket_init = sa1111_pcmcia_socket_init, 114 .socket_init = sa1111_pcmcia_socket_init,
101 .socket_suspend = sa1111_pcmcia_socket_suspend, 115 .socket_suspend = sa1111_pcmcia_socket_suspend,
102}; 116};
103 117
104int __devinit pcmcia_jornada720_init(struct device *dev) 118int __devinit pcmcia_jornada720_init(struct device *dev)
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 737fe5d87c40..b459e87a30ac 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -717,7 +717,7 @@ static void yenta_free_resources(struct yenta_socket *socket)
717/* 717/*
718 * Close it down - release our resources and go home.. 718 * Close it down - release our resources and go home..
719 */ 719 */
720static void yenta_close(struct pci_dev *dev) 720static void __devexit yenta_close(struct pci_dev *dev)
721{ 721{
722 struct yenta_socket *sock = pci_get_drvdata(dev); 722 struct yenta_socket *sock = pci_get_drvdata(dev);
723 723