aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/ibmtr_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/ibmtr_cs.c')
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c89
1 files changed, 25 insertions, 64 deletions
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index dc85282193bf..15d57f5b6f29 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -58,7 +58,6 @@
58#include <linux/trdevice.h> 58#include <linux/trdevice.h>
59#include <linux/ibmtr.h> 59#include <linux/ibmtr.h>
60 60
61#include <pcmcia/cs.h>
62#include <pcmcia/cistpl.h> 61#include <pcmcia/cistpl.h>
63#include <pcmcia/ds.h> 62#include <pcmcia/ds.h>
64 63
@@ -103,9 +102,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev);
103 102
104typedef struct ibmtr_dev_t { 103typedef struct ibmtr_dev_t {
105 struct pcmcia_device *p_dev; 104 struct pcmcia_device *p_dev;
106 struct net_device *dev; 105 struct net_device *dev;
107 window_handle_t sram_win_handle; 106 struct tok_info *ti;
108 struct tok_info *ti;
109} ibmtr_dev_t; 107} ibmtr_dev_t;
110 108
111static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { 109static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
@@ -114,14 +112,6 @@ static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
114 return tok_interrupt(irq, dev); 112 return tok_interrupt(irq, dev);
115}; 113};
116 114
117/*======================================================================
118
119 ibmtr_attach() creates an "instance" of the driver, allocating
120 local data structures for one device. The device is registered
121 with Card Services.
122
123======================================================================*/
124
125static int __devinit ibmtr_attach(struct pcmcia_device *link) 115static int __devinit ibmtr_attach(struct pcmcia_device *link)
126{ 116{
127 ibmtr_dev_t *info; 117 ibmtr_dev_t *info;
@@ -144,24 +134,14 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
144 134
145 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 135 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
146 link->resource[0]->end = 4; 136 link->resource[0]->end = 4;
147 link->conf.Attributes = CONF_ENABLE_IRQ; 137 link->config_flags |= CONF_ENABLE_IRQ;
148 link->conf.IntType = INT_MEMORY_AND_IO; 138 link->config_regs = PRESENT_OPTION;
149 link->conf.Present = PRESENT_OPTION;
150 139
151 info->dev = dev; 140 info->dev = dev;
152 141
153 return ibmtr_config(link); 142 return ibmtr_config(link);
154} /* ibmtr_attach */ 143} /* ibmtr_attach */
155 144
156/*======================================================================
157
158 This deletes a driver "instance". The device is de-registered
159 with Card Services. If it has been released, all local data
160 structures are freed. Otherwise, the structures will be freed
161 when the device is released.
162
163======================================================================*/
164
165static void ibmtr_detach(struct pcmcia_device *link) 145static void ibmtr_detach(struct pcmcia_device *link)
166{ 146{
167 struct ibmtr_dev_t *info = link->priv; 147 struct ibmtr_dev_t *info = link->priv;
@@ -186,26 +166,17 @@ static void ibmtr_detach(struct pcmcia_device *link)
186 kfree(info); 166 kfree(info);
187} /* ibmtr_detach */ 167} /* ibmtr_detach */
188 168
189/*======================================================================
190
191 ibmtr_config() is scheduled to run after a CARD_INSERTION event
192 is received, to configure the PCMCIA socket, and to make the
193 token-ring device available to the system.
194
195======================================================================*/
196
197static int __devinit ibmtr_config(struct pcmcia_device *link) 169static int __devinit ibmtr_config(struct pcmcia_device *link)
198{ 170{
199 ibmtr_dev_t *info = link->priv; 171 ibmtr_dev_t *info = link->priv;
200 struct net_device *dev = info->dev; 172 struct net_device *dev = info->dev;
201 struct tok_info *ti = netdev_priv(dev); 173 struct tok_info *ti = netdev_priv(dev);
202 win_req_t req;
203 int i, ret; 174 int i, ret;
204 175
205 dev_dbg(&link->dev, "ibmtr_config\n"); 176 dev_dbg(&link->dev, "ibmtr_config\n");
206 177
207 link->conf.ConfigIndex = 0x61;
208 link->io_lines = 16; 178 link->io_lines = 16;
179 link->config_index = 0x61;
209 180
210 /* Determine if this is PRIMARY or ALTERNATE. */ 181 /* Determine if this is PRIMARY or ALTERNATE. */
211 182
@@ -229,39 +200,39 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
229 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 200 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
230 201
231 /* Allocate the MMIO memory window */ 202 /* Allocate the MMIO memory window */
232 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 203 link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
233 req.Attributes |= WIN_USE_WAIT; 204 link->resource[2]->flags |= WIN_USE_WAIT;
234 req.Base = 0; 205 link->resource[2]->start = 0;
235 req.Size = 0x2000; 206 link->resource[2]->end = 0x2000;
236 req.AccessSpeed = 250; 207 ret = pcmcia_request_window(link, link->resource[2], 250);
237 ret = pcmcia_request_window(link, &req, &link->win);
238 if (ret) 208 if (ret)
239 goto failed; 209 goto failed;
240 210
241 ret = pcmcia_map_mem_page(link, link->win, mmiobase); 211 ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase);
242 if (ret) 212 if (ret)
243 goto failed; 213 goto failed;
244 ti->mmio = ioremap(req.Base, req.Size); 214 ti->mmio = ioremap(link->resource[2]->start,
215 resource_size(link->resource[2]));
245 216
246 /* Allocate the SRAM memory window */ 217 /* Allocate the SRAM memory window */
247 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 218 link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
248 req.Attributes |= WIN_USE_WAIT; 219 link->resource[3]->flags |= WIN_USE_WAIT;
249 req.Base = 0; 220 link->resource[3]->start = 0;
250 req.Size = sramsize * 1024; 221 link->resource[3]->end = sramsize * 1024;
251 req.AccessSpeed = 250; 222 ret = pcmcia_request_window(link, link->resource[3], 250);
252 ret = pcmcia_request_window(link, &req, &info->sram_win_handle);
253 if (ret) 223 if (ret)
254 goto failed; 224 goto failed;
255 225
256 ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 226 ret = pcmcia_map_mem_page(link, link->resource[3], srambase);
257 if (ret) 227 if (ret)
258 goto failed; 228 goto failed;
259 229
260 ti->sram_base = srambase >> 12; 230 ti->sram_base = srambase >> 12;
261 ti->sram_virt = ioremap(req.Base, req.Size); 231 ti->sram_virt = ioremap(link->resource[3]->start,
262 ti->sram_phys = req.Base; 232 resource_size(link->resource[3]));
233 ti->sram_phys = link->resource[3]->start;
263 234
264 ret = pcmcia_request_configuration(link, &link->conf); 235 ret = pcmcia_enable_device(link);
265 if (ret) 236 if (ret)
266 goto failed; 237 goto failed;
267 238
@@ -289,14 +260,6 @@ failed:
289 return -ENODEV; 260 return -ENODEV;
290} /* ibmtr_config */ 261} /* ibmtr_config */
291 262
292/*======================================================================
293
294 After a card is removed, ibmtr_release() will unregister the net
295 device, and release the PCMCIA configuration. If the device is
296 still open, this will be postponed until it is closed.
297
298======================================================================*/
299
300static void ibmtr_release(struct pcmcia_device *link) 263static void ibmtr_release(struct pcmcia_device *link)
301{ 264{
302 ibmtr_dev_t *info = link->priv; 265 ibmtr_dev_t *info = link->priv;
@@ -304,7 +267,7 @@ static void ibmtr_release(struct pcmcia_device *link)
304 267
305 dev_dbg(&link->dev, "ibmtr_release\n"); 268 dev_dbg(&link->dev, "ibmtr_release\n");
306 269
307 if (link->win) { 270 if (link->resource[2]->end) {
308 struct tok_info *ti = netdev_priv(dev); 271 struct tok_info *ti = netdev_priv(dev);
309 iounmap(ti->mmio); 272 iounmap(ti->mmio);
310 } 273 }
@@ -386,9 +349,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids);
386 349
387static struct pcmcia_driver ibmtr_cs_driver = { 350static struct pcmcia_driver ibmtr_cs_driver = {
388 .owner = THIS_MODULE, 351 .owner = THIS_MODULE,
389 .drv = { 352 .name = "ibmtr_cs",
390 .name = "ibmtr_cs",
391 },
392 .probe = ibmtr_attach, 353 .probe = ibmtr_attach,
393 .remove = ibmtr_detach, 354 .remove = ibmtr_detach,
394 .id_table = ibmtr_ids, 355 .id_table = ibmtr_ids,