~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/tty/serial/sh-sci.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
1052
1052
                if (SCIx_IRQ_IS_MUXED(port)) {
1053
1053
                        i = SCIx_MUX_IRQ;
1054
1054
                        irq = up->irq;
1055
 
                } else
 
1055
                } else {
1056
1056
                        irq = port->cfg->irqs[i];
1057
1057
 
 
1058
                        /*
 
1059
                         * Certain port types won't support all of the
 
1060
                         * available interrupt sources.
 
1061
                         */
 
1062
                        if (unlikely(!irq))
 
1063
                                continue;
 
1064
                }
 
1065
 
1058
1066
                desc = sci_irq_desc + i;
1059
1067
                port->irqstr[j] = kasprintf(GFP_KERNEL, "%s:%s",
1060
1068
                                            dev_name(up->dev), desc->desc);
1094
1102
         * IRQ first.
1095
1103
         */
1096
1104
        for (i = 0; i < SCIx_NR_IRQS; i++) {
 
1105
                unsigned int irq = port->cfg->irqs[i];
 
1106
 
 
1107
                /*
 
1108
                 * Certain port types won't support all of the available
 
1109
                 * interrupt sources.
 
1110
                 */
 
1111
                if (unlikely(!irq))
 
1112
                        continue;
 
1113
 
1097
1114
                free_irq(port->cfg->irqs[i], port);
1098
1115
                kfree(port->irqstr[i]);
1099
1116
 
1564
1581
 
1565
1582
static void sci_break_ctl(struct uart_port *port, int break_state)
1566
1583
{
1567
 
        /*
1568
 
         * Not supported by hardware. Most parts couple break and rx
1569
 
         * interrupts together, with break detection always enabled.
1570
 
         */
 
1584
        struct sci_port *s = to_sci_port(port);
 
1585
        struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR;
 
1586
        unsigned short scscr, scsptr;
 
1587
 
 
1588
        /* check wheter the port has SCSPTR */
 
1589
        if (!reg->size) {
 
1590
                /*
 
1591
                 * Not supported by hardware. Most parts couple break and rx
 
1592
                 * interrupts together, with break detection always enabled.
 
1593
                 */
 
1594
                return;
 
1595
        }
 
1596
 
 
1597
        scsptr = serial_port_in(port, SCSPTR);
 
1598
        scscr = serial_port_in(port, SCSCR);
 
1599
 
 
1600
        if (break_state == -1) {
 
1601
                scsptr = (scsptr | SCSPTR_SPB2IO) & ~SCSPTR_SPB2DT;
 
1602
                scscr &= ~SCSCR_TE;
 
1603
        } else {
 
1604
                scsptr = (scsptr | SCSPTR_SPB2DT) & ~SCSPTR_SPB2IO;
 
1605
                scscr |= SCSCR_TE;
 
1606
        }
 
1607
 
 
1608
        serial_port_out(port, SCSPTR, scsptr);
 
1609
        serial_port_out(port, SCSCR, scscr);
1571
1610
}
1572
1611
 
1573
1612
#ifdef CONFIG_SERIAL_SH_SCI_DMA
2140
2179
        return 0;
2141
2180
}
2142
2181
 
 
2182
static void sci_cleanup_single(struct sci_port *port)
 
2183
{
 
2184
        sci_free_gpios(port);
 
2185
 
 
2186
        clk_put(port->iclk);
 
2187
        clk_put(port->fclk);
 
2188
 
 
2189
        pm_runtime_disable(port->port.dev);
 
2190
}
 
2191
 
2143
2192
#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
2144
2193
static void serial_console_putchar(struct uart_port *port, int ch)
2145
2194
{
2321
2370
        cpufreq_unregister_notifier(&port->freq_transition,
2322
2371
                                    CPUFREQ_TRANSITION_NOTIFIER);
2323
2372
 
2324
 
        sci_free_gpios(port);
2325
 
 
2326
2373
        uart_remove_one_port(&sci_uart_driver, &port->port);
2327
2374
 
2328
 
        clk_put(port->iclk);
2329
 
        clk_put(port->fclk);
 
2375
        sci_cleanup_single(port);
2330
2376
 
2331
 
        pm_runtime_disable(&dev->dev);
2332
2377
        return 0;
2333
2378
}
2334
2379
 
2346
2391
                           index+1, SCI_NPORTS);
2347
2392
                dev_notice(&dev->dev, "Consider bumping "
2348
2393
                           "CONFIG_SERIAL_SH_SCI_NR_UARTS!\n");
2349
 
                return 0;
 
2394
                return -EINVAL;
2350
2395
        }
2351
2396
 
2352
2397
        ret = sci_init_single(dev, sciport, index, p);
2353
2398
        if (ret)
2354
2399
                return ret;
2355
2400
 
2356
 
        return uart_add_one_port(&sci_uart_driver, &sciport->port);
 
2401
        ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
 
2402
        if (ret) {
 
2403
                sci_cleanup_single(sciport);
 
2404
                return ret;
 
2405
        }
 
2406
 
 
2407
        return 0;
2357
2408
}
2358
2409
 
2359
2410
static int __devinit sci_probe(struct platform_device *dev)
2374
2425
 
2375
2426
        ret = sci_probe_single(dev, dev->id, p, sp);
2376
2427
        if (ret)
2377
 
                goto err_unreg;
 
2428
                return ret;
2378
2429
 
2379
2430
        sp->freq_transition.notifier_call = sci_notifier;
2380
2431
 
2381
2432
        ret = cpufreq_register_notifier(&sp->freq_transition,
2382
2433
                                        CPUFREQ_TRANSITION_NOTIFIER);
2383
 
        if (unlikely(ret < 0))
2384
 
                goto err_unreg;
 
2434
        if (unlikely(ret < 0)) {
 
2435
                sci_cleanup_single(sp);
 
2436
                return ret;
 
2437
        }
2385
2438
 
2386
2439
#ifdef CONFIG_SH_STANDARD_BIOS
2387
2440
        sh_bios_gdb_detach();
2388
2441
#endif
2389
2442
 
2390
2443
        return 0;
2391
 
 
2392
 
err_unreg:
2393
 
        sci_remove(dev);
2394
 
        return ret;
2395
2444
}
2396
2445
 
2397
2446
static int sci_suspend(struct device *dev)