diff options
Diffstat (limited to 'drivers/isdn/hisax/sedlbauer_cs.c')
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 83 |
1 files changed, 21 insertions, 62 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 1f4feaab21af..a024192b672a 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
48 | 48 | ||
49 | #include <pcmcia/cs_types.h> | ||
50 | #include <pcmcia/cs.h> | 49 | #include <pcmcia/cs.h> |
51 | #include <pcmcia/cistpl.h> | 50 | #include <pcmcia/cistpl.h> |
52 | #include <pcmcia/cisreg.h> | 51 | #include <pcmcia/cisreg.h> |
@@ -130,9 +129,8 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) | |||
130 | /* from old sedl_cs | 129 | /* from old sedl_cs |
131 | */ | 130 | */ |
132 | /* The io structure describes IO port mapping */ | 131 | /* The io structure describes IO port mapping */ |
133 | link->io.NumPorts1 = 8; | 132 | link->resource[0]->end = 8; |
134 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 133 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
135 | link->io.IOAddrLines = 3; | ||
136 | 134 | ||
137 | link->conf.Attributes = 0; | 135 | link->conf.Attributes = 0; |
138 | link->conf.IntType = INT_MEMORY_AND_IO; | 136 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -173,8 +171,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
173 | unsigned int vcc, | 171 | unsigned int vcc, |
174 | void *priv_data) | 172 | void *priv_data) |
175 | { | 173 | { |
176 | win_req_t *req = priv_data; | ||
177 | |||
178 | if (cfg->index == 0) | 174 | if (cfg->index == 0) |
179 | return -ENODEV; | 175 | return -ENODEV; |
180 | 176 | ||
@@ -202,52 +198,25 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
202 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 198 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
203 | 199 | ||
204 | /* IO window settings */ | 200 | /* IO window settings */ |
205 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 201 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
206 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 202 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
207 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 203 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
208 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 204 | p_dev->resource[0]->start = io->win[0].base; |
209 | if (!(io->flags & CISTPL_IO_8BIT)) | 205 | p_dev->resource[0]->end = io->win[0].len; |
210 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 206 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
211 | if (!(io->flags & CISTPL_IO_16BIT)) | 207 | p_dev->resource[0]->flags |= |
212 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 208 | pcmcia_io_cfg_data_width(io->flags); |
213 | p_dev->io.BasePort1 = io->win[0].base; | ||
214 | p_dev->io.NumPorts1 = io->win[0].len; | ||
215 | if (io->nwin > 1) { | 209 | if (io->nwin > 1) { |
216 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 210 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
217 | p_dev->io.BasePort2 = io->win[1].base; | 211 | p_dev->resource[1]->start = io->win[1].base; |
218 | p_dev->io.NumPorts2 = io->win[1].len; | 212 | p_dev->resource[1]->end = io->win[1].len; |
219 | } | 213 | } |
220 | /* This reserves IO space but doesn't actually enable it */ | 214 | /* This reserves IO space but doesn't actually enable it */ |
221 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 215 | p_dev->io_lines = 3; |
216 | if (pcmcia_request_io(p_dev) != 0) | ||
222 | return -ENODEV; | 217 | return -ENODEV; |
223 | } | 218 | } |
224 | 219 | ||
225 | /* | ||
226 | Now set up a common memory window, if needed. There is room | ||
227 | in the struct pcmcia_device structure for one memory window handle, | ||
228 | but if the base addresses need to be saved, or if multiple | ||
229 | windows are needed, the info should go in the private data | ||
230 | structure for this device. | ||
231 | |||
232 | Note that the memory window base is a physical address, and | ||
233 | needs to be mapped to virtual space with ioremap() before it | ||
234 | is used. | ||
235 | */ | ||
236 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
237 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
238 | memreq_t map; | ||
239 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
240 | req->Attributes |= WIN_ENABLE; | ||
241 | req->Base = mem->win[0].host_addr; | ||
242 | req->Size = mem->win[0].len; | ||
243 | req->AccessSpeed = 0; | ||
244 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) | ||
245 | return -ENODEV; | ||
246 | map.Page = 0; | ||
247 | map.CardOffset = mem->win[0].card_addr; | ||
248 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) | ||
249 | return -ENODEV; | ||
250 | } | ||
251 | return 0; | 220 | return 0; |
252 | } | 221 | } |
253 | 222 | ||
@@ -255,16 +224,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
255 | 224 | ||
256 | static int __devinit sedlbauer_config(struct pcmcia_device *link) | 225 | static int __devinit sedlbauer_config(struct pcmcia_device *link) |
257 | { | 226 | { |
258 | win_req_t *req; | ||
259 | int ret; | 227 | int ret; |
260 | IsdnCard_t icard; | 228 | IsdnCard_t icard; |
261 | 229 | ||
262 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); | 230 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); |
263 | 231 | ||
264 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | ||
265 | if (!req) | ||
266 | return -ENOMEM; | ||
267 | |||
268 | /* | 232 | /* |
269 | In this loop, we scan the CIS for configuration table entries, | 233 | In this loop, we scan the CIS for configuration table entries, |
270 | each of which describes a valid card configuration, including | 234 | each of which describes a valid card configuration, including |
@@ -277,7 +241,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) | |||
277 | these things without consulting the CIS, and most client drivers | 241 | these things without consulting the CIS, and most client drivers |
278 | will only use the CIS to fill in implementation-defined details. | 242 | will only use the CIS to fill in implementation-defined details. |
279 | */ | 243 | */ |
280 | ret = pcmcia_loop_config(link, sedlbauer_config_check, req); | 244 | ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); |
281 | if (ret) | 245 | if (ret) |
282 | goto failed; | 246 | goto failed; |
283 | 247 | ||
@@ -297,27 +261,22 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) | |||
297 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); | 261 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); |
298 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 262 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
299 | printk(", irq %d", link->irq); | 263 | printk(", irq %d", link->irq); |
300 | if (link->io.NumPorts1) | 264 | if (link->resource[0]) |
301 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 265 | printk(" & %pR", link->resource[0]); |
302 | link->io.BasePort1+link->io.NumPorts1-1); | 266 | if (link->resource[1]) |
303 | if (link->io.NumPorts2) | 267 | printk(" & %pR", link->resource[1]); |
304 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
305 | link->io.BasePort2+link->io.NumPorts2-1); | ||
306 | if (link->win) | ||
307 | printk(", mem 0x%06lx-0x%06lx", req->Base, | ||
308 | req->Base+req->Size-1); | ||
309 | printk("\n"); | 268 | printk("\n"); |
310 | 269 | ||
311 | icard.para[0] = link->irq; | 270 | icard.para[0] = link->irq; |
312 | icard.para[1] = link->io.BasePort1; | 271 | icard.para[1] = link->resource[0]->start; |
313 | icard.protocol = protocol; | 272 | icard.protocol = protocol; |
314 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; | 273 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; |
315 | 274 | ||
316 | ret = hisax_init_pcmcia(link, | 275 | ret = hisax_init_pcmcia(link, |
317 | &(((local_info_t *)link->priv)->stop), &icard); | 276 | &(((local_info_t *)link->priv)->stop), &icard); |
318 | if (ret < 0) { | 277 | if (ret < 0) { |
319 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", | 278 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d with %pR\n", |
320 | ret, link->io.BasePort1); | 279 | ret, link->resource[0]); |
321 | sedlbauer_release(link); | 280 | sedlbauer_release(link); |
322 | return -ENODEV; | 281 | return -ENODEV; |
323 | } else | 282 | } else |