~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/scsi/g_NCR5380.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
286
286
{
287
287
        static int current_override = 0;
288
 
        int count, i;
 
288
        int count;
289
289
        unsigned int *ports;
 
290
#ifndef SCSI_G_NCR5380_MEM
 
291
        int i;
290
292
        unsigned long region_size = 16;
 
293
#endif
291
294
        static unsigned int __initdata ncr_53c400a_ports[] = {
292
295
                0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
293
296
        };
296
299
        };
297
300
        int flags = 0;
298
301
        struct Scsi_Host *instance;
299
 
#ifdef CONFIG_SCSI_G_NCR5380_MEM
 
302
#ifdef SCSI_G_NCR5380_MEM
300
303
        unsigned long base;
301
304
        void __iomem *iomem;
302
305
#endif
315
318
                overrides[0].board = BOARD_NCR53C400A;
316
319
        else if (dtc_3181e != NCR_NOT_SET)
317
320
                overrides[0].board = BOARD_DTC3181E;
318
 
 
 
321
#ifndef SCSI_G_NCR5380_MEM
319
322
        if (!current_override && isapnp_present()) {
320
323
                struct pnp_dev *dev = NULL;
321
324
                count = 0;
322
325
                while ((dev = pnp_find_dev(NULL, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev))) {
323
326
                        if (count >= NO_OVERRIDES)
324
327
                                break;
325
 
                        if (pnp_device_attach(dev) < 0) {
326
 
                                printk(KERN_ERR "dtc436e probe: attach failed\n");
 
328
                        if (pnp_device_attach(dev) < 0)
327
329
                                continue;
328
 
                        }
329
330
                        if (pnp_activate_dev(dev) < 0) {
330
331
                                printk(KERN_ERR "dtc436e probe: activate failed\n");
331
332
                                pnp_device_detach(dev);
349
350
                        count++;
350
351
                }
351
352
        }
352
 
 
 
353
#endif
353
354
        tpnt->proc_name = "g_NCR5380";
354
355
 
355
356
        for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
374
375
                        break;
375
376
                }
376
377
 
377
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
378
#ifndef SCSI_G_NCR5380_MEM
378
379
                if (ports) {
379
380
                        /* wakeup sequence for the NCR53C400A and DTC3181E */
380
381
 
436
437
#endif
437
438
                instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
438
439
                if (instance == NULL) {
439
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
440
#ifndef SCSI_G_NCR5380_MEM
440
441
                        release_region(overrides[current_override].NCR5380_map_name, region_size);
441
442
#else
442
443
                        iounmap(iomem);
446
447
                }
447
448
 
448
449
                instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
449
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
450
#ifndef SCSI_G_NCR5380_MEM
450
451
                instance->n_io_port = region_size;
451
452
#else
452
 
                ((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem;
 
453
                ((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
453
454
#endif
454
455
 
455
456
                NCR5380_init(instance, flags);
517
518
                free_irq(instance->irq, instance);
518
519
        NCR5380_exit(instance);
519
520
 
520
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
521
#ifndef SCSI_G_NCR5380_MEM
521
522
        release_region(instance->NCR5380_instance_name, instance->n_io_port);
522
523
#else
523
 
        iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem);
 
524
        iounmap(((struct NCR5380_hostdata *)instance->hostdata)->iomem);
524
525
        release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
525
526
#endif
526
527
 
590
591
                }
591
592
                while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
592
593
 
593
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
594
#ifndef SCSI_G_NCR5380_MEM
594
595
                {
595
596
                        int i;
596
597
                        for (i = 0; i < 128; i++)
597
598
                                dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
598
599
                }
599
600
#else
600
 
                /* implies CONFIG_SCSI_G_NCR5380_MEM */
 
601
                /* implies SCSI_G_NCR5380_MEM */
601
602
                memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
602
603
#endif
603
604
                start += 128;
610
611
                        // FIXME - no timeout
611
612
                }
612
613
 
613
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
614
#ifndef SCSI_G_NCR5380_MEM
614
615
                {
615
616
                        int i;  
616
617
                        for (i = 0; i < 128; i++)
617
618
                                dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
618
619
                }
619
620
#else
620
 
                /* implies CONFIG_SCSI_G_NCR5380_MEM */
 
621
                /* implies SCSI_G_NCR5380_MEM */
621
622
                memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
622
623
#endif
623
624
                start += 128;
676
677
                }
677
678
                while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
678
679
                        ; // FIXME - timeout
679
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
680
#ifndef SCSI_G_NCR5380_MEM
680
681
                {
681
682
                        for (i = 0; i < 128; i++)
682
683
                                NCR5380_write(C400_HOST_BUFFER, src[start + i]);
683
684
                }
684
685
#else
685
 
                /* implies CONFIG_SCSI_G_NCR5380_MEM */
 
686
                /* implies SCSI_G_NCR5380_MEM */
686
687
                memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
687
688
#endif
688
689
                start += 128;
692
693
                while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
693
694
                        ; // FIXME - no timeout
694
695
 
695
 
#ifndef CONFIG_SCSI_G_NCR5380_MEM
 
696
#ifndef SCSI_G_NCR5380_MEM
696
697
                {
697
698
                        for (i = 0; i < 128; i++)
698
699
                                NCR5380_write(C400_HOST_BUFFER, src[start + i]);
699
700
                }
700
701
#else
701
 
                /* implies CONFIG_SCSI_G_NCR5380_MEM */
 
702
                /* implies SCSI_G_NCR5380_MEM */
702
703
                memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
703
704
#endif
704
705
                start += 128;
938
939
module_param(dtc_3181e, int, 0);
939
940
MODULE_LICENSE("GPL");
940
941
 
941
 
 
 
942
#ifndef SCSI_G_NCR5380_MEM
942
943
static struct isapnp_device_id id_table[] __devinitdata = {
943
944
        {
944
945
         ISAPNP_ANY_ID, ISAPNP_ANY_ID,
948
949
};
949
950
 
950
951
MODULE_DEVICE_TABLE(isapnp, id_table);
951
 
 
 
952
#endif
952
953
 
953
954
__setup("ncr5380=", do_NCR5380_setup);
954
955
__setup("ncr53c400=", do_NCR53C400_setup);