diff options
Diffstat (limited to 'drivers')
120 files changed, 1364 insertions, 869 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 328826381a2d..b8d96ce37fc9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -260,6 +260,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
260 | { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ | 260 | { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ |
261 | { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ | 261 | { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ |
262 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | 262 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ |
263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ | ||
263 | 264 | ||
264 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 265 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
265 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 266 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -379,6 +380,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
379 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 380 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
380 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | 381 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ |
381 | { PCI_DEVICE(0x1b4b, 0x9123), | 382 | { PCI_DEVICE(0x1b4b, 0x9123), |
383 | .class = PCI_CLASS_STORAGE_SATA_AHCI, | ||
384 | .class_mask = 0xffffff, | ||
382 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 385 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
383 | 386 | ||
384 | /* Promise */ | 387 | /* Promise */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a31fe96f7de6..d4e52e214859 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4138,6 +4138,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4138 | * device and controller are SATA. | 4138 | * device and controller are SATA. |
4139 | */ | 4139 | */ |
4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, | 4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, |
4141 | { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, | ||
4141 | 4142 | ||
4142 | /* End Marker */ | 4143 | /* End Marker */ |
4143 | { } | 4144 | { } |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 5defc74973d7..600f6353ecf8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1099,9 +1099,9 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1099 | struct request_queue *q = sdev->request_queue; | 1099 | struct request_queue *q = sdev->request_queue; |
1100 | void *buf; | 1100 | void *buf; |
1101 | 1101 | ||
1102 | /* set the min alignment and padding */ | 1102 | sdev->sector_size = ATA_SECT_SIZE; |
1103 | blk_queue_update_dma_alignment(sdev->request_queue, | 1103 | |
1104 | ATA_DMA_PAD_SZ - 1); | 1104 | /* set DMA padding */ |
1105 | blk_queue_update_dma_pad(sdev->request_queue, | 1105 | blk_queue_update_dma_pad(sdev->request_queue, |
1106 | ATA_DMA_PAD_SZ - 1); | 1106 | ATA_DMA_PAD_SZ - 1); |
1107 | 1107 | ||
@@ -1115,13 +1115,25 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1115 | 1115 | ||
1116 | blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN); | 1116 | blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN); |
1117 | } else { | 1117 | } else { |
1118 | /* ATA devices must be sector aligned */ | ||
1119 | sdev->sector_size = ata_id_logical_sector_size(dev->id); | 1118 | sdev->sector_size = ata_id_logical_sector_size(dev->id); |
1120 | blk_queue_update_dma_alignment(sdev->request_queue, | ||
1121 | sdev->sector_size - 1); | ||
1122 | sdev->manage_start_stop = 1; | 1119 | sdev->manage_start_stop = 1; |
1123 | } | 1120 | } |
1124 | 1121 | ||
1122 | /* | ||
1123 | * ata_pio_sectors() expects buffer for each sector to not cross | ||
1124 | * page boundary. Enforce it by requiring buffers to be sector | ||
1125 | * aligned, which works iff sector_size is not larger than | ||
1126 | * PAGE_SIZE. ATAPI devices also need the alignment as | ||
1127 | * IDENTIFY_PACKET is executed as ATA_PROT_PIO. | ||
1128 | */ | ||
1129 | if (sdev->sector_size > PAGE_SIZE) | ||
1130 | ata_dev_printk(dev, KERN_WARNING, | ||
1131 | "sector_size=%u > PAGE_SIZE, PIO may malfunction\n", | ||
1132 | sdev->sector_size); | ||
1133 | |||
1134 | blk_queue_update_dma_alignment(sdev->request_queue, | ||
1135 | sdev->sector_size - 1); | ||
1136 | |||
1125 | if (dev->flags & ATA_DFLAG_AN) | 1137 | if (dev->flags & ATA_DFLAG_AN) |
1126 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); | 1138 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); |
1127 | 1139 | ||
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index d7e57db36bc8..538ec38ba995 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
26 | 26 | ||
27 | #define DRV_NAME "pata_hpt366" | 27 | #define DRV_NAME "pata_hpt366" |
28 | #define DRV_VERSION "0.6.9" | 28 | #define DRV_VERSION "0.6.10" |
29 | 29 | ||
30 | struct hpt_clock { | 30 | struct hpt_clock { |
31 | u8 xfer_mode; | 31 | u8 xfer_mode; |
@@ -160,8 +160,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, | |||
160 | 160 | ||
161 | while (list[i] != NULL) { | 161 | while (list[i] != NULL) { |
162 | if (!strcmp(list[i], model_num)) { | 162 | if (!strcmp(list[i], model_num)) { |
163 | printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n", | 163 | pr_warning(DRV_NAME ": %s is not supported for %s.\n", |
164 | modestr, list[i]); | 164 | modestr, list[i]); |
165 | return 1; | 165 | return 1; |
166 | } | 166 | } |
167 | i++; | 167 | i++; |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index efdd18bc8663..4c5b5183225e 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
25 | 25 | ||
26 | #define DRV_NAME "pata_hpt37x" | 26 | #define DRV_NAME "pata_hpt37x" |
27 | #define DRV_VERSION "0.6.18" | 27 | #define DRV_VERSION "0.6.22" |
28 | 28 | ||
29 | struct hpt_clock { | 29 | struct hpt_clock { |
30 | u8 xfer_speed; | 30 | u8 xfer_speed; |
@@ -229,8 +229,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, | |||
229 | 229 | ||
230 | while (list[i] != NULL) { | 230 | while (list[i] != NULL) { |
231 | if (!strcmp(list[i], model_num)) { | 231 | if (!strcmp(list[i], model_num)) { |
232 | printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n", | 232 | pr_warning(DRV_NAME ": %s is not supported for %s.\n", |
233 | modestr, list[i]); | 233 | modestr, list[i]); |
234 | return 1; | 234 | return 1; |
235 | } | 235 | } |
236 | i++; | 236 | i++; |
@@ -642,7 +642,6 @@ static struct ata_port_operations hpt372_port_ops = { | |||
642 | static struct ata_port_operations hpt374_fn1_port_ops = { | 642 | static struct ata_port_operations hpt374_fn1_port_ops = { |
643 | .inherits = &hpt372_port_ops, | 643 | .inherits = &hpt372_port_ops, |
644 | .cable_detect = hpt374_fn1_cable_detect, | 644 | .cable_detect = hpt374_fn1_cable_detect, |
645 | .prereset = hpt37x_pre_reset, | ||
646 | }; | 645 | }; |
647 | 646 | ||
648 | /** | 647 | /** |
@@ -803,7 +802,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
803 | .udma_mask = ATA_UDMA6, | 802 | .udma_mask = ATA_UDMA6, |
804 | .port_ops = &hpt302_port_ops | 803 | .port_ops = &hpt302_port_ops |
805 | }; | 804 | }; |
806 | /* HPT374 - UDMA100, function 1 uses different prereset method */ | 805 | /* HPT374 - UDMA100, function 1 uses different cable_detect method */ |
807 | static const struct ata_port_info info_hpt374_fn0 = { | 806 | static const struct ata_port_info info_hpt374_fn0 = { |
808 | .flags = ATA_FLAG_SLAVE_POSS, | 807 | .flags = ATA_FLAG_SLAVE_POSS, |
809 | .pio_mask = ATA_PIO4, | 808 | .pio_mask = ATA_PIO4, |
@@ -838,7 +837,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
838 | if (rc) | 837 | if (rc) |
839 | return rc; | 838 | return rc; |
840 | 839 | ||
841 | if (dev->device == PCI_DEVICE_ID_TTI_HPT366) { | 840 | switch (dev->device) { |
841 | case PCI_DEVICE_ID_TTI_HPT366: | ||
842 | /* May be a later chip in disguise. Check */ | 842 | /* May be a later chip in disguise. Check */ |
843 | /* Older chips are in the HPT366 driver. Ignore them */ | 843 | /* Older chips are in the HPT366 driver. Ignore them */ |
844 | if (rev < 3) | 844 | if (rev < 3) |
@@ -863,54 +863,50 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
863 | chip_table = &hpt372; | 863 | chip_table = &hpt372; |
864 | break; | 864 | break; |
865 | default: | 865 | default: |
866 | printk(KERN_ERR "pata_hpt37x: Unknown HPT366 subtype, " | 866 | pr_err(DRV_NAME ": Unknown HPT366 subtype, " |
867 | "please report (%d).\n", rev); | 867 | "please report (%d).\n", rev); |
868 | return -ENODEV; | 868 | return -ENODEV; |
869 | } | 869 | } |
870 | } else { | 870 | break; |
871 | switch (dev->device) { | 871 | case PCI_DEVICE_ID_TTI_HPT372: |
872 | case PCI_DEVICE_ID_TTI_HPT372: | 872 | /* 372N if rev >= 2 */ |
873 | /* 372N if rev >= 2 */ | 873 | if (rev >= 2) |
874 | if (rev >= 2) | 874 | return -ENODEV; |
875 | return -ENODEV; | 875 | ppi[0] = &info_hpt372; |
876 | ppi[0] = &info_hpt372; | 876 | chip_table = &hpt372a; |
877 | chip_table = &hpt372a; | 877 | break; |
878 | break; | 878 | case PCI_DEVICE_ID_TTI_HPT302: |
879 | case PCI_DEVICE_ID_TTI_HPT302: | 879 | /* 302N if rev > 1 */ |
880 | /* 302N if rev > 1 */ | 880 | if (rev > 1) |
881 | if (rev > 1) | 881 | return -ENODEV; |
882 | return -ENODEV; | 882 | ppi[0] = &info_hpt302; |
883 | ppi[0] = &info_hpt302; | 883 | /* Check this */ |
884 | /* Check this */ | 884 | chip_table = &hpt302; |
885 | chip_table = &hpt302; | 885 | break; |
886 | break; | 886 | case PCI_DEVICE_ID_TTI_HPT371: |
887 | case PCI_DEVICE_ID_TTI_HPT371: | 887 | if (rev > 1) |
888 | if (rev > 1) | 888 | return -ENODEV; |
889 | return -ENODEV; | 889 | ppi[0] = &info_hpt302; |
890 | ppi[0] = &info_hpt302; | 890 | chip_table = &hpt371; |
891 | chip_table = &hpt371; | 891 | /* |
892 | /* | 892 | * Single channel device, master is not present but the BIOS |
893 | * Single channel device, master is not present | 893 | * (or us for non x86) must mark it absent |
894 | * but the BIOS (or us for non x86) must mark it | 894 | */ |
895 | * absent | 895 | pci_read_config_byte(dev, 0x50, &mcr1); |
896 | */ | 896 | mcr1 &= ~0x04; |
897 | pci_read_config_byte(dev, 0x50, &mcr1); | 897 | pci_write_config_byte(dev, 0x50, mcr1); |
898 | mcr1 &= ~0x04; | 898 | break; |
899 | pci_write_config_byte(dev, 0x50, mcr1); | 899 | case PCI_DEVICE_ID_TTI_HPT374: |
900 | break; | 900 | chip_table = &hpt374; |
901 | case PCI_DEVICE_ID_TTI_HPT374: | 901 | if (!(PCI_FUNC(dev->devfn) & 1)) |
902 | chip_table = &hpt374; | 902 | *ppi = &info_hpt374_fn0; |
903 | if (!(PCI_FUNC(dev->devfn) & 1)) | 903 | else |
904 | *ppi = &info_hpt374_fn0; | 904 | *ppi = &info_hpt374_fn1; |
905 | else | 905 | break; |
906 | *ppi = &info_hpt374_fn1; | 906 | default: |
907 | break; | 907 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", |
908 | default: | 908 | dev->device); |
909 | printk(KERN_ERR | 909 | return -ENODEV; |
910 | "pata_hpt37x: PCI table is bogus, please report (%d).\n", | ||
911 | dev->device); | ||
912 | return -ENODEV; | ||
913 | } | ||
914 | } | 910 | } |
915 | /* Ok so this is a chip we support */ | 911 | /* Ok so this is a chip we support */ |
916 | 912 | ||
@@ -957,8 +953,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
957 | u8 sr; | 953 | u8 sr; |
958 | u32 total = 0; | 954 | u32 total = 0; |
959 | 955 | ||
960 | printk(KERN_WARNING | 956 | pr_warning(DRV_NAME ": BIOS has not set timing clocks.\n"); |
961 | "pata_hpt37x: BIOS has not set timing clocks.\n"); | ||
962 | 957 | ||
963 | /* This is the process the HPT371 BIOS is reported to use */ | 958 | /* This is the process the HPT371 BIOS is reported to use */ |
964 | for (i = 0; i < 128; i++) { | 959 | for (i = 0; i < 128; i++) { |
@@ -1014,7 +1009,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1014 | (f_high << 16) | f_low | 0x100); | 1009 | (f_high << 16) | f_low | 0x100); |
1015 | } | 1010 | } |
1016 | if (adjust == 8) { | 1011 | if (adjust == 8) { |
1017 | printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n"); | 1012 | pr_err(DRV_NAME ": DPLL did not stabilize!\n"); |
1018 | return -ENODEV; | 1013 | return -ENODEV; |
1019 | } | 1014 | } |
1020 | if (dpll == 3) | 1015 | if (dpll == 3) |
@@ -1022,8 +1017,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1022 | else | 1017 | else |
1023 | private_data = (void *)hpt37x_timings_50; | 1018 | private_data = (void *)hpt37x_timings_50; |
1024 | 1019 | ||
1025 | printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using %dMHz DPLL.\n", | 1020 | pr_info(DRV_NAME ": bus clock %dMHz, using %dMHz DPLL.\n", |
1026 | MHz[clock_slot], MHz[dpll]); | 1021 | MHz[clock_slot], MHz[dpll]); |
1027 | } else { | 1022 | } else { |
1028 | private_data = (void *)chip_table->clocks[clock_slot]; | 1023 | private_data = (void *)chip_table->clocks[clock_slot]; |
1029 | /* | 1024 | /* |
@@ -1036,8 +1031,9 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1036 | ppi[0] = &info_hpt370_33; | 1031 | ppi[0] = &info_hpt370_33; |
1037 | if (clock_slot < 2 && ppi[0] == &info_hpt370a) | 1032 | if (clock_slot < 2 && ppi[0] == &info_hpt370a) |
1038 | ppi[0] = &info_hpt370a_33; | 1033 | ppi[0] = &info_hpt370a_33; |
1039 | printk(KERN_INFO "pata_hpt37x: %s using %dMHz bus clock.\n", | 1034 | |
1040 | chip_table->name, MHz[clock_slot]); | 1035 | pr_info(DRV_NAME ": %s using %dMHz bus clock.\n", |
1036 | chip_table->name, MHz[clock_slot]); | ||
1041 | } | 1037 | } |
1042 | 1038 | ||
1043 | /* Now kick off ATA set up */ | 1039 | /* Now kick off ATA set up */ |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index d2239bbdb798..eca68caf5f46 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
26 | 26 | ||
27 | #define DRV_NAME "pata_hpt3x2n" | 27 | #define DRV_NAME "pata_hpt3x2n" |
28 | #define DRV_VERSION "0.3.13" | 28 | #define DRV_VERSION "0.3.14" |
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | HPT_PCI_FAST = (1 << 31), | 31 | HPT_PCI_FAST = (1 << 31), |
@@ -418,7 +418,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) | |||
418 | u16 sr; | 418 | u16 sr; |
419 | u32 total = 0; | 419 | u32 total = 0; |
420 | 420 | ||
421 | printk(KERN_WARNING "pata_hpt3x2n: BIOS clock data not set.\n"); | 421 | pr_warning(DRV_NAME ": BIOS clock data not set.\n"); |
422 | 422 | ||
423 | /* This is the process the HPT371 BIOS is reported to use */ | 423 | /* This is the process the HPT371 BIOS is reported to use */ |
424 | for (i = 0; i < 128; i++) { | 424 | for (i = 0; i < 128; i++) { |
@@ -528,8 +528,7 @@ hpt372n: | |||
528 | ppi[0] = &info_hpt372n; | 528 | ppi[0] = &info_hpt372n; |
529 | break; | 529 | break; |
530 | default: | 530 | default: |
531 | printk(KERN_ERR | 531 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", |
532 | "pata_hpt3x2n: PCI table is bogus please report (%d).\n", | ||
533 | dev->device); | 532 | dev->device); |
534 | return -ENODEV; | 533 | return -ENODEV; |
535 | } | 534 | } |
@@ -579,12 +578,11 @@ hpt372n: | |||
579 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); | 578 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); |
580 | } | 579 | } |
581 | if (adjust == 8) { | 580 | if (adjust == 8) { |
582 | printk(KERN_ERR "pata_hpt3x2n: DPLL did not stabilize!\n"); | 581 | pr_err(DRV_NAME ": DPLL did not stabilize!\n"); |
583 | return -ENODEV; | 582 | return -ENODEV; |
584 | } | 583 | } |
585 | 584 | ||
586 | printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using 66MHz DPLL.\n", | 585 | pr_info(DRV_NAME ": bus clock %dMHz, using 66MHz DPLL.\n", pci_mhz); |
587 | pci_mhz); | ||
588 | 586 | ||
589 | /* | 587 | /* |
590 | * Set our private data up. We only need a few flags | 588 | * Set our private data up. We only need a few flags |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 8cc536e49a0a..d7d8026cde99 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -610,7 +610,7 @@ static struct scsi_host_template mpc52xx_ata_sht = { | |||
610 | }; | 610 | }; |
611 | 611 | ||
612 | static struct ata_port_operations mpc52xx_ata_port_ops = { | 612 | static struct ata_port_operations mpc52xx_ata_port_ops = { |
613 | .inherits = &ata_sff_port_ops, | 613 | .inherits = &ata_bmdma_port_ops, |
614 | .sff_dev_select = mpc52xx_ata_dev_select, | 614 | .sff_dev_select = mpc52xx_ata_dev_select, |
615 | .set_piomode = mpc52xx_ata_set_piomode, | 615 | .set_piomode = mpc52xx_ata_set_piomode, |
616 | .set_dmamode = mpc52xx_ata_set_dmamode, | 616 | .set_dmamode = mpc52xx_ata_set_dmamode, |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index b34cc7372b52..92369655dca3 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -666,6 +666,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
666 | ret = -EINVAL; | 666 | ret = -EINVAL; |
667 | goto fail; | 667 | goto fail; |
668 | } | 668 | } |
669 | DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); | ||
670 | for (i = 0; i < set->num_connectors; i++) { | ||
671 | DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, | ||
672 | drm_get_connector_name(set->connectors[i])); | ||
673 | set->connectors[i]->dpms = DRM_MODE_DPMS_ON; | ||
674 | } | ||
669 | } | 675 | } |
670 | drm_helper_disable_unused_functions(dev); | 676 | drm_helper_disable_unused_functions(dev); |
671 | } else if (fb_changed) { | 677 | } else if (fb_changed) { |
@@ -682,12 +688,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
682 | goto fail; | 688 | goto fail; |
683 | } | 689 | } |
684 | } | 690 | } |
685 | DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); | ||
686 | for (i = 0; i < set->num_connectors; i++) { | ||
687 | DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, | ||
688 | drm_get_connector_name(set->connectors[i])); | ||
689 | set->connectors[i]->dpms = DRM_MODE_DPMS_ON; | ||
690 | } | ||
691 | 691 | ||
692 | kfree(save_connectors); | 692 | kfree(save_connectors); |
693 | kfree(save_encoders); | 693 | kfree(save_encoders); |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index e38be1bcc01c..fbbfa24cf572 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -1079,7 +1079,7 @@ static void ib_sa_remove_one(struct ib_device *device) | |||
1079 | 1079 | ||
1080 | ib_unregister_event_handler(&sa_dev->event_handler); | 1080 | ib_unregister_event_handler(&sa_dev->event_handler); |
1081 | 1081 | ||
1082 | flush_scheduled_work(); | 1082 | flush_workqueue(ib_wq); |
1083 | 1083 | ||
1084 | for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) { | 1084 | for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) { |
1085 | if (rdma_port_get_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND) { | 1085 | if (rdma_port_get_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND) { |
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index ca12acf38379..ec1e9da1488b 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -636,6 +636,16 @@ static void ucma_copy_iboe_route(struct rdma_ucm_query_route_resp *resp, | |||
636 | } | 636 | } |
637 | } | 637 | } |
638 | 638 | ||
639 | static void ucma_copy_iw_route(struct rdma_ucm_query_route_resp *resp, | ||
640 | struct rdma_route *route) | ||
641 | { | ||
642 | struct rdma_dev_addr *dev_addr; | ||
643 | |||
644 | dev_addr = &route->addr.dev_addr; | ||
645 | rdma_addr_get_dgid(dev_addr, (union ib_gid *) &resp->ib_route[0].dgid); | ||
646 | rdma_addr_get_sgid(dev_addr, (union ib_gid *) &resp->ib_route[0].sgid); | ||
647 | } | ||
648 | |||
639 | static ssize_t ucma_query_route(struct ucma_file *file, | 649 | static ssize_t ucma_query_route(struct ucma_file *file, |
640 | const char __user *inbuf, | 650 | const char __user *inbuf, |
641 | int in_len, int out_len) | 651 | int in_len, int out_len) |
@@ -670,8 +680,10 @@ static ssize_t ucma_query_route(struct ucma_file *file, | |||
670 | 680 | ||
671 | resp.node_guid = (__force __u64) ctx->cm_id->device->node_guid; | 681 | resp.node_guid = (__force __u64) ctx->cm_id->device->node_guid; |
672 | resp.port_num = ctx->cm_id->port_num; | 682 | resp.port_num = ctx->cm_id->port_num; |
673 | if (rdma_node_get_transport(ctx->cm_id->device->node_type) == RDMA_TRANSPORT_IB) { | 683 | switch (rdma_node_get_transport(ctx->cm_id->device->node_type)) { |
674 | switch (rdma_port_get_link_layer(ctx->cm_id->device, ctx->cm_id->port_num)) { | 684 | case RDMA_TRANSPORT_IB: |
685 | switch (rdma_port_get_link_layer(ctx->cm_id->device, | ||
686 | ctx->cm_id->port_num)) { | ||
675 | case IB_LINK_LAYER_INFINIBAND: | 687 | case IB_LINK_LAYER_INFINIBAND: |
676 | ucma_copy_ib_route(&resp, &ctx->cm_id->route); | 688 | ucma_copy_ib_route(&resp, &ctx->cm_id->route); |
677 | break; | 689 | break; |
@@ -681,6 +693,12 @@ static ssize_t ucma_query_route(struct ucma_file *file, | |||
681 | default: | 693 | default: |
682 | break; | 694 | break; |
683 | } | 695 | } |
696 | break; | ||
697 | case RDMA_TRANSPORT_IWARP: | ||
698 | ucma_copy_iw_route(&resp, &ctx->cm_id->route); | ||
699 | break; | ||
700 | default: | ||
701 | break; | ||
684 | } | 702 | } |
685 | 703 | ||
686 | out: | 704 | out: |
diff --git a/drivers/infiniband/hw/amso1100/c2_vq.c b/drivers/infiniband/hw/amso1100/c2_vq.c index 9ce7819b7b2e..2ec716fb2edb 100644 --- a/drivers/infiniband/hw/amso1100/c2_vq.c +++ b/drivers/infiniband/hw/amso1100/c2_vq.c | |||
@@ -107,7 +107,7 @@ struct c2_vq_req *vq_req_alloc(struct c2_dev *c2dev) | |||
107 | r = kmalloc(sizeof(struct c2_vq_req), GFP_KERNEL); | 107 | r = kmalloc(sizeof(struct c2_vq_req), GFP_KERNEL); |
108 | if (r) { | 108 | if (r) { |
109 | init_waitqueue_head(&r->wait_object); | 109 | init_waitqueue_head(&r->wait_object); |
110 | r->reply_msg = (u64) NULL; | 110 | r->reply_msg = 0; |
111 | r->event = 0; | 111 | r->event = 0; |
112 | r->cm_id = NULL; | 112 | r->cm_id = NULL; |
113 | r->qp = NULL; | 113 | r->qp = NULL; |
@@ -123,7 +123,7 @@ struct c2_vq_req *vq_req_alloc(struct c2_dev *c2dev) | |||
123 | */ | 123 | */ |
124 | void vq_req_free(struct c2_dev *c2dev, struct c2_vq_req *r) | 124 | void vq_req_free(struct c2_dev *c2dev, struct c2_vq_req *r) |
125 | { | 125 | { |
126 | r->reply_msg = (u64) NULL; | 126 | r->reply_msg = 0; |
127 | if (atomic_dec_and_test(&r->refcnt)) { | 127 | if (atomic_dec_and_test(&r->refcnt)) { |
128 | kfree(r); | 128 | kfree(r); |
129 | } | 129 | } |
@@ -151,7 +151,7 @@ void vq_req_get(struct c2_dev *c2dev, struct c2_vq_req *r) | |||
151 | void vq_req_put(struct c2_dev *c2dev, struct c2_vq_req *r) | 151 | void vq_req_put(struct c2_dev *c2dev, struct c2_vq_req *r) |
152 | { | 152 | { |
153 | if (atomic_dec_and_test(&r->refcnt)) { | 153 | if (atomic_dec_and_test(&r->refcnt)) { |
154 | if (r->reply_msg != (u64) NULL) | 154 | if (r->reply_msg != 0) |
155 | vq_repbuf_free(c2dev, | 155 | vq_repbuf_free(c2dev, |
156 | (void *) (unsigned long) r->reply_msg); | 156 | (void *) (unsigned long) r->reply_msg); |
157 | kfree(r); | 157 | kfree(r); |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 0dc62b1438be..8b00e6c46f01 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -380,7 +380,7 @@ static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb) | |||
380 | 16)) | FW_WR_FLOWID(ep->hwtid)); | 380 | 16)) | FW_WR_FLOWID(ep->hwtid)); |
381 | 381 | ||
382 | flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN; | 382 | flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN; |
383 | flowc->mnemval[0].val = cpu_to_be32(0); | 383 | flowc->mnemval[0].val = cpu_to_be32(PCI_FUNC(ep->com.dev->rdev.lldi.pdev->devfn) << 8); |
384 | flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH; | 384 | flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH; |
385 | flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); | 385 | flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); |
386 | flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT; | 386 | flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT; |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 20800900ef3f..4f0be25cab1a 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -220,7 +220,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, | |||
220 | V_FW_RI_RES_WR_DCAEN(0) | | 220 | V_FW_RI_RES_WR_DCAEN(0) | |
221 | V_FW_RI_RES_WR_DCACPU(0) | | 221 | V_FW_RI_RES_WR_DCACPU(0) | |
222 | V_FW_RI_RES_WR_FBMIN(2) | | 222 | V_FW_RI_RES_WR_FBMIN(2) | |
223 | V_FW_RI_RES_WR_FBMAX(3) | | 223 | V_FW_RI_RES_WR_FBMAX(2) | |
224 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | | 224 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | |
225 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | | 225 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | |
226 | V_FW_RI_RES_WR_EQSIZE(eqsize)); | 226 | V_FW_RI_RES_WR_EQSIZE(eqsize)); |
@@ -243,7 +243,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, | |||
243 | V_FW_RI_RES_WR_DCAEN(0) | | 243 | V_FW_RI_RES_WR_DCAEN(0) | |
244 | V_FW_RI_RES_WR_DCACPU(0) | | 244 | V_FW_RI_RES_WR_DCACPU(0) | |
245 | V_FW_RI_RES_WR_FBMIN(2) | | 245 | V_FW_RI_RES_WR_FBMIN(2) | |
246 | V_FW_RI_RES_WR_FBMAX(3) | | 246 | V_FW_RI_RES_WR_FBMAX(2) | |
247 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | | 247 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | |
248 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | | 248 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | |
249 | V_FW_RI_RES_WR_EQSIZE(eqsize)); | 249 | V_FW_RI_RES_WR_EQSIZE(eqsize)); |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 50cceb3ab885..b01809a82cb0 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -623,7 +623,6 @@ struct qib_chippport_specific { | |||
623 | u8 ibmalfusesnap; | 623 | u8 ibmalfusesnap; |
624 | struct qib_qsfp_data qsfp_data; | 624 | struct qib_qsfp_data qsfp_data; |
625 | char epmsgbuf[192]; /* for port error interrupt msg buffer */ | 625 | char epmsgbuf[192]; /* for port error interrupt msg buffer */ |
626 | u8 bounced; | ||
627 | }; | 626 | }; |
628 | 627 | ||
629 | static struct { | 628 | static struct { |
@@ -1881,23 +1880,7 @@ static noinline void handle_7322_p_errors(struct qib_pportdata *ppd) | |||
1881 | IB_PHYSPORTSTATE_DISABLED) | 1880 | IB_PHYSPORTSTATE_DISABLED) |
1882 | qib_set_ib_7322_lstate(ppd, 0, | 1881 | qib_set_ib_7322_lstate(ppd, 0, |
1883 | QLOGIC_IB_IBCC_LINKINITCMD_DISABLE); | 1882 | QLOGIC_IB_IBCC_LINKINITCMD_DISABLE); |
1884 | else { | 1883 | else |
1885 | u32 lstate; | ||
1886 | /* | ||
1887 | * We need the current logical link state before | ||
1888 | * lflags are set in handle_e_ibstatuschanged. | ||
1889 | */ | ||
1890 | lstate = qib_7322_iblink_state(ibcs); | ||
1891 | |||
1892 | if (IS_QMH(dd) && !ppd->cpspec->bounced && | ||
1893 | ltstate == IB_PHYSPORTSTATE_LINKUP && | ||
1894 | (lstate >= IB_PORT_INIT && | ||
1895 | lstate <= IB_PORT_ACTIVE)) { | ||
1896 | ppd->cpspec->bounced = 1; | ||
1897 | qib_7322_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE, | ||
1898 | IB_LINKCMD_DOWN | IB_LINKINITCMD_POLL); | ||
1899 | } | ||
1900 | |||
1901 | /* | 1884 | /* |
1902 | * Since going into a recovery state causes the link | 1885 | * Since going into a recovery state causes the link |
1903 | * state to go down and since recovery is transitory, | 1886 | * state to go down and since recovery is transitory, |
@@ -1911,7 +1894,6 @@ static noinline void handle_7322_p_errors(struct qib_pportdata *ppd) | |||
1911 | ltstate != IB_PHYSPORTSTATE_RECOVERY_WAITRMT && | 1894 | ltstate != IB_PHYSPORTSTATE_RECOVERY_WAITRMT && |
1912 | ltstate != IB_PHYSPORTSTATE_RECOVERY_IDLE) | 1895 | ltstate != IB_PHYSPORTSTATE_RECOVERY_IDLE) |
1913 | qib_handle_e_ibstatuschanged(ppd, ibcs); | 1896 | qib_handle_e_ibstatuschanged(ppd, ibcs); |
1914 | } | ||
1915 | } | 1897 | } |
1916 | if (*msg && iserr) | 1898 | if (*msg && iserr) |
1917 | qib_dev_porterr(dd, ppd->port, "%s error\n", msg); | 1899 | qib_dev_porterr(dd, ppd->port, "%s error\n", msg); |
@@ -2381,6 +2363,11 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd) | |||
2381 | qib_write_kreg_port(ppd, krp_rcvctrl, ppd->p_rcvctrl); | 2363 | qib_write_kreg_port(ppd, krp_rcvctrl, ppd->p_rcvctrl); |
2382 | spin_unlock_irqrestore(&dd->cspec->rcvmod_lock, flags); | 2364 | spin_unlock_irqrestore(&dd->cspec->rcvmod_lock, flags); |
2383 | 2365 | ||
2366 | /* Hold the link state machine for mezz boards */ | ||
2367 | if (IS_QMH(dd) || IS_QME(dd)) | ||
2368 | qib_set_ib_7322_lstate(ppd, 0, | ||
2369 | QLOGIC_IB_IBCC_LINKINITCMD_DISABLE); | ||
2370 | |||
2384 | /* Also enable IBSTATUSCHG interrupt. */ | 2371 | /* Also enable IBSTATUSCHG interrupt. */ |
2385 | val = qib_read_kreg_port(ppd, krp_errmask); | 2372 | val = qib_read_kreg_port(ppd, krp_errmask); |
2386 | qib_write_kreg_port(ppd, krp_errmask, | 2373 | qib_write_kreg_port(ppd, krp_errmask, |
@@ -5702,6 +5689,11 @@ static void set_no_qsfp_atten(struct qib_devdata *dd, int change) | |||
5702 | ppd->cpspec->h1_val = h1; | 5689 | ppd->cpspec->h1_val = h1; |
5703 | /* now change the IBC and serdes, overriding generic */ | 5690 | /* now change the IBC and serdes, overriding generic */ |
5704 | init_txdds_table(ppd, 1); | 5691 | init_txdds_table(ppd, 1); |
5692 | /* Re-enable the physical state machine on mezz boards | ||
5693 | * now that the correct settings have been set. */ | ||
5694 | if (IS_QMH(dd) || IS_QME(dd)) | ||
5695 | qib_set_ib_7322_lstate(ppd, 0, | ||
5696 | QLOGIC_IB_IBCC_LINKINITCMD_SLEEP); | ||
5705 | any++; | 5697 | any++; |
5706 | } | 5698 | } |
5707 | if (*nxt == '\n') | 5699 | if (*nxt == '\n') |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 939476659ad6..ac471b77c18e 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -86,7 +86,7 @@ static const u32 tegra_kbc_default_keymap[] = { | |||
86 | KEY(0, 5, KEY_Z), | 86 | KEY(0, 5, KEY_Z), |
87 | KEY(0, 7, KEY_FN), | 87 | KEY(0, 7, KEY_FN), |
88 | 88 | ||
89 | KEY(1, 7, KEY_MENU), | 89 | KEY(1, 7, KEY_LEFTMETA), |
90 | 90 | ||
91 | KEY(2, 6, KEY_RIGHTALT), | 91 | KEY(2, 6, KEY_RIGHTALT), |
92 | KEY(2, 7, KEY_LEFTALT), | 92 | KEY(2, 7, KEY_LEFTALT), |
@@ -355,8 +355,8 @@ static void tegra_kbc_config_pins(struct tegra_kbc *kbc) | |||
355 | for (i = 0; i < KBC_MAX_GPIO; i++) { | 355 | for (i = 0; i < KBC_MAX_GPIO; i++) { |
356 | u32 r_shft = 5 * (i % 6); | 356 | u32 r_shft = 5 * (i % 6); |
357 | u32 c_shft = 4 * (i % 8); | 357 | u32 c_shft = 4 * (i % 8); |
358 | u32 r_mask = 0x1f << r_shift; | 358 | u32 r_mask = 0x1f << r_shft; |
359 | u32 c_mask = 0x0f << c_shift; | 359 | u32 c_mask = 0x0f << c_shft; |
360 | u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0; | 360 | u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0; |
361 | u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0; | 361 | u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0; |
362 | u32 row_cfg = readl(kbc->mmio + r_offs); | 362 | u32 row_cfg = readl(kbc->mmio + r_offs); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index da392c22fc6c..aa186cf6c514 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -755,23 +755,26 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
755 | { | 755 | { |
756 | struct synaptics_data *priv = psmouse->private; | 756 | struct synaptics_data *priv = psmouse->private; |
757 | struct synaptics_data old_priv = *priv; | 757 | struct synaptics_data old_priv = *priv; |
758 | int retry = 0; | ||
759 | int error; | ||
758 | 760 | ||
759 | psmouse_reset(psmouse); | 761 | do { |
762 | psmouse_reset(psmouse); | ||
763 | error = synaptics_detect(psmouse, 0); | ||
764 | } while (error && ++retry < 3); | ||
760 | 765 | ||
761 | if (synaptics_detect(psmouse, 0)) | 766 | if (error) |
762 | return -1; | 767 | return -1; |
763 | 768 | ||
769 | if (retry > 1) | ||
770 | printk(KERN_DEBUG "Synaptics reconnected after %d tries\n", | ||
771 | retry); | ||
772 | |||
764 | if (synaptics_query_hardware(psmouse)) { | 773 | if (synaptics_query_hardware(psmouse)) { |
765 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); | 774 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); |
766 | return -1; | 775 | return -1; |
767 | } | 776 | } |
768 | 777 | ||
769 | if (old_priv.identity != priv->identity || | ||
770 | old_priv.model_id != priv->model_id || | ||
771 | old_priv.capabilities != priv->capabilities || | ||
772 | old_priv.ext_cap != priv->ext_cap) | ||
773 | return -1; | ||
774 | |||
775 | if (synaptics_set_absolute_mode(psmouse)) { | 778 | if (synaptics_set_absolute_mode(psmouse)) { |
776 | printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); | 779 | printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); |
777 | return -1; | 780 | return -1; |
@@ -782,6 +785,19 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
782 | return -1; | 785 | return -1; |
783 | } | 786 | } |
784 | 787 | ||
788 | if (old_priv.identity != priv->identity || | ||
789 | old_priv.model_id != priv->model_id || | ||
790 | old_priv.capabilities != priv->capabilities || | ||
791 | old_priv.ext_cap != priv->ext_cap) { | ||
792 | printk(KERN_ERR "Synaptics hardware appears to be different: " | ||
793 | "id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n", | ||
794 | old_priv.identity, priv->identity, | ||
795 | old_priv.model_id, priv->model_id, | ||
796 | old_priv.capabilities, priv->capabilities, | ||
797 | old_priv.ext_cap, priv->ext_cap); | ||
798 | return -1; | ||
799 | } | ||
800 | |||
785 | return 0; | 801 | return 0; |
786 | } | 802 | } |
787 | 803 | ||
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index f011c5d9dea1..1c5cc65ea1e1 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ir-lirc-codec.c - ir-core to classic lirc interface bridge | 1 | /* ir-lirc-codec.c - rc-core to classic lirc interface bridge |
2 | * | 2 | * |
3 | * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> | 3 | * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> |
4 | * | 4 | * |
@@ -47,6 +47,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
47 | /* Carrier reports */ | 47 | /* Carrier reports */ |
48 | if (ev.carrier_report) { | 48 | if (ev.carrier_report) { |
49 | sample = LIRC_FREQUENCY(ev.carrier); | 49 | sample = LIRC_FREQUENCY(ev.carrier); |
50 | IR_dprintk(2, "carrier report (freq: %d)\n", sample); | ||
50 | 51 | ||
51 | /* Packet end */ | 52 | /* Packet end */ |
52 | } else if (ev.timeout) { | 53 | } else if (ev.timeout) { |
@@ -62,6 +63,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
62 | return 0; | 63 | return 0; |
63 | 64 | ||
64 | sample = LIRC_TIMEOUT(ev.duration / 1000); | 65 | sample = LIRC_TIMEOUT(ev.duration / 1000); |
66 | IR_dprintk(2, "timeout report (duration: %d)\n", sample); | ||
65 | 67 | ||
66 | /* Normal sample */ | 68 | /* Normal sample */ |
67 | } else { | 69 | } else { |
@@ -85,6 +87,8 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
85 | 87 | ||
86 | sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) : | 88 | sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) : |
87 | LIRC_SPACE(ev.duration / 1000); | 89 | LIRC_SPACE(ev.duration / 1000); |
90 | IR_dprintk(2, "delivering %uus %s to lirc_dev\n", | ||
91 | TO_US(ev.duration), TO_STR(ev.pulse)); | ||
88 | } | 92 | } |
89 | 93 | ||
90 | lirc_buffer_write(dev->raw->lirc.drv->rbuf, | 94 | lirc_buffer_write(dev->raw->lirc.drv->rbuf, |
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index 3bf3337875d1..2f5dc0622b94 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c | |||
@@ -3,6 +3,9 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | 4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> |
5 | * | 5 | * |
6 | * See http://mediacenterguides.com/book/export/html/31 for details on | ||
7 | * key mappings. | ||
8 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
@@ -60,6 +63,9 @@ static struct rc_map_table rc6_mce[] = { | |||
60 | { 0x800f0426, KEY_EPG }, /* Guide */ | 63 | { 0x800f0426, KEY_EPG }, /* Guide */ |
61 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ | 64 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ |
62 | 65 | ||
66 | { 0x800f0432, KEY_MODE }, /* Visualization */ | ||
67 | { 0x800f0433, KEY_PRESENTATION }, /* Slide Show */ | ||
68 | { 0x800f0434, KEY_EJECTCD }, | ||
63 | { 0x800f043a, KEY_BRIGHTNESSUP }, | 69 | { 0x800f043a, KEY_BRIGHTNESSUP }, |
64 | 70 | ||
65 | { 0x800f0446, KEY_TV }, | 71 | { 0x800f0446, KEY_TV }, |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 079353e5d558..6df0a4980645 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -816,7 +816,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index) | |||
816 | switch (ir->buf_in[index]) { | 816 | switch (ir->buf_in[index]) { |
817 | /* 2-byte return value commands */ | 817 | /* 2-byte return value commands */ |
818 | case MCE_CMD_S_TIMEOUT: | 818 | case MCE_CMD_S_TIMEOUT: |
819 | ir->rc->timeout = MS_TO_NS((hi << 8 | lo) / 2); | 819 | ir->rc->timeout = US_TO_NS((hi << 8 | lo) / 2); |
820 | break; | 820 | break; |
821 | 821 | ||
822 | /* 1-byte return value commands */ | 822 | /* 1-byte return value commands */ |
@@ -855,9 +855,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
855 | break; | 855 | break; |
856 | case PARSE_IRDATA: | 856 | case PARSE_IRDATA: |
857 | ir->rem--; | 857 | ir->rem--; |
858 | init_ir_raw_event(&rawir); | ||
858 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); | 859 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); |
859 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) | 860 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) |
860 | * MS_TO_US(MCE_TIME_UNIT); | 861 | * US_TO_NS(MCE_TIME_UNIT); |
861 | 862 | ||
862 | dev_dbg(ir->dev, "Storing %s with duration %d\n", | 863 | dev_dbg(ir->dev, "Storing %s with duration %d\n", |
863 | rawir.pulse ? "pulse" : "space", | 864 | rawir.pulse ? "pulse" : "space", |
@@ -883,6 +884,8 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
883 | i, ir->rem + 1, false); | 884 | i, ir->rem + 1, false); |
884 | if (ir->rem) | 885 | if (ir->rem) |
885 | ir->parser_state = PARSE_IRDATA; | 886 | ir->parser_state = PARSE_IRDATA; |
887 | else | ||
888 | ir_raw_event_reset(ir->rc); | ||
886 | break; | 889 | break; |
887 | } | 890 | } |
888 | 891 | ||
@@ -1060,7 +1063,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) | |||
1060 | rc->priv = ir; | 1063 | rc->priv = ir; |
1061 | rc->driver_type = RC_DRIVER_IR_RAW; | 1064 | rc->driver_type = RC_DRIVER_IR_RAW; |
1062 | rc->allowed_protos = RC_TYPE_ALL; | 1065 | rc->allowed_protos = RC_TYPE_ALL; |
1063 | rc->timeout = MS_TO_NS(1000); | 1066 | rc->timeout = US_TO_NS(1000); |
1064 | if (!ir->flags.no_tx) { | 1067 | if (!ir->flags.no_tx) { |
1065 | rc->s_tx_mask = mceusb_set_tx_mask; | 1068 | rc->s_tx_mask = mceusb_set_tx_mask; |
1066 | rc->s_tx_carrier = mceusb_set_tx_carrier; | 1069 | rc->s_tx_carrier = mceusb_set_tx_carrier; |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index dd4caf8ef80b..273d9d674792 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
@@ -460,7 +460,7 @@ static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) | |||
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | 462 | ||
463 | carrier = (count * 1000000) / duration; | 463 | carrier = MS_TO_NS(count) / duration; |
464 | 464 | ||
465 | if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER)) | 465 | if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER)) |
466 | nvt_dbg("WTF? Carrier frequency out of range!"); | 466 | nvt_dbg("WTF? Carrier frequency out of range!"); |
@@ -612,8 +612,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
612 | sample = nvt->buf[i]; | 612 | sample = nvt->buf[i]; |
613 | 613 | ||
614 | rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); | 614 | rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); |
615 | rawir.duration = (sample & BUF_LEN_MASK) | 615 | rawir.duration = US_TO_NS((sample & BUF_LEN_MASK) |
616 | * SAMPLE_PERIOD * 1000; | 616 | * SAMPLE_PERIOD); |
617 | 617 | ||
618 | if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { | 618 | if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { |
619 | if (nvt->rawir.pulse == rawir.pulse) | 619 | if (nvt->rawir.pulse == rawir.pulse) |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 72be8a02118c..512a2f4ada0e 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -458,21 +458,27 @@ static int ir_getkeycode(struct input_dev *idev, | |||
458 | index = ir_lookup_by_scancode(rc_map, scancode); | 458 | index = ir_lookup_by_scancode(rc_map, scancode); |
459 | } | 459 | } |
460 | 460 | ||
461 | if (index >= rc_map->len) { | 461 | if (index < rc_map->len) { |
462 | if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) | 462 | entry = &rc_map->scan[index]; |
463 | IR_dprintk(1, "unknown key for scancode 0x%04x\n", | 463 | |
464 | scancode); | 464 | ke->index = index; |
465 | ke->keycode = entry->keycode; | ||
466 | ke->len = sizeof(entry->scancode); | ||
467 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | ||
468 | |||
469 | } else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) { | ||
470 | /* | ||
471 | * We do not really know the valid range of scancodes | ||
472 | * so let's respond with KEY_RESERVED to anything we | ||
473 | * do not have mapping for [yet]. | ||
474 | */ | ||
475 | ke->index = index; | ||
476 | ke->keycode = KEY_RESERVED; | ||
477 | } else { | ||
465 | retval = -EINVAL; | 478 | retval = -EINVAL; |
466 | goto out; | 479 | goto out; |
467 | } | 480 | } |
468 | 481 | ||
469 | entry = &rc_map->scan[index]; | ||
470 | |||
471 | ke->index = index; | ||
472 | ke->keycode = entry->keycode; | ||
473 | ke->len = sizeof(entry->scancode); | ||
474 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | ||
475 | |||
476 | retval = 0; | 482 | retval = 0; |
477 | 483 | ||
478 | out: | 484 | out: |
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index 6e2911c2abfb..e435d94c0776 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c | |||
@@ -164,7 +164,7 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
164 | sz->signal_start.tv_usec - | 164 | sz->signal_start.tv_usec - |
165 | sz->signal_last.tv_usec); | 165 | sz->signal_last.tv_usec); |
166 | rawir.duration -= sz->sum; | 166 | rawir.duration -= sz->sum; |
167 | rawir.duration *= 1000; | 167 | rawir.duration = US_TO_NS(rawir.duration); |
168 | rawir.duration &= IR_MAX_DURATION; | 168 | rawir.duration &= IR_MAX_DURATION; |
169 | } | 169 | } |
170 | sz_push(sz, rawir); | 170 | sz_push(sz, rawir); |
@@ -177,7 +177,7 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
177 | rawir.duration = ((int) value) * SZ_RESOLUTION; | 177 | rawir.duration = ((int) value) * SZ_RESOLUTION; |
178 | rawir.duration += SZ_RESOLUTION / 2; | 178 | rawir.duration += SZ_RESOLUTION / 2; |
179 | sz->sum += rawir.duration; | 179 | sz->sum += rawir.duration; |
180 | rawir.duration *= 1000; | 180 | rawir.duration = US_TO_NS(rawir.duration); |
181 | rawir.duration &= IR_MAX_DURATION; | 181 | rawir.duration &= IR_MAX_DURATION; |
182 | sz_push(sz, rawir); | 182 | sz_push(sz, rawir); |
183 | } | 183 | } |
@@ -197,7 +197,7 @@ static void sz_push_full_space(struct streamzap_ir *sz, | |||
197 | rawir.duration = ((int) value) * SZ_RESOLUTION; | 197 | rawir.duration = ((int) value) * SZ_RESOLUTION; |
198 | rawir.duration += SZ_RESOLUTION / 2; | 198 | rawir.duration += SZ_RESOLUTION / 2; |
199 | sz->sum += rawir.duration; | 199 | sz->sum += rawir.duration; |
200 | rawir.duration *= 1000; | 200 | rawir.duration = US_TO_NS(rawir.duration); |
201 | sz_push(sz, rawir); | 201 | sz_push(sz, rawir); |
202 | } | 202 | } |
203 | 203 | ||
@@ -273,6 +273,7 @@ static void streamzap_callback(struct urb *urb) | |||
273 | if (sz->timeout_enabled) | 273 | if (sz->timeout_enabled) |
274 | sz_push(sz, rawir); | 274 | sz_push(sz, rawir); |
275 | ir_raw_event_handle(sz->rdev); | 275 | ir_raw_event_handle(sz->rdev); |
276 | ir_raw_event_reset(sz->rdev); | ||
276 | } else { | 277 | } else { |
277 | sz_push_full_space(sz, sz->buf_in[i]); | 278 | sz_push_full_space(sz, sz->buf_in[i]); |
278 | } | 279 | } |
@@ -290,6 +291,7 @@ static void streamzap_callback(struct urb *urb) | |||
290 | } | 291 | } |
291 | } | 292 | } |
292 | 293 | ||
294 | ir_raw_event_handle(sz->rdev); | ||
293 | usb_submit_urb(urb, GFP_ATOMIC); | 295 | usb_submit_urb(urb, GFP_ATOMIC); |
294 | 296 | ||
295 | return; | 297 | return; |
@@ -430,13 +432,13 @@ static int __devinit streamzap_probe(struct usb_interface *intf, | |||
430 | sz->decoder_state = PulseSpace; | 432 | sz->decoder_state = PulseSpace; |
431 | /* FIXME: don't yet have a way to set this */ | 433 | /* FIXME: don't yet have a way to set this */ |
432 | sz->timeout_enabled = true; | 434 | sz->timeout_enabled = true; |
433 | sz->rdev->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & | 435 | sz->rdev->timeout = ((US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION) & |
434 | IR_MAX_DURATION) | 0x03000000); | 436 | IR_MAX_DURATION) | 0x03000000); |
435 | #if 0 | 437 | #if 0 |
436 | /* not yet supported, depends on patches from maxim */ | 438 | /* not yet supported, depends on patches from maxim */ |
437 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ | 439 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ |
438 | sz->min_timeout = SZ_TIMEOUT * SZ_RESOLUTION * 1000; | 440 | sz->min_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION); |
439 | sz->max_timeout = SZ_TIMEOUT * SZ_RESOLUTION * 1000; | 441 | sz->max_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION); |
440 | #endif | 442 | #endif |
441 | 443 | ||
442 | do_gettimeofday(&sz->signal_start); | 444 | do_gettimeofday(&sz->signal_start); |
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index 865216e9362c..47236a58bf33 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -5793,7 +5793,7 @@ static void usb_exchange(struct gspca_dev *gspca_dev, | |||
5793 | break; | 5793 | break; |
5794 | default: | 5794 | default: |
5795 | /* case 0xdd: * delay */ | 5795 | /* case 0xdd: * delay */ |
5796 | msleep(action->val / 64 + 10); | 5796 | msleep(action->idx); |
5797 | break; | 5797 | break; |
5798 | } | 5798 | } |
5799 | action++; | 5799 | action++; |
@@ -5830,7 +5830,7 @@ static void setmatrix(struct gspca_dev *gspca_dev) | |||
5830 | [SENSOR_GC0305] = gc0305_matrix, | 5830 | [SENSOR_GC0305] = gc0305_matrix, |
5831 | [SENSOR_HDCS2020b] = NULL, | 5831 | [SENSOR_HDCS2020b] = NULL, |
5832 | [SENSOR_HV7131B] = NULL, | 5832 | [SENSOR_HV7131B] = NULL, |
5833 | [SENSOR_HV7131R] = NULL, | 5833 | [SENSOR_HV7131R] = po2030_matrix, |
5834 | [SENSOR_ICM105A] = po2030_matrix, | 5834 | [SENSOR_ICM105A] = po2030_matrix, |
5835 | [SENSOR_MC501CB] = NULL, | 5835 | [SENSOR_MC501CB] = NULL, |
5836 | [SENSOR_MT9V111_1] = gc0305_matrix, | 5836 | [SENSOR_MT9V111_1] = gc0305_matrix, |
@@ -5936,6 +5936,7 @@ static void setquality(struct gspca_dev *gspca_dev) | |||
5936 | case SENSOR_ADCM2700: | 5936 | case SENSOR_ADCM2700: |
5937 | case SENSOR_GC0305: | 5937 | case SENSOR_GC0305: |
5938 | case SENSOR_HV7131B: | 5938 | case SENSOR_HV7131B: |
5939 | case SENSOR_HV7131R: | ||
5939 | case SENSOR_OV7620: | 5940 | case SENSOR_OV7620: |
5940 | case SENSOR_PAS202B: | 5941 | case SENSOR_PAS202B: |
5941 | case SENSOR_PO2030: | 5942 | case SENSOR_PO2030: |
@@ -6108,11 +6109,13 @@ static void send_unknown(struct gspca_dev *gspca_dev, int sensor) | |||
6108 | reg_w(gspca_dev, 0x02, 0x003b); | 6109 | reg_w(gspca_dev, 0x02, 0x003b); |
6109 | reg_w(gspca_dev, 0x00, 0x0038); | 6110 | reg_w(gspca_dev, 0x00, 0x0038); |
6110 | break; | 6111 | break; |
6112 | case SENSOR_HV7131R: | ||
6111 | case SENSOR_PAS202B: | 6113 | case SENSOR_PAS202B: |
6112 | reg_w(gspca_dev, 0x03, 0x003b); | 6114 | reg_w(gspca_dev, 0x03, 0x003b); |
6113 | reg_w(gspca_dev, 0x0c, 0x003a); | 6115 | reg_w(gspca_dev, 0x0c, 0x003a); |
6114 | reg_w(gspca_dev, 0x0b, 0x0039); | 6116 | reg_w(gspca_dev, 0x0b, 0x0039); |
6115 | reg_w(gspca_dev, 0x0b, 0x0038); | 6117 | if (sensor == SENSOR_PAS202B) |
6118 | reg_w(gspca_dev, 0x0b, 0x0038); | ||
6116 | break; | 6119 | break; |
6117 | } | 6120 | } |
6118 | } | 6121 | } |
@@ -6704,10 +6707,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
6704 | reg_w(gspca_dev, 0x02, 0x003b); | 6707 | reg_w(gspca_dev, 0x02, 0x003b); |
6705 | reg_w(gspca_dev, 0x00, 0x0038); | 6708 | reg_w(gspca_dev, 0x00, 0x0038); |
6706 | break; | 6709 | break; |
6710 | case SENSOR_HV7131R: | ||
6707 | case SENSOR_PAS202B: | 6711 | case SENSOR_PAS202B: |
6708 | reg_w(gspca_dev, 0x03, 0x003b); | 6712 | reg_w(gspca_dev, 0x03, 0x003b); |
6709 | reg_w(gspca_dev, 0x0c, 0x003a); | 6713 | reg_w(gspca_dev, 0x0c, 0x003a); |
6710 | reg_w(gspca_dev, 0x0b, 0x0039); | 6714 | reg_w(gspca_dev, 0x0b, 0x0039); |
6715 | if (sd->sensor == SENSOR_HV7131R) | ||
6716 | reg_w(gspca_dev, 0x50, ZC3XX_R11D_GLOBALGAIN); | ||
6711 | break; | 6717 | break; |
6712 | } | 6718 | } |
6713 | 6719 | ||
@@ -6720,6 +6726,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
6720 | break; | 6726 | break; |
6721 | case SENSOR_PAS202B: | 6727 | case SENSOR_PAS202B: |
6722 | case SENSOR_GC0305: | 6728 | case SENSOR_GC0305: |
6729 | case SENSOR_HV7131R: | ||
6723 | case SENSOR_TAS5130C: | 6730 | case SENSOR_TAS5130C: |
6724 | reg_r(gspca_dev, 0x0008); | 6731 | reg_r(gspca_dev, 0x0008); |
6725 | /* fall thru */ | 6732 | /* fall thru */ |
@@ -6760,6 +6767,12 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
6760 | /* ms-win + */ | 6767 | /* ms-win + */ |
6761 | reg_w(gspca_dev, 0x40, 0x0117); | 6768 | reg_w(gspca_dev, 0x40, 0x0117); |
6762 | break; | 6769 | break; |
6770 | case SENSOR_HV7131R: | ||
6771 | i2c_write(gspca_dev, 0x25, 0x04, 0x00); /* exposure */ | ||
6772 | i2c_write(gspca_dev, 0x26, 0x93, 0x00); | ||
6773 | i2c_write(gspca_dev, 0x27, 0xe0, 0x00); | ||
6774 | reg_w(gspca_dev, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN); | ||
6775 | break; | ||
6763 | case SENSOR_GC0305: | 6776 | case SENSOR_GC0305: |
6764 | case SENSOR_TAS5130C: | 6777 | case SENSOR_TAS5130C: |
6765 | reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */ | 6778 | reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */ |
@@ -6808,9 +6821,17 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
6808 | { | 6821 | { |
6809 | struct sd *sd = (struct sd *) gspca_dev; | 6822 | struct sd *sd = (struct sd *) gspca_dev; |
6810 | 6823 | ||
6811 | if (data[0] == 0xff && data[1] == 0xd8) { /* start of frame */ | 6824 | /* check the JPEG end of frame */ |
6825 | if (len >= 3 | ||
6826 | && data[len - 3] == 0xff && data[len - 2] == 0xd9) { | ||
6827 | /*fixme: what does the last byte mean?*/ | ||
6812 | gspca_frame_add(gspca_dev, LAST_PACKET, | 6828 | gspca_frame_add(gspca_dev, LAST_PACKET, |
6813 | NULL, 0); | 6829 | data, len - 1); |
6830 | return; | ||
6831 | } | ||
6832 | |||
6833 | /* check the JPEG start of a frame */ | ||
6834 | if (data[0] == 0xff && data[1] == 0xd8) { | ||
6814 | /* put the JPEG header in the new frame */ | 6835 | /* put the JPEG header in the new frame */ |
6815 | gspca_frame_add(gspca_dev, FIRST_PACKET, | 6836 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
6816 | sd->jpeg_hdr, JPEG_HDR_SZ); | 6837 | sd->jpeg_hdr, JPEG_HDR_SZ); |
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c index a6572e5ae369..a27d93b503a5 100644 --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c | |||
@@ -283,6 +283,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
283 | struct hdpvr_device *dev; | 283 | struct hdpvr_device *dev; |
284 | struct usb_host_interface *iface_desc; | 284 | struct usb_host_interface *iface_desc; |
285 | struct usb_endpoint_descriptor *endpoint; | 285 | struct usb_endpoint_descriptor *endpoint; |
286 | struct i2c_client *client; | ||
286 | size_t buffer_size; | 287 | size_t buffer_size; |
287 | int i; | 288 | int i; |
288 | int retval = -ENOMEM; | 289 | int retval = -ENOMEM; |
@@ -381,13 +382,21 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
381 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 382 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
382 | retval = hdpvr_register_i2c_adapter(dev); | 383 | retval = hdpvr_register_i2c_adapter(dev); |
383 | if (retval < 0) { | 384 | if (retval < 0) { |
384 | v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n"); | 385 | v4l2_err(&dev->v4l2_dev, "i2c adapter register failed\n"); |
385 | goto error; | 386 | goto error; |
386 | } | 387 | } |
387 | 388 | ||
388 | retval = hdpvr_register_i2c_ir(dev); | 389 | client = hdpvr_register_ir_rx_i2c(dev); |
389 | if (retval < 0) | 390 | if (!client) { |
390 | v4l2_err(&dev->v4l2_dev, "registering i2c IR devices failed\n"); | 391 | v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n"); |
392 | goto reg_fail; | ||
393 | } | ||
394 | |||
395 | client = hdpvr_register_ir_tx_i2c(dev); | ||
396 | if (!client) { | ||
397 | v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n"); | ||
398 | goto reg_fail; | ||
399 | } | ||
391 | #endif | 400 | #endif |
392 | 401 | ||
393 | /* let the user know what node this device is now attached to */ | 402 | /* let the user know what node this device is now attached to */ |
@@ -395,6 +404,10 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
395 | video_device_node_name(dev->video_dev)); | 404 | video_device_node_name(dev->video_dev)); |
396 | return 0; | 405 | return 0; |
397 | 406 | ||
407 | reg_fail: | ||
408 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
409 | i2c_del_adapter(&dev->i2c_adapter); | ||
410 | #endif | ||
398 | error: | 411 | error: |
399 | if (dev) { | 412 | if (dev) { |
400 | /* Destroy single thread */ | 413 | /* Destroy single thread */ |
@@ -424,6 +437,9 @@ static void hdpvr_disconnect(struct usb_interface *interface) | |||
424 | mutex_lock(&dev->io_mutex); | 437 | mutex_lock(&dev->io_mutex); |
425 | hdpvr_cancel_queue(dev); | 438 | hdpvr_cancel_queue(dev); |
426 | mutex_unlock(&dev->io_mutex); | 439 | mutex_unlock(&dev->io_mutex); |
440 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
441 | i2c_del_adapter(&dev->i2c_adapter); | ||
442 | #endif | ||
427 | video_unregister_device(dev->video_dev); | 443 | video_unregister_device(dev->video_dev); |
428 | atomic_dec(&dev_nr); | 444 | atomic_dec(&dev_nr); |
429 | } | 445 | } |
diff --git a/drivers/media/video/hdpvr/hdpvr-i2c.c b/drivers/media/video/hdpvr/hdpvr-i2c.c index 89b71faeaac2..e53fa55d56a1 100644 --- a/drivers/media/video/hdpvr/hdpvr-i2c.c +++ b/drivers/media/video/hdpvr/hdpvr-i2c.c | |||
@@ -31,26 +31,34 @@ | |||
31 | #define Z8F0811_IR_RX_I2C_ADDR 0x71 | 31 | #define Z8F0811_IR_RX_I2C_ADDR 0x71 |
32 | 32 | ||
33 | 33 | ||
34 | static struct i2c_board_info hdpvr_i2c_board_info = { | 34 | struct i2c_client *hdpvr_register_ir_tx_i2c(struct hdpvr_device *dev) |
35 | I2C_BOARD_INFO("ir_tx_z8f0811_hdpvr", Z8F0811_IR_TX_I2C_ADDR), | 35 | { |
36 | I2C_BOARD_INFO("ir_rx_z8f0811_hdpvr", Z8F0811_IR_RX_I2C_ADDR), | 36 | struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; |
37 | }; | 37 | struct i2c_board_info hdpvr_ir_tx_i2c_board_info = { |
38 | I2C_BOARD_INFO("ir_tx_z8f0811_hdpvr", Z8F0811_IR_TX_I2C_ADDR), | ||
39 | }; | ||
40 | |||
41 | init_data->name = "HD-PVR"; | ||
42 | hdpvr_ir_tx_i2c_board_info.platform_data = init_data; | ||
38 | 43 | ||
39 | int hdpvr_register_i2c_ir(struct hdpvr_device *dev) | 44 | return i2c_new_device(&dev->i2c_adapter, &hdpvr_ir_tx_i2c_board_info); |
45 | } | ||
46 | |||
47 | struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev) | ||
40 | { | 48 | { |
41 | struct i2c_client *c; | ||
42 | struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; | 49 | struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; |
50 | struct i2c_board_info hdpvr_ir_rx_i2c_board_info = { | ||
51 | I2C_BOARD_INFO("ir_rx_z8f0811_hdpvr", Z8F0811_IR_RX_I2C_ADDR), | ||
52 | }; | ||
43 | 53 | ||
44 | /* Our default information for ir-kbd-i2c.c to use */ | 54 | /* Our default information for ir-kbd-i2c.c to use */ |
45 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; | 55 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; |
46 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 56 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
47 | init_data->type = RC_TYPE_RC5; | 57 | init_data->type = RC_TYPE_RC5; |
48 | init_data->name = "HD PVR"; | 58 | init_data->name = "HD-PVR"; |
49 | hdpvr_i2c_board_info.platform_data = init_data; | 59 | hdpvr_ir_rx_i2c_board_info.platform_data = init_data; |
50 | |||
51 | c = i2c_new_device(&dev->i2c_adapter, &hdpvr_i2c_board_info); | ||
52 | 60 | ||
53 | return (c == NULL) ? -ENODEV : 0; | 61 | return i2c_new_device(&dev->i2c_adapter, &hdpvr_ir_rx_i2c_board_info); |
54 | } | 62 | } |
55 | 63 | ||
56 | static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, | 64 | static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, |
diff --git a/drivers/media/video/hdpvr/hdpvr.h b/drivers/media/video/hdpvr/hdpvr.h index ee74e3be9a6a..072f23c570f3 100644 --- a/drivers/media/video/hdpvr/hdpvr.h +++ b/drivers/media/video/hdpvr/hdpvr.h | |||
@@ -313,7 +313,8 @@ int hdpvr_cancel_queue(struct hdpvr_device *dev); | |||
313 | /* i2c adapter registration */ | 313 | /* i2c adapter registration */ |
314 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev); | 314 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev); |
315 | 315 | ||
316 | int hdpvr_register_i2c_ir(struct hdpvr_device *dev); | 316 | struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev); |
317 | struct i2c_client *hdpvr_register_ir_tx_i2c(struct hdpvr_device *dev); | ||
317 | 318 | ||
318 | /*========================================================================*/ | 319 | /*========================================================================*/ |
319 | /* buffer management */ | 320 | /* buffer management */ |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index d2b20ad383a3..a221ad68b330 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -128,6 +128,19 @@ static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
128 | 128 | ||
129 | static int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 129 | static int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
130 | { | 130 | { |
131 | int ret; | ||
132 | unsigned char buf[1] = { 0 }; | ||
133 | |||
134 | /* | ||
135 | * This is the same apparent "are you ready?" poll command observed | ||
136 | * watching Windows driver traffic and implemented in lirc_zilog. With | ||
137 | * this added, we get far saner remote behavior with z8 chips on usb | ||
138 | * connected devices, even with the default polling interval of 100ms. | ||
139 | */ | ||
140 | ret = i2c_master_send(ir->c, buf, 1); | ||
141 | if (ret != 1) | ||
142 | return (ret < 0) ? ret : -EINVAL; | ||
143 | |||
131 | return get_key_haup_common (ir, ir_key, ir_raw, 6, 3); | 144 | return get_key_haup_common (ir, ir_key, ir_raw, 6, 3); |
132 | } | 145 | } |
133 | 146 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index ccc884948f34..451ecd485f97 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -597,7 +597,6 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) | |||
597 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 597 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
598 | init_data->type = RC_TYPE_RC5; | 598 | init_data->type = RC_TYPE_RC5; |
599 | init_data->name = hdw->hdw_desc->description; | 599 | init_data->name = hdw->hdw_desc->description; |
600 | init_data->polling_interval = 260; /* ms From lirc_zilog */ | ||
601 | /* IR Receiver */ | 600 | /* IR Receiver */ |
602 | info.addr = 0x71; | 601 | info.addr = 0x71; |
603 | info.platform_data = init_data; | 602 | info.platform_data = init_data; |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index f35459d1f42f..0db90922ee93 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1565,7 +1565,7 @@ static int saa711x_probe(struct i2c_client *client, | |||
1565 | chip_id = name[5]; | 1565 | chip_id = name[5]; |
1566 | 1566 | ||
1567 | /* Check whether this chip is part of the saa711x series */ | 1567 | /* Check whether this chip is part of the saa711x series */ |
1568 | if (memcmp(name, "1f711", 5)) { | 1568 | if (memcmp(name + 1, "f711", 4)) { |
1569 | v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", | 1569 | v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", |
1570 | client->addr << 1, name); | 1570 | client->addr << 1, name); |
1571 | return -ENODEV; | 1571 | return -ENODEV; |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 4b8dcd5b2a01..2d6de3e03e2d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/ioport.h> | 14 | #include <linux/ioport.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/kernel.h> | ||
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
@@ -283,19 +284,19 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
283 | u32 remain, success; | 284 | u32 remain, success; |
284 | 285 | ||
285 | /* Calculate how far we are into the transfer */ | 286 | /* Calculate how far we are into the transfer */ |
286 | remain = readl(host->base + MMCIDATACNT) << 2; | 287 | remain = readl(host->base + MMCIDATACNT); |
287 | success = data->blksz * data->blocks - remain; | 288 | success = data->blksz * data->blocks - remain; |
288 | 289 | ||
289 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); | 290 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); |
290 | if (status & MCI_DATACRCFAIL) { | 291 | if (status & MCI_DATACRCFAIL) { |
291 | /* Last block was not successful */ | 292 | /* Last block was not successful */ |
292 | host->data_xfered = ((success / data->blksz) - 1 * data->blksz); | 293 | host->data_xfered = round_down(success - 1, data->blksz); |
293 | data->error = -EILSEQ; | 294 | data->error = -EILSEQ; |
294 | } else if (status & MCI_DATATIMEOUT) { | 295 | } else if (status & MCI_DATATIMEOUT) { |
295 | host->data_xfered = success; | 296 | host->data_xfered = round_down(success, data->blksz); |
296 | data->error = -ETIMEDOUT; | 297 | data->error = -ETIMEDOUT; |
297 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 298 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
298 | host->data_xfered = success; | 299 | host->data_xfered = round_down(success, data->blksz); |
299 | data->error = -EIO; | 300 | data->error = -EIO; |
300 | } | 301 | } |
301 | 302 | ||
@@ -319,7 +320,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
319 | if (status & MCI_DATABLOCKEND) | 320 | if (status & MCI_DATABLOCKEND) |
320 | dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); | 321 | dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); |
321 | 322 | ||
322 | if (status & MCI_DATAEND) { | 323 | if (status & MCI_DATAEND || data->error) { |
323 | mmci_stop_data(host); | 324 | mmci_stop_data(host); |
324 | 325 | ||
325 | if (!data->error) | 326 | if (!data->error) |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index f49e49dc5928..5ebe280225d6 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -672,33 +672,7 @@ static int io_init(struct ubi_device *ubi) | |||
672 | ubi->nor_flash = 1; | 672 | ubi->nor_flash = 1; |
673 | } | 673 | } |
674 | 674 | ||
675 | /* | 675 | ubi->min_io_size = ubi->mtd->writesize; |
676 | * Set UBI min. I/O size (@ubi->min_io_size). We use @mtd->writebufsize | ||
677 | * for these purposes, not @mtd->writesize. At the moment this does not | ||
678 | * matter for NAND, because currently @mtd->writebufsize is equivalent to | ||
679 | * @mtd->writesize for all NANDs. However, some CFI NOR flashes may | ||
680 | * have @mtd->writebufsize which is multiple of @mtd->writesize. | ||
681 | * | ||
682 | * The reason we use @mtd->writebufsize for @ubi->min_io_size is that | ||
683 | * UBI and UBIFS recovery algorithms rely on the fact that if there was | ||
684 | * an unclean power cut, then we can find offset of the last corrupted | ||
685 | * node, align the offset to @ubi->min_io_size, read the rest of the | ||
686 | * eraseblock starting from this offset, and check whether there are | ||
687 | * only 0xFF bytes. If yes, then we are probably dealing with a | ||
688 | * corruption caused by a power cut, if not, then this is probably some | ||
689 | * severe corruption. | ||
690 | * | ||
691 | * Thus, we have to use the maximum write unit size of the flash, which | ||
692 | * is @mtd->writebufsize, because @mtd->writesize is the minimum write | ||
693 | * size, not the maximum. | ||
694 | */ | ||
695 | if (ubi->mtd->type == MTD_NANDFLASH) | ||
696 | ubi_assert(ubi->mtd->writebufsize == ubi->mtd->writesize); | ||
697 | else if (ubi->mtd->type == MTD_NORFLASH) | ||
698 | ubi_assert(ubi->mtd->writebufsize % ubi->mtd->writesize == 0); | ||
699 | |||
700 | ubi->min_io_size = ubi->mtd->writebufsize; | ||
701 | |||
702 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; | 676 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; |
703 | 677 | ||
704 | /* | 678 | /* |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 4ffdc18fcb8a..2765a3ce9c24 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -1286,6 +1286,21 @@ static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = { | |||
1286 | { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ | 1286 | { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ |
1287 | { PCI_VDEVICE(MELLANOX, 0x6746) }, /* MT26438 ConnectX EN 40GigE PCIe gen2 5GT/s */ | 1287 | { PCI_VDEVICE(MELLANOX, 0x6746) }, /* MT26438 ConnectX EN 40GigE PCIe gen2 5GT/s */ |
1288 | { PCI_VDEVICE(MELLANOX, 0x676e) }, /* MT26478 ConnectX2 40GigE PCIe gen2 */ | 1288 | { PCI_VDEVICE(MELLANOX, 0x676e) }, /* MT26478 ConnectX2 40GigE PCIe gen2 */ |
1289 | { PCI_VDEVICE(MELLANOX, 0x1002) }, /* MT25400 Family [ConnectX-2 Virtual Function] */ | ||
1290 | { PCI_VDEVICE(MELLANOX, 0x1003) }, /* MT27500 Family [ConnectX-3] */ | ||
1291 | { PCI_VDEVICE(MELLANOX, 0x1004) }, /* MT27500 Family [ConnectX-3 Virtual Function] */ | ||
1292 | { PCI_VDEVICE(MELLANOX, 0x1005) }, /* MT27510 Family */ | ||
1293 | { PCI_VDEVICE(MELLANOX, 0x1006) }, /* MT27511 Family */ | ||
1294 | { PCI_VDEVICE(MELLANOX, 0x1007) }, /* MT27520 Family */ | ||
1295 | { PCI_VDEVICE(MELLANOX, 0x1008) }, /* MT27521 Family */ | ||
1296 | { PCI_VDEVICE(MELLANOX, 0x1009) }, /* MT27530 Family */ | ||
1297 | { PCI_VDEVICE(MELLANOX, 0x100a) }, /* MT27531 Family */ | ||
1298 | { PCI_VDEVICE(MELLANOX, 0x100b) }, /* MT27540 Family */ | ||
1299 | { PCI_VDEVICE(MELLANOX, 0x100c) }, /* MT27541 Family */ | ||
1300 | { PCI_VDEVICE(MELLANOX, 0x100d) }, /* MT27550 Family */ | ||
1301 | { PCI_VDEVICE(MELLANOX, 0x100e) }, /* MT27551 Family */ | ||
1302 | { PCI_VDEVICE(MELLANOX, 0x100f) }, /* MT27560 Family */ | ||
1303 | { PCI_VDEVICE(MELLANOX, 0x1010) }, /* MT27561 Family */ | ||
1289 | { 0, } | 1304 | { 0, } |
1290 | }; | 1305 | }; |
1291 | 1306 | ||
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index f374c5961b32..a91d510a798b 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/sfi.h> | 26 | #include <linux/sfi.h> |
27 | #include <asm/mrst.h> | 27 | #include <asm/mrst.h> |
28 | #include <asm/intel_scu_ipc.h> | 28 | #include <asm/intel_scu_ipc.h> |
29 | #include <asm/mrst.h> | ||
30 | 29 | ||
31 | /* IPC defines the following message types */ | 30 | /* IPC defines the following message types */ |
32 | #define IPCMSG_WATCHDOG_TIMER 0xF8 /* Set Kernel Watchdog Threshold */ | 31 | #define IPCMSG_WATCHDOG_TIMER 0xF8 /* Set Kernel Watchdog Threshold */ |
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index 4155805dcdff..2b771f18d1ad 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c | |||
@@ -319,6 +319,9 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) | |||
319 | 319 | ||
320 | private = (struct dasd_eckd_private *) device->private; | 320 | private = (struct dasd_eckd_private *) device->private; |
321 | lcu = private->lcu; | 321 | lcu = private->lcu; |
322 | /* nothing to do if already disconnected */ | ||
323 | if (!lcu) | ||
324 | return; | ||
322 | device->discipline->get_uid(device, &uid); | 325 | device->discipline->get_uid(device, &uid); |
323 | spin_lock_irqsave(&lcu->lock, flags); | 326 | spin_lock_irqsave(&lcu->lock, flags); |
324 | list_del_init(&device->alias_list); | 327 | list_del_init(&device->alias_list); |
@@ -680,6 +683,9 @@ int dasd_alias_remove_device(struct dasd_device *device) | |||
680 | 683 | ||
681 | private = (struct dasd_eckd_private *) device->private; | 684 | private = (struct dasd_eckd_private *) device->private; |
682 | lcu = private->lcu; | 685 | lcu = private->lcu; |
686 | /* nothing to do if already removed */ | ||
687 | if (!lcu) | ||
688 | return 0; | ||
683 | spin_lock_irqsave(&lcu->lock, flags); | 689 | spin_lock_irqsave(&lcu->lock, flags); |
684 | _remove_device_from_lcu(lcu, device); | 690 | _remove_device_from_lcu(lcu, device); |
685 | spin_unlock_irqrestore(&lcu->lock, flags); | 691 | spin_unlock_irqrestore(&lcu->lock, flags); |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index e9fff2b9bce2..5640c89cd9de 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -476,7 +476,7 @@ static inline void inbound_primed(struct qdio_q *q, int count) | |||
476 | static int get_inbound_buffer_frontier(struct qdio_q *q) | 476 | static int get_inbound_buffer_frontier(struct qdio_q *q) |
477 | { | 477 | { |
478 | int count, stop; | 478 | int count, stop; |
479 | unsigned char state; | 479 | unsigned char state = 0; |
480 | 480 | ||
481 | /* | 481 | /* |
482 | * Don't check 128 buffers, as otherwise qdio_inbound_q_moved | 482 | * Don't check 128 buffers, as otherwise qdio_inbound_q_moved |
@@ -643,7 +643,7 @@ void qdio_inbound_processing(unsigned long data) | |||
643 | static int get_outbound_buffer_frontier(struct qdio_q *q) | 643 | static int get_outbound_buffer_frontier(struct qdio_q *q) |
644 | { | 644 | { |
645 | int count, stop; | 645 | int count, stop; |
646 | unsigned char state; | 646 | unsigned char state = 0; |
647 | 647 | ||
648 | if (need_siga_sync(q)) | 648 | if (need_siga_sync(q)) |
649 | if (((queue_type(q) != QDIO_IQDIO_QFMT) && | 649 | if (((queue_type(q) != QDIO_IQDIO_QFMT) && |
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h index 475c31ae985c..77b26f5b9c33 100644 --- a/drivers/scsi/arcmsr/arcmsr.h +++ b/drivers/scsi/arcmsr/arcmsr.h | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** O.S : Linux | 3 | ** O.S : Linux |
4 | ** FILE NAME : arcmsr.h | 4 | ** FILE NAME : arcmsr.h |
5 | ** BY : Erich Chen | 5 | ** BY : Nick Cheng |
6 | ** Description: SCSI RAID Device Driver for | 6 | ** Description: SCSI RAID Device Driver for |
7 | ** ARECA RAID Host adapter | 7 | ** ARECA RAID Host adapter |
8 | ******************************************************************************* | 8 | ******************************************************************************* |
@@ -46,8 +46,12 @@ | |||
46 | struct device_attribute; | 46 | struct device_attribute; |
47 | /*The limit of outstanding scsi command that firmware can handle*/ | 47 | /*The limit of outstanding scsi command that firmware can handle*/ |
48 | #define ARCMSR_MAX_OUTSTANDING_CMD 256 | 48 | #define ARCMSR_MAX_OUTSTANDING_CMD 256 |
49 | #define ARCMSR_MAX_FREECCB_NUM 320 | 49 | #ifdef CONFIG_XEN |
50 | #define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.15 2010/02/02" | 50 | #define ARCMSR_MAX_FREECCB_NUM 160 |
51 | #else | ||
52 | #define ARCMSR_MAX_FREECCB_NUM 320 | ||
53 | #endif | ||
54 | #define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.15 2010/08/05" | ||
51 | #define ARCMSR_SCSI_INITIATOR_ID 255 | 55 | #define ARCMSR_SCSI_INITIATOR_ID 255 |
52 | #define ARCMSR_MAX_XFER_SECTORS 512 | 56 | #define ARCMSR_MAX_XFER_SECTORS 512 |
53 | #define ARCMSR_MAX_XFER_SECTORS_B 4096 | 57 | #define ARCMSR_MAX_XFER_SECTORS_B 4096 |
@@ -60,7 +64,6 @@ struct device_attribute; | |||
60 | #define ARCMSR_MAX_HBB_POSTQUEUE 264 | 64 | #define ARCMSR_MAX_HBB_POSTQUEUE 264 |
61 | #define ARCMSR_MAX_XFER_LEN 0x26000 /* 152K */ | 65 | #define ARCMSR_MAX_XFER_LEN 0x26000 /* 152K */ |
62 | #define ARCMSR_CDB_SG_PAGE_LENGTH 256 | 66 | #define ARCMSR_CDB_SG_PAGE_LENGTH 256 |
63 | #define SCSI_CMD_ARECA_SPECIFIC 0xE1 | ||
64 | #ifndef PCI_DEVICE_ID_ARECA_1880 | 67 | #ifndef PCI_DEVICE_ID_ARECA_1880 |
65 | #define PCI_DEVICE_ID_ARECA_1880 0x1880 | 68 | #define PCI_DEVICE_ID_ARECA_1880 0x1880 |
66 | #endif | 69 | #endif |
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index a4e04c50c436..acdae33de521 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** O.S : Linux | 3 | ** O.S : Linux |
4 | ** FILE NAME : arcmsr_attr.c | 4 | ** FILE NAME : arcmsr_attr.c |
5 | ** BY : Erich Chen | 5 | ** BY : Nick Cheng |
6 | ** Description: attributes exported to sysfs and device host | 6 | ** Description: attributes exported to sysfs and device host |
7 | ******************************************************************************* | 7 | ******************************************************************************* |
8 | ** Copyright (C) 2002 - 2005, Areca Technology Corporation All rights reserved | 8 | ** Copyright (C) 2002 - 2005, Areca Technology Corporation All rights reserved |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 1cadcd6b7da6..984bd527c6c9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** O.S : Linux | 3 | ** O.S : Linux |
4 | ** FILE NAME : arcmsr_hba.c | 4 | ** FILE NAME : arcmsr_hba.c |
5 | ** BY : Erich Chen | 5 | ** BY : Nick Cheng |
6 | ** Description: SCSI RAID Device Driver for | 6 | ** Description: SCSI RAID Device Driver for |
7 | ** ARECA RAID Host adapter | 7 | ** ARECA RAID Host adapter |
8 | ******************************************************************************* | 8 | ******************************************************************************* |
@@ -76,7 +76,7 @@ MODULE_DESCRIPTION("ARECA (ARC11xx/12xx/16xx/1880) SATA/SAS RAID Host Bus Adapte | |||
76 | MODULE_LICENSE("Dual BSD/GPL"); | 76 | MODULE_LICENSE("Dual BSD/GPL"); |
77 | MODULE_VERSION(ARCMSR_DRIVER_VERSION); | 77 | MODULE_VERSION(ARCMSR_DRIVER_VERSION); |
78 | static int sleeptime = 10; | 78 | static int sleeptime = 10; |
79 | static int retrycount = 30; | 79 | static int retrycount = 12; |
80 | wait_queue_head_t wait_q; | 80 | wait_queue_head_t wait_q; |
81 | static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, | 81 | static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, |
82 | struct scsi_cmnd *cmd); | 82 | struct scsi_cmnd *cmd); |
@@ -187,7 +187,6 @@ int arcmsr_sleep_for_bus_reset(struct scsi_cmnd *cmd) | |||
187 | if (isleep > 0) { | 187 | if (isleep > 0) { |
188 | msleep(isleep*1000); | 188 | msleep(isleep*1000); |
189 | } | 189 | } |
190 | printk(KERN_NOTICE "wake-up\n"); | ||
191 | return 0; | 190 | return 0; |
192 | } | 191 | } |
193 | 192 | ||
@@ -921,7 +920,6 @@ static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb, | |||
921 | } | 920 | } |
922 | 921 | ||
923 | static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct CommandControlBlock *pCCB, bool error) | 922 | static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct CommandControlBlock *pCCB, bool error) |
924 | |||
925 | { | 923 | { |
926 | int id, lun; | 924 | int id, lun; |
927 | if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) { | 925 | if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) { |
@@ -948,7 +946,7 @@ static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct Comma | |||
948 | , pCCB->startdone | 946 | , pCCB->startdone |
949 | , atomic_read(&acb->ccboutstandingcount)); | 947 | , atomic_read(&acb->ccboutstandingcount)); |
950 | return; | 948 | return; |
951 | } | 949 | } |
952 | arcmsr_report_ccb_state(acb, pCCB, error); | 950 | arcmsr_report_ccb_state(acb, pCCB, error); |
953 | } | 951 | } |
954 | 952 | ||
@@ -981,7 +979,7 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb) | |||
981 | case ACB_ADAPTER_TYPE_B: { | 979 | case ACB_ADAPTER_TYPE_B: { |
982 | struct MessageUnit_B *reg = acb->pmuB; | 980 | struct MessageUnit_B *reg = acb->pmuB; |
983 | /*clear all outbound posted Q*/ | 981 | /*clear all outbound posted Q*/ |
984 | writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, ®->iop2drv_doorbell); /* clear doorbell interrupt */ | 982 | writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, reg->iop2drv_doorbell); /* clear doorbell interrupt */ |
985 | for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { | 983 | for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { |
986 | if ((flag_ccb = readl(®->done_qbuffer[i])) != 0) { | 984 | if ((flag_ccb = readl(®->done_qbuffer[i])) != 0) { |
987 | writel(0, ®->done_qbuffer[i]); | 985 | writel(0, ®->done_qbuffer[i]); |
@@ -1511,7 +1509,6 @@ static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb) | |||
1511 | arcmsr_drain_donequeue(acb, pCCB, error); | 1509 | arcmsr_drain_donequeue(acb, pCCB, error); |
1512 | } | 1510 | } |
1513 | } | 1511 | } |
1514 | |||
1515 | static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb) | 1512 | static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb) |
1516 | { | 1513 | { |
1517 | uint32_t index; | 1514 | uint32_t index; |
@@ -2106,10 +2103,6 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, | |||
2106 | if (atomic_read(&acb->ccboutstandingcount) >= | 2103 | if (atomic_read(&acb->ccboutstandingcount) >= |
2107 | ARCMSR_MAX_OUTSTANDING_CMD) | 2104 | ARCMSR_MAX_OUTSTANDING_CMD) |
2108 | return SCSI_MLQUEUE_HOST_BUSY; | 2105 | return SCSI_MLQUEUE_HOST_BUSY; |
2109 | if ((scsicmd == SCSI_CMD_ARECA_SPECIFIC)) { | ||
2110 | printk(KERN_NOTICE "Receiveing SCSI_CMD_ARECA_SPECIFIC command..\n"); | ||
2111 | return 0; | ||
2112 | } | ||
2113 | ccb = arcmsr_get_freeccb(acb); | 2106 | ccb = arcmsr_get_freeccb(acb); |
2114 | if (!ccb) | 2107 | if (!ccb) |
2115 | return SCSI_MLQUEUE_HOST_BUSY; | 2108 | return SCSI_MLQUEUE_HOST_BUSY; |
@@ -2393,6 +2386,7 @@ static int arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, | |||
2393 | int index, rtn; | 2386 | int index, rtn; |
2394 | bool error; | 2387 | bool error; |
2395 | polling_hbb_ccb_retry: | 2388 | polling_hbb_ccb_retry: |
2389 | |||
2396 | poll_count++; | 2390 | poll_count++; |
2397 | /* clear doorbell interrupt */ | 2391 | /* clear doorbell interrupt */ |
2398 | writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, reg->iop2drv_doorbell); | 2392 | writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, reg->iop2drv_doorbell); |
@@ -2663,6 +2657,7 @@ static void arcmsr_request_hba_device_map(struct AdapterControlBlock *acb) | |||
2663 | { | 2657 | { |
2664 | struct MessageUnit_A __iomem *reg = acb->pmuA; | 2658 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
2665 | if (unlikely(atomic_read(&acb->rq_map_token) == 0) || ((acb->acb_flags & ACB_F_BUS_RESET) != 0 ) || ((acb->acb_flags & ACB_F_ABORT) != 0 )){ | 2659 | if (unlikely(atomic_read(&acb->rq_map_token) == 0) || ((acb->acb_flags & ACB_F_BUS_RESET) != 0 ) || ((acb->acb_flags & ACB_F_ABORT) != 0 )){ |
2660 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | ||
2666 | return; | 2661 | return; |
2667 | } else { | 2662 | } else { |
2668 | acb->fw_flag = FW_NORMAL; | 2663 | acb->fw_flag = FW_NORMAL; |
@@ -2670,8 +2665,10 @@ static void arcmsr_request_hba_device_map(struct AdapterControlBlock *acb) | |||
2670 | atomic_set(&acb->rq_map_token, 16); | 2665 | atomic_set(&acb->rq_map_token, 16); |
2671 | } | 2666 | } |
2672 | atomic_set(&acb->ante_token_value, atomic_read(&acb->rq_map_token)); | 2667 | atomic_set(&acb->ante_token_value, atomic_read(&acb->rq_map_token)); |
2673 | if (atomic_dec_and_test(&acb->rq_map_token)) | 2668 | if (atomic_dec_and_test(&acb->rq_map_token)) { |
2669 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | ||
2674 | return; | 2670 | return; |
2671 | } | ||
2675 | writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0); | 2672 | writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0); |
2676 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | 2673 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); |
2677 | } | 2674 | } |
@@ -2682,15 +2679,18 @@ static void arcmsr_request_hbb_device_map(struct AdapterControlBlock *acb) | |||
2682 | { | 2679 | { |
2683 | struct MessageUnit_B __iomem *reg = acb->pmuB; | 2680 | struct MessageUnit_B __iomem *reg = acb->pmuB; |
2684 | if (unlikely(atomic_read(&acb->rq_map_token) == 0) || ((acb->acb_flags & ACB_F_BUS_RESET) != 0 ) || ((acb->acb_flags & ACB_F_ABORT) != 0 )){ | 2681 | if (unlikely(atomic_read(&acb->rq_map_token) == 0) || ((acb->acb_flags & ACB_F_BUS_RESET) != 0 ) || ((acb->acb_flags & ACB_F_ABORT) != 0 )){ |
2682 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | ||
2685 | return; | 2683 | return; |
2686 | } else { | 2684 | } else { |
2687 | acb->fw_flag = FW_NORMAL; | 2685 | acb->fw_flag = FW_NORMAL; |
2688 | if (atomic_read(&acb->ante_token_value) == atomic_read(&acb->rq_map_token)) { | 2686 | if (atomic_read(&acb->ante_token_value) == atomic_read(&acb->rq_map_token)) { |
2689 | atomic_set(&acb->rq_map_token,16); | 2687 | atomic_set(&acb->rq_map_token, 16); |
2690 | } | 2688 | } |
2691 | atomic_set(&acb->ante_token_value, atomic_read(&acb->rq_map_token)); | 2689 | atomic_set(&acb->ante_token_value, atomic_read(&acb->rq_map_token)); |
2692 | if(atomic_dec_and_test(&acb->rq_map_token)) | 2690 | if (atomic_dec_and_test(&acb->rq_map_token)) { |
2691 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | ||
2693 | return; | 2692 | return; |
2693 | } | ||
2694 | writel(ARCMSR_MESSAGE_GET_CONFIG, reg->drv2iop_doorbell); | 2694 | writel(ARCMSR_MESSAGE_GET_CONFIG, reg->drv2iop_doorbell); |
2695 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | 2695 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); |
2696 | } | 2696 | } |
@@ -2701,6 +2701,7 @@ static void arcmsr_request_hbc_device_map(struct AdapterControlBlock *acb) | |||
2701 | { | 2701 | { |
2702 | struct MessageUnit_C __iomem *reg = acb->pmuC; | 2702 | struct MessageUnit_C __iomem *reg = acb->pmuC; |
2703 | if (unlikely(atomic_read(&acb->rq_map_token) == 0) || ((acb->acb_flags & ACB_F_BUS_RESET) != 0) || ((acb->acb_flags & ACB_F_ABORT) != 0)) { | 2703 | if (unlikely(atomic_read(&acb->rq_map_token) == 0) || ((acb->acb_flags & ACB_F_BUS_RESET) != 0) || ((acb->acb_flags & ACB_F_ABORT) != 0)) { |
2704 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | ||
2704 | return; | 2705 | return; |
2705 | } else { | 2706 | } else { |
2706 | acb->fw_flag = FW_NORMAL; | 2707 | acb->fw_flag = FW_NORMAL; |
@@ -2708,8 +2709,10 @@ static void arcmsr_request_hbc_device_map(struct AdapterControlBlock *acb) | |||
2708 | atomic_set(&acb->rq_map_token, 16); | 2709 | atomic_set(&acb->rq_map_token, 16); |
2709 | } | 2710 | } |
2710 | atomic_set(&acb->ante_token_value, atomic_read(&acb->rq_map_token)); | 2711 | atomic_set(&acb->ante_token_value, atomic_read(&acb->rq_map_token)); |
2711 | if (atomic_dec_and_test(&acb->rq_map_token)) | 2712 | if (atomic_dec_and_test(&acb->rq_map_token)) { |
2713 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | ||
2712 | return; | 2714 | return; |
2715 | } | ||
2713 | writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0); | 2716 | writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0); |
2714 | writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, ®->inbound_doorbell); | 2717 | writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, ®->inbound_doorbell); |
2715 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); | 2718 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); |
@@ -2897,6 +2900,8 @@ static uint8_t arcmsr_iop_reset(struct AdapterControlBlock *acb) | |||
2897 | uint32_t intmask_org; | 2900 | uint32_t intmask_org; |
2898 | uint8_t rtnval = 0x00; | 2901 | uint8_t rtnval = 0x00; |
2899 | int i = 0; | 2902 | int i = 0; |
2903 | unsigned long flags; | ||
2904 | |||
2900 | if (atomic_read(&acb->ccboutstandingcount) != 0) { | 2905 | if (atomic_read(&acb->ccboutstandingcount) != 0) { |
2901 | /* disable all outbound interrupt */ | 2906 | /* disable all outbound interrupt */ |
2902 | intmask_org = arcmsr_disable_outbound_ints(acb); | 2907 | intmask_org = arcmsr_disable_outbound_ints(acb); |
@@ -2907,7 +2912,12 @@ static uint8_t arcmsr_iop_reset(struct AdapterControlBlock *acb) | |||
2907 | for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) { | 2912 | for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) { |
2908 | ccb = acb->pccb_pool[i]; | 2913 | ccb = acb->pccb_pool[i]; |
2909 | if (ccb->startdone == ARCMSR_CCB_START) { | 2914 | if (ccb->startdone == ARCMSR_CCB_START) { |
2910 | arcmsr_ccb_complete(ccb); | 2915 | scsi_dma_unmap(ccb->pcmd); |
2916 | ccb->startdone = ARCMSR_CCB_DONE; | ||
2917 | ccb->ccb_flags = 0; | ||
2918 | spin_lock_irqsave(&acb->ccblist_lock, flags); | ||
2919 | list_add_tail(&ccb->list, &acb->ccb_free_list); | ||
2920 | spin_unlock_irqrestore(&acb->ccblist_lock, flags); | ||
2911 | } | 2921 | } |
2912 | } | 2922 | } |
2913 | atomic_set(&acb->ccboutstandingcount, 0); | 2923 | atomic_set(&acb->ccboutstandingcount, 0); |
@@ -2920,8 +2930,7 @@ static uint8_t arcmsr_iop_reset(struct AdapterControlBlock *acb) | |||
2920 | 2930 | ||
2921 | static int arcmsr_bus_reset(struct scsi_cmnd *cmd) | 2931 | static int arcmsr_bus_reset(struct scsi_cmnd *cmd) |
2922 | { | 2932 | { |
2923 | struct AdapterControlBlock *acb = | 2933 | struct AdapterControlBlock *acb; |
2924 | (struct AdapterControlBlock *)cmd->device->host->hostdata; | ||
2925 | uint32_t intmask_org, outbound_doorbell; | 2934 | uint32_t intmask_org, outbound_doorbell; |
2926 | int retry_count = 0; | 2935 | int retry_count = 0; |
2927 | int rtn = FAILED; | 2936 | int rtn = FAILED; |
@@ -2971,31 +2980,16 @@ sleep_again: | |||
2971 | atomic_set(&acb->rq_map_token, 16); | 2980 | atomic_set(&acb->rq_map_token, 16); |
2972 | atomic_set(&acb->ante_token_value, 16); | 2981 | atomic_set(&acb->ante_token_value, 16); |
2973 | acb->fw_flag = FW_NORMAL; | 2982 | acb->fw_flag = FW_NORMAL; |
2974 | init_timer(&acb->eternal_timer); | 2983 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); |
2975 | acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6*HZ); | ||
2976 | acb->eternal_timer.data = (unsigned long) acb; | ||
2977 | acb->eternal_timer.function = &arcmsr_request_device_map; | ||
2978 | add_timer(&acb->eternal_timer); | ||
2979 | acb->acb_flags &= ~ACB_F_BUS_RESET; | 2984 | acb->acb_flags &= ~ACB_F_BUS_RESET; |
2980 | rtn = SUCCESS; | 2985 | rtn = SUCCESS; |
2981 | printk(KERN_ERR "arcmsr: scsi bus reset eh returns with success\n"); | 2986 | printk(KERN_ERR "arcmsr: scsi bus reset eh returns with success\n"); |
2982 | } else { | 2987 | } else { |
2983 | acb->acb_flags &= ~ACB_F_BUS_RESET; | 2988 | acb->acb_flags &= ~ACB_F_BUS_RESET; |
2984 | if (atomic_read(&acb->rq_map_token) == 0) { | 2989 | atomic_set(&acb->rq_map_token, 16); |
2985 | atomic_set(&acb->rq_map_token, 16); | 2990 | atomic_set(&acb->ante_token_value, 16); |
2986 | atomic_set(&acb->ante_token_value, 16); | 2991 | acb->fw_flag = FW_NORMAL; |
2987 | acb->fw_flag = FW_NORMAL; | 2992 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6*HZ)); |
2988 | init_timer(&acb->eternal_timer); | ||
2989 | acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6*HZ); | ||
2990 | acb->eternal_timer.data = (unsigned long) acb; | ||
2991 | acb->eternal_timer.function = &arcmsr_request_device_map; | ||
2992 | add_timer(&acb->eternal_timer); | ||
2993 | } else { | ||
2994 | atomic_set(&acb->rq_map_token, 16); | ||
2995 | atomic_set(&acb->ante_token_value, 16); | ||
2996 | acb->fw_flag = FW_NORMAL; | ||
2997 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6*HZ)); | ||
2998 | } | ||
2999 | rtn = SUCCESS; | 2993 | rtn = SUCCESS; |
3000 | } | 2994 | } |
3001 | break; | 2995 | break; |
@@ -3007,21 +3001,10 @@ sleep_again: | |||
3007 | rtn = FAILED; | 3001 | rtn = FAILED; |
3008 | } else { | 3002 | } else { |
3009 | acb->acb_flags &= ~ACB_F_BUS_RESET; | 3003 | acb->acb_flags &= ~ACB_F_BUS_RESET; |
3010 | if (atomic_read(&acb->rq_map_token) == 0) { | 3004 | atomic_set(&acb->rq_map_token, 16); |
3011 | atomic_set(&acb->rq_map_token, 16); | 3005 | atomic_set(&acb->ante_token_value, 16); |
3012 | atomic_set(&acb->ante_token_value, 16); | 3006 | acb->fw_flag = FW_NORMAL; |
3013 | acb->fw_flag = FW_NORMAL; | 3007 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); |
3014 | init_timer(&acb->eternal_timer); | ||
3015 | acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6*HZ); | ||
3016 | acb->eternal_timer.data = (unsigned long) acb; | ||
3017 | acb->eternal_timer.function = &arcmsr_request_device_map; | ||
3018 | add_timer(&acb->eternal_timer); | ||
3019 | } else { | ||
3020 | atomic_set(&acb->rq_map_token, 16); | ||
3021 | atomic_set(&acb->ante_token_value, 16); | ||
3022 | acb->fw_flag = FW_NORMAL; | ||
3023 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6*HZ)); | ||
3024 | } | ||
3025 | rtn = SUCCESS; | 3008 | rtn = SUCCESS; |
3026 | } | 3009 | } |
3027 | break; | 3010 | break; |
@@ -3067,31 +3050,16 @@ sleep: | |||
3067 | atomic_set(&acb->rq_map_token, 16); | 3050 | atomic_set(&acb->rq_map_token, 16); |
3068 | atomic_set(&acb->ante_token_value, 16); | 3051 | atomic_set(&acb->ante_token_value, 16); |
3069 | acb->fw_flag = FW_NORMAL; | 3052 | acb->fw_flag = FW_NORMAL; |
3070 | init_timer(&acb->eternal_timer); | 3053 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ)); |
3071 | acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ); | ||
3072 | acb->eternal_timer.data = (unsigned long) acb; | ||
3073 | acb->eternal_timer.function = &arcmsr_request_device_map; | ||
3074 | add_timer(&acb->eternal_timer); | ||
3075 | acb->acb_flags &= ~ACB_F_BUS_RESET; | 3054 | acb->acb_flags &= ~ACB_F_BUS_RESET; |
3076 | rtn = SUCCESS; | 3055 | rtn = SUCCESS; |
3077 | printk(KERN_ERR "arcmsr: scsi bus reset eh returns with success\n"); | 3056 | printk(KERN_ERR "arcmsr: scsi bus reset eh returns with success\n"); |
3078 | } else { | 3057 | } else { |
3079 | acb->acb_flags &= ~ACB_F_BUS_RESET; | 3058 | acb->acb_flags &= ~ACB_F_BUS_RESET; |
3080 | if (atomic_read(&acb->rq_map_token) == 0) { | 3059 | atomic_set(&acb->rq_map_token, 16); |
3081 | atomic_set(&acb->rq_map_token, 16); | 3060 | atomic_set(&acb->ante_token_value, 16); |
3082 | atomic_set(&acb->ante_token_value, 16); | 3061 | acb->fw_flag = FW_NORMAL; |
3083 | acb->fw_flag = FW_NORMAL; | 3062 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6*HZ)); |
3084 | init_timer(&acb->eternal_timer); | ||
3085 | acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6*HZ); | ||
3086 | acb->eternal_timer.data = (unsigned long) acb; | ||
3087 | acb->eternal_timer.function = &arcmsr_request_device_map; | ||
3088 | add_timer(&acb->eternal_timer); | ||
3089 | } else { | ||
3090 | atomic_set(&acb->rq_map_token, 16); | ||
3091 | atomic_set(&acb->ante_token_value, 16); | ||
3092 | acb->fw_flag = FW_NORMAL; | ||
3093 | mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6*HZ)); | ||
3094 | } | ||
3095 | rtn = SUCCESS; | 3063 | rtn = SUCCESS; |
3096 | } | 3064 | } |
3097 | break; | 3065 | break; |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 5815cbeb27a6..9a7aaf5f1311 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -646,6 +646,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost) | |||
646 | 646 | ||
647 | spin_lock_irqsave(shost->host_lock, flags); | 647 | spin_lock_irqsave(shost->host_lock, flags); |
648 | list_splice_init(&shost->eh_cmd_q, &eh_work_q); | 648 | list_splice_init(&shost->eh_cmd_q, &eh_work_q); |
649 | shost->host_eh_scheduled = 0; | ||
649 | spin_unlock_irqrestore(shost->host_lock, flags); | 650 | spin_unlock_irqrestore(shost->host_lock, flags); |
650 | 651 | ||
651 | SAS_DPRINTK("Enter %s\n", __func__); | 652 | SAS_DPRINTK("Enter %s\n", __func__); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index b2a817055b8b..9ead0399808a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -2176,9 +2176,9 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
2176 | /* adjust hba_queue_depth, reply_free_queue_depth, | 2176 | /* adjust hba_queue_depth, reply_free_queue_depth, |
2177 | * and queue_size | 2177 | * and queue_size |
2178 | */ | 2178 | */ |
2179 | ioc->hba_queue_depth -= queue_diff; | 2179 | ioc->hba_queue_depth -= (queue_diff / 2); |
2180 | ioc->reply_free_queue_depth -= queue_diff; | 2180 | ioc->reply_free_queue_depth -= (queue_diff / 2); |
2181 | queue_size -= queue_diff; | 2181 | queue_size = facts->MaxReplyDescriptorPostQueueDepth; |
2182 | } | 2182 | } |
2183 | ioc->reply_post_queue_depth = queue_size; | 2183 | ioc->reply_post_queue_depth = queue_size; |
2184 | 2184 | ||
@@ -3941,6 +3941,8 @@ mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc) | |||
3941 | static void | 3941 | static void |
3942 | _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) | 3942 | _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) |
3943 | { | 3943 | { |
3944 | mpt2sas_scsih_reset_handler(ioc, reset_phase); | ||
3945 | mpt2sas_ctl_reset_handler(ioc, reset_phase); | ||
3944 | switch (reset_phase) { | 3946 | switch (reset_phase) { |
3945 | case MPT2_IOC_PRE_RESET: | 3947 | case MPT2_IOC_PRE_RESET: |
3946 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: " | 3948 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: " |
@@ -3971,8 +3973,6 @@ _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) | |||
3971 | "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); | 3973 | "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); |
3972 | break; | 3974 | break; |
3973 | } | 3975 | } |
3974 | mpt2sas_scsih_reset_handler(ioc, reset_phase); | ||
3975 | mpt2sas_ctl_reset_handler(ioc, reset_phase); | ||
3976 | } | 3976 | } |
3977 | 3977 | ||
3978 | /** | 3978 | /** |
@@ -4026,6 +4026,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
4026 | { | 4026 | { |
4027 | int r; | 4027 | int r; |
4028 | unsigned long flags; | 4028 | unsigned long flags; |
4029 | u8 pe_complete = ioc->wait_for_port_enable_to_complete; | ||
4029 | 4030 | ||
4030 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, | 4031 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, |
4031 | __func__)); | 4032 | __func__)); |
@@ -4068,6 +4069,14 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
4068 | if (r) | 4069 | if (r) |
4069 | goto out; | 4070 | goto out; |
4070 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); | 4071 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); |
4072 | |||
4073 | /* If this hard reset is called while port enable is active, then | ||
4074 | * there is no reason to call make_ioc_operational | ||
4075 | */ | ||
4076 | if (pe_complete) { | ||
4077 | r = -EFAULT; | ||
4078 | goto out; | ||
4079 | } | ||
4071 | r = _base_make_ioc_operational(ioc, sleep_flag); | 4080 | r = _base_make_ioc_operational(ioc, sleep_flag); |
4072 | if (!r) | 4081 | if (!r) |
4073 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); | 4082 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index eda347c57979..5ded3db6e316 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -819,7 +819,7 @@ _scsih_is_end_device(u32 device_info) | |||
819 | } | 819 | } |
820 | 820 | ||
821 | /** | 821 | /** |
822 | * mptscsih_get_scsi_lookup - returns scmd entry | 822 | * _scsih_scsi_lookup_get - returns scmd entry |
823 | * @ioc: per adapter object | 823 | * @ioc: per adapter object |
824 | * @smid: system request message index | 824 | * @smid: system request message index |
825 | * | 825 | * |
@@ -832,6 +832,28 @@ _scsih_scsi_lookup_get(struct MPT2SAS_ADAPTER *ioc, u16 smid) | |||
832 | } | 832 | } |
833 | 833 | ||
834 | /** | 834 | /** |
835 | * _scsih_scsi_lookup_get_clear - returns scmd entry | ||
836 | * @ioc: per adapter object | ||
837 | * @smid: system request message index | ||
838 | * | ||
839 | * Returns the smid stored scmd pointer. | ||
840 | * Then will derefrence the stored scmd pointer. | ||
841 | */ | ||
842 | static inline struct scsi_cmnd * | ||
843 | _scsih_scsi_lookup_get_clear(struct MPT2SAS_ADAPTER *ioc, u16 smid) | ||
844 | { | ||
845 | unsigned long flags; | ||
846 | struct scsi_cmnd *scmd; | ||
847 | |||
848 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
849 | scmd = ioc->scsi_lookup[smid - 1].scmd; | ||
850 | ioc->scsi_lookup[smid - 1].scmd = NULL; | ||
851 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); | ||
852 | |||
853 | return scmd; | ||
854 | } | ||
855 | |||
856 | /** | ||
835 | * _scsih_scsi_lookup_find_by_scmd - scmd lookup | 857 | * _scsih_scsi_lookup_find_by_scmd - scmd lookup |
836 | * @ioc: per adapter object | 858 | * @ioc: per adapter object |
837 | * @smid: system request message index | 859 | * @smid: system request message index |
@@ -2981,9 +3003,6 @@ _scsih_check_topo_delete_events(struct MPT2SAS_ADAPTER *ioc, | |||
2981 | u16 handle; | 3003 | u16 handle; |
2982 | 3004 | ||
2983 | for (i = 0 ; i < event_data->NumEntries; i++) { | 3005 | for (i = 0 ; i < event_data->NumEntries; i++) { |
2984 | if (event_data->PHY[i].PhyStatus & | ||
2985 | MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT) | ||
2986 | continue; | ||
2987 | handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle); | 3006 | handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle); |
2988 | if (!handle) | 3007 | if (!handle) |
2989 | continue; | 3008 | continue; |
@@ -3210,7 +3229,7 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc) | |||
3210 | u16 count = 0; | 3229 | u16 count = 0; |
3211 | 3230 | ||
3212 | for (smid = 1; smid <= ioc->scsiio_depth; smid++) { | 3231 | for (smid = 1; smid <= ioc->scsiio_depth; smid++) { |
3213 | scmd = _scsih_scsi_lookup_get(ioc, smid); | 3232 | scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
3214 | if (!scmd) | 3233 | if (!scmd) |
3215 | continue; | 3234 | continue; |
3216 | count++; | 3235 | count++; |
@@ -3804,7 +3823,7 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
3804 | u32 response_code = 0; | 3823 | u32 response_code = 0; |
3805 | 3824 | ||
3806 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); | 3825 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); |
3807 | scmd = _scsih_scsi_lookup_get(ioc, smid); | 3826 | scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
3808 | if (scmd == NULL) | 3827 | if (scmd == NULL) |
3809 | return 1; | 3828 | return 1; |
3810 | 3829 | ||
@@ -5005,6 +5024,12 @@ _scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc, | |||
5005 | event_data); | 5024 | event_data); |
5006 | #endif | 5025 | #endif |
5007 | 5026 | ||
5027 | /* In MPI Revision K (0xC), the internal device reset complete was | ||
5028 | * implemented, so avoid setting tm_busy flag for older firmware. | ||
5029 | */ | ||
5030 | if ((ioc->facts.HeaderVersion >> 8) < 0xC) | ||
5031 | return; | ||
5032 | |||
5008 | if (event_data->ReasonCode != | 5033 | if (event_data->ReasonCode != |
5009 | MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET && | 5034 | MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET && |
5010 | event_data->ReasonCode != | 5035 | event_data->ReasonCode != |
@@ -5099,6 +5124,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5099 | struct fw_event_work *fw_event) | 5124 | struct fw_event_work *fw_event) |
5100 | { | 5125 | { |
5101 | struct scsi_cmnd *scmd; | 5126 | struct scsi_cmnd *scmd; |
5127 | struct scsi_device *sdev; | ||
5102 | u16 smid, handle; | 5128 | u16 smid, handle; |
5103 | u32 lun; | 5129 | u32 lun; |
5104 | struct MPT2SAS_DEVICE *sas_device_priv_data; | 5130 | struct MPT2SAS_DEVICE *sas_device_priv_data; |
@@ -5109,12 +5135,17 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5109 | Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; | 5135 | Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; |
5110 | #endif | 5136 | #endif |
5111 | u16 ioc_status; | 5137 | u16 ioc_status; |
5138 | unsigned long flags; | ||
5139 | int r; | ||
5140 | |||
5112 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: " | 5141 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: " |
5113 | "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, | 5142 | "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, |
5114 | event_data->PortWidth)); | 5143 | event_data->PortWidth)); |
5115 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, | 5144 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, |
5116 | __func__)); | 5145 | __func__)); |
5117 | 5146 | ||
5147 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
5148 | ioc->broadcast_aen_busy = 0; | ||
5118 | termination_count = 0; | 5149 | termination_count = 0; |
5119 | query_count = 0; | 5150 | query_count = 0; |
5120 | mpi_reply = ioc->tm_cmds.reply; | 5151 | mpi_reply = ioc->tm_cmds.reply; |
@@ -5122,7 +5153,8 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5122 | scmd = _scsih_scsi_lookup_get(ioc, smid); | 5153 | scmd = _scsih_scsi_lookup_get(ioc, smid); |
5123 | if (!scmd) | 5154 | if (!scmd) |
5124 | continue; | 5155 | continue; |
5125 | sas_device_priv_data = scmd->device->hostdata; | 5156 | sdev = scmd->device; |
5157 | sas_device_priv_data = sdev->hostdata; | ||
5126 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) | 5158 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) |
5127 | continue; | 5159 | continue; |
5128 | /* skip hidden raid components */ | 5160 | /* skip hidden raid components */ |
@@ -5138,6 +5170,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5138 | lun = sas_device_priv_data->lun; | 5170 | lun = sas_device_priv_data->lun; |
5139 | query_count++; | 5171 | query_count++; |
5140 | 5172 | ||
5173 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); | ||
5141 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, | 5174 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, |
5142 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL); | 5175 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL); |
5143 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; | 5176 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; |
@@ -5147,14 +5180,20 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5147 | (mpi_reply->ResponseCode == | 5180 | (mpi_reply->ResponseCode == |
5148 | MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || | 5181 | MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || |
5149 | mpi_reply->ResponseCode == | 5182 | mpi_reply->ResponseCode == |
5150 | MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) | 5183 | MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) { |
5184 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
5151 | continue; | 5185 | continue; |
5152 | 5186 | } | |
5153 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, | 5187 | r = mpt2sas_scsih_issue_tm(ioc, handle, sdev->channel, sdev->id, |
5154 | MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, 0, 30, NULL); | 5188 | sdev->lun, MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK, smid, 30, |
5189 | scmd); | ||
5190 | if (r == FAILED) | ||
5191 | sdev_printk(KERN_WARNING, sdev, "task abort: FAILED " | ||
5192 | "scmd(%p)\n", scmd); | ||
5155 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); | 5193 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); |
5194 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
5156 | } | 5195 | } |
5157 | ioc->broadcast_aen_busy = 0; | 5196 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
5158 | 5197 | ||
5159 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT | 5198 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT |
5160 | "%s - exit, query_count = %d termination_count = %d\n", | 5199 | "%s - exit, query_count = %d termination_count = %d\n", |
@@ -6626,6 +6665,7 @@ _scsih_remove(struct pci_dev *pdev) | |||
6626 | destroy_workqueue(wq); | 6665 | destroy_workqueue(wq); |
6627 | 6666 | ||
6628 | /* release all the volumes */ | 6667 | /* release all the volumes */ |
6668 | _scsih_ir_shutdown(ioc); | ||
6629 | list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, | 6669 | list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, |
6630 | list) { | 6670 | list) { |
6631 | if (raid_device->starget) { | 6671 | if (raid_device->starget) { |
diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c index 0e298dba9fc8..29b8ab44ea47 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c | |||
@@ -360,8 +360,8 @@ int PSSendOps(void *arg) | |||
360 | status = 1; | 360 | status = 1; |
361 | goto complete; | 361 | goto complete; |
362 | } | 362 | } |
363 | len = (firmware->size > MAX_BDADDR_FORMAT_LENGTH)? MAX_BDADDR_FORMAT_LENGTH: firmware->size; | 363 | len = min(firmware->size, MAX_BDADDR_FORMAT_LENGTH - 1); |
364 | memcpy(config_bdaddr, firmware->data,len); | 364 | memcpy(config_bdaddr, firmware->data, len); |
365 | config_bdaddr[len] = '\0'; | 365 | config_bdaddr[len] = '\0'; |
366 | write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); | 366 | write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); |
367 | A_RELEASE_FIRMWARE(firmware); | 367 | A_RELEASE_FIRMWARE(firmware); |
diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.c b/drivers/staging/brcm80211/sys/wl_mac80211.c index bdd629d72a75..f1235884cc5d 100644 --- a/drivers/staging/brcm80211/sys/wl_mac80211.c +++ b/drivers/staging/brcm80211/sys/wl_mac80211.c | |||
@@ -209,11 +209,8 @@ static void wl_ops_stop(struct ieee80211_hw *hw) | |||
209 | struct wl_info *wl = hw->priv; | 209 | struct wl_info *wl = hw->priv; |
210 | ASSERT(wl); | 210 | ASSERT(wl); |
211 | WL_LOCK(wl); | 211 | WL_LOCK(wl); |
212 | wl_down(wl); | ||
213 | ieee80211_stop_queues(hw); | 212 | ieee80211_stop_queues(hw); |
214 | WL_UNLOCK(wl); | 213 | WL_UNLOCK(wl); |
215 | |||
216 | return; | ||
217 | } | 214 | } |
218 | 215 | ||
219 | static int | 216 | static int |
@@ -246,7 +243,14 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
246 | static void | 243 | static void |
247 | wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 244 | wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
248 | { | 245 | { |
249 | return; | 246 | struct wl_info *wl; |
247 | |||
248 | wl = HW_TO_WL(hw); | ||
249 | |||
250 | /* put driver in down state */ | ||
251 | WL_LOCK(wl); | ||
252 | wl_down(wl); | ||
253 | WL_UNLOCK(wl); | ||
250 | } | 254 | } |
251 | 255 | ||
252 | static int | 256 | static int |
@@ -779,7 +783,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs, | |||
779 | wl_found++; | 783 | wl_found++; |
780 | return wl; | 784 | return wl; |
781 | 785 | ||
782 | fail: | 786 | fail: |
783 | wl_free(wl); | 787 | wl_free(wl); |
784 | fail1: | 788 | fail1: |
785 | return NULL; | 789 | return NULL; |
@@ -1090,7 +1094,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1090 | return 0; | 1094 | return 0; |
1091 | } | 1095 | } |
1092 | 1096 | ||
1093 | #ifdef LINUXSTA_PS | ||
1094 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) | 1097 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) |
1095 | { | 1098 | { |
1096 | struct wl_info *wl; | 1099 | struct wl_info *wl; |
@@ -1105,11 +1108,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1105 | return -ENODEV; | 1108 | return -ENODEV; |
1106 | } | 1109 | } |
1107 | 1110 | ||
1111 | /* only need to flag hw is down for proper resume */ | ||
1108 | WL_LOCK(wl); | 1112 | WL_LOCK(wl); |
1109 | wl_down(wl); | ||
1110 | wl->pub->hw_up = false; | 1113 | wl->pub->hw_up = false; |
1111 | WL_UNLOCK(wl); | 1114 | WL_UNLOCK(wl); |
1112 | pci_save_state(pdev, wl->pci_psstate); | 1115 | |
1116 | pci_save_state(pdev); | ||
1113 | pci_disable_device(pdev); | 1117 | pci_disable_device(pdev); |
1114 | return pci_set_power_state(pdev, PCI_D3hot); | 1118 | return pci_set_power_state(pdev, PCI_D3hot); |
1115 | } | 1119 | } |
@@ -1133,7 +1137,7 @@ static int wl_resume(struct pci_dev *pdev) | |||
1133 | if (err) | 1137 | if (err) |
1134 | return err; | 1138 | return err; |
1135 | 1139 | ||
1136 | pci_restore_state(pdev, wl->pci_psstate); | 1140 | pci_restore_state(pdev); |
1137 | 1141 | ||
1138 | err = pci_enable_device(pdev); | 1142 | err = pci_enable_device(pdev); |
1139 | if (err) | 1143 | if (err) |
@@ -1145,13 +1149,12 @@ static int wl_resume(struct pci_dev *pdev) | |||
1145 | if ((val & 0x0000ff00) != 0) | 1149 | if ((val & 0x0000ff00) != 0) |
1146 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); | 1150 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); |
1147 | 1151 | ||
1148 | WL_LOCK(wl); | 1152 | /* |
1149 | err = wl_up(wl); | 1153 | * done. driver will be put in up state |
1150 | WL_UNLOCK(wl); | 1154 | * in wl_ops_add_interface() call. |
1151 | 1155 | */ | |
1152 | return err; | 1156 | return err; |
1153 | } | 1157 | } |
1154 | #endif /* LINUXSTA_PS */ | ||
1155 | 1158 | ||
1156 | static void wl_remove(struct pci_dev *pdev) | 1159 | static void wl_remove(struct pci_dev *pdev) |
1157 | { | 1160 | { |
@@ -1184,14 +1187,12 @@ static void wl_remove(struct pci_dev *pdev) | |||
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | static struct pci_driver wl_pci_driver = { | 1189 | static struct pci_driver wl_pci_driver = { |
1187 | .name = "brcm80211", | 1190 | .name = "brcm80211", |
1188 | .probe = wl_pci_probe, | 1191 | .probe = wl_pci_probe, |
1189 | #ifdef LINUXSTA_PS | 1192 | .suspend = wl_suspend, |
1190 | .suspend = wl_suspend, | 1193 | .resume = wl_resume, |
1191 | .resume = wl_resume, | 1194 | .remove = __devexit_p(wl_remove), |
1192 | #endif /* LINUXSTA_PS */ | 1195 | .id_table = wl_id_table, |
1193 | .remove = __devexit_p(wl_remove), | ||
1194 | .id_table = wl_id_table, | ||
1195 | }; | 1196 | }; |
1196 | 1197 | ||
1197 | /** | 1198 | /** |
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c index 1d5d01ac0a9b..a1303863686c 100644 --- a/drivers/staging/brcm80211/sys/wlc_mac80211.c +++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c | |||
@@ -5126,7 +5126,6 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu, | |||
5126 | fifo = prio2fifo[prio]; | 5126 | fifo = prio2fifo[prio]; |
5127 | 5127 | ||
5128 | ASSERT((uint) skb_headroom(sdu) >= TXOFF); | 5128 | ASSERT((uint) skb_headroom(sdu) >= TXOFF); |
5129 | ASSERT(!(sdu->cloned)); | ||
5130 | ASSERT(!(sdu->next)); | 5129 | ASSERT(!(sdu->next)); |
5131 | ASSERT(!(sdu->prev)); | 5130 | ASSERT(!(sdu->prev)); |
5132 | ASSERT(fifo < NFIFO); | 5131 | ASSERT(fifo < NFIFO); |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 4d1868d04bac..0728c3c0cb0e 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c | |||
@@ -575,7 +575,8 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, | |||
575 | /* grab our IRQ */ | 575 | /* grab our IRQ */ |
576 | if (irq) { | 576 | if (irq) { |
577 | isr_flags = 0; | 577 | isr_flags = 0; |
578 | if (thisboard->bustype == pci_bustype) | 578 | if (thisboard->bustype == pci_bustype |
579 | || thisboard->bustype == pcmcia_bustype) | ||
579 | isr_flags |= IRQF_SHARED; | 580 | isr_flags |= IRQF_SHARED; |
580 | if (request_irq(irq, labpc_interrupt, isr_flags, | 581 | if (request_irq(irq, labpc_interrupt, isr_flags, |
581 | driver_labpc.driver_name, dev)) { | 582 | driver_labpc.driver_name, dev)) { |
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index b3d05fcfe6d2..4fb809485d9e 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -368,6 +368,7 @@ static int blkvsc_probe(struct device *device) | |||
368 | blkdev->gd->first_minor = 0; | 368 | blkdev->gd->first_minor = 0; |
369 | blkdev->gd->fops = &block_ops; | 369 | blkdev->gd->fops = &block_ops; |
370 | blkdev->gd->private_data = blkdev; | 370 | blkdev->gd->private_data = blkdev; |
371 | blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device); | ||
371 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); | 372 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); |
372 | 373 | ||
373 | blkvsc_do_inquiry(blkdev); | 374 | blkvsc_do_inquiry(blkdev); |
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index df9cd131e953..0edbe7483a4c 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c | |||
@@ -1279,7 +1279,7 @@ static void netvsc_channel_cb(void *context) | |||
1279 | /* ASSERT(device); */ | 1279 | /* ASSERT(device); */ |
1280 | 1280 | ||
1281 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), | 1281 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), |
1282 | GFP_KERNEL); | 1282 | GFP_ATOMIC); |
1283 | if (!packet) | 1283 | if (!packet) |
1284 | return; | 1284 | return; |
1285 | buffer = packet; | 1285 | buffer = packet; |
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 0147b407512c..54706a16dc0a 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c | |||
@@ -358,7 +358,6 @@ static int netvsc_probe(struct device *device) | |||
358 | 358 | ||
359 | /* Set initial state */ | 359 | /* Set initial state */ |
360 | netif_carrier_off(net); | 360 | netif_carrier_off(net); |
361 | netif_stop_queue(net); | ||
362 | 361 | ||
363 | net_device_ctx = netdev_priv(net); | 362 | net_device_ctx = netdev_priv(net); |
364 | net_device_ctx->device_ctx = device_ctx; | 363 | net_device_ctx->device_ctx = device_ctx; |
diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c index deb68c8a6e18..b8b54da67c63 100644 --- a/drivers/staging/iio/adc/ad7476_core.c +++ b/drivers/staging/iio/adc/ad7476_core.c | |||
@@ -68,7 +68,7 @@ static ssize_t ad7476_show_scale(struct device *dev, | |||
68 | /* Corresponds to Vref / 2^(bits) */ | 68 | /* Corresponds to Vref / 2^(bits) */ |
69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; | 69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
70 | 70 | ||
71 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 71 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
72 | } | 72 | } |
73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0); | 73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0); |
74 | 74 | ||
diff --git a/drivers/staging/iio/adc/ad7887_core.c b/drivers/staging/iio/adc/ad7887_core.c index 685908995d49..5d85efab658c 100644 --- a/drivers/staging/iio/adc/ad7887_core.c +++ b/drivers/staging/iio/adc/ad7887_core.c | |||
@@ -68,7 +68,7 @@ static ssize_t ad7887_show_scale(struct device *dev, | |||
68 | /* Corresponds to Vref / 2^(bits) */ | 68 | /* Corresponds to Vref / 2^(bits) */ |
69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; | 69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
70 | 70 | ||
71 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 71 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
72 | } | 72 | } |
73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7887_show_scale, NULL, 0); | 73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7887_show_scale, NULL, 0); |
74 | 74 | ||
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 6309d521a864..89ccf375a188 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c | |||
@@ -432,7 +432,7 @@ static ssize_t ad799x_show_scale(struct device *dev, | |||
432 | /* Corresponds to Vref / 2^(bits) */ | 432 | /* Corresponds to Vref / 2^(bits) */ |
433 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; | 433 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
434 | 434 | ||
435 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 435 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
436 | } | 436 | } |
437 | 437 | ||
438 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0); | 438 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0); |
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c index e3387cd31145..0f87ecac82fc 100644 --- a/drivers/staging/iio/dac/ad5446.c +++ b/drivers/staging/iio/dac/ad5446.c | |||
@@ -87,7 +87,7 @@ static ssize_t ad5446_show_scale(struct device *dev, | |||
87 | /* Corresponds to Vref / 2^(bits) */ | 87 | /* Corresponds to Vref / 2^(bits) */ |
88 | unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits; | 88 | unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits; |
89 | 89 | ||
90 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 90 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
91 | } | 91 | } |
92 | static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0); | 92 | static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0); |
93 | 93 | ||
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c index 3fe5f4160194..0aad0d7a74a3 100644 --- a/drivers/staging/lirc/lirc_zilog.c +++ b/drivers/staging/lirc/lirc_zilog.c | |||
@@ -495,7 +495,7 @@ static int send_data_block(struct IR_tx *tx, unsigned char *data_block) | |||
495 | /* send boot data to the IR TX device */ | 495 | /* send boot data to the IR TX device */ |
496 | static int send_boot_data(struct IR_tx *tx) | 496 | static int send_boot_data(struct IR_tx *tx) |
497 | { | 497 | { |
498 | int ret; | 498 | int ret, i; |
499 | unsigned char buf[4]; | 499 | unsigned char buf[4]; |
500 | 500 | ||
501 | /* send the boot block */ | 501 | /* send the boot block */ |
@@ -503,7 +503,7 @@ static int send_boot_data(struct IR_tx *tx) | |||
503 | if (ret != 0) | 503 | if (ret != 0) |
504 | return ret; | 504 | return ret; |
505 | 505 | ||
506 | /* kick it off? */ | 506 | /* Hit the go button to activate the new boot data */ |
507 | buf[0] = 0x00; | 507 | buf[0] = 0x00; |
508 | buf[1] = 0x20; | 508 | buf[1] = 0x20; |
509 | ret = i2c_master_send(tx->c, buf, 2); | 509 | ret = i2c_master_send(tx->c, buf, 2); |
@@ -511,7 +511,19 @@ static int send_boot_data(struct IR_tx *tx) | |||
511 | zilog_error("i2c_master_send failed with %d\n", ret); | 511 | zilog_error("i2c_master_send failed with %d\n", ret); |
512 | return ret < 0 ? ret : -EFAULT; | 512 | return ret < 0 ? ret : -EFAULT; |
513 | } | 513 | } |
514 | ret = i2c_master_send(tx->c, buf, 1); | 514 | |
515 | /* | ||
516 | * Wait for zilog to settle after hitting go post boot block upload. | ||
517 | * Without this delay, the HD-PVR and HVR-1950 both return an -EIO | ||
518 | * upon attempting to get firmware revision, and tx probe thus fails. | ||
519 | */ | ||
520 | for (i = 0; i < 10; i++) { | ||
521 | ret = i2c_master_send(tx->c, buf, 1); | ||
522 | if (ret == 1) | ||
523 | break; | ||
524 | udelay(100); | ||
525 | } | ||
526 | |||
515 | if (ret != 1) { | 527 | if (ret != 1) { |
516 | zilog_error("i2c_master_send failed with %d\n", ret); | 528 | zilog_error("i2c_master_send failed with %d\n", ret); |
517 | return ret < 0 ? ret : -EFAULT; | 529 | return ret < 0 ? ret : -EFAULT; |
@@ -523,8 +535,8 @@ static int send_boot_data(struct IR_tx *tx) | |||
523 | zilog_error("i2c_master_recv failed with %d\n", ret); | 535 | zilog_error("i2c_master_recv failed with %d\n", ret); |
524 | return 0; | 536 | return 0; |
525 | } | 537 | } |
526 | if (buf[0] != 0x80) { | 538 | if ((buf[0] != 0x80) && (buf[0] != 0xa0)) { |
527 | zilog_error("unexpected IR TX response: %02x\n", buf[0]); | 539 | zilog_error("unexpected IR TX init response: %02x\n", buf[0]); |
528 | return 0; | 540 | return 0; |
529 | } | 541 | } |
530 | zilog_notify("Zilog/Hauppauge IR blaster firmware version " | 542 | zilog_notify("Zilog/Hauppauge IR blaster firmware version " |
@@ -827,7 +839,15 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) | |||
827 | zilog_error("i2c_master_send failed with %d\n", ret); | 839 | zilog_error("i2c_master_send failed with %d\n", ret); |
828 | return ret < 0 ? ret : -EFAULT; | 840 | return ret < 0 ? ret : -EFAULT; |
829 | } | 841 | } |
830 | ret = i2c_master_send(tx->c, buf, 1); | 842 | |
843 | /* Give the z8 a moment to process data block */ | ||
844 | for (i = 0; i < 10; i++) { | ||
845 | ret = i2c_master_send(tx->c, buf, 1); | ||
846 | if (ret == 1) | ||
847 | break; | ||
848 | udelay(100); | ||
849 | } | ||
850 | |||
831 | if (ret != 1) { | 851 | if (ret != 1) { |
832 | zilog_error("i2c_master_send failed with %d\n", ret); | 852 | zilog_error("i2c_master_send failed with %d\n", ret); |
833 | return ret < 0 ? ret : -EFAULT; | 853 | return ret < 0 ? ret : -EFAULT; |
diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 701561d6b6fd..236dd36d349a 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c | |||
@@ -484,8 +484,6 @@ struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, | |||
484 | net_dev->ml_priv = (void *)pAd; | 484 | net_dev->ml_priv = (void *)pAd; |
485 | pAd->net_dev = net_dev; | 485 | pAd->net_dev = net_dev; |
486 | 486 | ||
487 | netif_stop_queue(net_dev); | ||
488 | |||
489 | return net_dev; | 487 | return net_dev; |
490 | 488 | ||
491 | } | 489 | } |
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index ee68d51caa4e..322bf49ee906 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c | |||
@@ -106,6 +106,7 @@ struct usb_device_id rtusb_usb_id[] = { | |||
106 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ | 106 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ |
107 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ | 107 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ |
108 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ | 108 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ |
109 | {USB_DEVICE(0x1737, 0x0078)}, /* Linksys WUSB100v2 */ | ||
109 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ | 110 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ |
110 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ | 111 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ |
111 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ | 112 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ |
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c index 32088a641eba..84be383abec3 100644 --- a/drivers/staging/rtl8712/hal_init.c +++ b/drivers/staging/rtl8712/hal_init.c | |||
@@ -128,12 +128,13 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) | |||
128 | u8 *ptmpchar = NULL, *ppayload, *ptr; | 128 | u8 *ptmpchar = NULL, *ppayload, *ptr; |
129 | struct tx_desc *ptx_desc; | 129 | struct tx_desc *ptx_desc; |
130 | u32 txdscp_sz = sizeof(struct tx_desc); | 130 | u32 txdscp_sz = sizeof(struct tx_desc); |
131 | u8 ret = _FAIL; | ||
131 | 132 | ||
132 | ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw); | 133 | ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw); |
133 | if (pmappedfw && (ulfilelength > 0)) { | 134 | if (pmappedfw && (ulfilelength > 0)) { |
134 | update_fwhdr(&fwhdr, pmappedfw); | 135 | update_fwhdr(&fwhdr, pmappedfw); |
135 | if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL) | 136 | if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL) |
136 | goto exit_fail; | 137 | goto firmware_rel; |
137 | fill_fwpriv(padapter, &fwhdr.fwpriv); | 138 | fill_fwpriv(padapter, &fwhdr.fwpriv); |
138 | /* firmware check ok */ | 139 | /* firmware check ok */ |
139 | maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ? | 140 | maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ? |
@@ -141,7 +142,7 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) | |||
141 | maxlen += txdscp_sz; | 142 | maxlen += txdscp_sz; |
142 | ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ); | 143 | ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ); |
143 | if (ptmpchar == NULL) | 144 | if (ptmpchar == NULL) |
144 | return _FAIL; | 145 | goto firmware_rel; |
145 | 146 | ||
146 | ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ - | 147 | ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ - |
147 | ((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1))); | 148 | ((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1))); |
@@ -273,11 +274,13 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) | |||
273 | goto exit_fail; | 274 | goto exit_fail; |
274 | } else | 275 | } else |
275 | goto exit_fail; | 276 | goto exit_fail; |
276 | return _SUCCESS; | 277 | ret = _SUCCESS; |
277 | 278 | ||
278 | exit_fail: | 279 | exit_fail: |
279 | kfree(ptmpchar); | 280 | kfree(ptmpchar); |
280 | return _FAIL; | 281 | firmware_rel: |
282 | release_firmware((struct firmware *)phfwfile_hdl); | ||
283 | return ret; | ||
281 | } | 284 | } |
282 | 285 | ||
283 | uint rtl8712_hal_init(struct _adapter *padapter) | 286 | uint rtl8712_hal_init(struct _adapter *padapter) |
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index a692ee88b9e9..21ce2af447b5 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c | |||
@@ -47,54 +47,123 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, | |||
47 | static void r871xu_dev_remove(struct usb_interface *pusb_intf); | 47 | static void r871xu_dev_remove(struct usb_interface *pusb_intf); |
48 | 48 | ||
49 | static struct usb_device_id rtl871x_usb_id_tbl[] = { | 49 | static struct usb_device_id rtl871x_usb_id_tbl[] = { |
50 | /*92SU | 50 | |
51 | * Realtek */ | 51 | /* RTL8188SU */ |
52 | {USB_DEVICE(0x0bda, 0x8171)}, | 52 | /* Realtek */ |
53 | {USB_DEVICE(0x0bda, 0x8172)}, | 53 | {USB_DEVICE(0x0BDA, 0x8171)}, |
54 | {USB_DEVICE(0x0bda, 0x8173)}, | 54 | {USB_DEVICE(0x0bda, 0x8173)}, |
55 | {USB_DEVICE(0x0bda, 0x8174)}, | ||
56 | {USB_DEVICE(0x0bda, 0x8712)}, | 55 | {USB_DEVICE(0x0bda, 0x8712)}, |
57 | {USB_DEVICE(0x0bda, 0x8713)}, | 56 | {USB_DEVICE(0x0bda, 0x8713)}, |
58 | {USB_DEVICE(0x0bda, 0xC512)}, | 57 | {USB_DEVICE(0x0bda, 0xC512)}, |
59 | /* Abocom */ | 58 | /* Abocom */ |
60 | {USB_DEVICE(0x07B8, 0x8188)}, | 59 | {USB_DEVICE(0x07B8, 0x8188)}, |
60 | /* ASUS */ | ||
61 | {USB_DEVICE(0x0B05, 0x1786)}, | ||
62 | {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ | ||
63 | /* Belkin */ | ||
64 | {USB_DEVICE(0x050D, 0x945A)}, | ||
61 | /* Corega */ | 65 | /* Corega */ |
62 | {USB_DEVICE(0x07aa, 0x0047)}, | 66 | {USB_DEVICE(0x07AA, 0x0047)}, |
63 | /* Dlink */ | 67 | /* D-Link */ |
64 | {USB_DEVICE(0x07d1, 0x3303)}, | 68 | {USB_DEVICE(0x2001, 0x3306)}, |
65 | {USB_DEVICE(0x07d1, 0x3302)}, | 69 | {USB_DEVICE(0x07D1, 0x3306)}, /* 11n mode disable */ |
66 | {USB_DEVICE(0x07d1, 0x3300)}, | 70 | /* Edimax */ |
67 | /* Dlink for Skyworth */ | 71 | {USB_DEVICE(0x7392, 0x7611)}, |
68 | {USB_DEVICE(0x14b2, 0x3300)}, | ||
69 | {USB_DEVICE(0x14b2, 0x3301)}, | ||
70 | {USB_DEVICE(0x14b2, 0x3302)}, | ||
71 | /* EnGenius */ | 72 | /* EnGenius */ |
72 | {USB_DEVICE(0x1740, 0x9603)}, | 73 | {USB_DEVICE(0x1740, 0x9603)}, |
73 | {USB_DEVICE(0x1740, 0x9605)}, | 74 | /* Hawking */ |
75 | {USB_DEVICE(0x0E66, 0x0016)}, | ||
76 | /* Hercules */ | ||
77 | {USB_DEVICE(0x06F8, 0xE034)}, | ||
78 | {USB_DEVICE(0x06F8, 0xE032)}, | ||
79 | /* Logitec */ | ||
80 | {USB_DEVICE(0x0789, 0x0167)}, | ||
81 | /* PCI */ | ||
82 | {USB_DEVICE(0x2019, 0xAB28)}, | ||
83 | {USB_DEVICE(0x2019, 0xED16)}, | ||
84 | /* Sitecom */ | ||
85 | {USB_DEVICE(0x0DF6, 0x0057)}, | ||
86 | {USB_DEVICE(0x0DF6, 0x0045)}, | ||
87 | {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ | ||
88 | {USB_DEVICE(0x0DF6, 0x004B)}, | ||
89 | {USB_DEVICE(0x0DF6, 0x0063)}, | ||
90 | /* Sweex */ | ||
91 | {USB_DEVICE(0x177F, 0x0154)}, | ||
92 | /* Thinkware */ | ||
93 | {USB_DEVICE(0x0BDA, 0x5077)}, | ||
94 | /* Toshiba */ | ||
95 | {USB_DEVICE(0x1690, 0x0752)}, | ||
96 | /* - */ | ||
97 | {USB_DEVICE(0x20F4, 0x646B)}, | ||
98 | {USB_DEVICE(0x083A, 0xC512)}, | ||
99 | |||
100 | /* RTL8191SU */ | ||
101 | /* Realtek */ | ||
102 | {USB_DEVICE(0x0BDA, 0x8172)}, | ||
103 | /* Amigo */ | ||
104 | {USB_DEVICE(0x0EB0, 0x9061)}, | ||
105 | /* ASUS/EKB */ | ||
106 | {USB_DEVICE(0x0BDA, 0x8172)}, | ||
107 | {USB_DEVICE(0x13D3, 0x3323)}, | ||
108 | {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */ | ||
109 | {USB_DEVICE(0x13D3, 0x3342)}, | ||
110 | /* ASUS/EKBLenovo */ | ||
111 | {USB_DEVICE(0x13D3, 0x3333)}, | ||
112 | {USB_DEVICE(0x13D3, 0x3334)}, | ||
113 | {USB_DEVICE(0x13D3, 0x3335)}, /* 11n mode disable */ | ||
114 | {USB_DEVICE(0x13D3, 0x3336)}, /* 11n mode disable */ | ||
115 | /* ASUS/Media BOX */ | ||
116 | {USB_DEVICE(0x13D3, 0x3309)}, | ||
74 | /* Belkin */ | 117 | /* Belkin */ |
75 | {USB_DEVICE(0x050d, 0x815F)}, | 118 | {USB_DEVICE(0x050D, 0x815F)}, |
76 | {USB_DEVICE(0x050d, 0x945A)}, | 119 | /* D-Link */ |
77 | {USB_DEVICE(0x050d, 0x845A)}, | 120 | {USB_DEVICE(0x07D1, 0x3302)}, |
78 | /* Guillemot */ | 121 | {USB_DEVICE(0x07D1, 0x3300)}, |
79 | {USB_DEVICE(0x06f8, 0xe031)}, | 122 | {USB_DEVICE(0x07D1, 0x3303)}, |
80 | /* Edimax */ | 123 | /* Edimax */ |
81 | {USB_DEVICE(0x7392, 0x7611)}, | ||
82 | {USB_DEVICE(0x7392, 0x7612)}, | 124 | {USB_DEVICE(0x7392, 0x7612)}, |
83 | {USB_DEVICE(0x7392, 0x7622)}, | 125 | /* EnGenius */ |
84 | /* Sitecom */ | 126 | {USB_DEVICE(0x1740, 0x9605)}, |
85 | {USB_DEVICE(0x0DF6, 0x0045)}, | 127 | /* Guillemot */ |
128 | {USB_DEVICE(0x06F8, 0xE031)}, | ||
86 | /* Hawking */ | 129 | /* Hawking */ |
87 | {USB_DEVICE(0x0E66, 0x0015)}, | 130 | {USB_DEVICE(0x0E66, 0x0015)}, |
88 | {USB_DEVICE(0x0E66, 0x0016)}, | 131 | /* Mediao */ |
89 | {USB_DEVICE(0x0b05, 0x1786)}, | ||
90 | {USB_DEVICE(0x0b05, 0x1791)}, /* 11n mode disable */ | ||
91 | |||
92 | {USB_DEVICE(0x13D3, 0x3306)}, | 132 | {USB_DEVICE(0x13D3, 0x3306)}, |
93 | {USB_DEVICE(0x13D3, 0x3309)}, | 133 | /* PCI */ |
134 | {USB_DEVICE(0x2019, 0xED18)}, | ||
135 | {USB_DEVICE(0x2019, 0x4901)}, | ||
136 | /* Sitecom */ | ||
137 | {USB_DEVICE(0x0DF6, 0x0058)}, | ||
138 | {USB_DEVICE(0x0DF6, 0x0049)}, | ||
139 | {USB_DEVICE(0x0DF6, 0x004C)}, | ||
140 | {USB_DEVICE(0x0DF6, 0x0064)}, | ||
141 | /* Skyworth */ | ||
142 | {USB_DEVICE(0x14b2, 0x3300)}, | ||
143 | {USB_DEVICE(0x14b2, 0x3301)}, | ||
144 | {USB_DEVICE(0x14B2, 0x3302)}, | ||
145 | /* - */ | ||
146 | {USB_DEVICE(0x04F2, 0xAFF2)}, | ||
147 | {USB_DEVICE(0x04F2, 0xAFF5)}, | ||
148 | {USB_DEVICE(0x04F2, 0xAFF6)}, | ||
149 | {USB_DEVICE(0x13D3, 0x3339)}, | ||
150 | {USB_DEVICE(0x13D3, 0x3340)}, /* 11n mode disable */ | ||
151 | {USB_DEVICE(0x13D3, 0x3341)}, /* 11n mode disable */ | ||
94 | {USB_DEVICE(0x13D3, 0x3310)}, | 152 | {USB_DEVICE(0x13D3, 0x3310)}, |
95 | {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */ | ||
96 | {USB_DEVICE(0x13D3, 0x3325)}, | 153 | {USB_DEVICE(0x13D3, 0x3325)}, |
97 | {USB_DEVICE(0x083A, 0xC512)}, | 154 | |
155 | /* RTL8192SU */ | ||
156 | /* Realtek */ | ||
157 | {USB_DEVICE(0x0BDA, 0x8174)}, | ||
158 | {USB_DEVICE(0x0BDA, 0x8174)}, | ||
159 | /* Belkin */ | ||
160 | {USB_DEVICE(0x050D, 0x845A)}, | ||
161 | /* Corega */ | ||
162 | {USB_DEVICE(0x07AA, 0x0051)}, | ||
163 | /* Edimax */ | ||
164 | {USB_DEVICE(0x7392, 0x7622)}, | ||
165 | /* NEC */ | ||
166 | {USB_DEVICE(0x0409, 0x02B6)}, | ||
98 | {} | 167 | {} |
99 | }; | 168 | }; |
100 | 169 | ||
@@ -103,8 +172,20 @@ MODULE_DEVICE_TABLE(usb, rtl871x_usb_id_tbl); | |||
103 | static struct specific_device_id specific_device_id_tbl[] = { | 172 | static struct specific_device_id specific_device_id_tbl[] = { |
104 | {.idVendor = 0x0b05, .idProduct = 0x1791, | 173 | {.idVendor = 0x0b05, .idProduct = 0x1791, |
105 | .flags = SPEC_DEV_ID_DISABLE_HT}, | 174 | .flags = SPEC_DEV_ID_DISABLE_HT}, |
175 | {.idVendor = 0x0df6, .idProduct = 0x0059, | ||
176 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
177 | {.idVendor = 0x13d3, .idProduct = 0x3306, | ||
178 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
106 | {.idVendor = 0x13D3, .idProduct = 0x3311, | 179 | {.idVendor = 0x13D3, .idProduct = 0x3311, |
107 | .flags = SPEC_DEV_ID_DISABLE_HT}, | 180 | .flags = SPEC_DEV_ID_DISABLE_HT}, |
181 | {.idVendor = 0x13d3, .idProduct = 0x3335, | ||
182 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
183 | {.idVendor = 0x13d3, .idProduct = 0x3336, | ||
184 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
185 | {.idVendor = 0x13d3, .idProduct = 0x3340, | ||
186 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
187 | {.idVendor = 0x13d3, .idProduct = 0x3341, | ||
188 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
108 | {} | 189 | {} |
109 | }; | 190 | }; |
110 | 191 | ||
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 408bb9b3303e..07a7f5432597 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c | |||
@@ -332,7 +332,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
332 | unsigned long flags; | 332 | unsigned long flags; |
333 | 333 | ||
334 | len = strlen(buf); | 334 | len = strlen(buf); |
335 | if (len > 0 || len < 3) { | 335 | if (len > 0 && len < 3) { |
336 | ch = buf[0]; | 336 | ch = buf[0]; |
337 | if (ch == '\n') | 337 | if (ch == '\n') |
338 | ch = '0'; | 338 | ch = '0'; |
diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index e8f047e86a32..80183a7e6624 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | |||
@@ -986,12 +986,6 @@ static int __devinit synaptics_rmi4_probe | |||
986 | input_set_abs_params(rmi4_data->input_dev, ABS_MT_TOUCH_MAJOR, 0, | 986 | input_set_abs_params(rmi4_data->input_dev, ABS_MT_TOUCH_MAJOR, 0, |
987 | MAX_TOUCH_MAJOR, 0, 0); | 987 | MAX_TOUCH_MAJOR, 0, 0); |
988 | 988 | ||
989 | retval = input_register_device(rmi4_data->input_dev); | ||
990 | if (retval) { | ||
991 | dev_err(&client->dev, "%s:input register failed\n", __func__); | ||
992 | goto err_input_register; | ||
993 | } | ||
994 | |||
995 | /* Clear interrupts */ | 989 | /* Clear interrupts */ |
996 | synaptics_rmi4_i2c_block_read(rmi4_data, | 990 | synaptics_rmi4_i2c_block_read(rmi4_data, |
997 | rmi4_data->fn01_data_base_addr + 1, intr_status, | 991 | rmi4_data->fn01_data_base_addr + 1, intr_status, |
@@ -1003,15 +997,20 @@ static int __devinit synaptics_rmi4_probe | |||
1003 | if (retval) { | 997 | if (retval) { |
1004 | dev_err(&client->dev, "%s:Unable to get attn irq %d\n", | 998 | dev_err(&client->dev, "%s:Unable to get attn irq %d\n", |
1005 | __func__, platformdata->irq_number); | 999 | __func__, platformdata->irq_number); |
1006 | goto err_request_irq; | 1000 | goto err_unset_clientdata; |
1001 | } | ||
1002 | |||
1003 | retval = input_register_device(rmi4_data->input_dev); | ||
1004 | if (retval) { | ||
1005 | dev_err(&client->dev, "%s:input register failed\n", __func__); | ||
1006 | goto err_free_irq; | ||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | return retval; | 1009 | return retval; |
1010 | 1010 | ||
1011 | err_request_irq: | 1011 | err_free_irq: |
1012 | free_irq(platformdata->irq_number, rmi4_data); | 1012 | free_irq(platformdata->irq_number, rmi4_data); |
1013 | input_unregister_device(rmi4_data->input_dev); | 1013 | err_unset_clientdata: |
1014 | err_input_register: | ||
1015 | i2c_set_clientdata(client, NULL); | 1014 | i2c_set_clientdata(client, NULL); |
1016 | err_query_dev: | 1015 | err_query_dev: |
1017 | if (platformdata->regulator_en) { | 1016 | if (platformdata->regulator_en) { |
diff --git a/drivers/staging/tidspbridge/core/io_sm.c b/drivers/staging/tidspbridge/core/io_sm.c index 571864555ddd..27e0aa81a584 100644 --- a/drivers/staging/tidspbridge/core/io_sm.c +++ b/drivers/staging/tidspbridge/core/io_sm.c | |||
@@ -949,7 +949,7 @@ func_end: | |||
949 | * Calls the Bridge's CHNL_ISR to determine if this interrupt is ours, then | 949 | * Calls the Bridge's CHNL_ISR to determine if this interrupt is ours, then |
950 | * schedules a DPC to dispatch I/O. | 950 | * schedules a DPC to dispatch I/O. |
951 | */ | 951 | */ |
952 | void io_mbox_msg(u32 msg) | 952 | int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg) |
953 | { | 953 | { |
954 | struct io_mgr *pio_mgr; | 954 | struct io_mgr *pio_mgr; |
955 | struct dev_object *dev_obj; | 955 | struct dev_object *dev_obj; |
@@ -959,9 +959,9 @@ void io_mbox_msg(u32 msg) | |||
959 | dev_get_io_mgr(dev_obj, &pio_mgr); | 959 | dev_get_io_mgr(dev_obj, &pio_mgr); |
960 | 960 | ||
961 | if (!pio_mgr) | 961 | if (!pio_mgr) |
962 | return; | 962 | return NOTIFY_BAD; |
963 | 963 | ||
964 | pio_mgr->intr_val = (u16)msg; | 964 | pio_mgr->intr_val = (u16)((u32)msg); |
965 | if (pio_mgr->intr_val & MBX_PM_CLASS) | 965 | if (pio_mgr->intr_val & MBX_PM_CLASS) |
966 | io_dispatch_pm(pio_mgr); | 966 | io_dispatch_pm(pio_mgr); |
967 | 967 | ||
@@ -973,7 +973,7 @@ void io_mbox_msg(u32 msg) | |||
973 | spin_unlock_irqrestore(&pio_mgr->dpc_lock, flags); | 973 | spin_unlock_irqrestore(&pio_mgr->dpc_lock, flags); |
974 | tasklet_schedule(&pio_mgr->dpc_tasklet); | 974 | tasklet_schedule(&pio_mgr->dpc_tasklet); |
975 | } | 975 | } |
976 | return; | 976 | return NOTIFY_OK; |
977 | } | 977 | } |
978 | 978 | ||
979 | /* | 979 | /* |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index a3b0a183d570..a3f69f6f505f 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -223,6 +223,10 @@ static struct bridge_drv_interface drv_interface_fxns = { | |||
223 | bridge_msg_set_queue_id, | 223 | bridge_msg_set_queue_id, |
224 | }; | 224 | }; |
225 | 225 | ||
226 | static struct notifier_block dsp_mbox_notifier = { | ||
227 | .notifier_call = io_mbox_msg, | ||
228 | }; | ||
229 | |||
226 | static inline void flush_all(struct bridge_dev_context *dev_context) | 230 | static inline void flush_all(struct bridge_dev_context *dev_context) |
227 | { | 231 | { |
228 | if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION || | 232 | if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION || |
@@ -553,7 +557,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
553 | * Enable Mailbox events and also drain any pending | 557 | * Enable Mailbox events and also drain any pending |
554 | * stale messages. | 558 | * stale messages. |
555 | */ | 559 | */ |
556 | dev_context->mbox = omap_mbox_get("dsp"); | 560 | dev_context->mbox = omap_mbox_get("dsp", &dsp_mbox_notifier); |
557 | if (IS_ERR(dev_context->mbox)) { | 561 | if (IS_ERR(dev_context->mbox)) { |
558 | dev_context->mbox = NULL; | 562 | dev_context->mbox = NULL; |
559 | pr_err("%s: Failed to get dsp mailbox handle\n", | 563 | pr_err("%s: Failed to get dsp mailbox handle\n", |
@@ -563,8 +567,6 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
563 | 567 | ||
564 | } | 568 | } |
565 | if (!status) { | 569 | if (!status) { |
566 | dev_context->mbox->rxq->callback = (int (*)(void *))io_mbox_msg; | ||
567 | |||
568 | /*PM_IVA2GRPSEL_PER = 0xC0;*/ | 570 | /*PM_IVA2GRPSEL_PER = 0xC0;*/ |
569 | temp = readl(resources->dw_per_pm_base + 0xA8); | 571 | temp = readl(resources->dw_per_pm_base + 0xA8); |
570 | temp = (temp & 0xFFFFFF30) | 0xC0; | 572 | temp = (temp & 0xFFFFFF30) | 0xC0; |
@@ -685,7 +687,7 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt) | |||
685 | /* Disable the mailbox interrupts */ | 687 | /* Disable the mailbox interrupts */ |
686 | if (dev_context->mbox) { | 688 | if (dev_context->mbox) { |
687 | omap_mbox_disable_irq(dev_context->mbox, IRQ_RX); | 689 | omap_mbox_disable_irq(dev_context->mbox, IRQ_RX); |
688 | omap_mbox_put(dev_context->mbox); | 690 | omap_mbox_put(dev_context->mbox, &dsp_mbox_notifier); |
689 | dev_context->mbox = NULL; | 691 | dev_context->mbox = NULL; |
690 | } | 692 | } |
691 | /* Reset IVA2 clocks*/ | 693 | /* Reset IVA2 clocks*/ |
@@ -786,10 +788,7 @@ static int bridge_dev_create(struct bridge_dev_context | |||
786 | 788 | ||
787 | pt_attrs = kzalloc(sizeof(struct pg_table_attrs), GFP_KERNEL); | 789 | pt_attrs = kzalloc(sizeof(struct pg_table_attrs), GFP_KERNEL); |
788 | if (pt_attrs != NULL) { | 790 | if (pt_attrs != NULL) { |
789 | /* Assuming that we use only DSP's memory map | 791 | pt_attrs->l1_size = SZ_16K; /* 4096 entries of 32 bits */ |
790 | * until 0x4000:0000 , we would need only 1024 | ||
791 | * L1 enties i.e L1 size = 4K */ | ||
792 | pt_attrs->l1_size = 0x1000; | ||
793 | align_size = pt_attrs->l1_size; | 792 | align_size = pt_attrs->l1_size; |
794 | /* Align sizes are expected to be power of 2 */ | 793 | /* Align sizes are expected to be power of 2 */ |
795 | /* we like to get aligned on L1 table size */ | 794 | /* we like to get aligned on L1 table size */ |
diff --git a/drivers/staging/tidspbridge/include/dspbridge/io_sm.h b/drivers/staging/tidspbridge/include/dspbridge/io_sm.h index 18aec55d8647..8242c70e09dd 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/io_sm.h +++ b/drivers/staging/tidspbridge/include/dspbridge/io_sm.h | |||
@@ -72,22 +72,17 @@ extern void io_dpc(unsigned long ref_data); | |||
72 | /* | 72 | /* |
73 | * ======== io_mbox_msg ======== | 73 | * ======== io_mbox_msg ======== |
74 | * Purpose: | 74 | * Purpose: |
75 | * Main interrupt handler for the shared memory Bridge channel manager. | 75 | * Main message handler for the shared memory Bridge channel manager. |
76 | * Calls the Bridge's chnlsm_isr to determine if this interrupt is ours, | 76 | * Determine if this message is ours, then schedules a DPC to |
77 | * then schedules a DPC to dispatch I/O. | 77 | * dispatch I/O. |
78 | * Parameters: | 78 | * Parameters: |
79 | * ref_data: Pointer to the channel manager object for this board. | 79 | * self: Pointer to its own notifier_block struct. |
80 | * Set in an initial call to ISR_Install(). | 80 | * len: Length of message. |
81 | * msg: Message code received. | ||
81 | * Returns: | 82 | * Returns: |
82 | * TRUE if interrupt handled; FALSE otherwise. | 83 | * NOTIFY_OK if handled; NOTIFY_BAD otherwise. |
83 | * Requires: | ||
84 | * Must be in locked memory if executing in kernel mode. | ||
85 | * Must only call functions which are in locked memory if Kernel mode. | ||
86 | * Must only call asynchronous services. | ||
87 | * Interrupts are disabled and EOI for this interrupt has been sent. | ||
88 | * Ensures: | ||
89 | */ | 84 | */ |
90 | void io_mbox_msg(u32 msg); | 85 | int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg); |
91 | 86 | ||
92 | /* | 87 | /* |
93 | * ======== io_request_chnl ======== | 88 | * ======== io_request_chnl ======== |
diff --git a/drivers/staging/usbip/stub.h b/drivers/staging/usbip/stub.h index 30dbfb6d16f2..d73267961ef4 100644 --- a/drivers/staging/usbip/stub.h +++ b/drivers/staging/usbip/stub.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | struct stub_device { | 33 | struct stub_device { |
34 | struct usb_interface *interface; | 34 | struct usb_interface *interface; |
35 | struct usb_device *udev; | ||
35 | struct list_head list; | 36 | struct list_head list; |
36 | 37 | ||
37 | struct usbip_device ud; | 38 | struct usbip_device ud; |
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index b186b5fed2b9..a7ce51cc8909 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c | |||
@@ -258,10 +258,11 @@ static void stub_shutdown_connection(struct usbip_device *ud) | |||
258 | static void stub_device_reset(struct usbip_device *ud) | 258 | static void stub_device_reset(struct usbip_device *ud) |
259 | { | 259 | { |
260 | struct stub_device *sdev = container_of(ud, struct stub_device, ud); | 260 | struct stub_device *sdev = container_of(ud, struct stub_device, ud); |
261 | struct usb_device *udev = interface_to_usbdev(sdev->interface); | 261 | struct usb_device *udev = sdev->udev; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
264 | usbip_udbg("device reset"); | 264 | usbip_udbg("device reset"); |
265 | |||
265 | ret = usb_lock_device_for_reset(udev, sdev->interface); | 266 | ret = usb_lock_device_for_reset(udev, sdev->interface); |
266 | if (ret < 0) { | 267 | if (ret < 0) { |
267 | dev_err(&udev->dev, "lock for reset\n"); | 268 | dev_err(&udev->dev, "lock for reset\n"); |
@@ -309,7 +310,8 @@ static void stub_device_unusable(struct usbip_device *ud) | |||
309 | * | 310 | * |
310 | * Allocates and initializes a new stub_device struct. | 311 | * Allocates and initializes a new stub_device struct. |
311 | */ | 312 | */ |
312 | static struct stub_device *stub_device_alloc(struct usb_interface *interface) | 313 | static struct stub_device *stub_device_alloc(struct usb_device *udev, |
314 | struct usb_interface *interface) | ||
313 | { | 315 | { |
314 | struct stub_device *sdev; | 316 | struct stub_device *sdev; |
315 | int busnum = interface_to_busnum(interface); | 317 | int busnum = interface_to_busnum(interface); |
@@ -324,7 +326,8 @@ static struct stub_device *stub_device_alloc(struct usb_interface *interface) | |||
324 | return NULL; | 326 | return NULL; |
325 | } | 327 | } |
326 | 328 | ||
327 | sdev->interface = interface; | 329 | sdev->interface = usb_get_intf(interface); |
330 | sdev->udev = usb_get_dev(udev); | ||
328 | 331 | ||
329 | /* | 332 | /* |
330 | * devid is defined with devnum when this driver is first allocated. | 333 | * devid is defined with devnum when this driver is first allocated. |
@@ -450,11 +453,12 @@ static int stub_probe(struct usb_interface *interface, | |||
450 | return err; | 453 | return err; |
451 | } | 454 | } |
452 | 455 | ||
456 | usb_get_intf(interface); | ||
453 | return 0; | 457 | return 0; |
454 | } | 458 | } |
455 | 459 | ||
456 | /* ok. this is my device. */ | 460 | /* ok. this is my device. */ |
457 | sdev = stub_device_alloc(interface); | 461 | sdev = stub_device_alloc(udev, interface); |
458 | if (!sdev) | 462 | if (!sdev) |
459 | return -ENOMEM; | 463 | return -ENOMEM; |
460 | 464 | ||
@@ -476,6 +480,8 @@ static int stub_probe(struct usb_interface *interface, | |||
476 | dev_err(&interface->dev, "create sysfs files for %s\n", | 480 | dev_err(&interface->dev, "create sysfs files for %s\n", |
477 | udev_busid); | 481 | udev_busid); |
478 | usb_set_intfdata(interface, NULL); | 482 | usb_set_intfdata(interface, NULL); |
483 | usb_put_intf(interface); | ||
484 | |||
479 | busid_priv->interf_count = 0; | 485 | busid_priv->interf_count = 0; |
480 | 486 | ||
481 | busid_priv->sdev = NULL; | 487 | busid_priv->sdev = NULL; |
@@ -545,6 +551,7 @@ static void stub_disconnect(struct usb_interface *interface) | |||
545 | if (busid_priv->interf_count > 1) { | 551 | if (busid_priv->interf_count > 1) { |
546 | busid_priv->interf_count--; | 552 | busid_priv->interf_count--; |
547 | shutdown_busid(busid_priv); | 553 | shutdown_busid(busid_priv); |
554 | usb_put_intf(interface); | ||
548 | return; | 555 | return; |
549 | } | 556 | } |
550 | 557 | ||
@@ -554,6 +561,9 @@ static void stub_disconnect(struct usb_interface *interface) | |||
554 | /* 1. shutdown the current connection */ | 561 | /* 1. shutdown the current connection */ |
555 | shutdown_busid(busid_priv); | 562 | shutdown_busid(busid_priv); |
556 | 563 | ||
564 | usb_put_dev(sdev->udev); | ||
565 | usb_put_intf(interface); | ||
566 | |||
557 | /* 3. free sdev */ | 567 | /* 3. free sdev */ |
558 | busid_priv->sdev = NULL; | 568 | busid_priv->sdev = NULL; |
559 | stub_device_free(sdev); | 569 | stub_device_free(sdev); |
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index 3de6fd2539dc..ae6ac82754a4 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c | |||
@@ -364,7 +364,7 @@ static struct stub_priv *stub_priv_alloc(struct stub_device *sdev, | |||
364 | 364 | ||
365 | static int get_pipe(struct stub_device *sdev, int epnum, int dir) | 365 | static int get_pipe(struct stub_device *sdev, int epnum, int dir) |
366 | { | 366 | { |
367 | struct usb_device *udev = interface_to_usbdev(sdev->interface); | 367 | struct usb_device *udev = sdev->udev; |
368 | struct usb_host_endpoint *ep; | 368 | struct usb_host_endpoint *ep; |
369 | struct usb_endpoint_descriptor *epd = NULL; | 369 | struct usb_endpoint_descriptor *epd = NULL; |
370 | 370 | ||
@@ -484,7 +484,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, | |||
484 | int ret; | 484 | int ret; |
485 | struct stub_priv *priv; | 485 | struct stub_priv *priv; |
486 | struct usbip_device *ud = &sdev->ud; | 486 | struct usbip_device *ud = &sdev->ud; |
487 | struct usb_device *udev = interface_to_usbdev(sdev->interface); | 487 | struct usb_device *udev = sdev->udev; |
488 | int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction); | 488 | int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction); |
489 | 489 | ||
490 | 490 | ||
diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h index 41a1fe5138f4..afc3b1a71881 100644 --- a/drivers/staging/usbip/vhci.h +++ b/drivers/staging/usbip/vhci.h | |||
@@ -100,9 +100,6 @@ struct vhci_hcd { | |||
100 | * But, the index of this array begins from 0. | 100 | * But, the index of this array begins from 0. |
101 | */ | 101 | */ |
102 | struct vhci_device vdev[VHCI_NPORTS]; | 102 | struct vhci_device vdev[VHCI_NPORTS]; |
103 | |||
104 | /* vhci_device which has not been assiged its address yet */ | ||
105 | int pending_port; | ||
106 | }; | 103 | }; |
107 | 104 | ||
108 | 105 | ||
@@ -119,6 +116,9 @@ void rh_port_disconnect(int rhport); | |||
119 | void vhci_rx_loop(struct usbip_task *ut); | 116 | void vhci_rx_loop(struct usbip_task *ut); |
120 | void vhci_tx_loop(struct usbip_task *ut); | 117 | void vhci_tx_loop(struct usbip_task *ut); |
121 | 118 | ||
119 | struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, | ||
120 | __u32 seqnum); | ||
121 | |||
122 | #define hardware (&the_controller->pdev.dev) | 122 | #define hardware (&the_controller->pdev.dev) |
123 | 123 | ||
124 | static inline struct vhci_device *port_to_vdev(__u32 port) | 124 | static inline struct vhci_device *port_to_vdev(__u32 port) |
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 08bd26a245d5..a35fe61268de 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c | |||
@@ -138,8 +138,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed) | |||
138 | * the_controller->vdev[rhport].ud.status = VDEV_CONNECT; | 138 | * the_controller->vdev[rhport].ud.status = VDEV_CONNECT; |
139 | * spin_unlock(&the_controller->vdev[rhport].ud.lock); */ | 139 | * spin_unlock(&the_controller->vdev[rhport].ud.lock); */ |
140 | 140 | ||
141 | the_controller->pending_port = rhport; | ||
142 | |||
143 | spin_unlock_irqrestore(&the_controller->lock, flags); | 141 | spin_unlock_irqrestore(&the_controller->lock, flags); |
144 | 142 | ||
145 | usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); | 143 | usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); |
@@ -559,6 +557,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
559 | struct device *dev = &urb->dev->dev; | 557 | struct device *dev = &urb->dev->dev; |
560 | int ret = 0; | 558 | int ret = 0; |
561 | unsigned long flags; | 559 | unsigned long flags; |
560 | struct vhci_device *vdev; | ||
562 | 561 | ||
563 | usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n", | 562 | usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n", |
564 | hcd, urb, mem_flags); | 563 | hcd, urb, mem_flags); |
@@ -574,6 +573,18 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
574 | return urb->status; | 573 | return urb->status; |
575 | } | 574 | } |
576 | 575 | ||
576 | vdev = port_to_vdev(urb->dev->portnum-1); | ||
577 | |||
578 | /* refuse enqueue for dead connection */ | ||
579 | spin_lock(&vdev->ud.lock); | ||
580 | if (vdev->ud.status == VDEV_ST_NULL || vdev->ud.status == VDEV_ST_ERROR) { | ||
581 | usbip_uerr("enqueue for inactive port %d\n", vdev->rhport); | ||
582 | spin_unlock(&vdev->ud.lock); | ||
583 | spin_unlock_irqrestore(&the_controller->lock, flags); | ||
584 | return -ENODEV; | ||
585 | } | ||
586 | spin_unlock(&vdev->ud.lock); | ||
587 | |||
577 | ret = usb_hcd_link_urb_to_ep(hcd, urb); | 588 | ret = usb_hcd_link_urb_to_ep(hcd, urb); |
578 | if (ret) | 589 | if (ret) |
579 | goto no_need_unlink; | 590 | goto no_need_unlink; |
@@ -592,8 +603,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
592 | __u8 type = usb_pipetype(urb->pipe); | 603 | __u8 type = usb_pipetype(urb->pipe); |
593 | struct usb_ctrlrequest *ctrlreq = | 604 | struct usb_ctrlrequest *ctrlreq = |
594 | (struct usb_ctrlrequest *) urb->setup_packet; | 605 | (struct usb_ctrlrequest *) urb->setup_packet; |
595 | struct vhci_device *vdev = | ||
596 | port_to_vdev(the_controller->pending_port); | ||
597 | 606 | ||
598 | if (type != PIPE_CONTROL || !ctrlreq) { | 607 | if (type != PIPE_CONTROL || !ctrlreq) { |
599 | dev_err(dev, "invalid request to devnum 0\n"); | 608 | dev_err(dev, "invalid request to devnum 0\n"); |
@@ -607,7 +616,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
607 | dev_info(dev, "SetAddress Request (%d) to port %d\n", | 616 | dev_info(dev, "SetAddress Request (%d) to port %d\n", |
608 | ctrlreq->wValue, vdev->rhport); | 617 | ctrlreq->wValue, vdev->rhport); |
609 | 618 | ||
610 | vdev->udev = urb->dev; | 619 | if (vdev->udev) |
620 | usb_put_dev(vdev->udev); | ||
621 | vdev->udev = usb_get_dev(urb->dev); | ||
611 | 622 | ||
612 | spin_lock(&vdev->ud.lock); | 623 | spin_lock(&vdev->ud.lock); |
613 | vdev->ud.status = VDEV_ST_USED; | 624 | vdev->ud.status = VDEV_ST_USED; |
@@ -627,8 +638,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
627 | "Get_Descriptor to device 0 " | 638 | "Get_Descriptor to device 0 " |
628 | "(get max pipe size)\n"); | 639 | "(get max pipe size)\n"); |
629 | 640 | ||
630 | /* FIXME: reference count? (usb_get_dev()) */ | 641 | if (vdev->udev) |
631 | vdev->udev = urb->dev; | 642 | usb_put_dev(vdev->udev); |
643 | vdev->udev = usb_get_dev(urb->dev); | ||
632 | goto out; | 644 | goto out; |
633 | 645 | ||
634 | default: | 646 | default: |
@@ -805,7 +817,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
805 | return 0; | 817 | return 0; |
806 | } | 818 | } |
807 | 819 | ||
808 | |||
809 | static void vhci_device_unlink_cleanup(struct vhci_device *vdev) | 820 | static void vhci_device_unlink_cleanup(struct vhci_device *vdev) |
810 | { | 821 | { |
811 | struct vhci_unlink *unlink, *tmp; | 822 | struct vhci_unlink *unlink, *tmp; |
@@ -813,11 +824,34 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) | |||
813 | spin_lock(&vdev->priv_lock); | 824 | spin_lock(&vdev->priv_lock); |
814 | 825 | ||
815 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { | 826 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { |
827 | usbip_uinfo("unlink cleanup tx %lu\n", unlink->unlink_seqnum); | ||
816 | list_del(&unlink->list); | 828 | list_del(&unlink->list); |
817 | kfree(unlink); | 829 | kfree(unlink); |
818 | } | 830 | } |
819 | 831 | ||
820 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) { | 832 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) { |
833 | struct urb *urb; | ||
834 | |||
835 | /* give back URB of unanswered unlink request */ | ||
836 | usbip_uinfo("unlink cleanup rx %lu\n", unlink->unlink_seqnum); | ||
837 | |||
838 | urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); | ||
839 | if (!urb) { | ||
840 | usbip_uinfo("the urb (seqnum %lu) was already given back\n", | ||
841 | unlink->unlink_seqnum); | ||
842 | list_del(&unlink->list); | ||
843 | kfree(unlink); | ||
844 | continue; | ||
845 | } | ||
846 | |||
847 | urb->status = -ENODEV; | ||
848 | |||
849 | spin_lock(&the_controller->lock); | ||
850 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); | ||
851 | spin_unlock(&the_controller->lock); | ||
852 | |||
853 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); | ||
854 | |||
821 | list_del(&unlink->list); | 855 | list_del(&unlink->list); |
822 | kfree(unlink); | 856 | kfree(unlink); |
823 | } | 857 | } |
@@ -887,6 +921,10 @@ static void vhci_device_reset(struct usbip_device *ud) | |||
887 | vdev->speed = 0; | 921 | vdev->speed = 0; |
888 | vdev->devid = 0; | 922 | vdev->devid = 0; |
889 | 923 | ||
924 | if (vdev->udev) | ||
925 | usb_put_dev(vdev->udev); | ||
926 | vdev->udev = NULL; | ||
927 | |||
890 | ud->tcp_socket = NULL; | 928 | ud->tcp_socket = NULL; |
891 | 929 | ||
892 | ud->status = VDEV_ST_NULL; | 930 | ud->status = VDEV_ST_NULL; |
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index 8147d7202b2d..bf6991470941 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c | |||
@@ -23,16 +23,14 @@ | |||
23 | #include "vhci.h" | 23 | #include "vhci.h" |
24 | 24 | ||
25 | 25 | ||
26 | /* get URB from transmitted urb queue */ | 26 | /* get URB from transmitted urb queue. caller must hold vdev->priv_lock */ |
27 | static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, | 27 | struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, |
28 | __u32 seqnum) | 28 | __u32 seqnum) |
29 | { | 29 | { |
30 | struct vhci_priv *priv, *tmp; | 30 | struct vhci_priv *priv, *tmp; |
31 | struct urb *urb = NULL; | 31 | struct urb *urb = NULL; |
32 | int status; | 32 | int status; |
33 | 33 | ||
34 | spin_lock(&vdev->priv_lock); | ||
35 | |||
36 | list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) { | 34 | list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) { |
37 | if (priv->seqnum == seqnum) { | 35 | if (priv->seqnum == seqnum) { |
38 | urb = priv->urb; | 36 | urb = priv->urb; |
@@ -63,8 +61,6 @@ static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, | |||
63 | } | 61 | } |
64 | } | 62 | } |
65 | 63 | ||
66 | spin_unlock(&vdev->priv_lock); | ||
67 | |||
68 | return urb; | 64 | return urb; |
69 | } | 65 | } |
70 | 66 | ||
@@ -74,9 +70,11 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, | |||
74 | struct usbip_device *ud = &vdev->ud; | 70 | struct usbip_device *ud = &vdev->ud; |
75 | struct urb *urb; | 71 | struct urb *urb; |
76 | 72 | ||
73 | spin_lock(&vdev->priv_lock); | ||
77 | 74 | ||
78 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); | 75 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); |
79 | 76 | ||
77 | spin_unlock(&vdev->priv_lock); | ||
80 | 78 | ||
81 | if (!urb) { | 79 | if (!urb) { |
82 | usbip_uerr("cannot find a urb of seqnum %u\n", | 80 | usbip_uerr("cannot find a urb of seqnum %u\n", |
@@ -161,7 +159,12 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
161 | return; | 159 | return; |
162 | } | 160 | } |
163 | 161 | ||
162 | spin_lock(&vdev->priv_lock); | ||
163 | |||
164 | urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); | 164 | urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); |
165 | |||
166 | spin_unlock(&vdev->priv_lock); | ||
167 | |||
165 | if (!urb) { | 168 | if (!urb) { |
166 | /* | 169 | /* |
167 | * I get the result of a unlink request. But, it seems that I | 170 | * I get the result of a unlink request. But, it seems that I |
@@ -190,6 +193,19 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
190 | return; | 193 | return; |
191 | } | 194 | } |
192 | 195 | ||
196 | static int vhci_priv_tx_empty(struct vhci_device *vdev) | ||
197 | { | ||
198 | int empty = 0; | ||
199 | |||
200 | spin_lock(&vdev->priv_lock); | ||
201 | |||
202 | empty = list_empty(&vdev->priv_rx); | ||
203 | |||
204 | spin_unlock(&vdev->priv_lock); | ||
205 | |||
206 | return empty; | ||
207 | } | ||
208 | |||
193 | /* recv a pdu */ | 209 | /* recv a pdu */ |
194 | static void vhci_rx_pdu(struct usbip_device *ud) | 210 | static void vhci_rx_pdu(struct usbip_device *ud) |
195 | { | 211 | { |
@@ -202,11 +218,29 @@ static void vhci_rx_pdu(struct usbip_device *ud) | |||
202 | 218 | ||
203 | memset(&pdu, 0, sizeof(pdu)); | 219 | memset(&pdu, 0, sizeof(pdu)); |
204 | 220 | ||
205 | |||
206 | /* 1. receive a pdu header */ | 221 | /* 1. receive a pdu header */ |
207 | ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0); | 222 | ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0); |
223 | if (ret < 0) { | ||
224 | if (ret == -ECONNRESET) | ||
225 | usbip_uinfo("connection reset by peer\n"); | ||
226 | else if (ret == -EAGAIN) { | ||
227 | /* ignore if connection was idle */ | ||
228 | if (vhci_priv_tx_empty(vdev)) | ||
229 | return; | ||
230 | usbip_uinfo("connection timed out with pending urbs\n"); | ||
231 | } else if (ret != -ERESTARTSYS) | ||
232 | usbip_uinfo("xmit failed %d\n", ret); | ||
233 | |||
234 | usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); | ||
235 | return; | ||
236 | } | ||
237 | if (ret == 0) { | ||
238 | usbip_uinfo("connection closed"); | ||
239 | usbip_event_add(ud, VDEV_EVENT_DOWN); | ||
240 | return; | ||
241 | } | ||
208 | if (ret != sizeof(pdu)) { | 242 | if (ret != sizeof(pdu)) { |
209 | usbip_uerr("receiving pdu failed! size is %d, should be %d\n", | 243 | usbip_uerr("received pdu size is %d, should be %d\n", |
210 | ret, (unsigned int)sizeof(pdu)); | 244 | ret, (unsigned int)sizeof(pdu)); |
211 | usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); | 245 | usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); |
212 | return; | 246 | return; |
diff --git a/drivers/staging/vme/bridges/Module.symvers b/drivers/staging/vme/bridges/Module.symvers deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/drivers/staging/vme/bridges/Module.symvers +++ /dev/null | |||
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 7016fdd2509f..e19b932492e1 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c | |||
@@ -3954,8 +3954,8 @@ void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, | |||
3954 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) | 3954 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) |
3955 | { | 3955 | { |
3956 | 3956 | ||
3957 | if ((((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) | 3957 | if ((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) && |
3958 | && (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ | 3958 | (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ |
3959 | return 1; | 3959 | return 1; |
3960 | 3960 | ||
3961 | return 0; | 3961 | return 0; |
@@ -8773,7 +8773,7 @@ unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, | |||
8773 | 8773 | ||
8774 | if (pVBInfo->IF_DEF_LVDS == 0) { | 8774 | if (pVBInfo->IF_DEF_LVDS == 0) { |
8775 | CRT2Index = CRT2Index >> 6; /* for LCD */ | 8775 | CRT2Index = CRT2Index >> 6; /* for LCD */ |
8776 | if (((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) { /*301b*/ | 8776 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/ |
8777 | if (pVBInfo->LCDResInfo != Panel1024x768) | 8777 | if (pVBInfo->LCDResInfo != Panel1024x768) |
8778 | VCLKIndex = LCDXlat2VCLK[CRT2Index]; | 8778 | VCLKIndex = LCDXlat2VCLK[CRT2Index]; |
8779 | else | 8779 | else |
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 47d32281032c..52fc0c9a6364 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c | |||
@@ -581,8 +581,9 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, | |||
581 | __u8 __user *buf, size_t nr) | 581 | __u8 __user *buf, size_t nr) |
582 | { | 582 | { |
583 | struct n_hdlc *n_hdlc = tty2n_hdlc(tty); | 583 | struct n_hdlc *n_hdlc = tty2n_hdlc(tty); |
584 | int ret; | 584 | int ret = 0; |
585 | struct n_hdlc_buf *rbuf; | 585 | struct n_hdlc_buf *rbuf; |
586 | DECLARE_WAITQUEUE(wait, current); | ||
586 | 587 | ||
587 | if (debuglevel >= DEBUG_LEVEL_INFO) | 588 | if (debuglevel >= DEBUG_LEVEL_INFO) |
588 | printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__); | 589 | printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__); |
@@ -598,57 +599,55 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, | |||
598 | return -EFAULT; | 599 | return -EFAULT; |
599 | } | 600 | } |
600 | 601 | ||
601 | tty_lock(); | 602 | add_wait_queue(&tty->read_wait, &wait); |
602 | 603 | ||
603 | for (;;) { | 604 | for (;;) { |
604 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { | 605 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { |
605 | tty_unlock(); | 606 | ret = -EIO; |
606 | return -EIO; | 607 | break; |
607 | } | 608 | } |
609 | if (tty_hung_up_p(file)) | ||
610 | break; | ||
608 | 611 | ||
609 | n_hdlc = tty2n_hdlc (tty); | 612 | set_current_state(TASK_INTERRUPTIBLE); |
610 | if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC || | ||
611 | tty != n_hdlc->tty) { | ||
612 | tty_unlock(); | ||
613 | return 0; | ||
614 | } | ||
615 | 613 | ||
616 | rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); | 614 | rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); |
617 | if (rbuf) | 615 | if (rbuf) { |
616 | if (rbuf->count > nr) { | ||
617 | /* too large for caller's buffer */ | ||
618 | ret = -EOVERFLOW; | ||
619 | } else { | ||
620 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) | ||
621 | ret = -EFAULT; | ||
622 | else | ||
623 | ret = rbuf->count; | ||
624 | } | ||
625 | |||
626 | if (n_hdlc->rx_free_buf_list.count > | ||
627 | DEFAULT_RX_BUF_COUNT) | ||
628 | kfree(rbuf); | ||
629 | else | ||
630 | n_hdlc_buf_put(&n_hdlc->rx_free_buf_list, rbuf); | ||
618 | break; | 631 | break; |
632 | } | ||
619 | 633 | ||
620 | /* no data */ | 634 | /* no data */ |
621 | if (file->f_flags & O_NONBLOCK) { | 635 | if (file->f_flags & O_NONBLOCK) { |
622 | tty_unlock(); | 636 | ret = -EAGAIN; |
623 | return -EAGAIN; | 637 | break; |
624 | } | 638 | } |
625 | 639 | ||
626 | interruptible_sleep_on (&tty->read_wait); | 640 | schedule(); |
641 | |||
627 | if (signal_pending(current)) { | 642 | if (signal_pending(current)) { |
628 | tty_unlock(); | 643 | ret = -EINTR; |
629 | return -EINTR; | 644 | break; |
630 | } | 645 | } |
631 | } | 646 | } |
632 | 647 | ||
633 | if (rbuf->count > nr) | 648 | remove_wait_queue(&tty->read_wait, &wait); |
634 | /* frame too large for caller's buffer (discard frame) */ | 649 | __set_current_state(TASK_RUNNING); |
635 | ret = -EOVERFLOW; | 650 | |
636 | else { | ||
637 | /* Copy the data to the caller's buffer */ | ||
638 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) | ||
639 | ret = -EFAULT; | ||
640 | else | ||
641 | ret = rbuf->count; | ||
642 | } | ||
643 | |||
644 | /* return HDLC buffer to free list unless the free list */ | ||
645 | /* count has exceeded the default value, in which case the */ | ||
646 | /* buffer is freed back to the OS to conserve memory */ | ||
647 | if (n_hdlc->rx_free_buf_list.count > DEFAULT_RX_BUF_COUNT) | ||
648 | kfree(rbuf); | ||
649 | else | ||
650 | n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,rbuf); | ||
651 | tty_unlock(); | ||
652 | return ret; | 651 | return ret; |
653 | 652 | ||
654 | } /* end of n_hdlc_tty_read() */ | 653 | } /* end of n_hdlc_tty_read() */ |
@@ -691,14 +690,15 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, | |||
691 | count = maxframe; | 690 | count = maxframe; |
692 | } | 691 | } |
693 | 692 | ||
694 | tty_lock(); | ||
695 | |||
696 | add_wait_queue(&tty->write_wait, &wait); | 693 | add_wait_queue(&tty->write_wait, &wait); |
697 | set_current_state(TASK_INTERRUPTIBLE); | 694 | |
695 | for (;;) { | ||
696 | set_current_state(TASK_INTERRUPTIBLE); | ||
698 | 697 | ||
699 | /* Allocate transmit buffer */ | 698 | tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list); |
700 | /* sleep until transmit buffer available */ | 699 | if (tbuf) |
701 | while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) { | 700 | break; |
701 | |||
702 | if (file->f_flags & O_NONBLOCK) { | 702 | if (file->f_flags & O_NONBLOCK) { |
703 | error = -EAGAIN; | 703 | error = -EAGAIN; |
704 | break; | 704 | break; |
@@ -719,7 +719,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, | |||
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | set_current_state(TASK_RUNNING); | 722 | __set_current_state(TASK_RUNNING); |
723 | remove_wait_queue(&tty->write_wait, &wait); | 723 | remove_wait_queue(&tty->write_wait, &wait); |
724 | 724 | ||
725 | if (!error) { | 725 | if (!error) { |
@@ -731,7 +731,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, | |||
731 | n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf); | 731 | n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf); |
732 | n_hdlc_send_frames(n_hdlc,tty); | 732 | n_hdlc_send_frames(n_hdlc,tty); |
733 | } | 733 | } |
734 | tty_unlock(); | 734 | |
735 | return error; | 735 | return error; |
736 | 736 | ||
737 | } /* end of n_hdlc_tty_write() */ | 737 | } /* end of n_hdlc_tty_write() */ |
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index b25e6e490530..3975df6f7fdb 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c | |||
@@ -236,7 +236,8 @@ static const struct serial8250_config uart_config[] = { | |||
236 | .fifo_size = 128, | 236 | .fifo_size = 128, |
237 | .tx_loadsz = 128, | 237 | .tx_loadsz = 128, |
238 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | 238 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
239 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, | 239 | /* UART_CAP_EFR breaks billionon CF bluetooth card. */ |
240 | .flags = UART_CAP_FIFO | UART_CAP_SLEEP, | ||
240 | }, | 241 | }, |
241 | [PORT_16654] = { | 242 | [PORT_16654] = { |
242 | .name = "ST16654", | 243 | .name = "ST16654", |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index b1682d7f1d8a..2b8334601c8b 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1518,6 +1518,7 @@ config SERIAL_BCM63XX_CONSOLE | |||
1518 | config SERIAL_GRLIB_GAISLER_APBUART | 1518 | config SERIAL_GRLIB_GAISLER_APBUART |
1519 | tristate "GRLIB APBUART serial support" | 1519 | tristate "GRLIB APBUART serial support" |
1520 | depends on OF | 1520 | depends on OF |
1521 | select SERIAL_CORE | ||
1521 | ---help--- | 1522 | ---help--- |
1522 | Add support for the GRLIB APBUART serial port. | 1523 | Add support for the GRLIB APBUART serial port. |
1523 | 1524 | ||
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 6158eae0f64a..0065da4b11c1 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -3257,7 +3257,7 @@ static ssize_t show_cons_active(struct device *dev, | |||
3257 | ssize_t count = 0; | 3257 | ssize_t count = 0; |
3258 | 3258 | ||
3259 | console_lock(); | 3259 | console_lock(); |
3260 | for (c = console_drivers; c; c = c->next) { | 3260 | for_each_console(c) { |
3261 | if (!c->device) | 3261 | if (!c->device) |
3262 | continue; | 3262 | continue; |
3263 | if (!c->write) | 3263 | if (!c->write) |
@@ -3306,7 +3306,7 @@ int __init tty_init(void) | |||
3306 | if (IS_ERR(consdev)) | 3306 | if (IS_ERR(consdev)) |
3307 | consdev = NULL; | 3307 | consdev = NULL; |
3308 | else | 3308 | else |
3309 | device_create_file(consdev, &dev_attr_active); | 3309 | WARN_ON(device_create_file(consdev, &dev_attr_active) < 0); |
3310 | 3310 | ||
3311 | #ifdef CONFIG_VT | 3311 | #ifdef CONFIG_VT |
3312 | vty_init(&console_fops); | 3312 | vty_init(&console_fops); |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index b230bd3f056f..147ede3423df 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -2994,7 +2994,7 @@ int __init vty_init(const struct file_operations *console_fops) | |||
2994 | if (IS_ERR(tty0dev)) | 2994 | if (IS_ERR(tty0dev)) |
2995 | tty0dev = NULL; | 2995 | tty0dev = NULL; |
2996 | else | 2996 | else |
2997 | device_create_file(tty0dev, &dev_attr_active); | 2997 | WARN_ON(device_create_file(tty0dev, &dev_attr_active) < 0); |
2998 | 2998 | ||
2999 | vcs_init(); | 2999 | vcs_init(); |
3000 | 3000 | ||
@@ -3545,7 +3545,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3545 | 3545 | ||
3546 | /* already registered */ | 3546 | /* already registered */ |
3547 | if (con_driver->con == csw) | 3547 | if (con_driver->con == csw) |
3548 | retval = -EINVAL; | 3548 | retval = -EBUSY; |
3549 | } | 3549 | } |
3550 | 3550 | ||
3551 | if (retval) | 3551 | if (retval) |
@@ -3656,7 +3656,12 @@ int take_over_console(const struct consw *csw, int first, int last, int deflt) | |||
3656 | int err; | 3656 | int err; |
3657 | 3657 | ||
3658 | err = register_con_driver(csw, first, last); | 3658 | err = register_con_driver(csw, first, last); |
3659 | 3659 | /* if we get an busy error we still want to bind the console driver | |
3660 | * and return success, as we may have unbound the console driver | ||
3661 | Â * but not unregistered it. | ||
3662 | */ | ||
3663 | if (err == -EBUSY) | ||
3664 | err = 0; | ||
3660 | if (!err) | 3665 | if (!err) |
3661 | bind_con_driver(csw, first, last, deflt); | 3666 | bind_con_driver(csw, first, last, deflt); |
3662 | 3667 | ||
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 6ee4451bfe2d..47085e5879ab 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -342,7 +342,7 @@ static ssize_t wdm_write | |||
342 | goto outnp; | 342 | goto outnp; |
343 | } | 343 | } |
344 | 344 | ||
345 | if (!file->f_flags && O_NONBLOCK) | 345 | if (!(file->f_flags & O_NONBLOCK)) |
346 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, | 346 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, |
347 | &desc->flags)); | 347 | &desc->flags)); |
348 | else | 348 | else |
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 9da250563027..df502a98d0df 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c | |||
@@ -192,12 +192,12 @@ int usb_create_ep_devs(struct device *parent, | |||
192 | ep_dev->dev.parent = parent; | 192 | ep_dev->dev.parent = parent; |
193 | ep_dev->dev.release = ep_device_release; | 193 | ep_dev->dev.release = ep_device_release; |
194 | dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress); | 194 | dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress); |
195 | device_enable_async_suspend(&ep_dev->dev); | ||
196 | 195 | ||
197 | retval = device_register(&ep_dev->dev); | 196 | retval = device_register(&ep_dev->dev); |
198 | if (retval) | 197 | if (retval) |
199 | goto error_register; | 198 | goto error_register; |
200 | 199 | ||
200 | device_enable_async_suspend(&ep_dev->dev); | ||
201 | endpoint->ep_dev = ep_dev; | 201 | endpoint->ep_dev = ep_dev; |
202 | return retval; | 202 | return retval; |
203 | 203 | ||
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index b55d46070a25..f71e8e307e0f 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -405,7 +405,12 @@ static int suspend_common(struct device *dev, bool do_wakeup) | |||
405 | return retval; | 405 | return retval; |
406 | } | 406 | } |
407 | 407 | ||
408 | synchronize_irq(pci_dev->irq); | 408 | /* If MSI-X is enabled, the driver will have synchronized all vectors |
409 | * in pci_suspend(). If MSI or legacy PCI is enabled, that will be | ||
410 | * synchronized here. | ||
411 | */ | ||
412 | if (!hcd->msix_enabled) | ||
413 | synchronize_irq(pci_dev->irq); | ||
409 | 414 | ||
410 | /* Downstream ports from this root hub should already be quiesced, so | 415 | /* Downstream ports from this root hub should already be quiesced, so |
411 | * there will be no DMA activity. Now we can shut down the upstream | 416 | * there will be no DMA activity. Now we can shut down the upstream |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b98efae6a1cf..4310cc4b1cb5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -676,6 +676,8 @@ static void hub_init_func3(struct work_struct *ws); | |||
676 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | 676 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
677 | { | 677 | { |
678 | struct usb_device *hdev = hub->hdev; | 678 | struct usb_device *hdev = hub->hdev; |
679 | struct usb_hcd *hcd; | ||
680 | int ret; | ||
679 | int port1; | 681 | int port1; |
680 | int status; | 682 | int status; |
681 | bool need_debounce_delay = false; | 683 | bool need_debounce_delay = false; |
@@ -714,6 +716,25 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
714 | usb_autopm_get_interface_no_resume( | 716 | usb_autopm_get_interface_no_resume( |
715 | to_usb_interface(hub->intfdev)); | 717 | to_usb_interface(hub->intfdev)); |
716 | return; /* Continues at init2: below */ | 718 | return; /* Continues at init2: below */ |
719 | } else if (type == HUB_RESET_RESUME) { | ||
720 | /* The internal host controller state for the hub device | ||
721 | * may be gone after a host power loss on system resume. | ||
722 | * Update the device's info so the HW knows it's a hub. | ||
723 | */ | ||
724 | hcd = bus_to_hcd(hdev->bus); | ||
725 | if (hcd->driver->update_hub_device) { | ||
726 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
727 | &hub->tt, GFP_NOIO); | ||
728 | if (ret < 0) { | ||
729 | dev_err(hub->intfdev, "Host not " | ||
730 | "accepting hub info " | ||
731 | "update.\n"); | ||
732 | dev_err(hub->intfdev, "LS/FS devices " | ||
733 | "and hubs may not work " | ||
734 | "under this hub\n."); | ||
735 | } | ||
736 | } | ||
737 | hub_power_on(hub, true); | ||
717 | } else { | 738 | } else { |
718 | hub_power_on(hub, true); | 739 | hub_power_on(hub, true); |
719 | } | 740 | } |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1dc9739277b4..06bb9d4587e9 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -509,7 +509,7 @@ config USB_LANGWELL | |||
509 | select USB_GADGET_SELECTED | 509 | select USB_GADGET_SELECTED |
510 | 510 | ||
511 | config USB_GADGET_EG20T | 511 | config USB_GADGET_EG20T |
512 | boolean "Intel EG20T(Topcliff) USB Device controller" | 512 | boolean "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC" |
513 | depends on PCI | 513 | depends on PCI |
514 | select USB_GADGET_DUALSPEED | 514 | select USB_GADGET_DUALSPEED |
515 | help | 515 | help |
@@ -525,6 +525,11 @@ config USB_GADGET_EG20T | |||
525 | This driver dose not support interrupt transfer or isochronous | 525 | This driver dose not support interrupt transfer or isochronous |
526 | transfer modes. | 526 | transfer modes. |
527 | 527 | ||
528 | This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is | ||
529 | for IVI(In-Vehicle Infotainment) use. | ||
530 | ML7213 is companion chip for Intel Atom E6xx series. | ||
531 | ML7213 is completely compatible for Intel EG20T PCH. | ||
532 | |||
528 | config USB_EG20T | 533 | config USB_EG20T |
529 | tristate | 534 | tristate |
530 | depends on USB_GADGET_EG20T | 535 | depends on USB_GADGET_EG20T |
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 31656a2b4ab4..a1c67ae1572a 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -76,10 +76,21 @@ static DEFINE_SPINLOCK(udc_lock); | |||
76 | 76 | ||
77 | /* control endpoint description */ | 77 | /* control endpoint description */ |
78 | static const struct usb_endpoint_descriptor | 78 | static const struct usb_endpoint_descriptor |
79 | ctrl_endpt_desc = { | 79 | ctrl_endpt_out_desc = { |
80 | .bLength = USB_DT_ENDPOINT_SIZE, | 80 | .bLength = USB_DT_ENDPOINT_SIZE, |
81 | .bDescriptorType = USB_DT_ENDPOINT, | 81 | .bDescriptorType = USB_DT_ENDPOINT, |
82 | 82 | ||
83 | .bEndpointAddress = USB_DIR_OUT, | ||
84 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, | ||
85 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), | ||
86 | }; | ||
87 | |||
88 | static const struct usb_endpoint_descriptor | ||
89 | ctrl_endpt_in_desc = { | ||
90 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
91 | .bDescriptorType = USB_DT_ENDPOINT, | ||
92 | |||
93 | .bEndpointAddress = USB_DIR_IN, | ||
83 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, | 94 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, |
84 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), | 95 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), |
85 | }; | 96 | }; |
@@ -265,10 +276,10 @@ static int hw_device_init(void __iomem *base) | |||
265 | hw_bank.size /= sizeof(u32); | 276 | hw_bank.size /= sizeof(u32); |
266 | 277 | ||
267 | reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN); | 278 | reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN); |
268 | if (reg == 0 || reg > ENDPT_MAX) | 279 | hw_ep_max = reg * 2; /* cache hw ENDPT_MAX */ |
269 | return -ENODEV; | ||
270 | 280 | ||
271 | hw_ep_max = reg; /* cache hw ENDPT_MAX */ | 281 | if (hw_ep_max == 0 || hw_ep_max > ENDPT_MAX) |
282 | return -ENODEV; | ||
272 | 283 | ||
273 | /* setup lock mode ? */ | 284 | /* setup lock mode ? */ |
274 | 285 | ||
@@ -1197,16 +1208,17 @@ static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, | |||
1197 | } | 1208 | } |
1198 | 1209 | ||
1199 | spin_lock_irqsave(udc->lock, flags); | 1210 | spin_lock_irqsave(udc->lock, flags); |
1200 | for (i = 0; i < hw_ep_max; i++) { | 1211 | for (i = 0; i < hw_ep_max/2; i++) { |
1201 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 1212 | struct ci13xxx_ep *mEpRx = &udc->ci13xxx_ep[i]; |
1213 | struct ci13xxx_ep *mEpTx = &udc->ci13xxx_ep[i + hw_ep_max/2]; | ||
1202 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1214 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1203 | "EP=%02i: RX=%08X TX=%08X\n", | 1215 | "EP=%02i: RX=%08X TX=%08X\n", |
1204 | i, (u32)mEp->qh[RX].dma, (u32)mEp->qh[TX].dma); | 1216 | i, (u32)mEpRx->qh.dma, (u32)mEpTx->qh.dma); |
1205 | for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) { | 1217 | for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) { |
1206 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1218 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1207 | " %04X: %08X %08X\n", j, | 1219 | " %04X: %08X %08X\n", j, |
1208 | *((u32 *)mEp->qh[RX].ptr + j), | 1220 | *((u32 *)mEpRx->qh.ptr + j), |
1209 | *((u32 *)mEp->qh[TX].ptr + j)); | 1221 | *((u32 *)mEpTx->qh.ptr + j)); |
1210 | } | 1222 | } |
1211 | } | 1223 | } |
1212 | spin_unlock_irqrestore(udc->lock, flags); | 1224 | spin_unlock_irqrestore(udc->lock, flags); |
@@ -1293,7 +1305,7 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | |||
1293 | unsigned long flags; | 1305 | unsigned long flags; |
1294 | struct list_head *ptr = NULL; | 1306 | struct list_head *ptr = NULL; |
1295 | struct ci13xxx_req *req = NULL; | 1307 | struct ci13xxx_req *req = NULL; |
1296 | unsigned i, j, k, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); | 1308 | unsigned i, j, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); |
1297 | 1309 | ||
1298 | dbg_trace("[%s] %p\n", __func__, buf); | 1310 | dbg_trace("[%s] %p\n", __func__, buf); |
1299 | if (attr == NULL || buf == NULL) { | 1311 | if (attr == NULL || buf == NULL) { |
@@ -1303,22 +1315,20 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | |||
1303 | 1315 | ||
1304 | spin_lock_irqsave(udc->lock, flags); | 1316 | spin_lock_irqsave(udc->lock, flags); |
1305 | for (i = 0; i < hw_ep_max; i++) | 1317 | for (i = 0; i < hw_ep_max; i++) |
1306 | for (k = RX; k <= TX; k++) | 1318 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh.queue) |
1307 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh[k].queue) | 1319 | { |
1308 | { | 1320 | req = list_entry(ptr, struct ci13xxx_req, queue); |
1309 | req = list_entry(ptr, | 1321 | |
1310 | struct ci13xxx_req, queue); | 1322 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1323 | "EP=%02i: TD=%08X %s\n", | ||
1324 | i % hw_ep_max/2, (u32)req->dma, | ||
1325 | ((i < hw_ep_max/2) ? "RX" : "TX")); | ||
1311 | 1326 | ||
1327 | for (j = 0; j < qSize; j++) | ||
1312 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1328 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1313 | "EP=%02i: TD=%08X %s\n", | 1329 | " %04X: %08X\n", j, |
1314 | i, (u32)req->dma, | 1330 | *((u32 *)req->ptr + j)); |
1315 | ((k == RX) ? "RX" : "TX")); | 1331 | } |
1316 | |||
1317 | for (j = 0; j < qSize; j++) | ||
1318 | n += scnprintf(buf + n, PAGE_SIZE - n, | ||
1319 | " %04X: %08X\n", j, | ||
1320 | *((u32 *)req->ptr + j)); | ||
1321 | } | ||
1322 | spin_unlock_irqrestore(udc->lock, flags); | 1332 | spin_unlock_irqrestore(udc->lock, flags); |
1323 | 1333 | ||
1324 | return n; | 1334 | return n; |
@@ -1467,12 +1477,12 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
1467 | * At this point it's guaranteed exclusive access to qhead | 1477 | * At this point it's guaranteed exclusive access to qhead |
1468 | * (endpt is not primed) so it's no need to use tripwire | 1478 | * (endpt is not primed) so it's no need to use tripwire |
1469 | */ | 1479 | */ |
1470 | mEp->qh[mEp->dir].ptr->td.next = mReq->dma; /* TERMINATE = 0 */ | 1480 | mEp->qh.ptr->td.next = mReq->dma; /* TERMINATE = 0 */ |
1471 | mEp->qh[mEp->dir].ptr->td.token &= ~TD_STATUS; /* clear status */ | 1481 | mEp->qh.ptr->td.token &= ~TD_STATUS; /* clear status */ |
1472 | if (mReq->req.zero == 0) | 1482 | if (mReq->req.zero == 0) |
1473 | mEp->qh[mEp->dir].ptr->cap |= QH_ZLT; | 1483 | mEp->qh.ptr->cap |= QH_ZLT; |
1474 | else | 1484 | else |
1475 | mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT; | 1485 | mEp->qh.ptr->cap &= ~QH_ZLT; |
1476 | 1486 | ||
1477 | wmb(); /* synchronize before ep prime */ | 1487 | wmb(); /* synchronize before ep prime */ |
1478 | 1488 | ||
@@ -1542,11 +1552,11 @@ __acquires(mEp->lock) | |||
1542 | 1552 | ||
1543 | hw_ep_flush(mEp->num, mEp->dir); | 1553 | hw_ep_flush(mEp->num, mEp->dir); |
1544 | 1554 | ||
1545 | while (!list_empty(&mEp->qh[mEp->dir].queue)) { | 1555 | while (!list_empty(&mEp->qh.queue)) { |
1546 | 1556 | ||
1547 | /* pop oldest request */ | 1557 | /* pop oldest request */ |
1548 | struct ci13xxx_req *mReq = \ | 1558 | struct ci13xxx_req *mReq = \ |
1549 | list_entry(mEp->qh[mEp->dir].queue.next, | 1559 | list_entry(mEp->qh.queue.next, |
1550 | struct ci13xxx_req, queue); | 1560 | struct ci13xxx_req, queue); |
1551 | list_del_init(&mReq->queue); | 1561 | list_del_init(&mReq->queue); |
1552 | mReq->req.status = -ESHUTDOWN; | 1562 | mReq->req.status = -ESHUTDOWN; |
@@ -1571,8 +1581,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1571 | { | 1581 | { |
1572 | struct usb_ep *ep; | 1582 | struct usb_ep *ep; |
1573 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); | 1583 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); |
1574 | struct ci13xxx_ep *mEp = container_of(gadget->ep0, | ||
1575 | struct ci13xxx_ep, ep); | ||
1576 | 1584 | ||
1577 | trace("%p", gadget); | 1585 | trace("%p", gadget); |
1578 | 1586 | ||
@@ -1583,7 +1591,8 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1583 | gadget_for_each_ep(ep, gadget) { | 1591 | gadget_for_each_ep(ep, gadget) { |
1584 | usb_ep_fifo_flush(ep); | 1592 | usb_ep_fifo_flush(ep); |
1585 | } | 1593 | } |
1586 | usb_ep_fifo_flush(gadget->ep0); | 1594 | usb_ep_fifo_flush(&udc->ep0out.ep); |
1595 | usb_ep_fifo_flush(&udc->ep0in.ep); | ||
1587 | 1596 | ||
1588 | udc->driver->disconnect(gadget); | 1597 | udc->driver->disconnect(gadget); |
1589 | 1598 | ||
@@ -1591,11 +1600,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1591 | gadget_for_each_ep(ep, gadget) { | 1600 | gadget_for_each_ep(ep, gadget) { |
1592 | usb_ep_disable(ep); | 1601 | usb_ep_disable(ep); |
1593 | } | 1602 | } |
1594 | usb_ep_disable(gadget->ep0); | 1603 | usb_ep_disable(&udc->ep0out.ep); |
1604 | usb_ep_disable(&udc->ep0in.ep); | ||
1595 | 1605 | ||
1596 | if (mEp->status != NULL) { | 1606 | if (udc->status != NULL) { |
1597 | usb_ep_free_request(gadget->ep0, mEp->status); | 1607 | usb_ep_free_request(&udc->ep0in.ep, udc->status); |
1598 | mEp->status = NULL; | 1608 | udc->status = NULL; |
1599 | } | 1609 | } |
1600 | 1610 | ||
1601 | return 0; | 1611 | return 0; |
@@ -1614,7 +1624,6 @@ static void isr_reset_handler(struct ci13xxx *udc) | |||
1614 | __releases(udc->lock) | 1624 | __releases(udc->lock) |
1615 | __acquires(udc->lock) | 1625 | __acquires(udc->lock) |
1616 | { | 1626 | { |
1617 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[0]; | ||
1618 | int retval; | 1627 | int retval; |
1619 | 1628 | ||
1620 | trace("%p", udc); | 1629 | trace("%p", udc); |
@@ -1635,11 +1644,15 @@ __acquires(udc->lock) | |||
1635 | if (retval) | 1644 | if (retval) |
1636 | goto done; | 1645 | goto done; |
1637 | 1646 | ||
1638 | retval = usb_ep_enable(&mEp->ep, &ctrl_endpt_desc); | 1647 | retval = usb_ep_enable(&udc->ep0out.ep, &ctrl_endpt_out_desc); |
1648 | if (retval) | ||
1649 | goto done; | ||
1650 | |||
1651 | retval = usb_ep_enable(&udc->ep0in.ep, &ctrl_endpt_in_desc); | ||
1639 | if (!retval) { | 1652 | if (!retval) { |
1640 | mEp->status = usb_ep_alloc_request(&mEp->ep, GFP_ATOMIC); | 1653 | udc->status = usb_ep_alloc_request(&udc->ep0in.ep, GFP_ATOMIC); |
1641 | if (mEp->status == NULL) { | 1654 | if (udc->status == NULL) { |
1642 | usb_ep_disable(&mEp->ep); | 1655 | usb_ep_disable(&udc->ep0out.ep); |
1643 | retval = -ENOMEM; | 1656 | retval = -ENOMEM; |
1644 | } | 1657 | } |
1645 | } | 1658 | } |
@@ -1672,16 +1685,17 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) | |||
1672 | 1685 | ||
1673 | /** | 1686 | /** |
1674 | * isr_get_status_response: get_status request response | 1687 | * isr_get_status_response: get_status request response |
1675 | * @ep: endpoint | 1688 | * @udc: udc struct |
1676 | * @setup: setup request packet | 1689 | * @setup: setup request packet |
1677 | * | 1690 | * |
1678 | * This function returns an error code | 1691 | * This function returns an error code |
1679 | */ | 1692 | */ |
1680 | static int isr_get_status_response(struct ci13xxx_ep *mEp, | 1693 | static int isr_get_status_response(struct ci13xxx *udc, |
1681 | struct usb_ctrlrequest *setup) | 1694 | struct usb_ctrlrequest *setup) |
1682 | __releases(mEp->lock) | 1695 | __releases(mEp->lock) |
1683 | __acquires(mEp->lock) | 1696 | __acquires(mEp->lock) |
1684 | { | 1697 | { |
1698 | struct ci13xxx_ep *mEp = &udc->ep0in; | ||
1685 | struct usb_request *req = NULL; | 1699 | struct usb_request *req = NULL; |
1686 | gfp_t gfp_flags = GFP_ATOMIC; | 1700 | gfp_t gfp_flags = GFP_ATOMIC; |
1687 | int dir, num, retval; | 1701 | int dir, num, retval; |
@@ -1736,27 +1750,23 @@ __acquires(mEp->lock) | |||
1736 | 1750 | ||
1737 | /** | 1751 | /** |
1738 | * isr_setup_status_phase: queues the status phase of a setup transation | 1752 | * isr_setup_status_phase: queues the status phase of a setup transation |
1739 | * @mEp: endpoint | 1753 | * @udc: udc struct |
1740 | * | 1754 | * |
1741 | * This function returns an error code | 1755 | * This function returns an error code |
1742 | */ | 1756 | */ |
1743 | static int isr_setup_status_phase(struct ci13xxx_ep *mEp) | 1757 | static int isr_setup_status_phase(struct ci13xxx *udc) |
1744 | __releases(mEp->lock) | 1758 | __releases(mEp->lock) |
1745 | __acquires(mEp->lock) | 1759 | __acquires(mEp->lock) |
1746 | { | 1760 | { |
1747 | int retval; | 1761 | int retval; |
1762 | struct ci13xxx_ep *mEp; | ||
1748 | 1763 | ||
1749 | trace("%p", mEp); | 1764 | trace("%p", udc); |
1750 | |||
1751 | /* mEp is always valid & configured */ | ||
1752 | |||
1753 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | ||
1754 | mEp->dir = (mEp->dir == TX) ? RX : TX; | ||
1755 | 1765 | ||
1756 | mEp->status->no_interrupt = 1; | 1766 | mEp = (udc->ep0_dir == TX) ? &udc->ep0out : &udc->ep0in; |
1757 | 1767 | ||
1758 | spin_unlock(mEp->lock); | 1768 | spin_unlock(mEp->lock); |
1759 | retval = usb_ep_queue(&mEp->ep, mEp->status, GFP_ATOMIC); | 1769 | retval = usb_ep_queue(&mEp->ep, udc->status, GFP_ATOMIC); |
1760 | spin_lock(mEp->lock); | 1770 | spin_lock(mEp->lock); |
1761 | 1771 | ||
1762 | return retval; | 1772 | return retval; |
@@ -1778,11 +1788,11 @@ __acquires(mEp->lock) | |||
1778 | 1788 | ||
1779 | trace("%p", mEp); | 1789 | trace("%p", mEp); |
1780 | 1790 | ||
1781 | if (list_empty(&mEp->qh[mEp->dir].queue)) | 1791 | if (list_empty(&mEp->qh.queue)) |
1782 | return -EINVAL; | 1792 | return -EINVAL; |
1783 | 1793 | ||
1784 | /* pop oldest request */ | 1794 | /* pop oldest request */ |
1785 | mReq = list_entry(mEp->qh[mEp->dir].queue.next, | 1795 | mReq = list_entry(mEp->qh.queue.next, |
1786 | struct ci13xxx_req, queue); | 1796 | struct ci13xxx_req, queue); |
1787 | list_del_init(&mReq->queue); | 1797 | list_del_init(&mReq->queue); |
1788 | 1798 | ||
@@ -1794,10 +1804,10 @@ __acquires(mEp->lock) | |||
1794 | 1804 | ||
1795 | dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); | 1805 | dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); |
1796 | 1806 | ||
1797 | if (!list_empty(&mEp->qh[mEp->dir].queue)) { | 1807 | if (!list_empty(&mEp->qh.queue)) { |
1798 | struct ci13xxx_req* mReqEnq; | 1808 | struct ci13xxx_req* mReqEnq; |
1799 | 1809 | ||
1800 | mReqEnq = list_entry(mEp->qh[mEp->dir].queue.next, | 1810 | mReqEnq = list_entry(mEp->qh.queue.next, |
1801 | struct ci13xxx_req, queue); | 1811 | struct ci13xxx_req, queue); |
1802 | _hardware_enqueue(mEp, mReqEnq); | 1812 | _hardware_enqueue(mEp, mReqEnq); |
1803 | } | 1813 | } |
@@ -1836,16 +1846,14 @@ __acquires(udc->lock) | |||
1836 | int type, num, err = -EINVAL; | 1846 | int type, num, err = -EINVAL; |
1837 | struct usb_ctrlrequest req; | 1847 | struct usb_ctrlrequest req; |
1838 | 1848 | ||
1839 | |||
1840 | if (mEp->desc == NULL) | 1849 | if (mEp->desc == NULL) |
1841 | continue; /* not configured */ | 1850 | continue; /* not configured */ |
1842 | 1851 | ||
1843 | if ((mEp->dir == RX && hw_test_and_clear_complete(i)) || | 1852 | if (hw_test_and_clear_complete(i)) { |
1844 | (mEp->dir == TX && hw_test_and_clear_complete(i + 16))) { | ||
1845 | err = isr_tr_complete_low(mEp); | 1853 | err = isr_tr_complete_low(mEp); |
1846 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { | 1854 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { |
1847 | if (err > 0) /* needs status phase */ | 1855 | if (err > 0) /* needs status phase */ |
1848 | err = isr_setup_status_phase(mEp); | 1856 | err = isr_setup_status_phase(udc); |
1849 | if (err < 0) { | 1857 | if (err < 0) { |
1850 | dbg_event(_usb_addr(mEp), | 1858 | dbg_event(_usb_addr(mEp), |
1851 | "ERROR", err); | 1859 | "ERROR", err); |
@@ -1866,15 +1874,22 @@ __acquires(udc->lock) | |||
1866 | continue; | 1874 | continue; |
1867 | } | 1875 | } |
1868 | 1876 | ||
1877 | /* | ||
1878 | * Flush data and handshake transactions of previous | ||
1879 | * setup packet. | ||
1880 | */ | ||
1881 | _ep_nuke(&udc->ep0out); | ||
1882 | _ep_nuke(&udc->ep0in); | ||
1883 | |||
1869 | /* read_setup_packet */ | 1884 | /* read_setup_packet */ |
1870 | do { | 1885 | do { |
1871 | hw_test_and_set_setup_guard(); | 1886 | hw_test_and_set_setup_guard(); |
1872 | memcpy(&req, &mEp->qh[RX].ptr->setup, sizeof(req)); | 1887 | memcpy(&req, &mEp->qh.ptr->setup, sizeof(req)); |
1873 | } while (!hw_test_and_clear_setup_guard()); | 1888 | } while (!hw_test_and_clear_setup_guard()); |
1874 | 1889 | ||
1875 | type = req.bRequestType; | 1890 | type = req.bRequestType; |
1876 | 1891 | ||
1877 | mEp->dir = (type & USB_DIR_IN) ? TX : RX; | 1892 | udc->ep0_dir = (type & USB_DIR_IN) ? TX : RX; |
1878 | 1893 | ||
1879 | dbg_setup(_usb_addr(mEp), &req); | 1894 | dbg_setup(_usb_addr(mEp), &req); |
1880 | 1895 | ||
@@ -1895,7 +1910,7 @@ __acquires(udc->lock) | |||
1895 | if (err) | 1910 | if (err) |
1896 | break; | 1911 | break; |
1897 | } | 1912 | } |
1898 | err = isr_setup_status_phase(mEp); | 1913 | err = isr_setup_status_phase(udc); |
1899 | break; | 1914 | break; |
1900 | case USB_REQ_GET_STATUS: | 1915 | case USB_REQ_GET_STATUS: |
1901 | if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && | 1916 | if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && |
@@ -1905,7 +1920,7 @@ __acquires(udc->lock) | |||
1905 | if (le16_to_cpu(req.wLength) != 2 || | 1920 | if (le16_to_cpu(req.wLength) != 2 || |
1906 | le16_to_cpu(req.wValue) != 0) | 1921 | le16_to_cpu(req.wValue) != 0) |
1907 | break; | 1922 | break; |
1908 | err = isr_get_status_response(mEp, &req); | 1923 | err = isr_get_status_response(udc, &req); |
1909 | break; | 1924 | break; |
1910 | case USB_REQ_SET_ADDRESS: | 1925 | case USB_REQ_SET_ADDRESS: |
1911 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) | 1926 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) |
@@ -1916,7 +1931,7 @@ __acquires(udc->lock) | |||
1916 | err = hw_usb_set_address((u8)le16_to_cpu(req.wValue)); | 1931 | err = hw_usb_set_address((u8)le16_to_cpu(req.wValue)); |
1917 | if (err) | 1932 | if (err) |
1918 | break; | 1933 | break; |
1919 | err = isr_setup_status_phase(mEp); | 1934 | err = isr_setup_status_phase(udc); |
1920 | break; | 1935 | break; |
1921 | case USB_REQ_SET_FEATURE: | 1936 | case USB_REQ_SET_FEATURE: |
1922 | if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) && | 1937 | if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) && |
@@ -1932,12 +1947,12 @@ __acquires(udc->lock) | |||
1932 | spin_lock(udc->lock); | 1947 | spin_lock(udc->lock); |
1933 | if (err) | 1948 | if (err) |
1934 | break; | 1949 | break; |
1935 | err = isr_setup_status_phase(mEp); | 1950 | err = isr_setup_status_phase(udc); |
1936 | break; | 1951 | break; |
1937 | default: | 1952 | default: |
1938 | delegate: | 1953 | delegate: |
1939 | if (req.wLength == 0) /* no data phase */ | 1954 | if (req.wLength == 0) /* no data phase */ |
1940 | mEp->dir = TX; | 1955 | udc->ep0_dir = TX; |
1941 | 1956 | ||
1942 | spin_unlock(udc->lock); | 1957 | spin_unlock(udc->lock); |
1943 | err = udc->driver->setup(&udc->gadget, &req); | 1958 | err = udc->driver->setup(&udc->gadget, &req); |
@@ -1968,7 +1983,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1968 | const struct usb_endpoint_descriptor *desc) | 1983 | const struct usb_endpoint_descriptor *desc) |
1969 | { | 1984 | { |
1970 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); | 1985 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); |
1971 | int direction, retval = 0; | 1986 | int retval = 0; |
1972 | unsigned long flags; | 1987 | unsigned long flags; |
1973 | 1988 | ||
1974 | trace("%p, %p", ep, desc); | 1989 | trace("%p, %p", ep, desc); |
@@ -1982,7 +1997,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1982 | 1997 | ||
1983 | mEp->desc = desc; | 1998 | mEp->desc = desc; |
1984 | 1999 | ||
1985 | if (!list_empty(&mEp->qh[mEp->dir].queue)) | 2000 | if (!list_empty(&mEp->qh.queue)) |
1986 | warn("enabling a non-empty endpoint!"); | 2001 | warn("enabling a non-empty endpoint!"); |
1987 | 2002 | ||
1988 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; | 2003 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; |
@@ -1991,29 +2006,22 @@ static int ep_enable(struct usb_ep *ep, | |||
1991 | 2006 | ||
1992 | mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize); | 2007 | mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize); |
1993 | 2008 | ||
1994 | direction = mEp->dir; | 2009 | dbg_event(_usb_addr(mEp), "ENABLE", 0); |
1995 | do { | ||
1996 | dbg_event(_usb_addr(mEp), "ENABLE", 0); | ||
1997 | 2010 | ||
1998 | mEp->qh[mEp->dir].ptr->cap = 0; | 2011 | mEp->qh.ptr->cap = 0; |
1999 | 2012 | ||
2000 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 2013 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) |
2001 | mEp->qh[mEp->dir].ptr->cap |= QH_IOS; | 2014 | mEp->qh.ptr->cap |= QH_IOS; |
2002 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) | 2015 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) |
2003 | mEp->qh[mEp->dir].ptr->cap &= ~QH_MULT; | 2016 | mEp->qh.ptr->cap &= ~QH_MULT; |
2004 | else | 2017 | else |
2005 | mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT; | 2018 | mEp->qh.ptr->cap &= ~QH_ZLT; |
2006 | |||
2007 | mEp->qh[mEp->dir].ptr->cap |= | ||
2008 | (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT; | ||
2009 | mEp->qh[mEp->dir].ptr->td.next |= TD_TERMINATE; /* needed? */ | ||
2010 | |||
2011 | retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type); | ||
2012 | 2019 | ||
2013 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 2020 | mEp->qh.ptr->cap |= |
2014 | mEp->dir = (mEp->dir == TX) ? RX : TX; | 2021 | (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT; |
2022 | mEp->qh.ptr->td.next |= TD_TERMINATE; /* needed? */ | ||
2015 | 2023 | ||
2016 | } while (mEp->dir != direction); | 2024 | retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type); |
2017 | 2025 | ||
2018 | spin_unlock_irqrestore(mEp->lock, flags); | 2026 | spin_unlock_irqrestore(mEp->lock, flags); |
2019 | return retval; | 2027 | return retval; |
@@ -2146,7 +2154,7 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
2146 | spin_lock_irqsave(mEp->lock, flags); | 2154 | spin_lock_irqsave(mEp->lock, flags); |
2147 | 2155 | ||
2148 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL && | 2156 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL && |
2149 | !list_empty(&mEp->qh[mEp->dir].queue)) { | 2157 | !list_empty(&mEp->qh.queue)) { |
2150 | _ep_nuke(mEp); | 2158 | _ep_nuke(mEp); |
2151 | retval = -EOVERFLOW; | 2159 | retval = -EOVERFLOW; |
2152 | warn("endpoint ctrl %X nuked", _usb_addr(mEp)); | 2160 | warn("endpoint ctrl %X nuked", _usb_addr(mEp)); |
@@ -2170,9 +2178,9 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
2170 | /* push request */ | 2178 | /* push request */ |
2171 | mReq->req.status = -EINPROGRESS; | 2179 | mReq->req.status = -EINPROGRESS; |
2172 | mReq->req.actual = 0; | 2180 | mReq->req.actual = 0; |
2173 | list_add_tail(&mReq->queue, &mEp->qh[mEp->dir].queue); | 2181 | list_add_tail(&mReq->queue, &mEp->qh.queue); |
2174 | 2182 | ||
2175 | if (list_is_singular(&mEp->qh[mEp->dir].queue)) | 2183 | if (list_is_singular(&mEp->qh.queue)) |
2176 | retval = _hardware_enqueue(mEp, mReq); | 2184 | retval = _hardware_enqueue(mEp, mReq); |
2177 | 2185 | ||
2178 | if (retval == -EALREADY) { | 2186 | if (retval == -EALREADY) { |
@@ -2199,7 +2207,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
2199 | trace("%p, %p", ep, req); | 2207 | trace("%p, %p", ep, req); |
2200 | 2208 | ||
2201 | if (ep == NULL || req == NULL || mEp->desc == NULL || | 2209 | if (ep == NULL || req == NULL || mEp->desc == NULL || |
2202 | list_empty(&mReq->queue) || list_empty(&mEp->qh[mEp->dir].queue)) | 2210 | list_empty(&mReq->queue) || list_empty(&mEp->qh.queue)) |
2203 | return -EINVAL; | 2211 | return -EINVAL; |
2204 | 2212 | ||
2205 | spin_lock_irqsave(mEp->lock, flags); | 2213 | spin_lock_irqsave(mEp->lock, flags); |
@@ -2244,7 +2252,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) | |||
2244 | #ifndef STALL_IN | 2252 | #ifndef STALL_IN |
2245 | /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ | 2253 | /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ |
2246 | if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX && | 2254 | if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX && |
2247 | !list_empty(&mEp->qh[mEp->dir].queue)) { | 2255 | !list_empty(&mEp->qh.queue)) { |
2248 | spin_unlock_irqrestore(mEp->lock, flags); | 2256 | spin_unlock_irqrestore(mEp->lock, flags); |
2249 | return -EAGAIN; | 2257 | return -EAGAIN; |
2250 | } | 2258 | } |
@@ -2355,7 +2363,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
2355 | if (is_active) { | 2363 | if (is_active) { |
2356 | pm_runtime_get_sync(&_gadget->dev); | 2364 | pm_runtime_get_sync(&_gadget->dev); |
2357 | hw_device_reset(udc); | 2365 | hw_device_reset(udc); |
2358 | hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma); | 2366 | hw_device_state(udc->ep0out.qh.dma); |
2359 | } else { | 2367 | } else { |
2360 | hw_device_state(0); | 2368 | hw_device_state(0); |
2361 | if (udc->udc_driver->notify_event) | 2369 | if (udc->udc_driver->notify_event) |
@@ -2390,7 +2398,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2390 | int (*bind)(struct usb_gadget *)) | 2398 | int (*bind)(struct usb_gadget *)) |
2391 | { | 2399 | { |
2392 | struct ci13xxx *udc = _udc; | 2400 | struct ci13xxx *udc = _udc; |
2393 | unsigned long i, k, flags; | 2401 | unsigned long flags; |
2402 | int i, j; | ||
2394 | int retval = -ENOMEM; | 2403 | int retval = -ENOMEM; |
2395 | 2404 | ||
2396 | trace("%p", driver); | 2405 | trace("%p", driver); |
@@ -2427,45 +2436,46 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2427 | 2436 | ||
2428 | info("hw_ep_max = %d", hw_ep_max); | 2437 | info("hw_ep_max = %d", hw_ep_max); |
2429 | 2438 | ||
2430 | udc->driver = driver; | ||
2431 | udc->gadget.dev.driver = NULL; | 2439 | udc->gadget.dev.driver = NULL; |
2432 | 2440 | ||
2433 | retval = 0; | 2441 | retval = 0; |
2434 | for (i = 0; i < hw_ep_max; i++) { | 2442 | for (i = 0; i < hw_ep_max/2; i++) { |
2435 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 2443 | for (j = RX; j <= TX; j++) { |
2444 | int k = i + j * hw_ep_max/2; | ||
2445 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[k]; | ||
2436 | 2446 | ||
2437 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i", (int)i); | 2447 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i%s", i, |
2448 | (j == TX) ? "in" : "out"); | ||
2438 | 2449 | ||
2439 | mEp->lock = udc->lock; | 2450 | mEp->lock = udc->lock; |
2440 | mEp->device = &udc->gadget.dev; | 2451 | mEp->device = &udc->gadget.dev; |
2441 | mEp->td_pool = udc->td_pool; | 2452 | mEp->td_pool = udc->td_pool; |
2442 | 2453 | ||
2443 | mEp->ep.name = mEp->name; | 2454 | mEp->ep.name = mEp->name; |
2444 | mEp->ep.ops = &usb_ep_ops; | 2455 | mEp->ep.ops = &usb_ep_ops; |
2445 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; | 2456 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; |
2446 | 2457 | ||
2447 | /* this allocation cannot be random */ | 2458 | INIT_LIST_HEAD(&mEp->qh.queue); |
2448 | for (k = RX; k <= TX; k++) { | ||
2449 | INIT_LIST_HEAD(&mEp->qh[k].queue); | ||
2450 | spin_unlock_irqrestore(udc->lock, flags); | 2459 | spin_unlock_irqrestore(udc->lock, flags); |
2451 | mEp->qh[k].ptr = dma_pool_alloc(udc->qh_pool, | 2460 | mEp->qh.ptr = dma_pool_alloc(udc->qh_pool, GFP_KERNEL, |
2452 | GFP_KERNEL, | 2461 | &mEp->qh.dma); |
2453 | &mEp->qh[k].dma); | ||
2454 | spin_lock_irqsave(udc->lock, flags); | 2462 | spin_lock_irqsave(udc->lock, flags); |
2455 | if (mEp->qh[k].ptr == NULL) | 2463 | if (mEp->qh.ptr == NULL) |
2456 | retval = -ENOMEM; | 2464 | retval = -ENOMEM; |
2457 | else | 2465 | else |
2458 | memset(mEp->qh[k].ptr, 0, | 2466 | memset(mEp->qh.ptr, 0, sizeof(*mEp->qh.ptr)); |
2459 | sizeof(*mEp->qh[k].ptr)); | 2467 | |
2460 | } | 2468 | /* skip ep0 out and in endpoints */ |
2461 | if (i == 0) | 2469 | if (i == 0) |
2462 | udc->gadget.ep0 = &mEp->ep; | 2470 | continue; |
2463 | else | 2471 | |
2464 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); | 2472 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); |
2473 | } | ||
2465 | } | 2474 | } |
2466 | if (retval) | 2475 | if (retval) |
2467 | goto done; | 2476 | goto done; |
2468 | 2477 | ||
2478 | udc->gadget.ep0 = &udc->ep0in.ep; | ||
2469 | /* bind gadget */ | 2479 | /* bind gadget */ |
2470 | driver->driver.bus = NULL; | 2480 | driver->driver.bus = NULL; |
2471 | udc->gadget.dev.driver = &driver->driver; | 2481 | udc->gadget.dev.driver = &driver->driver; |
@@ -2479,6 +2489,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2479 | goto done; | 2489 | goto done; |
2480 | } | 2490 | } |
2481 | 2491 | ||
2492 | udc->driver = driver; | ||
2482 | pm_runtime_get_sync(&udc->gadget.dev); | 2493 | pm_runtime_get_sync(&udc->gadget.dev); |
2483 | if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { | 2494 | if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { |
2484 | if (udc->vbus_active) { | 2495 | if (udc->vbus_active) { |
@@ -2490,14 +2501,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2490 | } | 2501 | } |
2491 | } | 2502 | } |
2492 | 2503 | ||
2493 | retval = hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma); | 2504 | retval = hw_device_state(udc->ep0out.qh.dma); |
2494 | if (retval) | 2505 | if (retval) |
2495 | pm_runtime_put_sync(&udc->gadget.dev); | 2506 | pm_runtime_put_sync(&udc->gadget.dev); |
2496 | 2507 | ||
2497 | done: | 2508 | done: |
2498 | spin_unlock_irqrestore(udc->lock, flags); | 2509 | spin_unlock_irqrestore(udc->lock, flags); |
2499 | if (retval) | ||
2500 | usb_gadget_unregister_driver(driver); | ||
2501 | return retval; | 2510 | return retval; |
2502 | } | 2511 | } |
2503 | EXPORT_SYMBOL(usb_gadget_probe_driver); | 2512 | EXPORT_SYMBOL(usb_gadget_probe_driver); |
@@ -2510,7 +2519,7 @@ EXPORT_SYMBOL(usb_gadget_probe_driver); | |||
2510 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 2519 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) |
2511 | { | 2520 | { |
2512 | struct ci13xxx *udc = _udc; | 2521 | struct ci13xxx *udc = _udc; |
2513 | unsigned long i, k, flags; | 2522 | unsigned long i, flags; |
2514 | 2523 | ||
2515 | trace("%p", driver); | 2524 | trace("%p", driver); |
2516 | 2525 | ||
@@ -2546,17 +2555,14 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2546 | for (i = 0; i < hw_ep_max; i++) { | 2555 | for (i = 0; i < hw_ep_max; i++) { |
2547 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 2556 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; |
2548 | 2557 | ||
2549 | if (i == 0) | 2558 | if (!list_empty(&mEp->ep.ep_list)) |
2550 | udc->gadget.ep0 = NULL; | ||
2551 | else if (!list_empty(&mEp->ep.ep_list)) | ||
2552 | list_del_init(&mEp->ep.ep_list); | 2559 | list_del_init(&mEp->ep.ep_list); |
2553 | 2560 | ||
2554 | for (k = RX; k <= TX; k++) | 2561 | if (mEp->qh.ptr != NULL) |
2555 | if (mEp->qh[k].ptr != NULL) | 2562 | dma_pool_free(udc->qh_pool, mEp->qh.ptr, mEp->qh.dma); |
2556 | dma_pool_free(udc->qh_pool, | ||
2557 | mEp->qh[k].ptr, mEp->qh[k].dma); | ||
2558 | } | 2563 | } |
2559 | 2564 | ||
2565 | udc->gadget.ep0 = NULL; | ||
2560 | udc->driver = NULL; | 2566 | udc->driver = NULL; |
2561 | 2567 | ||
2562 | spin_unlock_irqrestore(udc->lock, flags); | 2568 | spin_unlock_irqrestore(udc->lock, flags); |
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h index f61fed07f76b..a2492b65f98c 100644 --- a/drivers/usb/gadget/ci13xxx_udc.h +++ b/drivers/usb/gadget/ci13xxx_udc.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * DEFINE | 20 | * DEFINE |
21 | *****************************************************************************/ | 21 | *****************************************************************************/ |
22 | #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ | 22 | #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ |
23 | #define ENDPT_MAX (16) | 23 | #define ENDPT_MAX (32) |
24 | #define CTRL_PAYLOAD_MAX (64) | 24 | #define CTRL_PAYLOAD_MAX (64) |
25 | #define RX (0) /* similar to USB_DIR_OUT but can be used as an index */ | 25 | #define RX (0) /* similar to USB_DIR_OUT but can be used as an index */ |
26 | #define TX (1) /* similar to USB_DIR_IN but can be used as an index */ | 26 | #define TX (1) /* similar to USB_DIR_IN but can be used as an index */ |
@@ -88,8 +88,7 @@ struct ci13xxx_ep { | |||
88 | struct list_head queue; | 88 | struct list_head queue; |
89 | struct ci13xxx_qh *ptr; | 89 | struct ci13xxx_qh *ptr; |
90 | dma_addr_t dma; | 90 | dma_addr_t dma; |
91 | } qh[2]; | 91 | } qh; |
92 | struct usb_request *status; | ||
93 | int wedge; | 92 | int wedge; |
94 | 93 | ||
95 | /* global resources */ | 94 | /* global resources */ |
@@ -119,9 +118,13 @@ struct ci13xxx { | |||
119 | 118 | ||
120 | struct dma_pool *qh_pool; /* DMA pool for queue heads */ | 119 | struct dma_pool *qh_pool; /* DMA pool for queue heads */ |
121 | struct dma_pool *td_pool; /* DMA pool for transfer descs */ | 120 | struct dma_pool *td_pool; /* DMA pool for transfer descs */ |
121 | struct usb_request *status; /* ep0 status request */ | ||
122 | 122 | ||
123 | struct usb_gadget gadget; /* USB slave device */ | 123 | struct usb_gadget gadget; /* USB slave device */ |
124 | struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ | 124 | struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ |
125 | u32 ep0_dir; /* ep0 direction */ | ||
126 | #define ep0out ci13xxx_ep[0] | ||
127 | #define ep0in ci13xxx_ep[16] | ||
125 | 128 | ||
126 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ | 129 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ |
127 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ | 130 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index f6ff8456d52d..1ba4befe336b 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -928,8 +928,9 @@ unknown: | |||
928 | */ | 928 | */ |
929 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 929 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
930 | case USB_RECIP_INTERFACE: | 930 | case USB_RECIP_INTERFACE: |
931 | if (cdev->config) | 931 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) |
932 | f = cdev->config->interface[intf]; | 932 | break; |
933 | f = cdev->config->interface[intf]; | ||
933 | break; | 934 | break; |
934 | 935 | ||
935 | case USB_RECIP_ENDPOINT: | 936 | case USB_RECIP_ENDPOINT: |
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c index 0c8dd81dddca..b120dbb64d0f 100644 --- a/drivers/usb/gadget/pch_udc.c +++ b/drivers/usb/gadget/pch_udc.c | |||
@@ -198,10 +198,10 @@ | |||
198 | #define PCH_UDC_BRLEN 0x0F /* Burst length */ | 198 | #define PCH_UDC_BRLEN 0x0F /* Burst length */ |
199 | #define PCH_UDC_THLEN 0x1F /* Threshold length */ | 199 | #define PCH_UDC_THLEN 0x1F /* Threshold length */ |
200 | /* Value of EP Buffer Size */ | 200 | /* Value of EP Buffer Size */ |
201 | #define UDC_EP0IN_BUFF_SIZE 64 | 201 | #define UDC_EP0IN_BUFF_SIZE 16 |
202 | #define UDC_EPIN_BUFF_SIZE 512 | 202 | #define UDC_EPIN_BUFF_SIZE 256 |
203 | #define UDC_EP0OUT_BUFF_SIZE 64 | 203 | #define UDC_EP0OUT_BUFF_SIZE 16 |
204 | #define UDC_EPOUT_BUFF_SIZE 512 | 204 | #define UDC_EPOUT_BUFF_SIZE 256 |
205 | /* Value of EP maximum packet size */ | 205 | /* Value of EP maximum packet size */ |
206 | #define UDC_EP0IN_MAX_PKT_SIZE 64 | 206 | #define UDC_EP0IN_MAX_PKT_SIZE 64 |
207 | #define UDC_EP0OUT_MAX_PKT_SIZE 64 | 207 | #define UDC_EP0OUT_MAX_PKT_SIZE 64 |
@@ -351,7 +351,7 @@ struct pch_udc_dev { | |||
351 | struct pci_pool *data_requests; | 351 | struct pci_pool *data_requests; |
352 | struct pci_pool *stp_requests; | 352 | struct pci_pool *stp_requests; |
353 | dma_addr_t dma_addr; | 353 | dma_addr_t dma_addr; |
354 | unsigned long ep0out_buf[64]; | 354 | void *ep0out_buf; |
355 | struct usb_ctrlrequest setup_data; | 355 | struct usb_ctrlrequest setup_data; |
356 | unsigned long phys_addr; | 356 | unsigned long phys_addr; |
357 | void __iomem *base_addr; | 357 | void __iomem *base_addr; |
@@ -361,6 +361,8 @@ struct pch_udc_dev { | |||
361 | 361 | ||
362 | #define PCH_UDC_PCI_BAR 1 | 362 | #define PCH_UDC_PCI_BAR 1 |
363 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 | 363 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 |
364 | #define PCI_VENDOR_ID_ROHM 0x10DB | ||
365 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D | ||
364 | 366 | ||
365 | static const char ep0_string[] = "ep0in"; | 367 | static const char ep0_string[] = "ep0in"; |
366 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ | 368 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ |
@@ -1219,11 +1221,11 @@ static void complete_req(struct pch_udc_ep *ep, struct pch_udc_request *req, | |||
1219 | dev = ep->dev; | 1221 | dev = ep->dev; |
1220 | if (req->dma_mapped) { | 1222 | if (req->dma_mapped) { |
1221 | if (ep->in) | 1223 | if (ep->in) |
1222 | pci_unmap_single(dev->pdev, req->req.dma, | 1224 | dma_unmap_single(&dev->pdev->dev, req->req.dma, |
1223 | req->req.length, PCI_DMA_TODEVICE); | 1225 | req->req.length, DMA_TO_DEVICE); |
1224 | else | 1226 | else |
1225 | pci_unmap_single(dev->pdev, req->req.dma, | 1227 | dma_unmap_single(&dev->pdev->dev, req->req.dma, |
1226 | req->req.length, PCI_DMA_FROMDEVICE); | 1228 | req->req.length, DMA_FROM_DEVICE); |
1227 | req->dma_mapped = 0; | 1229 | req->dma_mapped = 0; |
1228 | req->req.dma = DMA_ADDR_INVALID; | 1230 | req->req.dma = DMA_ADDR_INVALID; |
1229 | } | 1231 | } |
@@ -1414,7 +1416,6 @@ static void pch_udc_start_rxrequest(struct pch_udc_ep *ep, | |||
1414 | 1416 | ||
1415 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); | 1417 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); |
1416 | td_data = req->td_data; | 1418 | td_data = req->td_data; |
1417 | ep->td_data = req->td_data; | ||
1418 | /* Set the status bits for all descriptors */ | 1419 | /* Set the status bits for all descriptors */ |
1419 | while (1) { | 1420 | while (1) { |
1420 | td_data->status = (td_data->status & ~PCH_UDC_BUFF_STS) | | 1421 | td_data->status = (td_data->status & ~PCH_UDC_BUFF_STS) | |
@@ -1613,15 +1614,19 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1613 | if (usbreq->length && | 1614 | if (usbreq->length && |
1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { | 1615 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { |
1615 | if (ep->in) | 1616 | if (ep->in) |
1616 | usbreq->dma = pci_map_single(dev->pdev, usbreq->buf, | 1617 | usbreq->dma = dma_map_single(&dev->pdev->dev, |
1617 | usbreq->length, PCI_DMA_TODEVICE); | 1618 | usbreq->buf, |
1619 | usbreq->length, | ||
1620 | DMA_TO_DEVICE); | ||
1618 | else | 1621 | else |
1619 | usbreq->dma = pci_map_single(dev->pdev, usbreq->buf, | 1622 | usbreq->dma = dma_map_single(&dev->pdev->dev, |
1620 | usbreq->length, PCI_DMA_FROMDEVICE); | 1623 | usbreq->buf, |
1624 | usbreq->length, | ||
1625 | DMA_FROM_DEVICE); | ||
1621 | req->dma_mapped = 1; | 1626 | req->dma_mapped = 1; |
1622 | } | 1627 | } |
1623 | if (usbreq->length > 0) { | 1628 | if (usbreq->length > 0) { |
1624 | retval = prepare_dma(ep, req, gfp); | 1629 | retval = prepare_dma(ep, req, GFP_ATOMIC); |
1625 | if (retval) | 1630 | if (retval) |
1626 | goto probe_end; | 1631 | goto probe_end; |
1627 | } | 1632 | } |
@@ -1646,7 +1651,6 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1646 | pch_udc_wait_ep_stall(ep); | 1651 | pch_udc_wait_ep_stall(ep); |
1647 | pch_udc_ep_clear_nak(ep); | 1652 | pch_udc_ep_clear_nak(ep); |
1648 | pch_udc_enable_ep_interrupts(ep->dev, (1 << ep->num)); | 1653 | pch_udc_enable_ep_interrupts(ep->dev, (1 << ep->num)); |
1649 | pch_udc_set_dma(dev, DMA_DIR_TX); | ||
1650 | } | 1654 | } |
1651 | } | 1655 | } |
1652 | /* Now add this request to the ep's pending requests */ | 1656 | /* Now add this request to the ep's pending requests */ |
@@ -1926,6 +1930,7 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep) | |||
1926 | PCH_UDC_BS_DMA_DONE) | 1930 | PCH_UDC_BS_DMA_DONE) |
1927 | return; | 1931 | return; |
1928 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); | 1932 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); |
1933 | pch_udc_ep_set_ddptr(ep, 0); | ||
1929 | if ((req->td_data_last->status & PCH_UDC_RXTX_STS) != | 1934 | if ((req->td_data_last->status & PCH_UDC_RXTX_STS) != |
1930 | PCH_UDC_RTS_SUCC) { | 1935 | PCH_UDC_RTS_SUCC) { |
1931 | dev_err(&dev->pdev->dev, "Invalid RXTX status (0x%08x) " | 1936 | dev_err(&dev->pdev->dev, "Invalid RXTX status (0x%08x) " |
@@ -1963,7 +1968,7 @@ static void pch_udc_svc_data_in(struct pch_udc_dev *dev, int ep_num) | |||
1963 | u32 epsts; | 1968 | u32 epsts; |
1964 | struct pch_udc_ep *ep; | 1969 | struct pch_udc_ep *ep; |
1965 | 1970 | ||
1966 | ep = &dev->ep[2*ep_num]; | 1971 | ep = &dev->ep[UDC_EPIN_IDX(ep_num)]; |
1967 | epsts = ep->epsts; | 1972 | epsts = ep->epsts; |
1968 | ep->epsts = 0; | 1973 | ep->epsts = 0; |
1969 | 1974 | ||
@@ -2008,7 +2013,7 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) | |||
2008 | struct pch_udc_ep *ep; | 2013 | struct pch_udc_ep *ep; |
2009 | struct pch_udc_request *req = NULL; | 2014 | struct pch_udc_request *req = NULL; |
2010 | 2015 | ||
2011 | ep = &dev->ep[2*ep_num + 1]; | 2016 | ep = &dev->ep[UDC_EPOUT_IDX(ep_num)]; |
2012 | epsts = ep->epsts; | 2017 | epsts = ep->epsts; |
2013 | ep->epsts = 0; | 2018 | ep->epsts = 0; |
2014 | 2019 | ||
@@ -2025,10 +2030,11 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) | |||
2025 | } | 2030 | } |
2026 | if (epsts & UDC_EPSTS_HE) | 2031 | if (epsts & UDC_EPSTS_HE) |
2027 | return; | 2032 | return; |
2028 | if (epsts & UDC_EPSTS_RSS) | 2033 | if (epsts & UDC_EPSTS_RSS) { |
2029 | pch_udc_ep_set_stall(ep); | 2034 | pch_udc_ep_set_stall(ep); |
2030 | pch_udc_enable_ep_interrupts(ep->dev, | 2035 | pch_udc_enable_ep_interrupts(ep->dev, |
2031 | PCH_UDC_EPINT(ep->in, ep->num)); | 2036 | PCH_UDC_EPINT(ep->in, ep->num)); |
2037 | } | ||
2032 | if (epsts & UDC_EPSTS_RCS) { | 2038 | if (epsts & UDC_EPSTS_RCS) { |
2033 | if (!dev->prot_stall) { | 2039 | if (!dev->prot_stall) { |
2034 | pch_udc_ep_clear_stall(ep); | 2040 | pch_udc_ep_clear_stall(ep); |
@@ -2060,8 +2066,10 @@ static void pch_udc_svc_control_in(struct pch_udc_dev *dev) | |||
2060 | { | 2066 | { |
2061 | u32 epsts; | 2067 | u32 epsts; |
2062 | struct pch_udc_ep *ep; | 2068 | struct pch_udc_ep *ep; |
2069 | struct pch_udc_ep *ep_out; | ||
2063 | 2070 | ||
2064 | ep = &dev->ep[UDC_EP0IN_IDX]; | 2071 | ep = &dev->ep[UDC_EP0IN_IDX]; |
2072 | ep_out = &dev->ep[UDC_EP0OUT_IDX]; | ||
2065 | epsts = ep->epsts; | 2073 | epsts = ep->epsts; |
2066 | ep->epsts = 0; | 2074 | ep->epsts = 0; |
2067 | 2075 | ||
@@ -2073,8 +2081,16 @@ static void pch_udc_svc_control_in(struct pch_udc_dev *dev) | |||
2073 | return; | 2081 | return; |
2074 | if (epsts & UDC_EPSTS_HE) | 2082 | if (epsts & UDC_EPSTS_HE) |
2075 | return; | 2083 | return; |
2076 | if ((epsts & UDC_EPSTS_TDC) && (!dev->stall)) | 2084 | if ((epsts & UDC_EPSTS_TDC) && (!dev->stall)) { |
2077 | pch_udc_complete_transfer(ep); | 2085 | pch_udc_complete_transfer(ep); |
2086 | pch_udc_clear_dma(dev, DMA_DIR_RX); | ||
2087 | ep_out->td_data->status = (ep_out->td_data->status & | ||
2088 | ~PCH_UDC_BUFF_STS) | | ||
2089 | PCH_UDC_BS_HST_RDY; | ||
2090 | pch_udc_ep_clear_nak(ep_out); | ||
2091 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2092 | pch_udc_ep_set_rrdy(ep_out); | ||
2093 | } | ||
2078 | /* On IN interrupt, provide data if we have any */ | 2094 | /* On IN interrupt, provide data if we have any */ |
2079 | if ((epsts & UDC_EPSTS_IN) && !(epsts & UDC_EPSTS_TDC) && | 2095 | if ((epsts & UDC_EPSTS_IN) && !(epsts & UDC_EPSTS_TDC) && |
2080 | !(epsts & UDC_EPSTS_TXEMPTY)) | 2096 | !(epsts & UDC_EPSTS_TXEMPTY)) |
@@ -2102,11 +2118,9 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2102 | dev->stall = 0; | 2118 | dev->stall = 0; |
2103 | dev->ep[UDC_EP0IN_IDX].halted = 0; | 2119 | dev->ep[UDC_EP0IN_IDX].halted = 0; |
2104 | dev->ep[UDC_EP0OUT_IDX].halted = 0; | 2120 | dev->ep[UDC_EP0OUT_IDX].halted = 0; |
2105 | /* In data not ready */ | ||
2106 | pch_udc_ep_set_nak(&(dev->ep[UDC_EP0IN_IDX])); | ||
2107 | dev->setup_data = ep->td_stp->request; | 2121 | dev->setup_data = ep->td_stp->request; |
2108 | pch_udc_init_setup_buff(ep->td_stp); | 2122 | pch_udc_init_setup_buff(ep->td_stp); |
2109 | pch_udc_clear_dma(dev, DMA_DIR_TX); | 2123 | pch_udc_clear_dma(dev, DMA_DIR_RX); |
2110 | pch_udc_ep_fifo_flush(&(dev->ep[UDC_EP0IN_IDX]), | 2124 | pch_udc_ep_fifo_flush(&(dev->ep[UDC_EP0IN_IDX]), |
2111 | dev->ep[UDC_EP0IN_IDX].in); | 2125 | dev->ep[UDC_EP0IN_IDX].in); |
2112 | if ((dev->setup_data.bRequestType & USB_DIR_IN)) | 2126 | if ((dev->setup_data.bRequestType & USB_DIR_IN)) |
@@ -2122,14 +2136,23 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2122 | setup_supported = dev->driver->setup(&dev->gadget, | 2136 | setup_supported = dev->driver->setup(&dev->gadget, |
2123 | &dev->setup_data); | 2137 | &dev->setup_data); |
2124 | spin_lock(&dev->lock); | 2138 | spin_lock(&dev->lock); |
2139 | |||
2140 | if (dev->setup_data.bRequestType & USB_DIR_IN) { | ||
2141 | ep->td_data->status = (ep->td_data->status & | ||
2142 | ~PCH_UDC_BUFF_STS) | | ||
2143 | PCH_UDC_BS_HST_RDY; | ||
2144 | pch_udc_ep_set_ddptr(ep, ep->td_data_phys); | ||
2145 | } | ||
2125 | /* ep0 in returns data on IN phase */ | 2146 | /* ep0 in returns data on IN phase */ |
2126 | if (setup_supported >= 0 && setup_supported < | 2147 | if (setup_supported >= 0 && setup_supported < |
2127 | UDC_EP0IN_MAX_PKT_SIZE) { | 2148 | UDC_EP0IN_MAX_PKT_SIZE) { |
2128 | pch_udc_ep_clear_nak(&(dev->ep[UDC_EP0IN_IDX])); | 2149 | pch_udc_ep_clear_nak(&(dev->ep[UDC_EP0IN_IDX])); |
2129 | /* Gadget would have queued a request when | 2150 | /* Gadget would have queued a request when |
2130 | * we called the setup */ | 2151 | * we called the setup */ |
2131 | pch_udc_set_dma(dev, DMA_DIR_RX); | 2152 | if (!(dev->setup_data.bRequestType & USB_DIR_IN)) { |
2132 | pch_udc_ep_clear_nak(ep); | 2153 | pch_udc_set_dma(dev, DMA_DIR_RX); |
2154 | pch_udc_ep_clear_nak(ep); | ||
2155 | } | ||
2133 | } else if (setup_supported < 0) { | 2156 | } else if (setup_supported < 0) { |
2134 | /* if unsupported request, then stall */ | 2157 | /* if unsupported request, then stall */ |
2135 | pch_udc_ep_set_stall(&(dev->ep[UDC_EP0IN_IDX])); | 2158 | pch_udc_ep_set_stall(&(dev->ep[UDC_EP0IN_IDX])); |
@@ -2142,22 +2165,13 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2142 | } | 2165 | } |
2143 | } else if ((((stat & UDC_EPSTS_OUT_MASK) >> UDC_EPSTS_OUT_SHIFT) == | 2166 | } else if ((((stat & UDC_EPSTS_OUT_MASK) >> UDC_EPSTS_OUT_SHIFT) == |
2144 | UDC_EPSTS_OUT_DATA) && !dev->stall) { | 2167 | UDC_EPSTS_OUT_DATA) && !dev->stall) { |
2145 | if (list_empty(&ep->queue)) { | 2168 | pch_udc_clear_dma(dev, DMA_DIR_RX); |
2146 | dev_err(&dev->pdev->dev, "%s: No request\n", __func__); | 2169 | pch_udc_ep_set_ddptr(ep, 0); |
2147 | ep->td_data->status = (ep->td_data->status & | 2170 | if (!list_empty(&ep->queue)) { |
2148 | ~PCH_UDC_BUFF_STS) | | ||
2149 | PCH_UDC_BS_HST_RDY; | ||
2150 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2151 | } else { | ||
2152 | /* control write */ | ||
2153 | /* next function will pickuo an clear the status */ | ||
2154 | ep->epsts = stat; | 2171 | ep->epsts = stat; |
2155 | 2172 | pch_udc_svc_data_out(dev, PCH_UDC_EP0); | |
2156 | pch_udc_svc_data_out(dev, 0); | ||
2157 | /* re-program desc. pointer for possible ZLPs */ | ||
2158 | pch_udc_ep_set_ddptr(ep, ep->td_data_phys); | ||
2159 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2160 | } | 2173 | } |
2174 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2161 | } | 2175 | } |
2162 | pch_udc_ep_set_rrdy(ep); | 2176 | pch_udc_ep_set_rrdy(ep); |
2163 | } | 2177 | } |
@@ -2174,7 +2188,7 @@ static void pch_udc_postsvc_epinters(struct pch_udc_dev *dev, int ep_num) | |||
2174 | struct pch_udc_ep *ep; | 2188 | struct pch_udc_ep *ep; |
2175 | struct pch_udc_request *req; | 2189 | struct pch_udc_request *req; |
2176 | 2190 | ||
2177 | ep = &dev->ep[2*ep_num]; | 2191 | ep = &dev->ep[UDC_EPIN_IDX(ep_num)]; |
2178 | if (!list_empty(&ep->queue)) { | 2192 | if (!list_empty(&ep->queue)) { |
2179 | req = list_entry(ep->queue.next, struct pch_udc_request, queue); | 2193 | req = list_entry(ep->queue.next, struct pch_udc_request, queue); |
2180 | pch_udc_enable_ep_interrupts(ep->dev, | 2194 | pch_udc_enable_ep_interrupts(ep->dev, |
@@ -2196,13 +2210,13 @@ static void pch_udc_read_all_epstatus(struct pch_udc_dev *dev, u32 ep_intr) | |||
2196 | for (i = 0; i < PCH_UDC_USED_EP_NUM; i++) { | 2210 | for (i = 0; i < PCH_UDC_USED_EP_NUM; i++) { |
2197 | /* IN */ | 2211 | /* IN */ |
2198 | if (ep_intr & (0x1 << i)) { | 2212 | if (ep_intr & (0x1 << i)) { |
2199 | ep = &dev->ep[2*i]; | 2213 | ep = &dev->ep[UDC_EPIN_IDX(i)]; |
2200 | ep->epsts = pch_udc_read_ep_status(ep); | 2214 | ep->epsts = pch_udc_read_ep_status(ep); |
2201 | pch_udc_clear_ep_status(ep, ep->epsts); | 2215 | pch_udc_clear_ep_status(ep, ep->epsts); |
2202 | } | 2216 | } |
2203 | /* OUT */ | 2217 | /* OUT */ |
2204 | if (ep_intr & (0x10000 << i)) { | 2218 | if (ep_intr & (0x10000 << i)) { |
2205 | ep = &dev->ep[2*i+1]; | 2219 | ep = &dev->ep[UDC_EPOUT_IDX(i)]; |
2206 | ep->epsts = pch_udc_read_ep_status(ep); | 2220 | ep->epsts = pch_udc_read_ep_status(ep); |
2207 | pch_udc_clear_ep_status(ep, ep->epsts); | 2221 | pch_udc_clear_ep_status(ep, ep->epsts); |
2208 | } | 2222 | } |
@@ -2563,9 +2577,6 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev) | |||
2563 | dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; | 2577 | dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; |
2564 | dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; | 2578 | dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; |
2565 | 2579 | ||
2566 | dev->dma_addr = pci_map_single(dev->pdev, dev->ep0out_buf, 256, | ||
2567 | PCI_DMA_FROMDEVICE); | ||
2568 | |||
2569 | /* remove ep0 in and out from the list. They have own pointer */ | 2580 | /* remove ep0 in and out from the list. They have own pointer */ |
2570 | list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); | 2581 | list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); |
2571 | list_del_init(&dev->ep[UDC_EP0OUT_IDX].ep.ep_list); | 2582 | list_del_init(&dev->ep[UDC_EP0OUT_IDX].ep.ep_list); |
@@ -2637,6 +2648,13 @@ static int init_dma_pools(struct pch_udc_dev *dev) | |||
2637 | dev->ep[UDC_EP0IN_IDX].td_stp_phys = 0; | 2648 | dev->ep[UDC_EP0IN_IDX].td_stp_phys = 0; |
2638 | dev->ep[UDC_EP0IN_IDX].td_data = NULL; | 2649 | dev->ep[UDC_EP0IN_IDX].td_data = NULL; |
2639 | dev->ep[UDC_EP0IN_IDX].td_data_phys = 0; | 2650 | dev->ep[UDC_EP0IN_IDX].td_data_phys = 0; |
2651 | |||
2652 | dev->ep0out_buf = kzalloc(UDC_EP0OUT_BUFF_SIZE * 4, GFP_KERNEL); | ||
2653 | if (!dev->ep0out_buf) | ||
2654 | return -ENOMEM; | ||
2655 | dev->dma_addr = dma_map_single(&dev->pdev->dev, dev->ep0out_buf, | ||
2656 | UDC_EP0OUT_BUFF_SIZE * 4, | ||
2657 | DMA_FROM_DEVICE); | ||
2640 | return 0; | 2658 | return 0; |
2641 | } | 2659 | } |
2642 | 2660 | ||
@@ -2700,7 +2718,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2700 | 2718 | ||
2701 | pch_udc_disable_interrupts(dev, UDC_DEVINT_MSK); | 2719 | pch_udc_disable_interrupts(dev, UDC_DEVINT_MSK); |
2702 | 2720 | ||
2703 | /* Assues that there are no pending requets with this driver */ | 2721 | /* Assures that there are no pending requests with this driver */ |
2722 | driver->disconnect(&dev->gadget); | ||
2704 | driver->unbind(&dev->gadget); | 2723 | driver->unbind(&dev->gadget); |
2705 | dev->gadget.dev.driver = NULL; | 2724 | dev->gadget.dev.driver = NULL; |
2706 | dev->driver = NULL; | 2725 | dev->driver = NULL; |
@@ -2750,6 +2769,11 @@ static void pch_udc_remove(struct pci_dev *pdev) | |||
2750 | pci_pool_destroy(dev->stp_requests); | 2769 | pci_pool_destroy(dev->stp_requests); |
2751 | } | 2770 | } |
2752 | 2771 | ||
2772 | if (dev->dma_addr) | ||
2773 | dma_unmap_single(&dev->pdev->dev, dev->dma_addr, | ||
2774 | UDC_EP0OUT_BUFF_SIZE * 4, DMA_FROM_DEVICE); | ||
2775 | kfree(dev->ep0out_buf); | ||
2776 | |||
2753 | pch_udc_exit(dev); | 2777 | pch_udc_exit(dev); |
2754 | 2778 | ||
2755 | if (dev->irq_registered) | 2779 | if (dev->irq_registered) |
@@ -2792,11 +2816,7 @@ static int pch_udc_resume(struct pci_dev *pdev) | |||
2792 | int ret; | 2816 | int ret; |
2793 | 2817 | ||
2794 | pci_set_power_state(pdev, PCI_D0); | 2818 | pci_set_power_state(pdev, PCI_D0); |
2795 | ret = pci_restore_state(pdev); | 2819 | pci_restore_state(pdev); |
2796 | if (ret) { | ||
2797 | dev_err(&pdev->dev, "%s: pci_restore_state failed\n", __func__); | ||
2798 | return ret; | ||
2799 | } | ||
2800 | ret = pci_enable_device(pdev); | 2820 | ret = pci_enable_device(pdev); |
2801 | if (ret) { | 2821 | if (ret) { |
2802 | dev_err(&pdev->dev, "%s: pci_enable_device failed\n", __func__); | 2822 | dev_err(&pdev->dev, "%s: pci_enable_device failed\n", __func__); |
@@ -2914,6 +2934,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = { | |||
2914 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | 2934 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, |
2915 | .class_mask = 0xffffffff, | 2935 | .class_mask = 0xffffffff, |
2916 | }, | 2936 | }, |
2937 | { | ||
2938 | PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7213_IOH_UDC), | ||
2939 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | ||
2940 | .class_mask = 0xffffffff, | ||
2941 | }, | ||
2917 | { 0 }, | 2942 | { 0 }, |
2918 | }; | 2943 | }; |
2919 | 2944 | ||
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 2fc8636316c5..12ff6cffedc9 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget; | |||
131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). | 131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static ushort __initdata idVendor; | 134 | static ushort idVendor; |
135 | module_param(idVendor, ushort, S_IRUGO); | 135 | module_param(idVendor, ushort, S_IRUGO); |
136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); | 136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); |
137 | 137 | ||
138 | static ushort __initdata idProduct; | 138 | static ushort idProduct; |
139 | module_param(idProduct, ushort, S_IRUGO); | 139 | module_param(idProduct, ushort, S_IRUGO); |
140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); | 140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); |
141 | 141 | ||
142 | static ushort __initdata bcdDevice; | 142 | static ushort bcdDevice; |
143 | module_param(bcdDevice, ushort, S_IRUGO); | 143 | module_param(bcdDevice, ushort, S_IRUGO); |
144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); | 144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); |
145 | 145 | ||
146 | static char *__initdata iManufacturer; | 146 | static char *iManufacturer; |
147 | module_param(iManufacturer, charp, S_IRUGO); | 147 | module_param(iManufacturer, charp, S_IRUGO); |
148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); | 148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); |
149 | 149 | ||
150 | static char *__initdata iProduct; | 150 | static char *iProduct; |
151 | module_param(iProduct, charp, S_IRUGO); | 151 | module_param(iProduct, charp, S_IRUGO); |
152 | MODULE_PARM_DESC(iProduct, "USB Product string"); | 152 | MODULE_PARM_DESC(iProduct, "USB Product string"); |
153 | 153 | ||
154 | static char *__initdata iSerialNum; | 154 | static char *iSerialNum; |
155 | module_param(iSerialNum, charp, S_IRUGO); | 155 | module_param(iSerialNum, charp, S_IRUGO); |
156 | MODULE_PARM_DESC(iSerialNum, "1"); | 156 | MODULE_PARM_DESC(iSerialNum, "1"); |
157 | 157 | ||
158 | static char *__initdata iPNPstring; | 158 | static char *iPNPstring; |
159 | module_param(iPNPstring, charp, S_IRUGO); | 159 | module_param(iPNPstring, charp, S_IRUGO); |
160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); | 160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); |
161 | 161 | ||
@@ -1596,13 +1596,12 @@ cleanup(void) | |||
1596 | int status; | 1596 | int status; |
1597 | 1597 | ||
1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); | 1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1599 | class_destroy(usb_gadget_class); | ||
1600 | unregister_chrdev_region(g_printer_devno, 2); | ||
1601 | |||
1602 | status = usb_gadget_unregister_driver(&printer_driver); | 1599 | status = usb_gadget_unregister_driver(&printer_driver); |
1603 | if (status) | 1600 | if (status) |
1604 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1601 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1605 | 1602 | ||
1603 | unregister_chrdev_region(g_printer_devno, 2); | ||
1604 | class_destroy(usb_gadget_class); | ||
1606 | mutex_unlock(&usb_printer_gadget.lock_printer_io); | 1605 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1607 | } | 1606 | } |
1608 | module_exit(cleanup); | 1607 | module_exit(cleanup); |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 86e42892016d..5c761df7fa83 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -52,7 +52,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
52 | struct resource *res; | 52 | struct resource *res; |
53 | int irq; | 53 | int irq; |
54 | int retval; | 54 | int retval; |
55 | unsigned int temp; | ||
56 | 55 | ||
57 | pr_debug("initializing FSL-SOC USB Controller\n"); | 56 | pr_debug("initializing FSL-SOC USB Controller\n"); |
58 | 57 | ||
@@ -126,18 +125,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
126 | goto err3; | 125 | goto err3; |
127 | } | 126 | } |
128 | 127 | ||
129 | /* | ||
130 | * Check if it is MPC5121 SoC, otherwise set pdata->have_sysif_regs | ||
131 | * flag for 83xx or 8536 system interface registers. | ||
132 | */ | ||
133 | if (pdata->big_endian_mmio) | ||
134 | temp = in_be32(hcd->regs + FSL_SOC_USB_ID); | ||
135 | else | ||
136 | temp = in_le32(hcd->regs + FSL_SOC_USB_ID); | ||
137 | |||
138 | if ((temp & ID_MSK) != (~((temp & NID_MSK) >> 8) & ID_MSK)) | ||
139 | pdata->have_sysif_regs = 1; | ||
140 | |||
141 | /* Enable USB controller, 83xx or 8536 */ | 128 | /* Enable USB controller, 83xx or 8536 */ |
142 | if (pdata->have_sysif_regs) | 129 | if (pdata->have_sysif_regs) |
143 | setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4); | 130 | setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4); |
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h index 2c8353795226..3fabed33d940 100644 --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h | |||
@@ -19,9 +19,6 @@ | |||
19 | #define _EHCI_FSL_H | 19 | #define _EHCI_FSL_H |
20 | 20 | ||
21 | /* offsets for the non-ehci registers in the FSL SOC USB controller */ | 21 | /* offsets for the non-ehci registers in the FSL SOC USB controller */ |
22 | #define FSL_SOC_USB_ID 0x0 | ||
23 | #define ID_MSK 0x3f | ||
24 | #define NID_MSK 0x3f00 | ||
25 | #define FSL_SOC_USB_ULPIVP 0x170 | 22 | #define FSL_SOC_USB_ULPIVP 0x170 |
26 | #define FSL_SOC_USB_PORTSC1 0x184 | 23 | #define FSL_SOC_USB_PORTSC1 0x184 |
27 | #define PORT_PTS_MSK (3<<30) | 24 | #define PORT_PTS_MSK (3<<30) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6fee3cd58efe..74dcf49bd015 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -572,6 +572,8 @@ static int ehci_init(struct usb_hcd *hcd) | |||
572 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; | 572 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; |
573 | ehci->iaa_watchdog.data = (unsigned long) ehci; | 573 | ehci->iaa_watchdog.data = (unsigned long) ehci; |
574 | 574 | ||
575 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
576 | |||
575 | /* | 577 | /* |
576 | * hw default: 1K periodic list heads, one per frame. | 578 | * hw default: 1K periodic list heads, one per frame. |
577 | * periodic_size can shrink by USBCMD update if hcc_params allows. | 579 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
@@ -579,11 +581,20 @@ static int ehci_init(struct usb_hcd *hcd) | |||
579 | ehci->periodic_size = DEFAULT_I_TDPS; | 581 | ehci->periodic_size = DEFAULT_I_TDPS; |
580 | INIT_LIST_HEAD(&ehci->cached_itd_list); | 582 | INIT_LIST_HEAD(&ehci->cached_itd_list); |
581 | INIT_LIST_HEAD(&ehci->cached_sitd_list); | 583 | INIT_LIST_HEAD(&ehci->cached_sitd_list); |
584 | |||
585 | if (HCC_PGM_FRAMELISTLEN(hcc_params)) { | ||
586 | /* periodic schedule size can be smaller than default */ | ||
587 | switch (EHCI_TUNE_FLS) { | ||
588 | case 0: ehci->periodic_size = 1024; break; | ||
589 | case 1: ehci->periodic_size = 512; break; | ||
590 | case 2: ehci->periodic_size = 256; break; | ||
591 | default: BUG(); | ||
592 | } | ||
593 | } | ||
582 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) | 594 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
583 | return retval; | 595 | return retval; |
584 | 596 | ||
585 | /* controllers may cache some of the periodic schedule ... */ | 597 | /* controllers may cache some of the periodic schedule ... */ |
586 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
587 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache | 598 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
588 | ehci->i_thresh = 2 + 8; | 599 | ehci->i_thresh = 2 + 8; |
589 | else // N microframes cached | 600 | else // N microframes cached |
@@ -637,12 +648,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
637 | /* periodic schedule size can be smaller than default */ | 648 | /* periodic schedule size can be smaller than default */ |
638 | temp &= ~(3 << 2); | 649 | temp &= ~(3 << 2); |
639 | temp |= (EHCI_TUNE_FLS << 2); | 650 | temp |= (EHCI_TUNE_FLS << 2); |
640 | switch (EHCI_TUNE_FLS) { | ||
641 | case 0: ehci->periodic_size = 1024; break; | ||
642 | case 1: ehci->periodic_size = 512; break; | ||
643 | case 2: ehci->periodic_size = 256; break; | ||
644 | default: BUG(); | ||
645 | } | ||
646 | } | 651 | } |
647 | if (HCC_LPM(hcc_params)) { | 652 | if (HCC_LPM(hcc_params)) { |
648 | /* support link power management EHCI 1.1 addendum */ | 653 | /* support link power management EHCI 1.1 addendum */ |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index fa59b26fc5bc..c8e360d7d975 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -21,10 +21,13 @@ | |||
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/usb/otg.h> | 23 | #include <linux/usb/otg.h> |
24 | #include <linux/usb/ulpi.h> | ||
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
25 | 26 | ||
26 | #include <mach/mxc_ehci.h> | 27 | #include <mach/mxc_ehci.h> |
27 | 28 | ||
29 | #include <asm/mach-types.h> | ||
30 | |||
28 | #define ULPI_VIEWPORT_OFFSET 0x170 | 31 | #define ULPI_VIEWPORT_OFFSET 0x170 |
29 | 32 | ||
30 | struct ehci_mxc_priv { | 33 | struct ehci_mxc_priv { |
@@ -114,6 +117,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
114 | struct usb_hcd *hcd; | 117 | struct usb_hcd *hcd; |
115 | struct resource *res; | 118 | struct resource *res; |
116 | int irq, ret; | 119 | int irq, ret; |
120 | unsigned int flags; | ||
117 | struct ehci_mxc_priv *priv; | 121 | struct ehci_mxc_priv *priv; |
118 | struct device *dev = &pdev->dev; | 122 | struct device *dev = &pdev->dev; |
119 | struct ehci_hcd *ehci; | 123 | struct ehci_hcd *ehci; |
@@ -177,8 +181,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
177 | clk_enable(priv->ahbclk); | 181 | clk_enable(priv->ahbclk); |
178 | } | 182 | } |
179 | 183 | ||
180 | /* "dr" device has its own clock */ | 184 | /* "dr" device has its own clock on i.MX51 */ |
181 | if (pdev->id == 0) { | 185 | if (cpu_is_mx51() && (pdev->id == 0)) { |
182 | priv->phy1clk = clk_get(dev, "usb_phy1"); | 186 | priv->phy1clk = clk_get(dev, "usb_phy1"); |
183 | if (IS_ERR(priv->phy1clk)) { | 187 | if (IS_ERR(priv->phy1clk)) { |
184 | ret = PTR_ERR(priv->phy1clk); | 188 | ret = PTR_ERR(priv->phy1clk); |
@@ -240,6 +244,23 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
240 | if (ret) | 244 | if (ret) |
241 | goto err_add; | 245 | goto err_add; |
242 | 246 | ||
247 | if (pdata->otg) { | ||
248 | /* | ||
249 | * efikamx and efikasb have some hardware bug which is | ||
250 | * preventing usb to work unless CHRGVBUS is set. | ||
251 | * It's in violation of USB specs | ||
252 | */ | ||
253 | if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) { | ||
254 | flags = otg_io_read(pdata->otg, ULPI_OTG_CTRL); | ||
255 | flags |= ULPI_OTG_CTRL_CHRGVBUS; | ||
256 | ret = otg_io_write(pdata->otg, flags, ULPI_OTG_CTRL); | ||
257 | if (ret) { | ||
258 | dev_err(dev, "unable to set CHRVBUS\n"); | ||
259 | goto err_add; | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | |||
243 | return 0; | 264 | return 0; |
244 | 265 | ||
245 | err_add: | 266 | err_add: |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 76179c39c0e3..bed07d4aab06 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -44,28 +44,35 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | static int ehci_quirk_amd_SB800(struct ehci_hcd *ehci) | 47 | static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci) |
48 | { | 48 | { |
49 | struct pci_dev *amd_smbus_dev; | 49 | struct pci_dev *amd_smbus_dev; |
50 | u8 rev = 0; | 50 | u8 rev = 0; |
51 | 51 | ||
52 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); | 52 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); |
53 | if (!amd_smbus_dev) | 53 | if (amd_smbus_dev) { |
54 | return 0; | 54 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
55 | 55 | if (rev < 0x40) { | |
56 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | 56 | pci_dev_put(amd_smbus_dev); |
57 | if (rev < 0x40) { | 57 | amd_smbus_dev = NULL; |
58 | pci_dev_put(amd_smbus_dev); | 58 | return 0; |
59 | amd_smbus_dev = NULL; | 59 | } |
60 | return 0; | 60 | } else { |
61 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL); | ||
62 | if (!amd_smbus_dev) | ||
63 | return 0; | ||
64 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | ||
65 | if (rev < 0x11 || rev > 0x18) { | ||
66 | pci_dev_put(amd_smbus_dev); | ||
67 | amd_smbus_dev = NULL; | ||
68 | return 0; | ||
69 | } | ||
61 | } | 70 | } |
62 | 71 | ||
63 | if (!amd_nb_dev) | 72 | if (!amd_nb_dev) |
64 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); | 73 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); |
65 | if (!amd_nb_dev) | ||
66 | ehci_err(ehci, "QUIRK: unable to get AMD NB device\n"); | ||
67 | 74 | ||
68 | ehci_info(ehci, "QUIRK: Enable AMD SB800 L1 fix\n"); | 75 | ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n"); |
69 | 76 | ||
70 | pci_dev_put(amd_smbus_dev); | 77 | pci_dev_put(amd_smbus_dev); |
71 | amd_smbus_dev = NULL; | 78 | amd_smbus_dev = NULL; |
@@ -131,7 +138,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
131 | /* cache this readonly data; minimize chip reads */ | 138 | /* cache this readonly data; minimize chip reads */ |
132 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 139 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
133 | 140 | ||
134 | if (ehci_quirk_amd_SB800(ehci)) | 141 | if (ehci_quirk_amd_hudson(ehci)) |
135 | ehci->amd_l1_fix = 1; | 142 | ehci->amd_l1_fix = 1; |
136 | 143 | ||
137 | retval = ehci_halt(ehci); | 144 | retval = ehci_halt(ehci); |
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 574b99ea0700..79a66d622f9c 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c | |||
@@ -262,19 +262,24 @@ static void fsl_usb2_mpc5121_exit(struct platform_device *pdev) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { | 265 | static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { |
266 | .big_endian_desc = 1, | 266 | .big_endian_desc = 1, |
267 | .big_endian_mmio = 1, | 267 | .big_endian_mmio = 1, |
268 | .es = 1, | 268 | .es = 1, |
269 | .have_sysif_regs = 0, | ||
269 | .le_setup_buf = 1, | 270 | .le_setup_buf = 1, |
270 | .init = fsl_usb2_mpc5121_init, | 271 | .init = fsl_usb2_mpc5121_init, |
271 | .exit = fsl_usb2_mpc5121_exit, | 272 | .exit = fsl_usb2_mpc5121_exit, |
272 | }; | 273 | }; |
273 | #endif /* CONFIG_PPC_MPC512x */ | 274 | #endif /* CONFIG_PPC_MPC512x */ |
274 | 275 | ||
276 | static struct fsl_usb2_platform_data fsl_usb2_mpc8xxx_pd = { | ||
277 | .have_sysif_regs = 1, | ||
278 | }; | ||
279 | |||
275 | static const struct of_device_id fsl_usb2_mph_dr_of_match[] = { | 280 | static const struct of_device_id fsl_usb2_mph_dr_of_match[] = { |
276 | { .compatible = "fsl-usb2-mph", }, | 281 | { .compatible = "fsl-usb2-mph", .data = &fsl_usb2_mpc8xxx_pd, }, |
277 | { .compatible = "fsl-usb2-dr", }, | 282 | { .compatible = "fsl-usb2-dr", .data = &fsl_usb2_mpc8xxx_pd, }, |
278 | #ifdef CONFIG_PPC_MPC512x | 283 | #ifdef CONFIG_PPC_MPC512x |
279 | { .compatible = "fsl,mpc5121-usb2-dr", .data = &fsl_usb2_mpc5121_pd, }, | 284 | { .compatible = "fsl,mpc5121-usb2-dr", .data = &fsl_usb2_mpc5121_pd, }, |
280 | #endif | 285 | #endif |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index df558f6f84e3..3e8211c1ce5a 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -308,11 +308,8 @@ static int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
308 | /* Ring the host controller doorbell after placing a command on the ring */ | 308 | /* Ring the host controller doorbell after placing a command on the ring */ |
309 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) | 309 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) |
310 | { | 310 | { |
311 | u32 temp; | ||
312 | |||
313 | xhci_dbg(xhci, "// Ding dong!\n"); | 311 | xhci_dbg(xhci, "// Ding dong!\n"); |
314 | temp = xhci_readl(xhci, &xhci->dba->doorbell[0]) & DB_MASK; | 312 | xhci_writel(xhci, DB_VALUE_HOST, &xhci->dba->doorbell[0]); |
315 | xhci_writel(xhci, temp | DB_TARGET_HOST, &xhci->dba->doorbell[0]); | ||
316 | /* Flush PCI posted writes */ | 313 | /* Flush PCI posted writes */ |
317 | xhci_readl(xhci, &xhci->dba->doorbell[0]); | 314 | xhci_readl(xhci, &xhci->dba->doorbell[0]); |
318 | } | 315 | } |
@@ -322,26 +319,24 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, | |||
322 | unsigned int ep_index, | 319 | unsigned int ep_index, |
323 | unsigned int stream_id) | 320 | unsigned int stream_id) |
324 | { | 321 | { |
325 | struct xhci_virt_ep *ep; | ||
326 | unsigned int ep_state; | ||
327 | u32 field; | ||
328 | __u32 __iomem *db_addr = &xhci->dba->doorbell[slot_id]; | 322 | __u32 __iomem *db_addr = &xhci->dba->doorbell[slot_id]; |
323 | struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; | ||
324 | unsigned int ep_state = ep->ep_state; | ||
329 | 325 | ||
330 | ep = &xhci->devs[slot_id]->eps[ep_index]; | ||
331 | ep_state = ep->ep_state; | ||
332 | /* Don't ring the doorbell for this endpoint if there are pending | 326 | /* Don't ring the doorbell for this endpoint if there are pending |
333 | * cancellations because the we don't want to interrupt processing. | 327 | * cancellations because we don't want to interrupt processing. |
334 | * We don't want to restart any stream rings if there's a set dequeue | 328 | * We don't want to restart any stream rings if there's a set dequeue |
335 | * pointer command pending because the device can choose to start any | 329 | * pointer command pending because the device can choose to start any |
336 | * stream once the endpoint is on the HW schedule. | 330 | * stream once the endpoint is on the HW schedule. |
337 | * FIXME - check all the stream rings for pending cancellations. | 331 | * FIXME - check all the stream rings for pending cancellations. |
338 | */ | 332 | */ |
339 | if (!(ep_state & EP_HALT_PENDING) && !(ep_state & SET_DEQ_PENDING) | 333 | if ((ep_state & EP_HALT_PENDING) || (ep_state & SET_DEQ_PENDING) || |
340 | && !(ep_state & EP_HALTED)) { | 334 | (ep_state & EP_HALTED)) |
341 | field = xhci_readl(xhci, db_addr) & DB_MASK; | 335 | return; |
342 | field |= EPI_TO_DB(ep_index) | STREAM_ID_TO_DB(stream_id); | 336 | xhci_writel(xhci, DB_VALUE(ep_index, stream_id), db_addr); |
343 | xhci_writel(xhci, field, db_addr); | 337 | /* The CPU has better things to do at this point than wait for a |
344 | } | 338 | * write-posting flush. It'll get there soon enough. |
339 | */ | ||
345 | } | 340 | } |
346 | 341 | ||
347 | /* Ring the doorbell for any rings with pending URBs */ | 342 | /* Ring the doorbell for any rings with pending URBs */ |
@@ -1188,7 +1183,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1188 | 1183 | ||
1189 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); | 1184 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); |
1190 | temp = xhci_readl(xhci, addr); | 1185 | temp = xhci_readl(xhci, addr); |
1191 | if ((temp & PORT_CONNECT) && (hcd->state == HC_STATE_SUSPENDED)) { | 1186 | if (hcd->state == HC_STATE_SUSPENDED) { |
1192 | xhci_dbg(xhci, "resume root hub\n"); | 1187 | xhci_dbg(xhci, "resume root hub\n"); |
1193 | usb_hcd_resume_root_hub(hcd); | 1188 | usb_hcd_resume_root_hub(hcd); |
1194 | } | 1189 | } |
@@ -1710,8 +1705,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1710 | /* Others already handled above */ | 1705 | /* Others already handled above */ |
1711 | break; | 1706 | break; |
1712 | } | 1707 | } |
1713 | dev_dbg(&td->urb->dev->dev, | 1708 | xhci_dbg(xhci, "ep %#x - asked for %d bytes, " |
1714 | "ep %#x - asked for %d bytes, " | ||
1715 | "%d bytes untransferred\n", | 1709 | "%d bytes untransferred\n", |
1716 | td->urb->ep->desc.bEndpointAddress, | 1710 | td->urb->ep->desc.bEndpointAddress, |
1717 | td->urb->transfer_buffer_length, | 1711 | td->urb->transfer_buffer_length, |
@@ -2389,7 +2383,8 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2389 | } | 2383 | } |
2390 | xhci_dbg(xhci, "\n"); | 2384 | xhci_dbg(xhci, "\n"); |
2391 | if (!in_interrupt()) | 2385 | if (!in_interrupt()) |
2392 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %d, sglist used, num_trbs = %d\n", | 2386 | xhci_dbg(xhci, "ep %#x - urb len = %d, sglist used, " |
2387 | "num_trbs = %d\n", | ||
2393 | urb->ep->desc.bEndpointAddress, | 2388 | urb->ep->desc.bEndpointAddress, |
2394 | urb->transfer_buffer_length, | 2389 | urb->transfer_buffer_length, |
2395 | num_trbs); | 2390 | num_trbs); |
@@ -2414,14 +2409,17 @@ static void check_trb_math(struct urb *urb, int num_trbs, int running_total) | |||
2414 | 2409 | ||
2415 | static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id, | 2410 | static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id, |
2416 | unsigned int ep_index, unsigned int stream_id, int start_cycle, | 2411 | unsigned int ep_index, unsigned int stream_id, int start_cycle, |
2417 | struct xhci_generic_trb *start_trb, struct xhci_td *td) | 2412 | struct xhci_generic_trb *start_trb) |
2418 | { | 2413 | { |
2419 | /* | 2414 | /* |
2420 | * Pass all the TRBs to the hardware at once and make sure this write | 2415 | * Pass all the TRBs to the hardware at once and make sure this write |
2421 | * isn't reordered. | 2416 | * isn't reordered. |
2422 | */ | 2417 | */ |
2423 | wmb(); | 2418 | wmb(); |
2424 | start_trb->field[3] |= start_cycle; | 2419 | if (start_cycle) |
2420 | start_trb->field[3] |= start_cycle; | ||
2421 | else | ||
2422 | start_trb->field[3] &= ~0x1; | ||
2425 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); | 2423 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); |
2426 | } | 2424 | } |
2427 | 2425 | ||
@@ -2449,7 +2447,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2449 | * to set the polling interval (once the API is added). | 2447 | * to set the polling interval (once the API is added). |
2450 | */ | 2448 | */ |
2451 | if (xhci_interval != ep_interval) { | 2449 | if (xhci_interval != ep_interval) { |
2452 | if (!printk_ratelimit()) | 2450 | if (printk_ratelimit()) |
2453 | dev_dbg(&urb->dev->dev, "Driver uses different interval" | 2451 | dev_dbg(&urb->dev->dev, "Driver uses different interval" |
2454 | " (%d microframe%s) than xHCI " | 2452 | " (%d microframe%s) than xHCI " |
2455 | "(%d microframe%s)\n", | 2453 | "(%d microframe%s)\n", |
@@ -2551,9 +2549,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2551 | u32 remainder = 0; | 2549 | u32 remainder = 0; |
2552 | 2550 | ||
2553 | /* Don't change the cycle bit of the first TRB until later */ | 2551 | /* Don't change the cycle bit of the first TRB until later */ |
2554 | if (first_trb) | 2552 | if (first_trb) { |
2555 | first_trb = false; | 2553 | first_trb = false; |
2556 | else | 2554 | if (start_cycle == 0) |
2555 | field |= 0x1; | ||
2556 | } else | ||
2557 | field |= ep_ring->cycle_state; | 2557 | field |= ep_ring->cycle_state; |
2558 | 2558 | ||
2559 | /* Chain all the TRBs together; clear the chain bit in the last | 2559 | /* Chain all the TRBs together; clear the chain bit in the last |
@@ -2625,7 +2625,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2625 | 2625 | ||
2626 | check_trb_math(urb, num_trbs, running_total); | 2626 | check_trb_math(urb, num_trbs, running_total); |
2627 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 2627 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
2628 | start_cycle, start_trb, td); | 2628 | start_cycle, start_trb); |
2629 | return 0; | 2629 | return 0; |
2630 | } | 2630 | } |
2631 | 2631 | ||
@@ -2671,7 +2671,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2671 | /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ | 2671 | /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ |
2672 | 2672 | ||
2673 | if (!in_interrupt()) | 2673 | if (!in_interrupt()) |
2674 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %#x (%d), addr = %#llx, num_trbs = %d\n", | 2674 | xhci_dbg(xhci, "ep %#x - urb len = %#x (%d), " |
2675 | "addr = %#llx, num_trbs = %d\n", | ||
2675 | urb->ep->desc.bEndpointAddress, | 2676 | urb->ep->desc.bEndpointAddress, |
2676 | urb->transfer_buffer_length, | 2677 | urb->transfer_buffer_length, |
2677 | urb->transfer_buffer_length, | 2678 | urb->transfer_buffer_length, |
@@ -2711,9 +2712,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2711 | field = 0; | 2712 | field = 0; |
2712 | 2713 | ||
2713 | /* Don't change the cycle bit of the first TRB until later */ | 2714 | /* Don't change the cycle bit of the first TRB until later */ |
2714 | if (first_trb) | 2715 | if (first_trb) { |
2715 | first_trb = false; | 2716 | first_trb = false; |
2716 | else | 2717 | if (start_cycle == 0) |
2718 | field |= 0x1; | ||
2719 | } else | ||
2717 | field |= ep_ring->cycle_state; | 2720 | field |= ep_ring->cycle_state; |
2718 | 2721 | ||
2719 | /* Chain all the TRBs together; clear the chain bit in the last | 2722 | /* Chain all the TRBs together; clear the chain bit in the last |
@@ -2757,7 +2760,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2757 | 2760 | ||
2758 | check_trb_math(urb, num_trbs, running_total); | 2761 | check_trb_math(urb, num_trbs, running_total); |
2759 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 2762 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
2760 | start_cycle, start_trb, td); | 2763 | start_cycle, start_trb); |
2761 | return 0; | 2764 | return 0; |
2762 | } | 2765 | } |
2763 | 2766 | ||
@@ -2818,13 +2821,17 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2818 | /* Queue setup TRB - see section 6.4.1.2.1 */ | 2821 | /* Queue setup TRB - see section 6.4.1.2.1 */ |
2819 | /* FIXME better way to translate setup_packet into two u32 fields? */ | 2822 | /* FIXME better way to translate setup_packet into two u32 fields? */ |
2820 | setup = (struct usb_ctrlrequest *) urb->setup_packet; | 2823 | setup = (struct usb_ctrlrequest *) urb->setup_packet; |
2824 | field = 0; | ||
2825 | field |= TRB_IDT | TRB_TYPE(TRB_SETUP); | ||
2826 | if (start_cycle == 0) | ||
2827 | field |= 0x1; | ||
2821 | queue_trb(xhci, ep_ring, false, true, | 2828 | queue_trb(xhci, ep_ring, false, true, |
2822 | /* FIXME endianness is probably going to bite my ass here. */ | 2829 | /* FIXME endianness is probably going to bite my ass here. */ |
2823 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, | 2830 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, |
2824 | setup->wIndex | setup->wLength << 16, | 2831 | setup->wIndex | setup->wLength << 16, |
2825 | TRB_LEN(8) | TRB_INTR_TARGET(0), | 2832 | TRB_LEN(8) | TRB_INTR_TARGET(0), |
2826 | /* Immediate data in pointer */ | 2833 | /* Immediate data in pointer */ |
2827 | TRB_IDT | TRB_TYPE(TRB_SETUP)); | 2834 | field); |
2828 | 2835 | ||
2829 | /* If there's data, queue data TRBs */ | 2836 | /* If there's data, queue data TRBs */ |
2830 | field = 0; | 2837 | field = 0; |
@@ -2859,7 +2866,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2859 | field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); | 2866 | field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); |
2860 | 2867 | ||
2861 | giveback_first_trb(xhci, slot_id, ep_index, 0, | 2868 | giveback_first_trb(xhci, slot_id, ep_index, 0, |
2862 | start_cycle, start_trb, td); | 2869 | start_cycle, start_trb); |
2863 | return 0; | 2870 | return 0; |
2864 | } | 2871 | } |
2865 | 2872 | ||
@@ -2900,6 +2907,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2900 | int running_total, trb_buff_len, td_len, td_remain_len, ret; | 2907 | int running_total, trb_buff_len, td_len, td_remain_len, ret; |
2901 | u64 start_addr, addr; | 2908 | u64 start_addr, addr; |
2902 | int i, j; | 2909 | int i, j; |
2910 | bool more_trbs_coming; | ||
2903 | 2911 | ||
2904 | ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; | 2912 | ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; |
2905 | 2913 | ||
@@ -2910,7 +2918,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2910 | } | 2918 | } |
2911 | 2919 | ||
2912 | if (!in_interrupt()) | 2920 | if (!in_interrupt()) |
2913 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %#x (%d)," | 2921 | xhci_dbg(xhci, "ep %#x - urb len = %#x (%d)," |
2914 | " addr = %#llx, num_tds = %d\n", | 2922 | " addr = %#llx, num_tds = %d\n", |
2915 | urb->ep->desc.bEndpointAddress, | 2923 | urb->ep->desc.bEndpointAddress, |
2916 | urb->transfer_buffer_length, | 2924 | urb->transfer_buffer_length, |
@@ -2950,7 +2958,10 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2950 | field |= TRB_TYPE(TRB_ISOC); | 2958 | field |= TRB_TYPE(TRB_ISOC); |
2951 | /* Assume URB_ISO_ASAP is set */ | 2959 | /* Assume URB_ISO_ASAP is set */ |
2952 | field |= TRB_SIA; | 2960 | field |= TRB_SIA; |
2953 | if (i > 0) | 2961 | if (i == 0) { |
2962 | if (start_cycle == 0) | ||
2963 | field |= 0x1; | ||
2964 | } else | ||
2954 | field |= ep_ring->cycle_state; | 2965 | field |= ep_ring->cycle_state; |
2955 | first_trb = false; | 2966 | first_trb = false; |
2956 | } else { | 2967 | } else { |
@@ -2965,9 +2976,11 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2965 | */ | 2976 | */ |
2966 | if (j < trbs_per_td - 1) { | 2977 | if (j < trbs_per_td - 1) { |
2967 | field |= TRB_CHAIN; | 2978 | field |= TRB_CHAIN; |
2979 | more_trbs_coming = true; | ||
2968 | } else { | 2980 | } else { |
2969 | td->last_trb = ep_ring->enqueue; | 2981 | td->last_trb = ep_ring->enqueue; |
2970 | field |= TRB_IOC; | 2982 | field |= TRB_IOC; |
2983 | more_trbs_coming = false; | ||
2971 | } | 2984 | } |
2972 | 2985 | ||
2973 | /* Calculate TRB length */ | 2986 | /* Calculate TRB length */ |
@@ -2980,7 +2993,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2980 | length_field = TRB_LEN(trb_buff_len) | | 2993 | length_field = TRB_LEN(trb_buff_len) | |
2981 | remainder | | 2994 | remainder | |
2982 | TRB_INTR_TARGET(0); | 2995 | TRB_INTR_TARGET(0); |
2983 | queue_trb(xhci, ep_ring, false, false, | 2996 | queue_trb(xhci, ep_ring, false, more_trbs_coming, |
2984 | lower_32_bits(addr), | 2997 | lower_32_bits(addr), |
2985 | upper_32_bits(addr), | 2998 | upper_32_bits(addr), |
2986 | length_field, | 2999 | length_field, |
@@ -3003,10 +3016,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3003 | } | 3016 | } |
3004 | } | 3017 | } |
3005 | 3018 | ||
3006 | wmb(); | 3019 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
3007 | start_trb->field[3] |= start_cycle; | 3020 | start_cycle, start_trb); |
3008 | |||
3009 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, urb->stream_id); | ||
3010 | return 0; | 3021 | return 0; |
3011 | } | 3022 | } |
3012 | 3023 | ||
@@ -3064,7 +3075,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3064 | * to set the polling interval (once the API is added). | 3075 | * to set the polling interval (once the API is added). |
3065 | */ | 3076 | */ |
3066 | if (xhci_interval != ep_interval) { | 3077 | if (xhci_interval != ep_interval) { |
3067 | if (!printk_ratelimit()) | 3078 | if (printk_ratelimit()) |
3068 | dev_dbg(&urb->dev->dev, "Driver uses different interval" | 3079 | dev_dbg(&urb->dev->dev, "Driver uses different interval" |
3069 | " (%d microframe%s) than xHCI " | 3080 | " (%d microframe%s) than xHCI " |
3070 | "(%d microframe%s)\n", | 3081 | "(%d microframe%s)\n", |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 45e4a3108cc3..34cf4e165877 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -226,7 +226,8 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) | |||
226 | static int xhci_setup_msix(struct xhci_hcd *xhci) | 226 | static int xhci_setup_msix(struct xhci_hcd *xhci) |
227 | { | 227 | { |
228 | int i, ret = 0; | 228 | int i, ret = 0; |
229 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 229 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
230 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
230 | 231 | ||
231 | /* | 232 | /* |
232 | * calculate number of msi-x vectors supported. | 233 | * calculate number of msi-x vectors supported. |
@@ -265,6 +266,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) | |||
265 | goto disable_msix; | 266 | goto disable_msix; |
266 | } | 267 | } |
267 | 268 | ||
269 | hcd->msix_enabled = 1; | ||
268 | return ret; | 270 | return ret; |
269 | 271 | ||
270 | disable_msix: | 272 | disable_msix: |
@@ -280,7 +282,8 @@ free_entries: | |||
280 | /* Free any IRQs and disable MSI-X */ | 282 | /* Free any IRQs and disable MSI-X */ |
281 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) | 283 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) |
282 | { | 284 | { |
283 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 285 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
286 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
284 | 287 | ||
285 | xhci_free_irq(xhci); | 288 | xhci_free_irq(xhci); |
286 | 289 | ||
@@ -292,6 +295,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) | |||
292 | pci_disable_msi(pdev); | 295 | pci_disable_msi(pdev); |
293 | } | 296 | } |
294 | 297 | ||
298 | hcd->msix_enabled = 0; | ||
295 | return; | 299 | return; |
296 | } | 300 | } |
297 | 301 | ||
@@ -508,9 +512,10 @@ void xhci_stop(struct usb_hcd *hcd) | |||
508 | spin_lock_irq(&xhci->lock); | 512 | spin_lock_irq(&xhci->lock); |
509 | xhci_halt(xhci); | 513 | xhci_halt(xhci); |
510 | xhci_reset(xhci); | 514 | xhci_reset(xhci); |
511 | xhci_cleanup_msix(xhci); | ||
512 | spin_unlock_irq(&xhci->lock); | 515 | spin_unlock_irq(&xhci->lock); |
513 | 516 | ||
517 | xhci_cleanup_msix(xhci); | ||
518 | |||
514 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 519 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
515 | /* Tell the event ring poll function not to reschedule */ | 520 | /* Tell the event ring poll function not to reschedule */ |
516 | xhci->zombie = 1; | 521 | xhci->zombie = 1; |
@@ -544,9 +549,10 @@ void xhci_shutdown(struct usb_hcd *hcd) | |||
544 | 549 | ||
545 | spin_lock_irq(&xhci->lock); | 550 | spin_lock_irq(&xhci->lock); |
546 | xhci_halt(xhci); | 551 | xhci_halt(xhci); |
547 | xhci_cleanup_msix(xhci); | ||
548 | spin_unlock_irq(&xhci->lock); | 552 | spin_unlock_irq(&xhci->lock); |
549 | 553 | ||
554 | xhci_cleanup_msix(xhci); | ||
555 | |||
550 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", | 556 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", |
551 | xhci_readl(xhci, &xhci->op_regs->status)); | 557 | xhci_readl(xhci, &xhci->op_regs->status)); |
552 | } | 558 | } |
@@ -647,6 +653,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
647 | int rc = 0; | 653 | int rc = 0; |
648 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 654 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
649 | u32 command; | 655 | u32 command; |
656 | int i; | ||
650 | 657 | ||
651 | spin_lock_irq(&xhci->lock); | 658 | spin_lock_irq(&xhci->lock); |
652 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 659 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
@@ -677,10 +684,15 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
677 | spin_unlock_irq(&xhci->lock); | 684 | spin_unlock_irq(&xhci->lock); |
678 | return -ETIMEDOUT; | 685 | return -ETIMEDOUT; |
679 | } | 686 | } |
680 | /* step 5: remove core well power */ | ||
681 | xhci_cleanup_msix(xhci); | ||
682 | spin_unlock_irq(&xhci->lock); | 687 | spin_unlock_irq(&xhci->lock); |
683 | 688 | ||
689 | /* step 5: remove core well power */ | ||
690 | /* synchronize irq when using MSI-X */ | ||
691 | if (xhci->msix_entries) { | ||
692 | for (i = 0; i < xhci->msix_count; i++) | ||
693 | synchronize_irq(xhci->msix_entries[i].vector); | ||
694 | } | ||
695 | |||
684 | return rc; | 696 | return rc; |
685 | } | 697 | } |
686 | 698 | ||
@@ -694,7 +706,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
694 | { | 706 | { |
695 | u32 command, temp = 0; | 707 | u32 command, temp = 0; |
696 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 708 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
697 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
698 | int old_state, retval; | 709 | int old_state, retval; |
699 | 710 | ||
700 | old_state = hcd->state; | 711 | old_state = hcd->state; |
@@ -729,9 +740,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
729 | xhci_dbg(xhci, "Stop HCD\n"); | 740 | xhci_dbg(xhci, "Stop HCD\n"); |
730 | xhci_halt(xhci); | 741 | xhci_halt(xhci); |
731 | xhci_reset(xhci); | 742 | xhci_reset(xhci); |
732 | if (hibernated) | ||
733 | xhci_cleanup_msix(xhci); | ||
734 | spin_unlock_irq(&xhci->lock); | 743 | spin_unlock_irq(&xhci->lock); |
744 | xhci_cleanup_msix(xhci); | ||
735 | 745 | ||
736 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 746 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
737 | /* Tell the event ring poll function not to reschedule */ | 747 | /* Tell the event ring poll function not to reschedule */ |
@@ -765,30 +775,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
765 | return retval; | 775 | return retval; |
766 | } | 776 | } |
767 | 777 | ||
768 | spin_unlock_irq(&xhci->lock); | ||
769 | /* Re-setup MSI-X */ | ||
770 | if (hcd->irq) | ||
771 | free_irq(hcd->irq, hcd); | ||
772 | hcd->irq = -1; | ||
773 | |||
774 | retval = xhci_setup_msix(xhci); | ||
775 | if (retval) | ||
776 | /* fall back to msi*/ | ||
777 | retval = xhci_setup_msi(xhci); | ||
778 | |||
779 | if (retval) { | ||
780 | /* fall back to legacy interrupt*/ | ||
781 | retval = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | ||
782 | hcd->irq_descr, hcd); | ||
783 | if (retval) { | ||
784 | xhci_err(xhci, "request interrupt %d failed\n", | ||
785 | pdev->irq); | ||
786 | return retval; | ||
787 | } | ||
788 | hcd->irq = pdev->irq; | ||
789 | } | ||
790 | |||
791 | spin_lock_irq(&xhci->lock); | ||
792 | /* step 4: set Run/Stop bit */ | 778 | /* step 4: set Run/Stop bit */ |
793 | command = xhci_readl(xhci, &xhci->op_regs->command); | 779 | command = xhci_readl(xhci, &xhci->op_regs->command); |
794 | command |= CMD_RUN; | 780 | command |= CMD_RUN; |
@@ -2445,8 +2431,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2445 | xhci_err(xhci, "Error while assigning device slot ID\n"); | 2431 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
2446 | return 0; | 2432 | return 0; |
2447 | } | 2433 | } |
2448 | /* xhci_alloc_virt_device() does not touch rings; no need to lock */ | 2434 | /* xhci_alloc_virt_device() does not touch rings; no need to lock. |
2449 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { | 2435 | * Use GFP_NOIO, since this function can be called from |
2436 | * xhci_discover_or_reset_device(), which may be called as part of | ||
2437 | * mass storage driver error handling. | ||
2438 | */ | ||
2439 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { | ||
2450 | /* Disable slot, if we can do it without mem alloc */ | 2440 | /* Disable slot, if we can do it without mem alloc */ |
2451 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); | 2441 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
2452 | spin_lock_irqsave(&xhci->lock, flags); | 2442 | spin_lock_irqsave(&xhci->lock, flags); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 170c367112d2..7f236fd22015 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -436,22 +436,18 @@ struct xhci_run_regs { | |||
436 | /** | 436 | /** |
437 | * struct doorbell_array | 437 | * struct doorbell_array |
438 | * | 438 | * |
439 | * Bits 0 - 7: Endpoint target | ||
440 | * Bits 8 - 15: RsvdZ | ||
441 | * Bits 16 - 31: Stream ID | ||
442 | * | ||
439 | * Section 5.6 | 443 | * Section 5.6 |
440 | */ | 444 | */ |
441 | struct xhci_doorbell_array { | 445 | struct xhci_doorbell_array { |
442 | u32 doorbell[256]; | 446 | u32 doorbell[256]; |
443 | }; | 447 | }; |
444 | 448 | ||
445 | #define DB_TARGET_MASK 0xFFFFFF00 | 449 | #define DB_VALUE(ep, stream) ((((ep) + 1) & 0xff) | ((stream) << 16)) |
446 | #define DB_STREAM_ID_MASK 0x0000FFFF | 450 | #define DB_VALUE_HOST 0x00000000 |
447 | #define DB_TARGET_HOST 0x0 | ||
448 | #define DB_STREAM_ID_HOST 0x0 | ||
449 | #define DB_MASK (0xff << 8) | ||
450 | |||
451 | /* Endpoint Target - bits 0:7 */ | ||
452 | #define EPI_TO_DB(p) (((p) + 1) & 0xff) | ||
453 | #define STREAM_ID_TO_DB(p) (((p) & 0xffff) << 16) | ||
454 | |||
455 | 451 | ||
456 | /** | 452 | /** |
457 | * struct xhci_protocol_caps | 453 | * struct xhci_protocol_caps |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 1732d9bc097e..1616ad1793a4 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -45,7 +45,7 @@ struct usb_led { | |||
45 | 45 | ||
46 | static void change_color(struct usb_led *led) | 46 | static void change_color(struct usb_led *led) |
47 | { | 47 | { |
48 | int retval; | 48 | int retval = 0; |
49 | unsigned char *buffer; | 49 | unsigned char *buffer; |
50 | 50 | ||
51 | buffer = kmalloc(8, GFP_KERNEL); | 51 | buffer = kmalloc(8, GFP_KERNEL); |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 4ff21587ab03..f7a205738032 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -776,7 +776,6 @@ static const struct usb_device_id uss720_table[] = { | |||
776 | { USB_DEVICE(0x0557, 0x2001) }, | 776 | { USB_DEVICE(0x0557, 0x2001) }, |
777 | { USB_DEVICE(0x0729, 0x1284) }, | 777 | { USB_DEVICE(0x0729, 0x1284) }, |
778 | { USB_DEVICE(0x1293, 0x0002) }, | 778 | { USB_DEVICE(0x1293, 0x0002) }, |
779 | { USB_DEVICE(0x1293, 0x0002) }, | ||
780 | { USB_DEVICE(0x050d, 0x0002) }, | 779 | { USB_DEVICE(0x050d, 0x0002) }, |
781 | { } /* Terminating entry */ | 780 | { } /* Terminating entry */ |
782 | }; | 781 | }; |
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index e70014ab0976..8acf165fe13b 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -132,6 +132,8 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
132 | 132 | ||
133 | platform_set_drvdata(pdev, nop); | 133 | platform_set_drvdata(pdev, nop); |
134 | 134 | ||
135 | BLOCKING_INIT_NOTIFIER_HEAD(&nop->otg.notifier); | ||
136 | |||
135 | return 0; | 137 | return 0; |
136 | exit: | 138 | exit: |
137 | kfree(nop); | 139 | kfree(nop); |
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c index 059d9ac0ab5b..770d799d5afb 100644 --- a/drivers/usb/otg/ulpi.c +++ b/drivers/usb/otg/ulpi.c | |||
@@ -45,7 +45,7 @@ struct ulpi_info { | |||
45 | /* ULPI hardcoded IDs, used for probing */ | 45 | /* ULPI hardcoded IDs, used for probing */ |
46 | static struct ulpi_info ulpi_ids[] = { | 46 | static struct ulpi_info ulpi_ids[] = { |
47 | ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"), | 47 | ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"), |
48 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB3319"), | 48 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"), |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) | 51 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 63f7cc45bcac..7b8815ddf368 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -486,12 +486,22 @@ static void ch341_read_int_callback(struct urb *urb) | |||
486 | if (actual_length >= 4) { | 486 | if (actual_length >= 4) { |
487 | struct ch341_private *priv = usb_get_serial_port_data(port); | 487 | struct ch341_private *priv = usb_get_serial_port_data(port); |
488 | unsigned long flags; | 488 | unsigned long flags; |
489 | u8 prev_line_status = priv->line_status; | ||
489 | 490 | ||
490 | spin_lock_irqsave(&priv->lock, flags); | 491 | spin_lock_irqsave(&priv->lock, flags); |
491 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; | 492 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; |
492 | if ((data[1] & CH341_MULT_STAT)) | 493 | if ((data[1] & CH341_MULT_STAT)) |
493 | priv->multi_status_change = 1; | 494 | priv->multi_status_change = 1; |
494 | spin_unlock_irqrestore(&priv->lock, flags); | 495 | spin_unlock_irqrestore(&priv->lock, flags); |
496 | |||
497 | if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) { | ||
498 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
499 | if (tty) | ||
500 | usb_serial_handle_dcd_change(port, tty, | ||
501 | priv->line_status & CH341_BIT_DCD); | ||
502 | tty_kref_put(tty); | ||
503 | } | ||
504 | |||
495 | wake_up_interruptible(&priv->delta_msr_wait); | 505 | wake_up_interruptible(&priv->delta_msr_wait); |
496 | } | 506 | } |
497 | 507 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 8d7731dbf478..735ea03157ab 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -49,7 +49,6 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, | |||
49 | static void cp210x_break_ctl(struct tty_struct *, int); | 49 | static void cp210x_break_ctl(struct tty_struct *, int); |
50 | static int cp210x_startup(struct usb_serial *); | 50 | static int cp210x_startup(struct usb_serial *); |
51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); | 51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); |
52 | static int cp210x_carrier_raised(struct usb_serial_port *p); | ||
53 | 52 | ||
54 | static int debug; | 53 | static int debug; |
55 | 54 | ||
@@ -87,7 +86,6 @@ static const struct usb_device_id id_table[] = { | |||
87 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ | 86 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ |
88 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 87 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
89 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ | 88 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
90 | { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ | ||
91 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 89 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
92 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 90 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
93 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 91 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
@@ -110,7 +108,9 @@ static const struct usb_device_id id_table[] = { | |||
110 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ | 108 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
111 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ | 109 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
112 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ | 110 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ |
111 | { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ | ||
113 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ | 112 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
113 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ | ||
114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ | 114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ | 115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
@@ -165,8 +165,7 @@ static struct usb_serial_driver cp210x_device = { | |||
165 | .tiocmget = cp210x_tiocmget, | 165 | .tiocmget = cp210x_tiocmget, |
166 | .tiocmset = cp210x_tiocmset, | 166 | .tiocmset = cp210x_tiocmset, |
167 | .attach = cp210x_startup, | 167 | .attach = cp210x_startup, |
168 | .dtr_rts = cp210x_dtr_rts, | 168 | .dtr_rts = cp210x_dtr_rts |
169 | .carrier_raised = cp210x_carrier_raised | ||
170 | }; | 169 | }; |
171 | 170 | ||
172 | /* Config request types */ | 171 | /* Config request types */ |
@@ -765,15 +764,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | |||
765 | return result; | 764 | return result; |
766 | } | 765 | } |
767 | 766 | ||
768 | static int cp210x_carrier_raised(struct usb_serial_port *p) | ||
769 | { | ||
770 | unsigned int control; | ||
771 | cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); | ||
772 | if (control & CONTROL_DCD) | ||
773 | return 1; | ||
774 | return 0; | ||
775 | } | ||
776 | |||
777 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | 767 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
778 | { | 768 | { |
779 | struct usb_serial_port *port = tty->driver_data; | 769 | struct usb_serial_port *port = tty->driver_data; |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index b92070c103cd..666e5a6edd82 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -455,7 +455,6 @@ static int digi_write_room(struct tty_struct *tty); | |||
455 | static int digi_chars_in_buffer(struct tty_struct *tty); | 455 | static int digi_chars_in_buffer(struct tty_struct *tty); |
456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); | 456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); |
457 | static void digi_close(struct usb_serial_port *port); | 457 | static void digi_close(struct usb_serial_port *port); |
458 | static int digi_carrier_raised(struct usb_serial_port *port); | ||
459 | static void digi_dtr_rts(struct usb_serial_port *port, int on); | 458 | static void digi_dtr_rts(struct usb_serial_port *port, int on); |
460 | static int digi_startup_device(struct usb_serial *serial); | 459 | static int digi_startup_device(struct usb_serial *serial); |
461 | static int digi_startup(struct usb_serial *serial); | 460 | static int digi_startup(struct usb_serial *serial); |
@@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
511 | .open = digi_open, | 510 | .open = digi_open, |
512 | .close = digi_close, | 511 | .close = digi_close, |
513 | .dtr_rts = digi_dtr_rts, | 512 | .dtr_rts = digi_dtr_rts, |
514 | .carrier_raised = digi_carrier_raised, | ||
515 | .write = digi_write, | 513 | .write = digi_write, |
516 | .write_room = digi_write_room, | 514 | .write_room = digi_write_room, |
517 | .write_bulk_callback = digi_write_bulk_callback, | 515 | .write_bulk_callback = digi_write_bulk_callback, |
@@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on) | |||
1339 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); | 1337 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); |
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | static int digi_carrier_raised(struct usb_serial_port *port) | ||
1343 | { | ||
1344 | struct digi_port *priv = usb_get_serial_port_data(port); | ||
1345 | if (priv->dp_modem_signals & TIOCM_CD) | ||
1346 | return 1; | ||
1347 | return 0; | ||
1348 | } | ||
1349 | |||
1350 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) | 1340 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) |
1351 | { | 1341 | { |
1352 | int ret; | 1342 | int ret; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a2668d089260..4787c0cd063f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -676,7 +676,17 @@ static struct usb_device_id id_table_combined [] = { | |||
676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | 676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, | 677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, |
678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
679 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 679 | { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, |
680 | { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, | ||
681 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, | ||
682 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, | ||
683 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, | ||
684 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, | ||
685 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, | ||
686 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, | ||
687 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, | ||
688 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, | ||
689 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, | ||
680 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 690 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
681 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 691 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
682 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 692 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index bf0867285481..ed160def8584 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -569,11 +569,23 @@ | |||
569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
570 | 570 | ||
571 | /* | 571 | /* |
572 | * Icom ID-1 digital transceiver | 572 | * Definitions for Icom Inc. devices |
573 | */ | 573 | */ |
574 | 574 | #define ICOM_VID 0x0C26 /* Icom vendor ID */ | |
575 | #define ICOM_ID1_VID 0x0C26 | 575 | /* Note: ID-1 is a communications tranceiver for HAM-radio operators */ |
576 | #define ICOM_ID1_PID 0x0004 | 576 | #define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ |
577 | /* Note: OPC is an Optional cable to connect an Icom Tranceiver */ | ||
578 | #define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ | ||
579 | /* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ | ||
580 | #define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ | ||
581 | #define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */ | ||
582 | #define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/ | ||
583 | #define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */ | ||
584 | #define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */ | ||
585 | #define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */ | ||
586 | #define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */ | ||
587 | #define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */ | ||
588 | #define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */ | ||
577 | 589 | ||
578 | /* | 590 | /* |
579 | * GN Otometrics (http://www.otometrics.com) | 591 | * GN Otometrics (http://www.otometrics.com) |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e6833e216fc9..e4db5ad2bc55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port) | |||
479 | } | 479 | } |
480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); | 480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); |
481 | 481 | ||
482 | /** | ||
483 | * usb_serial_handle_dcd_change - handle a change of carrier detect state | ||
484 | * @port: usb_serial_port structure for the open port | ||
485 | * @tty: tty_struct structure for the port | ||
486 | * @status: new carrier detect status, nonzero if active | ||
487 | */ | ||
488 | void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | ||
489 | struct tty_struct *tty, unsigned int status) | ||
490 | { | ||
491 | struct tty_port *port = &usb_port->port; | ||
492 | |||
493 | dbg("%s - port %d, status %d", __func__, usb_port->number, status); | ||
494 | |||
495 | if (status) | ||
496 | wake_up_interruptible(&port->open_wait); | ||
497 | else if (tty && !C_CLOCAL(tty)) | ||
498 | tty_hangup(tty); | ||
499 | } | ||
500 | EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change); | ||
501 | |||
482 | int usb_serial_generic_resume(struct usb_serial *serial) | 502 | int usb_serial_generic_resume(struct usb_serial *serial) |
483 | { | 503 | { |
484 | struct usb_serial_port *port; | 504 | struct usb_serial_port *port; |
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index 6ab2a3f97fe8..178b22eb32b1 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h | |||
@@ -199,6 +199,7 @@ static struct usb_serial_driver epic_device = { | |||
199 | .name = "epic", | 199 | .name = "epic", |
200 | }, | 200 | }, |
201 | .description = "EPiC device", | 201 | .description = "EPiC device", |
202 | .usb_driver = &io_driver, | ||
202 | .id_table = Epic_port_id_table, | 203 | .id_table = Epic_port_id_table, |
203 | .num_ports = 1, | 204 | .num_ports = 1, |
204 | .open = edge_open, | 205 | .open = edge_open, |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 12ed594f5f80..99b97c04896f 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -1275,6 +1275,7 @@ static struct usb_serial_driver iuu_device = { | |||
1275 | .name = "iuu_phoenix", | 1275 | .name = "iuu_phoenix", |
1276 | }, | 1276 | }, |
1277 | .id_table = id_table, | 1277 | .id_table = id_table, |
1278 | .usb_driver = &iuu_driver, | ||
1278 | .num_ports = 1, | 1279 | .num_ports = 1, |
1279 | .bulk_in_size = 512, | 1280 | .bulk_in_size = 512, |
1280 | .bulk_out_size = 512, | 1281 | .bulk_out_size = 512, |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 2d8baf6ac472..ce134dc28ddf 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -546,6 +546,7 @@ static struct usb_serial_driver keyspan_pre_device = { | |||
546 | .name = "keyspan_no_firm", | 546 | .name = "keyspan_no_firm", |
547 | }, | 547 | }, |
548 | .description = "Keyspan - (without firmware)", | 548 | .description = "Keyspan - (without firmware)", |
549 | .usb_driver = &keyspan_driver, | ||
549 | .id_table = keyspan_pre_ids, | 550 | .id_table = keyspan_pre_ids, |
550 | .num_ports = 1, | 551 | .num_ports = 1, |
551 | .attach = keyspan_fake_startup, | 552 | .attach = keyspan_fake_startup, |
@@ -557,6 +558,7 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
557 | .name = "keyspan_1", | 558 | .name = "keyspan_1", |
558 | }, | 559 | }, |
559 | .description = "Keyspan 1 port adapter", | 560 | .description = "Keyspan 1 port adapter", |
561 | .usb_driver = &keyspan_driver, | ||
560 | .id_table = keyspan_1port_ids, | 562 | .id_table = keyspan_1port_ids, |
561 | .num_ports = 1, | 563 | .num_ports = 1, |
562 | .open = keyspan_open, | 564 | .open = keyspan_open, |
@@ -579,6 +581,7 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
579 | .name = "keyspan_2", | 581 | .name = "keyspan_2", |
580 | }, | 582 | }, |
581 | .description = "Keyspan 2 port adapter", | 583 | .description = "Keyspan 2 port adapter", |
584 | .usb_driver = &keyspan_driver, | ||
582 | .id_table = keyspan_2port_ids, | 585 | .id_table = keyspan_2port_ids, |
583 | .num_ports = 2, | 586 | .num_ports = 2, |
584 | .open = keyspan_open, | 587 | .open = keyspan_open, |
@@ -601,6 +604,7 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
601 | .name = "keyspan_4", | 604 | .name = "keyspan_4", |
602 | }, | 605 | }, |
603 | .description = "Keyspan 4 port adapter", | 606 | .description = "Keyspan 4 port adapter", |
607 | .usb_driver = &keyspan_driver, | ||
604 | .id_table = keyspan_4port_ids, | 608 | .id_table = keyspan_4port_ids, |
605 | .num_ports = 4, | 609 | .num_ports = 4, |
606 | .open = keyspan_open, | 610 | .open = keyspan_open, |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index a10dd5676ccc..554a8693a463 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -679,22 +679,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) | |||
679 | } | 679 | } |
680 | } | 680 | } |
681 | 681 | ||
682 | static int keyspan_pda_carrier_raised(struct usb_serial_port *port) | ||
683 | { | ||
684 | struct usb_serial *serial = port->serial; | ||
685 | unsigned char modembits; | ||
686 | |||
687 | /* If we can read the modem status and the DCD is low then | ||
688 | carrier is not raised yet */ | ||
689 | if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { | ||
690 | if (!(modembits & (1>>6))) | ||
691 | return 0; | ||
692 | } | ||
693 | /* Carrier raised, or we failed (eg disconnected) so | ||
694 | progress accordingly */ | ||
695 | return 1; | ||
696 | } | ||
697 | |||
698 | 682 | ||
699 | static int keyspan_pda_open(struct tty_struct *tty, | 683 | static int keyspan_pda_open(struct tty_struct *tty, |
700 | struct usb_serial_port *port) | 684 | struct usb_serial_port *port) |
@@ -881,7 +865,6 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
881 | .id_table = id_table_std, | 865 | .id_table = id_table_std, |
882 | .num_ports = 1, | 866 | .num_ports = 1, |
883 | .dtr_rts = keyspan_pda_dtr_rts, | 867 | .dtr_rts = keyspan_pda_dtr_rts, |
884 | .carrier_raised = keyspan_pda_carrier_raised, | ||
885 | .open = keyspan_pda_open, | 868 | .open = keyspan_pda_open, |
886 | .close = keyspan_pda_close, | 869 | .close = keyspan_pda_close, |
887 | .write = keyspan_pda_write, | 870 | .write = keyspan_pda_write, |
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c index cf1718394e18..653465f61d4a 100644 --- a/drivers/usb/serial/moto_modem.c +++ b/drivers/usb/serial/moto_modem.c | |||
@@ -44,6 +44,7 @@ static struct usb_serial_driver moto_device = { | |||
44 | .name = "moto-modem", | 44 | .name = "moto-modem", |
45 | }, | 45 | }, |
46 | .id_table = id_table, | 46 | .id_table = id_table, |
47 | .usb_driver = &moto_driver, | ||
47 | .num_ports = 1, | 48 | .num_ports = 1, |
48 | }; | 49 | }; |
49 | 50 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 748778288d94..5f46838dfee5 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -382,7 +382,16 @@ static void option_instat_callback(struct urb *urb); | |||
382 | #define HAIER_VENDOR_ID 0x201e | 382 | #define HAIER_VENDOR_ID 0x201e |
383 | #define HAIER_PRODUCT_CE100 0x2009 | 383 | #define HAIER_PRODUCT_CE100 0x2009 |
384 | 384 | ||
385 | #define CINTERION_VENDOR_ID 0x0681 | 385 | /* Cinterion (formerly Siemens) products */ |
386 | #define SIEMENS_VENDOR_ID 0x0681 | ||
387 | #define CINTERION_VENDOR_ID 0x1e2d | ||
388 | #define CINTERION_PRODUCT_HC25_MDM 0x0047 | ||
389 | #define CINTERION_PRODUCT_HC25_MDMNET 0x0040 | ||
390 | #define CINTERION_PRODUCT_HC28_MDM 0x004C | ||
391 | #define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ | ||
392 | #define CINTERION_PRODUCT_EU3_E 0x0051 | ||
393 | #define CINTERION_PRODUCT_EU3_P 0x0052 | ||
394 | #define CINTERION_PRODUCT_PH8 0x0053 | ||
386 | 395 | ||
387 | /* Olivetti products */ | 396 | /* Olivetti products */ |
388 | #define OLIVETTI_VENDOR_ID 0x0b3c | 397 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -944,7 +953,17 @@ static const struct usb_device_id option_ids[] = { | |||
944 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, | 953 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, |
945 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, | 954 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, |
946 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, | 955 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, |
947 | { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, | 956 | /* Cinterion */ |
957 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | ||
958 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | ||
959 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | ||
960 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | ||
961 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
962 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | ||
963 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | ||
964 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | ||
965 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
966 | |||
948 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 967 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
949 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 968 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
950 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ | 969 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 5be866bb7a41..73613205be7a 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = { | |||
157 | .name = "oti6858", | 157 | .name = "oti6858", |
158 | }, | 158 | }, |
159 | .id_table = id_table, | 159 | .id_table = id_table, |
160 | .usb_driver = &oti6858_driver, | ||
160 | .num_ports = 1, | 161 | .num_ports = 1, |
161 | .open = oti6858_open, | 162 | .open = oti6858_open, |
162 | .close = oti6858_close, | 163 | .close = oti6858_close, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 8ae4c6cbc38a..08c9181b8e48 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = { | |||
50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, | 50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, |
51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, | 51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, | 52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, | ||
53 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 55 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
55 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 56 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
@@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
677 | { | 678 | { |
678 | 679 | ||
679 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 680 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
681 | struct tty_struct *tty; | ||
680 | unsigned long flags; | 682 | unsigned long flags; |
681 | u8 status_idx = UART_STATE; | 683 | u8 status_idx = UART_STATE; |
682 | u8 length = UART_STATE + 1; | 684 | u8 length = UART_STATE + 1; |
685 | u8 prev_line_status; | ||
683 | u16 idv, idp; | 686 | u16 idv, idp; |
684 | 687 | ||
685 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); | 688 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); |
@@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
701 | 704 | ||
702 | /* Save off the uart status for others to look at */ | 705 | /* Save off the uart status for others to look at */ |
703 | spin_lock_irqsave(&priv->lock, flags); | 706 | spin_lock_irqsave(&priv->lock, flags); |
707 | prev_line_status = priv->line_status; | ||
704 | priv->line_status = data[status_idx]; | 708 | priv->line_status = data[status_idx]; |
705 | spin_unlock_irqrestore(&priv->lock, flags); | 709 | spin_unlock_irqrestore(&priv->lock, flags); |
706 | if (priv->line_status & UART_BREAK_ERROR) | 710 | if (priv->line_status & UART_BREAK_ERROR) |
707 | usb_serial_handle_break(port); | 711 | usb_serial_handle_break(port); |
708 | wake_up_interruptible(&priv->delta_msr_wait); | 712 | wake_up_interruptible(&priv->delta_msr_wait); |
713 | |||
714 | tty = tty_port_tty_get(&port->port); | ||
715 | if (!tty) | ||
716 | return; | ||
717 | if ((priv->line_status ^ prev_line_status) & UART_DCD) | ||
718 | usb_serial_handle_dcd_change(port, tty, | ||
719 | priv->line_status & UART_DCD); | ||
720 | tty_kref_put(tty); | ||
709 | } | 721 | } |
710 | 722 | ||
711 | static void pl2303_read_int_callback(struct urb *urb) | 723 | static void pl2303_read_int_callback(struct urb *urb) |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 43eb9bdad422..1b025f75dafd 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define PL2303_PRODUCT_ID_MMX 0x0612 | 21 | #define PL2303_PRODUCT_ID_MMX 0x0612 |
22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 | 22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
23 | #define PL2303_PRODUCT_ID_HCR331 0x331a | 23 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 | ||
24 | 25 | ||
25 | #define ATEN_VENDOR_ID 0x0557 | 26 | #define ATEN_VENDOR_ID 0x0557 |
26 | #define ATEN_VENDOR_ID2 0x0547 | 27 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c index 214a3e504292..30b73e68a904 100644 --- a/drivers/usb/serial/qcaux.c +++ b/drivers/usb/serial/qcaux.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 | 36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 |
37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 | 37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 |
38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 | 38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 |
39 | #define PANTECH_PRODUCT_UML290_VZW 0x3718 | ||
39 | 40 | ||
40 | /* CMOTECH devices */ | 41 | /* CMOTECH devices */ |
41 | #define CMOTECH_VENDOR_ID 0x16d8 | 42 | #define CMOTECH_VENDOR_ID 0x16d8 |
@@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = { | |||
66 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, | 67 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, |
67 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, | 68 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, |
68 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, | 69 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, |
70 | { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, | ||
69 | { }, | 71 | { }, |
70 | }; | 72 | }; |
71 | MODULE_DEVICE_TABLE(usb, id_table); | 73 | MODULE_DEVICE_TABLE(usb, id_table); |
@@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = { | |||
84 | .name = "qcaux", | 86 | .name = "qcaux", |
85 | }, | 87 | }, |
86 | .id_table = id_table, | 88 | .id_table = id_table, |
89 | .usb_driver = &qcaux_driver, | ||
87 | .num_ports = 1, | 90 | .num_ports = 1, |
88 | }; | 91 | }; |
89 | 92 | ||
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c index cb8195cabfde..74cd4ccdb3fc 100644 --- a/drivers/usb/serial/siemens_mpi.c +++ b/drivers/usb/serial/siemens_mpi.c | |||
@@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = { | |||
42 | .name = "siemens_mpi", | 42 | .name = "siemens_mpi", |
43 | }, | 43 | }, |
44 | .id_table = id_table, | 44 | .id_table = id_table, |
45 | .usb_driver = &siemens_usb_mpi_driver, | ||
45 | .num_ports = 1, | 46 | .num_ports = 1, |
46 | }; | 47 | }; |
47 | 48 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 765aa983bf58..cbfb70bffdd0 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg { | |||
133 | 133 | ||
134 | /* how come ??? */ | 134 | /* how come ??? */ |
135 | #define UART_STATE 0x08 | 135 | #define UART_STATE 0x08 |
136 | #define UART_STATE_TRANSIENT_MASK 0x74 | 136 | #define UART_STATE_TRANSIENT_MASK 0x75 |
137 | #define UART_DCD 0x01 | 137 | #define UART_DCD 0x01 |
138 | #define UART_DSR 0x02 | 138 | #define UART_DSR 0x02 |
139 | #define UART_BREAK_ERROR 0x04 | 139 | #define UART_BREAK_ERROR 0x04 |
@@ -525,6 +525,10 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
525 | /* overrun is special, not associated with a char */ | 525 | /* overrun is special, not associated with a char */ |
526 | if (status & UART_OVERRUN_ERROR) | 526 | if (status & UART_OVERRUN_ERROR) |
527 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 527 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
528 | |||
529 | if (status & UART_DCD) | ||
530 | usb_serial_handle_dcd_change(port, tty, | ||
531 | priv->line_status & MSR_STATUS_LINE_DCD); | ||
528 | } | 532 | } |
529 | 533 | ||
530 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, | 534 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, |
@@ -645,6 +649,7 @@ static struct usb_serial_driver spcp8x5_device = { | |||
645 | .name = "SPCP8x5", | 649 | .name = "SPCP8x5", |
646 | }, | 650 | }, |
647 | .id_table = id_table, | 651 | .id_table = id_table, |
652 | .usb_driver = &spcp8x5_driver, | ||
648 | .num_ports = 1, | 653 | .num_ports = 1, |
649 | .open = spcp8x5_open, | 654 | .open = spcp8x5_open, |
650 | .dtr_rts = spcp8x5_dtr_rts, | 655 | .dtr_rts = spcp8x5_dtr_rts, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6954de50c0ff..546a52179bec 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1344,11 +1344,15 @@ int usb_serial_register(struct usb_serial_driver *driver) | |||
1344 | return -ENODEV; | 1344 | return -ENODEV; |
1345 | 1345 | ||
1346 | fixup_generic(driver); | 1346 | fixup_generic(driver); |
1347 | if (driver->usb_driver) | ||
1348 | driver->usb_driver->supports_autosuspend = 1; | ||
1349 | 1347 | ||
1350 | if (!driver->description) | 1348 | if (!driver->description) |
1351 | driver->description = driver->driver.name; | 1349 | driver->description = driver->driver.name; |
1350 | if (!driver->usb_driver) { | ||
1351 | WARN(1, "Serial driver %s has no usb_driver\n", | ||
1352 | driver->description); | ||
1353 | return -EINVAL; | ||
1354 | } | ||
1355 | driver->usb_driver->supports_autosuspend = 1; | ||
1352 | 1356 | ||
1353 | /* Add this device to our list of devices */ | 1357 | /* Add this device to our list of devices */ |
1354 | mutex_lock(&table_lock); | 1358 | mutex_lock(&table_lock); |
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c index f2ed6a31be77..95a82148ee81 100644 --- a/drivers/usb/serial/usb_debug.c +++ b/drivers/usb/serial/usb_debug.c | |||
@@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = { | |||
75 | .name = "debug", | 75 | .name = "debug", |
76 | }, | 76 | }, |
77 | .id_table = id_table, | 77 | .id_table = id_table, |
78 | .usb_driver = &debug_driver, | ||
78 | .num_ports = 1, | 79 | .num_ports = 1, |
79 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, | 80 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, |
80 | .break_ctl = usb_debug_break_ctl, | 81 | .break_ctl = usb_debug_break_ctl, |
diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h index c854fdebe0ae..2c8553026222 100644 --- a/drivers/usb/storage/unusual_cypress.h +++ b/drivers/usb/storage/unusual_cypress.h | |||
@@ -31,4 +31,9 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999, | |||
31 | "Cypress ISD-300LP", | 31 | "Cypress ISD-300LP", |
32 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), | 32 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
33 | 33 | ||
34 | UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999, | ||
35 | "Super Top", | ||
36 | "USB 2.0 SATA BRIDGE", | ||
37 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), | ||
38 | |||
34 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ | 39 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index fcc1e32ce256..24bd5d7c3deb 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1044,6 +1044,15 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110, | |||
1044 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1044 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1045 | US_FL_BULK32), | 1045 | US_FL_BULK32), |
1046 | 1046 | ||
1047 | /* Reported by <ttkspam@free.fr> | ||
1048 | * The device reports a vendor-specific device class, requiring an | ||
1049 | * explicit vendor/product match. | ||
1050 | */ | ||
1051 | UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002, | ||
1052 | "MagicPixel", | ||
1053 | "FW_Omega2", | ||
1054 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, 0), | ||
1055 | |||
1047 | /* Andrew Lunn <andrew@lunn.ch> | 1056 | /* Andrew Lunn <andrew@lunn.ch> |
1048 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL | 1057 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL |
1049 | * on LUN 4. | 1058 | * on LUN 4. |
@@ -1872,6 +1881,15 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
1872 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1881 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1873 | US_FL_NO_READ_DISC_INFO ), | 1882 | US_FL_NO_READ_DISC_INFO ), |
1874 | 1883 | ||
1884 | /* Patch by Richard Schütz <r.schtz@t-online.de> | ||
1885 | * This external hard drive enclosure uses a JMicron chip which | ||
1886 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | ||
1887 | UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000, | ||
1888 | "TrekStor GmbH & Co. KG", | ||
1889 | "DataStation maxi g.u", | ||
1890 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1891 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | ||
1892 | |||
1875 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, | 1893 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
1876 | "ST", | 1894 | "ST", |
1877 | "2A", | 1895 | "2A", |