aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/Kconfig7
-rw-r--r--drivers/serial/ioc3_serial.c4
-rw-r--r--drivers/serial/mfd.c2
-rw-r--r--drivers/serial/samsung.c2
-rw-r--r--drivers/serial/serial_cs.c205
5 files changed, 88 insertions, 132 deletions
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ba4b390299d5..927816484397 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -458,6 +458,7 @@ config SERIAL_SAMSUNG_UARTS
458 int 458 int
459 depends on ARM && PLAT_SAMSUNG 459 depends on ARM && PLAT_SAMSUNG
460 default 2 if ARCH_S3C2400 460 default 2 if ARCH_S3C2400
461 default 6 if ARCH_S5P6450
461 default 4 if SERIAL_SAMSUNG_UARTS_4 462 default 4 if SERIAL_SAMSUNG_UARTS_4
462 default 3 463 default 3
463 help 464 help
@@ -526,12 +527,12 @@ config SERIAL_S3C24A0
526 Serial port support for the Samsung S3C24A0 SoC 527 Serial port support for the Samsung S3C24A0 SoC
527 528
528config SERIAL_S3C6400 529config SERIAL_S3C6400
529 tristate "Samsung S3C6400/S3C6410/S5P6440/S5PC100 Serial port support" 530 tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support"
530 depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5PC100) 531 depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100)
531 select SERIAL_SAMSUNG_UARTS_4 532 select SERIAL_SAMSUNG_UARTS_4
532 default y 533 default y
533 help 534 help
534 Serial port support for the Samsung S3C6400, S3C6410, S5P6440 535 Serial port support for the Samsung S3C6400, S3C6410, S5P6440, S5P6450
535 and S5PC100 SoCs 536 and S5PC100 SoCs
536 537
537config SERIAL_S5PV210 538config SERIAL_S5PV210
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index 800c54602339..ee43efc7bdcc 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2017,6 +2017,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
2017 struct ioc3_port *port; 2017 struct ioc3_port *port;
2018 struct ioc3_port *ports[PORTS_PER_CARD]; 2018 struct ioc3_port *ports[PORTS_PER_CARD];
2019 int phys_port; 2019 int phys_port;
2020 int cnt;
2020 2021
2021 DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __func__, is, idd)); 2022 DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __func__, is, idd));
2022 2023
@@ -2147,6 +2148,9 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
2147 2148
2148 /* error exits that give back resources */ 2149 /* error exits that give back resources */
2149out4: 2150out4:
2151 for (cnt = 0; cnt < phys_port; cnt++)
2152 kfree(ports[cnt]);
2153
2150 kfree(card_ptr); 2154 kfree(card_ptr);
2151 return ret; 2155 return ret;
2152} 2156}
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c
index 735799e30aa9..5fc699e929dc 100644
--- a/drivers/serial/mfd.c
+++ b/drivers/serial/mfd.c
@@ -234,12 +234,14 @@ static const struct file_operations port_regs_ops = {
234 .owner = THIS_MODULE, 234 .owner = THIS_MODULE,
235 .open = hsu_show_regs_open, 235 .open = hsu_show_regs_open,
236 .read = port_show_regs, 236 .read = port_show_regs,
237 .llseek = default_llseek,
237}; 238};
238 239
239static const struct file_operations dma_regs_ops = { 240static const struct file_operations dma_regs_ops = {
240 .owner = THIS_MODULE, 241 .owner = THIS_MODULE,
241 .open = hsu_show_regs_open, 242 .open = hsu_show_regs_open,
242 .read = dma_show_regs, 243 .read = dma_show_regs,
244 .llseek = default_llseek,
243}; 245};
244 246
245static int hsu_debugfs_init(struct hsu_port *hsu) 247static int hsu_debugfs_init(struct hsu_port *hsu)
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c
index b1156ba8ad14..7ac2bf5167cd 100644
--- a/drivers/serial/samsung.c
+++ b/drivers/serial/samsung.c
@@ -1101,7 +1101,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1101 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); 1101 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);
1102 1102
1103 port->mapbase = res->start; 1103 port->mapbase = res->start;
1104 port->membase = S3C_VA_UART + res->start - (S3C_PA_UART & 0xfff00000); 1104 port->membase = S3C_VA_UART + (res->start & 0xfffff);
1105 ret = platform_get_irq(platdev, 0); 1105 ret = platform_get_irq(platdev, 0);
1106 if (ret < 0) 1106 if (ret < 0)
1107 port->irq = 0; 1107 port->irq = 0;
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 7d475b2a79e8..93760b2ea172 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -45,7 +45,6 @@
45#include <asm/io.h> 45#include <asm/io.h>
46#include <asm/system.h> 46#include <asm/system.h>
47 47
48#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
50#include <pcmcia/ciscode.h> 49#include <pcmcia/ciscode.h>
51#include <pcmcia/ds.h> 50#include <pcmcia/ds.h>
@@ -183,10 +182,8 @@ static void quirk_config_socket(struct pcmcia_device *link)
183{ 182{
184 struct serial_info *info = link->priv; 183 struct serial_info *info = link->priv;
185 184
186 if (info->multi) { 185 if (info->multi)
187 link->conf.Present |= PRESENT_EXT_STATUS; 186 link->config_flags |= CONF_ENABLE_ESR;
188 link->conf.ExtStatus = ESR_REQ_ATTN_ENA;
189 }
190} 187}
191 188
192static const struct serial_quirk quirks[] = { 189static const struct serial_quirk quirks[] = {
@@ -265,13 +262,6 @@ static const struct serial_quirk quirks[] = {
265static int serial_config(struct pcmcia_device * link); 262static int serial_config(struct pcmcia_device * link);
266 263
267 264
268/*======================================================================
269
270 After a card is removed, serial_remove() will unregister
271 the serial device(s), and release the PCMCIA configuration.
272
273======================================================================*/
274
275static void serial_remove(struct pcmcia_device *link) 265static void serial_remove(struct pcmcia_device *link)
276{ 266{
277 struct serial_info *info = link->priv; 267 struct serial_info *info = link->priv;
@@ -314,14 +304,6 @@ static int serial_resume(struct pcmcia_device *link)
314 return 0; 304 return 0;
315} 305}
316 306
317/*======================================================================
318
319 serial_attach() creates an "instance" of the driver, allocating
320 local data structures for one device. The device is registered
321 with Card Services.
322
323======================================================================*/
324
325static int serial_probe(struct pcmcia_device *link) 307static int serial_probe(struct pcmcia_device *link)
326{ 308{
327 struct serial_info *info; 309 struct serial_info *info;
@@ -335,25 +317,13 @@ static int serial_probe(struct pcmcia_device *link)
335 info->p_dev = link; 317 info->p_dev = link;
336 link->priv = info; 318 link->priv = info;
337 319
338 link->conf.Attributes = CONF_ENABLE_IRQ; 320 link->config_flags |= CONF_ENABLE_IRQ;
339 if (do_sound) { 321 if (do_sound)
340 link->conf.Attributes |= CONF_ENABLE_SPKR; 322 link->config_flags |= CONF_ENABLE_SPKR;
341 link->conf.Status = CCSR_AUDIO_ENA;
342 }
343 link->conf.IntType = INT_MEMORY_AND_IO;
344 323
345 return serial_config(link); 324 return serial_config(link);
346} 325}
347 326
348/*======================================================================
349
350 This deletes a driver "instance". The device is de-registered
351 with Card Services. If it has been released, all local data
352 structures are freed. Otherwise, the structures will be freed
353 when the device is released.
354
355======================================================================*/
356
357static void serial_detach(struct pcmcia_device *link) 327static void serial_detach(struct pcmcia_device *link)
358{ 328{
359 struct serial_info *info = link->priv; 329 struct serial_info *info = link->priv;
@@ -361,11 +331,6 @@ static void serial_detach(struct pcmcia_device *link)
361 dev_dbg(&link->dev, "serial_detach\n"); 331 dev_dbg(&link->dev, "serial_detach\n");
362 332
363 /* 333 /*
364 * Ensure any outstanding scheduled tasks are completed.
365 */
366 flush_scheduled_work();
367
368 /*
369 * Ensure that the ports have been released. 334 * Ensure that the ports have been released.
370 */ 335 */
371 serial_remove(link); 336 serial_remove(link);
@@ -430,47 +395,45 @@ static int pfc_config(struct pcmcia_device *p_dev)
430 return -ENODEV; 395 return -ENODEV;
431} 396}
432 397
433static int simple_config_check(struct pcmcia_device *p_dev, 398static int simple_config_check(struct pcmcia_device *p_dev, void *priv_data)
434 cistpl_cftable_entry_t *cf,
435 cistpl_cftable_entry_t *dflt,
436 unsigned int vcc,
437 void *priv_data)
438{ 399{
439 static const int size_table[2] = { 8, 16 }; 400 static const int size_table[2] = { 8, 16 };
440 int *try = priv_data; 401 int *try = priv_data;
441 402
442 if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 403 if (p_dev->resource[0]->start == 0)
443 p_dev->conf.Vpp = 404 return -ENODEV;
444 cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
445 405
446 p_dev->io_lines = ((*try & 0x1) == 0) ? 406 if ((*try & 0x1) == 0)
447 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 407 p_dev->io_lines = 16;
448 408
449 if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) 409 if (p_dev->resource[0]->end != size_table[(*try >> 1)])
450 && (cf->io.win[0].base != 0)) { 410 return -ENODEV;
451 p_dev->resource[0]->start = cf->io.win[0].base; 411
452 if (!pcmcia_request_io(p_dev)) 412 p_dev->resource[0]->end = 8;
453 return 0; 413 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
454 } 414 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
455 return -EINVAL; 415
416 return pcmcia_request_io(p_dev);
456} 417}
457 418
458static int simple_config_check_notpicky(struct pcmcia_device *p_dev, 419static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
459 cistpl_cftable_entry_t *cf,
460 cistpl_cftable_entry_t *dflt,
461 unsigned int vcc,
462 void *priv_data) 420 void *priv_data)
463{ 421{
464 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 422 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
465 int j; 423 int j;
466 424
467 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 425 if (p_dev->io_lines > 3)
468 for (j = 0; j < 5; j++) { 426 return -ENODEV;
469 p_dev->resource[0]->start = base[j]; 427
470 p_dev->io_lines = base[j] ? 16 : 3; 428 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
471 if (!pcmcia_request_io(p_dev)) 429 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
472 return 0; 430 p_dev->resource[0]->end = 8;
473 } 431
432 for (j = 0; j < 5; j++) {
433 p_dev->resource[0]->start = base[j];
434 p_dev->io_lines = base[j] ? 16 : 3;
435 if (!pcmcia_request_io(p_dev))
436 return 0;
474 } 437 }
475 return -ENODEV; 438 return -ENODEV;
476} 439}
@@ -480,11 +443,9 @@ static int simple_config(struct pcmcia_device *link)
480 struct serial_info *info = link->priv; 443 struct serial_info *info = link->priv;
481 int i = -ENODEV, try; 444 int i = -ENODEV, try;
482 445
483 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
484 link->resource[0]->end = 8;
485
486 /* First pass: look for a config entry that looks normal. 446 /* First pass: look for a config entry that looks normal.
487 * Two tries: without IO aliases, then with aliases */ 447 * Two tries: without IO aliases, then with aliases */
448 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_SET_IO;
488 for (try = 0; try < 4; try++) 449 for (try = 0; try < 4; try++)
489 if (!pcmcia_loop_config(link, simple_config_check, &try)) 450 if (!pcmcia_loop_config(link, simple_config_check, &try))
490 goto found_port; 451 goto found_port;
@@ -500,7 +461,7 @@ static int simple_config(struct pcmcia_device *link)
500 461
501found_port: 462found_port:
502 if (info->multi && (info->manfid == MANFID_3COM)) 463 if (info->multi && (info->manfid == MANFID_3COM))
503 link->conf.ConfigIndex &= ~(0x08); 464 link->config_index &= ~(0x08);
504 465
505 /* 466 /*
506 * Apply any configuration quirks. 467 * Apply any configuration quirks.
@@ -508,51 +469,50 @@ found_port:
508 if (info->quirk && info->quirk->config) 469 if (info->quirk && info->quirk->config)
509 info->quirk->config(link); 470 info->quirk->config(link);
510 471
511 i = pcmcia_request_configuration(link, &link->conf); 472 i = pcmcia_enable_device(link);
512 if (i != 0) 473 if (i != 0)
513 return -1; 474 return -1;
514 return setup_serial(link, info, link->resource[0]->start, link->irq); 475 return setup_serial(link, info, link->resource[0]->start, link->irq);
515} 476}
516 477
517static int multi_config_check(struct pcmcia_device *p_dev, 478static int multi_config_check(struct pcmcia_device *p_dev, void *priv_data)
518 cistpl_cftable_entry_t *cf,
519 cistpl_cftable_entry_t *dflt,
520 unsigned int vcc,
521 void *priv_data)
522{ 479{
523 int *base2 = priv_data; 480 int *multi = priv_data;
481
482 if (p_dev->resource[1]->end)
483 return -EINVAL;
524 484
525 /* The quad port cards have bad CIS's, so just look for a 485 /* The quad port cards have bad CIS's, so just look for a
526 window larger than 8 ports and assume it will be right */ 486 window larger than 8 ports and assume it will be right */
527 if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { 487 if (p_dev->resource[0]->end <= 8)
528 p_dev->resource[0]->start = cf->io.win[0].base; 488 return -EINVAL;
529 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 489
530 if (!pcmcia_request_io(p_dev)) { 490 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
531 *base2 = p_dev->resource[0]->start + 8; 491 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
532 return 0; 492 p_dev->resource[0]->end = *multi * 8;
533 } 493
534 } 494 if (pcmcia_request_io(p_dev))
535 return -ENODEV; 495 return -ENODEV;
496 return 0;
536} 497}
537 498
538static int multi_config_check_notpicky(struct pcmcia_device *p_dev, 499static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
539 cistpl_cftable_entry_t *cf,
540 cistpl_cftable_entry_t *dflt,
541 unsigned int vcc,
542 void *priv_data) 500 void *priv_data)
543{ 501{
544 int *base2 = priv_data; 502 int *base2 = priv_data;
545 503
546 if (cf->io.nwin == 2) { 504 if (!p_dev->resource[0]->end || !p_dev->resource[1]->end)
547 p_dev->resource[0]->start = cf->io.win[0].base; 505 return -ENODEV;
548 p_dev->resource[1]->start = cf->io.win[1].base; 506
549 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 507 p_dev->resource[0]->end = p_dev->resource[1]->end = 8;
550 if (!pcmcia_request_io(p_dev)) { 508 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
551 *base2 = p_dev->resource[1]->start; 509 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
552 return 0; 510
553 } 511 if (pcmcia_request_io(p_dev))
554 } 512 return -ENODEV;
555 return -ENODEV; 513
514 *base2 = p_dev->resource[0]->start + 8;
515 return 0;
556} 516}
557 517
558static int multi_config(struct pcmcia_device *link) 518static int multi_config(struct pcmcia_device *link)
@@ -560,12 +520,12 @@ static int multi_config(struct pcmcia_device *link)
560 struct serial_info *info = link->priv; 520 struct serial_info *info = link->priv;
561 int i, base2 = 0; 521 int i, base2 = 0;
562 522
523 link->config_flags |= CONF_AUTO_SET_IO;
563 /* First, look for a generic full-sized window */ 524 /* First, look for a generic full-sized window */
564 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 525 if (!pcmcia_loop_config(link, multi_config_check, &info->multi))
565 link->resource[0]->end = info->multi * 8; 526 base2 = link->resource[0]->start + 8;
566 if (pcmcia_loop_config(link, multi_config_check, &base2)) { 527 else {
567 /* If that didn't work, look for two windows */ 528 /* If that didn't work, look for two windows */
568 link->resource[0]->end = link->resource[1]->end = 8;
569 info->multi = 2; 529 info->multi = 2;
570 if (pcmcia_loop_config(link, multi_config_check_notpicky, 530 if (pcmcia_loop_config(link, multi_config_check_notpicky,
571 &base2)) { 531 &base2)) {
@@ -584,7 +544,7 @@ static int multi_config(struct pcmcia_device *link)
584 if (info->quirk && info->quirk->config) 544 if (info->quirk && info->quirk->config)
585 info->quirk->config(link); 545 info->quirk->config(link);
586 546
587 i = pcmcia_request_configuration(link, &link->conf); 547 i = pcmcia_enable_device(link);
588 if (i != 0) 548 if (i != 0)
589 return -ENODEV; 549 return -ENODEV;
590 550
@@ -596,11 +556,11 @@ static int multi_config(struct pcmcia_device *link)
596 info->prodid == PRODID_POSSIO_GCC)) { 556 info->prodid == PRODID_POSSIO_GCC)) {
597 int err; 557 int err;
598 558
599 if (link->conf.ConfigIndex == 1 || 559 if (link->config_index == 1 ||
600 link->conf.ConfigIndex == 3) { 560 link->config_index == 3) {
601 err = setup_serial(link, info, base2, 561 err = setup_serial(link, info, base2,
602 link->irq); 562 link->irq);
603 base2 = link->resource[0]->start;; 563 base2 = link->resource[0]->start;
604 } else { 564 } else {
605 err = setup_serial(link, info, link->resource[0]->start, 565 err = setup_serial(link, info, link->resource[0]->start,
606 link->irq); 566 link->irq);
@@ -624,33 +584,24 @@ static int multi_config(struct pcmcia_device *link)
624 return 0; 584 return 0;
625} 585}
626 586
627static int serial_check_for_multi(struct pcmcia_device *p_dev, 587static int serial_check_for_multi(struct pcmcia_device *p_dev, void *priv_data)
628 cistpl_cftable_entry_t *cf,
629 cistpl_cftable_entry_t *dflt,
630 unsigned int vcc,
631 void *priv_data)
632{ 588{
633 struct serial_info *info = p_dev->priv; 589 struct serial_info *info = p_dev->priv;
634 590
635 if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) 591 if (!p_dev->resource[0]->end)
636 info->multi = cf->io.win[0].len >> 3; 592 return -EINVAL;
593
594 if ((!p_dev->resource[1]->end) && (p_dev->resource[0]->end % 8 == 0))
595 info->multi = p_dev->resource[0]->end >> 3;
637 596
638 if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && 597 if ((p_dev->resource[1]->end) && (p_dev->resource[0]->end == 8)
639 (cf->io.win[1].len == 8)) 598 && (p_dev->resource[1]->end == 8))
640 info->multi = 2; 599 info->multi = 2;
641 600
642 return 0; /* break */ 601 return 0; /* break */
643} 602}
644 603
645 604
646/*======================================================================
647
648 serial_config() is scheduled to run after a CARD_INSERTION event
649 is received, to configure the PCMCIA socket, and to make the
650 serial device available to the system.
651
652======================================================================*/
653
654static int serial_config(struct pcmcia_device * link) 605static int serial_config(struct pcmcia_device * link)
655{ 606{
656 struct serial_info *info = link->priv; 607 struct serial_info *info = link->priv;
@@ -894,9 +845,7 @@ MODULE_FIRMWARE("cis/RS-COM-2P.cis");
894 845
895static struct pcmcia_driver serial_cs_driver = { 846static struct pcmcia_driver serial_cs_driver = {
896 .owner = THIS_MODULE, 847 .owner = THIS_MODULE,
897 .drv = { 848 .name = "serial_cs",
898 .name = "serial_cs",
899 },
900 .probe = serial_probe, 849 .probe = serial_probe,
901 .remove = serial_detach, 850 .remove = serial_detach,
902 .id_table = serial_ids, 851 .id_table = serial_ids,