diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-19 22:17:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-19 22:17:35 -0500 |
commit | da935c66bacb3ed9ada984b053297f87c2dff63a (patch) | |
tree | 46278da2b312c73f1375b830d7e5912bf23abd78 /drivers | |
parent | 9435eb1cf0b76b323019cebf8d16762a50a12a19 (diff) | |
parent | 2205a6ea93fea76f88b43727fea53f3ce3790d6f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
Documentation/feature-removal-schedule.txt
drivers/net/e1000e/netdev.c
net/xfrm/xfrm_policy.c
Diffstat (limited to 'drivers')
439 files changed, 5828 insertions, 4245 deletions
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index e9562a7cb2f9..3b20a3401b64 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
@@ -212,37 +212,40 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, | |||
212 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 212 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
213 | } | 213 | } |
214 | 214 | ||
215 | /* Validate wake_device is of type Device */ | ||
216 | |||
217 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); | ||
218 | if (device_node->type != ACPI_TYPE_DEVICE) { | ||
219 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
220 | } | ||
221 | |||
222 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 215 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
223 | 216 | ||
224 | /* Ensure that we have a valid GPE number */ | 217 | /* Ensure that we have a valid GPE number */ |
225 | 218 | ||
226 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 219 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
227 | if (gpe_event_info) { | 220 | if (!gpe_event_info) { |
228 | /* | 221 | goto unlock_and_exit; |
229 | * If there is no method or handler for this GPE, then the | 222 | } |
230 | * wake_device will be notified whenever this GPE fires (aka | 223 | |
231 | * "implicit notify") Note: The GPE is assumed to be | 224 | /* |
232 | * level-triggered (for windows compatibility). | 225 | * If there is no method or handler for this GPE, then the |
233 | */ | 226 | * wake_device will be notified whenever this GPE fires (aka |
234 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 227 | * "implicit notify") Note: The GPE is assumed to be |
235 | ACPI_GPE_DISPATCH_NONE) { | 228 | * level-triggered (for windows compatibility). |
236 | gpe_event_info->flags = | 229 | */ |
237 | (ACPI_GPE_DISPATCH_NOTIFY | | 230 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
238 | ACPI_GPE_LEVEL_TRIGGERED); | 231 | ACPI_GPE_DISPATCH_NONE) && (wake_device != ACPI_ROOT_OBJECT)) { |
239 | gpe_event_info->dispatch.device_node = device_node; | ||
240 | } | ||
241 | 232 | ||
242 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | 233 | /* Validate wake_device is of type Device */ |
243 | status = AE_OK; | 234 | |
235 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, | ||
236 | wake_device); | ||
237 | if (device_node->type != ACPI_TYPE_DEVICE) { | ||
238 | goto unlock_and_exit; | ||
239 | } | ||
240 | gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | | ||
241 | ACPI_GPE_LEVEL_TRIGGERED); | ||
242 | gpe_event_info->dispatch.device_node = device_node; | ||
244 | } | 243 | } |
245 | 244 | ||
245 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | ||
246 | status = AE_OK; | ||
247 | |||
248 | unlock_and_exit: | ||
246 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 249 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
247 | return_ACPI_STATUS(status); | 250 | return_ACPI_STATUS(status); |
248 | } | 251 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index b0931818cf98..c90c76aa7f8b 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -636,17 +636,21 @@ EXPORT_SYMBOL(acpi_os_write_port); | |||
636 | acpi_status | 636 | acpi_status |
637 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) | 637 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) |
638 | { | 638 | { |
639 | u32 dummy; | ||
640 | void __iomem *virt_addr; | 639 | void __iomem *virt_addr; |
641 | int size = width / 8, unmap = 0; | 640 | unsigned int size = width / 8; |
641 | bool unmap = false; | ||
642 | u32 dummy; | ||
642 | 643 | ||
643 | rcu_read_lock(); | 644 | rcu_read_lock(); |
644 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | 645 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
645 | rcu_read_unlock(); | ||
646 | if (!virt_addr) { | 646 | if (!virt_addr) { |
647 | rcu_read_unlock(); | ||
647 | virt_addr = acpi_os_ioremap(phys_addr, size); | 648 | virt_addr = acpi_os_ioremap(phys_addr, size); |
648 | unmap = 1; | 649 | if (!virt_addr) |
650 | return AE_BAD_ADDRESS; | ||
651 | unmap = true; | ||
649 | } | 652 | } |
653 | |||
650 | if (!value) | 654 | if (!value) |
651 | value = &dummy; | 655 | value = &dummy; |
652 | 656 | ||
@@ -666,6 +670,8 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) | |||
666 | 670 | ||
667 | if (unmap) | 671 | if (unmap) |
668 | iounmap(virt_addr); | 672 | iounmap(virt_addr); |
673 | else | ||
674 | rcu_read_unlock(); | ||
669 | 675 | ||
670 | return AE_OK; | 676 | return AE_OK; |
671 | } | 677 | } |
@@ -674,14 +680,17 @@ acpi_status | |||
674 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | 680 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) |
675 | { | 681 | { |
676 | void __iomem *virt_addr; | 682 | void __iomem *virt_addr; |
677 | int size = width / 8, unmap = 0; | 683 | unsigned int size = width / 8; |
684 | bool unmap = false; | ||
678 | 685 | ||
679 | rcu_read_lock(); | 686 | rcu_read_lock(); |
680 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | 687 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
681 | rcu_read_unlock(); | ||
682 | if (!virt_addr) { | 688 | if (!virt_addr) { |
689 | rcu_read_unlock(); | ||
683 | virt_addr = acpi_os_ioremap(phys_addr, size); | 690 | virt_addr = acpi_os_ioremap(phys_addr, size); |
684 | unmap = 1; | 691 | if (!virt_addr) |
692 | return AE_BAD_ADDRESS; | ||
693 | unmap = true; | ||
685 | } | 694 | } |
686 | 695 | ||
687 | switch (width) { | 696 | switch (width) { |
@@ -700,6 +709,8 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | |||
700 | 709 | ||
701 | if (unmap) | 710 | if (unmap) |
702 | iounmap(virt_addr); | 711 | iounmap(virt_addr); |
712 | else | ||
713 | rcu_read_unlock(); | ||
703 | 714 | ||
704 | return AE_OK; | 715 | return AE_OK; |
705 | } | 716 | } |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 42d3d72dae85..5af3479714f6 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -82,6 +82,11 @@ long acpi_is_video_device(struct acpi_device *device) | |||
82 | if (!device) | 82 | if (!device) |
83 | return 0; | 83 | return 0; |
84 | 84 | ||
85 | /* Is this device able to support video switching ? */ | ||
86 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) || | ||
87 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | ||
88 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | ||
89 | |||
85 | /* Is this device able to retrieve a video ROM ? */ | 90 | /* Is this device able to retrieve a video ROM ? */ |
86 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | 91 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) |
87 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | 92 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; |
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index ed6501452507..7bfbe40bc43b 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void) | |||
86 | struct acpi_device *dev = container_of(node, | 86 | struct acpi_device *dev = container_of(node, |
87 | struct acpi_device, | 87 | struct acpi_device, |
88 | wakeup_list); | 88 | wakeup_list); |
89 | if (device_can_wakeup(&dev->dev)) | 89 | if (device_can_wakeup(&dev->dev)) { |
90 | /* Button GPEs are supposed to be always enabled. */ | ||
91 | acpi_enable_gpe(dev->wakeup.gpe_device, | ||
92 | dev->wakeup.gpe_number); | ||
90 | device_set_wakeup_enable(&dev->dev, true); | 93 | device_set_wakeup_enable(&dev->dev, true); |
94 | } | ||
91 | } | 95 | } |
92 | mutex_unlock(&acpi_device_lock); | 96 | mutex_unlock(&acpi_device_lock); |
93 | return 0; | 97 | return 0; |
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/atm/solos-pci.c b/drivers/atm/solos-pci.c index 73fb1c4f4cd4..25ef1a4556e6 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -866,8 +866,9 @@ static int popen(struct atm_vcc *vcc) | |||
866 | } | 866 | } |
867 | 867 | ||
868 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); | 868 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); |
869 | if (!skb && net_ratelimit()) { | 869 | if (!skb) { |
870 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); | 870 | if (net_ratelimit()) |
871 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); | ||
871 | return -ENOMEM; | 872 | return -ENOMEM; |
872 | } | 873 | } |
873 | header = (void *)skb_put(skb, sizeof(*header)); | 874 | header = (void *)skb_put(skb, sizeof(*header)); |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 656493a5e073..42615b419dfb 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -407,12 +407,15 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
407 | goto out; | 407 | goto out; |
408 | } | 408 | } |
409 | 409 | ||
410 | /* Maybe the parent is now able to suspend. */ | ||
410 | if (parent && !parent->power.ignore_children && !dev->power.irq_safe) { | 411 | if (parent && !parent->power.ignore_children && !dev->power.irq_safe) { |
411 | spin_unlock_irq(&dev->power.lock); | 412 | spin_unlock(&dev->power.lock); |
412 | 413 | ||
413 | pm_request_idle(parent); | 414 | spin_lock(&parent->power.lock); |
415 | rpm_idle(parent, RPM_ASYNC); | ||
416 | spin_unlock(&parent->power.lock); | ||
414 | 417 | ||
415 | spin_lock_irq(&dev->power.lock); | 418 | spin_lock(&dev->power.lock); |
416 | } | 419 | } |
417 | 420 | ||
418 | out: | 421 | out: |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index d7f463d6312d..40528ba56d1b 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -39,4 +39,4 @@ obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o | |||
39 | obj-$(CONFIG_BLK_DEV_DRBD) += drbd/ | 39 | obj-$(CONFIG_BLK_DEV_DRBD) += drbd/ |
40 | obj-$(CONFIG_BLK_DEV_RBD) += rbd.o | 40 | obj-$(CONFIG_BLK_DEV_RBD) += rbd.o |
41 | 41 | ||
42 | swim_mod-objs := swim.o swim_asm.o | 42 | swim_mod-y := swim.o swim_asm.o |
diff --git a/drivers/block/aoe/Makefile b/drivers/block/aoe/Makefile index e76d997183c6..06ea82cdf27d 100644 --- a/drivers/block/aoe/Makefile +++ b/drivers/block/aoe/Makefile | |||
@@ -3,4 +3,4 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_ATA_OVER_ETH) += aoe.o | 5 | obj-$(CONFIG_ATA_OVER_ETH) += aoe.o |
6 | aoe-objs := aoeblk.o aoechr.o aoecmd.o aoedev.o aoemain.o aoenet.o | 6 | aoe-y := aoeblk.o aoechr.o aoecmd.o aoedev.o aoemain.o aoenet.o |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 516d5bbec2b6..9279272b3732 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2833,7 +2833,7 @@ static int cciss_revalidate(struct gendisk *disk) | |||
2833 | sector_t total_size; | 2833 | sector_t total_size; |
2834 | InquiryData_struct *inq_buff = NULL; | 2834 | InquiryData_struct *inq_buff = NULL; |
2835 | 2835 | ||
2836 | for (logvol = 0; logvol < CISS_MAX_LUN; logvol++) { | 2836 | for (logvol = 0; logvol <= h->highest_lun; logvol++) { |
2837 | if (!h->drv[logvol]) | 2837 | if (!h->drv[logvol]) |
2838 | continue; | 2838 | continue; |
2839 | if (memcmp(h->drv[logvol]->LunID, drv->LunID, | 2839 | if (memcmp(h->drv[logvol]->LunID, drv->LunID, |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 44e18c073c44..49e6a545eb63 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1641,6 +1641,9 @@ out: | |||
1641 | 1641 | ||
1642 | static void loop_free(struct loop_device *lo) | 1642 | static void loop_free(struct loop_device *lo) |
1643 | { | 1643 | { |
1644 | if (!lo->lo_queue->queue_lock) | ||
1645 | lo->lo_queue->queue_lock = &lo->lo_queue->__queue_lock; | ||
1646 | |||
1644 | blk_cleanup_queue(lo->lo_queue); | 1647 | blk_cleanup_queue(lo->lo_queue); |
1645 | put_disk(lo->lo_disk); | 1648 | put_disk(lo->lo_disk); |
1646 | list_del(&lo->lo_list); | 1649 | list_del(&lo->lo_list); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index a32fb41246f8..e6fc716aca45 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #define DBG_BLKDEV 0x0100 | 53 | #define DBG_BLKDEV 0x0100 |
54 | #define DBG_RX 0x0200 | 54 | #define DBG_RX 0x0200 |
55 | #define DBG_TX 0x0400 | 55 | #define DBG_TX 0x0400 |
56 | static DEFINE_MUTEX(nbd_mutex); | ||
57 | static unsigned int debugflags; | 56 | static unsigned int debugflags; |
58 | #endif /* NDEBUG */ | 57 | #endif /* NDEBUG */ |
59 | 58 | ||
@@ -718,11 +717,9 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode, | |||
718 | dprintk(DBG_IOCTL, "%s: nbd_ioctl cmd=%s(0x%x) arg=%lu\n", | 717 | dprintk(DBG_IOCTL, "%s: nbd_ioctl cmd=%s(0x%x) arg=%lu\n", |
719 | lo->disk->disk_name, ioctl_cmd_to_ascii(cmd), cmd, arg); | 718 | lo->disk->disk_name, ioctl_cmd_to_ascii(cmd), cmd, arg); |
720 | 719 | ||
721 | mutex_lock(&nbd_mutex); | ||
722 | mutex_lock(&lo->tx_lock); | 720 | mutex_lock(&lo->tx_lock); |
723 | error = __nbd_ioctl(bdev, lo, cmd, arg); | 721 | error = __nbd_ioctl(bdev, lo, cmd, arg); |
724 | mutex_unlock(&lo->tx_lock); | 722 | mutex_unlock(&lo->tx_lock); |
725 | mutex_unlock(&nbd_mutex); | ||
726 | 723 | ||
727 | return error; | 724 | return error; |
728 | } | 725 | } |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index a126e614601f..333c21289d97 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -39,6 +39,8 @@ static struct usb_device_id ath3k_table[] = { | |||
39 | /* Atheros AR3011 with sflash firmware*/ | 39 | /* Atheros AR3011 with sflash firmware*/ |
40 | { USB_DEVICE(0x0CF3, 0x3002) }, | 40 | { USB_DEVICE(0x0CF3, 0x3002) }, |
41 | 41 | ||
42 | /* Atheros AR9285 Malbec with sflash firmware */ | ||
43 | { USB_DEVICE(0x03F0, 0x311D) }, | ||
42 | { } /* Terminating entry */ | 44 | { } /* Terminating entry */ |
43 | }; | 45 | }; |
44 | 46 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 1da773f899a2..4cefa91e6c34 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -102,6 +102,9 @@ static struct usb_device_id blacklist_table[] = { | |||
102 | /* Atheros 3011 with sflash firmware */ | 102 | /* Atheros 3011 with sflash firmware */ |
103 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, | 103 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, |
104 | 104 | ||
105 | /* Atheros AR9285 Malbec with sflash firmware */ | ||
106 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | ||
107 | |||
105 | /* Broadcom BCM2035 */ | 108 | /* Broadcom BCM2035 */ |
106 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, | 109 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, |
107 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, | 110 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 14033a36bcd0..e2c48a7eccff 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -409,7 +409,8 @@ int register_cdrom(struct cdrom_device_info *cdi) | |||
409 | } | 409 | } |
410 | 410 | ||
411 | ENSURE(drive_status, CDC_DRIVE_STATUS ); | 411 | ENSURE(drive_status, CDC_DRIVE_STATUS ); |
412 | ENSURE(media_changed, CDC_MEDIA_CHANGED); | 412 | if (cdo->check_events == NULL && cdo->media_changed == NULL) |
413 | *change_capability = ~(CDC_MEDIA_CHANGED | CDC_SELECT_DISC); | ||
413 | ENSURE(tray_move, CDC_CLOSE_TRAY | CDC_OPEN_TRAY); | 414 | ENSURE(tray_move, CDC_CLOSE_TRAY | CDC_OPEN_TRAY); |
414 | ENSURE(lock_door, CDC_LOCK); | 415 | ENSURE(lock_door, CDC_LOCK); |
415 | ENSURE(select_speed, CDC_SELECT_SPEED); | 416 | ENSURE(select_speed, CDC_SELECT_SPEED); |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 5bc765d4c3ca..8238f89f73c9 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -30,6 +30,7 @@ obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o | |||
30 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o | 30 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o |
31 | obj-$(CONFIG_SX) += sx.o generic_serial.o | 31 | obj-$(CONFIG_SX) += sx.o generic_serial.o |
32 | obj-$(CONFIG_RIO) += rio/ generic_serial.o | 32 | obj-$(CONFIG_RIO) += rio/ generic_serial.o |
33 | obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o | ||
33 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 34 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
34 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o | 35 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o |
35 | obj-$(CONFIG_MSPEC) += mspec.o | 36 | obj-$(CONFIG_MSPEC) += mspec.o |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index fcd867d923ba..d8b1b576556c 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -50,7 +50,7 @@ config AGP_ATI | |||
50 | 50 | ||
51 | config AGP_AMD | 51 | config AGP_AMD |
52 | tristate "AMD Irongate, 761, and 762 chipset support" | 52 | tristate "AMD Irongate, 761, and 762 chipset support" |
53 | depends on AGP && (X86_32 || ALPHA) | 53 | depends on AGP && X86_32 |
54 | help | 54 | help |
55 | This option gives you AGP support for the GLX component of | 55 | This option gives you AGP support for the GLX component of |
56 | X on AMD Irongate, 761, and 762 chipsets. | 56 | X on AMD Irongate, 761, and 762 chipsets. |
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index b1b4362bc648..45681c0ff3b6 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -41,22 +41,8 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
41 | if (page_map->real == NULL) | 41 | if (page_map->real == NULL) |
42 | return -ENOMEM; | 42 | return -ENOMEM; |
43 | 43 | ||
44 | #ifndef CONFIG_X86 | ||
45 | SetPageReserved(virt_to_page(page_map->real)); | ||
46 | global_cache_flush(); | ||
47 | page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), | ||
48 | PAGE_SIZE); | ||
49 | if (page_map->remapped == NULL) { | ||
50 | ClearPageReserved(virt_to_page(page_map->real)); | ||
51 | free_page((unsigned long) page_map->real); | ||
52 | page_map->real = NULL; | ||
53 | return -ENOMEM; | ||
54 | } | ||
55 | global_cache_flush(); | ||
56 | #else | ||
57 | set_memory_uc((unsigned long)page_map->real, 1); | 44 | set_memory_uc((unsigned long)page_map->real, 1); |
58 | page_map->remapped = page_map->real; | 45 | page_map->remapped = page_map->real; |
59 | #endif | ||
60 | 46 | ||
61 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { | 47 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { |
62 | writel(agp_bridge->scratch_page, page_map->remapped+i); | 48 | writel(agp_bridge->scratch_page, page_map->remapped+i); |
@@ -68,12 +54,7 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
68 | 54 | ||
69 | static void amd_free_page_map(struct amd_page_map *page_map) | 55 | static void amd_free_page_map(struct amd_page_map *page_map) |
70 | { | 56 | { |
71 | #ifndef CONFIG_X86 | ||
72 | iounmap(page_map->remapped); | ||
73 | ClearPageReserved(virt_to_page(page_map->real)); | ||
74 | #else | ||
75 | set_memory_wb((unsigned long)page_map->real, 1); | 57 | set_memory_wb((unsigned long)page_map->real, 1); |
76 | #endif | ||
77 | free_page((unsigned long) page_map->real); | 58 | free_page((unsigned long) page_map->real); |
78 | } | 59 | } |
79 | 60 | ||
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 857df10c0428..b0a0dccc98c1 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -774,20 +774,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
774 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); | 774 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
775 | 775 | ||
776 | /* | 776 | /* |
777 | * If the device has not been properly setup, the following will catch | ||
778 | * the problem and should stop the system from crashing. | ||
779 | * 20030610 - hamish@zot.org | ||
780 | */ | ||
781 | if (pci_enable_device(pdev)) { | ||
782 | dev_err(&pdev->dev, "can't enable PCI device\n"); | ||
783 | agp_put_bridge(bridge); | ||
784 | return -ENODEV; | ||
785 | } | ||
786 | |||
787 | /* | ||
788 | * The following fixes the case where the BIOS has "forgotten" to | 777 | * The following fixes the case where the BIOS has "forgotten" to |
789 | * provide an address range for the GART. | 778 | * provide an address range for the GART. |
790 | * 20030610 - hamish@zot.org | 779 | * 20030610 - hamish@zot.org |
780 | * This happens before pci_enable_device() intentionally; | ||
781 | * calling pci_enable_device() before assigning the resource | ||
782 | * will result in the GART being disabled on machines with such | ||
783 | * BIOSs (the GART ends up with a BAR starting at 0, which | ||
784 | * conflicts a lot of other devices). | ||
791 | */ | 785 | */ |
792 | r = &pdev->resource[0]; | 786 | r = &pdev->resource[0]; |
793 | if (!r->start && r->end) { | 787 | if (!r->start && r->end) { |
@@ -798,6 +792,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
798 | } | 792 | } |
799 | } | 793 | } |
800 | 794 | ||
795 | /* | ||
796 | * If the device has not been properly setup, the following will catch | ||
797 | * the problem and should stop the system from crashing. | ||
798 | * 20030610 - hamish@zot.org | ||
799 | */ | ||
800 | if (pci_enable_device(pdev)) { | ||
801 | dev_err(&pdev->dev, "can't enable PCI device\n"); | ||
802 | agp_put_bridge(bridge); | ||
803 | return -ENODEV; | ||
804 | } | ||
805 | |||
801 | /* Fill in the mode register */ | 806 | /* Fill in the mode register */ |
802 | if (cap_ptr) { | 807 | if (cap_ptr) { |
803 | pci_read_config_dword(pdev, | 808 | pci_read_config_dword(pdev, |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 826ab0939a12..fab3d3265adb 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -68,6 +68,7 @@ static struct _intel_private { | |||
68 | phys_addr_t gma_bus_addr; | 68 | phys_addr_t gma_bus_addr; |
69 | u32 PGETBL_save; | 69 | u32 PGETBL_save; |
70 | u32 __iomem *gtt; /* I915G */ | 70 | u32 __iomem *gtt; /* I915G */ |
71 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ | ||
71 | int num_dcache_entries; | 72 | int num_dcache_entries; |
72 | union { | 73 | union { |
73 | void __iomem *i9xx_flush_page; | 74 | void __iomem *i9xx_flush_page; |
@@ -869,21 +870,12 @@ static int intel_fake_agp_free_gatt_table(struct agp_bridge_data *bridge) | |||
869 | 870 | ||
870 | static int intel_fake_agp_configure(void) | 871 | static int intel_fake_agp_configure(void) |
871 | { | 872 | { |
872 | int i; | ||
873 | |||
874 | if (!intel_enable_gtt()) | 873 | if (!intel_enable_gtt()) |
875 | return -EIO; | 874 | return -EIO; |
876 | 875 | ||
876 | intel_private.clear_fake_agp = true; | ||
877 | agp_bridge->gart_bus_addr = intel_private.gma_bus_addr; | 877 | agp_bridge->gart_bus_addr = intel_private.gma_bus_addr; |
878 | 878 | ||
879 | for (i = 0; i < intel_private.base.gtt_total_entries; i++) { | ||
880 | intel_private.driver->write_entry(intel_private.scratch_page_dma, | ||
881 | i, 0); | ||
882 | } | ||
883 | readl(intel_private.gtt+i-1); /* PCI Posting. */ | ||
884 | |||
885 | global_cache_flush(); | ||
886 | |||
887 | return 0; | 879 | return 0; |
888 | } | 880 | } |
889 | 881 | ||
@@ -945,6 +937,13 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem, | |||
945 | { | 937 | { |
946 | int ret = -EINVAL; | 938 | int ret = -EINVAL; |
947 | 939 | ||
940 | if (intel_private.clear_fake_agp) { | ||
941 | int start = intel_private.base.stolen_size / PAGE_SIZE; | ||
942 | int end = intel_private.base.gtt_mappable_entries; | ||
943 | intel_gtt_clear_range(start, end - start); | ||
944 | intel_private.clear_fake_agp = false; | ||
945 | } | ||
946 | |||
948 | if (INTEL_GTT_GEN == 1 && type == AGP_DCACHE_MEMORY) | 947 | if (INTEL_GTT_GEN == 1 && type == AGP_DCACHE_MEMORY) |
949 | return i810_insert_dcache_entries(mem, pg_start, type); | 948 | return i810_insert_dcache_entries(mem, pg_start, type); |
950 | 949 | ||
diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/char/bfin_jtag_comm.c index e397df3ad98e..16402445f2b2 100644 --- a/drivers/char/bfin_jtag_comm.c +++ b/drivers/char/bfin_jtag_comm.c | |||
@@ -183,16 +183,16 @@ bfin_jc_circ_write(const unsigned char *buf, int count) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | #ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE | 185 | #ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE |
186 | # define acquire_console_sem() | 186 | # define console_lock() |
187 | # define release_console_sem() | 187 | # define console_unlock() |
188 | #endif | 188 | #endif |
189 | static int | 189 | static int |
190 | bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count) | 190 | bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count) |
191 | { | 191 | { |
192 | int i; | 192 | int i; |
193 | acquire_console_sem(); | 193 | console_lock(); |
194 | i = bfin_jc_circ_write(buf, count); | 194 | i = bfin_jc_circ_write(buf, count); |
195 | release_console_sem(); | 195 | console_unlock(); |
196 | wake_up_process(bfin_jc_kthread); | 196 | wake_up_process(bfin_jc_kthread); |
197 | return i; | 197 | return i; |
198 | } | 198 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b6ae6e9a9c5f..7855f9f45b8e 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -320,6 +320,7 @@ static int unload_when_empty = 1; | |||
320 | static int add_smi(struct smi_info *smi); | 320 | static int add_smi(struct smi_info *smi); |
321 | static int try_smi_init(struct smi_info *smi); | 321 | static int try_smi_init(struct smi_info *smi); |
322 | static void cleanup_one_si(struct smi_info *to_clean); | 322 | static void cleanup_one_si(struct smi_info *to_clean); |
323 | static void cleanup_ipmi_si(void); | ||
323 | 324 | ||
324 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); | 325 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); |
325 | static int register_xaction_notifier(struct notifier_block *nb) | 326 | static int register_xaction_notifier(struct notifier_block *nb) |
@@ -3450,16 +3451,7 @@ static int __devinit init_ipmi_si(void) | |||
3450 | mutex_lock(&smi_infos_lock); | 3451 | mutex_lock(&smi_infos_lock); |
3451 | if (unload_when_empty && list_empty(&smi_infos)) { | 3452 | if (unload_when_empty && list_empty(&smi_infos)) { |
3452 | mutex_unlock(&smi_infos_lock); | 3453 | mutex_unlock(&smi_infos_lock); |
3453 | #ifdef CONFIG_PCI | 3454 | cleanup_ipmi_si(); |
3454 | if (pci_registered) | ||
3455 | pci_unregister_driver(&ipmi_pci_driver); | ||
3456 | #endif | ||
3457 | |||
3458 | #ifdef CONFIG_PPC_OF | ||
3459 | if (of_registered) | ||
3460 | of_unregister_platform_driver(&ipmi_of_platform_driver); | ||
3461 | #endif | ||
3462 | driver_unregister(&ipmi_driver.driver); | ||
3463 | printk(KERN_WARNING PFX | 3455 | printk(KERN_WARNING PFX |
3464 | "Unable to find any System Interface(s)\n"); | 3456 | "Unable to find any System Interface(s)\n"); |
3465 | return -ENODEV; | 3457 | return -ENODEV; |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 36e0fa161c2b..faf5a2c65926 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -577,9 +577,11 @@ duration: | |||
577 | if (rc) | 577 | if (rc) |
578 | return; | 578 | return; |
579 | 579 | ||
580 | if (be32_to_cpu(tpm_cmd.header.out.return_code) | 580 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
581 | != 3 * sizeof(u32)) | 581 | be32_to_cpu(tpm_cmd.header.out.length) |
582 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) | ||
582 | return; | 583 | return; |
584 | |||
583 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; | 585 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
584 | chip->vendor.duration[TPM_SHORT] = | 586 | chip->vendor.duration[TPM_SHORT] = |
585 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); | 587 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); |
@@ -939,6 +941,18 @@ ssize_t tpm_show_caps_1_2(struct device * dev, | |||
939 | } | 941 | } |
940 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); | 942 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); |
941 | 943 | ||
944 | ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr, | ||
945 | char *buf) | ||
946 | { | ||
947 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
948 | |||
949 | return sprintf(buf, "%d %d %d\n", | ||
950 | jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), | ||
951 | jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), | ||
952 | jiffies_to_usecs(chip->vendor.duration[TPM_LONG])); | ||
953 | } | ||
954 | EXPORT_SYMBOL_GPL(tpm_show_timeouts); | ||
955 | |||
942 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | 956 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, |
943 | const char *buf, size_t count) | 957 | const char *buf, size_t count) |
944 | { | 958 | { |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 72ddb031b69a..d84ff772c26f 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -56,6 +56,8 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, | |||
56 | char *); | 56 | char *); |
57 | extern ssize_t tpm_show_temp_deactivated(struct device *, | 57 | extern ssize_t tpm_show_temp_deactivated(struct device *, |
58 | struct device_attribute *attr, char *); | 58 | struct device_attribute *attr, char *); |
59 | extern ssize_t tpm_show_timeouts(struct device *, | ||
60 | struct device_attribute *attr, char *); | ||
59 | 61 | ||
60 | struct tpm_chip; | 62 | struct tpm_chip; |
61 | 63 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index dd21df55689d..0d1d38e5f266 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -376,6 +376,7 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, | |||
376 | NULL); | 376 | NULL); |
377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); | 377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); |
378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); | 378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); |
379 | static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); | ||
379 | 380 | ||
380 | static struct attribute *tis_attrs[] = { | 381 | static struct attribute *tis_attrs[] = { |
381 | &dev_attr_pubek.attr, | 382 | &dev_attr_pubek.attr, |
@@ -385,7 +386,8 @@ static struct attribute *tis_attrs[] = { | |||
385 | &dev_attr_owned.attr, | 386 | &dev_attr_owned.attr, |
386 | &dev_attr_temp_deactivated.attr, | 387 | &dev_attr_temp_deactivated.attr, |
387 | &dev_attr_caps.attr, | 388 | &dev_attr_caps.attr, |
388 | &dev_attr_cancel.attr, NULL, | 389 | &dev_attr_cancel.attr, |
390 | &dev_attr_timeouts.attr, NULL, | ||
389 | }; | 391 | }; |
390 | 392 | ||
391 | static struct attribute_group tis_attr_grp = { | 393 | static struct attribute_group tis_attr_grp = { |
diff --git a/drivers/tty/hvc/virtio_console.c b/drivers/char/virtio_console.c index 896a2ced1d27..490393186338 100644 --- a/drivers/tty/hvc/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006, 2007, 2009 Rusty Russell, IBM Corporation | 2 | * Copyright (C) 2006, 2007, 2009 Rusty Russell, IBM Corporation |
3 | * Copyright (C) 2009, 2010 Red Hat, Inc. | 3 | * Copyright (C) 2009, 2010, 2011 Red Hat, Inc. |
4 | * Copyright (C) 2009, 2010, 2011 Amit Shah <amit.shah@redhat.com> | ||
4 | * | 5 | * |
5 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -31,7 +32,7 @@ | |||
31 | #include <linux/virtio_console.h> | 32 | #include <linux/virtio_console.h> |
32 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
33 | #include <linux/workqueue.h> | 34 | #include <linux/workqueue.h> |
34 | #include "hvc_console.h" | 35 | #include "../tty/hvc/hvc_console.h" |
35 | 36 | ||
36 | /* | 37 | /* |
37 | * This is a global struct for storing common data for all the devices | 38 | * This is a global struct for storing common data for all the devices |
@@ -1462,6 +1463,17 @@ static void control_work_handler(struct work_struct *work) | |||
1462 | spin_unlock(&portdev->cvq_lock); | 1463 | spin_unlock(&portdev->cvq_lock); |
1463 | } | 1464 | } |
1464 | 1465 | ||
1466 | static void out_intr(struct virtqueue *vq) | ||
1467 | { | ||
1468 | struct port *port; | ||
1469 | |||
1470 | port = find_port_by_vq(vq->vdev->priv, vq); | ||
1471 | if (!port) | ||
1472 | return; | ||
1473 | |||
1474 | wake_up_interruptible(&port->waitqueue); | ||
1475 | } | ||
1476 | |||
1465 | static void in_intr(struct virtqueue *vq) | 1477 | static void in_intr(struct virtqueue *vq) |
1466 | { | 1478 | { |
1467 | struct port *port; | 1479 | struct port *port; |
@@ -1566,7 +1578,7 @@ static int init_vqs(struct ports_device *portdev) | |||
1566 | */ | 1578 | */ |
1567 | j = 0; | 1579 | j = 0; |
1568 | io_callbacks[j] = in_intr; | 1580 | io_callbacks[j] = in_intr; |
1569 | io_callbacks[j + 1] = NULL; | 1581 | io_callbacks[j + 1] = out_intr; |
1570 | io_names[j] = "input"; | 1582 | io_names[j] = "input"; |
1571 | io_names[j + 1] = "output"; | 1583 | io_names[j + 1] = "output"; |
1572 | j += 2; | 1584 | j += 2; |
@@ -1580,7 +1592,7 @@ static int init_vqs(struct ports_device *portdev) | |||
1580 | for (i = 1; i < nr_ports; i++) { | 1592 | for (i = 1; i < nr_ports; i++) { |
1581 | j += 2; | 1593 | j += 2; |
1582 | io_callbacks[j] = in_intr; | 1594 | io_callbacks[j] = in_intr; |
1583 | io_callbacks[j + 1] = NULL; | 1595 | io_callbacks[j + 1] = out_intr; |
1584 | io_names[j] = "input"; | 1596 | io_names[j] = "input"; |
1585 | io_names[j + 1] = "output"; | 1597 | io_names[j + 1] = "output"; |
1586 | } | 1598 | } |
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c index 01b886e68822..79c47e88d5d1 100644 --- a/drivers/clocksource/tcb_clksrc.c +++ b/drivers/clocksource/tcb_clksrc.c | |||
@@ -196,9 +196,9 @@ static void __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) | |||
196 | clkevt.clkevt.min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; | 196 | clkevt.clkevt.min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; |
197 | clkevt.clkevt.cpumask = cpumask_of(0); | 197 | clkevt.clkevt.cpumask = cpumask_of(0); |
198 | 198 | ||
199 | setup_irq(irq, &tc_irqaction); | ||
200 | |||
201 | clockevents_register_device(&clkevt.clkevt); | 199 | clockevents_register_device(&clkevt.clkevt); |
200 | |||
201 | setup_irq(irq, &tc_irqaction); | ||
202 | } | 202 | } |
203 | 203 | ||
204 | #else /* !CONFIG_GENERIC_CLOCKEVENTS */ | 204 | #else /* !CONFIG_GENERIC_CLOCKEVENTS */ |
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 297f48b0cba9..07bca4970e50 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #include <linux/module.h> | 79 | #include <linux/module.h> |
80 | #include <linux/interrupt.h> | 80 | #include <linux/interrupt.h> |
81 | #include <linux/slab.h> | 81 | #include <linux/slab.h> |
82 | #include <linux/delay.h> | ||
82 | #include <linux/dmapool.h> | 83 | #include <linux/dmapool.h> |
83 | #include <linux/dmaengine.h> | 84 | #include <linux/dmaengine.h> |
84 | #include <linux/amba/bus.h> | 85 | #include <linux/amba/bus.h> |
@@ -235,16 +236,19 @@ static void pl08x_start_txd(struct pl08x_dma_chan *plchan, | |||
235 | } | 236 | } |
236 | 237 | ||
237 | /* | 238 | /* |
238 | * Overall DMAC remains enabled always. | 239 | * Pause the channel by setting the HALT bit. |
239 | * | 240 | * |
240 | * Disabling individual channels could lose data. | 241 | * For M->P transfers, pause the DMAC first and then stop the peripheral - |
242 | * the FIFO can only drain if the peripheral is still requesting data. | ||
243 | * (note: this can still timeout if the DMAC FIFO never drains of data.) | ||
241 | * | 244 | * |
242 | * Disable the peripheral DMA after disabling the DMAC in order to allow | 245 | * For P->M transfers, disable the peripheral first to stop it filling |
243 | * the DMAC FIFO to drain, and hence allow the channel to show inactive | 246 | * the DMAC FIFO, and then pause the DMAC. |
244 | */ | 247 | */ |
245 | static void pl08x_pause_phy_chan(struct pl08x_phy_chan *ch) | 248 | static void pl08x_pause_phy_chan(struct pl08x_phy_chan *ch) |
246 | { | 249 | { |
247 | u32 val; | 250 | u32 val; |
251 | int timeout; | ||
248 | 252 | ||
249 | /* Set the HALT bit and wait for the FIFO to drain */ | 253 | /* Set the HALT bit and wait for the FIFO to drain */ |
250 | val = readl(ch->base + PL080_CH_CONFIG); | 254 | val = readl(ch->base + PL080_CH_CONFIG); |
@@ -252,8 +256,13 @@ static void pl08x_pause_phy_chan(struct pl08x_phy_chan *ch) | |||
252 | writel(val, ch->base + PL080_CH_CONFIG); | 256 | writel(val, ch->base + PL080_CH_CONFIG); |
253 | 257 | ||
254 | /* Wait for channel inactive */ | 258 | /* Wait for channel inactive */ |
255 | while (pl08x_phy_channel_busy(ch)) | 259 | for (timeout = 1000; timeout; timeout--) { |
256 | cpu_relax(); | 260 | if (!pl08x_phy_channel_busy(ch)) |
261 | break; | ||
262 | udelay(1); | ||
263 | } | ||
264 | if (pl08x_phy_channel_busy(ch)) | ||
265 | pr_err("pl08x: channel%u timeout waiting for pause\n", ch->id); | ||
257 | } | 266 | } |
258 | 267 | ||
259 | static void pl08x_resume_phy_chan(struct pl08x_phy_chan *ch) | 268 | static void pl08x_resume_phy_chan(struct pl08x_phy_chan *ch) |
@@ -267,19 +276,24 @@ static void pl08x_resume_phy_chan(struct pl08x_phy_chan *ch) | |||
267 | } | 276 | } |
268 | 277 | ||
269 | 278 | ||
270 | /* Stops the channel */ | 279 | /* |
271 | static void pl08x_stop_phy_chan(struct pl08x_phy_chan *ch) | 280 | * pl08x_terminate_phy_chan() stops the channel, clears the FIFO and |
281 | * clears any pending interrupt status. This should not be used for | ||
282 | * an on-going transfer, but as a method of shutting down a channel | ||
283 | * (eg, when it's no longer used) or terminating a transfer. | ||
284 | */ | ||
285 | static void pl08x_terminate_phy_chan(struct pl08x_driver_data *pl08x, | ||
286 | struct pl08x_phy_chan *ch) | ||
272 | { | 287 | { |
273 | u32 val; | 288 | u32 val = readl(ch->base + PL080_CH_CONFIG); |
274 | 289 | ||
275 | pl08x_pause_phy_chan(ch); | 290 | val &= ~(PL080_CONFIG_ENABLE | PL080_CONFIG_ERR_IRQ_MASK | |
291 | PL080_CONFIG_TC_IRQ_MASK); | ||
276 | 292 | ||
277 | /* Disable channel */ | ||
278 | val = readl(ch->base + PL080_CH_CONFIG); | ||
279 | val &= ~PL080_CONFIG_ENABLE; | ||
280 | val &= ~PL080_CONFIG_ERR_IRQ_MASK; | ||
281 | val &= ~PL080_CONFIG_TC_IRQ_MASK; | ||
282 | writel(val, ch->base + PL080_CH_CONFIG); | 293 | writel(val, ch->base + PL080_CH_CONFIG); |
294 | |||
295 | writel(1 << ch->id, pl08x->base + PL080_ERR_CLEAR); | ||
296 | writel(1 << ch->id, pl08x->base + PL080_TC_CLEAR); | ||
283 | } | 297 | } |
284 | 298 | ||
285 | static inline u32 get_bytes_in_cctl(u32 cctl) | 299 | static inline u32 get_bytes_in_cctl(u32 cctl) |
@@ -404,13 +418,12 @@ static inline void pl08x_put_phy_channel(struct pl08x_driver_data *pl08x, | |||
404 | { | 418 | { |
405 | unsigned long flags; | 419 | unsigned long flags; |
406 | 420 | ||
421 | spin_lock_irqsave(&ch->lock, flags); | ||
422 | |||
407 | /* Stop the channel and clear its interrupts */ | 423 | /* Stop the channel and clear its interrupts */ |
408 | pl08x_stop_phy_chan(ch); | 424 | pl08x_terminate_phy_chan(pl08x, ch); |
409 | writel((1 << ch->id), pl08x->base + PL080_ERR_CLEAR); | ||
410 | writel((1 << ch->id), pl08x->base + PL080_TC_CLEAR); | ||
411 | 425 | ||
412 | /* Mark it as free */ | 426 | /* Mark it as free */ |
413 | spin_lock_irqsave(&ch->lock, flags); | ||
414 | ch->serving = NULL; | 427 | ch->serving = NULL; |
415 | spin_unlock_irqrestore(&ch->lock, flags); | 428 | spin_unlock_irqrestore(&ch->lock, flags); |
416 | } | 429 | } |
@@ -1449,7 +1462,7 @@ static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
1449 | plchan->state = PL08X_CHAN_IDLE; | 1462 | plchan->state = PL08X_CHAN_IDLE; |
1450 | 1463 | ||
1451 | if (plchan->phychan) { | 1464 | if (plchan->phychan) { |
1452 | pl08x_stop_phy_chan(plchan->phychan); | 1465 | pl08x_terminate_phy_chan(pl08x, plchan->phychan); |
1453 | 1466 | ||
1454 | /* | 1467 | /* |
1455 | * Mark physical channel as free and free any slave | 1468 | * Mark physical channel as free and free any slave |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index e53d438142bb..e18eaabe92b9 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -49,6 +49,7 @@ struct imxdma_channel { | |||
49 | 49 | ||
50 | struct imxdma_engine { | 50 | struct imxdma_engine { |
51 | struct device *dev; | 51 | struct device *dev; |
52 | struct device_dma_parameters dma_parms; | ||
52 | struct dma_device dma_device; | 53 | struct dma_device dma_device; |
53 | struct imxdma_channel channel[MAX_DMA_CHANNELS]; | 54 | struct imxdma_channel channel[MAX_DMA_CHANNELS]; |
54 | }; | 55 | }; |
@@ -242,6 +243,21 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( | |||
242 | else | 243 | else |
243 | dmamode = DMA_MODE_WRITE; | 244 | dmamode = DMA_MODE_WRITE; |
244 | 245 | ||
246 | switch (imxdmac->word_size) { | ||
247 | case DMA_SLAVE_BUSWIDTH_4_BYTES: | ||
248 | if (sgl->length & 3 || sgl->dma_address & 3) | ||
249 | return NULL; | ||
250 | break; | ||
251 | case DMA_SLAVE_BUSWIDTH_2_BYTES: | ||
252 | if (sgl->length & 1 || sgl->dma_address & 1) | ||
253 | return NULL; | ||
254 | break; | ||
255 | case DMA_SLAVE_BUSWIDTH_1_BYTE: | ||
256 | break; | ||
257 | default: | ||
258 | return NULL; | ||
259 | } | ||
260 | |||
245 | ret = imx_dma_setup_sg(imxdmac->imxdma_channel, sgl, sg_len, | 261 | ret = imx_dma_setup_sg(imxdmac->imxdma_channel, sgl, sg_len, |
246 | dma_length, imxdmac->per_address, dmamode); | 262 | dma_length, imxdmac->per_address, dmamode); |
247 | if (ret) | 263 | if (ret) |
@@ -329,6 +345,9 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
329 | 345 | ||
330 | INIT_LIST_HEAD(&imxdma->dma_device.channels); | 346 | INIT_LIST_HEAD(&imxdma->dma_device.channels); |
331 | 347 | ||
348 | dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask); | ||
349 | dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask); | ||
350 | |||
332 | /* Initialize channel parameters */ | 351 | /* Initialize channel parameters */ |
333 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { | 352 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { |
334 | struct imxdma_channel *imxdmac = &imxdma->channel[i]; | 353 | struct imxdma_channel *imxdmac = &imxdma->channel[i]; |
@@ -346,11 +365,7 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
346 | imxdmac->imxdma = imxdma; | 365 | imxdmac->imxdma = imxdma; |
347 | spin_lock_init(&imxdmac->lock); | 366 | spin_lock_init(&imxdmac->lock); |
348 | 367 | ||
349 | dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask); | ||
350 | dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask); | ||
351 | |||
352 | imxdmac->chan.device = &imxdma->dma_device; | 368 | imxdmac->chan.device = &imxdma->dma_device; |
353 | imxdmac->chan.chan_id = i; | ||
354 | imxdmac->channel = i; | 369 | imxdmac->channel = i; |
355 | 370 | ||
356 | /* Add the channel to the DMAC list */ | 371 | /* Add the channel to the DMAC list */ |
@@ -370,6 +385,9 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
370 | 385 | ||
371 | platform_set_drvdata(pdev, imxdma); | 386 | platform_set_drvdata(pdev, imxdma); |
372 | 387 | ||
388 | imxdma->dma_device.dev->dma_parms = &imxdma->dma_parms; | ||
389 | dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff); | ||
390 | |||
373 | ret = dma_async_device_register(&imxdma->dma_device); | 391 | ret = dma_async_device_register(&imxdma->dma_device); |
374 | if (ret) { | 392 | if (ret) { |
375 | dev_err(&pdev->dev, "unable to register\n"); | 393 | dev_err(&pdev->dev, "unable to register\n"); |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index d5a5d4d9c19b..b6d1455fa936 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -230,7 +230,7 @@ struct sdma_engine; | |||
230 | * struct sdma_channel - housekeeping for a SDMA channel | 230 | * struct sdma_channel - housekeeping for a SDMA channel |
231 | * | 231 | * |
232 | * @sdma pointer to the SDMA engine for this channel | 232 | * @sdma pointer to the SDMA engine for this channel |
233 | * @channel the channel number, matches dmaengine chan_id | 233 | * @channel the channel number, matches dmaengine chan_id + 1 |
234 | * @direction transfer type. Needed for setting SDMA script | 234 | * @direction transfer type. Needed for setting SDMA script |
235 | * @peripheral_type Peripheral type. Needed for setting SDMA script | 235 | * @peripheral_type Peripheral type. Needed for setting SDMA script |
236 | * @event_id0 aka dma request line | 236 | * @event_id0 aka dma request line |
@@ -301,6 +301,7 @@ struct sdma_firmware_header { | |||
301 | 301 | ||
302 | struct sdma_engine { | 302 | struct sdma_engine { |
303 | struct device *dev; | 303 | struct device *dev; |
304 | struct device_dma_parameters dma_parms; | ||
304 | struct sdma_channel channel[MAX_DMA_CHANNELS]; | 305 | struct sdma_channel channel[MAX_DMA_CHANNELS]; |
305 | struct sdma_channel_control *channel_control; | 306 | struct sdma_channel_control *channel_control; |
306 | void __iomem *regs; | 307 | void __iomem *regs; |
@@ -449,7 +450,7 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac) | |||
449 | if (bd->mode.status & BD_RROR) | 450 | if (bd->mode.status & BD_RROR) |
450 | sdmac->status = DMA_ERROR; | 451 | sdmac->status = DMA_ERROR; |
451 | else | 452 | else |
452 | sdmac->status = DMA_SUCCESS; | 453 | sdmac->status = DMA_IN_PROGRESS; |
453 | 454 | ||
454 | bd->mode.status |= BD_DONE; | 455 | bd->mode.status |= BD_DONE; |
455 | sdmac->buf_tail++; | 456 | sdmac->buf_tail++; |
@@ -770,15 +771,15 @@ static void sdma_enable_channel(struct sdma_engine *sdma, int channel) | |||
770 | __raw_writel(1 << channel, sdma->regs + SDMA_H_START); | 771 | __raw_writel(1 << channel, sdma->regs + SDMA_H_START); |
771 | } | 772 | } |
772 | 773 | ||
773 | static dma_cookie_t sdma_assign_cookie(struct sdma_channel *sdma) | 774 | static dma_cookie_t sdma_assign_cookie(struct sdma_channel *sdmac) |
774 | { | 775 | { |
775 | dma_cookie_t cookie = sdma->chan.cookie; | 776 | dma_cookie_t cookie = sdmac->chan.cookie; |
776 | 777 | ||
777 | if (++cookie < 0) | 778 | if (++cookie < 0) |
778 | cookie = 1; | 779 | cookie = 1; |
779 | 780 | ||
780 | sdma->chan.cookie = cookie; | 781 | sdmac->chan.cookie = cookie; |
781 | sdma->desc.cookie = cookie; | 782 | sdmac->desc.cookie = cookie; |
782 | 783 | ||
783 | return cookie; | 784 | return cookie; |
784 | } | 785 | } |
@@ -798,7 +799,7 @@ static dma_cookie_t sdma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
798 | 799 | ||
799 | cookie = sdma_assign_cookie(sdmac); | 800 | cookie = sdma_assign_cookie(sdmac); |
800 | 801 | ||
801 | sdma_enable_channel(sdma, tx->chan->chan_id); | 802 | sdma_enable_channel(sdma, sdmac->channel); |
802 | 803 | ||
803 | spin_unlock_irq(&sdmac->lock); | 804 | spin_unlock_irq(&sdmac->lock); |
804 | 805 | ||
@@ -811,10 +812,6 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan) | |||
811 | struct imx_dma_data *data = chan->private; | 812 | struct imx_dma_data *data = chan->private; |
812 | int prio, ret; | 813 | int prio, ret; |
813 | 814 | ||
814 | /* No need to execute this for internal channel 0 */ | ||
815 | if (chan->chan_id == 0) | ||
816 | return 0; | ||
817 | |||
818 | if (!data) | 815 | if (!data) |
819 | return -EINVAL; | 816 | return -EINVAL; |
820 | 817 | ||
@@ -879,7 +876,7 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg( | |||
879 | struct sdma_channel *sdmac = to_sdma_chan(chan); | 876 | struct sdma_channel *sdmac = to_sdma_chan(chan); |
880 | struct sdma_engine *sdma = sdmac->sdma; | 877 | struct sdma_engine *sdma = sdmac->sdma; |
881 | int ret, i, count; | 878 | int ret, i, count; |
882 | int channel = chan->chan_id; | 879 | int channel = sdmac->channel; |
883 | struct scatterlist *sg; | 880 | struct scatterlist *sg; |
884 | 881 | ||
885 | if (sdmac->status == DMA_IN_PROGRESS) | 882 | if (sdmac->status == DMA_IN_PROGRESS) |
@@ -924,22 +921,33 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg( | |||
924 | ret = -EINVAL; | 921 | ret = -EINVAL; |
925 | goto err_out; | 922 | goto err_out; |
926 | } | 923 | } |
927 | if (sdmac->word_size == DMA_SLAVE_BUSWIDTH_4_BYTES) | 924 | |
925 | switch (sdmac->word_size) { | ||
926 | case DMA_SLAVE_BUSWIDTH_4_BYTES: | ||
928 | bd->mode.command = 0; | 927 | bd->mode.command = 0; |
929 | else | 928 | if (count & 3 || sg->dma_address & 3) |
930 | bd->mode.command = sdmac->word_size; | 929 | return NULL; |
930 | break; | ||
931 | case DMA_SLAVE_BUSWIDTH_2_BYTES: | ||
932 | bd->mode.command = 2; | ||
933 | if (count & 1 || sg->dma_address & 1) | ||
934 | return NULL; | ||
935 | break; | ||
936 | case DMA_SLAVE_BUSWIDTH_1_BYTE: | ||
937 | bd->mode.command = 1; | ||
938 | break; | ||
939 | default: | ||
940 | return NULL; | ||
941 | } | ||
931 | 942 | ||
932 | param = BD_DONE | BD_EXTD | BD_CONT; | 943 | param = BD_DONE | BD_EXTD | BD_CONT; |
933 | 944 | ||
934 | if (sdmac->flags & IMX_DMA_SG_LOOP) { | 945 | if (i + 1 == sg_len) { |
935 | param |= BD_INTR; | 946 | param |= BD_INTR; |
936 | if (i + 1 == sg_len) | 947 | param |= BD_LAST; |
937 | param |= BD_WRAP; | 948 | param &= ~BD_CONT; |
938 | } | 949 | } |
939 | 950 | ||
940 | if (i + 1 == sg_len) | ||
941 | param |= BD_INTR; | ||
942 | |||
943 | dev_dbg(sdma->dev, "entry %d: count: %d dma: 0x%08x %s%s\n", | 951 | dev_dbg(sdma->dev, "entry %d: count: %d dma: 0x%08x %s%s\n", |
944 | i, count, sg->dma_address, | 952 | i, count, sg->dma_address, |
945 | param & BD_WRAP ? "wrap" : "", | 953 | param & BD_WRAP ? "wrap" : "", |
@@ -953,6 +961,7 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg( | |||
953 | 961 | ||
954 | return &sdmac->desc; | 962 | return &sdmac->desc; |
955 | err_out: | 963 | err_out: |
964 | sdmac->status = DMA_ERROR; | ||
956 | return NULL; | 965 | return NULL; |
957 | } | 966 | } |
958 | 967 | ||
@@ -963,7 +972,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( | |||
963 | struct sdma_channel *sdmac = to_sdma_chan(chan); | 972 | struct sdma_channel *sdmac = to_sdma_chan(chan); |
964 | struct sdma_engine *sdma = sdmac->sdma; | 973 | struct sdma_engine *sdma = sdmac->sdma; |
965 | int num_periods = buf_len / period_len; | 974 | int num_periods = buf_len / period_len; |
966 | int channel = chan->chan_id; | 975 | int channel = sdmac->channel; |
967 | int ret, i = 0, buf = 0; | 976 | int ret, i = 0, buf = 0; |
968 | 977 | ||
969 | dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel); | 978 | dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel); |
@@ -1066,14 +1075,12 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan, | |||
1066 | { | 1075 | { |
1067 | struct sdma_channel *sdmac = to_sdma_chan(chan); | 1076 | struct sdma_channel *sdmac = to_sdma_chan(chan); |
1068 | dma_cookie_t last_used; | 1077 | dma_cookie_t last_used; |
1069 | enum dma_status ret; | ||
1070 | 1078 | ||
1071 | last_used = chan->cookie; | 1079 | last_used = chan->cookie; |
1072 | 1080 | ||
1073 | ret = dma_async_is_complete(cookie, sdmac->last_completed, last_used); | ||
1074 | dma_set_tx_state(txstate, sdmac->last_completed, last_used, 0); | 1081 | dma_set_tx_state(txstate, sdmac->last_completed, last_used, 0); |
1075 | 1082 | ||
1076 | return ret; | 1083 | return sdmac->status; |
1077 | } | 1084 | } |
1078 | 1085 | ||
1079 | static void sdma_issue_pending(struct dma_chan *chan) | 1086 | static void sdma_issue_pending(struct dma_chan *chan) |
@@ -1135,7 +1142,7 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma, | |||
1135 | /* download the RAM image for SDMA */ | 1142 | /* download the RAM image for SDMA */ |
1136 | sdma_load_script(sdma, ram_code, | 1143 | sdma_load_script(sdma, ram_code, |
1137 | header->ram_code_size, | 1144 | header->ram_code_size, |
1138 | sdma->script_addrs->ram_code_start_addr); | 1145 | addr->ram_code_start_addr); |
1139 | clk_disable(sdma->clk); | 1146 | clk_disable(sdma->clk); |
1140 | 1147 | ||
1141 | sdma_add_scripts(sdma, addr); | 1148 | sdma_add_scripts(sdma, addr); |
@@ -1237,7 +1244,6 @@ static int __init sdma_probe(struct platform_device *pdev) | |||
1237 | struct resource *iores; | 1244 | struct resource *iores; |
1238 | struct sdma_platform_data *pdata = pdev->dev.platform_data; | 1245 | struct sdma_platform_data *pdata = pdev->dev.platform_data; |
1239 | int i; | 1246 | int i; |
1240 | dma_cap_mask_t mask; | ||
1241 | struct sdma_engine *sdma; | 1247 | struct sdma_engine *sdma; |
1242 | 1248 | ||
1243 | sdma = kzalloc(sizeof(*sdma), GFP_KERNEL); | 1249 | sdma = kzalloc(sizeof(*sdma), GFP_KERNEL); |
@@ -1280,6 +1286,9 @@ static int __init sdma_probe(struct platform_device *pdev) | |||
1280 | 1286 | ||
1281 | sdma->version = pdata->sdma_version; | 1287 | sdma->version = pdata->sdma_version; |
1282 | 1288 | ||
1289 | dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask); | ||
1290 | dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask); | ||
1291 | |||
1283 | INIT_LIST_HEAD(&sdma->dma_device.channels); | 1292 | INIT_LIST_HEAD(&sdma->dma_device.channels); |
1284 | /* Initialize channel parameters */ | 1293 | /* Initialize channel parameters */ |
1285 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { | 1294 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { |
@@ -1288,15 +1297,17 @@ static int __init sdma_probe(struct platform_device *pdev) | |||
1288 | sdmac->sdma = sdma; | 1297 | sdmac->sdma = sdma; |
1289 | spin_lock_init(&sdmac->lock); | 1298 | spin_lock_init(&sdmac->lock); |
1290 | 1299 | ||
1291 | dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask); | ||
1292 | dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask); | ||
1293 | |||
1294 | sdmac->chan.device = &sdma->dma_device; | 1300 | sdmac->chan.device = &sdma->dma_device; |
1295 | sdmac->chan.chan_id = i; | ||
1296 | sdmac->channel = i; | 1301 | sdmac->channel = i; |
1297 | 1302 | ||
1298 | /* Add the channel to the DMAC list */ | 1303 | /* |
1299 | list_add_tail(&sdmac->chan.device_node, &sdma->dma_device.channels); | 1304 | * Add the channel to the DMAC list. Do not add channel 0 though |
1305 | * because we need it internally in the SDMA driver. This also means | ||
1306 | * that channel 0 in dmaengine counting matches sdma channel 1. | ||
1307 | */ | ||
1308 | if (i) | ||
1309 | list_add_tail(&sdmac->chan.device_node, | ||
1310 | &sdma->dma_device.channels); | ||
1300 | } | 1311 | } |
1301 | 1312 | ||
1302 | ret = sdma_init(sdma); | 1313 | ret = sdma_init(sdma); |
@@ -1317,6 +1328,8 @@ static int __init sdma_probe(struct platform_device *pdev) | |||
1317 | sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic; | 1328 | sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic; |
1318 | sdma->dma_device.device_control = sdma_control; | 1329 | sdma->dma_device.device_control = sdma_control; |
1319 | sdma->dma_device.device_issue_pending = sdma_issue_pending; | 1330 | sdma->dma_device.device_issue_pending = sdma_issue_pending; |
1331 | sdma->dma_device.dev->dma_parms = &sdma->dma_parms; | ||
1332 | dma_set_max_seg_size(sdma->dma_device.dev, 65535); | ||
1320 | 1333 | ||
1321 | ret = dma_async_device_register(&sdma->dma_device); | 1334 | ret = dma_async_device_register(&sdma->dma_device); |
1322 | if (ret) { | 1335 | if (ret) { |
@@ -1324,13 +1337,6 @@ static int __init sdma_probe(struct platform_device *pdev) | |||
1324 | goto err_init; | 1337 | goto err_init; |
1325 | } | 1338 | } |
1326 | 1339 | ||
1327 | /* request channel 0. This is an internal control channel | ||
1328 | * to the SDMA engine and not available to clients. | ||
1329 | */ | ||
1330 | dma_cap_zero(mask); | ||
1331 | dma_cap_set(DMA_SLAVE, mask); | ||
1332 | dma_request_channel(mask, NULL, NULL); | ||
1333 | |||
1334 | dev_info(sdma->dev, "initialized\n"); | 1340 | dev_info(sdma->dev, "initialized\n"); |
1335 | 1341 | ||
1336 | return 0; | 1342 | return 0; |
@@ -1348,7 +1354,7 @@ err_clk: | |||
1348 | err_request_region: | 1354 | err_request_region: |
1349 | err_irq: | 1355 | err_irq: |
1350 | kfree(sdma); | 1356 | kfree(sdma); |
1351 | return 0; | 1357 | return ret; |
1352 | } | 1358 | } |
1353 | 1359 | ||
1354 | static int __exit sdma_remove(struct platform_device *pdev) | 1360 | static int __exit sdma_remove(struct platform_device *pdev) |
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c index cb26ee9773d6..c1a125e7d1df 100644 --- a/drivers/dma/ipu/ipu_idmac.c +++ b/drivers/dma/ipu/ipu_idmac.c | |||
@@ -1145,29 +1145,6 @@ static int ipu_disable_channel(struct idmac *idmac, struct idmac_channel *ichan, | |||
1145 | reg = idmac_read_icreg(ipu, IDMAC_CHA_EN); | 1145 | reg = idmac_read_icreg(ipu, IDMAC_CHA_EN); |
1146 | idmac_write_icreg(ipu, reg & ~chan_mask, IDMAC_CHA_EN); | 1146 | idmac_write_icreg(ipu, reg & ~chan_mask, IDMAC_CHA_EN); |
1147 | 1147 | ||
1148 | /* | ||
1149 | * Problem (observed with channel DMAIC_7): after enabling the channel | ||
1150 | * and initialising buffers, there comes an interrupt with current still | ||
1151 | * pointing at buffer 0, whereas it should use buffer 0 first and only | ||
1152 | * generate an interrupt when it is done, then current should already | ||
1153 | * point to buffer 1. This spurious interrupt also comes on channel | ||
1154 | * DMASDC_0. With DMAIC_7 normally, is we just leave the ISR after the | ||
1155 | * first interrupt, there comes the second with current correctly | ||
1156 | * pointing to buffer 1 this time. But sometimes this second interrupt | ||
1157 | * doesn't come and the channel hangs. Clearing BUFx_RDY when disabling | ||
1158 | * the channel seems to prevent the channel from hanging, but it doesn't | ||
1159 | * prevent the spurious interrupt. This might also be unsafe. Think | ||
1160 | * about the IDMAC controller trying to switch to a buffer, when we | ||
1161 | * clear the ready bit, and re-enable it a moment later. | ||
1162 | */ | ||
1163 | reg = idmac_read_ipureg(ipu, IPU_CHA_BUF0_RDY); | ||
1164 | idmac_write_ipureg(ipu, 0, IPU_CHA_BUF0_RDY); | ||
1165 | idmac_write_ipureg(ipu, reg & ~(1UL << channel), IPU_CHA_BUF0_RDY); | ||
1166 | |||
1167 | reg = idmac_read_ipureg(ipu, IPU_CHA_BUF1_RDY); | ||
1168 | idmac_write_ipureg(ipu, 0, IPU_CHA_BUF1_RDY); | ||
1169 | idmac_write_ipureg(ipu, reg & ~(1UL << channel), IPU_CHA_BUF1_RDY); | ||
1170 | |||
1171 | spin_unlock_irqrestore(&ipu->lock, flags); | 1148 | spin_unlock_irqrestore(&ipu->lock, flags); |
1172 | 1149 | ||
1173 | return 0; | 1150 | return 0; |
@@ -1246,33 +1223,6 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id) | |||
1246 | 1223 | ||
1247 | /* Other interrupts do not interfere with this channel */ | 1224 | /* Other interrupts do not interfere with this channel */ |
1248 | spin_lock(&ichan->lock); | 1225 | spin_lock(&ichan->lock); |
1249 | if (unlikely(chan_id != IDMAC_SDC_0 && chan_id != IDMAC_SDC_1 && | ||
1250 | ((curbuf >> chan_id) & 1) == ichan->active_buffer && | ||
1251 | !list_is_last(ichan->queue.next, &ichan->queue))) { | ||
1252 | int i = 100; | ||
1253 | |||
1254 | /* This doesn't help. See comment in ipu_disable_channel() */ | ||
1255 | while (--i) { | ||
1256 | curbuf = idmac_read_ipureg(&ipu_data, IPU_CHA_CUR_BUF); | ||
1257 | if (((curbuf >> chan_id) & 1) != ichan->active_buffer) | ||
1258 | break; | ||
1259 | cpu_relax(); | ||
1260 | } | ||
1261 | |||
1262 | if (!i) { | ||
1263 | spin_unlock(&ichan->lock); | ||
1264 | dev_dbg(dev, | ||
1265 | "IRQ on active buffer on channel %x, active " | ||
1266 | "%d, ready %x, %x, current %x!\n", chan_id, | ||
1267 | ichan->active_buffer, ready0, ready1, curbuf); | ||
1268 | return IRQ_NONE; | ||
1269 | } else | ||
1270 | dev_dbg(dev, | ||
1271 | "Buffer deactivated on channel %x, active " | ||
1272 | "%d, ready %x, %x, current %x, rest %d!\n", chan_id, | ||
1273 | ichan->active_buffer, ready0, ready1, curbuf, i); | ||
1274 | } | ||
1275 | |||
1276 | if (unlikely((ichan->active_buffer && (ready1 >> chan_id) & 1) || | 1226 | if (unlikely((ichan->active_buffer && (ready1 >> chan_id) & 1) || |
1277 | (!ichan->active_buffer && (ready0 >> chan_id) & 1) | 1227 | (!ichan->active_buffer && (ready0 >> chan_id) & 1) |
1278 | )) { | 1228 | )) { |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 4a5ecc58025d..23e03554f0d3 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -826,8 +826,6 @@ static void amd64_dump_dramcfg_low(u32 dclr, int chan) | |||
826 | /* Display and decode various NB registers for debug purposes. */ | 826 | /* Display and decode various NB registers for debug purposes. */ |
827 | static void amd64_dump_misc_regs(struct amd64_pvt *pvt) | 827 | static void amd64_dump_misc_regs(struct amd64_pvt *pvt) |
828 | { | 828 | { |
829 | int ganged; | ||
830 | |||
831 | debugf1("F3xE8 (NB Cap): 0x%08x\n", pvt->nbcap); | 829 | debugf1("F3xE8 (NB Cap): 0x%08x\n", pvt->nbcap); |
832 | 830 | ||
833 | debugf1(" NB two channel DRAM capable: %s\n", | 831 | debugf1(" NB two channel DRAM capable: %s\n", |
@@ -851,28 +849,19 @@ static void amd64_dump_misc_regs(struct amd64_pvt *pvt) | |||
851 | debugf1(" DramHoleValid: %s\n", | 849 | debugf1(" DramHoleValid: %s\n", |
852 | (pvt->dhar & DHAR_VALID) ? "yes" : "no"); | 850 | (pvt->dhar & DHAR_VALID) ? "yes" : "no"); |
853 | 851 | ||
852 | amd64_debug_display_dimm_sizes(0, pvt); | ||
853 | |||
854 | /* everything below this point is Fam10h and above */ | 854 | /* everything below this point is Fam10h and above */ |
855 | if (boot_cpu_data.x86 == 0xf) { | 855 | if (boot_cpu_data.x86 == 0xf) |
856 | amd64_debug_display_dimm_sizes(0, pvt); | ||
857 | return; | 856 | return; |
858 | } | 857 | |
858 | amd64_debug_display_dimm_sizes(1, pvt); | ||
859 | 859 | ||
860 | amd64_info("using %s syndromes.\n", ((pvt->syn_type == 8) ? "x8" : "x4")); | 860 | amd64_info("using %s syndromes.\n", ((pvt->syn_type == 8) ? "x8" : "x4")); |
861 | 861 | ||
862 | /* Only if NOT ganged does dclr1 have valid info */ | 862 | /* Only if NOT ganged does dclr1 have valid info */ |
863 | if (!dct_ganging_enabled(pvt)) | 863 | if (!dct_ganging_enabled(pvt)) |
864 | amd64_dump_dramcfg_low(pvt->dclr1, 1); | 864 | amd64_dump_dramcfg_low(pvt->dclr1, 1); |
865 | |||
866 | /* | ||
867 | * Determine if ganged and then dump memory sizes for first controller, | ||
868 | * and if NOT ganged dump info for 2nd controller. | ||
869 | */ | ||
870 | ganged = dct_ganging_enabled(pvt); | ||
871 | |||
872 | amd64_debug_display_dimm_sizes(0, pvt); | ||
873 | |||
874 | if (!ganged) | ||
875 | amd64_debug_display_dimm_sizes(1, pvt); | ||
876 | } | 865 | } |
877 | 866 | ||
878 | /* Read in both of DBAM registers */ | 867 | /* Read in both of DBAM registers */ |
@@ -1644,11 +1633,10 @@ static void amd64_debug_display_dimm_sizes(int ctrl, struct amd64_pvt *pvt) | |||
1644 | WARN_ON(ctrl != 0); | 1633 | WARN_ON(ctrl != 0); |
1645 | } | 1634 | } |
1646 | 1635 | ||
1647 | debugf1("F2x%d80 (DRAM Bank Address Mapping): 0x%08x\n", | 1636 | dbam = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->dbam1 : pvt->dbam0; |
1648 | ctrl, ctrl ? pvt->dbam1 : pvt->dbam0); | 1637 | dcsb = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->dcsb1 : pvt->dcsb0; |
1649 | 1638 | ||
1650 | dbam = ctrl ? pvt->dbam1 : pvt->dbam0; | 1639 | debugf1("F2x%d80 (DRAM Bank Address Mapping): 0x%08x\n", ctrl, dbam); |
1651 | dcsb = ctrl ? pvt->dcsb1 : pvt->dcsb0; | ||
1652 | 1640 | ||
1653 | edac_printk(KERN_DEBUG, EDAC_MC, "DCT%d chip selects:\n", ctrl); | 1641 | edac_printk(KERN_DEBUG, EDAC_MC, "DCT%d chip selects:\n", ctrl); |
1654 | 1642 | ||
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index e28e41668177..bcb1126e3d00 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -378,10 +378,17 @@ static void __init print_filtered(const char *info) | |||
378 | 378 | ||
379 | static void __init dmi_dump_ids(void) | 379 | static void __init dmi_dump_ids(void) |
380 | { | 380 | { |
381 | const char *board; /* Board Name is optional */ | ||
382 | |||
381 | printk(KERN_DEBUG "DMI: "); | 383 | printk(KERN_DEBUG "DMI: "); |
382 | print_filtered(dmi_get_system_info(DMI_BOARD_NAME)); | 384 | print_filtered(dmi_get_system_info(DMI_SYS_VENDOR)); |
383 | printk(KERN_CONT "/"); | 385 | printk(KERN_CONT " "); |
384 | print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME)); | 386 | print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME)); |
387 | board = dmi_get_system_info(DMI_BOARD_NAME); | ||
388 | if (board) { | ||
389 | printk(KERN_CONT "/"); | ||
390 | print_filtered(board); | ||
391 | } | ||
385 | printk(KERN_CONT ", BIOS "); | 392 | printk(KERN_CONT ", BIOS "); |
386 | print_filtered(dmi_get_system_info(DMI_BIOS_VERSION)); | 393 | print_filtered(dmi_get_system_info(DMI_BIOS_VERSION)); |
387 | printk(KERN_CONT " "); | 394 | printk(KERN_CONT " "); |
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c index d81cc748e77f..54d70a47afc1 100644 --- a/drivers/gpio/langwell_gpio.c +++ b/drivers/gpio/langwell_gpio.c | |||
@@ -187,7 +187,7 @@ MODULE_DEVICE_TABLE(pci, lnw_gpio_ids); | |||
187 | 187 | ||
188 | static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) | 188 | static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) |
189 | { | 189 | { |
190 | struct lnw_gpio *lnw = (struct lnw_gpio *)get_irq_data(irq); | 190 | struct lnw_gpio *lnw = get_irq_data(irq); |
191 | u32 base, gpio; | 191 | u32 base, gpio; |
192 | void __iomem *gedr; | 192 | void __iomem *gedr; |
193 | u32 gedr_v; | 193 | u32 gedr_v; |
@@ -206,7 +206,12 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) | |||
206 | /* clear the edge detect status bit */ | 206 | /* clear the edge detect status bit */ |
207 | writel(gedr_v, gedr); | 207 | writel(gedr_v, gedr); |
208 | } | 208 | } |
209 | desc->chip->eoi(irq); | 209 | |
210 | if (desc->chip->irq_eoi) | ||
211 | desc->chip->irq_eoi(irq_get_irq_data(irq)); | ||
212 | else | ||
213 | dev_warn(lnw->chip.dev, "missing EOI handler for irq %d\n", irq); | ||
214 | |||
210 | } | 215 | } |
211 | 216 | ||
212 | static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | 217 | static int __devinit lnw_gpio_probe(struct pci_dev *pdev, |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index a261972f603d..b473429eee75 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -60,6 +60,7 @@ struct pca953x_chip { | |||
60 | unsigned gpio_start; | 60 | unsigned gpio_start; |
61 | uint16_t reg_output; | 61 | uint16_t reg_output; |
62 | uint16_t reg_direction; | 62 | uint16_t reg_direction; |
63 | struct mutex i2c_lock; | ||
63 | 64 | ||
64 | #ifdef CONFIG_GPIO_PCA953X_IRQ | 65 | #ifdef CONFIG_GPIO_PCA953X_IRQ |
65 | struct mutex irq_lock; | 66 | struct mutex irq_lock; |
@@ -119,13 +120,17 @@ static int pca953x_gpio_direction_input(struct gpio_chip *gc, unsigned off) | |||
119 | 120 | ||
120 | chip = container_of(gc, struct pca953x_chip, gpio_chip); | 121 | chip = container_of(gc, struct pca953x_chip, gpio_chip); |
121 | 122 | ||
123 | mutex_lock(&chip->i2c_lock); | ||
122 | reg_val = chip->reg_direction | (1u << off); | 124 | reg_val = chip->reg_direction | (1u << off); |
123 | ret = pca953x_write_reg(chip, PCA953X_DIRECTION, reg_val); | 125 | ret = pca953x_write_reg(chip, PCA953X_DIRECTION, reg_val); |
124 | if (ret) | 126 | if (ret) |
125 | return ret; | 127 | goto exit; |
126 | 128 | ||
127 | chip->reg_direction = reg_val; | 129 | chip->reg_direction = reg_val; |
128 | return 0; | 130 | ret = 0; |
131 | exit: | ||
132 | mutex_unlock(&chip->i2c_lock); | ||
133 | return ret; | ||
129 | } | 134 | } |
130 | 135 | ||
131 | static int pca953x_gpio_direction_output(struct gpio_chip *gc, | 136 | static int pca953x_gpio_direction_output(struct gpio_chip *gc, |
@@ -137,6 +142,7 @@ static int pca953x_gpio_direction_output(struct gpio_chip *gc, | |||
137 | 142 | ||
138 | chip = container_of(gc, struct pca953x_chip, gpio_chip); | 143 | chip = container_of(gc, struct pca953x_chip, gpio_chip); |
139 | 144 | ||
145 | mutex_lock(&chip->i2c_lock); | ||
140 | /* set output level */ | 146 | /* set output level */ |
141 | if (val) | 147 | if (val) |
142 | reg_val = chip->reg_output | (1u << off); | 148 | reg_val = chip->reg_output | (1u << off); |
@@ -145,7 +151,7 @@ static int pca953x_gpio_direction_output(struct gpio_chip *gc, | |||
145 | 151 | ||
146 | ret = pca953x_write_reg(chip, PCA953X_OUTPUT, reg_val); | 152 | ret = pca953x_write_reg(chip, PCA953X_OUTPUT, reg_val); |
147 | if (ret) | 153 | if (ret) |
148 | return ret; | 154 | goto exit; |
149 | 155 | ||
150 | chip->reg_output = reg_val; | 156 | chip->reg_output = reg_val; |
151 | 157 | ||
@@ -153,10 +159,13 @@ static int pca953x_gpio_direction_output(struct gpio_chip *gc, | |||
153 | reg_val = chip->reg_direction & ~(1u << off); | 159 | reg_val = chip->reg_direction & ~(1u << off); |
154 | ret = pca953x_write_reg(chip, PCA953X_DIRECTION, reg_val); | 160 | ret = pca953x_write_reg(chip, PCA953X_DIRECTION, reg_val); |
155 | if (ret) | 161 | if (ret) |
156 | return ret; | 162 | goto exit; |
157 | 163 | ||
158 | chip->reg_direction = reg_val; | 164 | chip->reg_direction = reg_val; |
159 | return 0; | 165 | ret = 0; |
166 | exit: | ||
167 | mutex_unlock(&chip->i2c_lock); | ||
168 | return ret; | ||
160 | } | 169 | } |
161 | 170 | ||
162 | static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) | 171 | static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) |
@@ -167,7 +176,9 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) | |||
167 | 176 | ||
168 | chip = container_of(gc, struct pca953x_chip, gpio_chip); | 177 | chip = container_of(gc, struct pca953x_chip, gpio_chip); |
169 | 178 | ||
179 | mutex_lock(&chip->i2c_lock); | ||
170 | ret = pca953x_read_reg(chip, PCA953X_INPUT, ®_val); | 180 | ret = pca953x_read_reg(chip, PCA953X_INPUT, ®_val); |
181 | mutex_unlock(&chip->i2c_lock); | ||
171 | if (ret < 0) { | 182 | if (ret < 0) { |
172 | /* NOTE: diagnostic already emitted; that's all we should | 183 | /* NOTE: diagnostic already emitted; that's all we should |
173 | * do unless gpio_*_value_cansleep() calls become different | 184 | * do unless gpio_*_value_cansleep() calls become different |
@@ -187,6 +198,7 @@ static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val) | |||
187 | 198 | ||
188 | chip = container_of(gc, struct pca953x_chip, gpio_chip); | 199 | chip = container_of(gc, struct pca953x_chip, gpio_chip); |
189 | 200 | ||
201 | mutex_lock(&chip->i2c_lock); | ||
190 | if (val) | 202 | if (val) |
191 | reg_val = chip->reg_output | (1u << off); | 203 | reg_val = chip->reg_output | (1u << off); |
192 | else | 204 | else |
@@ -194,9 +206,11 @@ static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val) | |||
194 | 206 | ||
195 | ret = pca953x_write_reg(chip, PCA953X_OUTPUT, reg_val); | 207 | ret = pca953x_write_reg(chip, PCA953X_OUTPUT, reg_val); |
196 | if (ret) | 208 | if (ret) |
197 | return; | 209 | goto exit; |
198 | 210 | ||
199 | chip->reg_output = reg_val; | 211 | chip->reg_output = reg_val; |
212 | exit: | ||
213 | mutex_unlock(&chip->i2c_lock); | ||
200 | } | 214 | } |
201 | 215 | ||
202 | static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) | 216 | static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) |
@@ -517,6 +531,8 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
517 | 531 | ||
518 | chip->names = pdata->names; | 532 | chip->names = pdata->names; |
519 | 533 | ||
534 | mutex_init(&chip->i2c_lock); | ||
535 | |||
520 | /* initialize cached registers from their original values. | 536 | /* initialize cached registers from their original values. |
521 | * we can't share this chip with another i2c master. | 537 | * we can't share this chip with another i2c master. |
522 | */ | 538 | */ |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index bea966f8ac84..0902d4460039 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -100,7 +100,10 @@ config DRM_I830 | |||
100 | config DRM_I915 | 100 | config DRM_I915 |
101 | tristate "i915 driver" | 101 | tristate "i915 driver" |
102 | depends on AGP_INTEL | 102 | depends on AGP_INTEL |
103 | # we need shmfs for the swappable backing store, and in particular | ||
104 | # the shmem_readpage() which depends upon tmpfs | ||
103 | select SHMEM | 105 | select SHMEM |
106 | select TMPFS | ||
104 | select DRM_KMS_HELPER | 107 | select DRM_KMS_HELPER |
105 | select FB_CFB_FILLRECT | 108 | select FB_CFB_FILLRECT |
106 | select FB_CFB_COPYAREA | 109 | select FB_CFB_COPYAREA |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 2baa6708e44c..654faa803dcb 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2674,3 +2674,23 @@ out: | |||
2674 | mutex_unlock(&dev->mode_config.mutex); | 2674 | mutex_unlock(&dev->mode_config.mutex); |
2675 | return ret; | 2675 | return ret; |
2676 | } | 2676 | } |
2677 | |||
2678 | void drm_mode_config_reset(struct drm_device *dev) | ||
2679 | { | ||
2680 | struct drm_crtc *crtc; | ||
2681 | struct drm_encoder *encoder; | ||
2682 | struct drm_connector *connector; | ||
2683 | |||
2684 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
2685 | if (crtc->funcs->reset) | ||
2686 | crtc->funcs->reset(crtc); | ||
2687 | |||
2688 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) | ||
2689 | if (encoder->funcs->reset) | ||
2690 | encoder->funcs->reset(encoder); | ||
2691 | |||
2692 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) | ||
2693 | if (connector->funcs->reset) | ||
2694 | connector->funcs->reset(connector); | ||
2695 | } | ||
2696 | EXPORT_SYMBOL(drm_mode_config_reset); | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 952b3d4fb2a6..92369655dca3 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -343,13 +343,12 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
343 | struct drm_encoder *encoder; | 343 | struct drm_encoder *encoder; |
344 | bool ret = true; | 344 | bool ret = true; |
345 | 345 | ||
346 | adjusted_mode = drm_mode_duplicate(dev, mode); | ||
347 | |||
348 | crtc->enabled = drm_helper_crtc_in_use(crtc); | 346 | crtc->enabled = drm_helper_crtc_in_use(crtc); |
349 | |||
350 | if (!crtc->enabled) | 347 | if (!crtc->enabled) |
351 | return true; | 348 | return true; |
352 | 349 | ||
350 | adjusted_mode = drm_mode_duplicate(dev, mode); | ||
351 | |||
353 | saved_hwmode = crtc->hwmode; | 352 | saved_hwmode = crtc->hwmode; |
354 | saved_mode = crtc->mode; | 353 | saved_mode = crtc->mode; |
355 | saved_x = crtc->x; | 354 | saved_x = crtc->x; |
@@ -437,10 +436,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
437 | */ | 436 | */ |
438 | drm_calc_timestamping_constants(crtc); | 437 | drm_calc_timestamping_constants(crtc); |
439 | 438 | ||
440 | /* XXX free adjustedmode */ | ||
441 | drm_mode_destroy(dev, adjusted_mode); | ||
442 | /* FIXME: add subpixel order */ | 439 | /* FIXME: add subpixel order */ |
443 | done: | 440 | done: |
441 | drm_mode_destroy(dev, adjusted_mode); | ||
444 | if (!ret) { | 442 | if (!ret) { |
445 | crtc->hwmode = saved_hwmode; | 443 | crtc->hwmode = saved_hwmode; |
446 | crtc->mode = saved_mode; | 444 | crtc->mode = saved_mode; |
@@ -497,14 +495,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
497 | 495 | ||
498 | crtc_funcs = set->crtc->helper_private; | 496 | crtc_funcs = set->crtc->helper_private; |
499 | 497 | ||
498 | if (!set->mode) | ||
499 | set->fb = NULL; | ||
500 | |||
500 | if (set->fb) { | 501 | if (set->fb) { |
501 | DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n", | 502 | DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n", |
502 | set->crtc->base.id, set->fb->base.id, | 503 | set->crtc->base.id, set->fb->base.id, |
503 | (int)set->num_connectors, set->x, set->y); | 504 | (int)set->num_connectors, set->x, set->y); |
504 | } else { | 505 | } else { |
505 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB] #connectors=%d (x y) (%i %i)\n", | 506 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
506 | set->crtc->base.id, (int)set->num_connectors, | 507 | set->mode = NULL; |
507 | set->x, set->y); | 508 | set->num_connectors = 0; |
508 | } | 509 | } |
509 | 510 | ||
510 | dev = set->crtc->dev; | 511 | dev = set->crtc->dev; |
@@ -649,8 +650,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
649 | mode_changed = true; | 650 | mode_changed = true; |
650 | 651 | ||
651 | if (mode_changed) { | 652 | if (mode_changed) { |
652 | set->crtc->enabled = (set->mode != NULL); | 653 | set->crtc->enabled = drm_helper_crtc_in_use(set->crtc); |
653 | if (set->mode != NULL) { | 654 | if (set->crtc->enabled) { |
654 | DRM_DEBUG_KMS("attempting to set mode from" | 655 | DRM_DEBUG_KMS("attempting to set mode from" |
655 | " userspace\n"); | 656 | " userspace\n"); |
656 | drm_mode_debug_printmodeline(set->mode); | 657 | drm_mode_debug_printmodeline(set->mode); |
@@ -665,6 +666,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
665 | ret = -EINVAL; | 666 | ret = -EINVAL; |
666 | goto fail; | 667 | goto fail; |
667 | } | 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 | } | ||
668 | } | 675 | } |
669 | drm_helper_disable_unused_functions(dev); | 676 | drm_helper_disable_unused_functions(dev); |
670 | } else if (fb_changed) { | 677 | } else if (fb_changed) { |
@@ -681,12 +688,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
681 | goto fail; | 688 | goto fail; |
682 | } | 689 | } |
683 | } | 690 | } |
684 | DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); | ||
685 | for (i = 0; i < set->num_connectors; i++) { | ||
686 | DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, | ||
687 | drm_get_connector_name(set->connectors[i])); | ||
688 | set->connectors[i]->dpms = DRM_MODE_DPMS_ON; | ||
689 | } | ||
690 | 691 | ||
691 | kfree(save_connectors); | 692 | kfree(save_connectors); |
692 | kfree(save_encoders); | 693 | kfree(save_encoders); |
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index 3cdbaf379bb5..be9a9c07d152 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -283,17 +283,18 @@ int drm_vma_info(struct seq_file *m, void *data) | |||
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | mutex_lock(&dev->struct_mutex); | 285 | mutex_lock(&dev->struct_mutex); |
286 | seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08llx\n", | 286 | seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", |
287 | atomic_read(&dev->vma_count), | 287 | atomic_read(&dev->vma_count), |
288 | high_memory, (u64)virt_to_phys(high_memory)); | 288 | high_memory, (void *)virt_to_phys(high_memory)); |
289 | 289 | ||
290 | list_for_each_entry(pt, &dev->vmalist, head) { | 290 | list_for_each_entry(pt, &dev->vmalist, head) { |
291 | vma = pt->vma; | 291 | vma = pt->vma; |
292 | if (!vma) | 292 | if (!vma) |
293 | continue; | 293 | continue; |
294 | seq_printf(m, | 294 | seq_printf(m, |
295 | "\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000", | 295 | "\n%5d 0x%pK-0x%pK %c%c%c%c%c%c 0x%08lx000", |
296 | pt->pid, vma->vm_start, vma->vm_end, | 296 | pt->pid, |
297 | (void *)vma->vm_start, (void *)vma->vm_end, | ||
297 | vma->vm_flags & VM_READ ? 'r' : '-', | 298 | vma->vm_flags & VM_READ ? 'r' : '-', |
298 | vma->vm_flags & VM_WRITE ? 'w' : '-', | 299 | vma->vm_flags & VM_WRITE ? 'w' : '-', |
299 | vma->vm_flags & VM_EXEC ? 'x' : '-', | 300 | vma->vm_flags & VM_EXEC ? 'x' : '-', |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 0054e957203f..3dadfa2a8528 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -1250,7 +1250,7 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc) | |||
1250 | * Drivers should call this routine in their vblank interrupt handlers to | 1250 | * Drivers should call this routine in their vblank interrupt handlers to |
1251 | * update the vblank counter and send any signals that may be pending. | 1251 | * update the vblank counter and send any signals that may be pending. |
1252 | */ | 1252 | */ |
1253 | void drm_handle_vblank(struct drm_device *dev, int crtc) | 1253 | bool drm_handle_vblank(struct drm_device *dev, int crtc) |
1254 | { | 1254 | { |
1255 | u32 vblcount; | 1255 | u32 vblcount; |
1256 | s64 diff_ns; | 1256 | s64 diff_ns; |
@@ -1258,7 +1258,7 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1258 | unsigned long irqflags; | 1258 | unsigned long irqflags; |
1259 | 1259 | ||
1260 | if (!dev->num_crtcs) | 1260 | if (!dev->num_crtcs) |
1261 | return; | 1261 | return false; |
1262 | 1262 | ||
1263 | /* Need timestamp lock to prevent concurrent execution with | 1263 | /* Need timestamp lock to prevent concurrent execution with |
1264 | * vblank enable/disable, as this would cause inconsistent | 1264 | * vblank enable/disable, as this would cause inconsistent |
@@ -1269,7 +1269,7 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1269 | /* Vblank irq handling disabled. Nothing to do. */ | 1269 | /* Vblank irq handling disabled. Nothing to do. */ |
1270 | if (!dev->vblank_enabled[crtc]) { | 1270 | if (!dev->vblank_enabled[crtc]) { |
1271 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); | 1271 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); |
1272 | return; | 1272 | return false; |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | /* Fetch corresponding timestamp for this vblank interval from | 1275 | /* Fetch corresponding timestamp for this vblank interval from |
@@ -1311,5 +1311,6 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1311 | drm_handle_vblank_events(dev, crtc); | 1311 | drm_handle_vblank_events(dev, crtc); |
1312 | 1312 | ||
1313 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); | 1313 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); |
1314 | return true; | ||
1314 | } | 1315 | } |
1315 | EXPORT_SYMBOL(drm_handle_vblank); | 1316 | EXPORT_SYMBOL(drm_handle_vblank); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 844f3c972b04..17bd766f2081 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -152,7 +152,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init) | |||
152 | { | 152 | { |
153 | drm_i915_private_t *dev_priv = dev->dev_private; | 153 | drm_i915_private_t *dev_priv = dev->dev_private; |
154 | struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; | 154 | struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; |
155 | struct intel_ring_buffer *ring = LP_RING(dev_priv); | 155 | int ret; |
156 | 156 | ||
157 | master_priv->sarea = drm_getsarea(dev); | 157 | master_priv->sarea = drm_getsarea(dev); |
158 | if (master_priv->sarea) { | 158 | if (master_priv->sarea) { |
@@ -163,33 +163,22 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | if (init->ring_size != 0) { | 165 | if (init->ring_size != 0) { |
166 | if (ring->obj != NULL) { | 166 | if (LP_RING(dev_priv)->obj != NULL) { |
167 | i915_dma_cleanup(dev); | 167 | i915_dma_cleanup(dev); |
168 | DRM_ERROR("Client tried to initialize ringbuffer in " | 168 | DRM_ERROR("Client tried to initialize ringbuffer in " |
169 | "GEM mode\n"); | 169 | "GEM mode\n"); |
170 | return -EINVAL; | 170 | return -EINVAL; |
171 | } | 171 | } |
172 | 172 | ||
173 | ring->size = init->ring_size; | 173 | ret = intel_render_ring_init_dri(dev, |
174 | 174 | init->ring_start, | |
175 | ring->map.offset = init->ring_start; | 175 | init->ring_size); |
176 | ring->map.size = init->ring_size; | 176 | if (ret) { |
177 | ring->map.type = 0; | ||
178 | ring->map.flags = 0; | ||
179 | ring->map.mtrr = 0; | ||
180 | |||
181 | drm_core_ioremap_wc(&ring->map, dev); | ||
182 | |||
183 | if (ring->map.handle == NULL) { | ||
184 | i915_dma_cleanup(dev); | 177 | i915_dma_cleanup(dev); |
185 | DRM_ERROR("can not ioremap virtual address for" | 178 | return ret; |
186 | " ring buffer\n"); | ||
187 | return -ENOMEM; | ||
188 | } | 179 | } |
189 | } | 180 | } |
190 | 181 | ||
191 | ring->virtual_start = ring->map.handle; | ||
192 | |||
193 | dev_priv->cpp = init->cpp; | 182 | dev_priv->cpp = init->cpp; |
194 | dev_priv->back_offset = init->back_offset; | 183 | dev_priv->back_offset = init->back_offset; |
195 | dev_priv->front_offset = init->front_offset; | 184 | dev_priv->front_offset = init->front_offset; |
@@ -1226,9 +1215,15 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1226 | if (ret) | 1215 | if (ret) |
1227 | DRM_INFO("failed to find VBIOS tables\n"); | 1216 | DRM_INFO("failed to find VBIOS tables\n"); |
1228 | 1217 | ||
1229 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ | 1218 | /* If we have > 1 VGA cards, then we need to arbitrate access |
1219 | * to the common VGA resources. | ||
1220 | * | ||
1221 | * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA), | ||
1222 | * then we do not take part in VGA arbitration and the | ||
1223 | * vga_client_register() fails with -ENODEV. | ||
1224 | */ | ||
1230 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); | 1225 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
1231 | if (ret) | 1226 | if (ret && ret != -ENODEV) |
1232 | goto cleanup_ringbuffer; | 1227 | goto cleanup_ringbuffer; |
1233 | 1228 | ||
1234 | intel_register_dsm_handler(); | 1229 | intel_register_dsm_handler(); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 72fea2bcfc4f..0ad533f06af9 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -46,6 +46,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400); | |||
46 | unsigned int i915_powersave = 1; | 46 | unsigned int i915_powersave = 1; |
47 | module_param_named(powersave, i915_powersave, int, 0600); | 47 | module_param_named(powersave, i915_powersave, int, 0600); |
48 | 48 | ||
49 | unsigned int i915_enable_rc6 = 0; | ||
50 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | ||
51 | |||
49 | unsigned int i915_lvds_downclock = 0; | 52 | unsigned int i915_lvds_downclock = 0; |
50 | module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); | 53 | module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); |
51 | 54 | ||
@@ -60,7 +63,7 @@ extern int intel_agp_enabled; | |||
60 | 63 | ||
61 | #define INTEL_VGA_DEVICE(id, info) { \ | 64 | #define INTEL_VGA_DEVICE(id, info) { \ |
62 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ | 65 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ |
63 | .class_mask = 0xffff00, \ | 66 | .class_mask = 0xff0000, \ |
64 | .vendor = 0x8086, \ | 67 | .vendor = 0x8086, \ |
65 | .device = id, \ | 68 | .device = id, \ |
66 | .subvendor = PCI_ANY_ID, \ | 69 | .subvendor = PCI_ANY_ID, \ |
@@ -354,12 +357,13 @@ static int i915_drm_thaw(struct drm_device *dev) | |||
354 | error = i915_gem_init_ringbuffer(dev); | 357 | error = i915_gem_init_ringbuffer(dev); |
355 | mutex_unlock(&dev->struct_mutex); | 358 | mutex_unlock(&dev->struct_mutex); |
356 | 359 | ||
360 | drm_mode_config_reset(dev); | ||
357 | drm_irq_install(dev); | 361 | drm_irq_install(dev); |
358 | 362 | ||
359 | /* Resume the modeset for every activated CRTC */ | 363 | /* Resume the modeset for every activated CRTC */ |
360 | drm_helper_resume_force_mode(dev); | 364 | drm_helper_resume_force_mode(dev); |
361 | 365 | ||
362 | if (dev_priv->renderctx && dev_priv->pwrctx) | 366 | if (IS_IRONLAKE_M(dev)) |
363 | ironlake_enable_rc6(dev); | 367 | ironlake_enable_rc6(dev); |
364 | } | 368 | } |
365 | 369 | ||
@@ -542,6 +546,7 @@ int i915_reset(struct drm_device *dev, u8 flags) | |||
542 | 546 | ||
543 | mutex_unlock(&dev->struct_mutex); | 547 | mutex_unlock(&dev->struct_mutex); |
544 | drm_irq_uninstall(dev); | 548 | drm_irq_uninstall(dev); |
549 | drm_mode_config_reset(dev); | ||
545 | drm_irq_install(dev); | 550 | drm_irq_install(dev); |
546 | mutex_lock(&dev->struct_mutex); | 551 | mutex_lock(&dev->struct_mutex); |
547 | } | 552 | } |
@@ -566,6 +571,14 @@ int i915_reset(struct drm_device *dev, u8 flags) | |||
566 | static int __devinit | 571 | static int __devinit |
567 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 572 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
568 | { | 573 | { |
574 | /* Only bind to function 0 of the device. Early generations | ||
575 | * used function 1 as a placeholder for multi-head. This causes | ||
576 | * us confusion instead, especially on the systems where both | ||
577 | * functions have the same PCI-ID! | ||
578 | */ | ||
579 | if (PCI_FUNC(pdev->devfn)) | ||
580 | return -ENODEV; | ||
581 | |||
569 | return drm_get_pci_dev(pdev, ent, &driver); | 582 | return drm_get_pci_dev(pdev, ent, &driver); |
570 | } | 583 | } |
571 | 584 | ||
@@ -752,6 +765,9 @@ static int __init i915_init(void) | |||
752 | driver.driver_features &= ~DRIVER_MODESET; | 765 | driver.driver_features &= ~DRIVER_MODESET; |
753 | #endif | 766 | #endif |
754 | 767 | ||
768 | if (!(driver.driver_features & DRIVER_MODESET)) | ||
769 | driver.get_vblank_timestamp = NULL; | ||
770 | |||
755 | return drm_init(&driver); | 771 | return drm_init(&driver); |
756 | } | 772 | } |
757 | 773 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 5969f46ac2d6..65dfe81d0035 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -543,8 +543,11 @@ typedef struct drm_i915_private { | |||
543 | /** List of all objects in gtt_space. Used to restore gtt | 543 | /** List of all objects in gtt_space. Used to restore gtt |
544 | * mappings on resume */ | 544 | * mappings on resume */ |
545 | struct list_head gtt_list; | 545 | struct list_head gtt_list; |
546 | /** End of mappable part of GTT */ | 546 | |
547 | /** Usable portion of the GTT for GEM */ | ||
548 | unsigned long gtt_start; | ||
547 | unsigned long gtt_mappable_end; | 549 | unsigned long gtt_mappable_end; |
550 | unsigned long gtt_end; | ||
548 | 551 | ||
549 | struct io_mapping *gtt_mapping; | 552 | struct io_mapping *gtt_mapping; |
550 | int gtt_mtrr; | 553 | int gtt_mtrr; |
@@ -955,6 +958,7 @@ extern unsigned int i915_fbpercrtc; | |||
955 | extern unsigned int i915_powersave; | 958 | extern unsigned int i915_powersave; |
956 | extern unsigned int i915_lvds_downclock; | 959 | extern unsigned int i915_lvds_downclock; |
957 | extern unsigned int i915_panel_use_ssc; | 960 | extern unsigned int i915_panel_use_ssc; |
961 | extern unsigned int i915_enable_rc6; | ||
958 | 962 | ||
959 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 963 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
960 | extern int i915_resume(struct drm_device *dev); | 964 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 3dfc848ff755..cf4f74c7c6fb 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -140,12 +140,16 @@ void i915_gem_do_init(struct drm_device *dev, | |||
140 | { | 140 | { |
141 | drm_i915_private_t *dev_priv = dev->dev_private; | 141 | drm_i915_private_t *dev_priv = dev->dev_private; |
142 | 142 | ||
143 | drm_mm_init(&dev_priv->mm.gtt_space, start, | 143 | drm_mm_init(&dev_priv->mm.gtt_space, start, end - start); |
144 | end - start); | ||
145 | 144 | ||
145 | dev_priv->mm.gtt_start = start; | ||
146 | dev_priv->mm.gtt_mappable_end = mappable_end; | ||
147 | dev_priv->mm.gtt_end = end; | ||
146 | dev_priv->mm.gtt_total = end - start; | 148 | dev_priv->mm.gtt_total = end - start; |
147 | dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start; | 149 | dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start; |
148 | dev_priv->mm.gtt_mappable_end = mappable_end; | 150 | |
151 | /* Take over this portion of the GTT */ | ||
152 | intel_gtt_clear_range(start / PAGE_SIZE, (end-start) / PAGE_SIZE); | ||
149 | } | 153 | } |
150 | 154 | ||
151 | int | 155 | int |
@@ -1857,7 +1861,7 @@ i915_gem_retire_requests_ring(struct drm_device *dev, | |||
1857 | 1861 | ||
1858 | seqno = ring->get_seqno(ring); | 1862 | seqno = ring->get_seqno(ring); |
1859 | 1863 | ||
1860 | for (i = 0; i < I915_NUM_RINGS; i++) | 1864 | for (i = 0; i < ARRAY_SIZE(ring->sync_seqno); i++) |
1861 | if (seqno >= ring->sync_seqno[i]) | 1865 | if (seqno >= ring->sync_seqno[i]) |
1862 | ring->sync_seqno[i] = 0; | 1866 | ring->sync_seqno[i] = 0; |
1863 | 1867 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index dcfdf4151b6d..d2f445e825f2 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -1175,7 +1175,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1175 | goto err; | 1175 | goto err; |
1176 | 1176 | ||
1177 | seqno = i915_gem_next_request_seqno(dev, ring); | 1177 | seqno = i915_gem_next_request_seqno(dev, ring); |
1178 | for (i = 0; i < I915_NUM_RINGS-1; i++) { | 1178 | for (i = 0; i < ARRAY_SIZE(ring->sync_seqno); i++) { |
1179 | if (seqno < ring->sync_seqno[i]) { | 1179 | if (seqno < ring->sync_seqno[i]) { |
1180 | /* The GPU can not handle its semaphore value wrapping, | 1180 | /* The GPU can not handle its semaphore value wrapping, |
1181 | * so every billion or so execbuffers, we need to stall | 1181 | * so every billion or so execbuffers, we need to stall |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 70433ae50ac8..b0abdc64aa9f 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -34,6 +34,10 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) | |||
34 | struct drm_i915_private *dev_priv = dev->dev_private; | 34 | struct drm_i915_private *dev_priv = dev->dev_private; |
35 | struct drm_i915_gem_object *obj; | 35 | struct drm_i915_gem_object *obj; |
36 | 36 | ||
37 | /* First fill our portion of the GTT with scratch pages */ | ||
38 | intel_gtt_clear_range(dev_priv->mm.gtt_start / PAGE_SIZE, | ||
39 | (dev_priv->mm.gtt_end - dev_priv->mm.gtt_start) / PAGE_SIZE); | ||
40 | |||
37 | list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) { | 41 | list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) { |
38 | i915_gem_clflush_object(obj); | 42 | i915_gem_clflush_object(obj); |
39 | 43 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b8e509ae065e..97f946dcc1aa 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -274,24 +274,35 @@ int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, | |||
274 | return ret; | 274 | return ret; |
275 | } | 275 | } |
276 | 276 | ||
277 | int i915_get_vblank_timestamp(struct drm_device *dev, int crtc, | 277 | int i915_get_vblank_timestamp(struct drm_device *dev, int pipe, |
278 | int *max_error, | 278 | int *max_error, |
279 | struct timeval *vblank_time, | 279 | struct timeval *vblank_time, |
280 | unsigned flags) | 280 | unsigned flags) |
281 | { | 281 | { |
282 | struct drm_crtc *drmcrtc; | 282 | struct drm_i915_private *dev_priv = dev->dev_private; |
283 | struct drm_crtc *crtc; | ||
283 | 284 | ||
284 | if (crtc < 0 || crtc >= dev->num_crtcs) { | 285 | if (pipe < 0 || pipe >= dev_priv->num_pipe) { |
285 | DRM_ERROR("Invalid crtc %d\n", crtc); | 286 | DRM_ERROR("Invalid crtc %d\n", pipe); |
286 | return -EINVAL; | 287 | return -EINVAL; |
287 | } | 288 | } |
288 | 289 | ||
289 | /* Get drm_crtc to timestamp: */ | 290 | /* Get drm_crtc to timestamp: */ |
290 | drmcrtc = intel_get_crtc_for_pipe(dev, crtc); | 291 | crtc = intel_get_crtc_for_pipe(dev, pipe); |
292 | if (crtc == NULL) { | ||
293 | DRM_ERROR("Invalid crtc %d\n", pipe); | ||
294 | return -EINVAL; | ||
295 | } | ||
296 | |||
297 | if (!crtc->enabled) { | ||
298 | DRM_DEBUG_KMS("crtc %d is disabled\n", pipe); | ||
299 | return -EBUSY; | ||
300 | } | ||
291 | 301 | ||
292 | /* Helper routine in DRM core does all the work: */ | 302 | /* Helper routine in DRM core does all the work: */ |
293 | return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, | 303 | return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error, |
294 | vblank_time, flags, drmcrtc); | 304 | vblank_time, flags, |
305 | crtc); | ||
295 | } | 306 | } |
296 | 307 | ||
297 | /* | 308 | /* |
@@ -348,8 +359,12 @@ static void notify_ring(struct drm_device *dev, | |||
348 | struct intel_ring_buffer *ring) | 359 | struct intel_ring_buffer *ring) |
349 | { | 360 | { |
350 | struct drm_i915_private *dev_priv = dev->dev_private; | 361 | struct drm_i915_private *dev_priv = dev->dev_private; |
351 | u32 seqno = ring->get_seqno(ring); | 362 | u32 seqno; |
352 | 363 | ||
364 | if (ring->obj == NULL) | ||
365 | return; | ||
366 | |||
367 | seqno = ring->get_seqno(ring); | ||
353 | trace_i915_gem_request_complete(dev, seqno); | 368 | trace_i915_gem_request_complete(dev, seqno); |
354 | 369 | ||
355 | ring->irq_seqno = seqno; | 370 | ring->irq_seqno = seqno; |
@@ -831,6 +846,8 @@ static void i915_capture_error_state(struct drm_device *dev) | |||
831 | i++; | 846 | i++; |
832 | error->pinned_bo_count = i - error->active_bo_count; | 847 | error->pinned_bo_count = i - error->active_bo_count; |
833 | 848 | ||
849 | error->active_bo = NULL; | ||
850 | error->pinned_bo = NULL; | ||
834 | if (i) { | 851 | if (i) { |
835 | error->active_bo = kmalloc(sizeof(*error->active_bo)*i, | 852 | error->active_bo = kmalloc(sizeof(*error->active_bo)*i, |
836 | GFP_ATOMIC); | 853 | GFP_ATOMIC); |
@@ -1179,18 +1196,18 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
1179 | intel_finish_page_flip_plane(dev, 1); | 1196 | intel_finish_page_flip_plane(dev, 1); |
1180 | } | 1197 | } |
1181 | 1198 | ||
1182 | if (pipea_stats & vblank_status) { | 1199 | if (pipea_stats & vblank_status && |
1200 | drm_handle_vblank(dev, 0)) { | ||
1183 | vblank++; | 1201 | vblank++; |
1184 | drm_handle_vblank(dev, 0); | ||
1185 | if (!dev_priv->flip_pending_is_done) { | 1202 | if (!dev_priv->flip_pending_is_done) { |
1186 | i915_pageflip_stall_check(dev, 0); | 1203 | i915_pageflip_stall_check(dev, 0); |
1187 | intel_finish_page_flip(dev, 0); | 1204 | intel_finish_page_flip(dev, 0); |
1188 | } | 1205 | } |
1189 | } | 1206 | } |
1190 | 1207 | ||
1191 | if (pipeb_stats & vblank_status) { | 1208 | if (pipeb_stats & vblank_status && |
1209 | drm_handle_vblank(dev, 1)) { | ||
1192 | vblank++; | 1210 | vblank++; |
1193 | drm_handle_vblank(dev, 1); | ||
1194 | if (!dev_priv->flip_pending_is_done) { | 1211 | if (!dev_priv->flip_pending_is_done) { |
1195 | i915_pageflip_stall_check(dev, 1); | 1212 | i915_pageflip_stall_check(dev, 1); |
1196 | intel_finish_page_flip(dev, 1); | 1213 | intel_finish_page_flip(dev, 1); |
@@ -1278,12 +1295,12 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) | |||
1278 | if (master_priv->sarea_priv) | 1295 | if (master_priv->sarea_priv) |
1279 | master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT; | 1296 | master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT; |
1280 | 1297 | ||
1281 | ret = -ENODEV; | ||
1282 | if (ring->irq_get(ring)) { | 1298 | if (ring->irq_get(ring)) { |
1283 | DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ, | 1299 | DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ, |
1284 | READ_BREADCRUMB(dev_priv) >= irq_nr); | 1300 | READ_BREADCRUMB(dev_priv) >= irq_nr); |
1285 | ring->irq_put(ring); | 1301 | ring->irq_put(ring); |
1286 | } | 1302 | } else if (wait_for(READ_BREADCRUMB(dev_priv) >= irq_nr, 3000)) |
1303 | ret = -EBUSY; | ||
1287 | 1304 | ||
1288 | if (ret == -EBUSY) { | 1305 | if (ret == -EBUSY) { |
1289 | DRM_ERROR("EBUSY -- rec: %d emitted: %d\n", | 1306 | DRM_ERROR("EBUSY -- rec: %d emitted: %d\n", |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 40a407f41f61..15d94c63918c 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -174,7 +174,9 @@ | |||
174 | * address/value pairs. Don't overdue it, though, x <= 2^4 must hold! | 174 | * address/value pairs. Don't overdue it, though, x <= 2^4 must hold! |
175 | */ | 175 | */ |
176 | #define MI_LOAD_REGISTER_IMM(x) MI_INSTR(0x22, 2*x-1) | 176 | #define MI_LOAD_REGISTER_IMM(x) MI_INSTR(0x22, 2*x-1) |
177 | #define MI_FLUSH_DW MI_INSTR(0x26, 2) /* for GEN6 */ | 177 | #define MI_FLUSH_DW MI_INSTR(0x26, 1) /* for GEN6 */ |
178 | #define MI_INVALIDATE_TLB (1<<18) | ||
179 | #define MI_INVALIDATE_BSD (1<<7) | ||
178 | #define MI_BATCH_BUFFER MI_INSTR(0x30, 1) | 180 | #define MI_BATCH_BUFFER MI_INSTR(0x30, 1) |
179 | #define MI_BATCH_NON_SECURE (1) | 181 | #define MI_BATCH_NON_SECURE (1) |
180 | #define MI_BATCH_NON_SECURE_I965 (1<<8) | 182 | #define MI_BATCH_NON_SECURE_I965 (1<<8) |
@@ -513,6 +515,10 @@ | |||
513 | #define GEN6_BLITTER_SYNC_STATUS (1 << 24) | 515 | #define GEN6_BLITTER_SYNC_STATUS (1 << 24) |
514 | #define GEN6_BLITTER_USER_INTERRUPT (1 << 22) | 516 | #define GEN6_BLITTER_USER_INTERRUPT (1 << 22) |
515 | 517 | ||
518 | #define GEN6_BLITTER_ECOSKPD 0x221d0 | ||
519 | #define GEN6_BLITTER_LOCK_SHIFT 16 | ||
520 | #define GEN6_BLITTER_FBC_NOTIFY (1<<3) | ||
521 | |||
516 | #define GEN6_BSD_SLEEP_PSMI_CONTROL 0x12050 | 522 | #define GEN6_BSD_SLEEP_PSMI_CONTROL 0x12050 |
517 | #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_MODIFY_MASK (1 << 16) | 523 | #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_MODIFY_MASK (1 << 16) |
518 | #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_DISABLE (1 << 0) | 524 | #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_DISABLE (1 << 0) |
@@ -2626,6 +2632,8 @@ | |||
2626 | #define DISPLAY_PORT_PLL_BIOS_2 0x46014 | 2632 | #define DISPLAY_PORT_PLL_BIOS_2 0x46014 |
2627 | 2633 | ||
2628 | #define PCH_DSPCLK_GATE_D 0x42020 | 2634 | #define PCH_DSPCLK_GATE_D 0x42020 |
2635 | # define DPFCUNIT_CLOCK_GATE_DISABLE (1 << 9) | ||
2636 | # define DPFCRUNIT_CLOCK_GATE_DISABLE (1 << 8) | ||
2629 | # define DPFDUNIT_CLOCK_GATE_DISABLE (1 << 7) | 2637 | # define DPFDUNIT_CLOCK_GATE_DISABLE (1 << 7) |
2630 | # define DPARBUNIT_CLOCK_GATE_DISABLE (1 << 5) | 2638 | # define DPARBUNIT_CLOCK_GATE_DISABLE (1 << 5) |
2631 | 2639 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 17035b87ee46..8a77ff4a7237 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -535,6 +535,15 @@ static int intel_crt_set_property(struct drm_connector *connector, | |||
535 | return 0; | 535 | return 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | static void intel_crt_reset(struct drm_connector *connector) | ||
539 | { | ||
540 | struct drm_device *dev = connector->dev; | ||
541 | struct intel_crt *crt = intel_attached_crt(connector); | ||
542 | |||
543 | if (HAS_PCH_SPLIT(dev)) | ||
544 | crt->force_hotplug_required = 1; | ||
545 | } | ||
546 | |||
538 | /* | 547 | /* |
539 | * Routines for controlling stuff on the analog port | 548 | * Routines for controlling stuff on the analog port |
540 | */ | 549 | */ |
@@ -548,6 +557,7 @@ static const struct drm_encoder_helper_funcs intel_crt_helper_funcs = { | |||
548 | }; | 557 | }; |
549 | 558 | ||
550 | static const struct drm_connector_funcs intel_crt_connector_funcs = { | 559 | static const struct drm_connector_funcs intel_crt_connector_funcs = { |
560 | .reset = intel_crt_reset, | ||
551 | .dpms = drm_helper_connector_dpms, | 561 | .dpms = drm_helper_connector_dpms, |
552 | .detect = intel_crt_detect, | 562 | .detect = intel_crt_detect, |
553 | .fill_modes = drm_helper_probe_single_connector_modes, | 563 | .fill_modes = drm_helper_probe_single_connector_modes, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 98967f3b7724..3b006536b3d2 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1213,6 +1213,26 @@ static bool g4x_fbc_enabled(struct drm_device *dev) | |||
1213 | return I915_READ(DPFC_CONTROL) & DPFC_CTL_EN; | 1213 | return I915_READ(DPFC_CONTROL) & DPFC_CTL_EN; |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | static void sandybridge_blit_fbc_update(struct drm_device *dev) | ||
1217 | { | ||
1218 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1219 | u32 blt_ecoskpd; | ||
1220 | |||
1221 | /* Make sure blitter notifies FBC of writes */ | ||
1222 | __gen6_force_wake_get(dev_priv); | ||
1223 | blt_ecoskpd = I915_READ(GEN6_BLITTER_ECOSKPD); | ||
1224 | blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY << | ||
1225 | GEN6_BLITTER_LOCK_SHIFT; | ||
1226 | I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); | ||
1227 | blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY; | ||
1228 | I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); | ||
1229 | blt_ecoskpd &= ~(GEN6_BLITTER_FBC_NOTIFY << | ||
1230 | GEN6_BLITTER_LOCK_SHIFT); | ||
1231 | I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); | ||
1232 | POSTING_READ(GEN6_BLITTER_ECOSKPD); | ||
1233 | __gen6_force_wake_put(dev_priv); | ||
1234 | } | ||
1235 | |||
1216 | static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) | 1236 | static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) |
1217 | { | 1237 | { |
1218 | struct drm_device *dev = crtc->dev; | 1238 | struct drm_device *dev = crtc->dev; |
@@ -1266,6 +1286,7 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) | |||
1266 | I915_WRITE(SNB_DPFC_CTL_SA, | 1286 | I915_WRITE(SNB_DPFC_CTL_SA, |
1267 | SNB_CPU_FENCE_ENABLE | dev_priv->cfb_fence); | 1287 | SNB_CPU_FENCE_ENABLE | dev_priv->cfb_fence); |
1268 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, crtc->y); | 1288 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, crtc->y); |
1289 | sandybridge_blit_fbc_update(dev); | ||
1269 | } | 1290 | } |
1270 | 1291 | ||
1271 | DRM_DEBUG_KMS("enabled fbc on plane %d\n", intel_crtc->plane); | 1292 | DRM_DEBUG_KMS("enabled fbc on plane %d\n", intel_crtc->plane); |
@@ -5530,6 +5551,16 @@ cleanup_work: | |||
5530 | return ret; | 5551 | return ret; |
5531 | } | 5552 | } |
5532 | 5553 | ||
5554 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
5555 | { | ||
5556 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
5557 | |||
5558 | /* Reset flags back to the 'unknown' status so that they | ||
5559 | * will be correctly set on the initial modeset. | ||
5560 | */ | ||
5561 | intel_crtc->dpms_mode = -1; | ||
5562 | } | ||
5563 | |||
5533 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | 5564 | static struct drm_crtc_helper_funcs intel_helper_funcs = { |
5534 | .dpms = intel_crtc_dpms, | 5565 | .dpms = intel_crtc_dpms, |
5535 | .mode_fixup = intel_crtc_mode_fixup, | 5566 | .mode_fixup = intel_crtc_mode_fixup, |
@@ -5541,6 +5572,7 @@ static struct drm_crtc_helper_funcs intel_helper_funcs = { | |||
5541 | }; | 5572 | }; |
5542 | 5573 | ||
5543 | static const struct drm_crtc_funcs intel_crtc_funcs = { | 5574 | static const struct drm_crtc_funcs intel_crtc_funcs = { |
5575 | .reset = intel_crtc_reset, | ||
5544 | .cursor_set = intel_crtc_cursor_set, | 5576 | .cursor_set = intel_crtc_cursor_set, |
5545 | .cursor_move = intel_crtc_cursor_move, | 5577 | .cursor_move = intel_crtc_cursor_move, |
5546 | .gamma_set = intel_crtc_gamma_set, | 5578 | .gamma_set = intel_crtc_gamma_set, |
@@ -5631,8 +5663,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
5631 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; | 5663 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; |
5632 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; | 5664 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; |
5633 | 5665 | ||
5634 | intel_crtc->cursor_addr = 0; | 5666 | intel_crtc_reset(&intel_crtc->base); |
5635 | intel_crtc->dpms_mode = -1; | ||
5636 | intel_crtc->active = true; /* force the pipe off on setup_init_config */ | 5667 | intel_crtc->active = true; /* force the pipe off on setup_init_config */ |
5637 | 5668 | ||
5638 | if (HAS_PCH_SPLIT(dev)) { | 5669 | if (HAS_PCH_SPLIT(dev)) { |
@@ -6286,7 +6317,9 @@ void intel_enable_clock_gating(struct drm_device *dev) | |||
6286 | 6317 | ||
6287 | if (IS_GEN5(dev)) { | 6318 | if (IS_GEN5(dev)) { |
6288 | /* Required for FBC */ | 6319 | /* Required for FBC */ |
6289 | dspclk_gate |= DPFDUNIT_CLOCK_GATE_DISABLE; | 6320 | dspclk_gate |= DPFCUNIT_CLOCK_GATE_DISABLE | |
6321 | DPFCRUNIT_CLOCK_GATE_DISABLE | | ||
6322 | DPFDUNIT_CLOCK_GATE_DISABLE; | ||
6290 | /* Required for CxSR */ | 6323 | /* Required for CxSR */ |
6291 | dspclk_gate |= DPARBUNIT_CLOCK_GATE_DISABLE; | 6324 | dspclk_gate |= DPARBUNIT_CLOCK_GATE_DISABLE; |
6292 | 6325 | ||
@@ -6429,52 +6462,60 @@ void intel_enable_clock_gating(struct drm_device *dev) | |||
6429 | } | 6462 | } |
6430 | } | 6463 | } |
6431 | 6464 | ||
6432 | void intel_disable_clock_gating(struct drm_device *dev) | 6465 | static void ironlake_teardown_rc6(struct drm_device *dev) |
6433 | { | 6466 | { |
6434 | struct drm_i915_private *dev_priv = dev->dev_private; | 6467 | struct drm_i915_private *dev_priv = dev->dev_private; |
6435 | 6468 | ||
6436 | if (dev_priv->renderctx) { | 6469 | if (dev_priv->renderctx) { |
6437 | struct drm_i915_gem_object *obj = dev_priv->renderctx; | 6470 | i915_gem_object_unpin(dev_priv->renderctx); |
6438 | 6471 | drm_gem_object_unreference(&dev_priv->renderctx->base); | |
6439 | I915_WRITE(CCID, 0); | ||
6440 | POSTING_READ(CCID); | ||
6441 | |||
6442 | i915_gem_object_unpin(obj); | ||
6443 | drm_gem_object_unreference(&obj->base); | ||
6444 | dev_priv->renderctx = NULL; | 6472 | dev_priv->renderctx = NULL; |
6445 | } | 6473 | } |
6446 | 6474 | ||
6447 | if (dev_priv->pwrctx) { | 6475 | if (dev_priv->pwrctx) { |
6448 | struct drm_i915_gem_object *obj = dev_priv->pwrctx; | 6476 | i915_gem_object_unpin(dev_priv->pwrctx); |
6477 | drm_gem_object_unreference(&dev_priv->pwrctx->base); | ||
6478 | dev_priv->pwrctx = NULL; | ||
6479 | } | ||
6480 | } | ||
6481 | |||
6482 | static void ironlake_disable_rc6(struct drm_device *dev) | ||
6483 | { | ||
6484 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
6485 | |||
6486 | if (I915_READ(PWRCTXA)) { | ||
6487 | /* Wake the GPU, prevent RC6, then restore RSTDBYCTL */ | ||
6488 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) | RCX_SW_EXIT); | ||
6489 | wait_for(((I915_READ(RSTDBYCTL) & RSX_STATUS_MASK) == RSX_STATUS_ON), | ||
6490 | 50); | ||
6449 | 6491 | ||
6450 | I915_WRITE(PWRCTXA, 0); | 6492 | I915_WRITE(PWRCTXA, 0); |
6451 | POSTING_READ(PWRCTXA); | 6493 | POSTING_READ(PWRCTXA); |
6452 | 6494 | ||
6453 | i915_gem_object_unpin(obj); | 6495 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) & ~RCX_SW_EXIT); |
6454 | drm_gem_object_unreference(&obj->base); | 6496 | POSTING_READ(RSTDBYCTL); |
6455 | dev_priv->pwrctx = NULL; | ||
6456 | } | 6497 | } |
6498 | |||
6499 | ironlake_disable_rc6(dev); | ||
6457 | } | 6500 | } |
6458 | 6501 | ||
6459 | static void ironlake_disable_rc6(struct drm_device *dev) | 6502 | static int ironlake_setup_rc6(struct drm_device *dev) |
6460 | { | 6503 | { |
6461 | struct drm_i915_private *dev_priv = dev->dev_private; | 6504 | struct drm_i915_private *dev_priv = dev->dev_private; |
6462 | 6505 | ||
6463 | /* Wake the GPU, prevent RC6, then restore RSTDBYCTL */ | 6506 | if (dev_priv->renderctx == NULL) |
6464 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) | RCX_SW_EXIT); | 6507 | dev_priv->renderctx = intel_alloc_context_page(dev); |
6465 | wait_for(((I915_READ(RSTDBYCTL) & RSX_STATUS_MASK) == RSX_STATUS_ON), | 6508 | if (!dev_priv->renderctx) |
6466 | 10); | 6509 | return -ENOMEM; |
6467 | POSTING_READ(CCID); | 6510 | |
6468 | I915_WRITE(PWRCTXA, 0); | 6511 | if (dev_priv->pwrctx == NULL) |
6469 | POSTING_READ(PWRCTXA); | 6512 | dev_priv->pwrctx = intel_alloc_context_page(dev); |
6470 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) & ~RCX_SW_EXIT); | 6513 | if (!dev_priv->pwrctx) { |
6471 | POSTING_READ(RSTDBYCTL); | 6514 | ironlake_teardown_rc6(dev); |
6472 | i915_gem_object_unpin(dev_priv->renderctx); | 6515 | return -ENOMEM; |
6473 | drm_gem_object_unreference(&dev_priv->renderctx->base); | 6516 | } |
6474 | dev_priv->renderctx = NULL; | 6517 | |
6475 | i915_gem_object_unpin(dev_priv->pwrctx); | 6518 | return 0; |
6476 | drm_gem_object_unreference(&dev_priv->pwrctx->base); | ||
6477 | dev_priv->pwrctx = NULL; | ||
6478 | } | 6519 | } |
6479 | 6520 | ||
6480 | void ironlake_enable_rc6(struct drm_device *dev) | 6521 | void ironlake_enable_rc6(struct drm_device *dev) |
@@ -6482,15 +6523,26 @@ void ironlake_enable_rc6(struct drm_device *dev) | |||
6482 | struct drm_i915_private *dev_priv = dev->dev_private; | 6523 | struct drm_i915_private *dev_priv = dev->dev_private; |
6483 | int ret; | 6524 | int ret; |
6484 | 6525 | ||
6526 | /* rc6 disabled by default due to repeated reports of hanging during | ||
6527 | * boot and resume. | ||
6528 | */ | ||
6529 | if (!i915_enable_rc6) | ||
6530 | return; | ||
6531 | |||
6532 | ret = ironlake_setup_rc6(dev); | ||
6533 | if (ret) | ||
6534 | return; | ||
6535 | |||
6485 | /* | 6536 | /* |
6486 | * GPU can automatically power down the render unit if given a page | 6537 | * GPU can automatically power down the render unit if given a page |
6487 | * to save state. | 6538 | * to save state. |
6488 | */ | 6539 | */ |
6489 | ret = BEGIN_LP_RING(6); | 6540 | ret = BEGIN_LP_RING(6); |
6490 | if (ret) { | 6541 | if (ret) { |
6491 | ironlake_disable_rc6(dev); | 6542 | ironlake_teardown_rc6(dev); |
6492 | return; | 6543 | return; |
6493 | } | 6544 | } |
6545 | |||
6494 | OUT_RING(MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN); | 6546 | OUT_RING(MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN); |
6495 | OUT_RING(MI_SET_CONTEXT); | 6547 | OUT_RING(MI_SET_CONTEXT); |
6496 | OUT_RING(dev_priv->renderctx->gtt_offset | | 6548 | OUT_RING(dev_priv->renderctx->gtt_offset | |
@@ -6507,6 +6559,7 @@ void ironlake_enable_rc6(struct drm_device *dev) | |||
6507 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) & ~RCX_SW_EXIT); | 6559 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) & ~RCX_SW_EXIT); |
6508 | } | 6560 | } |
6509 | 6561 | ||
6562 | |||
6510 | /* Set up chip specific display functions */ | 6563 | /* Set up chip specific display functions */ |
6511 | static void intel_init_display(struct drm_device *dev) | 6564 | static void intel_init_display(struct drm_device *dev) |
6512 | { | 6565 | { |
@@ -6749,21 +6802,9 @@ void intel_modeset_init(struct drm_device *dev) | |||
6749 | if (IS_GEN6(dev)) | 6802 | if (IS_GEN6(dev)) |
6750 | gen6_enable_rps(dev_priv); | 6803 | gen6_enable_rps(dev_priv); |
6751 | 6804 | ||
6752 | if (IS_IRONLAKE_M(dev)) { | 6805 | if (IS_IRONLAKE_M(dev)) |
6753 | dev_priv->renderctx = intel_alloc_context_page(dev); | ||
6754 | if (!dev_priv->renderctx) | ||
6755 | goto skip_rc6; | ||
6756 | dev_priv->pwrctx = intel_alloc_context_page(dev); | ||
6757 | if (!dev_priv->pwrctx) { | ||
6758 | i915_gem_object_unpin(dev_priv->renderctx); | ||
6759 | drm_gem_object_unreference(&dev_priv->renderctx->base); | ||
6760 | dev_priv->renderctx = NULL; | ||
6761 | goto skip_rc6; | ||
6762 | } | ||
6763 | ironlake_enable_rc6(dev); | 6806 | ironlake_enable_rc6(dev); |
6764 | } | ||
6765 | 6807 | ||
6766 | skip_rc6: | ||
6767 | INIT_WORK(&dev_priv->idle_work, intel_idle_update); | 6808 | INIT_WORK(&dev_priv->idle_work, intel_idle_update); |
6768 | setup_timer(&dev_priv->idle_timer, intel_gpu_idle_timer, | 6809 | setup_timer(&dev_priv->idle_timer, intel_gpu_idle_timer, |
6769 | (unsigned long)dev); | 6810 | (unsigned long)dev); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 1f4242b682c8..51cb4e36997f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1639,6 +1639,24 @@ static int intel_dp_get_modes(struct drm_connector *connector) | |||
1639 | return 0; | 1639 | return 0; |
1640 | } | 1640 | } |
1641 | 1641 | ||
1642 | static bool | ||
1643 | intel_dp_detect_audio(struct drm_connector *connector) | ||
1644 | { | ||
1645 | struct intel_dp *intel_dp = intel_attached_dp(connector); | ||
1646 | struct edid *edid; | ||
1647 | bool has_audio = false; | ||
1648 | |||
1649 | edid = drm_get_edid(connector, &intel_dp->adapter); | ||
1650 | if (edid) { | ||
1651 | has_audio = drm_detect_monitor_audio(edid); | ||
1652 | |||
1653 | connector->display_info.raw_edid = NULL; | ||
1654 | kfree(edid); | ||
1655 | } | ||
1656 | |||
1657 | return has_audio; | ||
1658 | } | ||
1659 | |||
1642 | static int | 1660 | static int |
1643 | intel_dp_set_property(struct drm_connector *connector, | 1661 | intel_dp_set_property(struct drm_connector *connector, |
1644 | struct drm_property *property, | 1662 | struct drm_property *property, |
@@ -1652,17 +1670,23 @@ intel_dp_set_property(struct drm_connector *connector, | |||
1652 | return ret; | 1670 | return ret; |
1653 | 1671 | ||
1654 | if (property == intel_dp->force_audio_property) { | 1672 | if (property == intel_dp->force_audio_property) { |
1655 | if (val == intel_dp->force_audio) | 1673 | int i = val; |
1674 | bool has_audio; | ||
1675 | |||
1676 | if (i == intel_dp->force_audio) | ||
1656 | return 0; | 1677 | return 0; |
1657 | 1678 | ||
1658 | intel_dp->force_audio = val; | 1679 | intel_dp->force_audio = i; |
1659 | 1680 | ||
1660 | if (val > 0 && intel_dp->has_audio) | 1681 | if (i == 0) |
1661 | return 0; | 1682 | has_audio = intel_dp_detect_audio(connector); |
1662 | if (val < 0 && !intel_dp->has_audio) | 1683 | else |
1684 | has_audio = i > 0; | ||
1685 | |||
1686 | if (has_audio == intel_dp->has_audio) | ||
1663 | return 0; | 1687 | return 0; |
1664 | 1688 | ||
1665 | intel_dp->has_audio = val > 0; | 1689 | intel_dp->has_audio = has_audio; |
1666 | goto done; | 1690 | goto done; |
1667 | } | 1691 | } |
1668 | 1692 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 74db2557d644..2c431049963c 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -298,7 +298,6 @@ extern void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, | |||
298 | extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | 298 | extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, |
299 | u16 *blue, int regno); | 299 | u16 *blue, int regno); |
300 | extern void intel_enable_clock_gating(struct drm_device *dev); | 300 | extern void intel_enable_clock_gating(struct drm_device *dev); |
301 | extern void intel_disable_clock_gating(struct drm_device *dev); | ||
302 | extern void ironlake_enable_drps(struct drm_device *dev); | 301 | extern void ironlake_enable_drps(struct drm_device *dev); |
303 | extern void ironlake_disable_drps(struct drm_device *dev); | 302 | extern void ironlake_disable_drps(struct drm_device *dev); |
304 | extern void gen6_enable_rps(struct drm_i915_private *dev_priv); | 303 | extern void gen6_enable_rps(struct drm_i915_private *dev_priv); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 0d0273e7b029..c635c9e357b9 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -251,6 +251,27 @@ static int intel_hdmi_get_modes(struct drm_connector *connector) | |||
251 | &dev_priv->gmbus[intel_hdmi->ddc_bus].adapter); | 251 | &dev_priv->gmbus[intel_hdmi->ddc_bus].adapter); |
252 | } | 252 | } |
253 | 253 | ||
254 | static bool | ||
255 | intel_hdmi_detect_audio(struct drm_connector *connector) | ||
256 | { | ||
257 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); | ||
258 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
259 | struct edid *edid; | ||
260 | bool has_audio = false; | ||
261 | |||
262 | edid = drm_get_edid(connector, | ||
263 | &dev_priv->gmbus[intel_hdmi->ddc_bus].adapter); | ||
264 | if (edid) { | ||
265 | if (edid->input & DRM_EDID_INPUT_DIGITAL) | ||
266 | has_audio = drm_detect_monitor_audio(edid); | ||
267 | |||
268 | connector->display_info.raw_edid = NULL; | ||
269 | kfree(edid); | ||
270 | } | ||
271 | |||
272 | return has_audio; | ||
273 | } | ||
274 | |||
254 | static int | 275 | static int |
255 | intel_hdmi_set_property(struct drm_connector *connector, | 276 | intel_hdmi_set_property(struct drm_connector *connector, |
256 | struct drm_property *property, | 277 | struct drm_property *property, |
@@ -264,17 +285,23 @@ intel_hdmi_set_property(struct drm_connector *connector, | |||
264 | return ret; | 285 | return ret; |
265 | 286 | ||
266 | if (property == intel_hdmi->force_audio_property) { | 287 | if (property == intel_hdmi->force_audio_property) { |
267 | if (val == intel_hdmi->force_audio) | 288 | int i = val; |
289 | bool has_audio; | ||
290 | |||
291 | if (i == intel_hdmi->force_audio) | ||
268 | return 0; | 292 | return 0; |
269 | 293 | ||
270 | intel_hdmi->force_audio = val; | 294 | intel_hdmi->force_audio = i; |
271 | 295 | ||
272 | if (val > 0 && intel_hdmi->has_audio) | 296 | if (i == 0) |
273 | return 0; | 297 | has_audio = intel_hdmi_detect_audio(connector); |
274 | if (val < 0 && !intel_hdmi->has_audio) | 298 | else |
299 | has_audio = i > 0; | ||
300 | |||
301 | if (has_audio == intel_hdmi->has_audio) | ||
275 | return 0; | 302 | return 0; |
276 | 303 | ||
277 | intel_hdmi->has_audio = val > 0; | 304 | intel_hdmi->has_audio = has_audio; |
278 | goto done; | 305 | goto done; |
279 | } | 306 | } |
280 | 307 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index ace8d5d30dd2..bcdba7bd5cfa 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -261,12 +261,6 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
261 | return true; | 261 | return true; |
262 | } | 262 | } |
263 | 263 | ||
264 | /* Make sure pre-965s set dither correctly */ | ||
265 | if (INTEL_INFO(dev)->gen < 4) { | ||
266 | if (dev_priv->lvds_dither) | ||
267 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
268 | } | ||
269 | |||
270 | /* Native modes don't need fitting */ | 264 | /* Native modes don't need fitting */ |
271 | if (adjusted_mode->hdisplay == mode->hdisplay && | 265 | if (adjusted_mode->hdisplay == mode->hdisplay && |
272 | adjusted_mode->vdisplay == mode->vdisplay) | 266 | adjusted_mode->vdisplay == mode->vdisplay) |
@@ -374,10 +368,16 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
374 | } | 368 | } |
375 | 369 | ||
376 | out: | 370 | out: |
371 | /* If not enabling scaling, be consistent and always use 0. */ | ||
377 | if ((pfit_control & PFIT_ENABLE) == 0) { | 372 | if ((pfit_control & PFIT_ENABLE) == 0) { |
378 | pfit_control = 0; | 373 | pfit_control = 0; |
379 | pfit_pgm_ratios = 0; | 374 | pfit_pgm_ratios = 0; |
380 | } | 375 | } |
376 | |||
377 | /* Make sure pre-965 set dither correctly */ | ||
378 | if (INTEL_INFO(dev)->gen < 4 && dev_priv->lvds_dither) | ||
379 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
380 | |||
381 | if (pfit_control != intel_lvds->pfit_control || | 381 | if (pfit_control != intel_lvds->pfit_control || |
382 | pfit_pgm_ratios != intel_lvds->pfit_pgm_ratios) { | 382 | pfit_pgm_ratios != intel_lvds->pfit_pgm_ratios) { |
383 | intel_lvds->pfit_control = pfit_control; | 383 | intel_lvds->pfit_control = pfit_control; |
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index f295a7aaadf9..64fd64443ca6 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/acpi.h> | 28 | #include <linux/acpi.h> |
29 | #include <linux/acpi_io.h> | ||
29 | #include <acpi/video.h> | 30 | #include <acpi/video.h> |
30 | 31 | ||
31 | #include "drmP.h" | 32 | #include "drmP.h" |
@@ -476,7 +477,7 @@ int intel_opregion_setup(struct drm_device *dev) | |||
476 | return -ENOTSUPP; | 477 | return -ENOTSUPP; |
477 | } | 478 | } |
478 | 479 | ||
479 | base = ioremap(asls, OPREGION_SIZE); | 480 | base = acpi_os_ioremap(asls, OPREGION_SIZE); |
480 | if (!base) | 481 | if (!base) |
481 | return -ENOMEM; | 482 | return -ENOMEM; |
482 | 483 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index f6b9baa6a63d..445f27efe677 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -34,6 +34,14 @@ | |||
34 | #include "i915_trace.h" | 34 | #include "i915_trace.h" |
35 | #include "intel_drv.h" | 35 | #include "intel_drv.h" |
36 | 36 | ||
37 | static inline int ring_space(struct intel_ring_buffer *ring) | ||
38 | { | ||
39 | int space = (ring->head & HEAD_ADDR) - (ring->tail + 8); | ||
40 | if (space < 0) | ||
41 | space += ring->size; | ||
42 | return space; | ||
43 | } | ||
44 | |||
37 | static u32 i915_gem_get_seqno(struct drm_device *dev) | 45 | static u32 i915_gem_get_seqno(struct drm_device *dev) |
38 | { | 46 | { |
39 | drm_i915_private_t *dev_priv = dev->dev_private; | 47 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -204,11 +212,9 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
204 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) | 212 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) |
205 | i915_kernel_lost_context(ring->dev); | 213 | i915_kernel_lost_context(ring->dev); |
206 | else { | 214 | else { |
207 | ring->head = I915_READ_HEAD(ring) & HEAD_ADDR; | 215 | ring->head = I915_READ_HEAD(ring); |
208 | ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; | 216 | ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; |
209 | ring->space = ring->head - (ring->tail + 8); | 217 | ring->space = ring_space(ring); |
210 | if (ring->space < 0) | ||
211 | ring->space += ring->size; | ||
212 | } | 218 | } |
213 | 219 | ||
214 | return 0; | 220 | return 0; |
@@ -921,32 +927,34 @@ static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring) | |||
921 | } | 927 | } |
922 | 928 | ||
923 | ring->tail = 0; | 929 | ring->tail = 0; |
924 | ring->space = ring->head - 8; | 930 | ring->space = ring_space(ring); |
925 | 931 | ||
926 | return 0; | 932 | return 0; |
927 | } | 933 | } |
928 | 934 | ||
929 | int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) | 935 | int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) |
930 | { | 936 | { |
931 | int reread = 0; | ||
932 | struct drm_device *dev = ring->dev; | 937 | struct drm_device *dev = ring->dev; |
933 | struct drm_i915_private *dev_priv = dev->dev_private; | 938 | struct drm_i915_private *dev_priv = dev->dev_private; |
934 | unsigned long end; | 939 | unsigned long end; |
935 | u32 head; | 940 | u32 head; |
936 | 941 | ||
942 | /* If the reported head position has wrapped or hasn't advanced, | ||
943 | * fallback to the slow and accurate path. | ||
944 | */ | ||
945 | head = intel_read_status_page(ring, 4); | ||
946 | if (head > ring->head) { | ||
947 | ring->head = head; | ||
948 | ring->space = ring_space(ring); | ||
949 | if (ring->space >= n) | ||
950 | return 0; | ||
951 | } | ||
952 | |||
937 | trace_i915_ring_wait_begin (dev); | 953 | trace_i915_ring_wait_begin (dev); |
938 | end = jiffies + 3 * HZ; | 954 | end = jiffies + 3 * HZ; |
939 | do { | 955 | do { |
940 | /* If the reported head position has wrapped or hasn't advanced, | 956 | ring->head = I915_READ_HEAD(ring); |
941 | * fallback to the slow and accurate path. | 957 | ring->space = ring_space(ring); |
942 | */ | ||
943 | head = intel_read_status_page(ring, 4); | ||
944 | if (reread) | ||
945 | head = I915_READ_HEAD(ring); | ||
946 | ring->head = head & HEAD_ADDR; | ||
947 | ring->space = ring->head - (ring->tail + 8); | ||
948 | if (ring->space < 0) | ||
949 | ring->space += ring->size; | ||
950 | if (ring->space >= n) { | 958 | if (ring->space >= n) { |
951 | trace_i915_ring_wait_end(dev); | 959 | trace_i915_ring_wait_end(dev); |
952 | return 0; | 960 | return 0; |
@@ -961,7 +969,6 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) | |||
961 | msleep(1); | 969 | msleep(1); |
962 | if (atomic_read(&dev_priv->mm.wedged)) | 970 | if (atomic_read(&dev_priv->mm.wedged)) |
963 | return -EAGAIN; | 971 | return -EAGAIN; |
964 | reread = 1; | ||
965 | } while (!time_after(jiffies, end)); | 972 | } while (!time_after(jiffies, end)); |
966 | trace_i915_ring_wait_end (dev); | 973 | trace_i915_ring_wait_end (dev); |
967 | return -EBUSY; | 974 | return -EBUSY; |
@@ -1052,22 +1059,25 @@ static void gen6_bsd_ring_write_tail(struct intel_ring_buffer *ring, | |||
1052 | } | 1059 | } |
1053 | 1060 | ||
1054 | static int gen6_ring_flush(struct intel_ring_buffer *ring, | 1061 | static int gen6_ring_flush(struct intel_ring_buffer *ring, |
1055 | u32 invalidate_domains, | 1062 | u32 invalidate, u32 flush) |
1056 | u32 flush_domains) | ||
1057 | { | 1063 | { |
1064 | uint32_t cmd; | ||
1058 | int ret; | 1065 | int ret; |
1059 | 1066 | ||
1060 | if ((flush_domains & I915_GEM_DOMAIN_RENDER) == 0) | 1067 | if (((invalidate | flush) & I915_GEM_GPU_DOMAINS) == 0) |
1061 | return 0; | 1068 | return 0; |
1062 | 1069 | ||
1063 | ret = intel_ring_begin(ring, 4); | 1070 | ret = intel_ring_begin(ring, 4); |
1064 | if (ret) | 1071 | if (ret) |
1065 | return ret; | 1072 | return ret; |
1066 | 1073 | ||
1067 | intel_ring_emit(ring, MI_FLUSH_DW); | 1074 | cmd = MI_FLUSH_DW; |
1068 | intel_ring_emit(ring, 0); | 1075 | if (invalidate & I915_GEM_GPU_DOMAINS) |
1076 | cmd |= MI_INVALIDATE_TLB | MI_INVALIDATE_BSD; | ||
1077 | intel_ring_emit(ring, cmd); | ||
1069 | intel_ring_emit(ring, 0); | 1078 | intel_ring_emit(ring, 0); |
1070 | intel_ring_emit(ring, 0); | 1079 | intel_ring_emit(ring, 0); |
1080 | intel_ring_emit(ring, MI_NOOP); | ||
1071 | intel_ring_advance(ring); | 1081 | intel_ring_advance(ring); |
1072 | return 0; | 1082 | return 0; |
1073 | } | 1083 | } |
@@ -1223,22 +1233,25 @@ static int blt_ring_begin(struct intel_ring_buffer *ring, | |||
1223 | } | 1233 | } |
1224 | 1234 | ||
1225 | static int blt_ring_flush(struct intel_ring_buffer *ring, | 1235 | static int blt_ring_flush(struct intel_ring_buffer *ring, |
1226 | u32 invalidate_domains, | 1236 | u32 invalidate, u32 flush) |
1227 | u32 flush_domains) | ||
1228 | { | 1237 | { |
1238 | uint32_t cmd; | ||
1229 | int ret; | 1239 | int ret; |
1230 | 1240 | ||
1231 | if ((flush_domains & I915_GEM_DOMAIN_RENDER) == 0) | 1241 | if (((invalidate | flush) & I915_GEM_DOMAIN_RENDER) == 0) |
1232 | return 0; | 1242 | return 0; |
1233 | 1243 | ||
1234 | ret = blt_ring_begin(ring, 4); | 1244 | ret = blt_ring_begin(ring, 4); |
1235 | if (ret) | 1245 | if (ret) |
1236 | return ret; | 1246 | return ret; |
1237 | 1247 | ||
1238 | intel_ring_emit(ring, MI_FLUSH_DW); | 1248 | cmd = MI_FLUSH_DW; |
1239 | intel_ring_emit(ring, 0); | 1249 | if (invalidate & I915_GEM_DOMAIN_RENDER) |
1250 | cmd |= MI_INVALIDATE_TLB; | ||
1251 | intel_ring_emit(ring, cmd); | ||
1240 | intel_ring_emit(ring, 0); | 1252 | intel_ring_emit(ring, 0); |
1241 | intel_ring_emit(ring, 0); | 1253 | intel_ring_emit(ring, 0); |
1254 | intel_ring_emit(ring, MI_NOOP); | ||
1242 | intel_ring_advance(ring); | 1255 | intel_ring_advance(ring); |
1243 | return 0; | 1256 | return 0; |
1244 | } | 1257 | } |
@@ -1292,6 +1305,48 @@ int intel_init_render_ring_buffer(struct drm_device *dev) | |||
1292 | return intel_init_ring_buffer(dev, ring); | 1305 | return intel_init_ring_buffer(dev, ring); |
1293 | } | 1306 | } |
1294 | 1307 | ||
1308 | int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) | ||
1309 | { | ||
1310 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1311 | struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; | ||
1312 | |||
1313 | *ring = render_ring; | ||
1314 | if (INTEL_INFO(dev)->gen >= 6) { | ||
1315 | ring->add_request = gen6_add_request; | ||
1316 | ring->irq_get = gen6_render_ring_get_irq; | ||
1317 | ring->irq_put = gen6_render_ring_put_irq; | ||
1318 | } else if (IS_GEN5(dev)) { | ||
1319 | ring->add_request = pc_render_add_request; | ||
1320 | ring->get_seqno = pc_render_get_seqno; | ||
1321 | } | ||
1322 | |||
1323 | ring->dev = dev; | ||
1324 | INIT_LIST_HEAD(&ring->active_list); | ||
1325 | INIT_LIST_HEAD(&ring->request_list); | ||
1326 | INIT_LIST_HEAD(&ring->gpu_write_list); | ||
1327 | |||
1328 | ring->size = size; | ||
1329 | ring->effective_size = ring->size; | ||
1330 | if (IS_I830(ring->dev)) | ||
1331 | ring->effective_size -= 128; | ||
1332 | |||
1333 | ring->map.offset = start; | ||
1334 | ring->map.size = size; | ||
1335 | ring->map.type = 0; | ||
1336 | ring->map.flags = 0; | ||
1337 | ring->map.mtrr = 0; | ||
1338 | |||
1339 | drm_core_ioremap_wc(&ring->map, dev); | ||
1340 | if (ring->map.handle == NULL) { | ||
1341 | DRM_ERROR("can not ioremap virtual address for" | ||
1342 | " ring buffer\n"); | ||
1343 | return -ENOMEM; | ||
1344 | } | ||
1345 | |||
1346 | ring->virtual_start = (void __force __iomem *)ring->map.handle; | ||
1347 | return 0; | ||
1348 | } | ||
1349 | |||
1295 | int intel_init_bsd_ring_buffer(struct drm_device *dev) | 1350 | int intel_init_bsd_ring_buffer(struct drm_device *dev) |
1296 | { | 1351 | { |
1297 | drm_i915_private_t *dev_priv = dev->dev_private; | 1352 | drm_i915_private_t *dev_priv = dev->dev_private; |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 5b0abfa881fc..6d6fde85a636 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -166,4 +166,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev); | |||
166 | u32 intel_ring_get_active_head(struct intel_ring_buffer *ring); | 166 | u32 intel_ring_get_active_head(struct intel_ring_buffer *ring); |
167 | void intel_ring_setup_status_page(struct intel_ring_buffer *ring); | 167 | void intel_ring_setup_status_page(struct intel_ring_buffer *ring); |
168 | 168 | ||
169 | /* DRI warts */ | ||
170 | int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size); | ||
171 | |||
169 | #endif /* _INTEL_RINGBUFFER_H_ */ | 172 | #endif /* _INTEL_RINGBUFFER_H_ */ |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 45cd37652a37..7c50cdce84f0 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -46,6 +46,7 @@ | |||
46 | SDVO_TV_MASK) | 46 | SDVO_TV_MASK) |
47 | 47 | ||
48 | #define IS_TV(c) (c->output_flag & SDVO_TV_MASK) | 48 | #define IS_TV(c) (c->output_flag & SDVO_TV_MASK) |
49 | #define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK) | ||
49 | #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) | 50 | #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) |
50 | #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) | 51 | #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) |
51 | 52 | ||
@@ -473,20 +474,6 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd, | |||
473 | return false; | 474 | return false; |
474 | } | 475 | } |
475 | 476 | ||
476 | i = 3; | ||
477 | while (status == SDVO_CMD_STATUS_PENDING && i--) { | ||
478 | if (!intel_sdvo_read_byte(intel_sdvo, | ||
479 | SDVO_I2C_CMD_STATUS, | ||
480 | &status)) | ||
481 | return false; | ||
482 | } | ||
483 | if (status != SDVO_CMD_STATUS_SUCCESS) { | ||
484 | DRM_DEBUG_KMS("command returns response %s [%d]\n", | ||
485 | status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP ? cmd_status_names[status] : "???", | ||
486 | status); | ||
487 | return false; | ||
488 | } | ||
489 | |||
490 | return true; | 477 | return true; |
491 | } | 478 | } |
492 | 479 | ||
@@ -497,6 +484,8 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, | |||
497 | u8 status; | 484 | u8 status; |
498 | int i; | 485 | int i; |
499 | 486 | ||
487 | DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(intel_sdvo)); | ||
488 | |||
500 | /* | 489 | /* |
501 | * The documentation states that all commands will be | 490 | * The documentation states that all commands will be |
502 | * processed within 15µs, and that we need only poll | 491 | * processed within 15µs, and that we need only poll |
@@ -505,14 +494,19 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, | |||
505 | * | 494 | * |
506 | * Check 5 times in case the hardware failed to read the docs. | 495 | * Check 5 times in case the hardware failed to read the docs. |
507 | */ | 496 | */ |
508 | do { | 497 | if (!intel_sdvo_read_byte(intel_sdvo, |
498 | SDVO_I2C_CMD_STATUS, | ||
499 | &status)) | ||
500 | goto log_fail; | ||
501 | |||
502 | while (status == SDVO_CMD_STATUS_PENDING && retry--) { | ||
503 | udelay(15); | ||
509 | if (!intel_sdvo_read_byte(intel_sdvo, | 504 | if (!intel_sdvo_read_byte(intel_sdvo, |
510 | SDVO_I2C_CMD_STATUS, | 505 | SDVO_I2C_CMD_STATUS, |
511 | &status)) | 506 | &status)) |
512 | return false; | 507 | goto log_fail; |
513 | } while (status == SDVO_CMD_STATUS_PENDING && --retry); | 508 | } |
514 | 509 | ||
515 | DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(intel_sdvo)); | ||
516 | if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) | 510 | if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) |
517 | DRM_LOG_KMS("(%s)", cmd_status_names[status]); | 511 | DRM_LOG_KMS("(%s)", cmd_status_names[status]); |
518 | else | 512 | else |
@@ -533,7 +527,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, | |||
533 | return true; | 527 | return true; |
534 | 528 | ||
535 | log_fail: | 529 | log_fail: |
536 | DRM_LOG_KMS("\n"); | 530 | DRM_LOG_KMS("... failed\n"); |
537 | return false; | 531 | return false; |
538 | } | 532 | } |
539 | 533 | ||
@@ -550,6 +544,7 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode) | |||
550 | static bool intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, | 544 | static bool intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, |
551 | u8 ddc_bus) | 545 | u8 ddc_bus) |
552 | { | 546 | { |
547 | /* This must be the immediately preceding write before the i2c xfer */ | ||
553 | return intel_sdvo_write_cmd(intel_sdvo, | 548 | return intel_sdvo_write_cmd(intel_sdvo, |
554 | SDVO_CMD_SET_CONTROL_BUS_SWITCH, | 549 | SDVO_CMD_SET_CONTROL_BUS_SWITCH, |
555 | &ddc_bus, 1); | 550 | &ddc_bus, 1); |
@@ -557,7 +552,10 @@ static bool intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, | |||
557 | 552 | ||
558 | static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len) | 553 | static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len) |
559 | { | 554 | { |
560 | return intel_sdvo_write_cmd(intel_sdvo, cmd, data, len); | 555 | if (!intel_sdvo_write_cmd(intel_sdvo, cmd, data, len)) |
556 | return false; | ||
557 | |||
558 | return intel_sdvo_read_response(intel_sdvo, NULL, 0); | ||
561 | } | 559 | } |
562 | 560 | ||
563 | static bool | 561 | static bool |
@@ -859,18 +857,21 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
859 | 857 | ||
860 | intel_dip_infoframe_csum(&avi_if); | 858 | intel_dip_infoframe_csum(&avi_if); |
861 | 859 | ||
862 | if (!intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_HBUF_INDEX, | 860 | if (!intel_sdvo_set_value(intel_sdvo, |
861 | SDVO_CMD_SET_HBUF_INDEX, | ||
863 | set_buf_index, 2)) | 862 | set_buf_index, 2)) |
864 | return false; | 863 | return false; |
865 | 864 | ||
866 | for (i = 0; i < sizeof(avi_if); i += 8) { | 865 | for (i = 0; i < sizeof(avi_if); i += 8) { |
867 | if (!intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_HBUF_DATA, | 866 | if (!intel_sdvo_set_value(intel_sdvo, |
867 | SDVO_CMD_SET_HBUF_DATA, | ||
868 | data, 8)) | 868 | data, 8)) |
869 | return false; | 869 | return false; |
870 | data++; | 870 | data++; |
871 | } | 871 | } |
872 | 872 | ||
873 | return intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_HBUF_TXRATE, | 873 | return intel_sdvo_set_value(intel_sdvo, |
874 | SDVO_CMD_SET_HBUF_TXRATE, | ||
874 | &tx_rate, 1); | 875 | &tx_rate, 1); |
875 | } | 876 | } |
876 | 877 | ||
@@ -1359,7 +1360,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector) | |||
1359 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); | 1360 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); |
1360 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); | 1361 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); |
1361 | } | 1362 | } |
1362 | } | 1363 | } else |
1364 | status = connector_status_disconnected; | ||
1363 | connector->display_info.raw_edid = NULL; | 1365 | connector->display_info.raw_edid = NULL; |
1364 | kfree(edid); | 1366 | kfree(edid); |
1365 | } | 1367 | } |
@@ -1407,10 +1409,25 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) | |||
1407 | 1409 | ||
1408 | if ((intel_sdvo_connector->output_flag & response) == 0) | 1410 | if ((intel_sdvo_connector->output_flag & response) == 0) |
1409 | ret = connector_status_disconnected; | 1411 | ret = connector_status_disconnected; |
1410 | else if (response & SDVO_TMDS_MASK) | 1412 | else if (IS_TMDS(intel_sdvo_connector)) |
1411 | ret = intel_sdvo_hdmi_sink_detect(connector); | 1413 | ret = intel_sdvo_hdmi_sink_detect(connector); |
1412 | else | 1414 | else { |
1413 | ret = connector_status_connected; | 1415 | struct edid *edid; |
1416 | |||
1417 | /* if we have an edid check it matches the connection */ | ||
1418 | edid = intel_sdvo_get_edid(connector); | ||
1419 | if (edid == NULL) | ||
1420 | edid = intel_sdvo_get_analog_edid(connector); | ||
1421 | if (edid != NULL) { | ||
1422 | if (edid->input & DRM_EDID_INPUT_DIGITAL) | ||
1423 | ret = connector_status_disconnected; | ||
1424 | else | ||
1425 | ret = connector_status_connected; | ||
1426 | connector->display_info.raw_edid = NULL; | ||
1427 | kfree(edid); | ||
1428 | } else | ||
1429 | ret = connector_status_connected; | ||
1430 | } | ||
1414 | 1431 | ||
1415 | /* May update encoder flag for like clock for SDVO TV, etc.*/ | 1432 | /* May update encoder flag for like clock for SDVO TV, etc.*/ |
1416 | if (ret == connector_status_connected) { | 1433 | if (ret == connector_status_connected) { |
@@ -1446,10 +1463,15 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) | |||
1446 | edid = intel_sdvo_get_analog_edid(connector); | 1463 | edid = intel_sdvo_get_analog_edid(connector); |
1447 | 1464 | ||
1448 | if (edid != NULL) { | 1465 | if (edid != NULL) { |
1449 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { | 1466 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); |
1467 | bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); | ||
1468 | bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector); | ||
1469 | |||
1470 | if (connector_is_digital == monitor_is_digital) { | ||
1450 | drm_mode_connector_update_edid_property(connector, edid); | 1471 | drm_mode_connector_update_edid_property(connector, edid); |
1451 | drm_add_edid_modes(connector, edid); | 1472 | drm_add_edid_modes(connector, edid); |
1452 | } | 1473 | } |
1474 | |||
1453 | connector->display_info.raw_edid = NULL; | 1475 | connector->display_info.raw_edid = NULL; |
1454 | kfree(edid); | 1476 | kfree(edid); |
1455 | } | 1477 | } |
@@ -1668,6 +1690,22 @@ static void intel_sdvo_destroy(struct drm_connector *connector) | |||
1668 | kfree(connector); | 1690 | kfree(connector); |
1669 | } | 1691 | } |
1670 | 1692 | ||
1693 | static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector) | ||
1694 | { | ||
1695 | struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector); | ||
1696 | struct edid *edid; | ||
1697 | bool has_audio = false; | ||
1698 | |||
1699 | if (!intel_sdvo->is_hdmi) | ||
1700 | return false; | ||
1701 | |||
1702 | edid = intel_sdvo_get_edid(connector); | ||
1703 | if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL) | ||
1704 | has_audio = drm_detect_monitor_audio(edid); | ||
1705 | |||
1706 | return has_audio; | ||
1707 | } | ||
1708 | |||
1671 | static int | 1709 | static int |
1672 | intel_sdvo_set_property(struct drm_connector *connector, | 1710 | intel_sdvo_set_property(struct drm_connector *connector, |
1673 | struct drm_property *property, | 1711 | struct drm_property *property, |
@@ -1684,17 +1722,23 @@ intel_sdvo_set_property(struct drm_connector *connector, | |||
1684 | return ret; | 1722 | return ret; |
1685 | 1723 | ||
1686 | if (property == intel_sdvo_connector->force_audio_property) { | 1724 | if (property == intel_sdvo_connector->force_audio_property) { |
1687 | if (val == intel_sdvo_connector->force_audio) | 1725 | int i = val; |
1726 | bool has_audio; | ||
1727 | |||
1728 | if (i == intel_sdvo_connector->force_audio) | ||
1688 | return 0; | 1729 | return 0; |
1689 | 1730 | ||
1690 | intel_sdvo_connector->force_audio = val; | 1731 | intel_sdvo_connector->force_audio = i; |
1691 | 1732 | ||
1692 | if (val > 0 && intel_sdvo->has_hdmi_audio) | 1733 | if (i == 0) |
1693 | return 0; | 1734 | has_audio = intel_sdvo_detect_hdmi_audio(connector); |
1694 | if (val < 0 && !intel_sdvo->has_hdmi_audio) | 1735 | else |
1736 | has_audio = i > 0; | ||
1737 | |||
1738 | if (has_audio == intel_sdvo->has_hdmi_audio) | ||
1695 | return 0; | 1739 | return 0; |
1696 | 1740 | ||
1697 | intel_sdvo->has_hdmi_audio = val > 0; | 1741 | intel_sdvo->has_hdmi_audio = has_audio; |
1698 | goto done; | 1742 | goto done; |
1699 | } | 1743 | } |
1700 | 1744 | ||
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 93206e4eaa6f..fe4a53a50b83 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1234,7 +1234,8 @@ static const struct drm_display_mode reported_modes[] = { | |||
1234 | * \return false if TV is disconnected. | 1234 | * \return false if TV is disconnected. |
1235 | */ | 1235 | */ |
1236 | static int | 1236 | static int |
1237 | intel_tv_detect_type (struct intel_tv *intel_tv) | 1237 | intel_tv_detect_type (struct intel_tv *intel_tv, |
1238 | struct drm_connector *connector) | ||
1238 | { | 1239 | { |
1239 | struct drm_encoder *encoder = &intel_tv->base.base; | 1240 | struct drm_encoder *encoder = &intel_tv->base.base; |
1240 | struct drm_device *dev = encoder->dev; | 1241 | struct drm_device *dev = encoder->dev; |
@@ -1245,11 +1246,13 @@ intel_tv_detect_type (struct intel_tv *intel_tv) | |||
1245 | int type; | 1246 | int type; |
1246 | 1247 | ||
1247 | /* Disable TV interrupts around load detect or we'll recurse */ | 1248 | /* Disable TV interrupts around load detect or we'll recurse */ |
1248 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); | 1249 | if (connector->polled & DRM_CONNECTOR_POLL_HPD) { |
1249 | i915_disable_pipestat(dev_priv, 0, | 1250 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); |
1250 | PIPE_HOTPLUG_INTERRUPT_ENABLE | | 1251 | i915_disable_pipestat(dev_priv, 0, |
1251 | PIPE_HOTPLUG_TV_INTERRUPT_ENABLE); | 1252 | PIPE_HOTPLUG_INTERRUPT_ENABLE | |
1252 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | 1253 | PIPE_HOTPLUG_TV_INTERRUPT_ENABLE); |
1254 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | ||
1255 | } | ||
1253 | 1256 | ||
1254 | save_tv_dac = tv_dac = I915_READ(TV_DAC); | 1257 | save_tv_dac = tv_dac = I915_READ(TV_DAC); |
1255 | save_tv_ctl = tv_ctl = I915_READ(TV_CTL); | 1258 | save_tv_ctl = tv_ctl = I915_READ(TV_CTL); |
@@ -1302,11 +1305,13 @@ intel_tv_detect_type (struct intel_tv *intel_tv) | |||
1302 | I915_WRITE(TV_CTL, save_tv_ctl); | 1305 | I915_WRITE(TV_CTL, save_tv_ctl); |
1303 | 1306 | ||
1304 | /* Restore interrupt config */ | 1307 | /* Restore interrupt config */ |
1305 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); | 1308 | if (connector->polled & DRM_CONNECTOR_POLL_HPD) { |
1306 | i915_enable_pipestat(dev_priv, 0, | 1309 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); |
1307 | PIPE_HOTPLUG_INTERRUPT_ENABLE | | 1310 | i915_enable_pipestat(dev_priv, 0, |
1308 | PIPE_HOTPLUG_TV_INTERRUPT_ENABLE); | 1311 | PIPE_HOTPLUG_INTERRUPT_ENABLE | |
1309 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | 1312 | PIPE_HOTPLUG_TV_INTERRUPT_ENABLE); |
1313 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); | ||
1314 | } | ||
1310 | 1315 | ||
1311 | return type; | 1316 | return type; |
1312 | } | 1317 | } |
@@ -1356,7 +1361,7 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1356 | drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V); | 1361 | drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V); |
1357 | 1362 | ||
1358 | if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) { | 1363 | if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) { |
1359 | type = intel_tv_detect_type(intel_tv); | 1364 | type = intel_tv_detect_type(intel_tv, connector); |
1360 | } else if (force) { | 1365 | } else if (force) { |
1361 | struct drm_crtc *crtc; | 1366 | struct drm_crtc *crtc; |
1362 | int dpms_mode; | 1367 | int dpms_mode; |
@@ -1364,7 +1369,7 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1364 | crtc = intel_get_load_detect_pipe(&intel_tv->base, connector, | 1369 | crtc = intel_get_load_detect_pipe(&intel_tv->base, connector, |
1365 | &mode, &dpms_mode); | 1370 | &mode, &dpms_mode); |
1366 | if (crtc) { | 1371 | if (crtc) { |
1367 | type = intel_tv_detect_type(intel_tv); | 1372 | type = intel_tv_detect_type(intel_tv, connector); |
1368 | intel_release_load_detect_pipe(&intel_tv->base, connector, | 1373 | intel_release_load_detect_pipe(&intel_tv->base, connector, |
1369 | dpms_mode); | 1374 | dpms_mode); |
1370 | } else | 1375 | } else |
@@ -1658,6 +1663,18 @@ intel_tv_init(struct drm_device *dev) | |||
1658 | intel_encoder = &intel_tv->base; | 1663 | intel_encoder = &intel_tv->base; |
1659 | connector = &intel_connector->base; | 1664 | connector = &intel_connector->base; |
1660 | 1665 | ||
1666 | /* The documentation, for the older chipsets at least, recommend | ||
1667 | * using a polling method rather than hotplug detection for TVs. | ||
1668 | * This is because in order to perform the hotplug detection, the PLLs | ||
1669 | * for the TV must be kept alive increasing power drain and starving | ||
1670 | * bandwidth from other encoders. Notably for instance, it causes | ||
1671 | * pipe underruns on Crestline when this encoder is supposedly idle. | ||
1672 | * | ||
1673 | * More recent chipsets favour HDMI rather than integrated S-Video. | ||
1674 | */ | ||
1675 | connector->polled = | ||
1676 | DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; | ||
1677 | |||
1661 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, | 1678 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, |
1662 | DRM_MODE_CONNECTOR_SVIDEO); | 1679 | DRM_MODE_CONNECTOR_SVIDEO); |
1663 | 1680 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 2aef5cd3acf5..6bdab891c64e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -6228,7 +6228,7 @@ parse_dcb15_entry(struct drm_device *dev, struct dcb_table *dcb, | |||
6228 | entry->tvconf.has_component_output = false; | 6228 | entry->tvconf.has_component_output = false; |
6229 | break; | 6229 | break; |
6230 | case OUTPUT_LVDS: | 6230 | case OUTPUT_LVDS: |
6231 | if ((conn & 0x00003f00) != 0x10) | 6231 | if ((conn & 0x00003f00) >> 8 != 0x10) |
6232 | entry->lvdsconf.use_straps_for_mode = true; | 6232 | entry->lvdsconf.use_straps_for_mode = true; |
6233 | entry->lvdsconf.use_power_scripts = true; | 6233 | entry->lvdsconf.use_power_scripts = true; |
6234 | break; | 6234 | break; |
@@ -6310,6 +6310,9 @@ void merge_like_dcb_entries(struct drm_device *dev, struct dcb_table *dcb) | |||
6310 | static bool | 6310 | static bool |
6311 | apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | 6311 | apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) |
6312 | { | 6312 | { |
6313 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
6314 | struct dcb_table *dcb = &dev_priv->vbios.dcb; | ||
6315 | |||
6313 | /* Dell Precision M6300 | 6316 | /* Dell Precision M6300 |
6314 | * DCB entry 2: 02025312 00000010 | 6317 | * DCB entry 2: 02025312 00000010 |
6315 | * DCB entry 3: 02026312 00000020 | 6318 | * DCB entry 3: 02026312 00000020 |
@@ -6327,6 +6330,18 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | |||
6327 | return false; | 6330 | return false; |
6328 | } | 6331 | } |
6329 | 6332 | ||
6333 | /* GeForce3 Ti 200 | ||
6334 | * | ||
6335 | * DCB reports an LVDS output that should be TMDS: | ||
6336 | * DCB entry 1: f2005014 ffffffff | ||
6337 | */ | ||
6338 | if (nv_match_device(dev, 0x0201, 0x1462, 0x8851)) { | ||
6339 | if (*conn == 0xf2005014 && *conf == 0xffffffff) { | ||
6340 | fabricate_dcb_output(dcb, OUTPUT_TMDS, 1, 1, 1); | ||
6341 | return false; | ||
6342 | } | ||
6343 | } | ||
6344 | |||
6330 | return true; | 6345 | return true; |
6331 | } | 6346 | } |
6332 | 6347 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index a7fae26f4654..d38a4d9f9b0b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -128,6 +128,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | nvbo->bo.mem.num_pages = size >> PAGE_SHIFT; | ||
131 | nouveau_bo_placement_set(nvbo, flags, 0); | 132 | nouveau_bo_placement_set(nvbo, flags, 0); |
132 | 133 | ||
133 | nvbo->channel = chan; | 134 | nvbo->channel = chan; |
@@ -166,17 +167,17 @@ static void | |||
166 | set_placement_range(struct nouveau_bo *nvbo, uint32_t type) | 167 | set_placement_range(struct nouveau_bo *nvbo, uint32_t type) |
167 | { | 168 | { |
168 | struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); | 169 | struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); |
170 | int vram_pages = dev_priv->vram_size >> PAGE_SHIFT; | ||
169 | 171 | ||
170 | if (dev_priv->card_type == NV_10 && | 172 | if (dev_priv->card_type == NV_10 && |
171 | nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM)) { | 173 | nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM) && |
174 | nvbo->bo.mem.num_pages < vram_pages / 2) { | ||
172 | /* | 175 | /* |
173 | * Make sure that the color and depth buffers are handled | 176 | * Make sure that the color and depth buffers are handled |
174 | * by independent memory controller units. Up to a 9x | 177 | * by independent memory controller units. Up to a 9x |
175 | * speed up when alpha-blending and depth-test are enabled | 178 | * speed up when alpha-blending and depth-test are enabled |
176 | * at the same time. | 179 | * at the same time. |
177 | */ | 180 | */ |
178 | int vram_pages = dev_priv->vram_size >> PAGE_SHIFT; | ||
179 | |||
180 | if (nvbo->tile_flags & NOUVEAU_GEM_TILE_ZETA) { | 181 | if (nvbo->tile_flags & NOUVEAU_GEM_TILE_ZETA) { |
181 | nvbo->placement.fpfn = vram_pages / 2; | 182 | nvbo->placement.fpfn = vram_pages / 2; |
182 | nvbo->placement.lpfn = ~0; | 183 | nvbo->placement.lpfn = ~0; |
@@ -785,7 +786,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
785 | if (ret) | 786 | if (ret) |
786 | goto out; | 787 | goto out; |
787 | 788 | ||
788 | ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); | 789 | ret = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, new_mem); |
789 | out: | 790 | out: |
790 | ttm_bo_mem_put(bo, &tmp_mem); | 791 | ttm_bo_mem_put(bo, &tmp_mem); |
791 | return ret; | 792 | return ret; |
@@ -811,11 +812,11 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
811 | if (ret) | 812 | if (ret) |
812 | return ret; | 813 | return ret; |
813 | 814 | ||
814 | ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, &tmp_mem); | 815 | ret = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, &tmp_mem); |
815 | if (ret) | 816 | if (ret) |
816 | goto out; | 817 | goto out; |
817 | 818 | ||
818 | ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem); | 819 | ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_reserve, no_wait_gpu, new_mem); |
819 | if (ret) | 820 | if (ret) |
820 | goto out; | 821 | goto out; |
821 | 822 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index a21e00076839..390d82c3c4b0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -507,6 +507,7 @@ nouveau_connector_native_mode(struct drm_connector *connector) | |||
507 | int high_w = 0, high_h = 0, high_v = 0; | 507 | int high_w = 0, high_h = 0, high_v = 0; |
508 | 508 | ||
509 | list_for_each_entry(mode, &nv_connector->base.probed_modes, head) { | 509 | list_for_each_entry(mode, &nv_connector->base.probed_modes, head) { |
510 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
510 | if (helper->mode_valid(connector, mode) != MODE_OK || | 511 | if (helper->mode_valid(connector, mode) != MODE_OK || |
511 | (mode->flags & DRM_MODE_FLAG_INTERLACE)) | 512 | (mode->flags & DRM_MODE_FLAG_INTERLACE)) |
512 | continue; | 513 | continue; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 13bb672a16f4..f658a04eecf9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -234,9 +234,9 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
234 | pci_set_power_state(pdev, PCI_D3hot); | 234 | pci_set_power_state(pdev, PCI_D3hot); |
235 | } | 235 | } |
236 | 236 | ||
237 | acquire_console_sem(); | 237 | console_lock(); |
238 | nouveau_fbcon_set_suspend(dev, 1); | 238 | nouveau_fbcon_set_suspend(dev, 1); |
239 | release_console_sem(); | 239 | console_unlock(); |
240 | nouveau_fbcon_restore_accel(dev); | 240 | nouveau_fbcon_restore_accel(dev); |
241 | return 0; | 241 | return 0; |
242 | 242 | ||
@@ -359,9 +359,9 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
359 | nv_crtc->lut.depth = 0; | 359 | nv_crtc->lut.depth = 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | acquire_console_sem(); | 362 | console_lock(); |
363 | nouveau_fbcon_set_suspend(dev, 0); | 363 | nouveau_fbcon_set_suspend(dev, 0); |
364 | release_console_sem(); | 364 | console_unlock(); |
365 | 365 | ||
366 | nouveau_fbcon_zfill_all(dev); | 366 | nouveau_fbcon_zfill_all(dev); |
367 | 367 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 01bffc4412d2..9821fcacc3d2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -848,9 +848,6 @@ extern void nv10_mem_put_tile_region(struct drm_device *dev, | |||
848 | struct nouveau_fence *fence); | 848 | struct nouveau_fence *fence); |
849 | extern const struct ttm_mem_type_manager_func nouveau_vram_manager; | 849 | extern const struct ttm_mem_type_manager_func nouveau_vram_manager; |
850 | 850 | ||
851 | /* nvc0_vram.c */ | ||
852 | extern const struct ttm_mem_type_manager_func nvc0_vram_manager; | ||
853 | |||
854 | /* nouveau_notifier.c */ | 851 | /* nouveau_notifier.c */ |
855 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); | 852 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); |
856 | extern void nouveau_notifier_takedown_channel(struct nouveau_channel *); | 853 | extern void nouveau_notifier_takedown_channel(struct nouveau_channel *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index fb846a3fef15..4399e2f34db4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -443,7 +443,7 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
443 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 443 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
444 | 444 | ||
445 | if (pm->hwmon) { | 445 | if (pm->hwmon) { |
446 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 446 | sysfs_remove_group(&dev->pdev->dev.kobj, &hwmon_attrgroup); |
447 | hwmon_device_unregister(pm->hwmon); | 447 | hwmon_device_unregister(pm->hwmon); |
448 | } | 448 | } |
449 | #endif | 449 | #endif |
@@ -543,7 +543,7 @@ nouveau_pm_resume(struct drm_device *dev) | |||
543 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 543 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
544 | struct nouveau_pm_level *perflvl; | 544 | struct nouveau_pm_level *perflvl; |
545 | 545 | ||
546 | if (pm->cur == &pm->boot) | 546 | if (!pm->cur || pm->cur == &pm->boot) |
547 | return; | 547 | return; |
548 | 548 | ||
549 | perflvl = pm->cur; | 549 | perflvl = pm->cur; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c index 7ecc4adc1e45..8d9968e1cba8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_temp.c +++ b/drivers/gpu/drm/nouveau/nouveau_temp.c | |||
@@ -265,8 +265,8 @@ nouveau_temp_probe_i2c(struct drm_device *dev) | |||
265 | struct i2c_board_info info[] = { | 265 | struct i2c_board_info info[] = { |
266 | { I2C_BOARD_INFO("w83l785ts", 0x2d) }, | 266 | { I2C_BOARD_INFO("w83l785ts", 0x2d) }, |
267 | { I2C_BOARD_INFO("w83781d", 0x2d) }, | 267 | { I2C_BOARD_INFO("w83781d", 0x2d) }, |
268 | { I2C_BOARD_INFO("f75375", 0x2e) }, | ||
269 | { I2C_BOARD_INFO("adt7473", 0x2e) }, | 268 | { I2C_BOARD_INFO("adt7473", 0x2e) }, |
269 | { I2C_BOARD_INFO("f75375", 0x2e) }, | ||
270 | { I2C_BOARD_INFO("lm99", 0x4c) }, | 270 | { I2C_BOARD_INFO("lm99", 0x4c) }, |
271 | { } | 271 | { } |
272 | }; | 272 | }; |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index ef23550407b5..c82db37d9f41 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -342,8 +342,8 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder, | |||
342 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { | 342 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { |
343 | bool duallink, dummy; | 343 | bool duallink, dummy; |
344 | 344 | ||
345 | nouveau_bios_parse_lvds_table(dev, nv_connector->native_mode-> | 345 | nouveau_bios_parse_lvds_table(dev, output_mode->clock, |
346 | clock, &duallink, &dummy); | 346 | &duallink, &dummy); |
347 | if (duallink) | 347 | if (duallink) |
348 | regp->fp_control |= (8 << 28); | 348 | regp->fp_control |= (8 << 28); |
349 | } else | 349 | } else |
@@ -518,8 +518,6 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) | |||
518 | return; | 518 | return; |
519 | 519 | ||
520 | if (nv_encoder->dcb->lvdsconf.use_power_scripts) { | 520 | if (nv_encoder->dcb->lvdsconf.use_power_scripts) { |
521 | struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder); | ||
522 | |||
523 | /* when removing an output, crtc may not be set, but PANEL_OFF | 521 | /* when removing an output, crtc may not be set, but PANEL_OFF |
524 | * must still be run | 522 | * must still be run |
525 | */ | 523 | */ |
@@ -527,12 +525,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) | |||
527 | nv04_dfp_get_bound_head(dev, nv_encoder->dcb); | 525 | nv04_dfp_get_bound_head(dev, nv_encoder->dcb); |
528 | 526 | ||
529 | if (mode == DRM_MODE_DPMS_ON) { | 527 | if (mode == DRM_MODE_DPMS_ON) { |
530 | if (!nv_connector->native_mode) { | ||
531 | NV_ERROR(dev, "Not turning on LVDS without native mode\n"); | ||
532 | return; | ||
533 | } | ||
534 | call_lvds_script(dev, nv_encoder->dcb, head, | 528 | call_lvds_script(dev, nv_encoder->dcb, head, |
535 | LVDS_PANEL_ON, nv_connector->native_mode->clock); | 529 | LVDS_PANEL_ON, nv_encoder->mode.clock); |
536 | } else | 530 | } else |
537 | /* pxclk of 0 is fine for PANEL_OFF, and for a | 531 | /* pxclk of 0 is fine for PANEL_OFF, and for a |
538 | * disconnected LVDS encoder there is no native_mode | 532 | * disconnected LVDS encoder there is no native_mode |
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 8870d72388c8..18d30c2c1aa6 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
@@ -211,18 +211,32 @@ nv40_graph_set_tile_region(struct drm_device *dev, int i) | |||
211 | struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i]; | 211 | struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i]; |
212 | 212 | ||
213 | switch (dev_priv->chipset) { | 213 | switch (dev_priv->chipset) { |
214 | case 0x40: | ||
215 | case 0x41: /* guess */ | ||
216 | case 0x42: | ||
217 | case 0x43: | ||
218 | case 0x45: /* guess */ | ||
219 | case 0x4e: | ||
220 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch); | ||
221 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit); | ||
222 | nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr); | ||
223 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tile->pitch); | ||
224 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit); | ||
225 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr); | ||
226 | break; | ||
214 | case 0x44: | 227 | case 0x44: |
215 | case 0x4a: | 228 | case 0x4a: |
216 | case 0x4e: | ||
217 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch); | 229 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch); |
218 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit); | 230 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit); |
219 | nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr); | 231 | nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr); |
220 | break; | 232 | break; |
221 | |||
222 | case 0x46: | 233 | case 0x46: |
223 | case 0x47: | 234 | case 0x47: |
224 | case 0x49: | 235 | case 0x49: |
225 | case 0x4b: | 236 | case 0x4b: |
237 | case 0x4c: | ||
238 | case 0x67: | ||
239 | default: | ||
226 | nv_wr32(dev, NV47_PGRAPH_TSIZE(i), tile->pitch); | 240 | nv_wr32(dev, NV47_PGRAPH_TSIZE(i), tile->pitch); |
227 | nv_wr32(dev, NV47_PGRAPH_TLIMIT(i), tile->limit); | 241 | nv_wr32(dev, NV47_PGRAPH_TLIMIT(i), tile->limit); |
228 | nv_wr32(dev, NV47_PGRAPH_TILE(i), tile->addr); | 242 | nv_wr32(dev, NV47_PGRAPH_TILE(i), tile->addr); |
@@ -230,15 +244,6 @@ nv40_graph_set_tile_region(struct drm_device *dev, int i) | |||
230 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit); | 244 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit); |
231 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr); | 245 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr); |
232 | break; | 246 | break; |
233 | |||
234 | default: | ||
235 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch); | ||
236 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit); | ||
237 | nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr); | ||
238 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tile->pitch); | ||
239 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit); | ||
240 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr); | ||
241 | break; | ||
242 | } | 247 | } |
243 | } | 248 | } |
244 | 249 | ||
@@ -396,17 +401,20 @@ nv40_graph_init(struct drm_device *dev) | |||
396 | break; | 401 | break; |
397 | default: | 402 | default: |
398 | switch (dev_priv->chipset) { | 403 | switch (dev_priv->chipset) { |
399 | case 0x46: | 404 | case 0x41: |
400 | case 0x47: | 405 | case 0x42: |
401 | case 0x49: | 406 | case 0x43: |
402 | case 0x4b: | 407 | case 0x45: |
403 | nv_wr32(dev, 0x400DF0, nv_rd32(dev, NV04_PFB_CFG0)); | 408 | case 0x4e: |
404 | nv_wr32(dev, 0x400DF4, nv_rd32(dev, NV04_PFB_CFG1)); | 409 | case 0x44: |
405 | break; | 410 | case 0x4a: |
406 | default: | ||
407 | nv_wr32(dev, 0x4009F0, nv_rd32(dev, NV04_PFB_CFG0)); | 411 | nv_wr32(dev, 0x4009F0, nv_rd32(dev, NV04_PFB_CFG0)); |
408 | nv_wr32(dev, 0x4009F4, nv_rd32(dev, NV04_PFB_CFG1)); | 412 | nv_wr32(dev, 0x4009F4, nv_rd32(dev, NV04_PFB_CFG1)); |
409 | break; | 413 | break; |
414 | default: | ||
415 | nv_wr32(dev, 0x400DF0, nv_rd32(dev, NV04_PFB_CFG0)); | ||
416 | nv_wr32(dev, 0x400DF4, nv_rd32(dev, NV04_PFB_CFG1)); | ||
417 | break; | ||
410 | } | 418 | } |
411 | nv_wr32(dev, 0x4069F0, nv_rd32(dev, NV04_PFB_CFG0)); | 419 | nv_wr32(dev, 0x4069F0, nv_rd32(dev, NV04_PFB_CFG0)); |
412 | nv_wr32(dev, 0x4069F4, nv_rd32(dev, NV04_PFB_CFG1)); | 420 | nv_wr32(dev, 0x4069F4, nv_rd32(dev, NV04_PFB_CFG1)); |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index 14e24e906ee8..0ea090f4244a 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -283,8 +283,7 @@ nv50_evo_create(struct drm_device *dev) | |||
283 | nv50_evo_channel_del(&dev_priv->evo); | 283 | nv50_evo_channel_del(&dev_priv->evo); |
284 | return ret; | 284 | return ret; |
285 | } | 285 | } |
286 | } else | 286 | } else { |
287 | if (dev_priv->chipset != 0x50) { | ||
288 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, | 287 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, |
289 | 0, 0xffffffff, 0x00010000); | 288 | 0, 0xffffffff, 0x00010000); |
290 | if (ret) { | 289 | if (ret) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 2d7ea75a09d4..37e21d2be95b 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -256,6 +256,7 @@ nv50_graph_destroy_context(struct nouveau_channel *chan) | |||
256 | struct drm_device *dev = chan->dev; | 256 | struct drm_device *dev = chan->dev; |
257 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 257 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
258 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | 258 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; |
259 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
259 | int i, hdr = (dev_priv->chipset == 0x50) ? 0x200 : 0x20; | 260 | int i, hdr = (dev_priv->chipset == 0x50) ? 0x200 : 0x20; |
260 | unsigned long flags; | 261 | unsigned long flags; |
261 | 262 | ||
@@ -265,6 +266,7 @@ nv50_graph_destroy_context(struct nouveau_channel *chan) | |||
265 | return; | 266 | return; |
266 | 267 | ||
267 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | 268 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); |
269 | pfifo->reassign(dev, false); | ||
268 | pgraph->fifo_access(dev, false); | 270 | pgraph->fifo_access(dev, false); |
269 | 271 | ||
270 | if (pgraph->channel(dev) == chan) | 272 | if (pgraph->channel(dev) == chan) |
@@ -275,6 +277,7 @@ nv50_graph_destroy_context(struct nouveau_channel *chan) | |||
275 | dev_priv->engine.instmem.flush(dev); | 277 | dev_priv->engine.instmem.flush(dev); |
276 | 278 | ||
277 | pgraph->fifo_access(dev, true); | 279 | pgraph->fifo_access(dev, true); |
280 | pfifo->reassign(dev, true); | ||
278 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | 281 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); |
279 | 282 | ||
280 | nouveau_gpuobj_ref(NULL, &chan->ramin_grctx); | 283 | nouveau_gpuobj_ref(NULL, &chan->ramin_grctx); |
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c index 38e523e10995..459ff08241e5 100644 --- a/drivers/gpu/drm/nouveau/nv50_vm.c +++ b/drivers/gpu/drm/nouveau/nv50_vm.c | |||
@@ -45,11 +45,6 @@ nv50_vm_map_pgt(struct nouveau_gpuobj *pgd, u32 pde, | |||
45 | } | 45 | } |
46 | 46 | ||
47 | if (phys & 1) { | 47 | if (phys & 1) { |
48 | if (dev_priv->vram_sys_base) { | ||
49 | phys += dev_priv->vram_sys_base; | ||
50 | phys |= 0x30; | ||
51 | } | ||
52 | |||
53 | if (coverage <= 32 * 1024 * 1024) | 48 | if (coverage <= 32 * 1024 * 1024) |
54 | phys |= 0x60; | 49 | phys |= 0x60; |
55 | else if (coverage <= 64 * 1024 * 1024) | 50 | else if (coverage <= 64 * 1024 * 1024) |
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index e6ea7d83187f..eb18a7e89f5b 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "nvc0_graph.h" | 31 | #include "nvc0_graph.h" |
32 | 32 | ||
33 | static void nvc0_graph_isr(struct drm_device *); | 33 | static void nvc0_graph_isr(struct drm_device *); |
34 | static void nvc0_runk140_isr(struct drm_device *); | ||
34 | static int nvc0_graph_unload_context_to(struct drm_device *dev, u64 chan); | 35 | static int nvc0_graph_unload_context_to(struct drm_device *dev, u64 chan); |
35 | 36 | ||
36 | void | 37 | void |
@@ -281,6 +282,7 @@ nvc0_graph_destroy(struct drm_device *dev) | |||
281 | return; | 282 | return; |
282 | 283 | ||
283 | nouveau_irq_unregister(dev, 12); | 284 | nouveau_irq_unregister(dev, 12); |
285 | nouveau_irq_unregister(dev, 25); | ||
284 | 286 | ||
285 | nouveau_gpuobj_ref(NULL, &priv->unk4188b8); | 287 | nouveau_gpuobj_ref(NULL, &priv->unk4188b8); |
286 | nouveau_gpuobj_ref(NULL, &priv->unk4188b4); | 288 | nouveau_gpuobj_ref(NULL, &priv->unk4188b4); |
@@ -390,6 +392,7 @@ nvc0_graph_create(struct drm_device *dev) | |||
390 | } | 392 | } |
391 | 393 | ||
392 | nouveau_irq_register(dev, 12, nvc0_graph_isr); | 394 | nouveau_irq_register(dev, 12, nvc0_graph_isr); |
395 | nouveau_irq_register(dev, 25, nvc0_runk140_isr); | ||
393 | NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */ | 396 | NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */ |
394 | NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */ | 397 | NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */ |
395 | NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */ | 398 | NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */ |
@@ -512,8 +515,8 @@ nvc0_graph_init_gpc_1(struct drm_device *dev) | |||
512 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x224), 0xc0000000); | 515 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x224), 0xc0000000); |
513 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x48c), 0xc0000000); | 516 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x48c), 0xc0000000); |
514 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x084), 0xc0000000); | 517 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x084), 0xc0000000); |
515 | nv_wr32(dev, TP_UNIT(gpc, tp, 0xe44), 0x001ffffe); | 518 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x644), 0x001ffffe); |
516 | nv_wr32(dev, TP_UNIT(gpc, tp, 0xe4c), 0x0000000f); | 519 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x64c), 0x0000000f); |
517 | } | 520 | } |
518 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c90), 0xffffffff); | 521 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c90), 0xffffffff); |
519 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c94), 0xffffffff); | 522 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c94), 0xffffffff); |
@@ -777,3 +780,19 @@ nvc0_graph_isr(struct drm_device *dev) | |||
777 | 780 | ||
778 | nv_wr32(dev, 0x400500, 0x00010001); | 781 | nv_wr32(dev, 0x400500, 0x00010001); |
779 | } | 782 | } |
783 | |||
784 | static void | ||
785 | nvc0_runk140_isr(struct drm_device *dev) | ||
786 | { | ||
787 | u32 units = nv_rd32(dev, 0x00017c) & 0x1f; | ||
788 | |||
789 | while (units) { | ||
790 | u32 unit = ffs(units) - 1; | ||
791 | u32 reg = 0x140000 + unit * 0x2000; | ||
792 | u32 st0 = nv_mask(dev, reg + 0x1020, 0, 0); | ||
793 | u32 st1 = nv_mask(dev, reg + 0x1420, 0, 0); | ||
794 | |||
795 | NV_INFO(dev, "PRUNK140: %d 0x%08x 0x%08x\n", unit, st0, st1); | ||
796 | units &= ~(1 << unit); | ||
797 | } | ||
798 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_grctx.c b/drivers/gpu/drm/nouveau/nvc0_grctx.c index b9e68b2d30aa..f880ff776db8 100644 --- a/drivers/gpu/drm/nouveau/nvc0_grctx.c +++ b/drivers/gpu/drm/nouveau/nvc0_grctx.c | |||
@@ -1830,7 +1830,7 @@ nvc0_grctx_generate(struct nouveau_channel *chan) | |||
1830 | 1830 | ||
1831 | for (tp = 0, id = 0; tp < 4; tp++) { | 1831 | for (tp = 0, id = 0; tp < 4; tp++) { |
1832 | for (gpc = 0; gpc < priv->gpc_nr; gpc++) { | 1832 | for (gpc = 0; gpc < priv->gpc_nr; gpc++) { |
1833 | if (tp <= priv->tp_nr[gpc]) { | 1833 | if (tp < priv->tp_nr[gpc]) { |
1834 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x698), id); | 1834 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x698), id); |
1835 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x4e8), id); | 1835 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x4e8), id); |
1836 | nv_wr32(dev, GPC_UNIT(gpc, 0x0c10 + tp * 4), id); | 1836 | nv_wr32(dev, GPC_UNIT(gpc, 0x0c10 + tp * 4), id); |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b0ab185b86f6..a4e5e53e0a62 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -48,29 +48,29 @@ static void atombios_overscan_setup(struct drm_crtc *crtc, | |||
48 | 48 | ||
49 | switch (radeon_crtc->rmx_type) { | 49 | switch (radeon_crtc->rmx_type) { |
50 | case RMX_CENTER: | 50 | case RMX_CENTER: |
51 | args.usOverscanTop = (adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2; | 51 | args.usOverscanTop = cpu_to_le16((adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2); |
52 | args.usOverscanBottom = (adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2; | 52 | args.usOverscanBottom = cpu_to_le16((adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2); |
53 | args.usOverscanLeft = (adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2; | 53 | args.usOverscanLeft = cpu_to_le16((adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2); |
54 | args.usOverscanRight = (adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2; | 54 | args.usOverscanRight = cpu_to_le16((adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2); |
55 | break; | 55 | break; |
56 | case RMX_ASPECT: | 56 | case RMX_ASPECT: |
57 | a1 = mode->crtc_vdisplay * adjusted_mode->crtc_hdisplay; | 57 | a1 = mode->crtc_vdisplay * adjusted_mode->crtc_hdisplay; |
58 | a2 = adjusted_mode->crtc_vdisplay * mode->crtc_hdisplay; | 58 | a2 = adjusted_mode->crtc_vdisplay * mode->crtc_hdisplay; |
59 | 59 | ||
60 | if (a1 > a2) { | 60 | if (a1 > a2) { |
61 | args.usOverscanLeft = (adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2; | 61 | args.usOverscanLeft = cpu_to_le16((adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2); |
62 | args.usOverscanRight = (adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2; | 62 | args.usOverscanRight = cpu_to_le16((adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2); |
63 | } else if (a2 > a1) { | 63 | } else if (a2 > a1) { |
64 | args.usOverscanLeft = (adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2; | 64 | args.usOverscanLeft = cpu_to_le16((adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2); |
65 | args.usOverscanRight = (adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2; | 65 | args.usOverscanRight = cpu_to_le16((adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2); |
66 | } | 66 | } |
67 | break; | 67 | break; |
68 | case RMX_FULL: | 68 | case RMX_FULL: |
69 | default: | 69 | default: |
70 | args.usOverscanRight = radeon_crtc->h_border; | 70 | args.usOverscanRight = cpu_to_le16(radeon_crtc->h_border); |
71 | args.usOverscanLeft = radeon_crtc->h_border; | 71 | args.usOverscanLeft = cpu_to_le16(radeon_crtc->h_border); |
72 | args.usOverscanBottom = radeon_crtc->v_border; | 72 | args.usOverscanBottom = cpu_to_le16(radeon_crtc->v_border); |
73 | args.usOverscanTop = radeon_crtc->v_border; | 73 | args.usOverscanTop = cpu_to_le16(radeon_crtc->v_border); |
74 | break; | 74 | break; |
75 | } | 75 | } |
76 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 76 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
@@ -419,23 +419,23 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc, | |||
419 | memset(&args, 0, sizeof(args)); | 419 | memset(&args, 0, sizeof(args)); |
420 | 420 | ||
421 | if (ASIC_IS_DCE5(rdev)) { | 421 | if (ASIC_IS_DCE5(rdev)) { |
422 | args.v3.usSpreadSpectrumAmountFrac = 0; | 422 | args.v3.usSpreadSpectrumAmountFrac = cpu_to_le16(0); |
423 | args.v3.ucSpreadSpectrumType = ss->type; | 423 | args.v3.ucSpreadSpectrumType = ss->type; |
424 | switch (pll_id) { | 424 | switch (pll_id) { |
425 | case ATOM_PPLL1: | 425 | case ATOM_PPLL1: |
426 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P1PLL; | 426 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P1PLL; |
427 | args.v3.usSpreadSpectrumAmount = ss->amount; | 427 | args.v3.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
428 | args.v3.usSpreadSpectrumStep = ss->step; | 428 | args.v3.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
429 | break; | 429 | break; |
430 | case ATOM_PPLL2: | 430 | case ATOM_PPLL2: |
431 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P2PLL; | 431 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P2PLL; |
432 | args.v3.usSpreadSpectrumAmount = ss->amount; | 432 | args.v3.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
433 | args.v3.usSpreadSpectrumStep = ss->step; | 433 | args.v3.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
434 | break; | 434 | break; |
435 | case ATOM_DCPLL: | 435 | case ATOM_DCPLL: |
436 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_DCPLL; | 436 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_DCPLL; |
437 | args.v3.usSpreadSpectrumAmount = 0; | 437 | args.v3.usSpreadSpectrumAmount = cpu_to_le16(0); |
438 | args.v3.usSpreadSpectrumStep = 0; | 438 | args.v3.usSpreadSpectrumStep = cpu_to_le16(0); |
439 | break; | 439 | break; |
440 | case ATOM_PPLL_INVALID: | 440 | case ATOM_PPLL_INVALID: |
441 | return; | 441 | return; |
@@ -447,18 +447,18 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc, | |||
447 | switch (pll_id) { | 447 | switch (pll_id) { |
448 | case ATOM_PPLL1: | 448 | case ATOM_PPLL1: |
449 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P1PLL; | 449 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P1PLL; |
450 | args.v2.usSpreadSpectrumAmount = ss->amount; | 450 | args.v2.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
451 | args.v2.usSpreadSpectrumStep = ss->step; | 451 | args.v2.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
452 | break; | 452 | break; |
453 | case ATOM_PPLL2: | 453 | case ATOM_PPLL2: |
454 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P2PLL; | 454 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P2PLL; |
455 | args.v2.usSpreadSpectrumAmount = ss->amount; | 455 | args.v2.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
456 | args.v2.usSpreadSpectrumStep = ss->step; | 456 | args.v2.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
457 | break; | 457 | break; |
458 | case ATOM_DCPLL: | 458 | case ATOM_DCPLL: |
459 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_DCPLL; | 459 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_DCPLL; |
460 | args.v2.usSpreadSpectrumAmount = 0; | 460 | args.v2.usSpreadSpectrumAmount = cpu_to_le16(0); |
461 | args.v2.usSpreadSpectrumStep = 0; | 461 | args.v2.usSpreadSpectrumStep = cpu_to_le16(0); |
462 | break; | 462 | break; |
463 | case ATOM_PPLL_INVALID: | 463 | case ATOM_PPLL_INVALID: |
464 | return; | 464 | return; |
@@ -538,7 +538,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
538 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; | 538 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
539 | else | 539 | else |
540 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; | 540 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
541 | |||
542 | } | 541 | } |
543 | 542 | ||
544 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 543 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
@@ -555,23 +554,28 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
555 | dp_clock = dig_connector->dp_clock; | 554 | dp_clock = dig_connector->dp_clock; |
556 | } | 555 | } |
557 | } | 556 | } |
558 | #if 0 /* doesn't work properly on some laptops */ | 557 | |
559 | /* use recommended ref_div for ss */ | 558 | /* use recommended ref_div for ss */ |
560 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 559 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
561 | if (ss_enabled) { | 560 | if (ss_enabled) { |
562 | if (ss->refdiv) { | 561 | if (ss->refdiv) { |
562 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | ||
563 | pll->flags |= RADEON_PLL_USE_REF_DIV; | 563 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
564 | pll->reference_div = ss->refdiv; | 564 | pll->reference_div = ss->refdiv; |
565 | if (ASIC_IS_AVIVO(rdev)) | ||
566 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
565 | } | 567 | } |
566 | } | 568 | } |
567 | } | 569 | } |
568 | #endif | 570 | |
569 | if (ASIC_IS_AVIVO(rdev)) { | 571 | if (ASIC_IS_AVIVO(rdev)) { |
570 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ | 572 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ |
571 | if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) | 573 | if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) |
572 | adjusted_clock = mode->clock * 2; | 574 | adjusted_clock = mode->clock * 2; |
573 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) | 575 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
574 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; | 576 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; |
577 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
578 | pll->flags |= RADEON_PLL_IS_LCD; | ||
575 | } else { | 579 | } else { |
576 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) | 580 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
577 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; | 581 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; |
@@ -606,14 +610,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
606 | args.v1.usPixelClock = cpu_to_le16(mode->clock / 10); | 610 | args.v1.usPixelClock = cpu_to_le16(mode->clock / 10); |
607 | args.v1.ucTransmitterID = radeon_encoder->encoder_id; | 611 | args.v1.ucTransmitterID = radeon_encoder->encoder_id; |
608 | args.v1.ucEncodeMode = encoder_mode; | 612 | args.v1.ucEncodeMode = encoder_mode; |
609 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { | 613 | if (ss_enabled) |
610 | if (ss_enabled) | ||
611 | args.v1.ucConfig |= | ||
612 | ADJUST_DISPLAY_CONFIG_SS_ENABLE; | ||
613 | } else if (encoder_mode == ATOM_ENCODER_MODE_LVDS) { | ||
614 | args.v1.ucConfig |= | 614 | args.v1.ucConfig |= |
615 | ADJUST_DISPLAY_CONFIG_SS_ENABLE; | 615 | ADJUST_DISPLAY_CONFIG_SS_ENABLE; |
616 | } | ||
617 | 616 | ||
618 | atom_execute_table(rdev->mode_info.atom_context, | 617 | atom_execute_table(rdev->mode_info.atom_context, |
619 | index, (uint32_t *)&args); | 618 | index, (uint32_t *)&args); |
@@ -624,12 +623,12 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
624 | args.v3.sInput.ucTransmitterID = radeon_encoder->encoder_id; | 623 | args.v3.sInput.ucTransmitterID = radeon_encoder->encoder_id; |
625 | args.v3.sInput.ucEncodeMode = encoder_mode; | 624 | args.v3.sInput.ucEncodeMode = encoder_mode; |
626 | args.v3.sInput.ucDispPllConfig = 0; | 625 | args.v3.sInput.ucDispPllConfig = 0; |
626 | if (ss_enabled) | ||
627 | args.v3.sInput.ucDispPllConfig |= | ||
628 | DISPPLL_CONFIG_SS_ENABLE; | ||
627 | if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { | 629 | if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { |
628 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 630 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
629 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { | 631 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { |
630 | if (ss_enabled) | ||
631 | args.v3.sInput.ucDispPllConfig |= | ||
632 | DISPPLL_CONFIG_SS_ENABLE; | ||
633 | args.v3.sInput.ucDispPllConfig |= | 632 | args.v3.sInput.ucDispPllConfig |= |
634 | DISPPLL_CONFIG_COHERENT_MODE; | 633 | DISPPLL_CONFIG_COHERENT_MODE; |
635 | /* 16200 or 27000 */ | 634 | /* 16200 or 27000 */ |
@@ -649,18 +648,11 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
649 | } | 648 | } |
650 | } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 649 | } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
651 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { | 650 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { |
652 | if (ss_enabled) | ||
653 | args.v3.sInput.ucDispPllConfig |= | ||
654 | DISPPLL_CONFIG_SS_ENABLE; | ||
655 | args.v3.sInput.ucDispPllConfig |= | 651 | args.v3.sInput.ucDispPllConfig |= |
656 | DISPPLL_CONFIG_COHERENT_MODE; | 652 | DISPPLL_CONFIG_COHERENT_MODE; |
657 | /* 16200 or 27000 */ | 653 | /* 16200 or 27000 */ |
658 | args.v3.sInput.usPixelClock = cpu_to_le16(dp_clock / 10); | 654 | args.v3.sInput.usPixelClock = cpu_to_le16(dp_clock / 10); |
659 | } else if (encoder_mode == ATOM_ENCODER_MODE_LVDS) { | 655 | } else if (encoder_mode != ATOM_ENCODER_MODE_LVDS) { |
660 | if (ss_enabled) | ||
661 | args.v3.sInput.ucDispPllConfig |= | ||
662 | DISPPLL_CONFIG_SS_ENABLE; | ||
663 | } else { | ||
664 | if (mode->clock > 165000) | 656 | if (mode->clock > 165000) |
665 | args.v3.sInput.ucDispPllConfig |= | 657 | args.v3.sInput.ucDispPllConfig |= |
666 | DISPPLL_CONFIG_DUAL_LINK; | 658 | DISPPLL_CONFIG_DUAL_LINK; |
@@ -670,10 +662,12 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
670 | index, (uint32_t *)&args); | 662 | index, (uint32_t *)&args); |
671 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; | 663 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; |
672 | if (args.v3.sOutput.ucRefDiv) { | 664 | if (args.v3.sOutput.ucRefDiv) { |
665 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
673 | pll->flags |= RADEON_PLL_USE_REF_DIV; | 666 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
674 | pll->reference_div = args.v3.sOutput.ucRefDiv; | 667 | pll->reference_div = args.v3.sOutput.ucRefDiv; |
675 | } | 668 | } |
676 | if (args.v3.sOutput.ucPostDiv) { | 669 | if (args.v3.sOutput.ucPostDiv) { |
670 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
677 | pll->flags |= RADEON_PLL_USE_POST_DIV; | 671 | pll->flags |= RADEON_PLL_USE_POST_DIV; |
678 | pll->post_div = args.v3.sOutput.ucPostDiv; | 672 | pll->post_div = args.v3.sOutput.ucPostDiv; |
679 | } | 673 | } |
@@ -727,14 +721,14 @@ static void atombios_crtc_set_dcpll(struct drm_crtc *crtc, | |||
727 | * SetPixelClock provides the dividers | 721 | * SetPixelClock provides the dividers |
728 | */ | 722 | */ |
729 | args.v5.ucCRTC = ATOM_CRTC_INVALID; | 723 | args.v5.ucCRTC = ATOM_CRTC_INVALID; |
730 | args.v5.usPixelClock = dispclk; | 724 | args.v5.usPixelClock = cpu_to_le16(dispclk); |
731 | args.v5.ucPpll = ATOM_DCPLL; | 725 | args.v5.ucPpll = ATOM_DCPLL; |
732 | break; | 726 | break; |
733 | case 6: | 727 | case 6: |
734 | /* if the default dcpll clock is specified, | 728 | /* if the default dcpll clock is specified, |
735 | * SetPixelClock provides the dividers | 729 | * SetPixelClock provides the dividers |
736 | */ | 730 | */ |
737 | args.v6.ulDispEngClkFreq = dispclk; | 731 | args.v6.ulDispEngClkFreq = cpu_to_le32(dispclk); |
738 | args.v6.ucPpll = ATOM_DCPLL; | 732 | args.v6.ucPpll = ATOM_DCPLL; |
739 | break; | 733 | break; |
740 | default: | 734 | default: |
@@ -963,8 +957,12 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
963 | /* adjust pixel clock as needed */ | 957 | /* adjust pixel clock as needed */ |
964 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); | 958 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); |
965 | 959 | ||
966 | radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | 960 | if (ASIC_IS_AVIVO(rdev)) |
967 | &ref_div, &post_div); | 961 | radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
962 | &ref_div, &post_div); | ||
963 | else | ||
964 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | ||
965 | &ref_div, &post_div); | ||
968 | 966 | ||
969 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); | 967 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); |
970 | 968 | ||
@@ -993,9 +991,9 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
993 | } | 991 | } |
994 | } | 992 | } |
995 | 993 | ||
996 | static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | 994 | static int dce4_crtc_do_set_base(struct drm_crtc *crtc, |
997 | struct drm_framebuffer *fb, | 995 | struct drm_framebuffer *fb, |
998 | int x, int y, int atomic) | 996 | int x, int y, int atomic) |
999 | { | 997 | { |
1000 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 998 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
1001 | struct drm_device *dev = crtc->dev; | 999 | struct drm_device *dev = crtc->dev; |
@@ -1006,6 +1004,7 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1006 | struct radeon_bo *rbo; | 1004 | struct radeon_bo *rbo; |
1007 | uint64_t fb_location; | 1005 | uint64_t fb_location; |
1008 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1006 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1007 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | ||
1009 | int r; | 1008 | int r; |
1010 | 1009 | ||
1011 | /* no fb bound */ | 1010 | /* no fb bound */ |
@@ -1057,11 +1056,17 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1057 | case 16: | 1056 | case 16: |
1058 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1057 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
1059 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); | 1058 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); |
1059 | #ifdef __BIG_ENDIAN | ||
1060 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1061 | #endif | ||
1060 | break; | 1062 | break; |
1061 | case 24: | 1063 | case 24: |
1062 | case 32: | 1064 | case 32: |
1063 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | 1065 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | |
1064 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); | 1066 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); |
1067 | #ifdef __BIG_ENDIAN | ||
1068 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
1069 | #endif | ||
1065 | break; | 1070 | break; |
1066 | default: | 1071 | default: |
1067 | DRM_ERROR("Unsupported screen depth %d\n", | 1072 | DRM_ERROR("Unsupported screen depth %d\n", |
@@ -1106,6 +1111,7 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1106 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | 1111 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
1107 | (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK); | 1112 | (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK); |
1108 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1113 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
1114 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | ||
1109 | 1115 | ||
1110 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1116 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1111 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1117 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
@@ -1127,12 +1133,6 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1127 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1133 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1128 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1134 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); |
1129 | 1135 | ||
1130 | if (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) | ||
1131 | WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, | ||
1132 | EVERGREEN_INTERLEAVE_EN); | ||
1133 | else | ||
1134 | WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, 0); | ||
1135 | |||
1136 | if (!atomic && fb && fb != crtc->fb) { | 1136 | if (!atomic && fb && fb != crtc->fb) { |
1137 | radeon_fb = to_radeon_framebuffer(fb); | 1137 | radeon_fb = to_radeon_framebuffer(fb); |
1138 | rbo = radeon_fb->obj->driver_private; | 1138 | rbo = radeon_fb->obj->driver_private; |
@@ -1162,6 +1162,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1162 | struct drm_framebuffer *target_fb; | 1162 | struct drm_framebuffer *target_fb; |
1163 | uint64_t fb_location; | 1163 | uint64_t fb_location; |
1164 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1164 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1165 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | ||
1165 | int r; | 1166 | int r; |
1166 | 1167 | ||
1167 | /* no fb bound */ | 1168 | /* no fb bound */ |
@@ -1215,12 +1216,18 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1215 | fb_format = | 1216 | fb_format = |
1216 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1217 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
1217 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; | 1218 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; |
1219 | #ifdef __BIG_ENDIAN | ||
1220 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
1221 | #endif | ||
1218 | break; | 1222 | break; |
1219 | case 24: | 1223 | case 24: |
1220 | case 32: | 1224 | case 32: |
1221 | fb_format = | 1225 | fb_format = |
1222 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | 1226 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | |
1223 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; | 1227 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; |
1228 | #ifdef __BIG_ENDIAN | ||
1229 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | ||
1230 | #endif | ||
1224 | break; | 1231 | break; |
1225 | default: | 1232 | default: |
1226 | DRM_ERROR("Unsupported screen depth %d\n", | 1233 | DRM_ERROR("Unsupported screen depth %d\n", |
@@ -1260,6 +1267,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1260 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + | 1267 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + |
1261 | radeon_crtc->crtc_offset, (u32) fb_location); | 1268 | radeon_crtc->crtc_offset, (u32) fb_location); |
1262 | WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1269 | WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
1270 | if (rdev->family >= CHIP_R600) | ||
1271 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | ||
1263 | 1272 | ||
1264 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1273 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1265 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1274 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
@@ -1281,12 +1290,6 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1281 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1290 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1282 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1291 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); |
1283 | 1292 | ||
1284 | if (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) | ||
1285 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, | ||
1286 | AVIVO_D1MODE_INTERLEAVE_EN); | ||
1287 | else | ||
1288 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, 0); | ||
1289 | |||
1290 | if (!atomic && fb && fb != crtc->fb) { | 1293 | if (!atomic && fb && fb != crtc->fb) { |
1291 | radeon_fb = to_radeon_framebuffer(fb); | 1294 | radeon_fb = to_radeon_framebuffer(fb); |
1292 | rbo = radeon_fb->obj->driver_private; | 1295 | rbo = radeon_fb->obj->driver_private; |
@@ -1310,7 +1313,7 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
1310 | struct radeon_device *rdev = dev->dev_private; | 1313 | struct radeon_device *rdev = dev->dev_private; |
1311 | 1314 | ||
1312 | if (ASIC_IS_DCE4(rdev)) | 1315 | if (ASIC_IS_DCE4(rdev)) |
1313 | return evergreen_crtc_do_set_base(crtc, old_fb, x, y, 0); | 1316 | return dce4_crtc_do_set_base(crtc, old_fb, x, y, 0); |
1314 | else if (ASIC_IS_AVIVO(rdev)) | 1317 | else if (ASIC_IS_AVIVO(rdev)) |
1315 | return avivo_crtc_do_set_base(crtc, old_fb, x, y, 0); | 1318 | return avivo_crtc_do_set_base(crtc, old_fb, x, y, 0); |
1316 | else | 1319 | else |
@@ -1325,7 +1328,7 @@ int atombios_crtc_set_base_atomic(struct drm_crtc *crtc, | |||
1325 | struct radeon_device *rdev = dev->dev_private; | 1328 | struct radeon_device *rdev = dev->dev_private; |
1326 | 1329 | ||
1327 | if (ASIC_IS_DCE4(rdev)) | 1330 | if (ASIC_IS_DCE4(rdev)) |
1328 | return evergreen_crtc_do_set_base(crtc, fb, x, y, 1); | 1331 | return dce4_crtc_do_set_base(crtc, fb, x, y, 1); |
1329 | else if (ASIC_IS_AVIVO(rdev)) | 1332 | else if (ASIC_IS_AVIVO(rdev)) |
1330 | return avivo_crtc_do_set_base(crtc, fb, x, y, 1); | 1333 | return avivo_crtc_do_set_base(crtc, fb, x, y, 1); |
1331 | else | 1334 | else |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 4e7778d44b8d..695de9a38506 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock) | |||
187 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) | 187 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) |
188 | { | 188 | { |
189 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); | 189 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); |
190 | int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); | 190 | int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock); |
191 | 191 | ||
192 | if ((lanes == 0) || (bw == 0)) | 192 | if ((lanes == 0) || (dp_clock == 0)) |
193 | return MODE_CLOCK_HIGH; | 193 | return MODE_CLOCK_HIGH; |
194 | 194 | ||
195 | return MODE_OK; | 195 | return MODE_OK; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index a8973acb3987..d270b3ff896b 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -97,26 +97,29 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* get temperature in millidegrees */ | 99 | /* get temperature in millidegrees */ |
100 | u32 evergreen_get_temp(struct radeon_device *rdev) | 100 | int evergreen_get_temp(struct radeon_device *rdev) |
101 | { | 101 | { |
102 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 102 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
103 | ASIC_T_SHIFT; | 103 | ASIC_T_SHIFT; |
104 | u32 actual_temp = 0; | 104 | u32 actual_temp = 0; |
105 | 105 | ||
106 | if ((temp >> 10) & 1) | 106 | if (temp & 0x400) |
107 | actual_temp = 0; | 107 | actual_temp = -256; |
108 | else if ((temp >> 9) & 1) | 108 | else if (temp & 0x200) |
109 | actual_temp = 255; | 109 | actual_temp = 255; |
110 | else | 110 | else if (temp & 0x100) { |
111 | actual_temp = (temp >> 1) & 0xff; | 111 | actual_temp = temp & 0x1ff; |
112 | actual_temp |= ~0x1ff; | ||
113 | } else | ||
114 | actual_temp = temp & 0xff; | ||
112 | 115 | ||
113 | return actual_temp * 1000; | 116 | return (actual_temp * 1000) / 2; |
114 | } | 117 | } |
115 | 118 | ||
116 | u32 sumo_get_temp(struct radeon_device *rdev) | 119 | int sumo_get_temp(struct radeon_device *rdev) |
117 | { | 120 | { |
118 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; | 121 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; |
119 | u32 actual_temp = (temp >> 1) & 0xff; | 122 | int actual_temp = temp - 49; |
120 | 123 | ||
121 | return actual_temp * 1000; | 124 | return actual_temp * 1000; |
122 | } | 125 | } |
@@ -1182,6 +1185,22 @@ static void evergreen_mc_program(struct radeon_device *rdev) | |||
1182 | /* | 1185 | /* |
1183 | * CP. | 1186 | * CP. |
1184 | */ | 1187 | */ |
1188 | void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | ||
1189 | { | ||
1190 | /* set to DX10/11 mode */ | ||
1191 | radeon_ring_write(rdev, PACKET3(PACKET3_MODE_CONTROL, 0)); | ||
1192 | radeon_ring_write(rdev, 1); | ||
1193 | /* FIXME: implement */ | ||
1194 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | ||
1195 | radeon_ring_write(rdev, | ||
1196 | #ifdef __BIG_ENDIAN | ||
1197 | (2 << 0) | | ||
1198 | #endif | ||
1199 | (ib->gpu_addr & 0xFFFFFFFC)); | ||
1200 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); | ||
1201 | radeon_ring_write(rdev, ib->length_dw); | ||
1202 | } | ||
1203 | |||
1185 | 1204 | ||
1186 | static int evergreen_cp_load_microcode(struct radeon_device *rdev) | 1205 | static int evergreen_cp_load_microcode(struct radeon_device *rdev) |
1187 | { | 1206 | { |
@@ -1192,7 +1211,11 @@ static int evergreen_cp_load_microcode(struct radeon_device *rdev) | |||
1192 | return -EINVAL; | 1211 | return -EINVAL; |
1193 | 1212 | ||
1194 | r700_cp_stop(rdev); | 1213 | r700_cp_stop(rdev); |
1195 | WREG32(CP_RB_CNTL, RB_NO_UPDATE | (15 << 8) | (3 << 0)); | 1214 | WREG32(CP_RB_CNTL, |
1215 | #ifdef __BIG_ENDIAN | ||
1216 | BUF_SWAP_32BIT | | ||
1217 | #endif | ||
1218 | RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3)); | ||
1196 | 1219 | ||
1197 | fw_data = (const __be32 *)rdev->pfp_fw->data; | 1220 | fw_data = (const __be32 *)rdev->pfp_fw->data; |
1198 | WREG32(CP_PFP_UCODE_ADDR, 0); | 1221 | WREG32(CP_PFP_UCODE_ADDR, 0); |
@@ -1233,7 +1256,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
1233 | cp_me = 0xff; | 1256 | cp_me = 0xff; |
1234 | WREG32(CP_ME_CNTL, cp_me); | 1257 | WREG32(CP_ME_CNTL, cp_me); |
1235 | 1258 | ||
1236 | r = radeon_ring_lock(rdev, evergreen_default_size + 15); | 1259 | r = radeon_ring_lock(rdev, evergreen_default_size + 19); |
1237 | if (r) { | 1260 | if (r) { |
1238 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | 1261 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
1239 | return r; | 1262 | return r; |
@@ -1266,6 +1289,11 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
1266 | radeon_ring_write(rdev, 0xffffffff); | 1289 | radeon_ring_write(rdev, 0xffffffff); |
1267 | radeon_ring_write(rdev, 0xffffffff); | 1290 | radeon_ring_write(rdev, 0xffffffff); |
1268 | 1291 | ||
1292 | radeon_ring_write(rdev, 0xc0026900); | ||
1293 | radeon_ring_write(rdev, 0x00000316); | ||
1294 | radeon_ring_write(rdev, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | ||
1295 | radeon_ring_write(rdev, 0x00000010); /* */ | ||
1296 | |||
1269 | radeon_ring_unlock_commit(rdev); | 1297 | radeon_ring_unlock_commit(rdev); |
1270 | 1298 | ||
1271 | return 0; | 1299 | return 0; |
@@ -1306,7 +1334,11 @@ int evergreen_cp_resume(struct radeon_device *rdev) | |||
1306 | WREG32(CP_RB_WPTR, 0); | 1334 | WREG32(CP_RB_WPTR, 0); |
1307 | 1335 | ||
1308 | /* set the wb address wether it's enabled or not */ | 1336 | /* set the wb address wether it's enabled or not */ |
1309 | WREG32(CP_RB_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC); | 1337 | WREG32(CP_RB_RPTR_ADDR, |
1338 | #ifdef __BIG_ENDIAN | ||
1339 | RB_RPTR_SWAP(2) | | ||
1340 | #endif | ||
1341 | ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC)); | ||
1310 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); | 1342 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); |
1311 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); | 1343 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); |
1312 | 1344 | ||
@@ -2072,6 +2104,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2072 | WREG32(VGT_CACHE_INVALIDATION, vgt_cache_invalidation); | 2104 | WREG32(VGT_CACHE_INVALIDATION, vgt_cache_invalidation); |
2073 | 2105 | ||
2074 | WREG32(VGT_GS_VERTEX_REUSE, 16); | 2106 | WREG32(VGT_GS_VERTEX_REUSE, 16); |
2107 | WREG32(PA_SU_LINE_STIPPLE_VALUE, 0); | ||
2075 | WREG32(PA_SC_LINE_STIPPLE_STATE, 0); | 2108 | WREG32(PA_SC_LINE_STIPPLE_STATE, 0); |
2076 | 2109 | ||
2077 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14); | 2110 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14); |
@@ -2201,6 +2234,9 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | |||
2201 | struct evergreen_mc_save save; | 2234 | struct evergreen_mc_save save; |
2202 | u32 grbm_reset = 0; | 2235 | u32 grbm_reset = 0; |
2203 | 2236 | ||
2237 | if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) | ||
2238 | return 0; | ||
2239 | |||
2204 | dev_info(rdev->dev, "GPU softreset \n"); | 2240 | dev_info(rdev->dev, "GPU softreset \n"); |
2205 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", | 2241 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", |
2206 | RREG32(GRBM_STATUS)); | 2242 | RREG32(GRBM_STATUS)); |
@@ -2603,8 +2639,8 @@ restart_ih: | |||
2603 | while (rptr != wptr) { | 2639 | while (rptr != wptr) { |
2604 | /* wptr/rptr are in bytes! */ | 2640 | /* wptr/rptr are in bytes! */ |
2605 | ring_index = rptr / 4; | 2641 | ring_index = rptr / 4; |
2606 | src_id = rdev->ih.ring[ring_index] & 0xff; | 2642 | src_id = le32_to_cpu(rdev->ih.ring[ring_index]) & 0xff; |
2607 | src_data = rdev->ih.ring[ring_index + 1] & 0xfffffff; | 2643 | src_data = le32_to_cpu(rdev->ih.ring[ring_index + 1]) & 0xfffffff; |
2608 | 2644 | ||
2609 | switch (src_id) { | 2645 | switch (src_id) { |
2610 | case 1: /* D1 vblank/vline */ | 2646 | case 1: /* D1 vblank/vline */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index b758dc7f2f2c..2adfb03f479b 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
@@ -55,7 +55,7 @@ set_render_target(struct radeon_device *rdev, int format, | |||
55 | if (h < 8) | 55 | if (h < 8) |
56 | h = 8; | 56 | h = 8; |
57 | 57 | ||
58 | cb_color_info = ((format << 2) | (1 << 24)); | 58 | cb_color_info = ((format << 2) | (1 << 24) | (1 << 8)); |
59 | pitch = (w / 8) - 1; | 59 | pitch = (w / 8) - 1; |
60 | slice = ((w * h) / 64) - 1; | 60 | slice = ((w * h) / 64) - 1; |
61 | 61 | ||
@@ -133,6 +133,9 @@ set_vtx_resource(struct radeon_device *rdev, u64 gpu_addr) | |||
133 | 133 | ||
134 | /* high addr, stride */ | 134 | /* high addr, stride */ |
135 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8)); | 135 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8)); |
136 | #ifdef __BIG_ENDIAN | ||
137 | sq_vtx_constant_word2 |= (2 << 30); | ||
138 | #endif | ||
136 | /* xyzw swizzles */ | 139 | /* xyzw swizzles */ |
137 | sq_vtx_constant_word3 = (0 << 3) | (1 << 6) | (2 << 9) | (3 << 12); | 140 | sq_vtx_constant_word3 = (0 << 3) | (1 << 6) | (2 << 9) | (3 << 12); |
138 | 141 | ||
@@ -173,7 +176,7 @@ set_tex_resource(struct radeon_device *rdev, | |||
173 | sq_tex_resource_word0 = (1 << 0); /* 2D */ | 176 | sq_tex_resource_word0 = (1 << 0); /* 2D */ |
174 | sq_tex_resource_word0 |= ((((pitch >> 3) - 1) << 6) | | 177 | sq_tex_resource_word0 |= ((((pitch >> 3) - 1) << 6) | |
175 | ((w - 1) << 18)); | 178 | ((w - 1) << 18)); |
176 | sq_tex_resource_word1 = ((h - 1) << 0); | 179 | sq_tex_resource_word1 = ((h - 1) << 0) | (1 << 28); |
177 | /* xyzw swizzles */ | 180 | /* xyzw swizzles */ |
178 | sq_tex_resource_word4 = (0 << 16) | (1 << 19) | (2 << 22) | (3 << 25); | 181 | sq_tex_resource_word4 = (0 << 16) | (1 << 19) | (2 << 22) | (3 << 25); |
179 | 182 | ||
@@ -221,7 +224,11 @@ draw_auto(struct radeon_device *rdev) | |||
221 | radeon_ring_write(rdev, DI_PT_RECTLIST); | 224 | radeon_ring_write(rdev, DI_PT_RECTLIST); |
222 | 225 | ||
223 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); | 226 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); |
224 | radeon_ring_write(rdev, DI_INDEX_SIZE_16_BIT); | 227 | radeon_ring_write(rdev, |
228 | #ifdef __BIG_ENDIAN | ||
229 | (2 << 2) | | ||
230 | #endif | ||
231 | DI_INDEX_SIZE_16_BIT); | ||
225 | 232 | ||
226 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); | 233 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); |
227 | radeon_ring_write(rdev, 1); | 234 | radeon_ring_write(rdev, 1); |
@@ -232,7 +239,7 @@ draw_auto(struct radeon_device *rdev) | |||
232 | 239 | ||
233 | } | 240 | } |
234 | 241 | ||
235 | /* emits 30 */ | 242 | /* emits 36 */ |
236 | static void | 243 | static void |
237 | set_default_state(struct radeon_device *rdev) | 244 | set_default_state(struct radeon_device *rdev) |
238 | { | 245 | { |
@@ -245,6 +252,8 @@ set_default_state(struct radeon_device *rdev) | |||
245 | int num_hs_threads, num_ls_threads; | 252 | int num_hs_threads, num_ls_threads; |
246 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; | 253 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; |
247 | int num_hs_stack_entries, num_ls_stack_entries; | 254 | int num_hs_stack_entries, num_ls_stack_entries; |
255 | u64 gpu_addr; | ||
256 | int dwords; | ||
248 | 257 | ||
249 | switch (rdev->family) { | 258 | switch (rdev->family) { |
250 | case CHIP_CEDAR: | 259 | case CHIP_CEDAR: |
@@ -497,6 +506,18 @@ set_default_state(struct radeon_device *rdev) | |||
497 | radeon_ring_write(rdev, 0x00000000); | 506 | radeon_ring_write(rdev, 0x00000000); |
498 | radeon_ring_write(rdev, 0x00000000); | 507 | radeon_ring_write(rdev, 0x00000000); |
499 | 508 | ||
509 | /* set to DX10/11 mode */ | ||
510 | radeon_ring_write(rdev, PACKET3(PACKET3_MODE_CONTROL, 0)); | ||
511 | radeon_ring_write(rdev, 1); | ||
512 | |||
513 | /* emit an IB pointing at default state */ | ||
514 | dwords = ALIGN(rdev->r600_blit.state_len, 0x10); | ||
515 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; | ||
516 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | ||
517 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); | ||
518 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); | ||
519 | radeon_ring_write(rdev, dwords); | ||
520 | |||
500 | } | 521 | } |
501 | 522 | ||
502 | static inline uint32_t i2f(uint32_t input) | 523 | static inline uint32_t i2f(uint32_t input) |
@@ -527,8 +548,10 @@ static inline uint32_t i2f(uint32_t input) | |||
527 | int evergreen_blit_init(struct radeon_device *rdev) | 548 | int evergreen_blit_init(struct radeon_device *rdev) |
528 | { | 549 | { |
529 | u32 obj_size; | 550 | u32 obj_size; |
530 | int r; | 551 | int i, r, dwords; |
531 | void *ptr; | 552 | void *ptr; |
553 | u32 packet2s[16]; | ||
554 | int num_packet2s = 0; | ||
532 | 555 | ||
533 | /* pin copy shader into vram if already initialized */ | 556 | /* pin copy shader into vram if already initialized */ |
534 | if (rdev->r600_blit.shader_obj) | 557 | if (rdev->r600_blit.shader_obj) |
@@ -536,8 +559,17 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
536 | 559 | ||
537 | mutex_init(&rdev->r600_blit.mutex); | 560 | mutex_init(&rdev->r600_blit.mutex); |
538 | rdev->r600_blit.state_offset = 0; | 561 | rdev->r600_blit.state_offset = 0; |
539 | rdev->r600_blit.state_len = 0; | 562 | |
540 | obj_size = 0; | 563 | rdev->r600_blit.state_len = evergreen_default_size; |
564 | |||
565 | dwords = rdev->r600_blit.state_len; | ||
566 | while (dwords & 0xf) { | ||
567 | packet2s[num_packet2s++] = cpu_to_le32(PACKET2(0)); | ||
568 | dwords++; | ||
569 | } | ||
570 | |||
571 | obj_size = dwords * 4; | ||
572 | obj_size = ALIGN(obj_size, 256); | ||
541 | 573 | ||
542 | rdev->r600_blit.vs_offset = obj_size; | 574 | rdev->r600_blit.vs_offset = obj_size; |
543 | obj_size += evergreen_vs_size * 4; | 575 | obj_size += evergreen_vs_size * 4; |
@@ -567,8 +599,16 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
567 | return r; | 599 | return r; |
568 | } | 600 | } |
569 | 601 | ||
570 | memcpy(ptr + rdev->r600_blit.vs_offset, evergreen_vs, evergreen_vs_size * 4); | 602 | memcpy_toio(ptr + rdev->r600_blit.state_offset, |
571 | memcpy(ptr + rdev->r600_blit.ps_offset, evergreen_ps, evergreen_ps_size * 4); | 603 | evergreen_default_state, rdev->r600_blit.state_len * 4); |
604 | |||
605 | if (num_packet2s) | ||
606 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | ||
607 | packet2s, num_packet2s * 4); | ||
608 | for (i = 0; i < evergreen_vs_size; i++) | ||
609 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]); | ||
610 | for (i = 0; i < evergreen_ps_size; i++) | ||
611 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]); | ||
572 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 612 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
573 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 613 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
574 | 614 | ||
@@ -652,7 +692,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
652 | /* calculate number of loops correctly */ | 692 | /* calculate number of loops correctly */ |
653 | ring_size = num_loops * dwords_per_loop; | 693 | ring_size = num_loops * dwords_per_loop; |
654 | /* set default + shaders */ | 694 | /* set default + shaders */ |
655 | ring_size += 46; /* shaders + def state */ | 695 | ring_size += 52; /* shaders + def state */ |
656 | ring_size += 10; /* fence emit for VB IB */ | 696 | ring_size += 10; /* fence emit for VB IB */ |
657 | ring_size += 5; /* done copy */ | 697 | ring_size += 5; /* done copy */ |
658 | ring_size += 10; /* fence emit for done copy */ | 698 | ring_size += 10; /* fence emit for done copy */ |
@@ -660,7 +700,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
660 | if (r) | 700 | if (r) |
661 | return r; | 701 | return r; |
662 | 702 | ||
663 | set_default_state(rdev); /* 30 */ | 703 | set_default_state(rdev); /* 36 */ |
664 | set_shaders(rdev); /* 16 */ | 704 | set_shaders(rdev); /* 16 */ |
665 | return 0; | 705 | return 0; |
666 | } | 706 | } |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_shaders.c b/drivers/gpu/drm/radeon/evergreen_blit_shaders.c index ef1d28c07fbf..3a10399e0066 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_shaders.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_shaders.c | |||
@@ -311,11 +311,19 @@ const u32 evergreen_vs[] = | |||
311 | 0x00000000, | 311 | 0x00000000, |
312 | 0x3c000000, | 312 | 0x3c000000, |
313 | 0x67961001, | 313 | 0x67961001, |
314 | #ifdef __BIG_ENDIAN | ||
315 | 0x000a0000, | ||
316 | #else | ||
314 | 0x00080000, | 317 | 0x00080000, |
318 | #endif | ||
315 | 0x00000000, | 319 | 0x00000000, |
316 | 0x1c000000, | 320 | 0x1c000000, |
317 | 0x67961000, | 321 | 0x67961000, |
322 | #ifdef __BIG_ENDIAN | ||
323 | 0x00020008, | ||
324 | #else | ||
318 | 0x00000008, | 325 | 0x00000008, |
326 | #endif | ||
319 | 0x00000000, | 327 | 0x00000000, |
320 | }; | 328 | }; |
321 | 329 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index 36d32d83d866..eb4acf4528ff 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -98,6 +98,7 @@ | |||
98 | #define BUF_SWAP_32BIT (2 << 16) | 98 | #define BUF_SWAP_32BIT (2 << 16) |
99 | #define CP_RB_RPTR 0x8700 | 99 | #define CP_RB_RPTR 0x8700 |
100 | #define CP_RB_RPTR_ADDR 0xC10C | 100 | #define CP_RB_RPTR_ADDR 0xC10C |
101 | #define RB_RPTR_SWAP(x) ((x) << 0) | ||
101 | #define CP_RB_RPTR_ADDR_HI 0xC110 | 102 | #define CP_RB_RPTR_ADDR_HI 0xC110 |
102 | #define CP_RB_RPTR_WR 0xC108 | 103 | #define CP_RB_RPTR_WR 0xC108 |
103 | #define CP_RB_WPTR 0xC114 | 104 | #define CP_RB_WPTR 0xC114 |
@@ -240,6 +241,7 @@ | |||
240 | #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) | 241 | #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) |
241 | #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16) | 242 | #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16) |
242 | #define PA_SC_LINE_STIPPLE 0x28A0C | 243 | #define PA_SC_LINE_STIPPLE 0x28A0C |
244 | #define PA_SU_LINE_STIPPLE_VALUE 0x8A60 | ||
243 | #define PA_SC_LINE_STIPPLE_STATE 0x8B10 | 245 | #define PA_SC_LINE_STIPPLE_STATE 0x8B10 |
244 | 246 | ||
245 | #define SCRATCH_REG0 0x8500 | 247 | #define SCRATCH_REG0 0x8500 |
@@ -652,6 +654,7 @@ | |||
652 | #define PACKET3_DISPATCH_DIRECT 0x15 | 654 | #define PACKET3_DISPATCH_DIRECT 0x15 |
653 | #define PACKET3_DISPATCH_INDIRECT 0x16 | 655 | #define PACKET3_DISPATCH_INDIRECT 0x16 |
654 | #define PACKET3_INDIRECT_BUFFER_END 0x17 | 656 | #define PACKET3_INDIRECT_BUFFER_END 0x17 |
657 | #define PACKET3_MODE_CONTROL 0x18 | ||
655 | #define PACKET3_SET_PREDICATION 0x20 | 658 | #define PACKET3_SET_PREDICATION 0x20 |
656 | #define PACKET3_REG_RMW 0x21 | 659 | #define PACKET3_REG_RMW 0x21 |
657 | #define PACKET3_COND_EXEC 0x22 | 660 | #define PACKET3_COND_EXEC 0x22 |
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c index 607241c6a8a9..5a82b6b75849 100644 --- a/drivers/gpu/drm/radeon/mkregtable.c +++ b/drivers/gpu/drm/radeon/mkregtable.c | |||
@@ -673,8 +673,10 @@ static int parser_auth(struct table *t, const char *filename) | |||
673 | last_reg = strtol(last_reg_s, NULL, 16); | 673 | last_reg = strtol(last_reg_s, NULL, 16); |
674 | 674 | ||
675 | do { | 675 | do { |
676 | if (fgets(buf, 1024, file) == NULL) | 676 | if (fgets(buf, 1024, file) == NULL) { |
677 | fclose(file); | ||
677 | return -1; | 678 | return -1; |
679 | } | ||
678 | len = strlen(buf); | 680 | len = strlen(buf); |
679 | if (ftell(file) == end) | 681 | if (ftell(file) == end) |
680 | done = 1; | 682 | done = 1; |
@@ -685,6 +687,7 @@ static int parser_auth(struct table *t, const char *filename) | |||
685 | fprintf(stderr, | 687 | fprintf(stderr, |
686 | "Error matching regular expression %d in %s\n", | 688 | "Error matching regular expression %d in %s\n", |
687 | r, filename); | 689 | r, filename); |
690 | fclose(file); | ||
688 | return -1; | 691 | return -1; |
689 | } else { | 692 | } else { |
690 | buf[match[0].rm_eo] = 0; | 693 | buf[match[0].rm_eo] = 0; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 46da5142b131..56deae5bf02e 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -1031,8 +1031,8 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
1031 | WREG32(RADEON_CP_CSQ_MODE, | 1031 | WREG32(RADEON_CP_CSQ_MODE, |
1032 | REG_SET(RADEON_INDIRECT2_START, indirect2_start) | | 1032 | REG_SET(RADEON_INDIRECT2_START, indirect2_start) | |
1033 | REG_SET(RADEON_INDIRECT1_START, indirect1_start)); | 1033 | REG_SET(RADEON_INDIRECT1_START, indirect1_start)); |
1034 | WREG32(0x718, 0); | 1034 | WREG32(RADEON_CP_RB_WPTR_DELAY, 0); |
1035 | WREG32(0x744, 0x00004D4D); | 1035 | WREG32(RADEON_CP_CSQ_MODE, 0x00004D4D); |
1036 | WREG32(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM); | 1036 | WREG32(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM); |
1037 | radeon_ring_start(rdev); | 1037 | radeon_ring_start(rdev); |
1038 | r = radeon_ring_test(rdev); | 1038 | r = radeon_ring_test(rdev); |
@@ -1427,6 +1427,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1427 | } | 1427 | } |
1428 | track->zb.robj = reloc->robj; | 1428 | track->zb.robj = reloc->robj; |
1429 | track->zb.offset = idx_value; | 1429 | track->zb.offset = idx_value; |
1430 | track->zb_dirty = true; | ||
1430 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1431 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
1431 | break; | 1432 | break; |
1432 | case RADEON_RB3D_COLOROFFSET: | 1433 | case RADEON_RB3D_COLOROFFSET: |
@@ -1439,6 +1440,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1439 | } | 1440 | } |
1440 | track->cb[0].robj = reloc->robj; | 1441 | track->cb[0].robj = reloc->robj; |
1441 | track->cb[0].offset = idx_value; | 1442 | track->cb[0].offset = idx_value; |
1443 | track->cb_dirty = true; | ||
1442 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1444 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
1443 | break; | 1445 | break; |
1444 | case RADEON_PP_TXOFFSET_0: | 1446 | case RADEON_PP_TXOFFSET_0: |
@@ -1454,6 +1456,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1454 | } | 1456 | } |
1455 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1457 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
1456 | track->textures[i].robj = reloc->robj; | 1458 | track->textures[i].robj = reloc->robj; |
1459 | track->tex_dirty = true; | ||
1457 | break; | 1460 | break; |
1458 | case RADEON_PP_CUBIC_OFFSET_T0_0: | 1461 | case RADEON_PP_CUBIC_OFFSET_T0_0: |
1459 | case RADEON_PP_CUBIC_OFFSET_T0_1: | 1462 | case RADEON_PP_CUBIC_OFFSET_T0_1: |
@@ -1471,6 +1474,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1471 | track->textures[0].cube_info[i].offset = idx_value; | 1474 | track->textures[0].cube_info[i].offset = idx_value; |
1472 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1475 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
1473 | track->textures[0].cube_info[i].robj = reloc->robj; | 1476 | track->textures[0].cube_info[i].robj = reloc->robj; |
1477 | track->tex_dirty = true; | ||
1474 | break; | 1478 | break; |
1475 | case RADEON_PP_CUBIC_OFFSET_T1_0: | 1479 | case RADEON_PP_CUBIC_OFFSET_T1_0: |
1476 | case RADEON_PP_CUBIC_OFFSET_T1_1: | 1480 | case RADEON_PP_CUBIC_OFFSET_T1_1: |
@@ -1488,6 +1492,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1488 | track->textures[1].cube_info[i].offset = idx_value; | 1492 | track->textures[1].cube_info[i].offset = idx_value; |
1489 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1493 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
1490 | track->textures[1].cube_info[i].robj = reloc->robj; | 1494 | track->textures[1].cube_info[i].robj = reloc->robj; |
1495 | track->tex_dirty = true; | ||
1491 | break; | 1496 | break; |
1492 | case RADEON_PP_CUBIC_OFFSET_T2_0: | 1497 | case RADEON_PP_CUBIC_OFFSET_T2_0: |
1493 | case RADEON_PP_CUBIC_OFFSET_T2_1: | 1498 | case RADEON_PP_CUBIC_OFFSET_T2_1: |
@@ -1505,9 +1510,12 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1505 | track->textures[2].cube_info[i].offset = idx_value; | 1510 | track->textures[2].cube_info[i].offset = idx_value; |
1506 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1511 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
1507 | track->textures[2].cube_info[i].robj = reloc->robj; | 1512 | track->textures[2].cube_info[i].robj = reloc->robj; |
1513 | track->tex_dirty = true; | ||
1508 | break; | 1514 | break; |
1509 | case RADEON_RE_WIDTH_HEIGHT: | 1515 | case RADEON_RE_WIDTH_HEIGHT: |
1510 | track->maxy = ((idx_value >> 16) & 0x7FF); | 1516 | track->maxy = ((idx_value >> 16) & 0x7FF); |
1517 | track->cb_dirty = true; | ||
1518 | track->zb_dirty = true; | ||
1511 | break; | 1519 | break; |
1512 | case RADEON_RB3D_COLORPITCH: | 1520 | case RADEON_RB3D_COLORPITCH: |
1513 | r = r100_cs_packet_next_reloc(p, &reloc); | 1521 | r = r100_cs_packet_next_reloc(p, &reloc); |
@@ -1528,9 +1536,11 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1528 | ib[idx] = tmp; | 1536 | ib[idx] = tmp; |
1529 | 1537 | ||
1530 | track->cb[0].pitch = idx_value & RADEON_COLORPITCH_MASK; | 1538 | track->cb[0].pitch = idx_value & RADEON_COLORPITCH_MASK; |
1539 | track->cb_dirty = true; | ||
1531 | break; | 1540 | break; |
1532 | case RADEON_RB3D_DEPTHPITCH: | 1541 | case RADEON_RB3D_DEPTHPITCH: |
1533 | track->zb.pitch = idx_value & RADEON_DEPTHPITCH_MASK; | 1542 | track->zb.pitch = idx_value & RADEON_DEPTHPITCH_MASK; |
1543 | track->zb_dirty = true; | ||
1534 | break; | 1544 | break; |
1535 | case RADEON_RB3D_CNTL: | 1545 | case RADEON_RB3D_CNTL: |
1536 | switch ((idx_value >> RADEON_RB3D_COLOR_FORMAT_SHIFT) & 0x1f) { | 1546 | switch ((idx_value >> RADEON_RB3D_COLOR_FORMAT_SHIFT) & 0x1f) { |
@@ -1555,6 +1565,8 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1555 | return -EINVAL; | 1565 | return -EINVAL; |
1556 | } | 1566 | } |
1557 | track->z_enabled = !!(idx_value & RADEON_Z_ENABLE); | 1567 | track->z_enabled = !!(idx_value & RADEON_Z_ENABLE); |
1568 | track->cb_dirty = true; | ||
1569 | track->zb_dirty = true; | ||
1558 | break; | 1570 | break; |
1559 | case RADEON_RB3D_ZSTENCILCNTL: | 1571 | case RADEON_RB3D_ZSTENCILCNTL: |
1560 | switch (idx_value & 0xf) { | 1572 | switch (idx_value & 0xf) { |
@@ -1572,6 +1584,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1572 | default: | 1584 | default: |
1573 | break; | 1585 | break; |
1574 | } | 1586 | } |
1587 | track->zb_dirty = true; | ||
1575 | break; | 1588 | break; |
1576 | case RADEON_RB3D_ZPASS_ADDR: | 1589 | case RADEON_RB3D_ZPASS_ADDR: |
1577 | r = r100_cs_packet_next_reloc(p, &reloc); | 1590 | r = r100_cs_packet_next_reloc(p, &reloc); |
@@ -1588,6 +1601,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1588 | uint32_t temp = idx_value >> 4; | 1601 | uint32_t temp = idx_value >> 4; |
1589 | for (i = 0; i < track->num_texture; i++) | 1602 | for (i = 0; i < track->num_texture; i++) |
1590 | track->textures[i].enabled = !!(temp & (1 << i)); | 1603 | track->textures[i].enabled = !!(temp & (1 << i)); |
1604 | track->tex_dirty = true; | ||
1591 | } | 1605 | } |
1592 | break; | 1606 | break; |
1593 | case RADEON_SE_VF_CNTL: | 1607 | case RADEON_SE_VF_CNTL: |
@@ -1602,12 +1616,14 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1602 | i = (reg - RADEON_PP_TEX_SIZE_0) / 8; | 1616 | i = (reg - RADEON_PP_TEX_SIZE_0) / 8; |
1603 | track->textures[i].width = (idx_value & RADEON_TEX_USIZE_MASK) + 1; | 1617 | track->textures[i].width = (idx_value & RADEON_TEX_USIZE_MASK) + 1; |
1604 | track->textures[i].height = ((idx_value & RADEON_TEX_VSIZE_MASK) >> RADEON_TEX_VSIZE_SHIFT) + 1; | 1618 | track->textures[i].height = ((idx_value & RADEON_TEX_VSIZE_MASK) >> RADEON_TEX_VSIZE_SHIFT) + 1; |
1619 | track->tex_dirty = true; | ||
1605 | break; | 1620 | break; |
1606 | case RADEON_PP_TEX_PITCH_0: | 1621 | case RADEON_PP_TEX_PITCH_0: |
1607 | case RADEON_PP_TEX_PITCH_1: | 1622 | case RADEON_PP_TEX_PITCH_1: |
1608 | case RADEON_PP_TEX_PITCH_2: | 1623 | case RADEON_PP_TEX_PITCH_2: |
1609 | i = (reg - RADEON_PP_TEX_PITCH_0) / 8; | 1624 | i = (reg - RADEON_PP_TEX_PITCH_0) / 8; |
1610 | track->textures[i].pitch = idx_value + 32; | 1625 | track->textures[i].pitch = idx_value + 32; |
1626 | track->tex_dirty = true; | ||
1611 | break; | 1627 | break; |
1612 | case RADEON_PP_TXFILTER_0: | 1628 | case RADEON_PP_TXFILTER_0: |
1613 | case RADEON_PP_TXFILTER_1: | 1629 | case RADEON_PP_TXFILTER_1: |
@@ -1621,6 +1637,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1621 | tmp = (idx_value >> 27) & 0x7; | 1637 | tmp = (idx_value >> 27) & 0x7; |
1622 | if (tmp == 2 || tmp == 6) | 1638 | if (tmp == 2 || tmp == 6) |
1623 | track->textures[i].roundup_h = false; | 1639 | track->textures[i].roundup_h = false; |
1640 | track->tex_dirty = true; | ||
1624 | break; | 1641 | break; |
1625 | case RADEON_PP_TXFORMAT_0: | 1642 | case RADEON_PP_TXFORMAT_0: |
1626 | case RADEON_PP_TXFORMAT_1: | 1643 | case RADEON_PP_TXFORMAT_1: |
@@ -1673,6 +1690,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1673 | } | 1690 | } |
1674 | track->textures[i].cube_info[4].width = 1 << ((idx_value >> 16) & 0xf); | 1691 | track->textures[i].cube_info[4].width = 1 << ((idx_value >> 16) & 0xf); |
1675 | track->textures[i].cube_info[4].height = 1 << ((idx_value >> 20) & 0xf); | 1692 | track->textures[i].cube_info[4].height = 1 << ((idx_value >> 20) & 0xf); |
1693 | track->tex_dirty = true; | ||
1676 | break; | 1694 | break; |
1677 | case RADEON_PP_CUBIC_FACES_0: | 1695 | case RADEON_PP_CUBIC_FACES_0: |
1678 | case RADEON_PP_CUBIC_FACES_1: | 1696 | case RADEON_PP_CUBIC_FACES_1: |
@@ -1683,6 +1701,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1683 | track->textures[i].cube_info[face].width = 1 << ((tmp >> (face * 8)) & 0xf); | 1701 | track->textures[i].cube_info[face].width = 1 << ((tmp >> (face * 8)) & 0xf); |
1684 | track->textures[i].cube_info[face].height = 1 << ((tmp >> ((face * 8) + 4)) & 0xf); | 1702 | track->textures[i].cube_info[face].height = 1 << ((tmp >> ((face * 8) + 4)) & 0xf); |
1685 | } | 1703 | } |
1704 | track->tex_dirty = true; | ||
1686 | break; | 1705 | break; |
1687 | default: | 1706 | default: |
1688 | printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", | 1707 | printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", |
@@ -2347,10 +2366,10 @@ void r100_vga_set_state(struct radeon_device *rdev, bool state) | |||
2347 | 2366 | ||
2348 | temp = RREG32(RADEON_CONFIG_CNTL); | 2367 | temp = RREG32(RADEON_CONFIG_CNTL); |
2349 | if (state == false) { | 2368 | if (state == false) { |
2350 | temp &= ~(1<<8); | 2369 | temp &= ~RADEON_CFG_VGA_RAM_EN; |
2351 | temp |= (1<<9); | 2370 | temp |= RADEON_CFG_VGA_IO_DIS; |
2352 | } else { | 2371 | } else { |
2353 | temp &= ~(1<<9); | 2372 | temp &= ~RADEON_CFG_VGA_IO_DIS; |
2354 | } | 2373 | } |
2355 | WREG32(RADEON_CONFIG_CNTL, temp); | 2374 | WREG32(RADEON_CONFIG_CNTL, temp); |
2356 | } | 2375 | } |
@@ -3318,9 +3337,9 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) | |||
3318 | unsigned long size; | 3337 | unsigned long size; |
3319 | unsigned prim_walk; | 3338 | unsigned prim_walk; |
3320 | unsigned nverts; | 3339 | unsigned nverts; |
3321 | unsigned num_cb = track->num_cb; | 3340 | unsigned num_cb = track->cb_dirty ? track->num_cb : 0; |
3322 | 3341 | ||
3323 | if (!track->zb_cb_clear && !track->color_channel_mask && | 3342 | if (num_cb && !track->zb_cb_clear && !track->color_channel_mask && |
3324 | !track->blend_read_enable) | 3343 | !track->blend_read_enable) |
3325 | num_cb = 0; | 3344 | num_cb = 0; |
3326 | 3345 | ||
@@ -3341,7 +3360,9 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) | |||
3341 | return -EINVAL; | 3360 | return -EINVAL; |
3342 | } | 3361 | } |
3343 | } | 3362 | } |
3344 | if (track->z_enabled) { | 3363 | track->cb_dirty = false; |
3364 | |||
3365 | if (track->zb_dirty && track->z_enabled) { | ||
3345 | if (track->zb.robj == NULL) { | 3366 | if (track->zb.robj == NULL) { |
3346 | DRM_ERROR("[drm] No buffer for z buffer !\n"); | 3367 | DRM_ERROR("[drm] No buffer for z buffer !\n"); |
3347 | return -EINVAL; | 3368 | return -EINVAL; |
@@ -3358,6 +3379,28 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) | |||
3358 | return -EINVAL; | 3379 | return -EINVAL; |
3359 | } | 3380 | } |
3360 | } | 3381 | } |
3382 | track->zb_dirty = false; | ||
3383 | |||
3384 | if (track->aa_dirty && track->aaresolve) { | ||
3385 | if (track->aa.robj == NULL) { | ||
3386 | DRM_ERROR("[drm] No buffer for AA resolve buffer %d !\n", i); | ||
3387 | return -EINVAL; | ||
3388 | } | ||
3389 | /* I believe the format comes from colorbuffer0. */ | ||
3390 | size = track->aa.pitch * track->cb[0].cpp * track->maxy; | ||
3391 | size += track->aa.offset; | ||
3392 | if (size > radeon_bo_size(track->aa.robj)) { | ||
3393 | DRM_ERROR("[drm] Buffer too small for AA resolve buffer %d " | ||
3394 | "(need %lu have %lu) !\n", i, size, | ||
3395 | radeon_bo_size(track->aa.robj)); | ||
3396 | DRM_ERROR("[drm] AA resolve buffer %d (%u %u %u %u)\n", | ||
3397 | i, track->aa.pitch, track->cb[0].cpp, | ||
3398 | track->aa.offset, track->maxy); | ||
3399 | return -EINVAL; | ||
3400 | } | ||
3401 | } | ||
3402 | track->aa_dirty = false; | ||
3403 | |||
3361 | prim_walk = (track->vap_vf_cntl >> 4) & 0x3; | 3404 | prim_walk = (track->vap_vf_cntl >> 4) & 0x3; |
3362 | if (track->vap_vf_cntl & (1 << 14)) { | 3405 | if (track->vap_vf_cntl & (1 << 14)) { |
3363 | nverts = track->vap_alt_nverts; | 3406 | nverts = track->vap_alt_nverts; |
@@ -3417,13 +3460,23 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) | |||
3417 | prim_walk); | 3460 | prim_walk); |
3418 | return -EINVAL; | 3461 | return -EINVAL; |
3419 | } | 3462 | } |
3420 | return r100_cs_track_texture_check(rdev, track); | 3463 | |
3464 | if (track->tex_dirty) { | ||
3465 | track->tex_dirty = false; | ||
3466 | return r100_cs_track_texture_check(rdev, track); | ||
3467 | } | ||
3468 | return 0; | ||
3421 | } | 3469 | } |
3422 | 3470 | ||
3423 | void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track) | 3471 | void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track) |
3424 | { | 3472 | { |
3425 | unsigned i, face; | 3473 | unsigned i, face; |
3426 | 3474 | ||
3475 | track->cb_dirty = true; | ||
3476 | track->zb_dirty = true; | ||
3477 | track->tex_dirty = true; | ||
3478 | track->aa_dirty = true; | ||
3479 | |||
3427 | if (rdev->family < CHIP_R300) { | 3480 | if (rdev->family < CHIP_R300) { |
3428 | track->num_cb = 1; | 3481 | track->num_cb = 1; |
3429 | if (rdev->family <= CHIP_RS200) | 3482 | if (rdev->family <= CHIP_RS200) |
@@ -3437,6 +3490,8 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track | |||
3437 | track->num_texture = 16; | 3490 | track->num_texture = 16; |
3438 | track->maxy = 4096; | 3491 | track->maxy = 4096; |
3439 | track->separate_cube = 0; | 3492 | track->separate_cube = 0; |
3493 | track->aaresolve = true; | ||
3494 | track->aa.robj = NULL; | ||
3440 | } | 3495 | } |
3441 | 3496 | ||
3442 | for (i = 0; i < track->num_cb; i++) { | 3497 | for (i = 0; i < track->num_cb; i++) { |
@@ -3522,7 +3577,7 @@ int r100_ring_test(struct radeon_device *rdev) | |||
3522 | if (i < rdev->usec_timeout) { | 3577 | if (i < rdev->usec_timeout) { |
3523 | DRM_INFO("ring test succeeded in %d usecs\n", i); | 3578 | DRM_INFO("ring test succeeded in %d usecs\n", i); |
3524 | } else { | 3579 | } else { |
3525 | DRM_ERROR("radeon: ring test failed (sracth(0x%04X)=0x%08X)\n", | 3580 | DRM_ERROR("radeon: ring test failed (scratch(0x%04X)=0x%08X)\n", |
3526 | scratch, tmp); | 3581 | scratch, tmp); |
3527 | r = -EINVAL; | 3582 | r = -EINVAL; |
3528 | } | 3583 | } |
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h index af65600e6564..2fef9de7f363 100644 --- a/drivers/gpu/drm/radeon/r100_track.h +++ b/drivers/gpu/drm/radeon/r100_track.h | |||
@@ -52,14 +52,7 @@ struct r100_cs_track_texture { | |||
52 | unsigned compress_format; | 52 | unsigned compress_format; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | struct r100_cs_track_limits { | ||
56 | unsigned num_cb; | ||
57 | unsigned num_texture; | ||
58 | unsigned max_levels; | ||
59 | }; | ||
60 | |||
61 | struct r100_cs_track { | 55 | struct r100_cs_track { |
62 | struct radeon_device *rdev; | ||
63 | unsigned num_cb; | 56 | unsigned num_cb; |
64 | unsigned num_texture; | 57 | unsigned num_texture; |
65 | unsigned maxy; | 58 | unsigned maxy; |
@@ -73,11 +66,17 @@ struct r100_cs_track { | |||
73 | struct r100_cs_track_array arrays[11]; | 66 | struct r100_cs_track_array arrays[11]; |
74 | struct r100_cs_track_cb cb[R300_MAX_CB]; | 67 | struct r100_cs_track_cb cb[R300_MAX_CB]; |
75 | struct r100_cs_track_cb zb; | 68 | struct r100_cs_track_cb zb; |
69 | struct r100_cs_track_cb aa; | ||
76 | struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE]; | 70 | struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE]; |
77 | bool z_enabled; | 71 | bool z_enabled; |
78 | bool separate_cube; | 72 | bool separate_cube; |
79 | bool zb_cb_clear; | 73 | bool zb_cb_clear; |
80 | bool blend_read_enable; | 74 | bool blend_read_enable; |
75 | bool cb_dirty; | ||
76 | bool zb_dirty; | ||
77 | bool tex_dirty; | ||
78 | bool aa_dirty; | ||
79 | bool aaresolve; | ||
81 | }; | 80 | }; |
82 | 81 | ||
83 | int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track); | 82 | int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track); |
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c index d2408c395619..f24058300413 100644 --- a/drivers/gpu/drm/radeon/r200.c +++ b/drivers/gpu/drm/radeon/r200.c | |||
@@ -184,6 +184,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
184 | } | 184 | } |
185 | track->zb.robj = reloc->robj; | 185 | track->zb.robj = reloc->robj; |
186 | track->zb.offset = idx_value; | 186 | track->zb.offset = idx_value; |
187 | track->zb_dirty = true; | ||
187 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 188 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
188 | break; | 189 | break; |
189 | case RADEON_RB3D_COLOROFFSET: | 190 | case RADEON_RB3D_COLOROFFSET: |
@@ -196,6 +197,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
196 | } | 197 | } |
197 | track->cb[0].robj = reloc->robj; | 198 | track->cb[0].robj = reloc->robj; |
198 | track->cb[0].offset = idx_value; | 199 | track->cb[0].offset = idx_value; |
200 | track->cb_dirty = true; | ||
199 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 201 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
200 | break; | 202 | break; |
201 | case R200_PP_TXOFFSET_0: | 203 | case R200_PP_TXOFFSET_0: |
@@ -214,6 +216,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
214 | } | 216 | } |
215 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 217 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
216 | track->textures[i].robj = reloc->robj; | 218 | track->textures[i].robj = reloc->robj; |
219 | track->tex_dirty = true; | ||
217 | break; | 220 | break; |
218 | case R200_PP_CUBIC_OFFSET_F1_0: | 221 | case R200_PP_CUBIC_OFFSET_F1_0: |
219 | case R200_PP_CUBIC_OFFSET_F2_0: | 222 | case R200_PP_CUBIC_OFFSET_F2_0: |
@@ -257,9 +260,12 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
257 | track->textures[i].cube_info[face - 1].offset = idx_value; | 260 | track->textures[i].cube_info[face - 1].offset = idx_value; |
258 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 261 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
259 | track->textures[i].cube_info[face - 1].robj = reloc->robj; | 262 | track->textures[i].cube_info[face - 1].robj = reloc->robj; |
263 | track->tex_dirty = true; | ||
260 | break; | 264 | break; |
261 | case RADEON_RE_WIDTH_HEIGHT: | 265 | case RADEON_RE_WIDTH_HEIGHT: |
262 | track->maxy = ((idx_value >> 16) & 0x7FF); | 266 | track->maxy = ((idx_value >> 16) & 0x7FF); |
267 | track->cb_dirty = true; | ||
268 | track->zb_dirty = true; | ||
263 | break; | 269 | break; |
264 | case RADEON_RB3D_COLORPITCH: | 270 | case RADEON_RB3D_COLORPITCH: |
265 | r = r100_cs_packet_next_reloc(p, &reloc); | 271 | r = r100_cs_packet_next_reloc(p, &reloc); |
@@ -280,9 +286,11 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
280 | ib[idx] = tmp; | 286 | ib[idx] = tmp; |
281 | 287 | ||
282 | track->cb[0].pitch = idx_value & RADEON_COLORPITCH_MASK; | 288 | track->cb[0].pitch = idx_value & RADEON_COLORPITCH_MASK; |
289 | track->cb_dirty = true; | ||
283 | break; | 290 | break; |
284 | case RADEON_RB3D_DEPTHPITCH: | 291 | case RADEON_RB3D_DEPTHPITCH: |
285 | track->zb.pitch = idx_value & RADEON_DEPTHPITCH_MASK; | 292 | track->zb.pitch = idx_value & RADEON_DEPTHPITCH_MASK; |
293 | track->zb_dirty = true; | ||
286 | break; | 294 | break; |
287 | case RADEON_RB3D_CNTL: | 295 | case RADEON_RB3D_CNTL: |
288 | switch ((idx_value >> RADEON_RB3D_COLOR_FORMAT_SHIFT) & 0x1f) { | 296 | switch ((idx_value >> RADEON_RB3D_COLOR_FORMAT_SHIFT) & 0x1f) { |
@@ -312,6 +320,8 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
312 | } | 320 | } |
313 | 321 | ||
314 | track->z_enabled = !!(idx_value & RADEON_Z_ENABLE); | 322 | track->z_enabled = !!(idx_value & RADEON_Z_ENABLE); |
323 | track->cb_dirty = true; | ||
324 | track->zb_dirty = true; | ||
315 | break; | 325 | break; |
316 | case RADEON_RB3D_ZSTENCILCNTL: | 326 | case RADEON_RB3D_ZSTENCILCNTL: |
317 | switch (idx_value & 0xf) { | 327 | switch (idx_value & 0xf) { |
@@ -329,6 +339,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
329 | default: | 339 | default: |
330 | break; | 340 | break; |
331 | } | 341 | } |
342 | track->zb_dirty = true; | ||
332 | break; | 343 | break; |
333 | case RADEON_RB3D_ZPASS_ADDR: | 344 | case RADEON_RB3D_ZPASS_ADDR: |
334 | r = r100_cs_packet_next_reloc(p, &reloc); | 345 | r = r100_cs_packet_next_reloc(p, &reloc); |
@@ -345,6 +356,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
345 | uint32_t temp = idx_value >> 4; | 356 | uint32_t temp = idx_value >> 4; |
346 | for (i = 0; i < track->num_texture; i++) | 357 | for (i = 0; i < track->num_texture; i++) |
347 | track->textures[i].enabled = !!(temp & (1 << i)); | 358 | track->textures[i].enabled = !!(temp & (1 << i)); |
359 | track->tex_dirty = true; | ||
348 | } | 360 | } |
349 | break; | 361 | break; |
350 | case RADEON_SE_VF_CNTL: | 362 | case RADEON_SE_VF_CNTL: |
@@ -369,6 +381,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
369 | i = (reg - R200_PP_TXSIZE_0) / 32; | 381 | i = (reg - R200_PP_TXSIZE_0) / 32; |
370 | track->textures[i].width = (idx_value & RADEON_TEX_USIZE_MASK) + 1; | 382 | track->textures[i].width = (idx_value & RADEON_TEX_USIZE_MASK) + 1; |
371 | track->textures[i].height = ((idx_value & RADEON_TEX_VSIZE_MASK) >> RADEON_TEX_VSIZE_SHIFT) + 1; | 383 | track->textures[i].height = ((idx_value & RADEON_TEX_VSIZE_MASK) >> RADEON_TEX_VSIZE_SHIFT) + 1; |
384 | track->tex_dirty = true; | ||
372 | break; | 385 | break; |
373 | case R200_PP_TXPITCH_0: | 386 | case R200_PP_TXPITCH_0: |
374 | case R200_PP_TXPITCH_1: | 387 | case R200_PP_TXPITCH_1: |
@@ -378,6 +391,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
378 | case R200_PP_TXPITCH_5: | 391 | case R200_PP_TXPITCH_5: |
379 | i = (reg - R200_PP_TXPITCH_0) / 32; | 392 | i = (reg - R200_PP_TXPITCH_0) / 32; |
380 | track->textures[i].pitch = idx_value + 32; | 393 | track->textures[i].pitch = idx_value + 32; |
394 | track->tex_dirty = true; | ||
381 | break; | 395 | break; |
382 | case R200_PP_TXFILTER_0: | 396 | case R200_PP_TXFILTER_0: |
383 | case R200_PP_TXFILTER_1: | 397 | case R200_PP_TXFILTER_1: |
@@ -394,6 +408,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
394 | tmp = (idx_value >> 27) & 0x7; | 408 | tmp = (idx_value >> 27) & 0x7; |
395 | if (tmp == 2 || tmp == 6) | 409 | if (tmp == 2 || tmp == 6) |
396 | track->textures[i].roundup_h = false; | 410 | track->textures[i].roundup_h = false; |
411 | track->tex_dirty = true; | ||
397 | break; | 412 | break; |
398 | case R200_PP_TXMULTI_CTL_0: | 413 | case R200_PP_TXMULTI_CTL_0: |
399 | case R200_PP_TXMULTI_CTL_1: | 414 | case R200_PP_TXMULTI_CTL_1: |
@@ -432,6 +447,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
432 | track->textures[i].tex_coord_type = 1; | 447 | track->textures[i].tex_coord_type = 1; |
433 | break; | 448 | break; |
434 | } | 449 | } |
450 | track->tex_dirty = true; | ||
435 | break; | 451 | break; |
436 | case R200_PP_TXFORMAT_0: | 452 | case R200_PP_TXFORMAT_0: |
437 | case R200_PP_TXFORMAT_1: | 453 | case R200_PP_TXFORMAT_1: |
@@ -488,6 +504,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
488 | } | 504 | } |
489 | track->textures[i].cube_info[4].width = 1 << ((idx_value >> 16) & 0xf); | 505 | track->textures[i].cube_info[4].width = 1 << ((idx_value >> 16) & 0xf); |
490 | track->textures[i].cube_info[4].height = 1 << ((idx_value >> 20) & 0xf); | 506 | track->textures[i].cube_info[4].height = 1 << ((idx_value >> 20) & 0xf); |
507 | track->tex_dirty = true; | ||
491 | break; | 508 | break; |
492 | case R200_PP_CUBIC_FACES_0: | 509 | case R200_PP_CUBIC_FACES_0: |
493 | case R200_PP_CUBIC_FACES_1: | 510 | case R200_PP_CUBIC_FACES_1: |
@@ -501,6 +518,7 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
501 | track->textures[i].cube_info[face].width = 1 << ((tmp >> (face * 8)) & 0xf); | 518 | track->textures[i].cube_info[face].width = 1 << ((tmp >> (face * 8)) & 0xf); |
502 | track->textures[i].cube_info[face].height = 1 << ((tmp >> ((face * 8) + 4)) & 0xf); | 519 | track->textures[i].cube_info[face].height = 1 << ((tmp >> ((face * 8) + 4)) & 0xf); |
503 | } | 520 | } |
521 | track->tex_dirty = true; | ||
504 | break; | 522 | break; |
505 | default: | 523 | default: |
506 | printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", | 524 | printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index cf862ca580bf..069efa8c8ecf 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -69,6 +69,9 @@ void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
69 | mb(); | 69 | mb(); |
70 | } | 70 | } |
71 | 71 | ||
72 | #define R300_PTE_WRITEABLE (1 << 2) | ||
73 | #define R300_PTE_READABLE (1 << 3) | ||
74 | |||
72 | int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | 75 | int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) |
73 | { | 76 | { |
74 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; | 77 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; |
@@ -78,7 +81,7 @@ int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | |||
78 | } | 81 | } |
79 | addr = (lower_32_bits(addr) >> 8) | | 82 | addr = (lower_32_bits(addr) >> 8) | |
80 | ((upper_32_bits(addr) & 0xff) << 24) | | 83 | ((upper_32_bits(addr) & 0xff) << 24) | |
81 | 0xc; | 84 | R300_PTE_WRITEABLE | R300_PTE_READABLE; |
82 | /* on x86 we want this to be CPU endian, on powerpc | 85 | /* on x86 we want this to be CPU endian, on powerpc |
83 | * on powerpc without HW swappers, it'll get swapped on way | 86 | * on powerpc without HW swappers, it'll get swapped on way |
84 | * into VRAM - so no need for cpu_to_le32 on VRAM tables */ | 87 | * into VRAM - so no need for cpu_to_le32 on VRAM tables */ |
@@ -135,7 +138,7 @@ int rv370_pcie_gart_enable(struct radeon_device *rdev) | |||
135 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_LO, rdev->mc.vram_start); | 138 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_LO, rdev->mc.vram_start); |
136 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_HI, 0); | 139 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_HI, 0); |
137 | /* Clear error */ | 140 | /* Clear error */ |
138 | WREG32_PCIE(0x18, 0); | 141 | WREG32_PCIE(RADEON_PCIE_TX_GART_ERROR, 0); |
139 | tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); | 142 | tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); |
140 | tmp |= RADEON_PCIE_TX_GART_EN; | 143 | tmp |= RADEON_PCIE_TX_GART_EN; |
141 | tmp |= RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD; | 144 | tmp |= RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD; |
@@ -664,6 +667,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
664 | } | 667 | } |
665 | track->cb[i].robj = reloc->robj; | 668 | track->cb[i].robj = reloc->robj; |
666 | track->cb[i].offset = idx_value; | 669 | track->cb[i].offset = idx_value; |
670 | track->cb_dirty = true; | ||
667 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 671 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
668 | break; | 672 | break; |
669 | case R300_ZB_DEPTHOFFSET: | 673 | case R300_ZB_DEPTHOFFSET: |
@@ -676,6 +680,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
676 | } | 680 | } |
677 | track->zb.robj = reloc->robj; | 681 | track->zb.robj = reloc->robj; |
678 | track->zb.offset = idx_value; | 682 | track->zb.offset = idx_value; |
683 | track->zb_dirty = true; | ||
679 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 684 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
680 | break; | 685 | break; |
681 | case R300_TX_OFFSET_0: | 686 | case R300_TX_OFFSET_0: |
@@ -714,6 +719,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
714 | tmp |= tile_flags; | 719 | tmp |= tile_flags; |
715 | ib[idx] = tmp; | 720 | ib[idx] = tmp; |
716 | track->textures[i].robj = reloc->robj; | 721 | track->textures[i].robj = reloc->robj; |
722 | track->tex_dirty = true; | ||
717 | break; | 723 | break; |
718 | /* Tracked registers */ | 724 | /* Tracked registers */ |
719 | case 0x2084: | 725 | case 0x2084: |
@@ -740,6 +746,8 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
740 | if (p->rdev->family < CHIP_RV515) { | 746 | if (p->rdev->family < CHIP_RV515) { |
741 | track->maxy -= 1440; | 747 | track->maxy -= 1440; |
742 | } | 748 | } |
749 | track->cb_dirty = true; | ||
750 | track->zb_dirty = true; | ||
743 | break; | 751 | break; |
744 | case 0x4E00: | 752 | case 0x4E00: |
745 | /* RB3D_CCTL */ | 753 | /* RB3D_CCTL */ |
@@ -749,6 +757,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
749 | return -EINVAL; | 757 | return -EINVAL; |
750 | } | 758 | } |
751 | track->num_cb = ((idx_value >> 5) & 0x3) + 1; | 759 | track->num_cb = ((idx_value >> 5) & 0x3) + 1; |
760 | track->cb_dirty = true; | ||
752 | break; | 761 | break; |
753 | case 0x4E38: | 762 | case 0x4E38: |
754 | case 0x4E3C: | 763 | case 0x4E3C: |
@@ -811,6 +820,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
811 | ((idx_value >> 21) & 0xF)); | 820 | ((idx_value >> 21) & 0xF)); |
812 | return -EINVAL; | 821 | return -EINVAL; |
813 | } | 822 | } |
823 | track->cb_dirty = true; | ||
814 | break; | 824 | break; |
815 | case 0x4F00: | 825 | case 0x4F00: |
816 | /* ZB_CNTL */ | 826 | /* ZB_CNTL */ |
@@ -819,6 +829,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
819 | } else { | 829 | } else { |
820 | track->z_enabled = false; | 830 | track->z_enabled = false; |
821 | } | 831 | } |
832 | track->zb_dirty = true; | ||
822 | break; | 833 | break; |
823 | case 0x4F10: | 834 | case 0x4F10: |
824 | /* ZB_FORMAT */ | 835 | /* ZB_FORMAT */ |
@@ -835,6 +846,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
835 | (idx_value & 0xF)); | 846 | (idx_value & 0xF)); |
836 | return -EINVAL; | 847 | return -EINVAL; |
837 | } | 848 | } |
849 | track->zb_dirty = true; | ||
838 | break; | 850 | break; |
839 | case 0x4F24: | 851 | case 0x4F24: |
840 | /* ZB_DEPTHPITCH */ | 852 | /* ZB_DEPTHPITCH */ |
@@ -858,14 +870,17 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
858 | ib[idx] = tmp; | 870 | ib[idx] = tmp; |
859 | 871 | ||
860 | track->zb.pitch = idx_value & 0x3FFC; | 872 | track->zb.pitch = idx_value & 0x3FFC; |
873 | track->zb_dirty = true; | ||
861 | break; | 874 | break; |
862 | case 0x4104: | 875 | case 0x4104: |
876 | /* TX_ENABLE */ | ||
863 | for (i = 0; i < 16; i++) { | 877 | for (i = 0; i < 16; i++) { |
864 | bool enabled; | 878 | bool enabled; |
865 | 879 | ||
866 | enabled = !!(idx_value & (1 << i)); | 880 | enabled = !!(idx_value & (1 << i)); |
867 | track->textures[i].enabled = enabled; | 881 | track->textures[i].enabled = enabled; |
868 | } | 882 | } |
883 | track->tex_dirty = true; | ||
869 | break; | 884 | break; |
870 | case 0x44C0: | 885 | case 0x44C0: |
871 | case 0x44C4: | 886 | case 0x44C4: |
@@ -895,6 +910,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
895 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; | 910 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; |
896 | break; | 911 | break; |
897 | case R300_TX_FORMAT_X16: | 912 | case R300_TX_FORMAT_X16: |
913 | case R300_TX_FORMAT_FL_I16: | ||
898 | case R300_TX_FORMAT_Y8X8: | 914 | case R300_TX_FORMAT_Y8X8: |
899 | case R300_TX_FORMAT_Z5Y6X5: | 915 | case R300_TX_FORMAT_Z5Y6X5: |
900 | case R300_TX_FORMAT_Z6Y5X5: | 916 | case R300_TX_FORMAT_Z6Y5X5: |
@@ -907,6 +923,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
907 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; | 923 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; |
908 | break; | 924 | break; |
909 | case R300_TX_FORMAT_Y16X16: | 925 | case R300_TX_FORMAT_Y16X16: |
926 | case R300_TX_FORMAT_FL_I16A16: | ||
910 | case R300_TX_FORMAT_Z11Y11X10: | 927 | case R300_TX_FORMAT_Z11Y11X10: |
911 | case R300_TX_FORMAT_Z10Y11X11: | 928 | case R300_TX_FORMAT_Z10Y11X11: |
912 | case R300_TX_FORMAT_W8Z8Y8X8: | 929 | case R300_TX_FORMAT_W8Z8Y8X8: |
@@ -948,8 +965,8 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
948 | DRM_ERROR("Invalid texture format %u\n", | 965 | DRM_ERROR("Invalid texture format %u\n", |
949 | (idx_value & 0x1F)); | 966 | (idx_value & 0x1F)); |
950 | return -EINVAL; | 967 | return -EINVAL; |
951 | break; | ||
952 | } | 968 | } |
969 | track->tex_dirty = true; | ||
953 | break; | 970 | break; |
954 | case 0x4400: | 971 | case 0x4400: |
955 | case 0x4404: | 972 | case 0x4404: |
@@ -977,6 +994,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
977 | if (tmp == 2 || tmp == 4 || tmp == 6) { | 994 | if (tmp == 2 || tmp == 4 || tmp == 6) { |
978 | track->textures[i].roundup_h = false; | 995 | track->textures[i].roundup_h = false; |
979 | } | 996 | } |
997 | track->tex_dirty = true; | ||
980 | break; | 998 | break; |
981 | case 0x4500: | 999 | case 0x4500: |
982 | case 0x4504: | 1000 | case 0x4504: |
@@ -1014,6 +1032,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
1014 | DRM_ERROR("Forbidden bit TXFORMAT_MSB\n"); | 1032 | DRM_ERROR("Forbidden bit TXFORMAT_MSB\n"); |
1015 | return -EINVAL; | 1033 | return -EINVAL; |
1016 | } | 1034 | } |
1035 | track->tex_dirty = true; | ||
1017 | break; | 1036 | break; |
1018 | case 0x4480: | 1037 | case 0x4480: |
1019 | case 0x4484: | 1038 | case 0x4484: |
@@ -1043,6 +1062,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
1043 | track->textures[i].use_pitch = !!tmp; | 1062 | track->textures[i].use_pitch = !!tmp; |
1044 | tmp = (idx_value >> 22) & 0xF; | 1063 | tmp = (idx_value >> 22) & 0xF; |
1045 | track->textures[i].txdepth = tmp; | 1064 | track->textures[i].txdepth = tmp; |
1065 | track->tex_dirty = true; | ||
1046 | break; | 1066 | break; |
1047 | case R300_ZB_ZPASS_ADDR: | 1067 | case R300_ZB_ZPASS_ADDR: |
1048 | r = r100_cs_packet_next_reloc(p, &reloc); | 1068 | r = r100_cs_packet_next_reloc(p, &reloc); |
@@ -1057,6 +1077,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
1057 | case 0x4e0c: | 1077 | case 0x4e0c: |
1058 | /* RB3D_COLOR_CHANNEL_MASK */ | 1078 | /* RB3D_COLOR_CHANNEL_MASK */ |
1059 | track->color_channel_mask = idx_value; | 1079 | track->color_channel_mask = idx_value; |
1080 | track->cb_dirty = true; | ||
1060 | break; | 1081 | break; |
1061 | case 0x43a4: | 1082 | case 0x43a4: |
1062 | /* SC_HYPERZ_EN */ | 1083 | /* SC_HYPERZ_EN */ |
@@ -1070,6 +1091,8 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
1070 | case 0x4f1c: | 1091 | case 0x4f1c: |
1071 | /* ZB_BW_CNTL */ | 1092 | /* ZB_BW_CNTL */ |
1072 | track->zb_cb_clear = !!(idx_value & (1 << 5)); | 1093 | track->zb_cb_clear = !!(idx_value & (1 << 5)); |
1094 | track->cb_dirty = true; | ||
1095 | track->zb_dirty = true; | ||
1073 | if (p->rdev->hyperz_filp != p->filp) { | 1096 | if (p->rdev->hyperz_filp != p->filp) { |
1074 | if (idx_value & (R300_HIZ_ENABLE | | 1097 | if (idx_value & (R300_HIZ_ENABLE | |
1075 | R300_RD_COMP_ENABLE | | 1098 | R300_RD_COMP_ENABLE | |
@@ -1081,8 +1104,28 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
1081 | case 0x4e04: | 1104 | case 0x4e04: |
1082 | /* RB3D_BLENDCNTL */ | 1105 | /* RB3D_BLENDCNTL */ |
1083 | track->blend_read_enable = !!(idx_value & (1 << 2)); | 1106 | track->blend_read_enable = !!(idx_value & (1 << 2)); |
1107 | track->cb_dirty = true; | ||
1108 | break; | ||
1109 | case R300_RB3D_AARESOLVE_OFFSET: | ||
1110 | r = r100_cs_packet_next_reloc(p, &reloc); | ||
1111 | if (r) { | ||
1112 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", | ||
1113 | idx, reg); | ||
1114 | r100_cs_dump_packet(p, pkt); | ||
1115 | return r; | ||
1116 | } | ||
1117 | track->aa.robj = reloc->robj; | ||
1118 | track->aa.offset = idx_value; | ||
1119 | track->aa_dirty = true; | ||
1120 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | ||
1121 | break; | ||
1122 | case R300_RB3D_AARESOLVE_PITCH: | ||
1123 | track->aa.pitch = idx_value & 0x3FFE; | ||
1124 | track->aa_dirty = true; | ||
1084 | break; | 1125 | break; |
1085 | case 0x4f28: /* ZB_DEPTHCLEARVALUE */ | 1126 | case R300_RB3D_AARESOLVE_CTL: |
1127 | track->aaresolve = idx_value & 0x1; | ||
1128 | track->aa_dirty = true; | ||
1086 | break; | 1129 | break; |
1087 | case 0x4f30: /* ZB_MASK_OFFSET */ | 1130 | case 0x4f30: /* ZB_MASK_OFFSET */ |
1088 | case 0x4f34: /* ZB_ZMASK_PITCH */ | 1131 | case 0x4f34: /* ZB_ZMASK_PITCH */ |
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h index 1a0d5362cd79..f0bce399c9f3 100644 --- a/drivers/gpu/drm/radeon/r300_reg.h +++ b/drivers/gpu/drm/radeon/r300_reg.h | |||
@@ -1371,6 +1371,8 @@ | |||
1371 | #define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ | 1371 | #define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ |
1372 | #define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ | 1372 | #define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ |
1373 | 1373 | ||
1374 | #define R300_RB3D_AARESOLVE_OFFSET 0x4E80 | ||
1375 | #define R300_RB3D_AARESOLVE_PITCH 0x4E84 | ||
1374 | #define R300_RB3D_AARESOLVE_CTL 0x4E88 | 1376 | #define R300_RB3D_AARESOLVE_CTL 0x4E88 |
1375 | /* gap */ | 1377 | /* gap */ |
1376 | 1378 | ||
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index c387346f93a9..0b59ed7c7d2c 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -96,7 +96,7 @@ void r420_pipes_init(struct radeon_device *rdev) | |||
96 | "programming pipes. Bad things might happen.\n"); | 96 | "programming pipes. Bad things might happen.\n"); |
97 | } | 97 | } |
98 | /* get max number of pipes */ | 98 | /* get max number of pipes */ |
99 | gb_pipe_select = RREG32(0x402C); | 99 | gb_pipe_select = RREG32(R400_GB_PIPE_SELECT); |
100 | num_pipes = ((gb_pipe_select >> 12) & 3) + 1; | 100 | num_pipes = ((gb_pipe_select >> 12) & 3) + 1; |
101 | 101 | ||
102 | /* SE chips have 1 pipe */ | 102 | /* SE chips have 1 pipe */ |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 3c8677f9e385..2ce80d976568 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -79,8 +79,8 @@ static void r520_gpu_init(struct radeon_device *rdev) | |||
79 | WREG32(0x4128, 0xFF); | 79 | WREG32(0x4128, 0xFF); |
80 | } | 80 | } |
81 | r420_pipes_init(rdev); | 81 | r420_pipes_init(rdev); |
82 | gb_pipe_select = RREG32(0x402C); | 82 | gb_pipe_select = RREG32(R400_GB_PIPE_SELECT); |
83 | tmp = RREG32(0x170C); | 83 | tmp = RREG32(R300_DST_PIPE_CONFIG); |
84 | pipe_select_current = (tmp >> 2) & 3; | 84 | pipe_select_current = (tmp >> 2) & 3; |
85 | tmp = (1 << pipe_select_current) | | 85 | tmp = (1 << pipe_select_current) | |
86 | (((gb_pipe_select >> 8) & 0xF) << 4); | 86 | (((gb_pipe_select >> 8) & 0xF) << 4); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index aca2236268fa..de88624d5f87 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -97,12 +97,16 @@ void r600_irq_disable(struct radeon_device *rdev); | |||
97 | static void r600_pcie_gen2_enable(struct radeon_device *rdev); | 97 | static void r600_pcie_gen2_enable(struct radeon_device *rdev); |
98 | 98 | ||
99 | /* get temperature in millidegrees */ | 99 | /* get temperature in millidegrees */ |
100 | u32 rv6xx_get_temp(struct radeon_device *rdev) | 100 | int rv6xx_get_temp(struct radeon_device *rdev) |
101 | { | 101 | { |
102 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> | 102 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> |
103 | ASIC_T_SHIFT; | 103 | ASIC_T_SHIFT; |
104 | int actual_temp = temp & 0xff; | ||
104 | 105 | ||
105 | return temp * 1000; | 106 | if (temp & 0x100) |
107 | actual_temp -= 256; | ||
108 | |||
109 | return actual_temp * 1000; | ||
106 | } | 110 | } |
107 | 111 | ||
108 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) | 112 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) |
@@ -1287,6 +1291,9 @@ int r600_gpu_soft_reset(struct radeon_device *rdev) | |||
1287 | S_008014_CB2_BUSY(1) | S_008014_CB3_BUSY(1); | 1291 | S_008014_CB2_BUSY(1) | S_008014_CB3_BUSY(1); |
1288 | u32 tmp; | 1292 | u32 tmp; |
1289 | 1293 | ||
1294 | if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) | ||
1295 | return 0; | ||
1296 | |||
1290 | dev_info(rdev->dev, "GPU softreset \n"); | 1297 | dev_info(rdev->dev, "GPU softreset \n"); |
1291 | dev_info(rdev->dev, " R_008010_GRBM_STATUS=0x%08X\n", | 1298 | dev_info(rdev->dev, " R_008010_GRBM_STATUS=0x%08X\n", |
1292 | RREG32(R_008010_GRBM_STATUS)); | 1299 | RREG32(R_008010_GRBM_STATUS)); |
@@ -2098,7 +2105,11 @@ static int r600_cp_load_microcode(struct radeon_device *rdev) | |||
2098 | 2105 | ||
2099 | r600_cp_stop(rdev); | 2106 | r600_cp_stop(rdev); |
2100 | 2107 | ||
2101 | WREG32(CP_RB_CNTL, RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3)); | 2108 | WREG32(CP_RB_CNTL, |
2109 | #ifdef __BIG_ENDIAN | ||
2110 | BUF_SWAP_32BIT | | ||
2111 | #endif | ||
2112 | RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3)); | ||
2102 | 2113 | ||
2103 | /* Reset cp */ | 2114 | /* Reset cp */ |
2104 | WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP); | 2115 | WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP); |
@@ -2185,7 +2196,11 @@ int r600_cp_resume(struct radeon_device *rdev) | |||
2185 | WREG32(CP_RB_WPTR, 0); | 2196 | WREG32(CP_RB_WPTR, 0); |
2186 | 2197 | ||
2187 | /* set the wb address whether it's enabled or not */ | 2198 | /* set the wb address whether it's enabled or not */ |
2188 | WREG32(CP_RB_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC); | 2199 | WREG32(CP_RB_RPTR_ADDR, |
2200 | #ifdef __BIG_ENDIAN | ||
2201 | RB_RPTR_SWAP(2) | | ||
2202 | #endif | ||
2203 | ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC)); | ||
2189 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); | 2204 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); |
2190 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); | 2205 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); |
2191 | 2206 | ||
@@ -2621,7 +2636,11 @@ void r600_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | |||
2621 | { | 2636 | { |
2622 | /* FIXME: implement */ | 2637 | /* FIXME: implement */ |
2623 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | 2638 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
2624 | radeon_ring_write(rdev, ib->gpu_addr & 0xFFFFFFFC); | 2639 | radeon_ring_write(rdev, |
2640 | #ifdef __BIG_ENDIAN | ||
2641 | (2 << 0) | | ||
2642 | #endif | ||
2643 | (ib->gpu_addr & 0xFFFFFFFC)); | ||
2625 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); | 2644 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); |
2626 | radeon_ring_write(rdev, ib->length_dw); | 2645 | radeon_ring_write(rdev, ib->length_dw); |
2627 | } | 2646 | } |
@@ -3290,8 +3309,8 @@ restart_ih: | |||
3290 | while (rptr != wptr) { | 3309 | while (rptr != wptr) { |
3291 | /* wptr/rptr are in bytes! */ | 3310 | /* wptr/rptr are in bytes! */ |
3292 | ring_index = rptr / 4; | 3311 | ring_index = rptr / 4; |
3293 | src_id = rdev->ih.ring[ring_index] & 0xff; | 3312 | src_id = le32_to_cpu(rdev->ih.ring[ring_index]) & 0xff; |
3294 | src_data = rdev->ih.ring[ring_index + 1] & 0xfffffff; | 3313 | src_data = le32_to_cpu(rdev->ih.ring[ring_index + 1]) & 0xfffffff; |
3295 | 3314 | ||
3296 | switch (src_id) { | 3315 | switch (src_id) { |
3297 | case 1: /* D1 vblank/vline */ | 3316 | case 1: /* D1 vblank/vline */ |
diff --git a/drivers/gpu/drm/radeon/r600_blit.c b/drivers/gpu/drm/radeon/r600_blit.c index ca5c29f70779..7f1043448d25 100644 --- a/drivers/gpu/drm/radeon/r600_blit.c +++ b/drivers/gpu/drm/radeon/r600_blit.c | |||
@@ -137,9 +137,9 @@ set_shaders(struct drm_device *dev) | |||
137 | ps = (u32 *) ((char *)dev->agp_buffer_map->handle + dev_priv->blit_vb->offset + 256); | 137 | ps = (u32 *) ((char *)dev->agp_buffer_map->handle + dev_priv->blit_vb->offset + 256); |
138 | 138 | ||
139 | for (i = 0; i < r6xx_vs_size; i++) | 139 | for (i = 0; i < r6xx_vs_size; i++) |
140 | vs[i] = r6xx_vs[i]; | 140 | vs[i] = cpu_to_le32(r6xx_vs[i]); |
141 | for (i = 0; i < r6xx_ps_size; i++) | 141 | for (i = 0; i < r6xx_ps_size; i++) |
142 | ps[i] = r6xx_ps[i]; | 142 | ps[i] = cpu_to_le32(r6xx_ps[i]); |
143 | 143 | ||
144 | dev_priv->blit_vb->used = 512; | 144 | dev_priv->blit_vb->used = 512; |
145 | 145 | ||
@@ -192,6 +192,9 @@ set_vtx_resource(drm_radeon_private_t *dev_priv, u64 gpu_addr) | |||
192 | DRM_DEBUG("\n"); | 192 | DRM_DEBUG("\n"); |
193 | 193 | ||
194 | sq_vtx_constant_word2 = (((gpu_addr >> 32) & 0xff) | (16 << 8)); | 194 | sq_vtx_constant_word2 = (((gpu_addr >> 32) & 0xff) | (16 << 8)); |
195 | #ifdef __BIG_ENDIAN | ||
196 | sq_vtx_constant_word2 |= (2 << 30); | ||
197 | #endif | ||
195 | 198 | ||
196 | BEGIN_RING(9); | 199 | BEGIN_RING(9); |
197 | OUT_RING(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); | 200 | OUT_RING(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); |
@@ -291,7 +294,11 @@ draw_auto(drm_radeon_private_t *dev_priv) | |||
291 | OUT_RING(DI_PT_RECTLIST); | 294 | OUT_RING(DI_PT_RECTLIST); |
292 | 295 | ||
293 | OUT_RING(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); | 296 | OUT_RING(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); |
297 | #ifdef __BIG_ENDIAN | ||
298 | OUT_RING((2 << 2) | DI_INDEX_SIZE_16_BIT); | ||
299 | #else | ||
294 | OUT_RING(DI_INDEX_SIZE_16_BIT); | 300 | OUT_RING(DI_INDEX_SIZE_16_BIT); |
301 | #endif | ||
295 | 302 | ||
296 | OUT_RING(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); | 303 | OUT_RING(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); |
297 | OUT_RING(1); | 304 | OUT_RING(1); |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 86e5aa07f0db..41f7aafc97c4 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -54,7 +54,7 @@ set_render_target(struct radeon_device *rdev, int format, | |||
54 | if (h < 8) | 54 | if (h < 8) |
55 | h = 8; | 55 | h = 8; |
56 | 56 | ||
57 | cb_color_info = ((format << 2) | (1 << 27)); | 57 | cb_color_info = ((format << 2) | (1 << 27) | (1 << 8)); |
58 | pitch = (w / 8) - 1; | 58 | pitch = (w / 8) - 1; |
59 | slice = ((w * h) / 64) - 1; | 59 | slice = ((w * h) / 64) - 1; |
60 | 60 | ||
@@ -165,6 +165,9 @@ set_vtx_resource(struct radeon_device *rdev, u64 gpu_addr) | |||
165 | u32 sq_vtx_constant_word2; | 165 | u32 sq_vtx_constant_word2; |
166 | 166 | ||
167 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8)); | 167 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8)); |
168 | #ifdef __BIG_ENDIAN | ||
169 | sq_vtx_constant_word2 |= (2 << 30); | ||
170 | #endif | ||
168 | 171 | ||
169 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_RESOURCE, 7)); | 172 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_RESOURCE, 7)); |
170 | radeon_ring_write(rdev, 0x460); | 173 | radeon_ring_write(rdev, 0x460); |
@@ -199,7 +202,7 @@ set_tex_resource(struct radeon_device *rdev, | |||
199 | if (h < 1) | 202 | if (h < 1) |
200 | h = 1; | 203 | h = 1; |
201 | 204 | ||
202 | sq_tex_resource_word0 = (1 << 0); | 205 | sq_tex_resource_word0 = (1 << 0) | (1 << 3); |
203 | sq_tex_resource_word0 |= ((((pitch >> 3) - 1) << 8) | | 206 | sq_tex_resource_word0 |= ((((pitch >> 3) - 1) << 8) | |
204 | ((w - 1) << 19)); | 207 | ((w - 1) << 19)); |
205 | 208 | ||
@@ -253,7 +256,11 @@ draw_auto(struct radeon_device *rdev) | |||
253 | radeon_ring_write(rdev, DI_PT_RECTLIST); | 256 | radeon_ring_write(rdev, DI_PT_RECTLIST); |
254 | 257 | ||
255 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); | 258 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); |
256 | radeon_ring_write(rdev, DI_INDEX_SIZE_16_BIT); | 259 | radeon_ring_write(rdev, |
260 | #ifdef __BIG_ENDIAN | ||
261 | (2 << 2) | | ||
262 | #endif | ||
263 | DI_INDEX_SIZE_16_BIT); | ||
257 | 264 | ||
258 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); | 265 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); |
259 | radeon_ring_write(rdev, 1); | 266 | radeon_ring_write(rdev, 1); |
@@ -424,7 +431,11 @@ set_default_state(struct radeon_device *rdev) | |||
424 | dwords = ALIGN(rdev->r600_blit.state_len, 0x10); | 431 | dwords = ALIGN(rdev->r600_blit.state_len, 0x10); |
425 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; | 432 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; |
426 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | 433 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
427 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); | 434 | radeon_ring_write(rdev, |
435 | #ifdef __BIG_ENDIAN | ||
436 | (2 << 0) | | ||
437 | #endif | ||
438 | (gpu_addr & 0xFFFFFFFC)); | ||
428 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); | 439 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); |
429 | radeon_ring_write(rdev, dwords); | 440 | radeon_ring_write(rdev, dwords); |
430 | 441 | ||
@@ -467,7 +478,7 @@ static inline uint32_t i2f(uint32_t input) | |||
467 | int r600_blit_init(struct radeon_device *rdev) | 478 | int r600_blit_init(struct radeon_device *rdev) |
468 | { | 479 | { |
469 | u32 obj_size; | 480 | u32 obj_size; |
470 | int r, dwords; | 481 | int i, r, dwords; |
471 | void *ptr; | 482 | void *ptr; |
472 | u32 packet2s[16]; | 483 | u32 packet2s[16]; |
473 | int num_packet2s = 0; | 484 | int num_packet2s = 0; |
@@ -486,7 +497,7 @@ int r600_blit_init(struct radeon_device *rdev) | |||
486 | 497 | ||
487 | dwords = rdev->r600_blit.state_len; | 498 | dwords = rdev->r600_blit.state_len; |
488 | while (dwords & 0xf) { | 499 | while (dwords & 0xf) { |
489 | packet2s[num_packet2s++] = PACKET2(0); | 500 | packet2s[num_packet2s++] = cpu_to_le32(PACKET2(0)); |
490 | dwords++; | 501 | dwords++; |
491 | } | 502 | } |
492 | 503 | ||
@@ -529,8 +540,10 @@ int r600_blit_init(struct radeon_device *rdev) | |||
529 | if (num_packet2s) | 540 | if (num_packet2s) |
530 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | 541 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), |
531 | packet2s, num_packet2s * 4); | 542 | packet2s, num_packet2s * 4); |
532 | memcpy(ptr + rdev->r600_blit.vs_offset, r6xx_vs, r6xx_vs_size * 4); | 543 | for (i = 0; i < r6xx_vs_size; i++) |
533 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); | 544 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(r6xx_vs[i]); |
545 | for (i = 0; i < r6xx_ps_size; i++) | ||
546 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(r6xx_ps[i]); | ||
534 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 547 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
535 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 548 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
536 | 549 | ||
diff --git a/drivers/gpu/drm/radeon/r600_blit_shaders.c b/drivers/gpu/drm/radeon/r600_blit_shaders.c index e8151c1d55b2..2d1f6c5ee2a7 100644 --- a/drivers/gpu/drm/radeon/r600_blit_shaders.c +++ b/drivers/gpu/drm/radeon/r600_blit_shaders.c | |||
@@ -684,7 +684,11 @@ const u32 r6xx_vs[] = | |||
684 | 0x00000000, | 684 | 0x00000000, |
685 | 0x3c000000, | 685 | 0x3c000000, |
686 | 0x68cd1000, | 686 | 0x68cd1000, |
687 | #ifdef __BIG_ENDIAN | ||
688 | 0x000a0000, | ||
689 | #else | ||
687 | 0x00080000, | 690 | 0x00080000, |
691 | #endif | ||
688 | 0x00000000, | 692 | 0x00000000, |
689 | }; | 693 | }; |
690 | 694 | ||
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 4f4cd8b286d5..c3ab959bdc7c 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -396,6 +396,9 @@ static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
396 | r600_do_cp_stop(dev_priv); | 396 | r600_do_cp_stop(dev_priv); |
397 | 397 | ||
398 | RADEON_WRITE(R600_CP_RB_CNTL, | 398 | RADEON_WRITE(R600_CP_RB_CNTL, |
399 | #ifdef __BIG_ENDIAN | ||
400 | R600_BUF_SWAP_32BIT | | ||
401 | #endif | ||
399 | R600_RB_NO_UPDATE | | 402 | R600_RB_NO_UPDATE | |
400 | R600_RB_BLKSZ(15) | | 403 | R600_RB_BLKSZ(15) | |
401 | R600_RB_BUFSZ(3)); | 404 | R600_RB_BUFSZ(3)); |
@@ -486,9 +489,12 @@ static void r700_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
486 | r600_do_cp_stop(dev_priv); | 489 | r600_do_cp_stop(dev_priv); |
487 | 490 | ||
488 | RADEON_WRITE(R600_CP_RB_CNTL, | 491 | RADEON_WRITE(R600_CP_RB_CNTL, |
492 | #ifdef __BIG_ENDIAN | ||
493 | R600_BUF_SWAP_32BIT | | ||
494 | #endif | ||
489 | R600_RB_NO_UPDATE | | 495 | R600_RB_NO_UPDATE | |
490 | (15 << 8) | | 496 | R600_RB_BLKSZ(15) | |
491 | (3 << 0)); | 497 | R600_RB_BUFSZ(3)); |
492 | 498 | ||
493 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 499 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
494 | RADEON_READ(R600_GRBM_SOFT_RESET); | 500 | RADEON_READ(R600_GRBM_SOFT_RESET); |
@@ -550,8 +556,12 @@ static void r600_test_writeback(drm_radeon_private_t *dev_priv) | |||
550 | 556 | ||
551 | if (!dev_priv->writeback_works) { | 557 | if (!dev_priv->writeback_works) { |
552 | /* Disable writeback to avoid unnecessary bus master transfer */ | 558 | /* Disable writeback to avoid unnecessary bus master transfer */ |
553 | RADEON_WRITE(R600_CP_RB_CNTL, RADEON_READ(R600_CP_RB_CNTL) | | 559 | RADEON_WRITE(R600_CP_RB_CNTL, |
554 | RADEON_RB_NO_UPDATE); | 560 | #ifdef __BIG_ENDIAN |
561 | R600_BUF_SWAP_32BIT | | ||
562 | #endif | ||
563 | RADEON_READ(R600_CP_RB_CNTL) | | ||
564 | R600_RB_NO_UPDATE); | ||
555 | RADEON_WRITE(R600_SCRATCH_UMSK, 0); | 565 | RADEON_WRITE(R600_SCRATCH_UMSK, 0); |
556 | } | 566 | } |
557 | } | 567 | } |
@@ -575,7 +585,11 @@ int r600_do_engine_reset(struct drm_device *dev) | |||
575 | 585 | ||
576 | RADEON_WRITE(R600_CP_RB_WPTR_DELAY, 0); | 586 | RADEON_WRITE(R600_CP_RB_WPTR_DELAY, 0); |
577 | cp_rb_cntl = RADEON_READ(R600_CP_RB_CNTL); | 587 | cp_rb_cntl = RADEON_READ(R600_CP_RB_CNTL); |
578 | RADEON_WRITE(R600_CP_RB_CNTL, R600_RB_RPTR_WR_ENA); | 588 | RADEON_WRITE(R600_CP_RB_CNTL, |
589 | #ifdef __BIG_ENDIAN | ||
590 | R600_BUF_SWAP_32BIT | | ||
591 | #endif | ||
592 | R600_RB_RPTR_WR_ENA); | ||
579 | 593 | ||
580 | RADEON_WRITE(R600_CP_RB_RPTR_WR, cp_ptr); | 594 | RADEON_WRITE(R600_CP_RB_RPTR_WR, cp_ptr); |
581 | RADEON_WRITE(R600_CP_RB_WPTR, cp_ptr); | 595 | RADEON_WRITE(R600_CP_RB_WPTR, cp_ptr); |
@@ -1838,7 +1852,10 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev, | |||
1838 | + dev_priv->gart_vm_start; | 1852 | + dev_priv->gart_vm_start; |
1839 | } | 1853 | } |
1840 | RADEON_WRITE(R600_CP_RB_RPTR_ADDR, | 1854 | RADEON_WRITE(R600_CP_RB_RPTR_ADDR, |
1841 | rptr_addr & 0xffffffff); | 1855 | #ifdef __BIG_ENDIAN |
1856 | (2 << 0) | | ||
1857 | #endif | ||
1858 | (rptr_addr & 0xfffffffc)); | ||
1842 | RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, | 1859 | RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, |
1843 | upper_32_bits(rptr_addr)); | 1860 | upper_32_bits(rptr_addr)); |
1844 | 1861 | ||
@@ -1889,7 +1906,7 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev, | |||
1889 | { | 1906 | { |
1890 | u64 scratch_addr; | 1907 | u64 scratch_addr; |
1891 | 1908 | ||
1892 | scratch_addr = RADEON_READ(R600_CP_RB_RPTR_ADDR); | 1909 | scratch_addr = RADEON_READ(R600_CP_RB_RPTR_ADDR) & 0xFFFFFFFC; |
1893 | scratch_addr |= ((u64)RADEON_READ(R600_CP_RB_RPTR_ADDR_HI)) << 32; | 1910 | scratch_addr |= ((u64)RADEON_READ(R600_CP_RB_RPTR_ADDR_HI)) << 32; |
1894 | scratch_addr += R600_SCRATCH_REG_OFFSET; | 1911 | scratch_addr += R600_SCRATCH_REG_OFFSET; |
1895 | scratch_addr >>= 8; | 1912 | scratch_addr >>= 8; |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 7831e0890210..153095fba62f 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -295,17 +295,18 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
295 | } | 295 | } |
296 | 296 | ||
297 | if (!IS_ALIGNED(pitch, pitch_align)) { | 297 | if (!IS_ALIGNED(pitch, pitch_align)) { |
298 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | 298 | dev_warn(p->dev, "%s:%d cb pitch (%d, 0x%x, %d) invalid\n", |
299 | __func__, __LINE__, pitch); | 299 | __func__, __LINE__, pitch, pitch_align, array_mode); |
300 | return -EINVAL; | 300 | return -EINVAL; |
301 | } | 301 | } |
302 | if (!IS_ALIGNED(height, height_align)) { | 302 | if (!IS_ALIGNED(height, height_align)) { |
303 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | 303 | dev_warn(p->dev, "%s:%d cb height (%d, 0x%x, %d) invalid\n", |
304 | __func__, __LINE__, height); | 304 | __func__, __LINE__, height, height_align, array_mode); |
305 | return -EINVAL; | 305 | return -EINVAL; |
306 | } | 306 | } |
307 | if (!IS_ALIGNED(base_offset, base_align)) { | 307 | if (!IS_ALIGNED(base_offset, base_align)) { |
308 | dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset); | 308 | dev_warn(p->dev, "%s offset[%d] 0x%llx 0x%llx, %d not aligned\n", __func__, i, |
309 | base_offset, base_align, array_mode); | ||
309 | return -EINVAL; | 310 | return -EINVAL; |
310 | } | 311 | } |
311 | 312 | ||
@@ -320,7 +321,10 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
320 | * broken userspace. | 321 | * broken userspace. |
321 | */ | 322 | */ |
322 | } else { | 323 | } else { |
323 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); | 324 | dev_warn(p->dev, "%s offset[%d] %d %d %d %lu too big\n", __func__, i, |
325 | array_mode, | ||
326 | track->cb_color_bo_offset[i], tmp, | ||
327 | radeon_bo_size(track->cb_color_bo[i])); | ||
324 | return -EINVAL; | 328 | return -EINVAL; |
325 | } | 329 | } |
326 | } | 330 | } |
@@ -455,17 +459,18 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
455 | } | 459 | } |
456 | 460 | ||
457 | if (!IS_ALIGNED(pitch, pitch_align)) { | 461 | if (!IS_ALIGNED(pitch, pitch_align)) { |
458 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | 462 | dev_warn(p->dev, "%s:%d db pitch (%d, 0x%x, %d) invalid\n", |
459 | __func__, __LINE__, pitch); | 463 | __func__, __LINE__, pitch, pitch_align, array_mode); |
460 | return -EINVAL; | 464 | return -EINVAL; |
461 | } | 465 | } |
462 | if (!IS_ALIGNED(height, height_align)) { | 466 | if (!IS_ALIGNED(height, height_align)) { |
463 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | 467 | dev_warn(p->dev, "%s:%d db height (%d, 0x%x, %d) invalid\n", |
464 | __func__, __LINE__, height); | 468 | __func__, __LINE__, height, height_align, array_mode); |
465 | return -EINVAL; | 469 | return -EINVAL; |
466 | } | 470 | } |
467 | if (!IS_ALIGNED(base_offset, base_align)) { | 471 | if (!IS_ALIGNED(base_offset, base_align)) { |
468 | dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset); | 472 | dev_warn(p->dev, "%s offset[%d] 0x%llx, 0x%llx, %d not aligned\n", __func__, i, |
473 | base_offset, base_align, array_mode); | ||
469 | return -EINVAL; | 474 | return -EINVAL; |
470 | } | 475 | } |
471 | 476 | ||
@@ -473,9 +478,10 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
473 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; | 478 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; |
474 | tmp = ntiles * bpe * 64 * nviews; | 479 | tmp = ntiles * bpe * 64 * nviews; |
475 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { | 480 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { |
476 | dev_warn(p->dev, "z/stencil buffer too small (0x%08X %d %d %d -> %u have %lu)\n", | 481 | dev_warn(p->dev, "z/stencil buffer (%d) too small (0x%08X %d %d %d -> %u have %lu)\n", |
477 | track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset, | 482 | array_mode, |
478 | radeon_bo_size(track->db_bo)); | 483 | track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset, |
484 | radeon_bo_size(track->db_bo)); | ||
479 | return -EINVAL; | 485 | return -EINVAL; |
480 | } | 486 | } |
481 | } | 487 | } |
@@ -1227,18 +1233,18 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i | |||
1227 | /* XXX check height as well... */ | 1233 | /* XXX check height as well... */ |
1228 | 1234 | ||
1229 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1235 | if (!IS_ALIGNED(pitch, pitch_align)) { |
1230 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1236 | dev_warn(p->dev, "%s:%d tex pitch (%d, 0x%x, %d) invalid\n", |
1231 | __func__, __LINE__, pitch); | 1237 | __func__, __LINE__, pitch, pitch_align, G_038000_TILE_MODE(word0)); |
1232 | return -EINVAL; | 1238 | return -EINVAL; |
1233 | } | 1239 | } |
1234 | if (!IS_ALIGNED(base_offset, base_align)) { | 1240 | if (!IS_ALIGNED(base_offset, base_align)) { |
1235 | dev_warn(p->dev, "%s:%d tex base offset (0x%llx) invalid\n", | 1241 | dev_warn(p->dev, "%s:%d tex base offset (0x%llx, 0x%llx, %d) invalid\n", |
1236 | __func__, __LINE__, base_offset); | 1242 | __func__, __LINE__, base_offset, base_align, G_038000_TILE_MODE(word0)); |
1237 | return -EINVAL; | 1243 | return -EINVAL; |
1238 | } | 1244 | } |
1239 | if (!IS_ALIGNED(mip_offset, base_align)) { | 1245 | if (!IS_ALIGNED(mip_offset, base_align)) { |
1240 | dev_warn(p->dev, "%s:%d tex mip offset (0x%llx) invalid\n", | 1246 | dev_warn(p->dev, "%s:%d tex mip offset (0x%llx, 0x%llx, %d) invalid\n", |
1241 | __func__, __LINE__, mip_offset); | 1247 | __func__, __LINE__, mip_offset, base_align, G_038000_TILE_MODE(word0)); |
1242 | return -EINVAL; | 1248 | return -EINVAL; |
1243 | } | 1249 | } |
1244 | 1250 | ||
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h index 33cda016b083..f869897c7456 100644 --- a/drivers/gpu/drm/radeon/r600_reg.h +++ b/drivers/gpu/drm/radeon/r600_reg.h | |||
@@ -81,7 +81,11 @@ | |||
81 | #define R600_MEDIUM_VID_LOWER_GPIO_CNTL 0x720 | 81 | #define R600_MEDIUM_VID_LOWER_GPIO_CNTL 0x720 |
82 | #define R600_LOW_VID_LOWER_GPIO_CNTL 0x724 | 82 | #define R600_LOW_VID_LOWER_GPIO_CNTL 0x724 |
83 | 83 | ||
84 | 84 | #define R600_D1GRPH_SWAP_CONTROL 0x610C | |
85 | # define R600_D1GRPH_SWAP_ENDIAN_NONE (0 << 0) | ||
86 | # define R600_D1GRPH_SWAP_ENDIAN_16BIT (1 << 0) | ||
87 | # define R600_D1GRPH_SWAP_ENDIAN_32BIT (2 << 0) | ||
88 | # define R600_D1GRPH_SWAP_ENDIAN_64BIT (3 << 0) | ||
85 | 89 | ||
86 | #define R600_HDP_NONSURFACE_BASE 0x2c04 | 90 | #define R600_HDP_NONSURFACE_BASE 0x2c04 |
87 | 91 | ||
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index a5d898b4bad2..04bac0bbd3ec 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -154,13 +154,14 @@ | |||
154 | #define ROQ_IB2_START(x) ((x) << 8) | 154 | #define ROQ_IB2_START(x) ((x) << 8) |
155 | #define CP_RB_BASE 0xC100 | 155 | #define CP_RB_BASE 0xC100 |
156 | #define CP_RB_CNTL 0xC104 | 156 | #define CP_RB_CNTL 0xC104 |
157 | #define RB_BUFSZ(x) ((x)<<0) | 157 | #define RB_BUFSZ(x) ((x) << 0) |
158 | #define RB_BLKSZ(x) ((x)<<8) | 158 | #define RB_BLKSZ(x) ((x) << 8) |
159 | #define RB_NO_UPDATE (1<<27) | 159 | #define RB_NO_UPDATE (1 << 27) |
160 | #define RB_RPTR_WR_ENA (1<<31) | 160 | #define RB_RPTR_WR_ENA (1 << 31) |
161 | #define BUF_SWAP_32BIT (2 << 16) | 161 | #define BUF_SWAP_32BIT (2 << 16) |
162 | #define CP_RB_RPTR 0x8700 | 162 | #define CP_RB_RPTR 0x8700 |
163 | #define CP_RB_RPTR_ADDR 0xC10C | 163 | #define CP_RB_RPTR_ADDR 0xC10C |
164 | #define RB_RPTR_SWAP(x) ((x) << 0) | ||
164 | #define CP_RB_RPTR_ADDR_HI 0xC110 | 165 | #define CP_RB_RPTR_ADDR_HI 0xC110 |
165 | #define CP_RB_RPTR_WR 0xC108 | 166 | #define CP_RB_RPTR_WR 0xC108 |
166 | #define CP_RB_WPTR 0xC114 | 167 | #define CP_RB_WPTR 0xC114 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 71d2a554bbe6..56c48b67ef3d 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -179,10 +179,10 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev); | |||
179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); | 179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); |
180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); | 180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); |
181 | void rs690_pm_info(struct radeon_device *rdev); | 181 | void rs690_pm_info(struct radeon_device *rdev); |
182 | extern u32 rv6xx_get_temp(struct radeon_device *rdev); | 182 | extern int rv6xx_get_temp(struct radeon_device *rdev); |
183 | extern u32 rv770_get_temp(struct radeon_device *rdev); | 183 | extern int rv770_get_temp(struct radeon_device *rdev); |
184 | extern u32 evergreen_get_temp(struct radeon_device *rdev); | 184 | extern int evergreen_get_temp(struct radeon_device *rdev); |
185 | extern u32 sumo_get_temp(struct radeon_device *rdev); | 185 | extern int sumo_get_temp(struct radeon_device *rdev); |
186 | 186 | ||
187 | /* | 187 | /* |
188 | * Fences. | 188 | * Fences. |
@@ -812,8 +812,7 @@ struct radeon_pm { | |||
812 | fixed20_12 sclk; | 812 | fixed20_12 sclk; |
813 | fixed20_12 mclk; | 813 | fixed20_12 mclk; |
814 | fixed20_12 needed_bandwidth; | 814 | fixed20_12 needed_bandwidth; |
815 | /* XXX: use a define for num power modes */ | 815 | struct radeon_power_state *power_state; |
816 | struct radeon_power_state power_state[8]; | ||
817 | /* number of valid power states */ | 816 | /* number of valid power states */ |
818 | int num_power_states; | 817 | int num_power_states; |
819 | int current_power_state_index; | 818 | int current_power_state_index; |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 3a1b16186224..e75d63b8e21d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -759,7 +759,7 @@ static struct radeon_asic evergreen_asic = { | |||
759 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, | 759 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, |
760 | .gart_set_page = &rs600_gart_set_page, | 760 | .gart_set_page = &rs600_gart_set_page, |
761 | .ring_test = &r600_ring_test, | 761 | .ring_test = &r600_ring_test, |
762 | .ring_ib_execute = &r600_ring_ib_execute, | 762 | .ring_ib_execute = &evergreen_ring_ib_execute, |
763 | .irq_set = &evergreen_irq_set, | 763 | .irq_set = &evergreen_irq_set, |
764 | .irq_process = &evergreen_irq_process, | 764 | .irq_process = &evergreen_irq_process, |
765 | .get_vblank_counter = &evergreen_get_vblank_counter, | 765 | .get_vblank_counter = &evergreen_get_vblank_counter, |
@@ -805,7 +805,7 @@ static struct radeon_asic sumo_asic = { | |||
805 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, | 805 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, |
806 | .gart_set_page = &rs600_gart_set_page, | 806 | .gart_set_page = &rs600_gart_set_page, |
807 | .ring_test = &r600_ring_test, | 807 | .ring_test = &r600_ring_test, |
808 | .ring_ib_execute = &r600_ring_ib_execute, | 808 | .ring_ib_execute = &evergreen_ring_ib_execute, |
809 | .irq_set = &evergreen_irq_set, | 809 | .irq_set = &evergreen_irq_set, |
810 | .irq_process = &evergreen_irq_process, | 810 | .irq_process = &evergreen_irq_process, |
811 | .get_vblank_counter = &evergreen_get_vblank_counter, | 811 | .get_vblank_counter = &evergreen_get_vblank_counter, |
@@ -848,7 +848,7 @@ static struct radeon_asic btc_asic = { | |||
848 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, | 848 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, |
849 | .gart_set_page = &rs600_gart_set_page, | 849 | .gart_set_page = &rs600_gart_set_page, |
850 | .ring_test = &r600_ring_test, | 850 | .ring_test = &r600_ring_test, |
851 | .ring_ib_execute = &r600_ring_ib_execute, | 851 | .ring_ib_execute = &evergreen_ring_ib_execute, |
852 | .irq_set = &evergreen_irq_set, | 852 | .irq_set = &evergreen_irq_set, |
853 | .irq_process = &evergreen_irq_process, | 853 | .irq_process = &evergreen_irq_process, |
854 | .get_vblank_counter = &evergreen_get_vblank_counter, | 854 | .get_vblank_counter = &evergreen_get_vblank_counter, |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index e01f07718539..c59bd98a2029 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -355,6 +355,7 @@ int evergreen_resume(struct radeon_device *rdev); | |||
355 | bool evergreen_gpu_is_lockup(struct radeon_device *rdev); | 355 | bool evergreen_gpu_is_lockup(struct radeon_device *rdev); |
356 | int evergreen_asic_reset(struct radeon_device *rdev); | 356 | int evergreen_asic_reset(struct radeon_device *rdev); |
357 | void evergreen_bandwidth_update(struct radeon_device *rdev); | 357 | void evergreen_bandwidth_update(struct radeon_device *rdev); |
358 | void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); | ||
358 | int evergreen_copy_blit(struct radeon_device *rdev, | 359 | int evergreen_copy_blit(struct radeon_device *rdev, |
359 | uint64_t src_offset, uint64_t dst_offset, | 360 | uint64_t src_offset, uint64_t dst_offset, |
360 | unsigned num_pages, struct radeon_fence *fence); | 361 | unsigned num_pages, struct radeon_fence *fence); |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 1573202a6418..02d5c415f499 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -88,7 +88,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
88 | /* some evergreen boards have bad data for this entry */ | 88 | /* some evergreen boards have bad data for this entry */ |
89 | if (ASIC_IS_DCE4(rdev)) { | 89 | if (ASIC_IS_DCE4(rdev)) { |
90 | if ((i == 7) && | 90 | if ((i == 7) && |
91 | (gpio->usClkMaskRegisterIndex == 0x1936) && | 91 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && |
92 | (gpio->sucI2cId.ucAccess == 0)) { | 92 | (gpio->sucI2cId.ucAccess == 0)) { |
93 | gpio->sucI2cId.ucAccess = 0x97; | 93 | gpio->sucI2cId.ucAccess = 0x97; |
94 | gpio->ucDataMaskShift = 8; | 94 | gpio->ucDataMaskShift = 8; |
@@ -101,7 +101,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
101 | /* some DCE3 boards have bad data for this entry */ | 101 | /* some DCE3 boards have bad data for this entry */ |
102 | if (ASIC_IS_DCE3(rdev)) { | 102 | if (ASIC_IS_DCE3(rdev)) { |
103 | if ((i == 4) && | 103 | if ((i == 4) && |
104 | (gpio->usClkMaskRegisterIndex == 0x1fda) && | 104 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && |
105 | (gpio->sucI2cId.ucAccess == 0x94)) | 105 | (gpio->sucI2cId.ucAccess == 0x94)) |
106 | gpio->sucI2cId.ucAccess = 0x14; | 106 | gpio->sucI2cId.ucAccess = 0x14; |
107 | } | 107 | } |
@@ -172,7 +172,7 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
172 | /* some evergreen boards have bad data for this entry */ | 172 | /* some evergreen boards have bad data for this entry */ |
173 | if (ASIC_IS_DCE4(rdev)) { | 173 | if (ASIC_IS_DCE4(rdev)) { |
174 | if ((i == 7) && | 174 | if ((i == 7) && |
175 | (gpio->usClkMaskRegisterIndex == 0x1936) && | 175 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && |
176 | (gpio->sucI2cId.ucAccess == 0)) { | 176 | (gpio->sucI2cId.ucAccess == 0)) { |
177 | gpio->sucI2cId.ucAccess = 0x97; | 177 | gpio->sucI2cId.ucAccess = 0x97; |
178 | gpio->ucDataMaskShift = 8; | 178 | gpio->ucDataMaskShift = 8; |
@@ -185,7 +185,7 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
185 | /* some DCE3 boards have bad data for this entry */ | 185 | /* some DCE3 boards have bad data for this entry */ |
186 | if (ASIC_IS_DCE3(rdev)) { | 186 | if (ASIC_IS_DCE3(rdev)) { |
187 | if ((i == 4) && | 187 | if ((i == 4) && |
188 | (gpio->usClkMaskRegisterIndex == 0x1fda) && | 188 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && |
189 | (gpio->sucI2cId.ucAccess == 0x94)) | 189 | (gpio->sucI2cId.ucAccess == 0x94)) |
190 | gpio->sucI2cId.ucAccess = 0x14; | 190 | gpio->sucI2cId.ucAccess = 0x14; |
191 | } | 191 | } |
@@ -252,7 +252,7 @@ static inline struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rd | |||
252 | pin = &gpio_info->asGPIO_Pin[i]; | 252 | pin = &gpio_info->asGPIO_Pin[i]; |
253 | if (id == pin->ucGPIO_ID) { | 253 | if (id == pin->ucGPIO_ID) { |
254 | gpio.id = pin->ucGPIO_ID; | 254 | gpio.id = pin->ucGPIO_ID; |
255 | gpio.reg = pin->usGpioPin_AIndex * 4; | 255 | gpio.reg = le16_to_cpu(pin->usGpioPin_AIndex) * 4; |
256 | gpio.mask = (1 << pin->ucGpioPinBitShift); | 256 | gpio.mask = (1 << pin->ucGpioPinBitShift); |
257 | gpio.valid = true; | 257 | gpio.valid = true; |
258 | break; | 258 | break; |
@@ -387,15 +387,11 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
387 | *line_mux = 0x90; | 387 | *line_mux = 0x90; |
388 | } | 388 | } |
389 | 389 | ||
390 | /* mac rv630 */ | 390 | /* mac rv630, rv730, others */ |
391 | if ((dev->pdev->device == 0x9588) && | 391 | if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) && |
392 | (dev->pdev->subsystem_vendor == 0x106b) && | 392 | (*connector_type == DRM_MODE_CONNECTOR_DVII)) { |
393 | (dev->pdev->subsystem_device == 0x00a6)) { | 393 | *connector_type = DRM_MODE_CONNECTOR_9PinDIN; |
394 | if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) && | 394 | *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1; |
395 | (*connector_type == DRM_MODE_CONNECTOR_DVII)) { | ||
396 | *connector_type = DRM_MODE_CONNECTOR_9PinDIN; | ||
397 | *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1; | ||
398 | } | ||
399 | } | 395 | } |
400 | 396 | ||
401 | /* ASUS HD 3600 XT board lists the DVI port as HDMI */ | 397 | /* ASUS HD 3600 XT board lists the DVI port as HDMI */ |
@@ -1167,16 +1163,6 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
1167 | p1pll->pll_out_min = 64800; | 1163 | p1pll->pll_out_min = 64800; |
1168 | else | 1164 | else |
1169 | p1pll->pll_out_min = 20000; | 1165 | p1pll->pll_out_min = 20000; |
1170 | } else if (p1pll->pll_out_min > 64800) { | ||
1171 | /* Limiting the pll output range is a good thing generally as | ||
1172 | * it limits the number of possible pll combinations for a given | ||
1173 | * frequency presumably to the ones that work best on each card. | ||
1174 | * However, certain duallink DVI monitors seem to like | ||
1175 | * pll combinations that would be limited by this at least on | ||
1176 | * pre-DCE 3.0 r6xx hardware. This might need to be adjusted per | ||
1177 | * family. | ||
1178 | */ | ||
1179 | p1pll->pll_out_min = 64800; | ||
1180 | } | 1166 | } |
1181 | 1167 | ||
1182 | p1pll->pll_in_min = | 1168 | p1pll->pll_in_min = |
@@ -1288,11 +1274,11 @@ bool radeon_atombios_sideport_present(struct radeon_device *rdev) | |||
1288 | data_offset); | 1274 | data_offset); |
1289 | switch (crev) { | 1275 | switch (crev) { |
1290 | case 1: | 1276 | case 1: |
1291 | if (igp_info->info.ulBootUpMemoryClock) | 1277 | if (le32_to_cpu(igp_info->info.ulBootUpMemoryClock)) |
1292 | return true; | 1278 | return true; |
1293 | break; | 1279 | break; |
1294 | case 2: | 1280 | case 2: |
1295 | if (igp_info->info_2.ulBootUpSidePortClock) | 1281 | if (le32_to_cpu(igp_info->info_2.ulBootUpSidePortClock)) |
1296 | return true; | 1282 | return true; |
1297 | break; | 1283 | break; |
1298 | default: | 1284 | default: |
@@ -1456,7 +1442,7 @@ bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, | |||
1456 | 1442 | ||
1457 | for (i = 0; i < num_indices; i++) { | 1443 | for (i = 0; i < num_indices; i++) { |
1458 | if ((ss_info->info.asSpreadSpectrum[i].ucClockIndication == id) && | 1444 | if ((ss_info->info.asSpreadSpectrum[i].ucClockIndication == id) && |
1459 | (clock <= ss_info->info.asSpreadSpectrum[i].ulTargetClockRange)) { | 1445 | (clock <= le32_to_cpu(ss_info->info.asSpreadSpectrum[i].ulTargetClockRange))) { |
1460 | ss->percentage = | 1446 | ss->percentage = |
1461 | le16_to_cpu(ss_info->info.asSpreadSpectrum[i].usSpreadSpectrumPercentage); | 1447 | le16_to_cpu(ss_info->info.asSpreadSpectrum[i].usSpreadSpectrumPercentage); |
1462 | ss->type = ss_info->info.asSpreadSpectrum[i].ucSpreadSpectrumMode; | 1448 | ss->type = ss_info->info.asSpreadSpectrum[i].ucSpreadSpectrumMode; |
@@ -1470,7 +1456,7 @@ bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, | |||
1470 | sizeof(ATOM_ASIC_SS_ASSIGNMENT_V2); | 1456 | sizeof(ATOM_ASIC_SS_ASSIGNMENT_V2); |
1471 | for (i = 0; i < num_indices; i++) { | 1457 | for (i = 0; i < num_indices; i++) { |
1472 | if ((ss_info->info_2.asSpreadSpectrum[i].ucClockIndication == id) && | 1458 | if ((ss_info->info_2.asSpreadSpectrum[i].ucClockIndication == id) && |
1473 | (clock <= ss_info->info_2.asSpreadSpectrum[i].ulTargetClockRange)) { | 1459 | (clock <= le32_to_cpu(ss_info->info_2.asSpreadSpectrum[i].ulTargetClockRange))) { |
1474 | ss->percentage = | 1460 | ss->percentage = |
1475 | le16_to_cpu(ss_info->info_2.asSpreadSpectrum[i].usSpreadSpectrumPercentage); | 1461 | le16_to_cpu(ss_info->info_2.asSpreadSpectrum[i].usSpreadSpectrumPercentage); |
1476 | ss->type = ss_info->info_2.asSpreadSpectrum[i].ucSpreadSpectrumMode; | 1462 | ss->type = ss_info->info_2.asSpreadSpectrum[i].ucSpreadSpectrumMode; |
@@ -1484,7 +1470,7 @@ bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, | |||
1484 | sizeof(ATOM_ASIC_SS_ASSIGNMENT_V3); | 1470 | sizeof(ATOM_ASIC_SS_ASSIGNMENT_V3); |
1485 | for (i = 0; i < num_indices; i++) { | 1471 | for (i = 0; i < num_indices; i++) { |
1486 | if ((ss_info->info_3.asSpreadSpectrum[i].ucClockIndication == id) && | 1472 | if ((ss_info->info_3.asSpreadSpectrum[i].ucClockIndication == id) && |
1487 | (clock <= ss_info->info_3.asSpreadSpectrum[i].ulTargetClockRange)) { | 1473 | (clock <= le32_to_cpu(ss_info->info_3.asSpreadSpectrum[i].ulTargetClockRange))) { |
1488 | ss->percentage = | 1474 | ss->percentage = |
1489 | le16_to_cpu(ss_info->info_3.asSpreadSpectrum[i].usSpreadSpectrumPercentage); | 1475 | le16_to_cpu(ss_info->info_3.asSpreadSpectrum[i].usSpreadSpectrumPercentage); |
1490 | ss->type = ss_info->info_3.asSpreadSpectrum[i].ucSpreadSpectrumMode; | 1476 | ss->type = ss_info->info_3.asSpreadSpectrum[i].ucSpreadSpectrumMode; |
@@ -1567,8 +1553,8 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct | |||
1567 | if (misc & ATOM_DOUBLE_CLOCK_MODE) | 1553 | if (misc & ATOM_DOUBLE_CLOCK_MODE) |
1568 | lvds->native_mode.flags |= DRM_MODE_FLAG_DBLSCAN; | 1554 | lvds->native_mode.flags |= DRM_MODE_FLAG_DBLSCAN; |
1569 | 1555 | ||
1570 | lvds->native_mode.width_mm = lvds_info->info.sLCDTiming.usImageHSize; | 1556 | lvds->native_mode.width_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageHSize); |
1571 | lvds->native_mode.height_mm = lvds_info->info.sLCDTiming.usImageVSize; | 1557 | lvds->native_mode.height_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageVSize); |
1572 | 1558 | ||
1573 | /* set crtc values */ | 1559 | /* set crtc values */ |
1574 | drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); | 1560 | drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); |
@@ -1583,13 +1569,13 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct | |||
1583 | lvds->linkb = false; | 1569 | lvds->linkb = false; |
1584 | 1570 | ||
1585 | /* parse the lcd record table */ | 1571 | /* parse the lcd record table */ |
1586 | if (lvds_info->info.usModePatchTableOffset) { | 1572 | if (le16_to_cpu(lvds_info->info.usModePatchTableOffset)) { |
1587 | ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record; | 1573 | ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record; |
1588 | ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record; | 1574 | ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record; |
1589 | bool bad_record = false; | 1575 | bool bad_record = false; |
1590 | u8 *record = (u8 *)(mode_info->atom_context->bios + | 1576 | u8 *record = (u8 *)(mode_info->atom_context->bios + |
1591 | data_offset + | 1577 | data_offset + |
1592 | lvds_info->info.usModePatchTableOffset); | 1578 | le16_to_cpu(lvds_info->info.usModePatchTableOffset)); |
1593 | while (*record != ATOM_RECORD_END_TYPE) { | 1579 | while (*record != ATOM_RECORD_END_TYPE) { |
1594 | switch (*record) { | 1580 | switch (*record) { |
1595 | case LCD_MODE_PATCH_RECORD_MODE_TYPE: | 1581 | case LCD_MODE_PATCH_RECORD_MODE_TYPE: |
@@ -1991,6 +1977,9 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
1991 | num_modes = power_info->info.ucNumOfPowerModeEntries; | 1977 | num_modes = power_info->info.ucNumOfPowerModeEntries; |
1992 | if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) | 1978 | if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) |
1993 | num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; | 1979 | num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; |
1980 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * num_modes, GFP_KERNEL); | ||
1981 | if (!rdev->pm.power_state) | ||
1982 | return state_index; | ||
1994 | /* last mode is usually default, array is low to high */ | 1983 | /* last mode is usually default, array is low to high */ |
1995 | for (i = 0; i < num_modes; i++) { | 1984 | for (i = 0; i < num_modes; i++) { |
1996 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 1985 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
@@ -2200,7 +2189,7 @@ static u16 radeon_atombios_get_default_vddc(struct radeon_device *rdev) | |||
2200 | firmware_info = | 2189 | firmware_info = |
2201 | (union firmware_info *)(mode_info->atom_context->bios + | 2190 | (union firmware_info *)(mode_info->atom_context->bios + |
2202 | data_offset); | 2191 | data_offset); |
2203 | vddc = firmware_info->info_14.usBootUpVDDCVoltage; | 2192 | vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); |
2204 | } | 2193 | } |
2205 | 2194 | ||
2206 | return vddc; | 2195 | return vddc; |
@@ -2295,7 +2284,7 @@ static bool radeon_atombios_parse_pplib_clock_info(struct radeon_device *rdev, | |||
2295 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = | 2284 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = |
2296 | VOLTAGE_SW; | 2285 | VOLTAGE_SW; |
2297 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = | 2286 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = |
2298 | clock_info->evergreen.usVDDC; | 2287 | le16_to_cpu(clock_info->evergreen.usVDDC); |
2299 | } else { | 2288 | } else { |
2300 | sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); | 2289 | sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); |
2301 | sclk |= clock_info->r600.ucEngineClockHigh << 16; | 2290 | sclk |= clock_info->r600.ucEngineClockHigh << 16; |
@@ -2306,7 +2295,7 @@ static bool radeon_atombios_parse_pplib_clock_info(struct radeon_device *rdev, | |||
2306 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = | 2295 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = |
2307 | VOLTAGE_SW; | 2296 | VOLTAGE_SW; |
2308 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = | 2297 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = |
2309 | clock_info->r600.usVDDC; | 2298 | le16_to_cpu(clock_info->r600.usVDDC); |
2310 | } | 2299 | } |
2311 | 2300 | ||
2312 | if (rdev->flags & RADEON_IS_IGP) { | 2301 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -2342,6 +2331,10 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev) | |||
2342 | power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); | 2331 | power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); |
2343 | 2332 | ||
2344 | radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); | 2333 | radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); |
2334 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * | ||
2335 | power_info->pplib.ucNumStates, GFP_KERNEL); | ||
2336 | if (!rdev->pm.power_state) | ||
2337 | return state_index; | ||
2345 | /* first mode is usually default, followed by low to high */ | 2338 | /* first mode is usually default, followed by low to high */ |
2346 | for (i = 0; i < power_info->pplib.ucNumStates; i++) { | 2339 | for (i = 0; i < power_info->pplib.ucNumStates; i++) { |
2347 | mode_index = 0; | 2340 | mode_index = 0; |
@@ -2415,13 +2408,17 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev) | |||
2415 | radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); | 2408 | radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); |
2416 | state_array = (struct StateArray *) | 2409 | state_array = (struct StateArray *) |
2417 | (mode_info->atom_context->bios + data_offset + | 2410 | (mode_info->atom_context->bios + data_offset + |
2418 | power_info->pplib.usStateArrayOffset); | 2411 | le16_to_cpu(power_info->pplib.usStateArrayOffset)); |
2419 | clock_info_array = (struct ClockInfoArray *) | 2412 | clock_info_array = (struct ClockInfoArray *) |
2420 | (mode_info->atom_context->bios + data_offset + | 2413 | (mode_info->atom_context->bios + data_offset + |
2421 | power_info->pplib.usClockInfoArrayOffset); | 2414 | le16_to_cpu(power_info->pplib.usClockInfoArrayOffset)); |
2422 | non_clock_info_array = (struct NonClockInfoArray *) | 2415 | non_clock_info_array = (struct NonClockInfoArray *) |
2423 | (mode_info->atom_context->bios + data_offset + | 2416 | (mode_info->atom_context->bios + data_offset + |
2424 | power_info->pplib.usNonClockInfoArrayOffset); | 2417 | le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); |
2418 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * | ||
2419 | state_array->ucNumEntries, GFP_KERNEL); | ||
2420 | if (!rdev->pm.power_state) | ||
2421 | return state_index; | ||
2425 | for (i = 0; i < state_array->ucNumEntries; i++) { | 2422 | for (i = 0; i < state_array->ucNumEntries; i++) { |
2426 | mode_index = 0; | 2423 | mode_index = 0; |
2427 | power_state = (union pplib_power_state *)&state_array->states[i]; | 2424 | power_state = (union pplib_power_state *)&state_array->states[i]; |
@@ -2495,19 +2492,22 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
2495 | break; | 2492 | break; |
2496 | } | 2493 | } |
2497 | } else { | 2494 | } else { |
2498 | /* add the default mode */ | 2495 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); |
2499 | rdev->pm.power_state[state_index].type = | 2496 | if (rdev->pm.power_state) { |
2500 | POWER_STATE_TYPE_DEFAULT; | 2497 | /* add the default mode */ |
2501 | rdev->pm.power_state[state_index].num_clock_modes = 1; | 2498 | rdev->pm.power_state[state_index].type = |
2502 | rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; | 2499 | POWER_STATE_TYPE_DEFAULT; |
2503 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; | 2500 | rdev->pm.power_state[state_index].num_clock_modes = 1; |
2504 | rdev->pm.power_state[state_index].default_clock_mode = | 2501 | rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; |
2505 | &rdev->pm.power_state[state_index].clock_info[0]; | 2502 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; |
2506 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 2503 | rdev->pm.power_state[state_index].default_clock_mode = |
2507 | rdev->pm.power_state[state_index].pcie_lanes = 16; | 2504 | &rdev->pm.power_state[state_index].clock_info[0]; |
2508 | rdev->pm.default_power_state_index = state_index; | 2505 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
2509 | rdev->pm.power_state[state_index].flags = 0; | 2506 | rdev->pm.power_state[state_index].pcie_lanes = 16; |
2510 | state_index++; | 2507 | rdev->pm.default_power_state_index = state_index; |
2508 | rdev->pm.power_state[state_index].flags = 0; | ||
2509 | state_index++; | ||
2510 | } | ||
2511 | } | 2511 | } |
2512 | 2512 | ||
2513 | rdev->pm.num_power_states = state_index; | 2513 | rdev->pm.num_power_states = state_index; |
@@ -2533,7 +2533,7 @@ uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev) | |||
2533 | int index = GetIndexIntoMasterTable(COMMAND, GetEngineClock); | 2533 | int index = GetIndexIntoMasterTable(COMMAND, GetEngineClock); |
2534 | 2534 | ||
2535 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 2535 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
2536 | return args.ulReturnEngineClock; | 2536 | return le32_to_cpu(args.ulReturnEngineClock); |
2537 | } | 2537 | } |
2538 | 2538 | ||
2539 | uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev) | 2539 | uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev) |
@@ -2542,7 +2542,7 @@ uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev) | |||
2542 | int index = GetIndexIntoMasterTable(COMMAND, GetMemoryClock); | 2542 | int index = GetIndexIntoMasterTable(COMMAND, GetMemoryClock); |
2543 | 2543 | ||
2544 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 2544 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
2545 | return args.ulReturnMemoryClock; | 2545 | return le32_to_cpu(args.ulReturnMemoryClock); |
2546 | } | 2546 | } |
2547 | 2547 | ||
2548 | void radeon_atom_set_engine_clock(struct radeon_device *rdev, | 2548 | void radeon_atom_set_engine_clock(struct radeon_device *rdev, |
@@ -2551,7 +2551,7 @@ void radeon_atom_set_engine_clock(struct radeon_device *rdev, | |||
2551 | SET_ENGINE_CLOCK_PS_ALLOCATION args; | 2551 | SET_ENGINE_CLOCK_PS_ALLOCATION args; |
2552 | int index = GetIndexIntoMasterTable(COMMAND, SetEngineClock); | 2552 | int index = GetIndexIntoMasterTable(COMMAND, SetEngineClock); |
2553 | 2553 | ||
2554 | args.ulTargetEngineClock = eng_clock; /* 10 khz */ | 2554 | args.ulTargetEngineClock = cpu_to_le32(eng_clock); /* 10 khz */ |
2555 | 2555 | ||
2556 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 2556 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
2557 | } | 2557 | } |
@@ -2565,7 +2565,7 @@ void radeon_atom_set_memory_clock(struct radeon_device *rdev, | |||
2565 | if (rdev->flags & RADEON_IS_IGP) | 2565 | if (rdev->flags & RADEON_IS_IGP) |
2566 | return; | 2566 | return; |
2567 | 2567 | ||
2568 | args.ulTargetMemoryClock = mem_clock; /* 10 khz */ | 2568 | args.ulTargetMemoryClock = cpu_to_le32(mem_clock); /* 10 khz */ |
2569 | 2569 | ||
2570 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 2570 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
2571 | } | 2571 | } |
@@ -2623,7 +2623,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) | |||
2623 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; | 2623 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; |
2624 | 2624 | ||
2625 | /* tell the bios not to handle mode switching */ | 2625 | /* tell the bios not to handle mode switching */ |
2626 | bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); | 2626 | bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; |
2627 | 2627 | ||
2628 | if (rdev->family >= CHIP_R600) { | 2628 | if (rdev->family >= CHIP_R600) { |
2629 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); | 2629 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); |
@@ -2674,10 +2674,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock) | |||
2674 | else | 2674 | else |
2675 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); | 2675 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); |
2676 | 2676 | ||
2677 | if (lock) | 2677 | if (lock) { |
2678 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; | 2678 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; |
2679 | else | 2679 | bios_6_scratch &= ~ATOM_S6_ACC_MODE; |
2680 | } else { | ||
2680 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; | 2681 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; |
2682 | bios_6_scratch |= ATOM_S6_ACC_MODE; | ||
2683 | } | ||
2681 | 2684 | ||
2682 | if (rdev->family >= CHIP_R600) | 2685 | if (rdev->family >= CHIP_R600) |
2683 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); | 2686 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 591fcae8f224..cf7c8d5b4ec2 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -1504,6 +1504,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1504 | (rdev->pdev->subsystem_device == 0x4a48)) { | 1504 | (rdev->pdev->subsystem_device == 0x4a48)) { |
1505 | /* Mac X800 */ | 1505 | /* Mac X800 */ |
1506 | rdev->mode_info.connector_table = CT_MAC_X800; | 1506 | rdev->mode_info.connector_table = CT_MAC_X800; |
1507 | } else if ((rdev->pdev->device == 0x4150) && | ||
1508 | (rdev->pdev->subsystem_vendor == 0x1002) && | ||
1509 | (rdev->pdev->subsystem_device == 0x4150)) { | ||
1510 | /* Mac G5 9600 */ | ||
1511 | rdev->mode_info.connector_table = CT_MAC_G5_9600; | ||
1507 | } else | 1512 | } else |
1508 | #endif /* CONFIG_PPC_PMAC */ | 1513 | #endif /* CONFIG_PPC_PMAC */ |
1509 | #ifdef CONFIG_PPC64 | 1514 | #ifdef CONFIG_PPC64 |
@@ -2022,6 +2027,48 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
2022 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I, | 2027 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I, |
2023 | &hpd); | 2028 | &hpd); |
2024 | break; | 2029 | break; |
2030 | case CT_MAC_G5_9600: | ||
2031 | DRM_INFO("Connector Table: %d (mac g5 9600)\n", | ||
2032 | rdev->mode_info.connector_table); | ||
2033 | /* DVI - tv dac, dvo */ | ||
2034 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); | ||
2035 | hpd.hpd = RADEON_HPD_1; /* ??? */ | ||
2036 | radeon_add_legacy_encoder(dev, | ||
2037 | radeon_get_encoder_enum(dev, | ||
2038 | ATOM_DEVICE_DFP2_SUPPORT, | ||
2039 | 0), | ||
2040 | ATOM_DEVICE_DFP2_SUPPORT); | ||
2041 | radeon_add_legacy_encoder(dev, | ||
2042 | radeon_get_encoder_enum(dev, | ||
2043 | ATOM_DEVICE_CRT2_SUPPORT, | ||
2044 | 2), | ||
2045 | ATOM_DEVICE_CRT2_SUPPORT); | ||
2046 | radeon_add_legacy_connector(dev, 0, | ||
2047 | ATOM_DEVICE_DFP2_SUPPORT | | ||
2048 | ATOM_DEVICE_CRT2_SUPPORT, | ||
2049 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, | ||
2050 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, | ||
2051 | &hpd); | ||
2052 | /* ADC - primary dac, internal tmds */ | ||
2053 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); | ||
2054 | hpd.hpd = RADEON_HPD_2; /* ??? */ | ||
2055 | radeon_add_legacy_encoder(dev, | ||
2056 | radeon_get_encoder_enum(dev, | ||
2057 | ATOM_DEVICE_DFP1_SUPPORT, | ||
2058 | 0), | ||
2059 | ATOM_DEVICE_DFP1_SUPPORT); | ||
2060 | radeon_add_legacy_encoder(dev, | ||
2061 | radeon_get_encoder_enum(dev, | ||
2062 | ATOM_DEVICE_CRT1_SUPPORT, | ||
2063 | 1), | ||
2064 | ATOM_DEVICE_CRT1_SUPPORT); | ||
2065 | radeon_add_legacy_connector(dev, 1, | ||
2066 | ATOM_DEVICE_DFP1_SUPPORT | | ||
2067 | ATOM_DEVICE_CRT1_SUPPORT, | ||
2068 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, | ||
2069 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, | ||
2070 | &hpd); | ||
2071 | break; | ||
2025 | default: | 2072 | default: |
2026 | DRM_INFO("Connector table: %d (invalid)\n", | 2073 | DRM_INFO("Connector table: %d (invalid)\n", |
2027 | rdev->mode_info.connector_table); | 2074 | rdev->mode_info.connector_table); |
@@ -2442,6 +2489,17 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) | |||
2442 | 2489 | ||
2443 | rdev->pm.default_power_state_index = -1; | 2490 | rdev->pm.default_power_state_index = -1; |
2444 | 2491 | ||
2492 | /* allocate 2 power states */ | ||
2493 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL); | ||
2494 | if (!rdev->pm.power_state) { | ||
2495 | rdev->pm.default_power_state_index = state_index; | ||
2496 | rdev->pm.num_power_states = 0; | ||
2497 | |||
2498 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | ||
2499 | rdev->pm.current_clock_mode_index = 0; | ||
2500 | return; | ||
2501 | } | ||
2502 | |||
2445 | if (rdev->flags & RADEON_IS_MOBILITY) { | 2503 | if (rdev->flags & RADEON_IS_MOBILITY) { |
2446 | offset = combios_get_table_offset(dev, COMBIOS_POWERPLAY_INFO_TABLE); | 2504 | offset = combios_get_table_offset(dev, COMBIOS_POWERPLAY_INFO_TABLE); |
2447 | if (offset) { | 2505 | if (offset) { |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 26091d602b84..4954e2d6ffa2 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -891,9 +891,9 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
891 | pci_disable_device(dev->pdev); | 891 | pci_disable_device(dev->pdev); |
892 | pci_set_power_state(dev->pdev, PCI_D3hot); | 892 | pci_set_power_state(dev->pdev, PCI_D3hot); |
893 | } | 893 | } |
894 | acquire_console_sem(); | 894 | console_lock(); |
895 | radeon_fbdev_set_suspend(rdev, 1); | 895 | radeon_fbdev_set_suspend(rdev, 1); |
896 | release_console_sem(); | 896 | console_unlock(); |
897 | return 0; | 897 | return 0; |
898 | } | 898 | } |
899 | 899 | ||
@@ -905,11 +905,11 @@ int radeon_resume_kms(struct drm_device *dev) | |||
905 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 905 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
906 | return 0; | 906 | return 0; |
907 | 907 | ||
908 | acquire_console_sem(); | 908 | console_lock(); |
909 | pci_set_power_state(dev->pdev, PCI_D0); | 909 | pci_set_power_state(dev->pdev, PCI_D0); |
910 | pci_restore_state(dev->pdev); | 910 | pci_restore_state(dev->pdev); |
911 | if (pci_enable_device(dev->pdev)) { | 911 | if (pci_enable_device(dev->pdev)) { |
912 | release_console_sem(); | 912 | console_unlock(); |
913 | return -1; | 913 | return -1; |
914 | } | 914 | } |
915 | pci_set_master(dev->pdev); | 915 | pci_set_master(dev->pdev); |
@@ -920,7 +920,7 @@ int radeon_resume_kms(struct drm_device *dev) | |||
920 | radeon_restore_bios_scratch_regs(rdev); | 920 | radeon_restore_bios_scratch_regs(rdev); |
921 | 921 | ||
922 | radeon_fbdev_set_suspend(rdev, 0); | 922 | radeon_fbdev_set_suspend(rdev, 0); |
923 | release_console_sem(); | 923 | console_unlock(); |
924 | 924 | ||
925 | /* reset hpd state */ | 925 | /* reset hpd state */ |
926 | radeon_hpd_init(rdev); | 926 | radeon_hpd_init(rdev); |
@@ -936,8 +936,11 @@ int radeon_resume_kms(struct drm_device *dev) | |||
936 | int radeon_gpu_reset(struct radeon_device *rdev) | 936 | int radeon_gpu_reset(struct radeon_device *rdev) |
937 | { | 937 | { |
938 | int r; | 938 | int r; |
939 | int resched; | ||
939 | 940 | ||
940 | radeon_save_bios_scratch_regs(rdev); | 941 | radeon_save_bios_scratch_regs(rdev); |
942 | /* block TTM */ | ||
943 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | ||
941 | radeon_suspend(rdev); | 944 | radeon_suspend(rdev); |
942 | 945 | ||
943 | r = radeon_asic_reset(rdev); | 946 | r = radeon_asic_reset(rdev); |
@@ -946,6 +949,7 @@ int radeon_gpu_reset(struct radeon_device *rdev) | |||
946 | radeon_resume(rdev); | 949 | radeon_resume(rdev); |
947 | radeon_restore_bios_scratch_regs(rdev); | 950 | radeon_restore_bios_scratch_regs(rdev); |
948 | drm_helper_resume_force_mode(rdev->ddev); | 951 | drm_helper_resume_force_mode(rdev->ddev); |
952 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); | ||
949 | return 0; | 953 | return 0; |
950 | } | 954 | } |
951 | /* bad news, how to tell it to userspace ? */ | 955 | /* bad news, how to tell it to userspace ? */ |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index d26dabf878d9..0e657095de7c 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -780,6 +780,125 @@ static int radeon_ddc_dump(struct drm_connector *connector) | |||
780 | return ret; | 780 | return ret; |
781 | } | 781 | } |
782 | 782 | ||
783 | /* avivo */ | ||
784 | static void avivo_get_fb_div(struct radeon_pll *pll, | ||
785 | u32 target_clock, | ||
786 | u32 post_div, | ||
787 | u32 ref_div, | ||
788 | u32 *fb_div, | ||
789 | u32 *frac_fb_div) | ||
790 | { | ||
791 | u32 tmp = post_div * ref_div; | ||
792 | |||
793 | tmp *= target_clock; | ||
794 | *fb_div = tmp / pll->reference_freq; | ||
795 | *frac_fb_div = tmp % pll->reference_freq; | ||
796 | |||
797 | if (*fb_div > pll->max_feedback_div) | ||
798 | *fb_div = pll->max_feedback_div; | ||
799 | else if (*fb_div < pll->min_feedback_div) | ||
800 | *fb_div = pll->min_feedback_div; | ||
801 | } | ||
802 | |||
803 | static u32 avivo_get_post_div(struct radeon_pll *pll, | ||
804 | u32 target_clock) | ||
805 | { | ||
806 | u32 vco, post_div, tmp; | ||
807 | |||
808 | if (pll->flags & RADEON_PLL_USE_POST_DIV) | ||
809 | return pll->post_div; | ||
810 | |||
811 | if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP) { | ||
812 | if (pll->flags & RADEON_PLL_IS_LCD) | ||
813 | vco = pll->lcd_pll_out_min; | ||
814 | else | ||
815 | vco = pll->pll_out_min; | ||
816 | } else { | ||
817 | if (pll->flags & RADEON_PLL_IS_LCD) | ||
818 | vco = pll->lcd_pll_out_max; | ||
819 | else | ||
820 | vco = pll->pll_out_max; | ||
821 | } | ||
822 | |||
823 | post_div = vco / target_clock; | ||
824 | tmp = vco % target_clock; | ||
825 | |||
826 | if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP) { | ||
827 | if (tmp) | ||
828 | post_div++; | ||
829 | } else { | ||
830 | if (!tmp) | ||
831 | post_div--; | ||
832 | } | ||
833 | |||
834 | if (post_div > pll->max_post_div) | ||
835 | post_div = pll->max_post_div; | ||
836 | else if (post_div < pll->min_post_div) | ||
837 | post_div = pll->min_post_div; | ||
838 | |||
839 | return post_div; | ||
840 | } | ||
841 | |||
842 | #define MAX_TOLERANCE 10 | ||
843 | |||
844 | void radeon_compute_pll_avivo(struct radeon_pll *pll, | ||
845 | u32 freq, | ||
846 | u32 *dot_clock_p, | ||
847 | u32 *fb_div_p, | ||
848 | u32 *frac_fb_div_p, | ||
849 | u32 *ref_div_p, | ||
850 | u32 *post_div_p) | ||
851 | { | ||
852 | u32 target_clock = freq / 10; | ||
853 | u32 post_div = avivo_get_post_div(pll, target_clock); | ||
854 | u32 ref_div = pll->min_ref_div; | ||
855 | u32 fb_div = 0, frac_fb_div = 0, tmp; | ||
856 | |||
857 | if (pll->flags & RADEON_PLL_USE_REF_DIV) | ||
858 | ref_div = pll->reference_div; | ||
859 | |||
860 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { | ||
861 | avivo_get_fb_div(pll, target_clock, post_div, ref_div, &fb_div, &frac_fb_div); | ||
862 | frac_fb_div = (100 * frac_fb_div) / pll->reference_freq; | ||
863 | if (frac_fb_div >= 5) { | ||
864 | frac_fb_div -= 5; | ||
865 | frac_fb_div = frac_fb_div / 10; | ||
866 | frac_fb_div++; | ||
867 | } | ||
868 | if (frac_fb_div >= 10) { | ||
869 | fb_div++; | ||
870 | frac_fb_div = 0; | ||
871 | } | ||
872 | } else { | ||
873 | while (ref_div <= pll->max_ref_div) { | ||
874 | avivo_get_fb_div(pll, target_clock, post_div, ref_div, | ||
875 | &fb_div, &frac_fb_div); | ||
876 | if (frac_fb_div >= (pll->reference_freq / 2)) | ||
877 | fb_div++; | ||
878 | frac_fb_div = 0; | ||
879 | tmp = (pll->reference_freq * fb_div) / (post_div * ref_div); | ||
880 | tmp = (tmp * 10000) / target_clock; | ||
881 | |||
882 | if (tmp > (10000 + MAX_TOLERANCE)) | ||
883 | ref_div++; | ||
884 | else if (tmp >= (10000 - MAX_TOLERANCE)) | ||
885 | break; | ||
886 | else | ||
887 | ref_div++; | ||
888 | } | ||
889 | } | ||
890 | |||
891 | *dot_clock_p = ((pll->reference_freq * fb_div * 10) + (pll->reference_freq * frac_fb_div)) / | ||
892 | (ref_div * post_div * 10); | ||
893 | *fb_div_p = fb_div; | ||
894 | *frac_fb_div_p = frac_fb_div; | ||
895 | *ref_div_p = ref_div; | ||
896 | *post_div_p = post_div; | ||
897 | DRM_DEBUG_KMS("%d, pll dividers - fb: %d.%d ref: %d, post %d\n", | ||
898 | *dot_clock_p, fb_div, frac_fb_div, ref_div, post_div); | ||
899 | } | ||
900 | |||
901 | /* pre-avivo */ | ||
783 | static inline uint32_t radeon_div(uint64_t n, uint32_t d) | 902 | static inline uint32_t radeon_div(uint64_t n, uint32_t d) |
784 | { | 903 | { |
785 | uint64_t mod; | 904 | uint64_t mod; |
@@ -790,13 +909,13 @@ static inline uint32_t radeon_div(uint64_t n, uint32_t d) | |||
790 | return n; | 909 | return n; |
791 | } | 910 | } |
792 | 911 | ||
793 | void radeon_compute_pll(struct radeon_pll *pll, | 912 | void radeon_compute_pll_legacy(struct radeon_pll *pll, |
794 | uint64_t freq, | 913 | uint64_t freq, |
795 | uint32_t *dot_clock_p, | 914 | uint32_t *dot_clock_p, |
796 | uint32_t *fb_div_p, | 915 | uint32_t *fb_div_p, |
797 | uint32_t *frac_fb_div_p, | 916 | uint32_t *frac_fb_div_p, |
798 | uint32_t *ref_div_p, | 917 | uint32_t *ref_div_p, |
799 | uint32_t *post_div_p) | 918 | uint32_t *post_div_p) |
800 | { | 919 | { |
801 | uint32_t min_ref_div = pll->min_ref_div; | 920 | uint32_t min_ref_div = pll->min_ref_div; |
802 | uint32_t max_ref_div = pll->max_ref_div; | 921 | uint32_t max_ref_div = pll->max_ref_div; |
@@ -826,6 +945,9 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
826 | pll_out_max = pll->pll_out_max; | 945 | pll_out_max = pll->pll_out_max; |
827 | } | 946 | } |
828 | 947 | ||
948 | if (pll_out_min > 64800) | ||
949 | pll_out_min = 64800; | ||
950 | |||
829 | if (pll->flags & RADEON_PLL_USE_REF_DIV) | 951 | if (pll->flags & RADEON_PLL_USE_REF_DIV) |
830 | min_ref_div = max_ref_div = pll->reference_div; | 952 | min_ref_div = max_ref_div = pll->reference_div; |
831 | else { | 953 | else { |
@@ -849,7 +971,7 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
849 | max_fractional_feed_div = pll->max_frac_feedback_div; | 971 | max_fractional_feed_div = pll->max_frac_feedback_div; |
850 | } | 972 | } |
851 | 973 | ||
852 | for (post_div = max_post_div; post_div >= min_post_div; --post_div) { | 974 | for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { |
853 | uint32_t ref_div; | 975 | uint32_t ref_div; |
854 | 976 | ||
855 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) | 977 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) |
@@ -965,6 +1087,10 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
965 | *frac_fb_div_p = best_frac_feedback_div; | 1087 | *frac_fb_div_p = best_frac_feedback_div; |
966 | *ref_div_p = best_ref_div; | 1088 | *ref_div_p = best_ref_div; |
967 | *post_div_p = best_post_div; | 1089 | *post_div_p = best_post_div; |
1090 | DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n", | ||
1091 | freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div, | ||
1092 | best_ref_div, best_post_div); | ||
1093 | |||
968 | } | 1094 | } |
969 | 1095 | ||
970 | static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) | 1096 | static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index d5680a0c87af..275b26a708d6 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -48,7 +48,7 @@ | |||
48 | * - 2.5.0 - add get accel 2 to work around ddx breakage for evergreen | 48 | * - 2.5.0 - add get accel 2 to work around ddx breakage for evergreen |
49 | * - 2.6.0 - add tiling config query (r6xx+), add initial HiZ support (r300->r500) | 49 | * - 2.6.0 - add tiling config query (r6xx+), add initial HiZ support (r300->r500) |
50 | * 2.7.0 - fixups for r600 2D tiling support. (no external ABI change), add eg dyn gpr regs | 50 | * 2.7.0 - fixups for r600 2D tiling support. (no external ABI change), add eg dyn gpr regs |
51 | * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK | 51 | * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK, clock crystal query |
52 | */ | 52 | */ |
53 | #define KMS_DRIVER_MAJOR 2 | 53 | #define KMS_DRIVER_MAJOR 2 |
54 | #define KMS_DRIVER_MINOR 8 | 54 | #define KMS_DRIVER_MINOR 8 |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 448eba89d1e6..5cba46b9779a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
@@ -1524,6 +1524,7 @@ extern u32 radeon_get_scratch(drm_radeon_private_t *dev_priv, int index); | |||
1524 | #define R600_CP_RB_CNTL 0xc104 | 1524 | #define R600_CP_RB_CNTL 0xc104 |
1525 | # define R600_RB_BUFSZ(x) ((x) << 0) | 1525 | # define R600_RB_BUFSZ(x) ((x) << 0) |
1526 | # define R600_RB_BLKSZ(x) ((x) << 8) | 1526 | # define R600_RB_BLKSZ(x) ((x) << 8) |
1527 | # define R600_BUF_SWAP_32BIT (2 << 16) | ||
1527 | # define R600_RB_NO_UPDATE (1 << 27) | 1528 | # define R600_RB_NO_UPDATE (1 << 27) |
1528 | # define R600_RB_RPTR_WR_ENA (1 << 31) | 1529 | # define R600_RB_RPTR_WR_ENA (1 << 31) |
1529 | #define R600_CP_RB_RPTR_WR 0xc108 | 1530 | #define R600_CP_RB_RPTR_WR 0xc108 |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 8fd184286c0b..b4274883227f 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -641,7 +641,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
641 | switch (connector->connector_type) { | 641 | switch (connector->connector_type) { |
642 | case DRM_MODE_CONNECTOR_DVII: | 642 | case DRM_MODE_CONNECTOR_DVII: |
643 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ | 643 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ |
644 | if (drm_detect_monitor_audio(radeon_connector->edid)) { | 644 | if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { |
645 | /* fix me */ | 645 | /* fix me */ |
646 | if (ASIC_IS_DCE4(rdev)) | 646 | if (ASIC_IS_DCE4(rdev)) |
647 | return ATOM_ENCODER_MODE_DVI; | 647 | return ATOM_ENCODER_MODE_DVI; |
@@ -655,7 +655,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
655 | case DRM_MODE_CONNECTOR_DVID: | 655 | case DRM_MODE_CONNECTOR_DVID: |
656 | case DRM_MODE_CONNECTOR_HDMIA: | 656 | case DRM_MODE_CONNECTOR_HDMIA: |
657 | default: | 657 | default: |
658 | if (drm_detect_monitor_audio(radeon_connector->edid)) { | 658 | if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { |
659 | /* fix me */ | 659 | /* fix me */ |
660 | if (ASIC_IS_DCE4(rdev)) | 660 | if (ASIC_IS_DCE4(rdev)) |
661 | return ATOM_ENCODER_MODE_DVI; | 661 | return ATOM_ENCODER_MODE_DVI; |
@@ -673,7 +673,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
673 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | 673 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
674 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | 674 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) |
675 | return ATOM_ENCODER_MODE_DP; | 675 | return ATOM_ENCODER_MODE_DP; |
676 | else if (drm_detect_monitor_audio(radeon_connector->edid)) { | 676 | else if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { |
677 | /* fix me */ | 677 | /* fix me */ |
678 | if (ASIC_IS_DCE4(rdev)) | 678 | if (ASIC_IS_DCE4(rdev)) |
679 | return ATOM_ENCODER_MODE_DVI; | 679 | return ATOM_ENCODER_MODE_DVI; |
@@ -910,7 +910,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
910 | 910 | ||
911 | args.v1.ucAction = action; | 911 | args.v1.ucAction = action; |
912 | if (action == ATOM_TRANSMITTER_ACTION_INIT) { | 912 | if (action == ATOM_TRANSMITTER_ACTION_INIT) { |
913 | args.v1.usInitInfo = connector_object_id; | 913 | args.v1.usInitInfo = cpu_to_le16(connector_object_id); |
914 | } else if (action == ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH) { | 914 | } else if (action == ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH) { |
915 | args.v1.asMode.ucLaneSel = lane_num; | 915 | args.v1.asMode.ucLaneSel = lane_num; |
916 | args.v1.asMode.ucLaneSet = lane_set; | 916 | args.v1.asMode.ucLaneSet = lane_set; |
@@ -1063,7 +1063,7 @@ atombios_set_edp_panel_power(struct drm_connector *connector, int action) | |||
1063 | if (!ASIC_IS_DCE4(rdev)) | 1063 | if (!ASIC_IS_DCE4(rdev)) |
1064 | return; | 1064 | return; |
1065 | 1065 | ||
1066 | if ((action != ATOM_TRANSMITTER_ACTION_POWER_ON) || | 1066 | if ((action != ATOM_TRANSMITTER_ACTION_POWER_ON) && |
1067 | (action != ATOM_TRANSMITTER_ACTION_POWER_OFF)) | 1067 | (action != ATOM_TRANSMITTER_ACTION_POWER_OFF)) |
1068 | return; | 1068 | return; |
1069 | 1069 | ||
@@ -1140,7 +1140,7 @@ atombios_external_encoder_setup(struct drm_encoder *encoder, | |||
1140 | case 3: | 1140 | case 3: |
1141 | args.v3.sExtEncoder.ucAction = action; | 1141 | args.v3.sExtEncoder.ucAction = action; |
1142 | if (action == EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT) | 1142 | if (action == EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT) |
1143 | args.v3.sExtEncoder.usConnectorId = connector_object_id; | 1143 | args.v3.sExtEncoder.usConnectorId = cpu_to_le16(connector_object_id); |
1144 | else | 1144 | else |
1145 | args.v3.sExtEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | 1145 | args.v3.sExtEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); |
1146 | args.v3.sExtEncoder.ucEncoderMode = atombios_get_encoder_mode(encoder); | 1146 | args.v3.sExtEncoder.ucEncoderMode = atombios_get_encoder_mode(encoder); |
@@ -1570,11 +1570,21 @@ atombios_apply_encoder_quirks(struct drm_encoder *encoder, | |||
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | /* set scaler clears this on some chips */ | 1572 | /* set scaler clears this on some chips */ |
1573 | /* XXX check DCE4 */ | 1573 | if (ASIC_IS_AVIVO(rdev) && |
1574 | if (!(radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))) { | 1574 | (!(radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)))) { |
1575 | if (ASIC_IS_AVIVO(rdev) && (mode->flags & DRM_MODE_FLAG_INTERLACE)) | 1575 | if (ASIC_IS_DCE4(rdev)) { |
1576 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, | 1576 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) |
1577 | AVIVO_D1MODE_INTERLEAVE_EN); | 1577 | WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, |
1578 | EVERGREEN_INTERLEAVE_EN); | ||
1579 | else | ||
1580 | WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, 0); | ||
1581 | } else { | ||
1582 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) | ||
1583 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, | ||
1584 | AVIVO_D1MODE_INTERLEAVE_EN); | ||
1585 | else | ||
1586 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, 0); | ||
1587 | } | ||
1578 | } | 1588 | } |
1579 | } | 1589 | } |
1580 | 1590 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index a289646e8aa4..9ec830c77af0 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -110,11 +110,14 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) | |||
110 | 110 | ||
111 | int radeon_irq_kms_init(struct radeon_device *rdev) | 111 | int radeon_irq_kms_init(struct radeon_device *rdev) |
112 | { | 112 | { |
113 | int i; | ||
113 | int r = 0; | 114 | int r = 0; |
114 | 115 | ||
115 | INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); | 116 | INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); |
116 | 117 | ||
117 | spin_lock_init(&rdev->irq.sw_lock); | 118 | spin_lock_init(&rdev->irq.sw_lock); |
119 | for (i = 0; i < rdev->num_crtc; i++) | ||
120 | spin_lock_init(&rdev->irq.pflip_lock[i]); | ||
118 | r = drm_vblank_init(rdev->ddev, rdev->num_crtc); | 121 | r = drm_vblank_init(rdev->ddev, rdev->num_crtc); |
119 | if (r) { | 122 | if (r) { |
120 | return r; | 123 | return r; |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 28a53e4a925f..8387d32caaa7 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -201,6 +201,10 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
201 | } | 201 | } |
202 | radeon_set_filp_rights(dev, &rdev->cmask_filp, filp, &value); | 202 | radeon_set_filp_rights(dev, &rdev->cmask_filp, filp, &value); |
203 | break; | 203 | break; |
204 | case RADEON_INFO_CLOCK_CRYSTAL_FREQ: | ||
205 | /* return clock value in KHz */ | ||
206 | value = rdev->clock.spll.reference_freq * 10; | ||
207 | break; | ||
204 | default: | 208 | default: |
205 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); | 209 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); |
206 | return -EINVAL; | 210 | return -EINVAL; |
@@ -243,6 +247,8 @@ void radeon_driver_preclose_kms(struct drm_device *dev, | |||
243 | struct radeon_device *rdev = dev->dev_private; | 247 | struct radeon_device *rdev = dev->dev_private; |
244 | if (rdev->hyperz_filp == file_priv) | 248 | if (rdev->hyperz_filp == file_priv) |
245 | rdev->hyperz_filp = NULL; | 249 | rdev->hyperz_filp = NULL; |
250 | if (rdev->cmask_filp == file_priv) | ||
251 | rdev->cmask_filp = NULL; | ||
246 | } | 252 | } |
247 | 253 | ||
248 | /* | 254 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index ace2e6384d40..cf0638c3b7c7 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -778,9 +778,9 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
778 | DRM_DEBUG_KMS("\n"); | 778 | DRM_DEBUG_KMS("\n"); |
779 | 779 | ||
780 | if (!use_bios_divs) { | 780 | if (!use_bios_divs) { |
781 | radeon_compute_pll(pll, mode->clock, | 781 | radeon_compute_pll_legacy(pll, mode->clock, |
782 | &freq, &feedback_div, &frac_fb_div, | 782 | &freq, &feedback_div, &frac_fb_div, |
783 | &reference_div, &post_divider); | 783 | &reference_div, &post_divider); |
784 | 784 | ||
785 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { | 785 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { |
786 | if (post_div->divider == post_divider) | 786 | if (post_div->divider == post_divider) |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 12bdeab91c86..a670caaee29e 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -149,6 +149,7 @@ struct radeon_tmds_pll { | |||
149 | #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) | 149 | #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) |
150 | #define RADEON_PLL_USE_POST_DIV (1 << 12) | 150 | #define RADEON_PLL_USE_POST_DIV (1 << 12) |
151 | #define RADEON_PLL_IS_LCD (1 << 13) | 151 | #define RADEON_PLL_IS_LCD (1 << 13) |
152 | #define RADEON_PLL_PREFER_MINM_OVER_MAXP (1 << 14) | ||
152 | 153 | ||
153 | struct radeon_pll { | 154 | struct radeon_pll { |
154 | /* reference frequency */ | 155 | /* reference frequency */ |
@@ -208,6 +209,7 @@ enum radeon_connector_table { | |||
208 | CT_EMAC, | 209 | CT_EMAC, |
209 | CT_RN50_POWER, | 210 | CT_RN50_POWER, |
210 | CT_MAC_X800, | 211 | CT_MAC_X800, |
212 | CT_MAC_G5_9600, | ||
211 | }; | 213 | }; |
212 | 214 | ||
213 | enum radeon_dvo_chip { | 215 | enum radeon_dvo_chip { |
@@ -510,13 +512,21 @@ extern bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, | |||
510 | struct radeon_atom_ss *ss, | 512 | struct radeon_atom_ss *ss, |
511 | int id, u32 clock); | 513 | int id, u32 clock); |
512 | 514 | ||
513 | extern void radeon_compute_pll(struct radeon_pll *pll, | 515 | extern void radeon_compute_pll_legacy(struct radeon_pll *pll, |
514 | uint64_t freq, | 516 | uint64_t freq, |
515 | uint32_t *dot_clock_p, | 517 | uint32_t *dot_clock_p, |
516 | uint32_t *fb_div_p, | 518 | uint32_t *fb_div_p, |
517 | uint32_t *frac_fb_div_p, | 519 | uint32_t *frac_fb_div_p, |
518 | uint32_t *ref_div_p, | 520 | uint32_t *ref_div_p, |
519 | uint32_t *post_div_p); | 521 | uint32_t *post_div_p); |
522 | |||
523 | extern void radeon_compute_pll_avivo(struct radeon_pll *pll, | ||
524 | u32 freq, | ||
525 | u32 *dot_clock_p, | ||
526 | u32 *fb_div_p, | ||
527 | u32 *frac_fb_div_p, | ||
528 | u32 *ref_div_p, | ||
529 | u32 *post_div_p); | ||
520 | 530 | ||
521 | extern void radeon_setup_encoder_clones(struct drm_device *dev); | 531 | extern void radeon_setup_encoder_clones(struct drm_device *dev); |
522 | 532 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 3b1b2bf9cdd5..2aed03bde4b2 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -430,7 +430,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev, | |||
430 | { | 430 | { |
431 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 431 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); |
432 | struct radeon_device *rdev = ddev->dev_private; | 432 | struct radeon_device *rdev = ddev->dev_private; |
433 | u32 temp; | 433 | int temp; |
434 | 434 | ||
435 | switch (rdev->pm.int_thermal_type) { | 435 | switch (rdev->pm.int_thermal_type) { |
436 | case THERMAL_TYPE_RV6XX: | 436 | case THERMAL_TYPE_RV6XX: |
@@ -646,6 +646,9 @@ void radeon_pm_fini(struct radeon_device *rdev) | |||
646 | #endif | 646 | #endif |
647 | } | 647 | } |
648 | 648 | ||
649 | if (rdev->pm.power_state) | ||
650 | kfree(rdev->pm.power_state); | ||
651 | |||
649 | radeon_hwmon_fini(rdev); | 652 | radeon_hwmon_fini(rdev); |
650 | } | 653 | } |
651 | 654 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h index 3cd4dace57c7..ec93a75369e6 100644 --- a/drivers/gpu/drm/radeon/radeon_reg.h +++ b/drivers/gpu/drm/radeon/radeon_reg.h | |||
@@ -375,6 +375,8 @@ | |||
375 | #define RADEON_CONFIG_APER_SIZE 0x0108 | 375 | #define RADEON_CONFIG_APER_SIZE 0x0108 |
376 | #define RADEON_CONFIG_BONDS 0x00e8 | 376 | #define RADEON_CONFIG_BONDS 0x00e8 |
377 | #define RADEON_CONFIG_CNTL 0x00e0 | 377 | #define RADEON_CONFIG_CNTL 0x00e0 |
378 | # define RADEON_CFG_VGA_RAM_EN (1 << 8) | ||
379 | # define RADEON_CFG_VGA_IO_DIS (1 << 9) | ||
378 | # define RADEON_CFG_ATI_REV_A11 (0 << 16) | 380 | # define RADEON_CFG_ATI_REV_A11 (0 << 16) |
379 | # define RADEON_CFG_ATI_REV_A12 (1 << 16) | 381 | # define RADEON_CFG_ATI_REV_A12 (1 << 16) |
380 | # define RADEON_CFG_ATI_REV_A13 (2 << 16) | 382 | # define RADEON_CFG_ATI_REV_A13 (2 << 16) |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 1272e4b6a1d4..e5b2cf10cbf4 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -787,9 +787,9 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev) | |||
787 | radeon_mem_types_list[i].show = &radeon_mm_dump_table; | 787 | radeon_mem_types_list[i].show = &radeon_mm_dump_table; |
788 | radeon_mem_types_list[i].driver_features = 0; | 788 | radeon_mem_types_list[i].driver_features = 0; |
789 | if (i == 0) | 789 | if (i == 0) |
790 | radeon_mem_types_list[i].data = &rdev->mman.bdev.man[TTM_PL_VRAM].priv; | 790 | radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_VRAM].priv; |
791 | else | 791 | else |
792 | radeon_mem_types_list[i].data = &rdev->mman.bdev.man[TTM_PL_TT].priv; | 792 | radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_TT].priv; |
793 | 793 | ||
794 | } | 794 | } |
795 | /* Add ttm page pool to debugfs */ | 795 | /* Add ttm page pool to debugfs */ |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r300 b/drivers/gpu/drm/radeon/reg_srcs/r300 index b506ec1cab4b..e8a1786b6426 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/r300 +++ b/drivers/gpu/drm/radeon/reg_srcs/r300 | |||
@@ -683,9 +683,7 @@ r300 0x4f60 | |||
683 | 0x4DF4 US_ALU_CONST_G_31 | 683 | 0x4DF4 US_ALU_CONST_G_31 |
684 | 0x4DF8 US_ALU_CONST_B_31 | 684 | 0x4DF8 US_ALU_CONST_B_31 |
685 | 0x4DFC US_ALU_CONST_A_31 | 685 | 0x4DFC US_ALU_CONST_A_31 |
686 | 0x4E04 RB3D_BLENDCNTL_R3 | ||
687 | 0x4E08 RB3D_ABLENDCNTL_R3 | 686 | 0x4E08 RB3D_ABLENDCNTL_R3 |
688 | 0x4E0C RB3D_COLOR_CHANNEL_MASK | ||
689 | 0x4E10 RB3D_CONSTANT_COLOR | 687 | 0x4E10 RB3D_CONSTANT_COLOR |
690 | 0x4E14 RB3D_COLOR_CLEAR_VALUE | 688 | 0x4E14 RB3D_COLOR_CLEAR_VALUE |
691 | 0x4E18 RB3D_ROPCNTL_R3 | 689 | 0x4E18 RB3D_ROPCNTL_R3 |
@@ -706,13 +704,11 @@ r300 0x4f60 | |||
706 | 0x4E74 RB3D_CMASK_WRINDEX | 704 | 0x4E74 RB3D_CMASK_WRINDEX |
707 | 0x4E78 RB3D_CMASK_DWORD | 705 | 0x4E78 RB3D_CMASK_DWORD |
708 | 0x4E7C RB3D_CMASK_RDINDEX | 706 | 0x4E7C RB3D_CMASK_RDINDEX |
709 | 0x4E80 RB3D_AARESOLVE_OFFSET | ||
710 | 0x4E84 RB3D_AARESOLVE_PITCH | ||
711 | 0x4E88 RB3D_AARESOLVE_CTL | ||
712 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD | 707 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD |
713 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD | 708 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD |
714 | 0x4F04 ZB_ZSTENCILCNTL | 709 | 0x4F04 ZB_ZSTENCILCNTL |
715 | 0x4F08 ZB_STENCILREFMASK | 710 | 0x4F08 ZB_STENCILREFMASK |
716 | 0x4F14 ZB_ZTOP | 711 | 0x4F14 ZB_ZTOP |
717 | 0x4F18 ZB_ZCACHE_CTLSTAT | 712 | 0x4F18 ZB_ZCACHE_CTLSTAT |
713 | 0x4F28 ZB_DEPTHCLEARVALUE | ||
718 | 0x4F58 ZB_ZPASS_DATA | 714 | 0x4F58 ZB_ZPASS_DATA |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r420 b/drivers/gpu/drm/radeon/reg_srcs/r420 index 8c1214c2390f..722074e21e2f 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/r420 +++ b/drivers/gpu/drm/radeon/reg_srcs/r420 | |||
@@ -130,7 +130,6 @@ r420 0x4f60 | |||
130 | 0x401C GB_SELECT | 130 | 0x401C GB_SELECT |
131 | 0x4020 GB_AA_CONFIG | 131 | 0x4020 GB_AA_CONFIG |
132 | 0x4024 GB_FIFO_SIZE | 132 | 0x4024 GB_FIFO_SIZE |
133 | 0x4028 GB_Z_PEQ_CONFIG | ||
134 | 0x4100 TX_INVALTAGS | 133 | 0x4100 TX_INVALTAGS |
135 | 0x4200 GA_POINT_S0 | 134 | 0x4200 GA_POINT_S0 |
136 | 0x4204 GA_POINT_T0 | 135 | 0x4204 GA_POINT_T0 |
@@ -750,9 +749,7 @@ r420 0x4f60 | |||
750 | 0x4DF4 US_ALU_CONST_G_31 | 749 | 0x4DF4 US_ALU_CONST_G_31 |
751 | 0x4DF8 US_ALU_CONST_B_31 | 750 | 0x4DF8 US_ALU_CONST_B_31 |
752 | 0x4DFC US_ALU_CONST_A_31 | 751 | 0x4DFC US_ALU_CONST_A_31 |
753 | 0x4E04 RB3D_BLENDCNTL_R3 | ||
754 | 0x4E08 RB3D_ABLENDCNTL_R3 | 752 | 0x4E08 RB3D_ABLENDCNTL_R3 |
755 | 0x4E0C RB3D_COLOR_CHANNEL_MASK | ||
756 | 0x4E10 RB3D_CONSTANT_COLOR | 753 | 0x4E10 RB3D_CONSTANT_COLOR |
757 | 0x4E14 RB3D_COLOR_CLEAR_VALUE | 754 | 0x4E14 RB3D_COLOR_CLEAR_VALUE |
758 | 0x4E18 RB3D_ROPCNTL_R3 | 755 | 0x4E18 RB3D_ROPCNTL_R3 |
@@ -773,13 +770,11 @@ r420 0x4f60 | |||
773 | 0x4E74 RB3D_CMASK_WRINDEX | 770 | 0x4E74 RB3D_CMASK_WRINDEX |
774 | 0x4E78 RB3D_CMASK_DWORD | 771 | 0x4E78 RB3D_CMASK_DWORD |
775 | 0x4E7C RB3D_CMASK_RDINDEX | 772 | 0x4E7C RB3D_CMASK_RDINDEX |
776 | 0x4E80 RB3D_AARESOLVE_OFFSET | ||
777 | 0x4E84 RB3D_AARESOLVE_PITCH | ||
778 | 0x4E88 RB3D_AARESOLVE_CTL | ||
779 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD | 773 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD |
780 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD | 774 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD |
781 | 0x4F04 ZB_ZSTENCILCNTL | 775 | 0x4F04 ZB_ZSTENCILCNTL |
782 | 0x4F08 ZB_STENCILREFMASK | 776 | 0x4F08 ZB_STENCILREFMASK |
783 | 0x4F14 ZB_ZTOP | 777 | 0x4F14 ZB_ZTOP |
784 | 0x4F18 ZB_ZCACHE_CTLSTAT | 778 | 0x4F18 ZB_ZCACHE_CTLSTAT |
779 | 0x4F28 ZB_DEPTHCLEARVALUE | ||
785 | 0x4F58 ZB_ZPASS_DATA | 780 | 0x4F58 ZB_ZPASS_DATA |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rs600 b/drivers/gpu/drm/radeon/reg_srcs/rs600 index 0828d80396f2..d9f62866bbc1 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rs600 +++ b/drivers/gpu/drm/radeon/reg_srcs/rs600 | |||
@@ -749,9 +749,7 @@ rs600 0x6d40 | |||
749 | 0x4DF4 US_ALU_CONST_G_31 | 749 | 0x4DF4 US_ALU_CONST_G_31 |
750 | 0x4DF8 US_ALU_CONST_B_31 | 750 | 0x4DF8 US_ALU_CONST_B_31 |
751 | 0x4DFC US_ALU_CONST_A_31 | 751 | 0x4DFC US_ALU_CONST_A_31 |
752 | 0x4E04 RB3D_BLENDCNTL_R3 | ||
753 | 0x4E08 RB3D_ABLENDCNTL_R3 | 752 | 0x4E08 RB3D_ABLENDCNTL_R3 |
754 | 0x4E0C RB3D_COLOR_CHANNEL_MASK | ||
755 | 0x4E10 RB3D_CONSTANT_COLOR | 753 | 0x4E10 RB3D_CONSTANT_COLOR |
756 | 0x4E14 RB3D_COLOR_CLEAR_VALUE | 754 | 0x4E14 RB3D_COLOR_CLEAR_VALUE |
757 | 0x4E18 RB3D_ROPCNTL_R3 | 755 | 0x4E18 RB3D_ROPCNTL_R3 |
@@ -772,13 +770,11 @@ rs600 0x6d40 | |||
772 | 0x4E74 RB3D_CMASK_WRINDEX | 770 | 0x4E74 RB3D_CMASK_WRINDEX |
773 | 0x4E78 RB3D_CMASK_DWORD | 771 | 0x4E78 RB3D_CMASK_DWORD |
774 | 0x4E7C RB3D_CMASK_RDINDEX | 772 | 0x4E7C RB3D_CMASK_RDINDEX |
775 | 0x4E80 RB3D_AARESOLVE_OFFSET | ||
776 | 0x4E84 RB3D_AARESOLVE_PITCH | ||
777 | 0x4E88 RB3D_AARESOLVE_CTL | ||
778 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD | 773 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD |
779 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD | 774 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD |
780 | 0x4F04 ZB_ZSTENCILCNTL | 775 | 0x4F04 ZB_ZSTENCILCNTL |
781 | 0x4F08 ZB_STENCILREFMASK | 776 | 0x4F08 ZB_STENCILREFMASK |
782 | 0x4F14 ZB_ZTOP | 777 | 0x4F14 ZB_ZTOP |
783 | 0x4F18 ZB_ZCACHE_CTLSTAT | 778 | 0x4F18 ZB_ZCACHE_CTLSTAT |
779 | 0x4F28 ZB_DEPTHCLEARVALUE | ||
784 | 0x4F58 ZB_ZPASS_DATA | 780 | 0x4F58 ZB_ZPASS_DATA |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 b/drivers/gpu/drm/radeon/reg_srcs/rv515 index ef422bbacfc1..911a8fbd32bb 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rv515 +++ b/drivers/gpu/drm/radeon/reg_srcs/rv515 | |||
@@ -164,7 +164,6 @@ rv515 0x6d40 | |||
164 | 0x401C GB_SELECT | 164 | 0x401C GB_SELECT |
165 | 0x4020 GB_AA_CONFIG | 165 | 0x4020 GB_AA_CONFIG |
166 | 0x4024 GB_FIFO_SIZE | 166 | 0x4024 GB_FIFO_SIZE |
167 | 0x4028 GB_Z_PEQ_CONFIG | ||
168 | 0x4100 TX_INVALTAGS | 167 | 0x4100 TX_INVALTAGS |
169 | 0x4114 SU_TEX_WRAP_PS3 | 168 | 0x4114 SU_TEX_WRAP_PS3 |
170 | 0x4118 PS3_ENABLE | 169 | 0x4118 PS3_ENABLE |
@@ -461,9 +460,7 @@ rv515 0x6d40 | |||
461 | 0x4DF4 US_ALU_CONST_G_31 | 460 | 0x4DF4 US_ALU_CONST_G_31 |
462 | 0x4DF8 US_ALU_CONST_B_31 | 461 | 0x4DF8 US_ALU_CONST_B_31 |
463 | 0x4DFC US_ALU_CONST_A_31 | 462 | 0x4DFC US_ALU_CONST_A_31 |
464 | 0x4E04 RB3D_BLENDCNTL_R3 | ||
465 | 0x4E08 RB3D_ABLENDCNTL_R3 | 463 | 0x4E08 RB3D_ABLENDCNTL_R3 |
466 | 0x4E0C RB3D_COLOR_CHANNEL_MASK | ||
467 | 0x4E10 RB3D_CONSTANT_COLOR | 464 | 0x4E10 RB3D_CONSTANT_COLOR |
468 | 0x4E14 RB3D_COLOR_CLEAR_VALUE | 465 | 0x4E14 RB3D_COLOR_CLEAR_VALUE |
469 | 0x4E18 RB3D_ROPCNTL_R3 | 466 | 0x4E18 RB3D_ROPCNTL_R3 |
@@ -484,9 +481,6 @@ rv515 0x6d40 | |||
484 | 0x4E74 RB3D_CMASK_WRINDEX | 481 | 0x4E74 RB3D_CMASK_WRINDEX |
485 | 0x4E78 RB3D_CMASK_DWORD | 482 | 0x4E78 RB3D_CMASK_DWORD |
486 | 0x4E7C RB3D_CMASK_RDINDEX | 483 | 0x4E7C RB3D_CMASK_RDINDEX |
487 | 0x4E80 RB3D_AARESOLVE_OFFSET | ||
488 | 0x4E84 RB3D_AARESOLVE_PITCH | ||
489 | 0x4E88 RB3D_AARESOLVE_CTL | ||
490 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD | 484 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD |
491 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD | 485 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD |
492 | 0x4EF8 RB3D_CONSTANT_COLOR_AR | 486 | 0x4EF8 RB3D_CONSTANT_COLOR_AR |
@@ -496,4 +490,5 @@ rv515 0x6d40 | |||
496 | 0x4F14 ZB_ZTOP | 490 | 0x4F14 ZB_ZTOP |
497 | 0x4F18 ZB_ZCACHE_CTLSTAT | 491 | 0x4F18 ZB_ZCACHE_CTLSTAT |
498 | 0x4F58 ZB_ZPASS_DATA | 492 | 0x4F58 ZB_ZPASS_DATA |
493 | 0x4F28 ZB_DEPTHCLEARVALUE | ||
499 | 0x4FD4 ZB_STENCILREFMASK_BF | 494 | 0x4FD4 ZB_STENCILREFMASK_BF |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 5512e4e5e636..c76283d9eb3d 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -203,6 +203,9 @@ void rs400_gart_fini(struct radeon_device *rdev) | |||
203 | radeon_gart_table_ram_free(rdev); | 203 | radeon_gart_table_ram_free(rdev); |
204 | } | 204 | } |
205 | 205 | ||
206 | #define RS400_PTE_WRITEABLE (1 << 2) | ||
207 | #define RS400_PTE_READABLE (1 << 3) | ||
208 | |||
206 | int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | 209 | int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) |
207 | { | 210 | { |
208 | uint32_t entry; | 211 | uint32_t entry; |
@@ -213,7 +216,7 @@ int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | |||
213 | 216 | ||
214 | entry = (lower_32_bits(addr) & PAGE_MASK) | | 217 | entry = (lower_32_bits(addr) & PAGE_MASK) | |
215 | ((upper_32_bits(addr) & 0xff) << 4) | | 218 | ((upper_32_bits(addr) & 0xff) << 4) | |
216 | 0xc; | 219 | RS400_PTE_WRITEABLE | RS400_PTE_READABLE; |
217 | entry = cpu_to_le32(entry); | 220 | entry = cpu_to_le32(entry); |
218 | rdev->gart.table.ram.ptr[i] = entry; | 221 | rdev->gart.table.ram.ptr[i] = entry; |
219 | return 0; | 222 | return 0; |
@@ -226,8 +229,8 @@ int rs400_mc_wait_for_idle(struct radeon_device *rdev) | |||
226 | 229 | ||
227 | for (i = 0; i < rdev->usec_timeout; i++) { | 230 | for (i = 0; i < rdev->usec_timeout; i++) { |
228 | /* read MC_STATUS */ | 231 | /* read MC_STATUS */ |
229 | tmp = RREG32(0x0150); | 232 | tmp = RREG32(RADEON_MC_STATUS); |
230 | if (tmp & (1 << 2)) { | 233 | if (tmp & RADEON_MC_IDLE) { |
231 | return 0; | 234 | return 0; |
232 | } | 235 | } |
233 | DRM_UDELAY(1); | 236 | DRM_UDELAY(1); |
@@ -241,7 +244,7 @@ void rs400_gpu_init(struct radeon_device *rdev) | |||
241 | r420_pipes_init(rdev); | 244 | r420_pipes_init(rdev); |
242 | if (rs400_mc_wait_for_idle(rdev)) { | 245 | if (rs400_mc_wait_for_idle(rdev)) { |
243 | printk(KERN_WARNING "rs400: Failed to wait MC idle while " | 246 | printk(KERN_WARNING "rs400: Failed to wait MC idle while " |
244 | "programming pipes. Bad things might happen. %08x\n", RREG32(0x150)); | 247 | "programming pipes. Bad things might happen. %08x\n", RREG32(RADEON_MC_STATUS)); |
245 | } | 248 | } |
246 | } | 249 | } |
247 | 250 | ||
@@ -300,9 +303,9 @@ static int rs400_debugfs_gart_info(struct seq_file *m, void *data) | |||
300 | seq_printf(m, "MCCFG_AGP_BASE_2 0x%08x\n", tmp); | 303 | seq_printf(m, "MCCFG_AGP_BASE_2 0x%08x\n", tmp); |
301 | tmp = RREG32_MC(RS690_MCCFG_AGP_LOCATION); | 304 | tmp = RREG32_MC(RS690_MCCFG_AGP_LOCATION); |
302 | seq_printf(m, "MCCFG_AGP_LOCATION 0x%08x\n", tmp); | 305 | seq_printf(m, "MCCFG_AGP_LOCATION 0x%08x\n", tmp); |
303 | tmp = RREG32_MC(0x100); | 306 | tmp = RREG32_MC(RS690_MCCFG_FB_LOCATION); |
304 | seq_printf(m, "MCCFG_FB_LOCATION 0x%08x\n", tmp); | 307 | seq_printf(m, "MCCFG_FB_LOCATION 0x%08x\n", tmp); |
305 | tmp = RREG32(0x134); | 308 | tmp = RREG32(RS690_HDP_FB_LOCATION); |
306 | seq_printf(m, "HDP_FB_LOCATION 0x%08x\n", tmp); | 309 | seq_printf(m, "HDP_FB_LOCATION 0x%08x\n", tmp); |
307 | } else { | 310 | } else { |
308 | tmp = RREG32(RADEON_AGP_BASE); | 311 | tmp = RREG32(RADEON_AGP_BASE); |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 0137d3e3728d..6638c8e4c81b 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -77,9 +77,9 @@ void rs690_pm_info(struct radeon_device *rdev) | |||
77 | switch (crev) { | 77 | switch (crev) { |
78 | case 1: | 78 | case 1: |
79 | tmp.full = dfixed_const(100); | 79 | tmp.full = dfixed_const(100); |
80 | rdev->pm.igp_sideport_mclk.full = dfixed_const(info->info.ulBootUpMemoryClock); | 80 | rdev->pm.igp_sideport_mclk.full = dfixed_const(le32_to_cpu(info->info.ulBootUpMemoryClock)); |
81 | rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); | 81 | rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); |
82 | if (info->info.usK8MemoryClock) | 82 | if (le16_to_cpu(info->info.usK8MemoryClock)) |
83 | rdev->pm.igp_system_mclk.full = dfixed_const(le16_to_cpu(info->info.usK8MemoryClock)); | 83 | rdev->pm.igp_system_mclk.full = dfixed_const(le16_to_cpu(info->info.usK8MemoryClock)); |
84 | else if (rdev->clock.default_mclk) { | 84 | else if (rdev->clock.default_mclk) { |
85 | rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk); | 85 | rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk); |
@@ -91,16 +91,16 @@ void rs690_pm_info(struct radeon_device *rdev) | |||
91 | break; | 91 | break; |
92 | case 2: | 92 | case 2: |
93 | tmp.full = dfixed_const(100); | 93 | tmp.full = dfixed_const(100); |
94 | rdev->pm.igp_sideport_mclk.full = dfixed_const(info->info_v2.ulBootUpSidePortClock); | 94 | rdev->pm.igp_sideport_mclk.full = dfixed_const(le32_to_cpu(info->info_v2.ulBootUpSidePortClock)); |
95 | rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); | 95 | rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); |
96 | if (info->info_v2.ulBootUpUMAClock) | 96 | if (le32_to_cpu(info->info_v2.ulBootUpUMAClock)) |
97 | rdev->pm.igp_system_mclk.full = dfixed_const(info->info_v2.ulBootUpUMAClock); | 97 | rdev->pm.igp_system_mclk.full = dfixed_const(le32_to_cpu(info->info_v2.ulBootUpUMAClock)); |
98 | else if (rdev->clock.default_mclk) | 98 | else if (rdev->clock.default_mclk) |
99 | rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk); | 99 | rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk); |
100 | else | 100 | else |
101 | rdev->pm.igp_system_mclk.full = dfixed_const(66700); | 101 | rdev->pm.igp_system_mclk.full = dfixed_const(66700); |
102 | rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp); | 102 | rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp); |
103 | rdev->pm.igp_ht_link_clk.full = dfixed_const(info->info_v2.ulHTLinkFreq); | 103 | rdev->pm.igp_ht_link_clk.full = dfixed_const(le32_to_cpu(info->info_v2.ulHTLinkFreq)); |
104 | rdev->pm.igp_ht_link_clk.full = dfixed_div(rdev->pm.igp_ht_link_clk, tmp); | 104 | rdev->pm.igp_ht_link_clk.full = dfixed_div(rdev->pm.igp_ht_link_clk, tmp); |
105 | rdev->pm.igp_ht_link_width.full = dfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth)); | 105 | rdev->pm.igp_ht_link_width.full = dfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth)); |
106 | break; | 106 | break; |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 5d569f41f4ae..64b57af93714 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -69,13 +69,13 @@ void rv515_ring_start(struct radeon_device *rdev) | |||
69 | ISYNC_CPSCRATCH_IDLEGUI); | 69 | ISYNC_CPSCRATCH_IDLEGUI); |
70 | radeon_ring_write(rdev, PACKET0(WAIT_UNTIL, 0)); | 70 | radeon_ring_write(rdev, PACKET0(WAIT_UNTIL, 0)); |
71 | radeon_ring_write(rdev, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN); | 71 | radeon_ring_write(rdev, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN); |
72 | radeon_ring_write(rdev, PACKET0(0x170C, 0)); | 72 | radeon_ring_write(rdev, PACKET0(R300_DST_PIPE_CONFIG, 0)); |
73 | radeon_ring_write(rdev, 1 << 31); | 73 | radeon_ring_write(rdev, R300_PIPE_AUTO_CONFIG); |
74 | radeon_ring_write(rdev, PACKET0(GB_SELECT, 0)); | 74 | radeon_ring_write(rdev, PACKET0(GB_SELECT, 0)); |
75 | radeon_ring_write(rdev, 0); | 75 | radeon_ring_write(rdev, 0); |
76 | radeon_ring_write(rdev, PACKET0(GB_ENABLE, 0)); | 76 | radeon_ring_write(rdev, PACKET0(GB_ENABLE, 0)); |
77 | radeon_ring_write(rdev, 0); | 77 | radeon_ring_write(rdev, 0); |
78 | radeon_ring_write(rdev, PACKET0(0x42C8, 0)); | 78 | radeon_ring_write(rdev, PACKET0(R500_SU_REG_DEST, 0)); |
79 | radeon_ring_write(rdev, (1 << rdev->num_gb_pipes) - 1); | 79 | radeon_ring_write(rdev, (1 << rdev->num_gb_pipes) - 1); |
80 | radeon_ring_write(rdev, PACKET0(VAP_INDEX_OFFSET, 0)); | 80 | radeon_ring_write(rdev, PACKET0(VAP_INDEX_OFFSET, 0)); |
81 | radeon_ring_write(rdev, 0); | 81 | radeon_ring_write(rdev, 0); |
@@ -153,8 +153,8 @@ void rv515_gpu_init(struct radeon_device *rdev) | |||
153 | } | 153 | } |
154 | rv515_vga_render_disable(rdev); | 154 | rv515_vga_render_disable(rdev); |
155 | r420_pipes_init(rdev); | 155 | r420_pipes_init(rdev); |
156 | gb_pipe_select = RREG32(0x402C); | 156 | gb_pipe_select = RREG32(R400_GB_PIPE_SELECT); |
157 | tmp = RREG32(0x170C); | 157 | tmp = RREG32(R300_DST_PIPE_CONFIG); |
158 | pipe_select_current = (tmp >> 2) & 3; | 158 | pipe_select_current = (tmp >> 2) & 3; |
159 | tmp = (1 << pipe_select_current) | | 159 | tmp = (1 << pipe_select_current) | |
160 | (((gb_pipe_select >> 8) & 0xF) << 4); | 160 | (((gb_pipe_select >> 8) & 0xF) << 4); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 491dc9000655..d8ba67690656 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -78,18 +78,23 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* get temperature in millidegrees */ | 80 | /* get temperature in millidegrees */ |
81 | u32 rv770_get_temp(struct radeon_device *rdev) | 81 | int rv770_get_temp(struct radeon_device *rdev) |
82 | { | 82 | { |
83 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 83 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
84 | ASIC_T_SHIFT; | 84 | ASIC_T_SHIFT; |
85 | u32 actual_temp = 0; | 85 | int actual_temp; |
86 | 86 | ||
87 | if ((temp >> 9) & 1) | 87 | if (temp & 0x400) |
88 | actual_temp = 0; | 88 | actual_temp = -256; |
89 | else | 89 | else if (temp & 0x200) |
90 | actual_temp = (temp >> 1) & 0xff; | 90 | actual_temp = 255; |
91 | 91 | else if (temp & 0x100) { | |
92 | return actual_temp * 1000; | 92 | actual_temp = temp & 0x1ff; |
93 | actual_temp |= ~0x1ff; | ||
94 | } else | ||
95 | actual_temp = temp & 0xff; | ||
96 | |||
97 | return (actual_temp * 1000) / 2; | ||
93 | } | 98 | } |
94 | 99 | ||
95 | void rv770_pm_misc(struct radeon_device *rdev) | 100 | void rv770_pm_misc(struct radeon_device *rdev) |
@@ -316,7 +321,11 @@ static int rv770_cp_load_microcode(struct radeon_device *rdev) | |||
316 | return -EINVAL; | 321 | return -EINVAL; |
317 | 322 | ||
318 | r700_cp_stop(rdev); | 323 | r700_cp_stop(rdev); |
319 | WREG32(CP_RB_CNTL, RB_NO_UPDATE | (15 << 8) | (3 << 0)); | 324 | WREG32(CP_RB_CNTL, |
325 | #ifdef __BIG_ENDIAN | ||
326 | BUF_SWAP_32BIT | | ||
327 | #endif | ||
328 | RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3)); | ||
320 | 329 | ||
321 | /* Reset cp */ | 330 | /* Reset cp */ |
322 | WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP); | 331 | WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP); |
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h index abc8cf5a3672..79fa588e9ed5 100644 --- a/drivers/gpu/drm/radeon/rv770d.h +++ b/drivers/gpu/drm/radeon/rv770d.h | |||
@@ -76,10 +76,10 @@ | |||
76 | #define ROQ_IB1_START(x) ((x) << 0) | 76 | #define ROQ_IB1_START(x) ((x) << 0) |
77 | #define ROQ_IB2_START(x) ((x) << 8) | 77 | #define ROQ_IB2_START(x) ((x) << 8) |
78 | #define CP_RB_CNTL 0xC104 | 78 | #define CP_RB_CNTL 0xC104 |
79 | #define RB_BUFSZ(x) ((x)<<0) | 79 | #define RB_BUFSZ(x) ((x) << 0) |
80 | #define RB_BLKSZ(x) ((x)<<8) | 80 | #define RB_BLKSZ(x) ((x) << 8) |
81 | #define RB_NO_UPDATE (1<<27) | 81 | #define RB_NO_UPDATE (1 << 27) |
82 | #define RB_RPTR_WR_ENA (1<<31) | 82 | #define RB_RPTR_WR_ENA (1 << 31) |
83 | #define BUF_SWAP_32BIT (2 << 16) | 83 | #define BUF_SWAP_32BIT (2 << 16) |
84 | #define CP_RB_RPTR 0x8700 | 84 | #define CP_RB_RPTR 0x8700 |
85 | #define CP_RB_RPTR_ADDR 0xC10C | 85 | #define CP_RB_RPTR_ADDR 0xC10C |
diff --git a/drivers/gpu/stub/Kconfig b/drivers/gpu/stub/Kconfig index 09aea5f1556d..70e60a4bb678 100644 --- a/drivers/gpu/stub/Kconfig +++ b/drivers/gpu/stub/Kconfig | |||
@@ -1,11 +1,13 @@ | |||
1 | config STUB_POULSBO | 1 | config STUB_POULSBO |
2 | tristate "Intel GMA500 Stub Driver" | 2 | tristate "Intel GMA500 Stub Driver" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on NET # for THERMAL | ||
4 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled | 5 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled |
5 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 6 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
6 | select BACKLIGHT_CLASS_DEVICE if ACPI | 7 | select BACKLIGHT_CLASS_DEVICE if ACPI |
7 | select INPUT if ACPI | 8 | select INPUT if ACPI |
8 | select ACPI_VIDEO if ACPI | 9 | select ACPI_VIDEO if ACPI |
10 | select THERMAL if ACPI | ||
9 | help | 11 | help |
10 | Choose this option if you have a system that has Intel GMA500 | 12 | Choose this option if you have a system that has Intel GMA500 |
11 | (Poulsbo) integrated graphics. If M is selected, the module will | 13 | (Poulsbo) integrated graphics. If M is selected, the module will |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index c380c65da417..ace2b1623b21 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -636,7 +636,7 @@ int vga_client_register(struct pci_dev *pdev, void *cookie, | |||
636 | void (*irq_set_state)(void *cookie, bool state), | 636 | void (*irq_set_state)(void *cookie, bool state), |
637 | unsigned int (*set_vga_decode)(void *cookie, bool decode)) | 637 | unsigned int (*set_vga_decode)(void *cookie, bool decode)) |
638 | { | 638 | { |
639 | int ret = -1; | 639 | int ret = -ENODEV; |
640 | struct vga_device *vgadev; | 640 | struct vga_device *vgadev; |
641 | unsigned long flags; | 641 | unsigned long flags; |
642 | 642 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index ce0372f0615e..4c0743660e9c 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -1072,6 +1072,7 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num) | |||
1072 | node->sda.dev_attr.show = grp->show; | 1072 | node->sda.dev_attr.show = grp->show; |
1073 | node->sda.dev_attr.store = grp->store; | 1073 | node->sda.dev_attr.store = grp->store; |
1074 | attr = &node->sda.dev_attr.attr; | 1074 | attr = &node->sda.dev_attr.attr; |
1075 | sysfs_attr_init(attr); | ||
1075 | attr->name = node->name; | 1076 | attr->name = node->name; |
1076 | attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); | 1077 | attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); |
1077 | ret = sysfs_create_file(&pdev->dev.kobj, attr); | 1078 | ret = sysfs_create_file(&pdev->dev.kobj, attr); |
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index 2d68cf3c223b..b5e892017e0c 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/dmi.h> | ||
16 | 17 | ||
17 | #include <acpi/acpi.h> | 18 | #include <acpi/acpi.h> |
18 | #include <acpi/acpixf.h> | 19 | #include <acpi/acpixf.h> |
@@ -22,6 +23,21 @@ | |||
22 | 23 | ||
23 | #define ATK_HID "ATK0110" | 24 | #define ATK_HID "ATK0110" |
24 | 25 | ||
26 | static bool new_if; | ||
27 | module_param(new_if, bool, 0); | ||
28 | MODULE_PARM_DESC(new_if, "Override detection heuristic and force the use of the new ATK0110 interface"); | ||
29 | |||
30 | static const struct dmi_system_id __initconst atk_force_new_if[] = { | ||
31 | { | ||
32 | /* Old interface has broken MCH temp monitoring */ | ||
33 | .ident = "Asus Sabertooth X58", | ||
34 | .matches = { | ||
35 | DMI_MATCH(DMI_BOARD_NAME, "SABERTOOTH X58") | ||
36 | } | ||
37 | }, | ||
38 | { } | ||
39 | }; | ||
40 | |||
25 | /* Minimum time between readings, enforced in order to avoid | 41 | /* Minimum time between readings, enforced in order to avoid |
26 | * hogging the CPU. | 42 | * hogging the CPU. |
27 | */ | 43 | */ |
@@ -1302,7 +1318,9 @@ static int atk_probe_if(struct atk_data *data) | |||
1302 | * analysis of multiple DSDTs indicates that when both interfaces | 1318 | * analysis of multiple DSDTs indicates that when both interfaces |
1303 | * are present the new one (GGRP/GITM) is not functional. | 1319 | * are present the new one (GGRP/GITM) is not functional. |
1304 | */ | 1320 | */ |
1305 | if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle) | 1321 | if (new_if) |
1322 | dev_info(dev, "Overriding interface detection\n"); | ||
1323 | if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle && !new_if) | ||
1306 | data->old_interface = true; | 1324 | data->old_interface = true; |
1307 | else if (data->enumerate_handle && data->read_handle && | 1325 | else if (data->enumerate_handle && data->read_handle && |
1308 | data->write_handle) | 1326 | data->write_handle) |
@@ -1420,6 +1438,9 @@ static int __init atk0110_init(void) | |||
1420 | return -EBUSY; | 1438 | return -EBUSY; |
1421 | } | 1439 | } |
1422 | 1440 | ||
1441 | if (dmi_check_system(atk_force_new_if)) | ||
1442 | new_if = true; | ||
1443 | |||
1423 | ret = acpi_bus_register_driver(&atk_driver); | 1444 | ret = acpi_bus_register_driver(&atk_driver); |
1424 | if (ret) | 1445 | if (ret) |
1425 | pr_info("acpi_bus_register_driver failed: %d\n", ret); | 1446 | pr_info("acpi_bus_register_driver failed: %d\n", ret); |
diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c index 5dea9faa1656..cd2a6e437aec 100644 --- a/drivers/hwmon/emc1403.c +++ b/drivers/hwmon/emc1403.c | |||
@@ -344,7 +344,7 @@ static int emc1403_remove(struct i2c_client *client) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | static const unsigned short emc1403_address_list[] = { | 346 | static const unsigned short emc1403_address_list[] = { |
347 | 0x18, 0x2a, 0x4c, 0x4d, I2C_CLIENT_END | 347 | 0x18, 0x29, 0x4c, 0x4d, I2C_CLIENT_END |
348 | }; | 348 | }; |
349 | 349 | ||
350 | static const struct i2c_device_id emc1403_idtable[] = { | 350 | static const struct i2c_device_id emc1403_idtable[] = { |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 1b674b7d4584..d805e8e57967 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -957,7 +957,7 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) | |||
957 | 957 | ||
958 | /* bail if we did not get an IRQ from the bus layer */ | 958 | /* bail if we did not get an IRQ from the bus layer */ |
959 | if (!dev->irq) { | 959 | if (!dev->irq) { |
960 | pr_err("No IRQ. Disabling /dev/freefall\n"); | 960 | pr_debug("No IRQ. Disabling /dev/freefall\n"); |
961 | goto out; | 961 | goto out; |
962 | } | 962 | } |
963 | 963 | ||
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 776aeb3019d2..508cb291f71b 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -98,6 +98,9 @@ static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END }; | |||
98 | * value, it uses signed 8-bit values with LSB = 1 degree Celsius. | 98 | * value, it uses signed 8-bit values with LSB = 1 degree Celsius. |
99 | * For remote temperature, low and high limits, it uses signed 11-bit values | 99 | * For remote temperature, low and high limits, it uses signed 11-bit values |
100 | * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. | 100 | * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. |
101 | * For LM64 the actual remote diode temperature is 16 degree Celsius higher | ||
102 | * than the register reading. Remote temperature setpoints have to be | ||
103 | * adapted accordingly. | ||
101 | */ | 104 | */ |
102 | 105 | ||
103 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ | 106 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ |
@@ -165,6 +168,8 @@ struct lm63_data { | |||
165 | struct mutex update_lock; | 168 | struct mutex update_lock; |
166 | char valid; /* zero until following fields are valid */ | 169 | char valid; /* zero until following fields are valid */ |
167 | unsigned long last_updated; /* in jiffies */ | 170 | unsigned long last_updated; /* in jiffies */ |
171 | int kind; | ||
172 | int temp2_offset; | ||
168 | 173 | ||
169 | /* registers values */ | 174 | /* registers values */ |
170 | u8 config, config_fan; | 175 | u8 config, config_fan; |
@@ -247,16 +252,34 @@ static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *dum | |||
247 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); | 252 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); |
248 | } | 253 | } |
249 | 254 | ||
250 | static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr, | 255 | /* |
251 | char *buf) | 256 | * There are 8bit registers for both local(temp1) and remote(temp2) sensor. |
257 | * For remote sensor registers temp2_offset has to be considered, | ||
258 | * for local sensor it must not. | ||
259 | * So we need separate 8bit accessors for local and remote sensor. | ||
260 | */ | ||
261 | static ssize_t show_local_temp8(struct device *dev, | ||
262 | struct device_attribute *devattr, | ||
263 | char *buf) | ||
252 | { | 264 | { |
253 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 265 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
254 | struct lm63_data *data = lm63_update_device(dev); | 266 | struct lm63_data *data = lm63_update_device(dev); |
255 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); | 267 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); |
256 | } | 268 | } |
257 | 269 | ||
258 | static ssize_t set_temp8(struct device *dev, struct device_attribute *dummy, | 270 | static ssize_t show_remote_temp8(struct device *dev, |
259 | const char *buf, size_t count) | 271 | struct device_attribute *devattr, |
272 | char *buf) | ||
273 | { | ||
274 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
275 | struct lm63_data *data = lm63_update_device(dev); | ||
276 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index]) | ||
277 | + data->temp2_offset); | ||
278 | } | ||
279 | |||
280 | static ssize_t set_local_temp8(struct device *dev, | ||
281 | struct device_attribute *dummy, | ||
282 | const char *buf, size_t count) | ||
260 | { | 283 | { |
261 | struct i2c_client *client = to_i2c_client(dev); | 284 | struct i2c_client *client = to_i2c_client(dev); |
262 | struct lm63_data *data = i2c_get_clientdata(client); | 285 | struct lm63_data *data = i2c_get_clientdata(client); |
@@ -274,7 +297,8 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, | |||
274 | { | 297 | { |
275 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 298 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
276 | struct lm63_data *data = lm63_update_device(dev); | 299 | struct lm63_data *data = lm63_update_device(dev); |
277 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])); | 300 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index]) |
301 | + data->temp2_offset); | ||
278 | } | 302 | } |
279 | 303 | ||
280 | static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, | 304 | static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, |
@@ -294,7 +318,7 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, | |||
294 | int nr = attr->index; | 318 | int nr = attr->index; |
295 | 319 | ||
296 | mutex_lock(&data->update_lock); | 320 | mutex_lock(&data->update_lock); |
297 | data->temp11[nr] = TEMP11_TO_REG(val); | 321 | data->temp11[nr] = TEMP11_TO_REG(val - data->temp2_offset); |
298 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], | 322 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], |
299 | data->temp11[nr] >> 8); | 323 | data->temp11[nr] >> 8); |
300 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], | 324 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], |
@@ -310,6 +334,7 @@ static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute | |||
310 | { | 334 | { |
311 | struct lm63_data *data = lm63_update_device(dev); | 335 | struct lm63_data *data = lm63_update_device(dev); |
312 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) | 336 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) |
337 | + data->temp2_offset | ||
313 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); | 338 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); |
314 | } | 339 | } |
315 | 340 | ||
@@ -324,7 +349,7 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute * | |||
324 | long hyst; | 349 | long hyst; |
325 | 350 | ||
326 | mutex_lock(&data->update_lock); | 351 | mutex_lock(&data->update_lock); |
327 | hyst = TEMP8_FROM_REG(data->temp8[2]) - val; | 352 | hyst = TEMP8_FROM_REG(data->temp8[2]) + data->temp2_offset - val; |
328 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, | 353 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, |
329 | HYST_TO_REG(hyst)); | 354 | HYST_TO_REG(hyst)); |
330 | mutex_unlock(&data->update_lock); | 355 | mutex_unlock(&data->update_lock); |
@@ -355,16 +380,21 @@ static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan, | |||
355 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); | 380 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); |
356 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); | 381 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); |
357 | 382 | ||
358 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); | 383 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_local_temp8, NULL, 0); |
359 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp8, | 384 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_local_temp8, |
360 | set_temp8, 1); | 385 | set_local_temp8, 1); |
361 | 386 | ||
362 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); | 387 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); |
363 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, | 388 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, |
364 | set_temp11, 1); | 389 | set_temp11, 1); |
365 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, | 390 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, |
366 | set_temp11, 2); | 391 | set_temp11, 2); |
367 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp8, NULL, 2); | 392 | /* |
393 | * On LM63, temp2_crit can be set only once, which should be job | ||
394 | * of the bootloader. | ||
395 | */ | ||
396 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_remote_temp8, | ||
397 | NULL, 2); | ||
368 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, | 398 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, |
369 | set_temp2_crit_hyst); | 399 | set_temp2_crit_hyst); |
370 | 400 | ||
@@ -479,7 +509,12 @@ static int lm63_probe(struct i2c_client *new_client, | |||
479 | data->valid = 0; | 509 | data->valid = 0; |
480 | mutex_init(&data->update_lock); | 510 | mutex_init(&data->update_lock); |
481 | 511 | ||
482 | /* Initialize the LM63 chip */ | 512 | /* Set the device type */ |
513 | data->kind = id->driver_data; | ||
514 | if (data->kind == lm64) | ||
515 | data->temp2_offset = 16000; | ||
516 | |||
517 | /* Initialize chip */ | ||
483 | lm63_init_client(new_client); | 518 | lm63_init_client(new_client); |
484 | 519 | ||
485 | /* Register sysfs hooks */ | 520 | /* Register sysfs hooks */ |
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/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 8b606fd64022..08c194861af5 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -2610,9 +2610,11 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2610 | netif_carrier_on(nesvnic->netdev); | 2610 | netif_carrier_on(nesvnic->netdev); |
2611 | 2611 | ||
2612 | spin_lock(&nesvnic->port_ibevent_lock); | 2612 | spin_lock(&nesvnic->port_ibevent_lock); |
2613 | if (nesdev->iw_status == 0) { | 2613 | if (nesvnic->of_device_registered) { |
2614 | nesdev->iw_status = 1; | 2614 | if (nesdev->iw_status == 0) { |
2615 | nes_port_ibevent(nesvnic); | 2615 | nesdev->iw_status = 1; |
2616 | nes_port_ibevent(nesvnic); | ||
2617 | } | ||
2616 | } | 2618 | } |
2617 | spin_unlock(&nesvnic->port_ibevent_lock); | 2619 | spin_unlock(&nesvnic->port_ibevent_lock); |
2618 | } | 2620 | } |
@@ -2642,9 +2644,11 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2642 | netif_carrier_off(nesvnic->netdev); | 2644 | netif_carrier_off(nesvnic->netdev); |
2643 | 2645 | ||
2644 | spin_lock(&nesvnic->port_ibevent_lock); | 2646 | spin_lock(&nesvnic->port_ibevent_lock); |
2645 | if (nesdev->iw_status == 1) { | 2647 | if (nesvnic->of_device_registered) { |
2646 | nesdev->iw_status = 0; | 2648 | if (nesdev->iw_status == 1) { |
2647 | nes_port_ibevent(nesvnic); | 2649 | nesdev->iw_status = 0; |
2650 | nes_port_ibevent(nesvnic); | ||
2651 | } | ||
2648 | } | 2652 | } |
2649 | spin_unlock(&nesvnic->port_ibevent_lock); | 2653 | spin_unlock(&nesvnic->port_ibevent_lock); |
2650 | } | 2654 | } |
@@ -2703,9 +2707,11 @@ void nes_recheck_link_status(struct work_struct *work) | |||
2703 | netif_carrier_on(nesvnic->netdev); | 2707 | netif_carrier_on(nesvnic->netdev); |
2704 | 2708 | ||
2705 | spin_lock(&nesvnic->port_ibevent_lock); | 2709 | spin_lock(&nesvnic->port_ibevent_lock); |
2706 | if (nesdev->iw_status == 0) { | 2710 | if (nesvnic->of_device_registered) { |
2707 | nesdev->iw_status = 1; | 2711 | if (nesdev->iw_status == 0) { |
2708 | nes_port_ibevent(nesvnic); | 2712 | nesdev->iw_status = 1; |
2713 | nes_port_ibevent(nesvnic); | ||
2714 | } | ||
2709 | } | 2715 | } |
2710 | spin_unlock(&nesvnic->port_ibevent_lock); | 2716 | spin_unlock(&nesvnic->port_ibevent_lock); |
2711 | } | 2717 | } |
@@ -2723,9 +2729,11 @@ void nes_recheck_link_status(struct work_struct *work) | |||
2723 | netif_carrier_off(nesvnic->netdev); | 2729 | netif_carrier_off(nesvnic->netdev); |
2724 | 2730 | ||
2725 | spin_lock(&nesvnic->port_ibevent_lock); | 2731 | spin_lock(&nesvnic->port_ibevent_lock); |
2726 | if (nesdev->iw_status == 1) { | 2732 | if (nesvnic->of_device_registered) { |
2727 | nesdev->iw_status = 0; | 2733 | if (nesdev->iw_status == 1) { |
2728 | nes_port_ibevent(nesvnic); | 2734 | nesdev->iw_status = 0; |
2735 | nes_port_ibevent(nesvnic); | ||
2736 | } | ||
2729 | } | 2737 | } |
2730 | spin_unlock(&nesvnic->port_ibevent_lock); | 2738 | spin_unlock(&nesvnic->port_ibevent_lock); |
2731 | } | 2739 | } |
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/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c index 8245237b67ce..eca0c41f1226 100644 --- a/drivers/infiniband/hw/qib/qib_rc.c +++ b/drivers/infiniband/hw/qib/qib_rc.c | |||
@@ -1005,7 +1005,8 @@ void qib_rc_send_complete(struct qib_qp *qp, struct qib_ib_header *hdr) | |||
1005 | * there are still requests that haven't been acked. | 1005 | * there are still requests that haven't been acked. |
1006 | */ | 1006 | */ |
1007 | if ((psn & IB_BTH_REQ_ACK) && qp->s_acked != qp->s_tail && | 1007 | if ((psn & IB_BTH_REQ_ACK) && qp->s_acked != qp->s_tail && |
1008 | !(qp->s_flags & (QIB_S_TIMER | QIB_S_WAIT_RNR | QIB_S_WAIT_PSN))) | 1008 | !(qp->s_flags & (QIB_S_TIMER | QIB_S_WAIT_RNR | QIB_S_WAIT_PSN)) && |
1009 | (ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK)) | ||
1009 | start_timer(qp); | 1010 | start_timer(qp); |
1010 | 1011 | ||
1011 | while (qp->s_last != qp->s_acked) { | 1012 | while (qp->s_last != qp->s_acked) { |
@@ -1439,6 +1440,8 @@ static void qib_rc_rcv_resp(struct qib_ibport *ibp, | |||
1439 | } | 1440 | } |
1440 | 1441 | ||
1441 | spin_lock_irqsave(&qp->s_lock, flags); | 1442 | spin_lock_irqsave(&qp->s_lock, flags); |
1443 | if (!(ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK)) | ||
1444 | goto ack_done; | ||
1442 | 1445 | ||
1443 | /* Ignore invalid responses. */ | 1446 | /* Ignore invalid responses. */ |
1444 | if (qib_cmp24(psn, qp->s_next_psn) >= 0) | 1447 | if (qib_cmp24(psn, qp->s_next_psn) >= 0) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7985114beac7..11905b6a3023 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -75,7 +75,6 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz) | |||
75 | * dev->event_lock held and interrupts disabled. | 75 | * dev->event_lock held and interrupts disabled. |
76 | */ | 76 | */ |
77 | static void input_pass_event(struct input_dev *dev, | 77 | static void input_pass_event(struct input_dev *dev, |
78 | struct input_handler *src_handler, | ||
79 | unsigned int type, unsigned int code, int value) | 78 | unsigned int type, unsigned int code, int value) |
80 | { | 79 | { |
81 | struct input_handler *handler; | 80 | struct input_handler *handler; |
@@ -94,15 +93,6 @@ static void input_pass_event(struct input_dev *dev, | |||
94 | continue; | 93 | continue; |
95 | 94 | ||
96 | handler = handle->handler; | 95 | handler = handle->handler; |
97 | |||
98 | /* | ||
99 | * If this is the handler that injected this | ||
100 | * particular event we want to skip it to avoid | ||
101 | * filters firing again and again. | ||
102 | */ | ||
103 | if (handler == src_handler) | ||
104 | continue; | ||
105 | |||
106 | if (!handler->filter) { | 96 | if (!handler->filter) { |
107 | if (filtered) | 97 | if (filtered) |
108 | break; | 98 | break; |
@@ -132,7 +122,7 @@ static void input_repeat_key(unsigned long data) | |||
132 | if (test_bit(dev->repeat_key, dev->key) && | 122 | if (test_bit(dev->repeat_key, dev->key) && |
133 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { | 123 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { |
134 | 124 | ||
135 | input_pass_event(dev, NULL, EV_KEY, dev->repeat_key, 2); | 125 | input_pass_event(dev, EV_KEY, dev->repeat_key, 2); |
136 | 126 | ||
137 | if (dev->sync) { | 127 | if (dev->sync) { |
138 | /* | 128 | /* |
@@ -141,7 +131,7 @@ static void input_repeat_key(unsigned long data) | |||
141 | * Otherwise assume that the driver will send | 131 | * Otherwise assume that the driver will send |
142 | * SYN_REPORT once it's done. | 132 | * SYN_REPORT once it's done. |
143 | */ | 133 | */ |
144 | input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); | 134 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
145 | } | 135 | } |
146 | 136 | ||
147 | if (dev->rep[REP_PERIOD]) | 137 | if (dev->rep[REP_PERIOD]) |
@@ -174,7 +164,6 @@ static void input_stop_autorepeat(struct input_dev *dev) | |||
174 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) | 164 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) |
175 | 165 | ||
176 | static int input_handle_abs_event(struct input_dev *dev, | 166 | static int input_handle_abs_event(struct input_dev *dev, |
177 | struct input_handler *src_handler, | ||
178 | unsigned int code, int *pval) | 167 | unsigned int code, int *pval) |
179 | { | 168 | { |
180 | bool is_mt_event; | 169 | bool is_mt_event; |
@@ -218,15 +207,13 @@ static int input_handle_abs_event(struct input_dev *dev, | |||
218 | /* Flush pending "slot" event */ | 207 | /* Flush pending "slot" event */ |
219 | if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { | 208 | if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { |
220 | input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); | 209 | input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); |
221 | input_pass_event(dev, src_handler, | 210 | input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot); |
222 | EV_ABS, ABS_MT_SLOT, dev->slot); | ||
223 | } | 211 | } |
224 | 212 | ||
225 | return INPUT_PASS_TO_HANDLERS; | 213 | return INPUT_PASS_TO_HANDLERS; |
226 | } | 214 | } |
227 | 215 | ||
228 | static void input_handle_event(struct input_dev *dev, | 216 | static void input_handle_event(struct input_dev *dev, |
229 | struct input_handler *src_handler, | ||
230 | unsigned int type, unsigned int code, int value) | 217 | unsigned int type, unsigned int code, int value) |
231 | { | 218 | { |
232 | int disposition = INPUT_IGNORE_EVENT; | 219 | int disposition = INPUT_IGNORE_EVENT; |
@@ -279,8 +266,7 @@ static void input_handle_event(struct input_dev *dev, | |||
279 | 266 | ||
280 | case EV_ABS: | 267 | case EV_ABS: |
281 | if (is_event_supported(code, dev->absbit, ABS_MAX)) | 268 | if (is_event_supported(code, dev->absbit, ABS_MAX)) |
282 | disposition = input_handle_abs_event(dev, src_handler, | 269 | disposition = input_handle_abs_event(dev, code, &value); |
283 | code, &value); | ||
284 | 270 | ||
285 | break; | 271 | break; |
286 | 272 | ||
@@ -338,7 +324,7 @@ static void input_handle_event(struct input_dev *dev, | |||
338 | dev->event(dev, type, code, value); | 324 | dev->event(dev, type, code, value); |
339 | 325 | ||
340 | if (disposition & INPUT_PASS_TO_HANDLERS) | 326 | if (disposition & INPUT_PASS_TO_HANDLERS) |
341 | input_pass_event(dev, src_handler, type, code, value); | 327 | input_pass_event(dev, type, code, value); |
342 | } | 328 | } |
343 | 329 | ||
344 | /** | 330 | /** |
@@ -367,7 +353,7 @@ void input_event(struct input_dev *dev, | |||
367 | 353 | ||
368 | spin_lock_irqsave(&dev->event_lock, flags); | 354 | spin_lock_irqsave(&dev->event_lock, flags); |
369 | add_input_randomness(type, code, value); | 355 | add_input_randomness(type, code, value); |
370 | input_handle_event(dev, NULL, type, code, value); | 356 | input_handle_event(dev, type, code, value); |
371 | spin_unlock_irqrestore(&dev->event_lock, flags); | 357 | spin_unlock_irqrestore(&dev->event_lock, flags); |
372 | } | 358 | } |
373 | } | 359 | } |
@@ -397,8 +383,7 @@ void input_inject_event(struct input_handle *handle, | |||
397 | rcu_read_lock(); | 383 | rcu_read_lock(); |
398 | grab = rcu_dereference(dev->grab); | 384 | grab = rcu_dereference(dev->grab); |
399 | if (!grab || grab == handle) | 385 | if (!grab || grab == handle) |
400 | input_handle_event(dev, handle->handler, | 386 | input_handle_event(dev, type, code, value); |
401 | type, code, value); | ||
402 | rcu_read_unlock(); | 387 | rcu_read_unlock(); |
403 | 388 | ||
404 | spin_unlock_irqrestore(&dev->event_lock, flags); | 389 | spin_unlock_irqrestore(&dev->event_lock, flags); |
@@ -611,10 +596,10 @@ static void input_dev_release_keys(struct input_dev *dev) | |||
611 | for (code = 0; code <= KEY_MAX; code++) { | 596 | for (code = 0; code <= KEY_MAX; code++) { |
612 | if (is_event_supported(code, dev->keybit, KEY_MAX) && | 597 | if (is_event_supported(code, dev->keybit, KEY_MAX) && |
613 | __test_and_clear_bit(code, dev->key)) { | 598 | __test_and_clear_bit(code, dev->key)) { |
614 | input_pass_event(dev, NULL, EV_KEY, code, 0); | 599 | input_pass_event(dev, EV_KEY, code, 0); |
615 | } | 600 | } |
616 | } | 601 | } |
617 | input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); | 602 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
618 | } | 603 | } |
619 | } | 604 | } |
620 | 605 | ||
@@ -889,9 +874,9 @@ int input_set_keycode(struct input_dev *dev, | |||
889 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && | 874 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && |
890 | __test_and_clear_bit(old_keycode, dev->key)) { | 875 | __test_and_clear_bit(old_keycode, dev->key)) { |
891 | 876 | ||
892 | input_pass_event(dev, NULL, EV_KEY, old_keycode, 0); | 877 | input_pass_event(dev, EV_KEY, old_keycode, 0); |
893 | if (dev->sync) | 878 | if (dev->sync) |
894 | input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); | 879 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
895 | } | 880 | } |
896 | 881 | ||
897 | out: | 882 | out: |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 417507348bab..c7a92028f450 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -343,6 +343,16 @@ config KEYBOARD_NOMADIK | |||
343 | To compile this driver as a module, choose M here: the | 343 | To compile this driver as a module, choose M here: the |
344 | module will be called nmk-ske-keypad. | 344 | module will be called nmk-ske-keypad. |
345 | 345 | ||
346 | config KEYBOARD_TEGRA | ||
347 | tristate "NVIDIA Tegra internal matrix keyboard controller support" | ||
348 | depends on ARCH_TEGRA | ||
349 | help | ||
350 | Say Y here if you want to use a matrix keyboard connected directly | ||
351 | to the internal keyboard controller on Tegra SoCs. | ||
352 | |||
353 | To compile this driver as a module, choose M here: the | ||
354 | module will be called tegra-kbc. | ||
355 | |||
346 | config KEYBOARD_OPENCORES | 356 | config KEYBOARD_OPENCORES |
347 | tristate "OpenCores Keyboard Controller" | 357 | tristate "OpenCores Keyboard Controller" |
348 | help | 358 | help |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 4e5571b72cda..468c627a2844 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o | |||
42 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | 42 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o |
43 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | 43 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o |
44 | obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o | 44 | obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o |
45 | obj-$(CONFIG_KEYBOARD_TEGRA) += tegra-kbc.o | ||
45 | obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o | 46 | obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o |
46 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o | 47 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o |
47 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | 48 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 6069abe31e42..eb3006361ee4 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -322,7 +322,7 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata) | |||
322 | struct gpio_keys_button *button = bdata->button; | 322 | struct gpio_keys_button *button = bdata->button; |
323 | struct input_dev *input = bdata->input; | 323 | struct input_dev *input = bdata->input; |
324 | unsigned int type = button->type ?: EV_KEY; | 324 | unsigned int type = button->type ?: EV_KEY; |
325 | int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; | 325 | int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; |
326 | 326 | ||
327 | input_event(input, type, button->code, !!state); | 327 | input_event(input, type, button->code, !!state); |
328 | input_sync(input); | 328 | input_sync(input); |
@@ -410,8 +410,8 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev, | |||
410 | if (!button->can_disable) | 410 | if (!button->can_disable) |
411 | irqflags |= IRQF_SHARED; | 411 | irqflags |= IRQF_SHARED; |
412 | 412 | ||
413 | error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata); | 413 | error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata); |
414 | if (error) { | 414 | if (error < 0) { |
415 | dev_err(dev, "Unable to claim irq %d; error %d\n", | 415 | dev_err(dev, "Unable to claim irq %d; error %d\n", |
416 | irq, error); | 416 | irq, error); |
417 | goto fail3; | 417 | goto fail3; |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c new file mode 100644 index 000000000000..ac471b77c18e --- /dev/null +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -0,0 +1,727 @@ | |||
1 | /* | ||
2 | * Keyboard class input driver for the NVIDIA Tegra SoC internal matrix | ||
3 | * keyboard controller | ||
4 | * | ||
5 | * Copyright (c) 2009-2011, NVIDIA Corporation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/io.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/clk.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <mach/clk.h> | ||
31 | #include <mach/kbc.h> | ||
32 | |||
33 | #define KBC_MAX_DEBOUNCE_CNT 0x3ffu | ||
34 | |||
35 | /* KBC row scan time and delay for beginning the row scan. */ | ||
36 | #define KBC_ROW_SCAN_TIME 16 | ||
37 | #define KBC_ROW_SCAN_DLY 5 | ||
38 | |||
39 | /* KBC uses a 32KHz clock so a cycle = 1/32Khz */ | ||
40 | #define KBC_CYCLE_USEC 32 | ||
41 | |||
42 | /* KBC Registers */ | ||
43 | |||
44 | /* KBC Control Register */ | ||
45 | #define KBC_CONTROL_0 0x0 | ||
46 | #define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14) | ||
47 | #define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4) | ||
48 | #define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3) | ||
49 | #define KBC_CONTROL_KBC_EN (1 << 0) | ||
50 | |||
51 | /* KBC Interrupt Register */ | ||
52 | #define KBC_INT_0 0x4 | ||
53 | #define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2) | ||
54 | |||
55 | #define KBC_ROW_CFG0_0 0x8 | ||
56 | #define KBC_COL_CFG0_0 0x18 | ||
57 | #define KBC_INIT_DLY_0 0x28 | ||
58 | #define KBC_RPT_DLY_0 0x2c | ||
59 | #define KBC_KP_ENT0_0 0x30 | ||
60 | #define KBC_KP_ENT1_0 0x34 | ||
61 | #define KBC_ROW0_MASK_0 0x38 | ||
62 | |||
63 | #define KBC_ROW_SHIFT 3 | ||
64 | |||
65 | struct tegra_kbc { | ||
66 | void __iomem *mmio; | ||
67 | struct input_dev *idev; | ||
68 | unsigned int irq; | ||
69 | unsigned int wake_enable_rows; | ||
70 | unsigned int wake_enable_cols; | ||
71 | spinlock_t lock; | ||
72 | unsigned int repoll_dly; | ||
73 | unsigned long cp_dly_jiffies; | ||
74 | const struct tegra_kbc_platform_data *pdata; | ||
75 | unsigned short keycode[KBC_MAX_KEY]; | ||
76 | unsigned short current_keys[KBC_MAX_KPENT]; | ||
77 | unsigned int num_pressed_keys; | ||
78 | struct timer_list timer; | ||
79 | struct clk *clk; | ||
80 | }; | ||
81 | |||
82 | static const u32 tegra_kbc_default_keymap[] = { | ||
83 | KEY(0, 2, KEY_W), | ||
84 | KEY(0, 3, KEY_S), | ||
85 | KEY(0, 4, KEY_A), | ||
86 | KEY(0, 5, KEY_Z), | ||
87 | KEY(0, 7, KEY_FN), | ||
88 | |||
89 | KEY(1, 7, KEY_LEFTMETA), | ||
90 | |||
91 | KEY(2, 6, KEY_RIGHTALT), | ||
92 | KEY(2, 7, KEY_LEFTALT), | ||
93 | |||
94 | KEY(3, 0, KEY_5), | ||
95 | KEY(3, 1, KEY_4), | ||
96 | KEY(3, 2, KEY_R), | ||
97 | KEY(3, 3, KEY_E), | ||
98 | KEY(3, 4, KEY_F), | ||
99 | KEY(3, 5, KEY_D), | ||
100 | KEY(3, 6, KEY_X), | ||
101 | |||
102 | KEY(4, 0, KEY_7), | ||
103 | KEY(4, 1, KEY_6), | ||
104 | KEY(4, 2, KEY_T), | ||
105 | KEY(4, 3, KEY_H), | ||
106 | KEY(4, 4, KEY_G), | ||
107 | KEY(4, 5, KEY_V), | ||
108 | KEY(4, 6, KEY_C), | ||
109 | KEY(4, 7, KEY_SPACE), | ||
110 | |||
111 | KEY(5, 0, KEY_9), | ||
112 | KEY(5, 1, KEY_8), | ||
113 | KEY(5, 2, KEY_U), | ||
114 | KEY(5, 3, KEY_Y), | ||
115 | KEY(5, 4, KEY_J), | ||
116 | KEY(5, 5, KEY_N), | ||
117 | KEY(5, 6, KEY_B), | ||
118 | KEY(5, 7, KEY_BACKSLASH), | ||
119 | |||
120 | KEY(6, 0, KEY_MINUS), | ||
121 | KEY(6, 1, KEY_0), | ||
122 | KEY(6, 2, KEY_O), | ||
123 | KEY(6, 3, KEY_I), | ||
124 | KEY(6, 4, KEY_L), | ||
125 | KEY(6, 5, KEY_K), | ||
126 | KEY(6, 6, KEY_COMMA), | ||
127 | KEY(6, 7, KEY_M), | ||
128 | |||
129 | KEY(7, 1, KEY_EQUAL), | ||
130 | KEY(7, 2, KEY_RIGHTBRACE), | ||
131 | KEY(7, 3, KEY_ENTER), | ||
132 | KEY(7, 7, KEY_MENU), | ||
133 | |||
134 | KEY(8, 4, KEY_RIGHTSHIFT), | ||
135 | KEY(8, 5, KEY_LEFTSHIFT), | ||
136 | |||
137 | KEY(9, 5, KEY_RIGHTCTRL), | ||
138 | KEY(9, 7, KEY_LEFTCTRL), | ||
139 | |||
140 | KEY(11, 0, KEY_LEFTBRACE), | ||
141 | KEY(11, 1, KEY_P), | ||
142 | KEY(11, 2, KEY_APOSTROPHE), | ||
143 | KEY(11, 3, KEY_SEMICOLON), | ||
144 | KEY(11, 4, KEY_SLASH), | ||
145 | KEY(11, 5, KEY_DOT), | ||
146 | |||
147 | KEY(12, 0, KEY_F10), | ||
148 | KEY(12, 1, KEY_F9), | ||
149 | KEY(12, 2, KEY_BACKSPACE), | ||
150 | KEY(12, 3, KEY_3), | ||
151 | KEY(12, 4, KEY_2), | ||
152 | KEY(12, 5, KEY_UP), | ||
153 | KEY(12, 6, KEY_PRINT), | ||
154 | KEY(12, 7, KEY_PAUSE), | ||
155 | |||
156 | KEY(13, 0, KEY_INSERT), | ||
157 | KEY(13, 1, KEY_DELETE), | ||
158 | KEY(13, 3, KEY_PAGEUP), | ||
159 | KEY(13, 4, KEY_PAGEDOWN), | ||
160 | KEY(13, 5, KEY_RIGHT), | ||
161 | KEY(13, 6, KEY_DOWN), | ||
162 | KEY(13, 7, KEY_LEFT), | ||
163 | |||
164 | KEY(14, 0, KEY_F11), | ||
165 | KEY(14, 1, KEY_F12), | ||
166 | KEY(14, 2, KEY_F8), | ||
167 | KEY(14, 3, KEY_Q), | ||
168 | KEY(14, 4, KEY_F4), | ||
169 | KEY(14, 5, KEY_F3), | ||
170 | KEY(14, 6, KEY_1), | ||
171 | KEY(14, 7, KEY_F7), | ||
172 | |||
173 | KEY(15, 0, KEY_ESC), | ||
174 | KEY(15, 1, KEY_GRAVE), | ||
175 | KEY(15, 2, KEY_F5), | ||
176 | KEY(15, 3, KEY_TAB), | ||
177 | KEY(15, 4, KEY_F1), | ||
178 | KEY(15, 5, KEY_F2), | ||
179 | KEY(15, 6, KEY_CAPSLOCK), | ||
180 | KEY(15, 7, KEY_F6), | ||
181 | }; | ||
182 | |||
183 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { | ||
184 | .keymap = tegra_kbc_default_keymap, | ||
185 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), | ||
186 | }; | ||
187 | |||
188 | static void tegra_kbc_report_released_keys(struct input_dev *input, | ||
189 | unsigned short old_keycodes[], | ||
190 | unsigned int old_num_keys, | ||
191 | unsigned short new_keycodes[], | ||
192 | unsigned int new_num_keys) | ||
193 | { | ||
194 | unsigned int i, j; | ||
195 | |||
196 | for (i = 0; i < old_num_keys; i++) { | ||
197 | for (j = 0; j < new_num_keys; j++) | ||
198 | if (old_keycodes[i] == new_keycodes[j]) | ||
199 | break; | ||
200 | |||
201 | if (j == new_num_keys) | ||
202 | input_report_key(input, old_keycodes[i], 0); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | static void tegra_kbc_report_pressed_keys(struct input_dev *input, | ||
207 | unsigned char scancodes[], | ||
208 | unsigned short keycodes[], | ||
209 | unsigned int num_pressed_keys) | ||
210 | { | ||
211 | unsigned int i; | ||
212 | |||
213 | for (i = 0; i < num_pressed_keys; i++) { | ||
214 | input_event(input, EV_MSC, MSC_SCAN, scancodes[i]); | ||
215 | input_report_key(input, keycodes[i], 1); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | ||
220 | { | ||
221 | unsigned char scancodes[KBC_MAX_KPENT]; | ||
222 | unsigned short keycodes[KBC_MAX_KPENT]; | ||
223 | u32 val = 0; | ||
224 | unsigned int i; | ||
225 | unsigned int num_down = 0; | ||
226 | unsigned long flags; | ||
227 | |||
228 | spin_lock_irqsave(&kbc->lock, flags); | ||
229 | for (i = 0; i < KBC_MAX_KPENT; i++) { | ||
230 | if ((i % 4) == 0) | ||
231 | val = readl(kbc->mmio + KBC_KP_ENT0_0 + i); | ||
232 | |||
233 | if (val & 0x80) { | ||
234 | unsigned int col = val & 0x07; | ||
235 | unsigned int row = (val >> 3) & 0x0f; | ||
236 | unsigned char scancode = | ||
237 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); | ||
238 | |||
239 | scancodes[num_down] = scancode; | ||
240 | keycodes[num_down++] = kbc->keycode[scancode]; | ||
241 | } | ||
242 | |||
243 | val >>= 8; | ||
244 | } | ||
245 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
246 | |||
247 | tegra_kbc_report_released_keys(kbc->idev, | ||
248 | kbc->current_keys, kbc->num_pressed_keys, | ||
249 | keycodes, num_down); | ||
250 | tegra_kbc_report_pressed_keys(kbc->idev, scancodes, keycodes, num_down); | ||
251 | input_sync(kbc->idev); | ||
252 | |||
253 | memcpy(kbc->current_keys, keycodes, sizeof(kbc->current_keys)); | ||
254 | kbc->num_pressed_keys = num_down; | ||
255 | } | ||
256 | |||
257 | static void tegra_kbc_keypress_timer(unsigned long data) | ||
258 | { | ||
259 | struct tegra_kbc *kbc = (struct tegra_kbc *)data; | ||
260 | unsigned long flags; | ||
261 | u32 val; | ||
262 | unsigned int i; | ||
263 | |||
264 | val = (readl(kbc->mmio + KBC_INT_0) >> 4) & 0xf; | ||
265 | if (val) { | ||
266 | unsigned long dly; | ||
267 | |||
268 | tegra_kbc_report_keys(kbc); | ||
269 | |||
270 | /* | ||
271 | * If more than one keys are pressed we need not wait | ||
272 | * for the repoll delay. | ||
273 | */ | ||
274 | dly = (val == 1) ? kbc->repoll_dly : 1; | ||
275 | mod_timer(&kbc->timer, jiffies + msecs_to_jiffies(dly)); | ||
276 | } else { | ||
277 | /* Release any pressed keys and exit the polling loop */ | ||
278 | for (i = 0; i < kbc->num_pressed_keys; i++) | ||
279 | input_report_key(kbc->idev, kbc->current_keys[i], 0); | ||
280 | input_sync(kbc->idev); | ||
281 | |||
282 | kbc->num_pressed_keys = 0; | ||
283 | |||
284 | /* All keys are released so enable the keypress interrupt */ | ||
285 | spin_lock_irqsave(&kbc->lock, flags); | ||
286 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
287 | val |= KBC_CONTROL_FIFO_CNT_INT_EN; | ||
288 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
289 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static irqreturn_t tegra_kbc_isr(int irq, void *args) | ||
294 | { | ||
295 | struct tegra_kbc *kbc = args; | ||
296 | u32 val, ctl; | ||
297 | |||
298 | /* | ||
299 | * Until all keys are released, defer further processing to | ||
300 | * the polling loop in tegra_kbc_keypress_timer | ||
301 | */ | ||
302 | ctl = readl(kbc->mmio + KBC_CONTROL_0); | ||
303 | ctl &= ~KBC_CONTROL_FIFO_CNT_INT_EN; | ||
304 | writel(ctl, kbc->mmio + KBC_CONTROL_0); | ||
305 | |||
306 | /* | ||
307 | * Quickly bail out & reenable interrupts if the fifo threshold | ||
308 | * count interrupt wasn't the interrupt source | ||
309 | */ | ||
310 | val = readl(kbc->mmio + KBC_INT_0); | ||
311 | writel(val, kbc->mmio + KBC_INT_0); | ||
312 | |||
313 | if (val & KBC_INT_FIFO_CNT_INT_STATUS) { | ||
314 | /* | ||
315 | * Schedule timer to run when hardware is in continuous | ||
316 | * polling mode. | ||
317 | */ | ||
318 | mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies); | ||
319 | } else { | ||
320 | ctl |= KBC_CONTROL_FIFO_CNT_INT_EN; | ||
321 | writel(ctl, kbc->mmio + KBC_CONTROL_0); | ||
322 | } | ||
323 | |||
324 | return IRQ_HANDLED; | ||
325 | } | ||
326 | |||
327 | static void tegra_kbc_setup_wakekeys(struct tegra_kbc *kbc, bool filter) | ||
328 | { | ||
329 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
330 | int i; | ||
331 | unsigned int rst_val; | ||
332 | |||
333 | BUG_ON(pdata->wake_cnt > KBC_MAX_KEY); | ||
334 | rst_val = (filter && pdata->wake_cnt) ? ~0 : 0; | ||
335 | |||
336 | for (i = 0; i < KBC_MAX_ROW; i++) | ||
337 | writel(rst_val, kbc->mmio + KBC_ROW0_MASK_0 + i * 4); | ||
338 | |||
339 | if (filter) { | ||
340 | for (i = 0; i < pdata->wake_cnt; i++) { | ||
341 | u32 val, addr; | ||
342 | addr = pdata->wake_cfg[i].row * 4 + KBC_ROW0_MASK_0; | ||
343 | val = readl(kbc->mmio + addr); | ||
344 | val &= ~(1 << pdata->wake_cfg[i].col); | ||
345 | writel(val, kbc->mmio + addr); | ||
346 | } | ||
347 | } | ||
348 | } | ||
349 | |||
350 | static void tegra_kbc_config_pins(struct tegra_kbc *kbc) | ||
351 | { | ||
352 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
353 | int i; | ||
354 | |||
355 | for (i = 0; i < KBC_MAX_GPIO; i++) { | ||
356 | u32 r_shft = 5 * (i % 6); | ||
357 | u32 c_shft = 4 * (i % 8); | ||
358 | u32 r_mask = 0x1f << r_shft; | ||
359 | u32 c_mask = 0x0f << c_shft; | ||
360 | u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0; | ||
361 | u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0; | ||
362 | u32 row_cfg = readl(kbc->mmio + r_offs); | ||
363 | u32 col_cfg = readl(kbc->mmio + c_offs); | ||
364 | |||
365 | row_cfg &= ~r_mask; | ||
366 | col_cfg &= ~c_mask; | ||
367 | |||
368 | if (pdata->pin_cfg[i].is_row) | ||
369 | row_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << r_shft; | ||
370 | else | ||
371 | col_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << c_shft; | ||
372 | |||
373 | writel(row_cfg, kbc->mmio + r_offs); | ||
374 | writel(col_cfg, kbc->mmio + c_offs); | ||
375 | } | ||
376 | } | ||
377 | |||
378 | static int tegra_kbc_start(struct tegra_kbc *kbc) | ||
379 | { | ||
380 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
381 | unsigned long flags; | ||
382 | unsigned int debounce_cnt; | ||
383 | u32 val = 0; | ||
384 | |||
385 | clk_enable(kbc->clk); | ||
386 | |||
387 | /* Reset the KBC controller to clear all previous status.*/ | ||
388 | tegra_periph_reset_assert(kbc->clk); | ||
389 | udelay(100); | ||
390 | tegra_periph_reset_deassert(kbc->clk); | ||
391 | udelay(100); | ||
392 | |||
393 | tegra_kbc_config_pins(kbc); | ||
394 | tegra_kbc_setup_wakekeys(kbc, false); | ||
395 | |||
396 | writel(pdata->repeat_cnt, kbc->mmio + KBC_RPT_DLY_0); | ||
397 | |||
398 | /* Keyboard debounce count is maximum of 12 bits. */ | ||
399 | debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); | ||
400 | val = KBC_DEBOUNCE_CNT_SHIFT(debounce_cnt); | ||
401 | val |= KBC_FIFO_TH_CNT_SHIFT(1); /* set fifo interrupt threshold to 1 */ | ||
402 | val |= KBC_CONTROL_FIFO_CNT_INT_EN; /* interrupt on FIFO threshold */ | ||
403 | val |= KBC_CONTROL_KBC_EN; /* enable */ | ||
404 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
405 | |||
406 | /* | ||
407 | * Compute the delay(ns) from interrupt mode to continuous polling | ||
408 | * mode so the timer routine is scheduled appropriately. | ||
409 | */ | ||
410 | val = readl(kbc->mmio + KBC_INIT_DLY_0); | ||
411 | kbc->cp_dly_jiffies = usecs_to_jiffies((val & 0xfffff) * 32); | ||
412 | |||
413 | kbc->num_pressed_keys = 0; | ||
414 | |||
415 | /* | ||
416 | * Atomically clear out any remaining entries in the key FIFO | ||
417 | * and enable keyboard interrupts. | ||
418 | */ | ||
419 | spin_lock_irqsave(&kbc->lock, flags); | ||
420 | while (1) { | ||
421 | val = readl(kbc->mmio + KBC_INT_0); | ||
422 | val >>= 4; | ||
423 | if (!val) | ||
424 | break; | ||
425 | |||
426 | val = readl(kbc->mmio + KBC_KP_ENT0_0); | ||
427 | val = readl(kbc->mmio + KBC_KP_ENT1_0); | ||
428 | } | ||
429 | writel(0x7, kbc->mmio + KBC_INT_0); | ||
430 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
431 | |||
432 | enable_irq(kbc->irq); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | static void tegra_kbc_stop(struct tegra_kbc *kbc) | ||
438 | { | ||
439 | unsigned long flags; | ||
440 | u32 val; | ||
441 | |||
442 | spin_lock_irqsave(&kbc->lock, flags); | ||
443 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
444 | val &= ~1; | ||
445 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
446 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
447 | |||
448 | disable_irq(kbc->irq); | ||
449 | del_timer_sync(&kbc->timer); | ||
450 | |||
451 | clk_disable(kbc->clk); | ||
452 | } | ||
453 | |||
454 | static int tegra_kbc_open(struct input_dev *dev) | ||
455 | { | ||
456 | struct tegra_kbc *kbc = input_get_drvdata(dev); | ||
457 | |||
458 | return tegra_kbc_start(kbc); | ||
459 | } | ||
460 | |||
461 | static void tegra_kbc_close(struct input_dev *dev) | ||
462 | { | ||
463 | struct tegra_kbc *kbc = input_get_drvdata(dev); | ||
464 | |||
465 | return tegra_kbc_stop(kbc); | ||
466 | } | ||
467 | |||
468 | static bool __devinit | ||
469 | tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, | ||
470 | struct device *dev, unsigned int *num_rows) | ||
471 | { | ||
472 | int i; | ||
473 | |||
474 | *num_rows = 0; | ||
475 | |||
476 | for (i = 0; i < KBC_MAX_GPIO; i++) { | ||
477 | const struct tegra_kbc_pin_cfg *pin_cfg = &pdata->pin_cfg[i]; | ||
478 | |||
479 | if (pin_cfg->is_row) { | ||
480 | if (pin_cfg->num >= KBC_MAX_ROW) { | ||
481 | dev_err(dev, | ||
482 | "pin_cfg[%d]: invalid row number %d\n", | ||
483 | i, pin_cfg->num); | ||
484 | return false; | ||
485 | } | ||
486 | (*num_rows)++; | ||
487 | } else { | ||
488 | if (pin_cfg->num >= KBC_MAX_COL) { | ||
489 | dev_err(dev, | ||
490 | "pin_cfg[%d]: invalid column number %d\n", | ||
491 | i, pin_cfg->num); | ||
492 | return false; | ||
493 | } | ||
494 | } | ||
495 | } | ||
496 | |||
497 | return true; | ||
498 | } | ||
499 | |||
500 | static int __devinit tegra_kbc_probe(struct platform_device *pdev) | ||
501 | { | ||
502 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; | ||
503 | const struct matrix_keymap_data *keymap_data; | ||
504 | struct tegra_kbc *kbc; | ||
505 | struct input_dev *input_dev; | ||
506 | struct resource *res; | ||
507 | int irq; | ||
508 | int err; | ||
509 | int i; | ||
510 | int num_rows = 0; | ||
511 | unsigned int debounce_cnt; | ||
512 | unsigned int scan_time_rows; | ||
513 | |||
514 | if (!pdata) | ||
515 | return -EINVAL; | ||
516 | |||
517 | if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) | ||
518 | return -EINVAL; | ||
519 | |||
520 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
521 | if (!res) { | ||
522 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | ||
523 | return -ENXIO; | ||
524 | } | ||
525 | |||
526 | irq = platform_get_irq(pdev, 0); | ||
527 | if (irq < 0) { | ||
528 | dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); | ||
529 | return -ENXIO; | ||
530 | } | ||
531 | |||
532 | kbc = kzalloc(sizeof(*kbc), GFP_KERNEL); | ||
533 | input_dev = input_allocate_device(); | ||
534 | if (!kbc || !input_dev) { | ||
535 | err = -ENOMEM; | ||
536 | goto err_free_mem; | ||
537 | } | ||
538 | |||
539 | kbc->pdata = pdata; | ||
540 | kbc->idev = input_dev; | ||
541 | kbc->irq = irq; | ||
542 | spin_lock_init(&kbc->lock); | ||
543 | setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); | ||
544 | |||
545 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
546 | if (!res) { | ||
547 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
548 | err = -EBUSY; | ||
549 | goto err_free_mem; | ||
550 | } | ||
551 | |||
552 | kbc->mmio = ioremap(res->start, resource_size(res)); | ||
553 | if (!kbc->mmio) { | ||
554 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
555 | err = -ENXIO; | ||
556 | goto err_free_mem_region; | ||
557 | } | ||
558 | |||
559 | kbc->clk = clk_get(&pdev->dev, NULL); | ||
560 | if (IS_ERR(kbc->clk)) { | ||
561 | dev_err(&pdev->dev, "failed to get keyboard clock\n"); | ||
562 | err = PTR_ERR(kbc->clk); | ||
563 | goto err_iounmap; | ||
564 | } | ||
565 | |||
566 | kbc->wake_enable_rows = 0; | ||
567 | kbc->wake_enable_cols = 0; | ||
568 | for (i = 0; i < pdata->wake_cnt; i++) { | ||
569 | kbc->wake_enable_rows |= (1 << pdata->wake_cfg[i].row); | ||
570 | kbc->wake_enable_cols |= (1 << pdata->wake_cfg[i].col); | ||
571 | } | ||
572 | |||
573 | /* | ||
574 | * The time delay between two consecutive reads of the FIFO is | ||
575 | * the sum of the repeat time and the time taken for scanning | ||
576 | * the rows. There is an additional delay before the row scanning | ||
577 | * starts. The repoll delay is computed in milliseconds. | ||
578 | */ | ||
579 | debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); | ||
580 | scan_time_rows = (KBC_ROW_SCAN_TIME + debounce_cnt) * num_rows; | ||
581 | kbc->repoll_dly = KBC_ROW_SCAN_DLY + scan_time_rows + pdata->repeat_cnt; | ||
582 | kbc->repoll_dly = ((kbc->repoll_dly * KBC_CYCLE_USEC) + 999) / 1000; | ||
583 | |||
584 | input_dev->name = pdev->name; | ||
585 | input_dev->id.bustype = BUS_HOST; | ||
586 | input_dev->dev.parent = &pdev->dev; | ||
587 | input_dev->open = tegra_kbc_open; | ||
588 | input_dev->close = tegra_kbc_close; | ||
589 | |||
590 | input_set_drvdata(input_dev, kbc); | ||
591 | |||
592 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
593 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
594 | |||
595 | input_dev->keycode = kbc->keycode; | ||
596 | input_dev->keycodesize = sizeof(kbc->keycode[0]); | ||
597 | input_dev->keycodemax = ARRAY_SIZE(kbc->keycode); | ||
598 | |||
599 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; | ||
600 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, | ||
601 | input_dev->keycode, input_dev->keybit); | ||
602 | |||
603 | err = request_irq(kbc->irq, tegra_kbc_isr, IRQF_TRIGGER_HIGH, | ||
604 | pdev->name, kbc); | ||
605 | if (err) { | ||
606 | dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); | ||
607 | goto err_put_clk; | ||
608 | } | ||
609 | |||
610 | disable_irq(kbc->irq); | ||
611 | |||
612 | err = input_register_device(kbc->idev); | ||
613 | if (err) { | ||
614 | dev_err(&pdev->dev, "failed to register input device\n"); | ||
615 | goto err_free_irq; | ||
616 | } | ||
617 | |||
618 | platform_set_drvdata(pdev, kbc); | ||
619 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
620 | |||
621 | return 0; | ||
622 | |||
623 | err_free_irq: | ||
624 | free_irq(kbc->irq, pdev); | ||
625 | err_put_clk: | ||
626 | clk_put(kbc->clk); | ||
627 | err_iounmap: | ||
628 | iounmap(kbc->mmio); | ||
629 | err_free_mem_region: | ||
630 | release_mem_region(res->start, resource_size(res)); | ||
631 | err_free_mem: | ||
632 | input_free_device(kbc->idev); | ||
633 | kfree(kbc); | ||
634 | |||
635 | return err; | ||
636 | } | ||
637 | |||
638 | static int __devexit tegra_kbc_remove(struct platform_device *pdev) | ||
639 | { | ||
640 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
641 | struct resource *res; | ||
642 | |||
643 | free_irq(kbc->irq, pdev); | ||
644 | clk_put(kbc->clk); | ||
645 | |||
646 | input_unregister_device(kbc->idev); | ||
647 | iounmap(kbc->mmio); | ||
648 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
649 | release_mem_region(res->start, resource_size(res)); | ||
650 | |||
651 | kfree(kbc); | ||
652 | |||
653 | platform_set_drvdata(pdev, NULL); | ||
654 | |||
655 | return 0; | ||
656 | } | ||
657 | |||
658 | #ifdef CONFIG_PM_SLEEP | ||
659 | static int tegra_kbc_suspend(struct device *dev) | ||
660 | { | ||
661 | struct platform_device *pdev = to_platform_device(dev); | ||
662 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
663 | |||
664 | if (device_may_wakeup(&pdev->dev)) { | ||
665 | tegra_kbc_setup_wakekeys(kbc, true); | ||
666 | enable_irq_wake(kbc->irq); | ||
667 | /* Forcefully clear the interrupt status */ | ||
668 | writel(0x7, kbc->mmio + KBC_INT_0); | ||
669 | msleep(30); | ||
670 | } else { | ||
671 | mutex_lock(&kbc->idev->mutex); | ||
672 | if (kbc->idev->users) | ||
673 | tegra_kbc_stop(kbc); | ||
674 | mutex_unlock(&kbc->idev->mutex); | ||
675 | } | ||
676 | |||
677 | return 0; | ||
678 | } | ||
679 | |||
680 | static int tegra_kbc_resume(struct device *dev) | ||
681 | { | ||
682 | struct platform_device *pdev = to_platform_device(dev); | ||
683 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
684 | int err = 0; | ||
685 | |||
686 | if (device_may_wakeup(&pdev->dev)) { | ||
687 | disable_irq_wake(kbc->irq); | ||
688 | tegra_kbc_setup_wakekeys(kbc, false); | ||
689 | } else { | ||
690 | mutex_lock(&kbc->idev->mutex); | ||
691 | if (kbc->idev->users) | ||
692 | err = tegra_kbc_start(kbc); | ||
693 | mutex_unlock(&kbc->idev->mutex); | ||
694 | } | ||
695 | |||
696 | return err; | ||
697 | } | ||
698 | #endif | ||
699 | |||
700 | static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); | ||
701 | |||
702 | static struct platform_driver tegra_kbc_driver = { | ||
703 | .probe = tegra_kbc_probe, | ||
704 | .remove = __devexit_p(tegra_kbc_remove), | ||
705 | .driver = { | ||
706 | .name = "tegra-kbc", | ||
707 | .owner = THIS_MODULE, | ||
708 | .pm = &tegra_kbc_pm_ops, | ||
709 | }, | ||
710 | }; | ||
711 | |||
712 | static void __exit tegra_kbc_exit(void) | ||
713 | { | ||
714 | platform_driver_unregister(&tegra_kbc_driver); | ||
715 | } | ||
716 | module_exit(tegra_kbc_exit); | ||
717 | |||
718 | static int __init tegra_kbc_init(void) | ||
719 | { | ||
720 | return platform_driver_register(&tegra_kbc_driver); | ||
721 | } | ||
722 | module_init(tegra_kbc_init); | ||
723 | |||
724 | MODULE_LICENSE("GPL"); | ||
725 | MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>"); | ||
726 | MODULE_DESCRIPTION("Tegra matrix keyboard controller driver"); | ||
727 | MODULE_ALIAS("platform:tegra-kbc"); | ||
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index b4a81ebfab92..c8f097a15d89 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -219,9 +220,9 @@ static int __devinit keypad_probe(struct platform_device *pdev) | |||
219 | } | 220 | } |
220 | 221 | ||
221 | kp->clk = clk_get(dev, NULL); | 222 | kp->clk = clk_get(dev, NULL); |
222 | if (!kp->clk) { | 223 | if (IS_ERR(kp->clk)) { |
223 | dev_err(dev, "cannot claim device clock\n"); | 224 | dev_err(dev, "cannot claim device clock\n"); |
224 | error = -EINVAL; | 225 | error = PTR_ERR(kp->clk); |
225 | goto error_clk; | 226 | goto error_clk; |
226 | } | 227 | } |
227 | 228 | ||
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 9dfd6e5f786f..1f38302a5951 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -69,11 +69,7 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned | |||
69 | } | 69 | } |
70 | 70 | ||
71 | if (value > 20 && value < 32767) | 71 | if (value > 20 && value < 32767) |
72 | #ifndef FREQ | 72 | count = (IXP4XX_TIMER_FREQ / (value * 4)) - 1; |
73 | count = (ixp4xx_get_board_tick_rate() / (value * 4)) - 1; | ||
74 | #else | ||
75 | count = (FREQ / (value * 4)) - 1; | ||
76 | #endif | ||
77 | 73 | ||
78 | ixp4xx_spkr_control(pin, count); | 74 | ixp4xx_spkr_control(pin, count); |
79 | 75 | ||
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 1f8e0108962e..7e64d01da2be 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
@@ -176,7 +176,7 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
176 | 176 | ||
177 | /* request the IRQs */ | 177 | /* request the IRQs */ |
178 | err = request_irq(encoder->irq_a, &rotary_encoder_irq, | 178 | err = request_irq(encoder->irq_a, &rotary_encoder_irq, |
179 | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, | 179 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
180 | DRV_NAME, encoder); | 180 | DRV_NAME, encoder); |
181 | if (err) { | 181 | if (err) { |
182 | dev_err(&pdev->dev, "unable to request IRQ %d\n", | 182 | dev_err(&pdev->dev, "unable to request IRQ %d\n", |
@@ -185,7 +185,7 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | err = request_irq(encoder->irq_b, &rotary_encoder_irq, | 187 | err = request_irq(encoder->irq_b, &rotary_encoder_irq, |
188 | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, | 188 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
189 | DRV_NAME, encoder); | 189 | DRV_NAME, encoder); |
190 | if (err) { | 190 | if (err) { |
191 | dev_err(&pdev->dev, "unable to request IRQ %d\n", | 191 | dev_err(&pdev->dev, "unable to request IRQ %d\n", |
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/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 448c7724beb9..852816567241 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c | |||
@@ -111,9 +111,11 @@ static void ct82c710_close(struct serio *serio) | |||
111 | static int ct82c710_open(struct serio *serio) | 111 | static int ct82c710_open(struct serio *serio) |
112 | { | 112 | { |
113 | unsigned char status; | 113 | unsigned char status; |
114 | int err; | ||
114 | 115 | ||
115 | if (request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL)) | 116 | err = request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL); |
116 | return -1; | 117 | if (err) |
118 | return err; | ||
117 | 119 | ||
118 | status = inb_p(CT82C710_STATUS); | 120 | status = inb_p(CT82C710_STATUS); |
119 | 121 | ||
@@ -131,7 +133,7 @@ static int ct82c710_open(struct serio *serio) | |||
131 | status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); | 133 | status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); |
132 | outb_p(status, CT82C710_STATUS); | 134 | outb_p(status, CT82C710_STATUS); |
133 | free_irq(CT82C710_IRQ, NULL); | 135 | free_irq(CT82C710_IRQ, NULL); |
134 | return -1; | 136 | return -EBUSY; |
135 | } | 137 | } |
136 | 138 | ||
137 | return 0; | 139 | return 0; |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index db5b0bca1a1a..7c38d1fbabf2 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -188,7 +188,8 @@ static void serio_free_event(struct serio_event *event) | |||
188 | kfree(event); | 188 | kfree(event); |
189 | } | 189 | } |
190 | 190 | ||
191 | static void serio_remove_duplicate_events(struct serio_event *event) | 191 | static void serio_remove_duplicate_events(void *object, |
192 | enum serio_event_type type) | ||
192 | { | 193 | { |
193 | struct serio_event *e, *next; | 194 | struct serio_event *e, *next; |
194 | unsigned long flags; | 195 | unsigned long flags; |
@@ -196,13 +197,13 @@ static void serio_remove_duplicate_events(struct serio_event *event) | |||
196 | spin_lock_irqsave(&serio_event_lock, flags); | 197 | spin_lock_irqsave(&serio_event_lock, flags); |
197 | 198 | ||
198 | list_for_each_entry_safe(e, next, &serio_event_list, node) { | 199 | list_for_each_entry_safe(e, next, &serio_event_list, node) { |
199 | if (event->object == e->object) { | 200 | if (object == e->object) { |
200 | /* | 201 | /* |
201 | * If this event is of different type we should not | 202 | * If this event is of different type we should not |
202 | * look further - we only suppress duplicate events | 203 | * look further - we only suppress duplicate events |
203 | * that were sent back-to-back. | 204 | * that were sent back-to-back. |
204 | */ | 205 | */ |
205 | if (event->type != e->type) | 206 | if (type != e->type) |
206 | break; | 207 | break; |
207 | 208 | ||
208 | list_del_init(&e->node); | 209 | list_del_init(&e->node); |
@@ -245,7 +246,7 @@ static void serio_handle_event(struct work_struct *work) | |||
245 | break; | 246 | break; |
246 | } | 247 | } |
247 | 248 | ||
248 | serio_remove_duplicate_events(event); | 249 | serio_remove_duplicate_events(event->object, event->type); |
249 | serio_free_event(event); | 250 | serio_free_event(event); |
250 | } | 251 | } |
251 | 252 | ||
@@ -436,10 +437,12 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute * | |||
436 | } else if (!strncmp(buf, "rescan", count)) { | 437 | } else if (!strncmp(buf, "rescan", count)) { |
437 | serio_disconnect_port(serio); | 438 | serio_disconnect_port(serio); |
438 | serio_find_driver(serio); | 439 | serio_find_driver(serio); |
440 | serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT); | ||
439 | } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { | 441 | } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { |
440 | serio_disconnect_port(serio); | 442 | serio_disconnect_port(serio); |
441 | error = serio_bind_driver(serio, to_serio_driver(drv)); | 443 | error = serio_bind_driver(serio, to_serio_driver(drv)); |
442 | put_driver(drv); | 444 | put_driver(drv); |
445 | serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT); | ||
443 | } else { | 446 | } else { |
444 | error = -EINVAL; | 447 | error = -EINVAL; |
445 | } | 448 | } |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 6e362de3f412..8755f5f3ad37 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -116,14 +116,15 @@ static void serport_ldisc_close(struct tty_struct *tty) | |||
116 | 116 | ||
117 | /* | 117 | /* |
118 | * serport_ldisc_receive() is called by the low level tty driver when characters | 118 | * serport_ldisc_receive() is called by the low level tty driver when characters |
119 | * are ready for us. We forward the characters, one by one to the 'interrupt' | 119 | * are ready for us. We forward the characters and flags, one by one to the |
120 | * routine. | 120 | * 'interrupt' routine. |
121 | */ | 121 | */ |
122 | 122 | ||
123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) | 123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) |
124 | { | 124 | { |
125 | struct serport *serport = (struct serport*) tty->disc_data; | 125 | struct serport *serport = (struct serport*) tty->disc_data; |
126 | unsigned long flags; | 126 | unsigned long flags; |
127 | unsigned int ch_flags; | ||
127 | int i; | 128 | int i; |
128 | 129 | ||
129 | spin_lock_irqsave(&serport->lock, flags); | 130 | spin_lock_irqsave(&serport->lock, flags); |
@@ -131,8 +132,23 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c | |||
131 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) | 132 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) |
132 | goto out; | 133 | goto out; |
133 | 134 | ||
134 | for (i = 0; i < count; i++) | 135 | for (i = 0; i < count; i++) { |
135 | serio_interrupt(serport->serio, cp[i], 0); | 136 | switch (fp[i]) { |
137 | case TTY_FRAME: | ||
138 | ch_flags = SERIO_FRAME; | ||
139 | break; | ||
140 | |||
141 | case TTY_PARITY: | ||
142 | ch_flags = SERIO_PARITY; | ||
143 | break; | ||
144 | |||
145 | default: | ||
146 | ch_flags = 0; | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | serio_interrupt(serport->serio, cp[i], ch_flags); | ||
151 | } | ||
136 | 152 | ||
137 | out: | 153 | out: |
138 | spin_unlock_irqrestore(&serport->lock, flags); | 154 | spin_unlock_irqrestore(&serport->lock, flags); |
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c index a29a7812bd46..7729e547ba65 100644 --- a/drivers/input/sparse-keymap.c +++ b/drivers/input/sparse-keymap.c | |||
@@ -201,6 +201,7 @@ int sparse_keymap_setup(struct input_dev *dev, | |||
201 | break; | 201 | break; |
202 | 202 | ||
203 | case KE_SW: | 203 | case KE_SW: |
204 | case KE_VSW: | ||
204 | __set_bit(EV_SW, dev->evbit); | 205 | __set_bit(EV_SW, dev->evbit); |
205 | __set_bit(entry->sw.code, dev->swbit); | 206 | __set_bit(entry->sw.code, dev->swbit); |
206 | break; | 207 | break; |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index fc381498b798..cf8fb9f5d4a8 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -519,7 +519,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
519 | /* Retrieve the physical and logical size for OEM devices */ | 519 | /* Retrieve the physical and logical size for OEM devices */ |
520 | error = wacom_retrieve_hid_descriptor(intf, features); | 520 | error = wacom_retrieve_hid_descriptor(intf, features); |
521 | if (error) | 521 | if (error) |
522 | goto fail2; | 522 | goto fail3; |
523 | 523 | ||
524 | wacom_setup_device_quirks(features); | 524 | wacom_setup_device_quirks(features); |
525 | 525 | ||
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 518782999fea..367fa82a607e 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1101,6 +1101,13 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static unsigned int wacom_calculate_touch_res(unsigned int logical_max, | ||
1105 | unsigned int physical_max) | ||
1106 | { | ||
1107 | /* Touch physical dimensions are in 100th of mm */ | ||
1108 | return (logical_max * 100) / physical_max; | ||
1109 | } | ||
1110 | |||
1104 | void wacom_setup_input_capabilities(struct input_dev *input_dev, | 1111 | void wacom_setup_input_capabilities(struct input_dev *input_dev, |
1105 | struct wacom_wac *wacom_wac) | 1112 | struct wacom_wac *wacom_wac) |
1106 | { | 1113 | { |
@@ -1228,8 +1235,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1228 | case TABLETPC: | 1235 | case TABLETPC: |
1229 | if (features->device_type == BTN_TOOL_DOUBLETAP || | 1236 | if (features->device_type == BTN_TOOL_DOUBLETAP || |
1230 | features->device_type == BTN_TOOL_TRIPLETAP) { | 1237 | features->device_type == BTN_TOOL_TRIPLETAP) { |
1231 | input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); | 1238 | input_abs_set_res(input_dev, ABS_X, |
1232 | input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); | 1239 | wacom_calculate_touch_res(features->x_max, |
1240 | features->x_phy)); | ||
1241 | input_abs_set_res(input_dev, ABS_Y, | ||
1242 | wacom_calculate_touch_res(features->y_max, | ||
1243 | features->y_phy)); | ||
1233 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | 1244 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); |
1234 | } | 1245 | } |
1235 | 1246 | ||
@@ -1272,6 +1283,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1272 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, | 1283 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, |
1273 | 0, features->pressure_max, | 1284 | 0, features->pressure_max, |
1274 | features->pressure_fuzz, 0); | 1285 | features->pressure_fuzz, 0); |
1286 | input_abs_set_res(input_dev, ABS_X, | ||
1287 | wacom_calculate_touch_res(features->x_max, | ||
1288 | features->x_phy)); | ||
1289 | input_abs_set_res(input_dev, ABS_Y, | ||
1290 | wacom_calculate_touch_res(features->y_max, | ||
1291 | features->y_phy)); | ||
1275 | } else if (features->device_type == BTN_TOOL_PEN) { | 1292 | } else if (features->device_type == BTN_TOOL_PEN) { |
1276 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1293 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1277 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1294 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
@@ -1426,6 +1443,10 @@ static struct wacom_features wacom_features_0xD3 = | |||
1426 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1443 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1427 | static const struct wacom_features wacom_features_0xD4 = | 1444 | static const struct wacom_features wacom_features_0xD4 = |
1428 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; | 1445 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; |
1446 | static struct wacom_features wacom_features_0xD6 = | ||
1447 | { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1448 | static struct wacom_features wacom_features_0xD7 = | ||
1449 | { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1429 | static struct wacom_features wacom_features_0xD8 = | 1450 | static struct wacom_features wacom_features_0xD8 = |
1430 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1451 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1431 | static struct wacom_features wacom_features_0xDA = | 1452 | static struct wacom_features wacom_features_0xDA = |
@@ -1507,6 +1528,8 @@ const struct usb_device_id wacom_ids[] = { | |||
1507 | { USB_DEVICE_WACOM(0xD2) }, | 1528 | { USB_DEVICE_WACOM(0xD2) }, |
1508 | { USB_DEVICE_WACOM(0xD3) }, | 1529 | { USB_DEVICE_WACOM(0xD3) }, |
1509 | { USB_DEVICE_WACOM(0xD4) }, | 1530 | { USB_DEVICE_WACOM(0xD4) }, |
1531 | { USB_DEVICE_WACOM(0xD6) }, | ||
1532 | { USB_DEVICE_WACOM(0xD7) }, | ||
1510 | { USB_DEVICE_WACOM(0xD8) }, | 1533 | { USB_DEVICE_WACOM(0xD8) }, |
1511 | { USB_DEVICE_WACOM(0xDA) }, | 1534 | { USB_DEVICE_WACOM(0xDA) }, |
1512 | { USB_DEVICE_WACOM(0xDB) }, | 1535 | { USB_DEVICE_WACOM(0xDB) }, |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 14ea54b78e46..4bf2316e3284 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -941,28 +941,29 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 | |||
941 | struct ads7846_platform_data *pdata = spi->dev.platform_data; | 941 | struct ads7846_platform_data *pdata = spi->dev.platform_data; |
942 | int err; | 942 | int err; |
943 | 943 | ||
944 | /* REVISIT when the irq can be triggered active-low, or if for some | 944 | /* |
945 | * REVISIT when the irq can be triggered active-low, or if for some | ||
945 | * reason the touchscreen isn't hooked up, we don't need to access | 946 | * reason the touchscreen isn't hooked up, we don't need to access |
946 | * the pendown state. | 947 | * the pendown state. |
947 | */ | 948 | */ |
948 | if (!pdata->get_pendown_state && !gpio_is_valid(pdata->gpio_pendown)) { | ||
949 | dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); | ||
950 | return -EINVAL; | ||
951 | } | ||
952 | 949 | ||
953 | if (pdata->get_pendown_state) { | 950 | if (pdata->get_pendown_state) { |
954 | ts->get_pendown_state = pdata->get_pendown_state; | 951 | ts->get_pendown_state = pdata->get_pendown_state; |
955 | return 0; | 952 | } else if (gpio_is_valid(pdata->gpio_pendown)) { |
956 | } | ||
957 | 953 | ||
958 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); | 954 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); |
959 | if (err) { | 955 | if (err) { |
960 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", | 956 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", |
961 | pdata->gpio_pendown); | 957 | pdata->gpio_pendown); |
962 | return err; | 958 | return err; |
963 | } | 959 | } |
964 | 960 | ||
965 | ts->gpio_pendown = pdata->gpio_pendown; | 961 | ts->gpio_pendown = pdata->gpio_pendown; |
962 | |||
963 | } else { | ||
964 | dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); | ||
965 | return -EINVAL; | ||
966 | } | ||
966 | 967 | ||
967 | return 0; | 968 | return 0; |
968 | } | 969 | } |
@@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1353 | err_put_regulator: | 1354 | err_put_regulator: |
1354 | regulator_put(ts->reg); | 1355 | regulator_put(ts->reg); |
1355 | err_free_gpio: | 1356 | err_free_gpio: |
1356 | if (ts->gpio_pendown != -1) | 1357 | if (!ts->get_pendown_state) |
1357 | gpio_free(ts->gpio_pendown); | 1358 | gpio_free(ts->gpio_pendown); |
1358 | err_cleanup_filter: | 1359 | err_cleanup_filter: |
1359 | if (ts->filter_cleanup) | 1360 | if (ts->filter_cleanup) |
@@ -1383,8 +1384,13 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
1383 | regulator_disable(ts->reg); | 1384 | regulator_disable(ts->reg); |
1384 | regulator_put(ts->reg); | 1385 | regulator_put(ts->reg); |
1385 | 1386 | ||
1386 | if (ts->gpio_pendown != -1) | 1387 | if (!ts->get_pendown_state) { |
1388 | /* | ||
1389 | * If we are not using specialized pendown method we must | ||
1390 | * have been relying on gpio we set up ourselves. | ||
1391 | */ | ||
1387 | gpio_free(ts->gpio_pendown); | 1392 | gpio_free(ts->gpio_pendown); |
1393 | } | ||
1388 | 1394 | ||
1389 | if (ts->filter_cleanup) | 1395 | if (ts->filter_cleanup) |
1390 | ts->filter_cleanup(ts->filter_data); | 1396 | ts->filter_cleanup(ts->filter_data); |
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index f7fa9ef4cd65..1507ce108d5b 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/input.h> | 12 | #include <linux/input.h> |
13 | #include <linux/input/bu21013.h> | 13 | #include <linux/input/bu21013.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/regulator/consumer.h> | ||
15 | 16 | ||
16 | #define PEN_DOWN_INTR 0 | 17 | #define PEN_DOWN_INTR 0 |
17 | #define MAX_FINGERS 2 | 18 | #define MAX_FINGERS 2 |
@@ -139,6 +140,7 @@ | |||
139 | * @chip: pointer to the touch panel controller | 140 | * @chip: pointer to the touch panel controller |
140 | * @in_dev: pointer to the input device structure | 141 | * @in_dev: pointer to the input device structure |
141 | * @intr_pin: interrupt pin value | 142 | * @intr_pin: interrupt pin value |
143 | * @regulator: pointer to the Regulator used for touch screen | ||
142 | * | 144 | * |
143 | * Touch panel device data structure | 145 | * Touch panel device data structure |
144 | */ | 146 | */ |
@@ -149,6 +151,7 @@ struct bu21013_ts_data { | |||
149 | const struct bu21013_platform_device *chip; | 151 | const struct bu21013_platform_device *chip; |
150 | struct input_dev *in_dev; | 152 | struct input_dev *in_dev; |
151 | unsigned int intr_pin; | 153 | unsigned int intr_pin; |
154 | struct regulator *regulator; | ||
152 | }; | 155 | }; |
153 | 156 | ||
154 | /** | 157 | /** |
@@ -456,6 +459,20 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
456 | bu21013_data->in_dev = in_dev; | 459 | bu21013_data->in_dev = in_dev; |
457 | bu21013_data->chip = pdata; | 460 | bu21013_data->chip = pdata; |
458 | bu21013_data->client = client; | 461 | bu21013_data->client = client; |
462 | |||
463 | bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH"); | ||
464 | if (IS_ERR(bu21013_data->regulator)) { | ||
465 | dev_err(&client->dev, "regulator_get failed\n"); | ||
466 | error = PTR_ERR(bu21013_data->regulator); | ||
467 | goto err_free_mem; | ||
468 | } | ||
469 | |||
470 | error = regulator_enable(bu21013_data->regulator); | ||
471 | if (error < 0) { | ||
472 | dev_err(&client->dev, "regulator enable failed\n"); | ||
473 | goto err_put_regulator; | ||
474 | } | ||
475 | |||
459 | bu21013_data->touch_stopped = false; | 476 | bu21013_data->touch_stopped = false; |
460 | init_waitqueue_head(&bu21013_data->wait); | 477 | init_waitqueue_head(&bu21013_data->wait); |
461 | 478 | ||
@@ -464,7 +481,7 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
464 | error = pdata->cs_en(pdata->cs_pin); | 481 | error = pdata->cs_en(pdata->cs_pin); |
465 | if (error < 0) { | 482 | if (error < 0) { |
466 | dev_err(&client->dev, "chip init failed\n"); | 483 | dev_err(&client->dev, "chip init failed\n"); |
467 | goto err_free_mem; | 484 | goto err_disable_regulator; |
468 | } | 485 | } |
469 | } | 486 | } |
470 | 487 | ||
@@ -485,9 +502,9 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
485 | __set_bit(EV_ABS, in_dev->evbit); | 502 | __set_bit(EV_ABS, in_dev->evbit); |
486 | 503 | ||
487 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, | 504 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, |
488 | pdata->x_max_res, 0, 0); | 505 | pdata->touch_x_max, 0, 0); |
489 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, | 506 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, |
490 | pdata->y_max_res, 0, 0); | 507 | pdata->touch_y_max, 0, 0); |
491 | input_set_drvdata(in_dev, bu21013_data); | 508 | input_set_drvdata(in_dev, bu21013_data); |
492 | 509 | ||
493 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 510 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, |
@@ -513,6 +530,10 @@ err_free_irq: | |||
513 | bu21013_free_irq(bu21013_data); | 530 | bu21013_free_irq(bu21013_data); |
514 | err_cs_disable: | 531 | err_cs_disable: |
515 | pdata->cs_dis(pdata->cs_pin); | 532 | pdata->cs_dis(pdata->cs_pin); |
533 | err_disable_regulator: | ||
534 | regulator_disable(bu21013_data->regulator); | ||
535 | err_put_regulator: | ||
536 | regulator_put(bu21013_data->regulator); | ||
516 | err_free_mem: | 537 | err_free_mem: |
517 | input_free_device(in_dev); | 538 | input_free_device(in_dev); |
518 | kfree(bu21013_data); | 539 | kfree(bu21013_data); |
@@ -535,6 +556,10 @@ static int __devexit bu21013_remove(struct i2c_client *client) | |||
535 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); | 556 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); |
536 | 557 | ||
537 | input_unregister_device(bu21013_data->in_dev); | 558 | input_unregister_device(bu21013_data->in_dev); |
559 | |||
560 | regulator_disable(bu21013_data->regulator); | ||
561 | regulator_put(bu21013_data->regulator); | ||
562 | |||
538 | kfree(bu21013_data); | 563 | kfree(bu21013_data); |
539 | 564 | ||
540 | device_init_wakeup(&client->dev, false); | 565 | device_init_wakeup(&client->dev, false); |
@@ -561,6 +586,8 @@ static int bu21013_suspend(struct device *dev) | |||
561 | else | 586 | else |
562 | disable_irq(bu21013_data->chip->irq); | 587 | disable_irq(bu21013_data->chip->irq); |
563 | 588 | ||
589 | regulator_disable(bu21013_data->regulator); | ||
590 | |||
564 | return 0; | 591 | return 0; |
565 | } | 592 | } |
566 | 593 | ||
@@ -577,6 +604,12 @@ static int bu21013_resume(struct device *dev) | |||
577 | struct i2c_client *client = bu21013_data->client; | 604 | struct i2c_client *client = bu21013_data->client; |
578 | int retval; | 605 | int retval; |
579 | 606 | ||
607 | retval = regulator_enable(bu21013_data->regulator); | ||
608 | if (retval < 0) { | ||
609 | dev_err(&client->dev, "bu21013 regulator enable failed\n"); | ||
610 | return retval; | ||
611 | } | ||
612 | |||
580 | retval = bu21013_init_chip(bu21013_data); | 613 | retval = bu21013_init_chip(bu21013_data); |
581 | if (retval < 0) { | 614 | if (retval < 0) { |
582 | dev_err(&client->dev, "bu21013 controller config failed\n"); | 615 | dev_err(&client->dev, "bu21013 controller config failed\n"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index cf1dba2e267c..22a3411e93c5 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -289,9 +290,9 @@ static int __devinit tsc_probe(struct platform_device *pdev) | |||
289 | } | 290 | } |
290 | 291 | ||
291 | ts->clk = clk_get(dev, NULL); | 292 | ts->clk = clk_get(dev, NULL); |
292 | if (!ts->clk) { | 293 | if (IS_ERR(ts->clk)) { |
293 | dev_err(dev, "cannot claim device clock\n"); | 294 | dev_err(dev, "cannot claim device clock\n"); |
294 | error = -EINVAL; | 295 | error = PTR_ERR(ts->clk); |
295 | goto error_clk; | 296 | goto error_clk; |
296 | } | 297 | } |
297 | 298 | ||
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 5cb8449c909d..c14412ef4648 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
@@ -51,6 +51,10 @@ MODULE_LICENSE("GPL"); | |||
51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ | 51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ |
52 | #define W8001_PKTLEN_TOUCH2FG 13 | 52 | #define W8001_PKTLEN_TOUCH2FG 13 |
53 | 53 | ||
54 | /* resolution in points/mm */ | ||
55 | #define W8001_PEN_RESOLUTION 100 | ||
56 | #define W8001_TOUCH_RESOLUTION 10 | ||
57 | |||
54 | struct w8001_coord { | 58 | struct w8001_coord { |
55 | u8 rdy; | 59 | u8 rdy; |
56 | u8 tsw; | 60 | u8 tsw; |
@@ -198,7 +202,7 @@ static void parse_touchquery(u8 *data, struct w8001_touch_query *query) | |||
198 | query->y = 1024; | 202 | query->y = 1024; |
199 | if (query->panel_res) | 203 | if (query->panel_res) |
200 | query->x = query->y = (1 << query->panel_res); | 204 | query->x = query->y = (1 << query->panel_res); |
201 | query->panel_res = 10; | 205 | query->panel_res = W8001_TOUCH_RESOLUTION; |
202 | } | 206 | } |
203 | } | 207 | } |
204 | 208 | ||
@@ -394,6 +398,8 @@ static int w8001_setup(struct w8001 *w8001) | |||
394 | 398 | ||
395 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); | 399 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); |
396 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); | 400 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); |
401 | input_abs_set_res(dev, ABS_X, W8001_PEN_RESOLUTION); | ||
402 | input_abs_set_res(dev, ABS_Y, W8001_PEN_RESOLUTION); | ||
397 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); | 403 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); |
398 | if (coord.tilt_x && coord.tilt_y) { | 404 | if (coord.tilt_x && coord.tilt_y) { |
399 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); | 405 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); |
@@ -418,14 +424,17 @@ static int w8001_setup(struct w8001 *w8001) | |||
418 | w8001->max_touch_x = touch.x; | 424 | w8001->max_touch_x = touch.x; |
419 | w8001->max_touch_y = touch.y; | 425 | w8001->max_touch_y = touch.y; |
420 | 426 | ||
421 | /* scale to pen maximum */ | ||
422 | if (w8001->max_pen_x && w8001->max_pen_y) { | 427 | if (w8001->max_pen_x && w8001->max_pen_y) { |
428 | /* if pen is supported scale to pen maximum */ | ||
423 | touch.x = w8001->max_pen_x; | 429 | touch.x = w8001->max_pen_x; |
424 | touch.y = w8001->max_pen_y; | 430 | touch.y = w8001->max_pen_y; |
431 | touch.panel_res = W8001_PEN_RESOLUTION; | ||
425 | } | 432 | } |
426 | 433 | ||
427 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); | 434 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); |
428 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); | 435 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); |
436 | input_abs_set_res(dev, ABS_X, touch.panel_res); | ||
437 | input_abs_set_res(dev, ABS_Y, touch.panel_res); | ||
429 | 438 | ||
430 | switch (touch.sensor_id) { | 439 | switch (touch.sensor_id) { |
431 | case 0: | 440 | case 0: |
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index 0858791978d8..cfff0c41d298 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c | |||
@@ -1247,10 +1247,10 @@ static void | |||
1247 | l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | 1247 | l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) |
1248 | { | 1248 | { |
1249 | struct PStack *st = fi->userdata; | 1249 | struct PStack *st = fi->userdata; |
1250 | struct sk_buff *skb, *oskb; | 1250 | struct sk_buff *skb; |
1251 | struct Layer2 *l2 = &st->l2; | 1251 | struct Layer2 *l2 = &st->l2; |
1252 | u_char header[MAX_HEADER_LEN]; | 1252 | u_char header[MAX_HEADER_LEN]; |
1253 | int i; | 1253 | int i, hdr_space_needed; |
1254 | int unsigned p1; | 1254 | int unsigned p1; |
1255 | u_long flags; | 1255 | u_long flags; |
1256 | 1256 | ||
@@ -1261,6 +1261,16 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1261 | if (!skb) | 1261 | if (!skb) |
1262 | return; | 1262 | return; |
1263 | 1263 | ||
1264 | hdr_space_needed = l2headersize(l2, 0); | ||
1265 | if (hdr_space_needed > skb_headroom(skb)) { | ||
1266 | struct sk_buff *orig_skb = skb; | ||
1267 | |||
1268 | skb = skb_realloc_headroom(skb, hdr_space_needed); | ||
1269 | if (!skb) { | ||
1270 | dev_kfree_skb(orig_skb); | ||
1271 | return; | ||
1272 | } | ||
1273 | } | ||
1264 | spin_lock_irqsave(&l2->lock, flags); | 1274 | spin_lock_irqsave(&l2->lock, flags); |
1265 | if(test_bit(FLG_MOD128, &l2->flag)) | 1275 | if(test_bit(FLG_MOD128, &l2->flag)) |
1266 | p1 = (l2->vs - l2->va) % 128; | 1276 | p1 = (l2->vs - l2->va) % 128; |
@@ -1285,19 +1295,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1285 | l2->vs = (l2->vs + 1) % 8; | 1295 | l2->vs = (l2->vs + 1) % 8; |
1286 | } | 1296 | } |
1287 | spin_unlock_irqrestore(&l2->lock, flags); | 1297 | spin_unlock_irqrestore(&l2->lock, flags); |
1288 | p1 = skb->data - skb->head; | 1298 | memcpy(skb_push(skb, i), header, i); |
1289 | if (p1 >= i) | ||
1290 | memcpy(skb_push(skb, i), header, i); | ||
1291 | else { | ||
1292 | printk(KERN_WARNING | ||
1293 | "isdl2 pull_iqueue skb header(%d/%d) too short\n", i, p1); | ||
1294 | oskb = skb; | ||
1295 | skb = alloc_skb(oskb->len + i, GFP_ATOMIC); | ||
1296 | memcpy(skb_put(skb, i), header, i); | ||
1297 | skb_copy_from_linear_data(oskb, | ||
1298 | skb_put(skb, oskb->len), oskb->len); | ||
1299 | dev_kfree_skb(oskb); | ||
1300 | } | ||
1301 | st->l2.l2l1(st, PH_PULL | INDICATION, skb); | 1299 | st->l2.l2l1(st, PH_PULL | INDICATION, skb); |
1302 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); | 1300 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); |
1303 | if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) { | 1301 | if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) { |
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h index 729df4089385..18b801ad97a4 100644 --- a/drivers/isdn/hysdn/hysdn_defs.h +++ b/drivers/isdn/hysdn/hysdn_defs.h | |||
@@ -227,7 +227,6 @@ extern hysdn_card *card_root; /* pointer to first card */ | |||
227 | /*************************/ | 227 | /*************************/ |
228 | /* im/exported functions */ | 228 | /* im/exported functions */ |
229 | /*************************/ | 229 | /*************************/ |
230 | extern char *hysdn_getrev(const char *); | ||
231 | 230 | ||
232 | /* hysdn_procconf.c */ | 231 | /* hysdn_procconf.c */ |
233 | extern int hysdn_procconf_init(void); /* init proc config filesys */ | 232 | extern int hysdn_procconf_init(void); /* init proc config filesys */ |
@@ -259,7 +258,6 @@ extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *, | |||
259 | 258 | ||
260 | /* hysdn_net.c */ | 259 | /* hysdn_net.c */ |
261 | extern unsigned int hynet_enable; | 260 | extern unsigned int hynet_enable; |
262 | extern char *hysdn_net_revision; | ||
263 | extern int hysdn_net_create(hysdn_card *); /* create a new net device */ | 261 | extern int hysdn_net_create(hysdn_card *); /* create a new net device */ |
264 | extern int hysdn_net_release(hysdn_card *); /* delete the device */ | 262 | extern int hysdn_net_release(hysdn_card *); /* delete the device */ |
265 | extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ | 263 | extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ |
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index b7cc5c2f08c6..0ab42ace1692 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c | |||
@@ -36,7 +36,6 @@ MODULE_DESCRIPTION("ISDN4Linux: Driver for HYSDN cards"); | |||
36 | MODULE_AUTHOR("Werner Cornelius"); | 36 | MODULE_AUTHOR("Werner Cornelius"); |
37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
38 | 38 | ||
39 | static char *hysdn_init_revision = "$Revision: 1.6.6.6 $"; | ||
40 | static int cardmax; /* number of found cards */ | 39 | static int cardmax; /* number of found cards */ |
41 | hysdn_card *card_root = NULL; /* pointer to first card */ | 40 | hysdn_card *card_root = NULL; /* pointer to first card */ |
42 | static hysdn_card *card_last = NULL; /* pointer to first card */ | 41 | static hysdn_card *card_last = NULL; /* pointer to first card */ |
@@ -49,25 +48,6 @@ static hysdn_card *card_last = NULL; /* pointer to first card */ | |||
49 | /* Additionally newer versions may be activated without rebooting. */ | 48 | /* Additionally newer versions may be activated without rebooting. */ |
50 | /****************************************************************************/ | 49 | /****************************************************************************/ |
51 | 50 | ||
52 | /******************************************************/ | ||
53 | /* extract revision number from string for log output */ | ||
54 | /******************************************************/ | ||
55 | char * | ||
56 | hysdn_getrev(const char *revision) | ||
57 | { | ||
58 | char *rev; | ||
59 | char *p; | ||
60 | |||
61 | if ((p = strchr(revision, ':'))) { | ||
62 | rev = p + 2; | ||
63 | p = strchr(rev, '$'); | ||
64 | *--p = 0; | ||
65 | } else | ||
66 | rev = "???"; | ||
67 | return rev; | ||
68 | } | ||
69 | |||
70 | |||
71 | /****************************************************************************/ | 51 | /****************************************************************************/ |
72 | /* init_module is called once when the module is loaded to do all necessary */ | 52 | /* init_module is called once when the module is loaded to do all necessary */ |
73 | /* things like autodetect... */ | 53 | /* things like autodetect... */ |
@@ -175,13 +155,9 @@ static int hysdn_have_procfs; | |||
175 | static int __init | 155 | static int __init |
176 | hysdn_init(void) | 156 | hysdn_init(void) |
177 | { | 157 | { |
178 | char tmp[50]; | ||
179 | int rc; | 158 | int rc; |
180 | 159 | ||
181 | strcpy(tmp, hysdn_init_revision); | 160 | printk(KERN_NOTICE "HYSDN: module loaded\n"); |
182 | printk(KERN_NOTICE "HYSDN: module Rev: %s loaded\n", hysdn_getrev(tmp)); | ||
183 | strcpy(tmp, hysdn_net_revision); | ||
184 | printk(KERN_NOTICE "HYSDN: network interface Rev: %s \n", hysdn_getrev(tmp)); | ||
185 | 161 | ||
186 | rc = pci_register_driver(&hysdn_pci_driver); | 162 | rc = pci_register_driver(&hysdn_pci_driver); |
187 | if (rc) | 163 | if (rc) |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index feec8d89d719..11f2cce26005 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -26,9 +26,6 @@ | |||
26 | unsigned int hynet_enable = 0xffffffff; | 26 | unsigned int hynet_enable = 0xffffffff; |
27 | module_param(hynet_enable, uint, 0); | 27 | module_param(hynet_enable, uint, 0); |
28 | 28 | ||
29 | /* store the actual version for log reporting */ | ||
30 | char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; | ||
31 | |||
32 | #define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */ | 29 | #define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */ |
33 | 30 | ||
34 | /****************************************************************************/ | 31 | /****************************************************************************/ |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 96b3e39c3356..5fe83bd42061 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "hysdn_defs.h" | 23 | #include "hysdn_defs.h" |
24 | 24 | ||
25 | static DEFINE_MUTEX(hysdn_conf_mutex); | 25 | static DEFINE_MUTEX(hysdn_conf_mutex); |
26 | static char *hysdn_procconf_revision = "$Revision: 1.8.6.4 $"; | ||
27 | 26 | ||
28 | #define INFO_OUT_LEN 80 /* length of info line including lf */ | 27 | #define INFO_OUT_LEN 80 /* length of info line including lf */ |
29 | 28 | ||
@@ -404,7 +403,7 @@ hysdn_procconf_init(void) | |||
404 | card = card->next; /* next entry */ | 403 | card = card->next; /* next entry */ |
405 | } | 404 | } |
406 | 405 | ||
407 | printk(KERN_NOTICE "HYSDN: procfs Rev. %s initialised\n", hysdn_getrev(hysdn_procconf_revision)); | 406 | printk(KERN_NOTICE "HYSDN: procfs initialised\n"); |
408 | return (0); | 407 | return (0); |
409 | } /* hysdn_procconf_init */ | 408 | } /* hysdn_procconf_init */ |
410 | 409 | ||
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index da3fa8dcdf5b..666daf77872e 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c | |||
@@ -69,6 +69,7 @@ static int led_pwm_probe(struct platform_device *pdev) | |||
69 | led_dat->pwm = pwm_request(cur_led->pwm_id, | 69 | led_dat->pwm = pwm_request(cur_led->pwm_id, |
70 | cur_led->name); | 70 | cur_led->name); |
71 | if (IS_ERR(led_dat->pwm)) { | 71 | if (IS_ERR(led_dat->pwm)) { |
72 | ret = PTR_ERR(led_dat->pwm); | ||
72 | dev_err(&pdev->dev, "unable to request PWM %d\n", | 73 | dev_err(&pdev->dev, "unable to request PWM %d\n", |
73 | cur_led->pwm_id); | 74 | cur_led->pwm_id); |
74 | goto err; | 75 | goto err; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b76cfc89e1b5..0cc30ecda4c1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -287,6 +287,7 @@ static int md_make_request(struct request_queue *q, struct bio *bio) | |||
287 | mddev_t *mddev = q->queuedata; | 287 | mddev_t *mddev = q->queuedata; |
288 | int rv; | 288 | int rv; |
289 | int cpu; | 289 | int cpu; |
290 | unsigned int sectors; | ||
290 | 291 | ||
291 | if (mddev == NULL || mddev->pers == NULL | 292 | if (mddev == NULL || mddev->pers == NULL |
292 | || !mddev->ready) { | 293 | || !mddev->ready) { |
@@ -311,12 +312,16 @@ static int md_make_request(struct request_queue *q, struct bio *bio) | |||
311 | atomic_inc(&mddev->active_io); | 312 | atomic_inc(&mddev->active_io); |
312 | rcu_read_unlock(); | 313 | rcu_read_unlock(); |
313 | 314 | ||
315 | /* | ||
316 | * save the sectors now since our bio can | ||
317 | * go away inside make_request | ||
318 | */ | ||
319 | sectors = bio_sectors(bio); | ||
314 | rv = mddev->pers->make_request(mddev, bio); | 320 | rv = mddev->pers->make_request(mddev, bio); |
315 | 321 | ||
316 | cpu = part_stat_lock(); | 322 | cpu = part_stat_lock(); |
317 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); | 323 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); |
318 | part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], | 324 | part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors); |
319 | bio_sectors(bio)); | ||
320 | part_stat_unlock(); | 325 | part_stat_unlock(); |
321 | 326 | ||
322 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) | 327 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) |
@@ -1947,8 +1952,6 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared) | |||
1947 | __bdevname(dev, b)); | 1952 | __bdevname(dev, b)); |
1948 | return PTR_ERR(bdev); | 1953 | return PTR_ERR(bdev); |
1949 | } | 1954 | } |
1950 | if (!shared) | ||
1951 | set_bit(AllReserved, &rdev->flags); | ||
1952 | rdev->bdev = bdev; | 1955 | rdev->bdev = bdev; |
1953 | return err; | 1956 | return err; |
1954 | } | 1957 | } |
@@ -2465,6 +2468,9 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2465 | if (rdev->raid_disk != -1) | 2468 | if (rdev->raid_disk != -1) |
2466 | return -EBUSY; | 2469 | return -EBUSY; |
2467 | 2470 | ||
2471 | if (test_bit(MD_RECOVERY_RUNNING, &rdev->mddev->recovery)) | ||
2472 | return -EBUSY; | ||
2473 | |||
2468 | if (rdev->mddev->pers->hot_add_disk == NULL) | 2474 | if (rdev->mddev->pers->hot_add_disk == NULL) |
2469 | return -EINVAL; | 2475 | return -EINVAL; |
2470 | 2476 | ||
@@ -2610,12 +2616,11 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2610 | 2616 | ||
2611 | mddev_lock(mddev); | 2617 | mddev_lock(mddev); |
2612 | list_for_each_entry(rdev2, &mddev->disks, same_set) | 2618 | list_for_each_entry(rdev2, &mddev->disks, same_set) |
2613 | if (test_bit(AllReserved, &rdev2->flags) || | 2619 | if (rdev->bdev == rdev2->bdev && |
2614 | (rdev->bdev == rdev2->bdev && | 2620 | rdev != rdev2 && |
2615 | rdev != rdev2 && | 2621 | overlaps(rdev->data_offset, rdev->sectors, |
2616 | overlaps(rdev->data_offset, rdev->sectors, | 2622 | rdev2->data_offset, |
2617 | rdev2->data_offset, | 2623 | rdev2->sectors)) { |
2618 | rdev2->sectors))) { | ||
2619 | overlap = 1; | 2624 | overlap = 1; |
2620 | break; | 2625 | break; |
2621 | } | 2626 | } |
@@ -5578,6 +5583,8 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks) | |||
5578 | mddev->delta_disks = raid_disks - mddev->raid_disks; | 5583 | mddev->delta_disks = raid_disks - mddev->raid_disks; |
5579 | 5584 | ||
5580 | rv = mddev->pers->check_reshape(mddev); | 5585 | rv = mddev->pers->check_reshape(mddev); |
5586 | if (rv < 0) | ||
5587 | mddev->delta_disks = 0; | ||
5581 | return rv; | 5588 | return rv; |
5582 | } | 5589 | } |
5583 | 5590 | ||
@@ -6985,9 +6992,6 @@ void md_do_sync(mddev_t *mddev) | |||
6985 | } else if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) | 6992 | } else if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
6986 | mddev->resync_min = mddev->curr_resync_completed; | 6993 | mddev->resync_min = mddev->curr_resync_completed; |
6987 | mddev->curr_resync = 0; | 6994 | mddev->curr_resync = 0; |
6988 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) | ||
6989 | mddev->curr_resync_completed = 0; | ||
6990 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
6991 | wake_up(&resync_wait); | 6995 | wake_up(&resync_wait); |
6992 | set_bit(MD_RECOVERY_DONE, &mddev->recovery); | 6996 | set_bit(MD_RECOVERY_DONE, &mddev->recovery); |
6993 | md_wakeup_thread(mddev->thread); | 6997 | md_wakeup_thread(mddev->thread); |
@@ -7028,7 +7032,7 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
7028 | } | 7032 | } |
7029 | } | 7033 | } |
7030 | 7034 | ||
7031 | if (mddev->degraded && ! mddev->ro && !mddev->recovery_disabled) { | 7035 | if (mddev->degraded && !mddev->recovery_disabled) { |
7032 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 7036 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
7033 | if (rdev->raid_disk >= 0 && | 7037 | if (rdev->raid_disk >= 0 && |
7034 | !test_bit(In_sync, &rdev->flags) && | 7038 | !test_bit(In_sync, &rdev->flags) && |
@@ -7151,7 +7155,20 @@ void md_check_recovery(mddev_t *mddev) | |||
7151 | /* Only thing we do on a ro array is remove | 7155 | /* Only thing we do on a ro array is remove |
7152 | * failed devices. | 7156 | * failed devices. |
7153 | */ | 7157 | */ |
7154 | remove_and_add_spares(mddev); | 7158 | mdk_rdev_t *rdev; |
7159 | list_for_each_entry(rdev, &mddev->disks, same_set) | ||
7160 | if (rdev->raid_disk >= 0 && | ||
7161 | !test_bit(Blocked, &rdev->flags) && | ||
7162 | test_bit(Faulty, &rdev->flags) && | ||
7163 | atomic_read(&rdev->nr_pending)==0) { | ||
7164 | if (mddev->pers->hot_remove_disk( | ||
7165 | mddev, rdev->raid_disk)==0) { | ||
7166 | char nm[20]; | ||
7167 | sprintf(nm,"rd%d", rdev->raid_disk); | ||
7168 | sysfs_remove_link(&mddev->kobj, nm); | ||
7169 | rdev->raid_disk = -1; | ||
7170 | } | ||
7171 | } | ||
7155 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 7172 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
7156 | goto unlock; | 7173 | goto unlock; |
7157 | } | 7174 | } |
diff --git a/drivers/md/md.h b/drivers/md/md.h index eec517ced31a..7e90b8593b2a 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -93,8 +93,6 @@ struct mdk_rdev_s | |||
93 | #define Faulty 1 /* device is known to have a fault */ | 93 | #define Faulty 1 /* device is known to have a fault */ |
94 | #define In_sync 2 /* device is in_sync with rest of array */ | 94 | #define In_sync 2 /* device is in_sync with rest of array */ |
95 | #define WriteMostly 4 /* Avoid reading if at all possible */ | 95 | #define WriteMostly 4 /* Avoid reading if at all possible */ |
96 | #define AllReserved 6 /* If whole device is reserved for | ||
97 | * one array */ | ||
98 | #define AutoDetected 7 /* added by auto-detect */ | 96 | #define AutoDetected 7 /* added by auto-detect */ |
99 | #define Blocked 8 /* An error occured on an externally | 97 | #define Blocked 8 /* An error occured on an externally |
100 | * managed array, don't allow writes | 98 | * managed array, don't allow writes |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index a39f4c355e55..637a96855edb 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -179,6 +179,14 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
179 | rdev1->new_raid_disk = j; | 179 | rdev1->new_raid_disk = j; |
180 | } | 180 | } |
181 | 181 | ||
182 | if (mddev->level == 1) { | ||
183 | /* taiking over a raid1 array- | ||
184 | * we have only one active disk | ||
185 | */ | ||
186 | j = 0; | ||
187 | rdev1->new_raid_disk = j; | ||
188 | } | ||
189 | |||
182 | if (j < 0 || j >= mddev->raid_disks) { | 190 | if (j < 0 || j >= mddev->raid_disks) { |
183 | printk(KERN_ERR "md/raid0:%s: bad disk number %d - " | 191 | printk(KERN_ERR "md/raid0:%s: bad disk number %d - " |
184 | "aborting!\n", mdname(mddev), j); | 192 | "aborting!\n", mdname(mddev), j); |
@@ -644,12 +652,38 @@ static void *raid0_takeover_raid10(mddev_t *mddev) | |||
644 | return priv_conf; | 652 | return priv_conf; |
645 | } | 653 | } |
646 | 654 | ||
655 | static void *raid0_takeover_raid1(mddev_t *mddev) | ||
656 | { | ||
657 | raid0_conf_t *priv_conf; | ||
658 | |||
659 | /* Check layout: | ||
660 | * - (N - 1) mirror drives must be already faulty | ||
661 | */ | ||
662 | if ((mddev->raid_disks - 1) != mddev->degraded) { | ||
663 | printk(KERN_ERR "md/raid0:%s: (N - 1) mirrors drives must be already faulty!\n", | ||
664 | mdname(mddev)); | ||
665 | return ERR_PTR(-EINVAL); | ||
666 | } | ||
667 | |||
668 | /* Set new parameters */ | ||
669 | mddev->new_level = 0; | ||
670 | mddev->new_layout = 0; | ||
671 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ | ||
672 | mddev->delta_disks = 1 - mddev->raid_disks; | ||
673 | /* make sure it will be not marked as dirty */ | ||
674 | mddev->recovery_cp = MaxSector; | ||
675 | |||
676 | create_strip_zones(mddev, &priv_conf); | ||
677 | return priv_conf; | ||
678 | } | ||
679 | |||
647 | static void *raid0_takeover(mddev_t *mddev) | 680 | static void *raid0_takeover(mddev_t *mddev) |
648 | { | 681 | { |
649 | /* raid0 can take over: | 682 | /* raid0 can take over: |
650 | * raid4 - if all data disks are active. | 683 | * raid4 - if all data disks are active. |
651 | * raid5 - providing it is Raid4 layout and one disk is faulty | 684 | * raid5 - providing it is Raid4 layout and one disk is faulty |
652 | * raid10 - assuming we have all necessary active disks | 685 | * raid10 - assuming we have all necessary active disks |
686 | * raid1 - with (N -1) mirror drives faulty | ||
653 | */ | 687 | */ |
654 | if (mddev->level == 4) | 688 | if (mddev->level == 4) |
655 | return raid0_takeover_raid45(mddev); | 689 | return raid0_takeover_raid45(mddev); |
@@ -665,6 +699,12 @@ static void *raid0_takeover(mddev_t *mddev) | |||
665 | if (mddev->level == 10) | 699 | if (mddev->level == 10) |
666 | return raid0_takeover_raid10(mddev); | 700 | return raid0_takeover_raid10(mddev); |
667 | 701 | ||
702 | if (mddev->level == 1) | ||
703 | return raid0_takeover_raid1(mddev); | ||
704 | |||
705 | printk(KERN_ERR "Takeover from raid%i to raid0 not supported\n", | ||
706 | mddev->level); | ||
707 | |||
668 | return ERR_PTR(-EINVAL); | 708 | return ERR_PTR(-EINVAL); |
669 | } | 709 | } |
670 | 710 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 69b659544390..3b607b28741b 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2463,11 +2463,13 @@ static void *raid10_takeover_raid0(mddev_t *mddev) | |||
2463 | mddev->recovery_cp = MaxSector; | 2463 | mddev->recovery_cp = MaxSector; |
2464 | 2464 | ||
2465 | conf = setup_conf(mddev); | 2465 | conf = setup_conf(mddev); |
2466 | if (!IS_ERR(conf)) | 2466 | if (!IS_ERR(conf)) { |
2467 | list_for_each_entry(rdev, &mddev->disks, same_set) | 2467 | list_for_each_entry(rdev, &mddev->disks, same_set) |
2468 | if (rdev->raid_disk >= 0) | 2468 | if (rdev->raid_disk >= 0) |
2469 | rdev->new_raid_disk = rdev->raid_disk * 2; | 2469 | rdev->new_raid_disk = rdev->raid_disk * 2; |
2470 | 2470 | conf->barrier = 1; | |
2471 | } | ||
2472 | |||
2471 | return conf; | 2473 | return conf; |
2472 | } | 2474 | } |
2473 | 2475 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 5044babfcda0..702812824195 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5517,7 +5517,6 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5517 | raid5_conf_t *conf = mddev->private; | 5517 | raid5_conf_t *conf = mddev->private; |
5518 | mdk_rdev_t *rdev; | 5518 | mdk_rdev_t *rdev; |
5519 | int spares = 0; | 5519 | int spares = 0; |
5520 | int added_devices = 0; | ||
5521 | unsigned long flags; | 5520 | unsigned long flags; |
5522 | 5521 | ||
5523 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) | 5522 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) |
@@ -5527,8 +5526,8 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5527 | return -ENOSPC; | 5526 | return -ENOSPC; |
5528 | 5527 | ||
5529 | list_for_each_entry(rdev, &mddev->disks, same_set) | 5528 | list_for_each_entry(rdev, &mddev->disks, same_set) |
5530 | if ((rdev->raid_disk < 0 || rdev->raid_disk >= conf->raid_disks) | 5529 | if (!test_bit(In_sync, &rdev->flags) |
5531 | && !test_bit(Faulty, &rdev->flags)) | 5530 | && !test_bit(Faulty, &rdev->flags)) |
5532 | spares++; | 5531 | spares++; |
5533 | 5532 | ||
5534 | if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded) | 5533 | if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded) |
@@ -5571,34 +5570,35 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5571 | * to correctly record the "partially reconstructed" state of | 5570 | * to correctly record the "partially reconstructed" state of |
5572 | * such devices during the reshape and confusion could result. | 5571 | * such devices during the reshape and confusion could result. |
5573 | */ | 5572 | */ |
5574 | if (mddev->delta_disks >= 0) | 5573 | if (mddev->delta_disks >= 0) { |
5575 | list_for_each_entry(rdev, &mddev->disks, same_set) | 5574 | int added_devices = 0; |
5576 | if (rdev->raid_disk < 0 && | 5575 | list_for_each_entry(rdev, &mddev->disks, same_set) |
5577 | !test_bit(Faulty, &rdev->flags)) { | 5576 | if (rdev->raid_disk < 0 && |
5578 | if (raid5_add_disk(mddev, rdev) == 0) { | 5577 | !test_bit(Faulty, &rdev->flags)) { |
5579 | char nm[20]; | 5578 | if (raid5_add_disk(mddev, rdev) == 0) { |
5580 | if (rdev->raid_disk >= conf->previous_raid_disks) { | 5579 | char nm[20]; |
5581 | set_bit(In_sync, &rdev->flags); | 5580 | if (rdev->raid_disk |
5582 | added_devices++; | 5581 | >= conf->previous_raid_disks) { |
5583 | } else | 5582 | set_bit(In_sync, &rdev->flags); |
5584 | rdev->recovery_offset = 0; | 5583 | added_devices++; |
5585 | sprintf(nm, "rd%d", rdev->raid_disk); | 5584 | } else |
5586 | if (sysfs_create_link(&mddev->kobj, | 5585 | rdev->recovery_offset = 0; |
5587 | &rdev->kobj, nm)) | 5586 | sprintf(nm, "rd%d", rdev->raid_disk); |
5588 | /* Failure here is OK */; | 5587 | if (sysfs_create_link(&mddev->kobj, |
5589 | } else | 5588 | &rdev->kobj, nm)) |
5590 | break; | 5589 | /* Failure here is OK */; |
5591 | } else if (rdev->raid_disk >= conf->previous_raid_disks | 5590 | } |
5592 | && !test_bit(Faulty, &rdev->flags)) { | 5591 | } else if (rdev->raid_disk >= conf->previous_raid_disks |
5593 | /* This is a spare that was manually added */ | 5592 | && !test_bit(Faulty, &rdev->flags)) { |
5594 | set_bit(In_sync, &rdev->flags); | 5593 | /* This is a spare that was manually added */ |
5595 | added_devices++; | 5594 | set_bit(In_sync, &rdev->flags); |
5596 | } | 5595 | added_devices++; |
5596 | } | ||
5597 | 5597 | ||
5598 | /* When a reshape changes the number of devices, ->degraded | 5598 | /* When a reshape changes the number of devices, |
5599 | * is measured against the larger of the pre and post number of | 5599 | * ->degraded is measured against the larger of the |
5600 | * devices.*/ | 5600 | * pre and post number of devices. |
5601 | if (mddev->delta_disks > 0) { | 5601 | */ |
5602 | spin_lock_irqsave(&conf->device_lock, flags); | 5602 | spin_lock_irqsave(&conf->device_lock, flags); |
5603 | mddev->degraded += (conf->raid_disks - conf->previous_raid_disks) | 5603 | mddev->degraded += (conf->raid_disks - conf->previous_raid_disks) |
5604 | - added_devices; | 5604 | - added_devices; |
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/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index e9a3eab7b0cf..8c1d85e27be4 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
@@ -621,7 +621,7 @@ static int __init memstick_init(void) | |||
621 | { | 621 | { |
622 | int rc; | 622 | int rc; |
623 | 623 | ||
624 | workqueue = create_freezeable_workqueue("kmemstick"); | 624 | workqueue = create_freezable_workqueue("kmemstick"); |
625 | if (!workqueue) | 625 | if (!workqueue) |
626 | return -ENOMEM; | 626 | return -ENOMEM; |
627 | 627 | ||
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index f71f22948477..1735c84ff757 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -76,8 +76,8 @@ | |||
76 | #define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR | 76 | #define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #define MPT_LINUX_VERSION_COMMON "3.04.17" | 79 | #define MPT_LINUX_VERSION_COMMON "3.04.18" |
80 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.17" | 80 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.18" |
81 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" | 81 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" |
82 | 82 | ||
83 | #define show_mptmod_ver(s,ver) \ | 83 | #define show_mptmod_ver(s,ver) \ |
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index a3856ed90aef..e8deb8ed0499 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -597,6 +597,13 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
597 | } | 597 | } |
598 | 598 | ||
599 | static int | 599 | static int |
600 | mptctl_release(struct inode *inode, struct file *filep) | ||
601 | { | ||
602 | fasync_helper(-1, filep, 0, &async_queue); | ||
603 | return 0; | ||
604 | } | ||
605 | |||
606 | static int | ||
600 | mptctl_fasync(int fd, struct file *filep, int mode) | 607 | mptctl_fasync(int fd, struct file *filep, int mode) |
601 | { | 608 | { |
602 | MPT_ADAPTER *ioc; | 609 | MPT_ADAPTER *ioc; |
@@ -2815,6 +2822,7 @@ static const struct file_operations mptctl_fops = { | |||
2815 | .llseek = no_llseek, | 2822 | .llseek = no_llseek, |
2816 | .fasync = mptctl_fasync, | 2823 | .fasync = mptctl_fasync, |
2817 | .unlocked_ioctl = mptctl_ioctl, | 2824 | .unlocked_ioctl = mptctl_ioctl, |
2825 | .release = mptctl_release, | ||
2818 | #ifdef CONFIG_COMPAT | 2826 | #ifdef CONFIG_COMPAT |
2819 | .compat_ioctl = compat_mpctl_ioctl, | 2827 | .compat_ioctl = compat_mpctl_ioctl, |
2820 | #endif | 2828 | #endif |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 59b8f53d1ece..0d9b82a44540 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1873,8 +1873,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1873 | } | 1873 | } |
1874 | 1874 | ||
1875 | out: | 1875 | out: |
1876 | printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n", | 1876 | printk(MYIOC_s_INFO_FMT "task abort: %s (rv=%04x) (sc=%p) (sn=%ld)\n", |
1877 | ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), SCpnt); | 1877 | ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), retval, |
1878 | SCpnt, SCpnt->serial_number); | ||
1878 | 1879 | ||
1879 | return retval; | 1880 | return retval; |
1880 | } | 1881 | } |
@@ -1911,7 +1912,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) | |||
1911 | 1912 | ||
1912 | vdevice = SCpnt->device->hostdata; | 1913 | vdevice = SCpnt->device->hostdata; |
1913 | if (!vdevice || !vdevice->vtarget) { | 1914 | if (!vdevice || !vdevice->vtarget) { |
1914 | retval = SUCCESS; | 1915 | retval = 0; |
1915 | goto out; | 1916 | goto out; |
1916 | } | 1917 | } |
1917 | 1918 | ||
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c index 5f6852dff40b..44d4475a09dd 100644 --- a/drivers/misc/tifm_core.c +++ b/drivers/misc/tifm_core.c | |||
@@ -329,7 +329,7 @@ static int __init tifm_init(void) | |||
329 | { | 329 | { |
330 | int rc; | 330 | int rc; |
331 | 331 | ||
332 | workqueue = create_freezeable_workqueue("tifm"); | 332 | workqueue = create_freezable_workqueue("tifm"); |
333 | if (!workqueue) | 333 | if (!workqueue) |
334 | return -ENOMEM; | 334 | return -ENOMEM; |
335 | 335 | ||
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 4d2ea8e80140..6df5a55da110 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
@@ -785,7 +785,7 @@ static int __init vmballoon_init(void) | |||
785 | if (x86_hyper != &x86_hyper_vmware) | 785 | if (x86_hyper != &x86_hyper_vmware) |
786 | return -ENODEV; | 786 | return -ENODEV; |
787 | 787 | ||
788 | vmballoon_wq = create_freezeable_workqueue("vmmemctl"); | 788 | vmballoon_wq = create_freezable_workqueue("vmmemctl"); |
789 | if (!vmballoon_wq) { | 789 | if (!vmballoon_wq) { |
790 | pr_err("failed to create workqueue\n"); | 790 | pr_err("failed to create workqueue\n"); |
791 | return -ENOMEM; | 791 | return -ENOMEM; |
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index bac7d62866b7..0371bf502249 100644 --- a/drivers/mmc/host/bfin_sdh.c +++ b/drivers/mmc/host/bfin_sdh.c | |||
@@ -462,7 +462,7 @@ static int __devinit sdh_probe(struct platform_device *pdev) | |||
462 | goto out; | 462 | goto out; |
463 | } | 463 | } |
464 | 464 | ||
465 | mmc = mmc_alloc_host(sizeof(*mmc), &pdev->dev); | 465 | mmc = mmc_alloc_host(sizeof(struct sdh_host), &pdev->dev); |
466 | if (!mmc) { | 466 | if (!mmc) { |
467 | ret = -ENOMEM; | 467 | ret = -ENOMEM; |
468 | goto out; | 468 | goto out; |
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c index b3a0ab0e4c2b..74218ad677e4 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/io.h> | 18 | #include <linux/io.h> |
18 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
@@ -827,8 +828,8 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev) | |||
827 | } | 828 | } |
828 | 829 | ||
829 | host->clk = clk_get(&pdev->dev, "mmc"); | 830 | host->clk = clk_get(&pdev->dev, "mmc"); |
830 | if (!host->clk) { | 831 | if (IS_ERR(host->clk)) { |
831 | ret = -ENOENT; | 832 | ret = PTR_ERR(host->clk); |
832 | dev_err(&pdev->dev, "Failed to get mmc clock\n"); | 833 | dev_err(&pdev->dev, "Failed to get mmc clock\n"); |
833 | goto err_free_host; | 834 | goto err_free_host; |
834 | } | 835 | } |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 563022825667..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> |
@@ -46,10 +47,6 @@ static unsigned int fmax = 515633; | |||
46 | * is asserted (likewise for RX) | 47 | * is asserted (likewise for RX) |
47 | * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY | 48 | * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY |
48 | * is asserted (likewise for RX) | 49 | * is asserted (likewise for RX) |
49 | * @broken_blockend: the MCI_DATABLOCKEND is broken on the hardware | ||
50 | * and will not work at all. | ||
51 | * @broken_blockend_dma: the MCI_DATABLOCKEND is broken on the hardware when | ||
52 | * using DMA. | ||
53 | * @sdio: variant supports SDIO | 50 | * @sdio: variant supports SDIO |
54 | * @st_clkdiv: true if using a ST-specific clock divider algorithm | 51 | * @st_clkdiv: true if using a ST-specific clock divider algorithm |
55 | */ | 52 | */ |
@@ -59,8 +56,6 @@ struct variant_data { | |||
59 | unsigned int datalength_bits; | 56 | unsigned int datalength_bits; |
60 | unsigned int fifosize; | 57 | unsigned int fifosize; |
61 | unsigned int fifohalfsize; | 58 | unsigned int fifohalfsize; |
62 | bool broken_blockend; | ||
63 | bool broken_blockend_dma; | ||
64 | bool sdio; | 59 | bool sdio; |
65 | bool st_clkdiv; | 60 | bool st_clkdiv; |
66 | }; | 61 | }; |
@@ -76,7 +71,6 @@ static struct variant_data variant_u300 = { | |||
76 | .fifohalfsize = 8 * 4, | 71 | .fifohalfsize = 8 * 4, |
77 | .clkreg_enable = 1 << 13, /* HWFCEN */ | 72 | .clkreg_enable = 1 << 13, /* HWFCEN */ |
78 | .datalength_bits = 16, | 73 | .datalength_bits = 16, |
79 | .broken_blockend_dma = true, | ||
80 | .sdio = true, | 74 | .sdio = true, |
81 | }; | 75 | }; |
82 | 76 | ||
@@ -86,7 +80,6 @@ static struct variant_data variant_ux500 = { | |||
86 | .clkreg = MCI_CLK_ENABLE, | 80 | .clkreg = MCI_CLK_ENABLE, |
87 | .clkreg_enable = 1 << 14, /* HWFCEN */ | 81 | .clkreg_enable = 1 << 14, /* HWFCEN */ |
88 | .datalength_bits = 24, | 82 | .datalength_bits = 24, |
89 | .broken_blockend = true, | ||
90 | .sdio = true, | 83 | .sdio = true, |
91 | .st_clkdiv = true, | 84 | .st_clkdiv = true, |
92 | }; | 85 | }; |
@@ -210,8 +203,6 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | |||
210 | host->data = data; | 203 | host->data = data; |
211 | host->size = data->blksz * data->blocks; | 204 | host->size = data->blksz * data->blocks; |
212 | host->data_xfered = 0; | 205 | host->data_xfered = 0; |
213 | host->blockend = false; | ||
214 | host->dataend = false; | ||
215 | 206 | ||
216 | mmci_init_sg(host, data); | 207 | mmci_init_sg(host, data); |
217 | 208 | ||
@@ -288,21 +279,26 @@ static void | |||
288 | mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | 279 | mmci_data_irq(struct mmci_host *host, struct mmc_data *data, |
289 | unsigned int status) | 280 | unsigned int status) |
290 | { | 281 | { |
291 | struct variant_data *variant = host->variant; | ||
292 | |||
293 | /* First check for errors */ | 282 | /* First check for errors */ |
294 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 283 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
284 | u32 remain, success; | ||
285 | |||
286 | /* Calculate how far we are into the transfer */ | ||
287 | remain = readl(host->base + MMCIDATACNT); | ||
288 | success = data->blksz * data->blocks - remain; | ||
289 | |||
295 | 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); |
296 | if (status & MCI_DATACRCFAIL) | 291 | if (status & MCI_DATACRCFAIL) { |
292 | /* Last block was not successful */ | ||
293 | host->data_xfered = round_down(success - 1, data->blksz); | ||
297 | data->error = -EILSEQ; | 294 | data->error = -EILSEQ; |
298 | else if (status & MCI_DATATIMEOUT) | 295 | } else if (status & MCI_DATATIMEOUT) { |
296 | host->data_xfered = round_down(success, data->blksz); | ||
299 | data->error = -ETIMEDOUT; | 297 | data->error = -ETIMEDOUT; |
300 | else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) | 298 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
299 | host->data_xfered = round_down(success, data->blksz); | ||
301 | data->error = -EIO; | 300 | data->error = -EIO; |
302 | 301 | } | |
303 | /* Force-complete the transaction */ | ||
304 | host->blockend = true; | ||
305 | host->dataend = true; | ||
306 | 302 | ||
307 | /* | 303 | /* |
308 | * We hit an error condition. Ensure that any data | 304 | * We hit an error condition. Ensure that any data |
@@ -321,61 +317,14 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
321 | } | 317 | } |
322 | } | 318 | } |
323 | 319 | ||
324 | /* | 320 | if (status & MCI_DATABLOCKEND) |
325 | * On ARM variants in PIO mode, MCI_DATABLOCKEND | 321 | dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); |
326 | * is always sent first, and we increase the | ||
327 | * transfered number of bytes for that IRQ. Then | ||
328 | * MCI_DATAEND follows and we conclude the transaction. | ||
329 | * | ||
330 | * On the Ux500 single-IRQ variant MCI_DATABLOCKEND | ||
331 | * doesn't seem to immediately clear from the status, | ||
332 | * so we can't use it keep count when only one irq is | ||
333 | * used because the irq will hit for other reasons, and | ||
334 | * then the flag is still up. So we use the MCI_DATAEND | ||
335 | * IRQ at the end of the entire transfer because | ||
336 | * MCI_DATABLOCKEND is broken. | ||
337 | * | ||
338 | * In the U300, the IRQs can arrive out-of-order, | ||
339 | * e.g. MCI_DATABLOCKEND sometimes arrives after MCI_DATAEND, | ||
340 | * so for this case we use the flags "blockend" and | ||
341 | * "dataend" to make sure both IRQs have arrived before | ||
342 | * concluding the transaction. (This does not apply | ||
343 | * to the Ux500 which doesn't fire MCI_DATABLOCKEND | ||
344 | * at all.) In DMA mode it suffers from the same problem | ||
345 | * as the Ux500. | ||
346 | */ | ||
347 | if (status & MCI_DATABLOCKEND) { | ||
348 | /* | ||
349 | * Just being a little over-cautious, we do not | ||
350 | * use this progressive update if the hardware blockend | ||
351 | * flag is unreliable: since it can stay high between | ||
352 | * IRQs it will corrupt the transfer counter. | ||
353 | */ | ||
354 | if (!variant->broken_blockend) | ||
355 | host->data_xfered += data->blksz; | ||
356 | host->blockend = true; | ||
357 | } | ||
358 | |||
359 | if (status & MCI_DATAEND) | ||
360 | host->dataend = true; | ||
361 | 322 | ||
362 | /* | 323 | if (status & MCI_DATAEND || data->error) { |
363 | * On variants with broken blockend we shall only wait for dataend, | ||
364 | * on others we must sync with the blockend signal since they can | ||
365 | * appear out-of-order. | ||
366 | */ | ||
367 | if (host->dataend && (host->blockend || variant->broken_blockend)) { | ||
368 | mmci_stop_data(host); | 324 | mmci_stop_data(host); |
369 | 325 | ||
370 | /* Reset these flags */ | 326 | if (!data->error) |
371 | host->blockend = false; | 327 | /* The error clause is handled above, success! */ |
372 | host->dataend = false; | ||
373 | |||
374 | /* | ||
375 | * Variants with broken blockend flags need to handle the | ||
376 | * end of the entire transfer here. | ||
377 | */ | ||
378 | if (variant->broken_blockend && !data->error) | ||
379 | host->data_xfered += data->blksz * data->blocks; | 328 | host->data_xfered += data->blksz * data->blocks; |
380 | 329 | ||
381 | if (!data->stop) { | 330 | if (!data->stop) { |
@@ -394,15 +343,15 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, | |||
394 | 343 | ||
395 | host->cmd = NULL; | 344 | host->cmd = NULL; |
396 | 345 | ||
397 | cmd->resp[0] = readl(base + MMCIRESPONSE0); | ||
398 | cmd->resp[1] = readl(base + MMCIRESPONSE1); | ||
399 | cmd->resp[2] = readl(base + MMCIRESPONSE2); | ||
400 | cmd->resp[3] = readl(base + MMCIRESPONSE3); | ||
401 | |||
402 | if (status & MCI_CMDTIMEOUT) { | 346 | if (status & MCI_CMDTIMEOUT) { |
403 | cmd->error = -ETIMEDOUT; | 347 | cmd->error = -ETIMEDOUT; |
404 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { | 348 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { |
405 | cmd->error = -EILSEQ; | 349 | cmd->error = -EILSEQ; |
350 | } else { | ||
351 | cmd->resp[0] = readl(base + MMCIRESPONSE0); | ||
352 | cmd->resp[1] = readl(base + MMCIRESPONSE1); | ||
353 | cmd->resp[2] = readl(base + MMCIRESPONSE2); | ||
354 | cmd->resp[3] = readl(base + MMCIRESPONSE3); | ||
406 | } | 355 | } |
407 | 356 | ||
408 | if (!cmd->data || cmd->error) { | 357 | if (!cmd->data || cmd->error) { |
@@ -770,7 +719,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
770 | struct variant_data *variant = id->data; | 719 | struct variant_data *variant = id->data; |
771 | struct mmci_host *host; | 720 | struct mmci_host *host; |
772 | struct mmc_host *mmc; | 721 | struct mmc_host *mmc; |
773 | unsigned int mask; | ||
774 | int ret; | 722 | int ret; |
775 | 723 | ||
776 | /* must have platform data */ | 724 | /* must have platform data */ |
@@ -951,12 +899,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
951 | goto irq0_free; | 899 | goto irq0_free; |
952 | } | 900 | } |
953 | 901 | ||
954 | mask = MCI_IRQENABLE; | 902 | writel(MCI_IRQENABLE, host->base + MMCIMASK0); |
955 | /* Don't use the datablockend flag if it's broken */ | ||
956 | if (variant->broken_blockend) | ||
957 | mask &= ~MCI_DATABLOCKEND; | ||
958 | |||
959 | writel(mask, host->base + MMCIMASK0); | ||
960 | 903 | ||
961 | amba_set_drvdata(dev, mmc); | 904 | amba_set_drvdata(dev, mmc); |
962 | 905 | ||
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index df06f01aac89..c1df7b82d36c 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h | |||
@@ -137,7 +137,7 @@ | |||
137 | #define MCI_IRQENABLE \ | 137 | #define MCI_IRQENABLE \ |
138 | (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ | 138 | (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ |
139 | MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ | 139 | MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ |
140 | MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATABLOCKENDMASK) | 140 | MCI_CMDRESPENDMASK|MCI_CMDSENTMASK) |
141 | 141 | ||
142 | /* These interrupts are directed to IRQ1 when two IRQ lines are available */ | 142 | /* These interrupts are directed to IRQ1 when two IRQ lines are available */ |
143 | #define MCI_IRQ1MASK \ | 143 | #define MCI_IRQ1MASK \ |
@@ -177,9 +177,6 @@ struct mmci_host { | |||
177 | struct timer_list timer; | 177 | struct timer_list timer; |
178 | unsigned int oldstat; | 178 | unsigned int oldstat; |
179 | 179 | ||
180 | bool blockend; | ||
181 | bool dataend; | ||
182 | |||
183 | /* pio stuff */ | 180 | /* pio stuff */ |
184 | struct sg_mapping_iter sg_miter; | 181 | struct sg_mapping_iter sg_miter; |
185 | unsigned int size; | 182 | unsigned int size; |
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 5decfd0bd61d..153ab977a013 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c | |||
@@ -383,14 +383,30 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data) | |||
383 | host->curr.user_pages = 0; | 383 | host->curr.user_pages = 0; |
384 | 384 | ||
385 | box = &nc->cmd[0]; | 385 | box = &nc->cmd[0]; |
386 | for (i = 0; i < host->dma.num_ents; i++) { | ||
387 | box->cmd = CMD_MODE_BOX; | ||
388 | 386 | ||
389 | /* Initialize sg dma address */ | 387 | /* location of command block must be 64 bit aligned */ |
390 | sg->dma_address = page_to_dma(mmc_dev(host->mmc), sg_page(sg)) | 388 | BUG_ON(host->dma.cmd_busaddr & 0x07); |
391 | + sg->offset; | ||
392 | 389 | ||
393 | if (i == (host->dma.num_ents - 1)) | 390 | nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; |
391 | host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | | ||
392 | DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); | ||
393 | host->dma.hdr.complete_func = msmsdcc_dma_complete_func; | ||
394 | |||
395 | n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, | ||
396 | host->dma.num_ents, host->dma.dir); | ||
397 | if (n == 0) { | ||
398 | printk(KERN_ERR "%s: Unable to map in all sg elements\n", | ||
399 | mmc_hostname(host->mmc)); | ||
400 | host->dma.sg = NULL; | ||
401 | host->dma.num_ents = 0; | ||
402 | return -ENOMEM; | ||
403 | } | ||
404 | |||
405 | for_each_sg(host->dma.sg, sg, n, i) { | ||
406 | |||
407 | box->cmd = CMD_MODE_BOX; | ||
408 | |||
409 | if (i == n - 1) | ||
394 | box->cmd |= CMD_LC; | 410 | box->cmd |= CMD_LC; |
395 | rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ? | 411 | rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ? |
396 | (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 : | 412 | (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 : |
@@ -418,27 +434,6 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data) | |||
418 | box->cmd |= CMD_DST_CRCI(crci); | 434 | box->cmd |= CMD_DST_CRCI(crci); |
419 | } | 435 | } |
420 | box++; | 436 | box++; |
421 | sg++; | ||
422 | } | ||
423 | |||
424 | /* location of command block must be 64 bit aligned */ | ||
425 | BUG_ON(host->dma.cmd_busaddr & 0x07); | ||
426 | |||
427 | nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; | ||
428 | host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | | ||
429 | DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); | ||
430 | host->dma.hdr.complete_func = msmsdcc_dma_complete_func; | ||
431 | |||
432 | n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, | ||
433 | host->dma.num_ents, host->dma.dir); | ||
434 | /* dsb inside dma_map_sg will write nc out to mem as well */ | ||
435 | |||
436 | if (n != host->dma.num_ents) { | ||
437 | printk(KERN_ERR "%s: Unable to map in all sg elements\n", | ||
438 | mmc_hostname(host->mmc)); | ||
439 | host->dma.sg = NULL; | ||
440 | host->dma.num_ents = 0; | ||
441 | return -ENOMEM; | ||
442 | } | 437 | } |
443 | 438 | ||
444 | return 0; | 439 | return 0; |
@@ -1331,9 +1326,6 @@ msmsdcc_probe(struct platform_device *pdev) | |||
1331 | if (host->timer.function) | 1326 | if (host->timer.function) |
1332 | pr_info("%s: Polling status mode enabled\n", mmc_hostname(mmc)); | 1327 | pr_info("%s: Polling status mode enabled\n", mmc_hostname(mmc)); |
1333 | 1328 | ||
1334 | #if BUSCLK_PWRSAVE | ||
1335 | msmsdcc_disable_clocks(host, 1); | ||
1336 | #endif | ||
1337 | return 0; | 1329 | return 0; |
1338 | cmd_irq_free: | 1330 | cmd_irq_free: |
1339 | free_irq(cmd_irqres->start, host); | 1331 | free_irq(cmd_irqres->start, host); |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 17203586305c..5309ab95aada 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -277,10 +277,43 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) | |||
277 | host->clock = clock; | 277 | host->clock = clock; |
278 | } | 278 | } |
279 | 279 | ||
280 | /** | ||
281 | * sdhci_s3c_platform_8bit_width - support 8bit buswidth | ||
282 | * @host: The SDHCI host being queried | ||
283 | * @width: MMC_BUS_WIDTH_ macro for the bus width being requested | ||
284 | * | ||
285 | * We have 8-bit width support but is not a v3 controller. | ||
286 | * So we add platform_8bit_width() and support 8bit width. | ||
287 | */ | ||
288 | static int sdhci_s3c_platform_8bit_width(struct sdhci_host *host, int width) | ||
289 | { | ||
290 | u8 ctrl; | ||
291 | |||
292 | ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); | ||
293 | |||
294 | switch (width) { | ||
295 | case MMC_BUS_WIDTH_8: | ||
296 | ctrl |= SDHCI_CTRL_8BITBUS; | ||
297 | ctrl &= ~SDHCI_CTRL_4BITBUS; | ||
298 | break; | ||
299 | case MMC_BUS_WIDTH_4: | ||
300 | ctrl |= SDHCI_CTRL_4BITBUS; | ||
301 | ctrl &= ~SDHCI_CTRL_8BITBUS; | ||
302 | break; | ||
303 | default: | ||
304 | break; | ||
305 | } | ||
306 | |||
307 | sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); | ||
308 | |||
309 | return 0; | ||
310 | } | ||
311 | |||
280 | static struct sdhci_ops sdhci_s3c_ops = { | 312 | static struct sdhci_ops sdhci_s3c_ops = { |
281 | .get_max_clock = sdhci_s3c_get_max_clk, | 313 | .get_max_clock = sdhci_s3c_get_max_clk, |
282 | .set_clock = sdhci_s3c_set_clock, | 314 | .set_clock = sdhci_s3c_set_clock, |
283 | .get_min_clock = sdhci_s3c_get_min_clock, | 315 | .get_min_clock = sdhci_s3c_get_min_clock, |
316 | .platform_8bit_width = sdhci_s3c_platform_8bit_width, | ||
284 | }; | 317 | }; |
285 | 318 | ||
286 | static void sdhci_s3c_notify_change(struct platform_device *dev, int state) | 319 | static void sdhci_s3c_notify_change(struct platform_device *dev, int state) |
@@ -473,6 +506,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
473 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) | 506 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) |
474 | host->mmc->caps = MMC_CAP_NONREMOVABLE; | 507 | host->mmc->caps = MMC_CAP_NONREMOVABLE; |
475 | 508 | ||
509 | if (pdata->host_caps) | ||
510 | host->mmc->caps |= pdata->host_caps; | ||
511 | |||
476 | host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR | | 512 | host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR | |
477 | SDHCI_QUIRK_32BIT_DMA_SIZE); | 513 | SDHCI_QUIRK_32BIT_DMA_SIZE); |
478 | 514 | ||
diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c index f8f65df9b017..f08f944ac53c 100644 --- a/drivers/mmc/host/ushc.c +++ b/drivers/mmc/host/ushc.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/usb.h> | 20 | #include <linux/usb.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/usb.h> | ||
23 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
24 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
25 | #include <linux/mmc/host.h> | 24 | #include <linux/mmc/host.h> |
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c index d9d7efbc77cc..6322d1fb5d62 100644 --- a/drivers/mtd/nand/r852.c +++ b/drivers/mtd/nand/r852.c | |||
@@ -930,7 +930,7 @@ int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | |||
930 | 930 | ||
931 | init_completion(&dev->dma_done); | 931 | init_completion(&dev->dma_done); |
932 | 932 | ||
933 | dev->card_workqueue = create_freezeable_workqueue(DRV_NAME); | 933 | dev->card_workqueue = create_freezable_workqueue(DRV_NAME); |
934 | 934 | ||
935 | if (!dev->card_workqueue) | 935 | if (!dev->card_workqueue) |
936 | goto error9; | 936 | goto error9; |
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index 67822cf6c025..ac0d6a8613b5 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c | |||
@@ -1258,7 +1258,7 @@ static struct mtd_blktrans_ops sm_ftl_ops = { | |||
1258 | static __init int sm_module_init(void) | 1258 | static __init int sm_module_init(void) |
1259 | { | 1259 | { |
1260 | int error = 0; | 1260 | int error = 0; |
1261 | cache_flush_workqueue = create_freezeable_workqueue("smflush"); | 1261 | cache_flush_workqueue = create_freezable_workqueue("smflush"); |
1262 | 1262 | ||
1263 | if (IS_ERR(cache_flush_workqueue)) | 1263 | if (IS_ERR(cache_flush_workqueue)) |
1264 | return PTR_ERR(cache_flush_workqueue); | 1264 | return PTR_ERR(cache_flush_workqueue); |
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/can/mcp251x.c b/drivers/net/can/mcp251x.c index 7ab534aee452..7513c4523ac4 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -940,7 +940,7 @@ static int mcp251x_open(struct net_device *net) | |||
940 | goto open_unlock; | 940 | goto open_unlock; |
941 | } | 941 | } |
942 | 942 | ||
943 | priv->wq = create_freezeable_workqueue("mcp251x_wq"); | 943 | priv->wq = create_freezable_workqueue("mcp251x_wq"); |
944 | INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); | 944 | INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); |
945 | INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); | 945 | INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); |
946 | 946 | ||
diff --git a/drivers/net/can/mscan/Kconfig b/drivers/net/can/mscan/Kconfig index 27d1d398e25e..d38706958af6 100644 --- a/drivers/net/can/mscan/Kconfig +++ b/drivers/net/can/mscan/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | config CAN_MSCAN | 1 | config CAN_MSCAN |
2 | depends on CAN_DEV && (PPC || M68K || M68KNOMMU) | 2 | depends on CAN_DEV && (PPC || M68K) |
3 | tristate "Support for Freescale MSCAN based chips" | 3 | tristate "Support for Freescale MSCAN based chips" |
4 | ---help--- | 4 | ---help--- |
5 | The Motorola Scalable Controller Area Network (MSCAN) definition | 5 | The Motorola Scalable Controller Area Network (MSCAN) definition |
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 7d8bc128044c..e54712b22c27 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c | |||
@@ -185,9 +185,9 @@ struct pch_can_priv { | |||
185 | 185 | ||
186 | static struct can_bittiming_const pch_can_bittiming_const = { | 186 | static struct can_bittiming_const pch_can_bittiming_const = { |
187 | .name = KBUILD_MODNAME, | 187 | .name = KBUILD_MODNAME, |
188 | .tseg1_min = 1, | 188 | .tseg1_min = 2, |
189 | .tseg1_max = 16, | 189 | .tseg1_max = 16, |
190 | .tseg2_min = 2, | 190 | .tseg2_min = 1, |
191 | .tseg2_max = 8, | 191 | .tseg2_max = 8, |
192 | .sjw_max = 4, | 192 | .sjw_max = 4, |
193 | .brp_min = 1, | 193 | .brp_min = 1, |
diff --git a/drivers/net/can/softing/Kconfig b/drivers/net/can/softing/Kconfig index 8ba81b3ddd90..5de46a9a77bb 100644 --- a/drivers/net/can/softing/Kconfig +++ b/drivers/net/can/softing/Kconfig | |||
@@ -18,7 +18,7 @@ config CAN_SOFTING | |||
18 | config CAN_SOFTING_CS | 18 | config CAN_SOFTING_CS |
19 | tristate "Softing Gmbh CAN pcmcia cards" | 19 | tristate "Softing Gmbh CAN pcmcia cards" |
20 | depends on PCMCIA | 20 | depends on PCMCIA |
21 | select CAN_SOFTING | 21 | depends on CAN_SOFTING |
22 | ---help--- | 22 | ---help--- |
23 | Support for PCMCIA cards from Softing Gmbh & some cards | 23 | Support for PCMCIA cards from Softing Gmbh & some cards |
24 | from Vector Gmbh. | 24 | from Vector Gmbh. |
diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c index 300fe75dd1a7..c11bb4de8630 100644 --- a/drivers/net/can/softing/softing_cs.c +++ b/drivers/net/can/softing/softing_cs.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/slab.h> | ||
22 | 23 | ||
23 | #include <pcmcia/cistpl.h> | 24 | #include <pcmcia/cistpl.h> |
24 | #include <pcmcia/ds.h> | 25 | #include <pcmcia/ds.h> |
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c index 56166ae2059f..6aad64df4dcb 100644 --- a/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c | |||
@@ -2040,7 +2040,7 @@ static int __devinit setup_debugfs(struct adapter *adapter) | |||
2040 | { | 2040 | { |
2041 | int i; | 2041 | int i; |
2042 | 2042 | ||
2043 | BUG_ON(adapter->debugfs_root == NULL); | 2043 | BUG_ON(IS_ERR_OR_NULL(adapter->debugfs_root)); |
2044 | 2044 | ||
2045 | /* | 2045 | /* |
2046 | * Debugfs support is best effort. | 2046 | * Debugfs support is best effort. |
@@ -2061,7 +2061,7 @@ static int __devinit setup_debugfs(struct adapter *adapter) | |||
2061 | */ | 2061 | */ |
2062 | static void cleanup_debugfs(struct adapter *adapter) | 2062 | static void cleanup_debugfs(struct adapter *adapter) |
2063 | { | 2063 | { |
2064 | BUG_ON(adapter->debugfs_root == NULL); | 2064 | BUG_ON(IS_ERR_OR_NULL(adapter->debugfs_root)); |
2065 | 2065 | ||
2066 | /* | 2066 | /* |
2067 | * Unlike our sister routine cleanup_proc(), we don't need to remove | 2067 | * Unlike our sister routine cleanup_proc(), we don't need to remove |
@@ -2489,17 +2489,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, | |||
2489 | struct net_device *netdev; | 2489 | struct net_device *netdev; |
2490 | 2490 | ||
2491 | /* | 2491 | /* |
2492 | * Vet our module parameters. | ||
2493 | */ | ||
2494 | if (msi != MSI_MSIX && msi != MSI_MSI) { | ||
2495 | dev_err(&pdev->dev, "bad module parameter msi=%d; must be %d" | ||
2496 | " (MSI-X or MSI) or %d (MSI)\n", msi, MSI_MSIX, | ||
2497 | MSI_MSI); | ||
2498 | err = -EINVAL; | ||
2499 | goto err_out; | ||
2500 | } | ||
2501 | |||
2502 | /* | ||
2503 | * Print our driver banner the first time we're called to initialize a | 2492 | * Print our driver banner the first time we're called to initialize a |
2504 | * device. | 2493 | * device. |
2505 | */ | 2494 | */ |
@@ -2711,11 +2700,11 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, | |||
2711 | /* | 2700 | /* |
2712 | * Set up our debugfs entries. | 2701 | * Set up our debugfs entries. |
2713 | */ | 2702 | */ |
2714 | if (cxgb4vf_debugfs_root) { | 2703 | if (!IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) { |
2715 | adapter->debugfs_root = | 2704 | adapter->debugfs_root = |
2716 | debugfs_create_dir(pci_name(pdev), | 2705 | debugfs_create_dir(pci_name(pdev), |
2717 | cxgb4vf_debugfs_root); | 2706 | cxgb4vf_debugfs_root); |
2718 | if (adapter->debugfs_root == NULL) | 2707 | if (IS_ERR_OR_NULL(adapter->debugfs_root)) |
2719 | dev_warn(&pdev->dev, "could not create debugfs" | 2708 | dev_warn(&pdev->dev, "could not create debugfs" |
2720 | " directory"); | 2709 | " directory"); |
2721 | else | 2710 | else |
@@ -2770,7 +2759,7 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, | |||
2770 | */ | 2759 | */ |
2771 | 2760 | ||
2772 | err_free_debugfs: | 2761 | err_free_debugfs: |
2773 | if (adapter->debugfs_root) { | 2762 | if (!IS_ERR_OR_NULL(adapter->debugfs_root)) { |
2774 | cleanup_debugfs(adapter); | 2763 | cleanup_debugfs(adapter); |
2775 | debugfs_remove_recursive(adapter->debugfs_root); | 2764 | debugfs_remove_recursive(adapter->debugfs_root); |
2776 | } | 2765 | } |
@@ -2802,7 +2791,6 @@ err_release_regions: | |||
2802 | err_disable_device: | 2791 | err_disable_device: |
2803 | pci_disable_device(pdev); | 2792 | pci_disable_device(pdev); |
2804 | 2793 | ||
2805 | err_out: | ||
2806 | return err; | 2794 | return err; |
2807 | } | 2795 | } |
2808 | 2796 | ||
@@ -2840,7 +2828,7 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev) | |||
2840 | /* | 2828 | /* |
2841 | * Tear down our debugfs entries. | 2829 | * Tear down our debugfs entries. |
2842 | */ | 2830 | */ |
2843 | if (adapter->debugfs_root) { | 2831 | if (!IS_ERR_OR_NULL(adapter->debugfs_root)) { |
2844 | cleanup_debugfs(adapter); | 2832 | cleanup_debugfs(adapter); |
2845 | debugfs_remove_recursive(adapter->debugfs_root); | 2833 | debugfs_remove_recursive(adapter->debugfs_root); |
2846 | } | 2834 | } |
@@ -2874,6 +2862,46 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev) | |||
2874 | } | 2862 | } |
2875 | 2863 | ||
2876 | /* | 2864 | /* |
2865 | * "Shutdown" quiesce the device, stopping Ingress Packet and Interrupt | ||
2866 | * delivery. | ||
2867 | */ | ||
2868 | static void __devexit cxgb4vf_pci_shutdown(struct pci_dev *pdev) | ||
2869 | { | ||
2870 | struct adapter *adapter; | ||
2871 | int pidx; | ||
2872 | |||
2873 | adapter = pci_get_drvdata(pdev); | ||
2874 | if (!adapter) | ||
2875 | return; | ||
2876 | |||
2877 | /* | ||
2878 | * Disable all Virtual Interfaces. This will shut down the | ||
2879 | * delivery of all ingress packets into the chip for these | ||
2880 | * Virtual Interfaces. | ||
2881 | */ | ||
2882 | for_each_port(adapter, pidx) { | ||
2883 | struct net_device *netdev; | ||
2884 | struct port_info *pi; | ||
2885 | |||
2886 | if (!test_bit(pidx, &adapter->registered_device_map)) | ||
2887 | continue; | ||
2888 | |||
2889 | netdev = adapter->port[pidx]; | ||
2890 | if (!netdev) | ||
2891 | continue; | ||
2892 | |||
2893 | pi = netdev_priv(netdev); | ||
2894 | t4vf_enable_vi(adapter, pi->viid, false, false); | ||
2895 | } | ||
2896 | |||
2897 | /* | ||
2898 | * Free up all Queues which will prevent further DMA and | ||
2899 | * Interrupts allowing various internal pathways to drain. | ||
2900 | */ | ||
2901 | t4vf_free_sge_resources(adapter); | ||
2902 | } | ||
2903 | |||
2904 | /* | ||
2877 | * PCI Device registration data structures. | 2905 | * PCI Device registration data structures. |
2878 | */ | 2906 | */ |
2879 | #define CH_DEVICE(devid, idx) \ | 2907 | #define CH_DEVICE(devid, idx) \ |
@@ -2906,6 +2934,7 @@ static struct pci_driver cxgb4vf_driver = { | |||
2906 | .id_table = cxgb4vf_pci_tbl, | 2934 | .id_table = cxgb4vf_pci_tbl, |
2907 | .probe = cxgb4vf_pci_probe, | 2935 | .probe = cxgb4vf_pci_probe, |
2908 | .remove = __devexit_p(cxgb4vf_pci_remove), | 2936 | .remove = __devexit_p(cxgb4vf_pci_remove), |
2937 | .shutdown = __devexit_p(cxgb4vf_pci_shutdown), | ||
2909 | }; | 2938 | }; |
2910 | 2939 | ||
2911 | /* | 2940 | /* |
@@ -2915,14 +2944,25 @@ static int __init cxgb4vf_module_init(void) | |||
2915 | { | 2944 | { |
2916 | int ret; | 2945 | int ret; |
2917 | 2946 | ||
2947 | /* | ||
2948 | * Vet our module parameters. | ||
2949 | */ | ||
2950 | if (msi != MSI_MSIX && msi != MSI_MSI) { | ||
2951 | printk(KERN_WARNING KBUILD_MODNAME | ||
2952 | ": bad module parameter msi=%d; must be %d" | ||
2953 | " (MSI-X or MSI) or %d (MSI)\n", | ||
2954 | msi, MSI_MSIX, MSI_MSI); | ||
2955 | return -EINVAL; | ||
2956 | } | ||
2957 | |||
2918 | /* Debugfs support is optional, just warn if this fails */ | 2958 | /* Debugfs support is optional, just warn if this fails */ |
2919 | cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | 2959 | cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
2920 | if (!cxgb4vf_debugfs_root) | 2960 | if (IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) |
2921 | printk(KERN_WARNING KBUILD_MODNAME ": could not create" | 2961 | printk(KERN_WARNING KBUILD_MODNAME ": could not create" |
2922 | " debugfs entry, continuing\n"); | 2962 | " debugfs entry, continuing\n"); |
2923 | 2963 | ||
2924 | ret = pci_register_driver(&cxgb4vf_driver); | 2964 | ret = pci_register_driver(&cxgb4vf_driver); |
2925 | if (ret < 0) | 2965 | if (ret < 0 && !IS_ERR_OR_NULL(cxgb4vf_debugfs_root)) |
2926 | debugfs_remove(cxgb4vf_debugfs_root); | 2966 | debugfs_remove(cxgb4vf_debugfs_root); |
2927 | return ret; | 2967 | return ret; |
2928 | } | 2968 | } |
diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c index 0f51c80475ce..192db226ec7f 100644 --- a/drivers/net/cxgb4vf/t4vf_hw.c +++ b/drivers/net/cxgb4vf/t4vf_hw.c | |||
@@ -171,7 +171,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, | |||
171 | delay_idx = 0; | 171 | delay_idx = 0; |
172 | ms = delay[0]; | 172 | ms = delay[0]; |
173 | 173 | ||
174 | for (i = 0; i < 500; i += ms) { | 174 | for (i = 0; i < FW_CMD_MAX_TIMEOUT; i += ms) { |
175 | if (sleep_ok) { | 175 | if (sleep_ok) { |
176 | ms = delay[delay_idx]; | 176 | ms = delay[delay_idx]; |
177 | if (delay_idx < ARRAY_SIZE(delay) - 1) | 177 | if (delay_idx < ARRAY_SIZE(delay) - 1) |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 7cedfeb505b2..ec0b803c501e 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -935,6 +935,9 @@ static void e1000_print_hw_hang(struct work_struct *work) | |||
935 | u16 phy_status, phy_1000t_status, phy_ext_status; | 935 | u16 phy_status, phy_1000t_status, phy_ext_status; |
936 | u16 pci_status; | 936 | u16 pci_status; |
937 | 937 | ||
938 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
939 | return; | ||
940 | |||
938 | e1e_rphy(hw, PHY_STATUS, &phy_status); | 941 | e1e_rphy(hw, PHY_STATUS, &phy_status); |
939 | e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status); | 942 | e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status); |
940 | e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status); | 943 | e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status); |
@@ -1498,6 +1501,9 @@ static void e1000e_downshift_workaround(struct work_struct *work) | |||
1498 | struct e1000_adapter *adapter = container_of(work, | 1501 | struct e1000_adapter *adapter = container_of(work, |
1499 | struct e1000_adapter, downshift_task); | 1502 | struct e1000_adapter, downshift_task); |
1500 | 1503 | ||
1504 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
1505 | return; | ||
1506 | |||
1501 | e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); | 1507 | e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); |
1502 | } | 1508 | } |
1503 | 1509 | ||
@@ -3335,6 +3341,21 @@ int e1000e_up(struct e1000_adapter *adapter) | |||
3335 | return 0; | 3341 | return 0; |
3336 | } | 3342 | } |
3337 | 3343 | ||
3344 | static void e1000e_flush_descriptors(struct e1000_adapter *adapter) | ||
3345 | { | ||
3346 | struct e1000_hw *hw = &adapter->hw; | ||
3347 | |||
3348 | if (!(adapter->flags2 & FLAG2_DMA_BURST)) | ||
3349 | return; | ||
3350 | |||
3351 | /* flush pending descriptor writebacks to memory */ | ||
3352 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
3353 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | ||
3354 | |||
3355 | /* execute the writes immediately */ | ||
3356 | e1e_flush(); | ||
3357 | } | ||
3358 | |||
3338 | static void e1000e_update_stats(struct e1000_adapter *adapter); | 3359 | static void e1000e_update_stats(struct e1000_adapter *adapter); |
3339 | 3360 | ||
3340 | void e1000e_down(struct e1000_adapter *adapter) | 3361 | void e1000e_down(struct e1000_adapter *adapter) |
@@ -3381,6 +3402,9 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
3381 | 3402 | ||
3382 | if (!pci_channel_offline(adapter->pdev)) | 3403 | if (!pci_channel_offline(adapter->pdev)) |
3383 | e1000e_reset(adapter); | 3404 | e1000e_reset(adapter); |
3405 | |||
3406 | e1000e_flush_descriptors(adapter); | ||
3407 | |||
3384 | e1000_clean_tx_ring(adapter); | 3408 | e1000_clean_tx_ring(adapter); |
3385 | e1000_clean_rx_ring(adapter); | 3409 | e1000_clean_rx_ring(adapter); |
3386 | 3410 | ||
@@ -3771,6 +3795,10 @@ static void e1000e_update_phy_task(struct work_struct *work) | |||
3771 | { | 3795 | { |
3772 | struct e1000_adapter *adapter = container_of(work, | 3796 | struct e1000_adapter *adapter = container_of(work, |
3773 | struct e1000_adapter, update_phy_task); | 3797 | struct e1000_adapter, update_phy_task); |
3798 | |||
3799 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
3800 | return; | ||
3801 | |||
3774 | e1000_get_phy_info(&adapter->hw); | 3802 | e1000_get_phy_info(&adapter->hw); |
3775 | } | 3803 | } |
3776 | 3804 | ||
@@ -3781,6 +3809,10 @@ static void e1000e_update_phy_task(struct work_struct *work) | |||
3781 | static void e1000_update_phy_info(unsigned long data) | 3809 | static void e1000_update_phy_info(unsigned long data) |
3782 | { | 3810 | { |
3783 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 3811 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
3812 | |||
3813 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
3814 | return; | ||
3815 | |||
3784 | schedule_work(&adapter->update_phy_task); | 3816 | schedule_work(&adapter->update_phy_task); |
3785 | } | 3817 | } |
3786 | 3818 | ||
@@ -4155,6 +4187,9 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
4155 | struct e1000_hw *hw = &adapter->hw; | 4187 | struct e1000_hw *hw = &adapter->hw; |
4156 | u32 link, tctl; | 4188 | u32 link, tctl; |
4157 | 4189 | ||
4190 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
4191 | return; | ||
4192 | |||
4158 | link = e1000e_has_link(adapter); | 4193 | link = e1000e_has_link(adapter); |
4159 | if ((netif_carrier_ok(netdev)) && link) { | 4194 | if ((netif_carrier_ok(netdev)) && link) { |
4160 | /* Cancel scheduled suspend requests. */ | 4195 | /* Cancel scheduled suspend requests. */ |
@@ -4342,19 +4377,12 @@ link_up: | |||
4342 | else | 4377 | else |
4343 | ew32(ICS, E1000_ICS_RXDMT0); | 4378 | ew32(ICS, E1000_ICS_RXDMT0); |
4344 | 4379 | ||
4380 | /* flush pending descriptors to memory before detecting Tx hang */ | ||
4381 | e1000e_flush_descriptors(adapter); | ||
4382 | |||
4345 | /* Force detection of hung controller every watchdog period */ | 4383 | /* Force detection of hung controller every watchdog period */ |
4346 | adapter->detect_tx_hung = 1; | 4384 | adapter->detect_tx_hung = 1; |
4347 | 4385 | ||
4348 | /* flush partial descriptors to memory before detecting Tx hang */ | ||
4349 | if (adapter->flags2 & FLAG2_DMA_BURST) { | ||
4350 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
4351 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | ||
4352 | /* | ||
4353 | * no need to flush the writes because the timeout code does | ||
4354 | * an er32 first thing | ||
4355 | */ | ||
4356 | } | ||
4357 | |||
4358 | /* | 4386 | /* |
4359 | * With 82571 controllers, LAA may be overwritten due to controller | 4387 | * With 82571 controllers, LAA may be overwritten due to controller |
4360 | * reset from the other port. Set the appropriate LAA in RAR[0] | 4388 | * reset from the other port. Set the appropriate LAA in RAR[0] |
@@ -4892,6 +4920,10 @@ static void e1000_reset_task(struct work_struct *work) | |||
4892 | struct e1000_adapter *adapter; | 4920 | struct e1000_adapter *adapter; |
4893 | adapter = container_of(work, struct e1000_adapter, reset_task); | 4921 | adapter = container_of(work, struct e1000_adapter, reset_task); |
4894 | 4922 | ||
4923 | /* don't run the task if already down */ | ||
4924 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
4925 | return; | ||
4926 | |||
4895 | if (!((adapter->flags & FLAG_RX_NEEDS_RESTART) && | 4927 | if (!((adapter->flags & FLAG_RX_NEEDS_RESTART) && |
4896 | (adapter->flags & FLAG_RX_RESTART_NOW))) { | 4928 | (adapter->flags & FLAG_RX_RESTART_NOW))) { |
4897 | e1000e_dump(adapter); | 4929 | e1000e_dump(adapter); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index af09296ef0dd..9c0b1bac6af6 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5645,6 +5645,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5645 | goto out_error; | 5645 | goto out_error; |
5646 | } | 5646 | } |
5647 | 5647 | ||
5648 | netif_carrier_off(dev); | ||
5649 | |||
5648 | dev_info(&pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, addr %pM\n", | 5650 | dev_info(&pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, addr %pM\n", |
5649 | dev->name, np->phy_oui, np->phyaddr, dev->dev_addr); | 5651 | dev->name, np->phy_oui, np->phyaddr, dev->dev_addr); |
5650 | 5652 | ||
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index 8753980668c7..c54a88274d51 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
@@ -159,7 +159,7 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, | |||
159 | struct scatterlist *sg; | 159 | struct scatterlist *sg; |
160 | unsigned int i, j, dmacount; | 160 | unsigned int i, j, dmacount; |
161 | unsigned int len; | 161 | unsigned int len; |
162 | static const unsigned int bufflen = 4096; | 162 | static const unsigned int bufflen = IXGBE_FCBUFF_MIN; |
163 | unsigned int firstoff = 0; | 163 | unsigned int firstoff = 0; |
164 | unsigned int lastsize; | 164 | unsigned int lastsize; |
165 | unsigned int thisoff = 0; | 165 | unsigned int thisoff = 0; |
@@ -254,6 +254,24 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, | |||
254 | /* only the last buffer may have non-full bufflen */ | 254 | /* only the last buffer may have non-full bufflen */ |
255 | lastsize = thisoff + thislen; | 255 | lastsize = thisoff + thislen; |
256 | 256 | ||
257 | /* | ||
258 | * lastsize can not be buffer len. | ||
259 | * If it is then adding another buffer with lastsize = 1. | ||
260 | */ | ||
261 | if (lastsize == bufflen) { | ||
262 | if (j >= IXGBE_BUFFCNT_MAX) { | ||
263 | e_err(drv, "xid=%x:%d,%d,%d:addr=%llx " | ||
264 | "not enough user buffers. We need an extra " | ||
265 | "buffer because lastsize is bufflen.\n", | ||
266 | xid, i, j, dmacount, (u64)addr); | ||
267 | goto out_noddp_free; | ||
268 | } | ||
269 | |||
270 | ddp->udl[j] = (u64)(fcoe->extra_ddp_buffer_dma); | ||
271 | j++; | ||
272 | lastsize = 1; | ||
273 | } | ||
274 | |||
257 | fcbuff = (IXGBE_FCBUFF_4KB << IXGBE_FCBUFF_BUFFSIZE_SHIFT); | 275 | fcbuff = (IXGBE_FCBUFF_4KB << IXGBE_FCBUFF_BUFFSIZE_SHIFT); |
258 | fcbuff |= ((j & 0xff) << IXGBE_FCBUFF_BUFFCNT_SHIFT); | 276 | fcbuff |= ((j & 0xff) << IXGBE_FCBUFF_BUFFCNT_SHIFT); |
259 | fcbuff |= (firstoff << IXGBE_FCBUFF_OFFSET_SHIFT); | 277 | fcbuff |= (firstoff << IXGBE_FCBUFF_OFFSET_SHIFT); |
@@ -532,6 +550,24 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) | |||
532 | e_err(drv, "failed to allocated FCoE DDP pool\n"); | 550 | e_err(drv, "failed to allocated FCoE DDP pool\n"); |
533 | 551 | ||
534 | spin_lock_init(&fcoe->lock); | 552 | spin_lock_init(&fcoe->lock); |
553 | |||
554 | /* Extra buffer to be shared by all DDPs for HW work around */ | ||
555 | fcoe->extra_ddp_buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC); | ||
556 | if (fcoe->extra_ddp_buffer == NULL) { | ||
557 | e_err(drv, "failed to allocated extra DDP buffer\n"); | ||
558 | goto out_extra_ddp_buffer_alloc; | ||
559 | } | ||
560 | |||
561 | fcoe->extra_ddp_buffer_dma = | ||
562 | dma_map_single(&adapter->pdev->dev, | ||
563 | fcoe->extra_ddp_buffer, | ||
564 | IXGBE_FCBUFF_MIN, | ||
565 | DMA_FROM_DEVICE); | ||
566 | if (dma_mapping_error(&adapter->pdev->dev, | ||
567 | fcoe->extra_ddp_buffer_dma)) { | ||
568 | e_err(drv, "failed to map extra DDP buffer\n"); | ||
569 | goto out_extra_ddp_buffer_dma; | ||
570 | } | ||
535 | } | 571 | } |
536 | 572 | ||
537 | /* Enable L2 eth type filter for FCoE */ | 573 | /* Enable L2 eth type filter for FCoE */ |
@@ -581,6 +617,14 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) | |||
581 | } | 617 | } |
582 | } | 618 | } |
583 | #endif | 619 | #endif |
620 | |||
621 | return; | ||
622 | |||
623 | out_extra_ddp_buffer_dma: | ||
624 | kfree(fcoe->extra_ddp_buffer); | ||
625 | out_extra_ddp_buffer_alloc: | ||
626 | pci_pool_destroy(fcoe->pool); | ||
627 | fcoe->pool = NULL; | ||
584 | } | 628 | } |
585 | 629 | ||
586 | /** | 630 | /** |
@@ -600,6 +644,11 @@ void ixgbe_cleanup_fcoe(struct ixgbe_adapter *adapter) | |||
600 | if (fcoe->pool) { | 644 | if (fcoe->pool) { |
601 | for (i = 0; i < IXGBE_FCOE_DDP_MAX; i++) | 645 | for (i = 0; i < IXGBE_FCOE_DDP_MAX; i++) |
602 | ixgbe_fcoe_ddp_put(adapter->netdev, i); | 646 | ixgbe_fcoe_ddp_put(adapter->netdev, i); |
647 | dma_unmap_single(&adapter->pdev->dev, | ||
648 | fcoe->extra_ddp_buffer_dma, | ||
649 | IXGBE_FCBUFF_MIN, | ||
650 | DMA_FROM_DEVICE); | ||
651 | kfree(fcoe->extra_ddp_buffer); | ||
603 | pci_pool_destroy(fcoe->pool); | 652 | pci_pool_destroy(fcoe->pool); |
604 | fcoe->pool = NULL; | 653 | fcoe->pool = NULL; |
605 | } | 654 | } |
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h index 4bc2c551c8db..65cc8fb14fe7 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.h +++ b/drivers/net/ixgbe/ixgbe_fcoe.h | |||
@@ -70,6 +70,8 @@ struct ixgbe_fcoe { | |||
70 | spinlock_t lock; | 70 | spinlock_t lock; |
71 | struct pci_pool *pool; | 71 | struct pci_pool *pool; |
72 | struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; | 72 | struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; |
73 | unsigned char *extra_ddp_buffer; | ||
74 | dma_addr_t extra_ddp_buffer_dma; | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | #endif /* _IXGBE_FCOE_H */ | 77 | #endif /* _IXGBE_FCOE_H */ |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 4f81b5a00775..eca762d954c6 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -3728,7 +3728,8 @@ static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) | |||
3728 | * We need to try and force an autonegotiation | 3728 | * We need to try and force an autonegotiation |
3729 | * session, then bring up link. | 3729 | * session, then bring up link. |
3730 | */ | 3730 | */ |
3731 | hw->mac.ops.setup_sfp(hw); | 3731 | if (hw->mac.ops.setup_sfp) |
3732 | hw->mac.ops.setup_sfp(hw); | ||
3732 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) | 3733 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) |
3733 | schedule_work(&adapter->multispeed_fiber_task); | 3734 | schedule_work(&adapter->multispeed_fiber_task); |
3734 | } else { | 3735 | } else { |
@@ -5971,7 +5972,8 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) | |||
5971 | unregister_netdev(adapter->netdev); | 5972 | unregister_netdev(adapter->netdev); |
5972 | return; | 5973 | return; |
5973 | } | 5974 | } |
5974 | hw->mac.ops.setup_sfp(hw); | 5975 | if (hw->mac.ops.setup_sfp) |
5976 | hw->mac.ops.setup_sfp(hw); | ||
5975 | 5977 | ||
5976 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) | 5978 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) |
5977 | /* This will also work for DA Twinax connections */ | 5979 | /* This will also work for DA Twinax connections */ |
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/net/pch_gbe/pch_gbe.h b/drivers/net/pch_gbe/pch_gbe.h index a0c26a99520f..e1e33c80fb25 100644 --- a/drivers/net/pch_gbe/pch_gbe.h +++ b/drivers/net/pch_gbe/pch_gbe.h | |||
@@ -73,7 +73,7 @@ struct pch_gbe_regs { | |||
73 | struct pch_gbe_regs_mac_adr mac_adr[16]; | 73 | struct pch_gbe_regs_mac_adr mac_adr[16]; |
74 | u32 ADDR_MASK; | 74 | u32 ADDR_MASK; |
75 | u32 MIIM; | 75 | u32 MIIM; |
76 | u32 reserve2; | 76 | u32 MAC_ADDR_LOAD; |
77 | u32 RGMII_ST; | 77 | u32 RGMII_ST; |
78 | u32 RGMII_CTRL; | 78 | u32 RGMII_CTRL; |
79 | u32 reserve3[3]; | 79 | u32 reserve3[3]; |
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c index 1bf12339441b..b99e90aca37d 100644 --- a/drivers/net/pch_gbe/pch_gbe_main.c +++ b/drivers/net/pch_gbe/pch_gbe_main.c | |||
@@ -29,6 +29,7 @@ const char pch_driver_version[] = DRV_VERSION; | |||
29 | #define PCH_GBE_SHORT_PKT 64 | 29 | #define PCH_GBE_SHORT_PKT 64 |
30 | #define DSC_INIT16 0xC000 | 30 | #define DSC_INIT16 0xC000 |
31 | #define PCH_GBE_DMA_ALIGN 0 | 31 | #define PCH_GBE_DMA_ALIGN 0 |
32 | #define PCH_GBE_DMA_PADDING 2 | ||
32 | #define PCH_GBE_WATCHDOG_PERIOD (1 * HZ) /* watchdog time */ | 33 | #define PCH_GBE_WATCHDOG_PERIOD (1 * HZ) /* watchdog time */ |
33 | #define PCH_GBE_COPYBREAK_DEFAULT 256 | 34 | #define PCH_GBE_COPYBREAK_DEFAULT 256 |
34 | #define PCH_GBE_PCI_BAR 1 | 35 | #define PCH_GBE_PCI_BAR 1 |
@@ -88,6 +89,12 @@ static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; | |||
88 | static int pch_gbe_mdio_read(struct net_device *netdev, int addr, int reg); | 89 | static int pch_gbe_mdio_read(struct net_device *netdev, int addr, int reg); |
89 | static void pch_gbe_mdio_write(struct net_device *netdev, int addr, int reg, | 90 | static void pch_gbe_mdio_write(struct net_device *netdev, int addr, int reg, |
90 | int data); | 91 | int data); |
92 | |||
93 | inline void pch_gbe_mac_load_mac_addr(struct pch_gbe_hw *hw) | ||
94 | { | ||
95 | iowrite32(0x01, &hw->reg->MAC_ADDR_LOAD); | ||
96 | } | ||
97 | |||
91 | /** | 98 | /** |
92 | * pch_gbe_mac_read_mac_addr - Read MAC address | 99 | * pch_gbe_mac_read_mac_addr - Read MAC address |
93 | * @hw: Pointer to the HW structure | 100 | * @hw: Pointer to the HW structure |
@@ -519,7 +526,9 @@ static void pch_gbe_reset_task(struct work_struct *work) | |||
519 | struct pch_gbe_adapter *adapter; | 526 | struct pch_gbe_adapter *adapter; |
520 | adapter = container_of(work, struct pch_gbe_adapter, reset_task); | 527 | adapter = container_of(work, struct pch_gbe_adapter, reset_task); |
521 | 528 | ||
529 | rtnl_lock(); | ||
522 | pch_gbe_reinit_locked(adapter); | 530 | pch_gbe_reinit_locked(adapter); |
531 | rtnl_unlock(); | ||
523 | } | 532 | } |
524 | 533 | ||
525 | /** | 534 | /** |
@@ -528,14 +537,8 @@ static void pch_gbe_reset_task(struct work_struct *work) | |||
528 | */ | 537 | */ |
529 | void pch_gbe_reinit_locked(struct pch_gbe_adapter *adapter) | 538 | void pch_gbe_reinit_locked(struct pch_gbe_adapter *adapter) |
530 | { | 539 | { |
531 | struct net_device *netdev = adapter->netdev; | 540 | pch_gbe_down(adapter); |
532 | 541 | pch_gbe_up(adapter); | |
533 | rtnl_lock(); | ||
534 | if (netif_running(netdev)) { | ||
535 | pch_gbe_down(adapter); | ||
536 | pch_gbe_up(adapter); | ||
537 | } | ||
538 | rtnl_unlock(); | ||
539 | } | 542 | } |
540 | 543 | ||
541 | /** | 544 | /** |
@@ -1369,16 +1372,13 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
1369 | struct pch_gbe_buffer *buffer_info; | 1372 | struct pch_gbe_buffer *buffer_info; |
1370 | struct pch_gbe_rx_desc *rx_desc; | 1373 | struct pch_gbe_rx_desc *rx_desc; |
1371 | u32 length; | 1374 | u32 length; |
1372 | unsigned char tmp_packet[ETH_HLEN]; | ||
1373 | unsigned int i; | 1375 | unsigned int i; |
1374 | unsigned int cleaned_count = 0; | 1376 | unsigned int cleaned_count = 0; |
1375 | bool cleaned = false; | 1377 | bool cleaned = false; |
1376 | struct sk_buff *skb; | 1378 | struct sk_buff *skb, *new_skb; |
1377 | u8 dma_status; | 1379 | u8 dma_status; |
1378 | u16 gbec_status; | 1380 | u16 gbec_status; |
1379 | u32 tcp_ip_status; | 1381 | u32 tcp_ip_status; |
1380 | u8 skb_copy_flag = 0; | ||
1381 | u8 skb_padding_flag = 0; | ||
1382 | 1382 | ||
1383 | i = rx_ring->next_to_clean; | 1383 | i = rx_ring->next_to_clean; |
1384 | 1384 | ||
@@ -1422,55 +1422,70 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
1422 | pr_err("Receive CRC Error\n"); | 1422 | pr_err("Receive CRC Error\n"); |
1423 | } else { | 1423 | } else { |
1424 | /* get receive length */ | 1424 | /* get receive length */ |
1425 | /* length convert[-3], padding[-2] */ | 1425 | /* length convert[-3] */ |
1426 | length = (rx_desc->rx_words_eob) - 3 - 2; | 1426 | length = (rx_desc->rx_words_eob) - 3; |
1427 | 1427 | ||
1428 | /* Decide the data conversion method */ | 1428 | /* Decide the data conversion method */ |
1429 | if (!adapter->rx_csum) { | 1429 | if (!adapter->rx_csum) { |
1430 | /* [Header:14][payload] */ | 1430 | /* [Header:14][payload] */ |
1431 | skb_padding_flag = 0; | 1431 | if (NET_IP_ALIGN) { |
1432 | skb_copy_flag = 1; | 1432 | /* Because alignment differs, |
1433 | * the new_skb is newly allocated, | ||
1434 | * and data is copied to new_skb.*/ | ||
1435 | new_skb = netdev_alloc_skb(netdev, | ||
1436 | length + NET_IP_ALIGN); | ||
1437 | if (!new_skb) { | ||
1438 | /* dorrop error */ | ||
1439 | pr_err("New skb allocation " | ||
1440 | "Error\n"); | ||
1441 | goto dorrop; | ||
1442 | } | ||
1443 | skb_reserve(new_skb, NET_IP_ALIGN); | ||
1444 | memcpy(new_skb->data, skb->data, | ||
1445 | length); | ||
1446 | skb = new_skb; | ||
1447 | } else { | ||
1448 | /* DMA buffer is used as SKB as it is.*/ | ||
1449 | buffer_info->skb = NULL; | ||
1450 | } | ||
1433 | } else { | 1451 | } else { |
1434 | /* [Header:14][padding:2][payload] */ | 1452 | /* [Header:14][padding:2][payload] */ |
1435 | skb_padding_flag = 1; | 1453 | /* The length includes padding length */ |
1436 | if (length < copybreak) | 1454 | length = length - PCH_GBE_DMA_PADDING; |
1437 | skb_copy_flag = 1; | 1455 | if ((length < copybreak) || |
1438 | else | 1456 | (NET_IP_ALIGN != PCH_GBE_DMA_PADDING)) { |
1439 | skb_copy_flag = 0; | 1457 | /* Because alignment differs, |
1440 | } | 1458 | * the new_skb is newly allocated, |
1441 | 1459 | * and data is copied to new_skb. | |
1442 | /* Data conversion */ | 1460 | * Padding data is deleted |
1443 | if (skb_copy_flag) { /* recycle skb */ | 1461 | * at the time of a copy.*/ |
1444 | struct sk_buff *new_skb; | 1462 | new_skb = netdev_alloc_skb(netdev, |
1445 | new_skb = | 1463 | length + NET_IP_ALIGN); |
1446 | netdev_alloc_skb(netdev, | 1464 | if (!new_skb) { |
1447 | length + NET_IP_ALIGN); | 1465 | /* dorrop error */ |
1448 | if (new_skb) { | 1466 | pr_err("New skb allocation " |
1449 | if (!skb_padding_flag) { | 1467 | "Error\n"); |
1450 | skb_reserve(new_skb, | 1468 | goto dorrop; |
1451 | NET_IP_ALIGN); | ||
1452 | } | 1469 | } |
1470 | skb_reserve(new_skb, NET_IP_ALIGN); | ||
1453 | memcpy(new_skb->data, skb->data, | 1471 | memcpy(new_skb->data, skb->data, |
1454 | length); | 1472 | ETH_HLEN); |
1455 | /* save the skb | 1473 | memcpy(&new_skb->data[ETH_HLEN], |
1456 | * in buffer_info as good */ | 1474 | &skb->data[ETH_HLEN + |
1475 | PCH_GBE_DMA_PADDING], | ||
1476 | length - ETH_HLEN); | ||
1457 | skb = new_skb; | 1477 | skb = new_skb; |
1458 | } else if (!skb_padding_flag) { | 1478 | } else { |
1459 | /* dorrop error */ | 1479 | /* Padding data is deleted |
1460 | pr_err("New skb allocation Error\n"); | 1480 | * by moving header data.*/ |
1461 | goto dorrop; | 1481 | memmove(&skb->data[PCH_GBE_DMA_PADDING], |
1482 | &skb->data[0], ETH_HLEN); | ||
1483 | skb_reserve(skb, NET_IP_ALIGN); | ||
1484 | buffer_info->skb = NULL; | ||
1462 | } | 1485 | } |
1463 | } else { | ||
1464 | buffer_info->skb = NULL; | ||
1465 | } | 1486 | } |
1466 | if (skb_padding_flag) { | 1487 | /* The length includes FCS length */ |
1467 | memcpy(&tmp_packet[0], &skb->data[0], ETH_HLEN); | 1488 | length = length - ETH_FCS_LEN; |
1468 | memcpy(&skb->data[NET_IP_ALIGN], &tmp_packet[0], | ||
1469 | ETH_HLEN); | ||
1470 | skb_reserve(skb, NET_IP_ALIGN); | ||
1471 | |||
1472 | } | ||
1473 | |||
1474 | /* update status of driver */ | 1489 | /* update status of driver */ |
1475 | adapter->stats.rx_bytes += length; | 1490 | adapter->stats.rx_bytes += length; |
1476 | adapter->stats.rx_packets++; | 1491 | adapter->stats.rx_packets++; |
@@ -2322,6 +2337,7 @@ static int pch_gbe_probe(struct pci_dev *pdev, | |||
2322 | netdev->features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_GRO; | 2337 | netdev->features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_GRO; |
2323 | pch_gbe_set_ethtool_ops(netdev); | 2338 | pch_gbe_set_ethtool_ops(netdev); |
2324 | 2339 | ||
2340 | pch_gbe_mac_load_mac_addr(&adapter->hw); | ||
2325 | pch_gbe_mac_reset_hw(&adapter->hw); | 2341 | pch_gbe_mac_reset_hw(&adapter->hw); |
2326 | 2342 | ||
2327 | /* setup the private structure */ | 2343 | /* setup the private structure */ |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 59ccf0c5c610..469ab0b7ce31 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -3190,6 +3190,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3190 | if (pci_dev_run_wake(pdev)) | 3190 | if (pci_dev_run_wake(pdev)) |
3191 | pm_runtime_put_noidle(&pdev->dev); | 3191 | pm_runtime_put_noidle(&pdev->dev); |
3192 | 3192 | ||
3193 | netif_carrier_off(dev); | ||
3194 | |||
3193 | out: | 3195 | out: |
3194 | return rc; | 3196 | return rc; |
3195 | 3197 | ||
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index 34a0af3837f9..0e5f03135b50 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -1560,8 +1560,10 @@ static int stmmac_mac_device_setup(struct net_device *dev) | |||
1560 | 1560 | ||
1561 | priv->hw = device; | 1561 | priv->hw = device; |
1562 | 1562 | ||
1563 | if (device_can_wakeup(priv->device)) | 1563 | if (device_can_wakeup(priv->device)) { |
1564 | priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */ | 1564 | priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */ |
1565 | enable_irq_wake(dev->irq); | ||
1566 | } | ||
1565 | 1567 | ||
1566 | return 0; | 1568 | return 0; |
1567 | } | 1569 | } |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index bed8fcedff49..6d83812603b6 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -2628,15 +2628,15 @@ exit: | |||
2628 | 2628 | ||
2629 | static void hso_free_tiomget(struct hso_serial *serial) | 2629 | static void hso_free_tiomget(struct hso_serial *serial) |
2630 | { | 2630 | { |
2631 | struct hso_tiocmget *tiocmget = serial->tiocmget; | 2631 | struct hso_tiocmget *tiocmget; |
2632 | if (!serial) | ||
2633 | return; | ||
2634 | tiocmget = serial->tiocmget; | ||
2632 | if (tiocmget) { | 2635 | if (tiocmget) { |
2633 | if (tiocmget->urb) { | 2636 | usb_free_urb(tiocmget->urb); |
2634 | usb_free_urb(tiocmget->urb); | 2637 | tiocmget->urb = NULL; |
2635 | tiocmget->urb = NULL; | ||
2636 | } | ||
2637 | serial->tiocmget = NULL; | 2638 | serial->tiocmget = NULL; |
2638 | kfree(tiocmget); | 2639 | kfree(tiocmget); |
2639 | |||
2640 | } | 2640 | } |
2641 | } | 2641 | } |
2642 | 2642 | ||
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index ed9a41643ff4..95c41d56631c 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -931,8 +931,10 @@ fail_halt: | |||
931 | if (urb != NULL) { | 931 | if (urb != NULL) { |
932 | clear_bit (EVENT_RX_MEMORY, &dev->flags); | 932 | clear_bit (EVENT_RX_MEMORY, &dev->flags); |
933 | status = usb_autopm_get_interface(dev->intf); | 933 | status = usb_autopm_get_interface(dev->intf); |
934 | if (status < 0) | 934 | if (status < 0) { |
935 | usb_free_urb(urb); | ||
935 | goto fail_lowmem; | 936 | goto fail_lowmem; |
937 | } | ||
936 | if (rx_submit (dev, urb, GFP_KERNEL) == -ENOLINK) | 938 | if (rx_submit (dev, urb, GFP_KERNEL) == -ENOLINK) |
937 | resched = 0; | 939 | resched = 0; |
938 | usb_autopm_put_interface(dev->intf); | 940 | usb_autopm_put_interface(dev->intf); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 90a23e410d1b..82dba5aaf423 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq) | |||
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
449 | static void virtnet_napi_enable(struct virtnet_info *vi) | ||
450 | { | ||
451 | napi_enable(&vi->napi); | ||
452 | |||
453 | /* If all buffers were filled by other side before we napi_enabled, we | ||
454 | * won't get another interrupt, so process any outstanding packets | ||
455 | * now. virtnet_poll wants re-enable the queue, so we disable here. | ||
456 | * We synchronize against interrupts via NAPI_STATE_SCHED */ | ||
457 | if (napi_schedule_prep(&vi->napi)) { | ||
458 | virtqueue_disable_cb(vi->rvq); | ||
459 | __napi_schedule(&vi->napi); | ||
460 | } | ||
461 | } | ||
462 | |||
449 | static void refill_work(struct work_struct *work) | 463 | static void refill_work(struct work_struct *work) |
450 | { | 464 | { |
451 | struct virtnet_info *vi; | 465 | struct virtnet_info *vi; |
@@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work) | |||
454 | vi = container_of(work, struct virtnet_info, refill.work); | 468 | vi = container_of(work, struct virtnet_info, refill.work); |
455 | napi_disable(&vi->napi); | 469 | napi_disable(&vi->napi); |
456 | still_empty = !try_fill_recv(vi, GFP_KERNEL); | 470 | still_empty = !try_fill_recv(vi, GFP_KERNEL); |
457 | napi_enable(&vi->napi); | 471 | virtnet_napi_enable(vi); |
458 | 472 | ||
459 | /* In theory, this can happen: if we don't get any buffers in | 473 | /* In theory, this can happen: if we don't get any buffers in |
460 | * we will *never* try to fill again. */ | 474 | * we will *never* try to fill again. */ |
@@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev) | |||
638 | { | 652 | { |
639 | struct virtnet_info *vi = netdev_priv(dev); | 653 | struct virtnet_info *vi = netdev_priv(dev); |
640 | 654 | ||
641 | napi_enable(&vi->napi); | 655 | virtnet_napi_enable(vi); |
642 | |||
643 | /* If all buffers were filled by other side before we napi_enabled, we | ||
644 | * won't get another interrupt, so process any outstanding packets | ||
645 | * now. virtnet_poll wants re-enable the queue, so we disable here. | ||
646 | * We synchronize against interrupts via NAPI_STATE_SCHED */ | ||
647 | if (napi_schedule_prep(&vi->napi)) { | ||
648 | virtqueue_disable_cb(vi->rvq); | ||
649 | __napi_schedule(&vi->napi); | ||
650 | } | ||
651 | return 0; | 656 | return 0; |
652 | } | 657 | } |
653 | 658 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 58213e72d107..166e9f742596 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -402,72 +402,6 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv, | |||
402 | } | 402 | } |
403 | #endif | 403 | #endif |
404 | 404 | ||
405 | /** | ||
406 | * iwl3945_good_plcp_health - checks for plcp error. | ||
407 | * | ||
408 | * When the plcp error is exceeding the thresholds, reset the radio | ||
409 | * to improve the throughput. | ||
410 | */ | ||
411 | static bool iwl3945_good_plcp_health(struct iwl_priv *priv, | ||
412 | struct iwl_rx_packet *pkt) | ||
413 | { | ||
414 | bool rc = true; | ||
415 | struct iwl3945_notif_statistics current_stat; | ||
416 | int combined_plcp_delta; | ||
417 | unsigned int plcp_msec; | ||
418 | unsigned long plcp_received_jiffies; | ||
419 | |||
420 | if (priv->cfg->base_params->plcp_delta_threshold == | ||
421 | IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE) { | ||
422 | IWL_DEBUG_RADIO(priv, "plcp_err check disabled\n"); | ||
423 | return rc; | ||
424 | } | ||
425 | memcpy(¤t_stat, pkt->u.raw, sizeof(struct | ||
426 | iwl3945_notif_statistics)); | ||
427 | /* | ||
428 | * check for plcp_err and trigger radio reset if it exceeds | ||
429 | * the plcp error threshold plcp_delta. | ||
430 | */ | ||
431 | plcp_received_jiffies = jiffies; | ||
432 | plcp_msec = jiffies_to_msecs((long) plcp_received_jiffies - | ||
433 | (long) priv->plcp_jiffies); | ||
434 | priv->plcp_jiffies = plcp_received_jiffies; | ||
435 | /* | ||
436 | * check to make sure plcp_msec is not 0 to prevent division | ||
437 | * by zero. | ||
438 | */ | ||
439 | if (plcp_msec) { | ||
440 | combined_plcp_delta = | ||
441 | (le32_to_cpu(current_stat.rx.ofdm.plcp_err) - | ||
442 | le32_to_cpu(priv->_3945.statistics.rx.ofdm.plcp_err)); | ||
443 | |||
444 | if ((combined_plcp_delta > 0) && | ||
445 | ((combined_plcp_delta * 100) / plcp_msec) > | ||
446 | priv->cfg->base_params->plcp_delta_threshold) { | ||
447 | /* | ||
448 | * if plcp_err exceed the threshold, the following | ||
449 | * data is printed in csv format: | ||
450 | * Text: plcp_err exceeded %d, | ||
451 | * Received ofdm.plcp_err, | ||
452 | * Current ofdm.plcp_err, | ||
453 | * combined_plcp_delta, | ||
454 | * plcp_msec | ||
455 | */ | ||
456 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " | ||
457 | "%u, %d, %u mSecs\n", | ||
458 | priv->cfg->base_params->plcp_delta_threshold, | ||
459 | le32_to_cpu(current_stat.rx.ofdm.plcp_err), | ||
460 | combined_plcp_delta, plcp_msec); | ||
461 | /* | ||
462 | * Reset the RF radio due to the high plcp | ||
463 | * error rate | ||
464 | */ | ||
465 | rc = false; | ||
466 | } | ||
467 | } | ||
468 | return rc; | ||
469 | } | ||
470 | |||
471 | void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | 405 | void iwl3945_hw_rx_statistics(struct iwl_priv *priv, |
472 | struct iwl_rx_mem_buffer *rxb) | 406 | struct iwl_rx_mem_buffer *rxb) |
473 | { | 407 | { |
@@ -2734,7 +2668,6 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
2734 | .isr_ops = { | 2668 | .isr_ops = { |
2735 | .isr = iwl_isr_legacy, | 2669 | .isr = iwl_isr_legacy, |
2736 | }, | 2670 | }, |
2737 | .check_plcp_health = iwl3945_good_plcp_health, | ||
2738 | 2671 | ||
2739 | .debugfs_ops = { | 2672 | .debugfs_ops = { |
2740 | .rx_stats_read = iwl3945_ucode_rx_stats_read, | 2673 | .rx_stats_read = iwl3945_ucode_rx_stats_read, |
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index a2d9d1e59260..a848e02e6be3 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -678,7 +678,7 @@ void parport_unregister_device(struct pardevice *dev) | |||
678 | 678 | ||
679 | /* Make sure we haven't left any pointers around in the wait | 679 | /* Make sure we haven't left any pointers around in the wait |
680 | * list. */ | 680 | * list. */ |
681 | spin_lock (&port->waitlist_lock); | 681 | spin_lock_irq(&port->waitlist_lock); |
682 | if (dev->waitprev || dev->waitnext || port->waithead == dev) { | 682 | if (dev->waitprev || dev->waitnext || port->waithead == dev) { |
683 | if (dev->waitprev) | 683 | if (dev->waitprev) |
684 | dev->waitprev->waitnext = dev->waitnext; | 684 | dev->waitprev->waitnext = dev->waitnext; |
@@ -689,7 +689,7 @@ void parport_unregister_device(struct pardevice *dev) | |||
689 | else | 689 | else |
690 | port->waittail = dev->waitprev; | 690 | port->waittail = dev->waitprev; |
691 | } | 691 | } |
692 | spin_unlock (&port->waitlist_lock); | 692 | spin_unlock_irq(&port->waitlist_lock); |
693 | 693 | ||
694 | kfree(dev->state); | 694 | kfree(dev->state); |
695 | kfree(dev); | 695 | kfree(dev); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 8ecaac983923..ea25e5bfcf23 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/capability.h> | 25 | #include <linux/capability.h> |
26 | #include <linux/security.h> | ||
26 | #include <linux/pci-aspm.h> | 27 | #include <linux/pci-aspm.h> |
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include "pci.h" | 29 | #include "pci.h" |
@@ -368,7 +369,7 @@ pci_read_config(struct file *filp, struct kobject *kobj, | |||
368 | u8 *data = (u8*) buf; | 369 | u8 *data = (u8*) buf; |
369 | 370 | ||
370 | /* Several chips lock up trying to read undefined config space */ | 371 | /* Several chips lock up trying to read undefined config space */ |
371 | if (cap_raised(filp->f_cred->cap_effective, CAP_SYS_ADMIN)) { | 372 | if (security_capable(filp->f_cred, CAP_SYS_ADMIN) == 0) { |
372 | size = dev->cfg_size; | 373 | size = dev->cfg_size; |
373 | } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { | 374 | } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { |
374 | size = 128; | 375 | size = 128; |
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 1752ef006d26..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 */ |
@@ -161,7 +160,7 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id) | |||
161 | { | 160 | { |
162 | int i, nc, bytes, d; | 161 | int i, nc, bytes, d; |
163 | u32 offset = 0; | 162 | u32 offset = 0; |
164 | u32 err = 0; | 163 | int err; |
165 | u8 cbuf[IPC_WWBUF_SIZE] = { }; | 164 | u8 cbuf[IPC_WWBUF_SIZE] = { }; |
166 | u32 *wbuf = (u32 *)&cbuf; | 165 | u32 *wbuf = (u32 *)&cbuf; |
167 | 166 | ||
@@ -404,7 +403,7 @@ EXPORT_SYMBOL(intel_scu_ipc_update_register); | |||
404 | */ | 403 | */ |
405 | int intel_scu_ipc_simple_command(int cmd, int sub) | 404 | int intel_scu_ipc_simple_command(int cmd, int sub) |
406 | { | 405 | { |
407 | u32 err = 0; | 406 | int err; |
408 | 407 | ||
409 | mutex_lock(&ipclock); | 408 | mutex_lock(&ipclock); |
410 | if (ipcdev.pdev == NULL) { | 409 | if (ipcdev.pdev == NULL) { |
@@ -434,8 +433,7 @@ EXPORT_SYMBOL(intel_scu_ipc_simple_command); | |||
434 | int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, | 433 | int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, |
435 | u32 *out, int outlen) | 434 | u32 *out, int outlen) |
436 | { | 435 | { |
437 | u32 err = 0; | 436 | int i, err; |
438 | int i = 0; | ||
439 | 437 | ||
440 | mutex_lock(&ipclock); | 438 | mutex_lock(&ipclock); |
441 | if (ipcdev.pdev == NULL) { | 439 | if (ipcdev.pdev == NULL) { |
diff --git a/drivers/platform/x86/intel_scu_ipcutil.c b/drivers/platform/x86/intel_scu_ipcutil.c index ba3231d0819e..b93a03259c16 100644 --- a/drivers/platform/x86/intel_scu_ipcutil.c +++ b/drivers/platform/x86/intel_scu_ipcutil.c | |||
@@ -128,6 +128,6 @@ static void __exit ipc_module_exit(void) | |||
128 | module_init(ipc_module_init); | 128 | module_init(ipc_module_init); |
129 | module_exit(ipc_module_exit); | 129 | module_exit(ipc_module_exit); |
130 | 130 | ||
131 | MODULE_LICENSE("GPL V2"); | 131 | MODULE_LICENSE("GPL v2"); |
132 | MODULE_DESCRIPTION("Utility driver for intel scu ipc"); | 132 | MODULE_DESCRIPTION("Utility driver for intel scu ipc"); |
133 | MODULE_AUTHOR("Sreedhara <sreedhara.ds@intel.com>"); | 133 | MODULE_AUTHOR("Sreedhara <sreedhara.ds@intel.com>"); |
diff --git a/drivers/pps/clients/pps-ktimer.c b/drivers/pps/clients/pps-ktimer.c index 2728469d3884..82583b0ff82d 100644 --- a/drivers/pps/clients/pps-ktimer.c +++ b/drivers/pps/clients/pps-ktimer.c | |||
@@ -46,8 +46,6 @@ static void pps_ktimer_event(unsigned long ptr) | |||
46 | /* First of all we get the time stamp... */ | 46 | /* First of all we get the time stamp... */ |
47 | pps_get_ts(&ts); | 47 | pps_get_ts(&ts); |
48 | 48 | ||
49 | dev_info(pps->dev, "PPS event at %lu\n", jiffies); | ||
50 | |||
51 | pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL); | 49 | pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL); |
52 | 50 | ||
53 | mod_timer(&ktimer, jiffies + HZ); | 51 | mod_timer(&ktimer, jiffies + HZ); |
diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c index 32221efd9ca9..c571d6dd8f61 100644 --- a/drivers/pps/clients/pps_parport.c +++ b/drivers/pps/clients/pps_parport.c | |||
@@ -163,7 +163,7 @@ static void parport_attach(struct parport *port) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | device->pardev = parport_register_device(port, KBUILD_MODNAME, | 165 | device->pardev = parport_register_device(port, KBUILD_MODNAME, |
166 | NULL, NULL, parport_irq, 0, device); | 166 | NULL, NULL, parport_irq, PARPORT_FLAG_EXCL, device); |
167 | if (!device->pardev) { | 167 | if (!device->pardev) { |
168 | pr_err("couldn't register with %s\n", port->name); | 168 | pr_err("couldn't register with %s\n", port->name); |
169 | goto err_free; | 169 | goto err_free; |
diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c index 5c32f8dacf56..b93af3ebb5ba 100644 --- a/drivers/pps/generators/pps_gen_parport.c +++ b/drivers/pps/generators/pps_gen_parport.c | |||
@@ -198,7 +198,7 @@ static void parport_attach(struct parport *port) | |||
198 | } | 198 | } |
199 | 199 | ||
200 | device.pardev = parport_register_device(port, KBUILD_MODNAME, | 200 | device.pardev = parport_register_device(port, KBUILD_MODNAME, |
201 | NULL, NULL, NULL, 0, &device); | 201 | NULL, NULL, NULL, PARPORT_FLAG_EXCL, &device); |
202 | if (!device.pardev) { | 202 | if (!device.pardev) { |
203 | pr_err("couldn't register with %s\n", port->name); | 203 | pr_err("couldn't register with %s\n", port->name); |
204 | return; | 204 | return; |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index cdd97192dc69..4941cade319f 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -97,6 +97,18 @@ config RTC_INTF_DEV | |||
97 | 97 | ||
98 | If unsure, say Y. | 98 | If unsure, say Y. |
99 | 99 | ||
100 | config RTC_INTF_DEV_UIE_EMUL | ||
101 | bool "RTC UIE emulation on dev interface" | ||
102 | depends on RTC_INTF_DEV | ||
103 | help | ||
104 | Provides an emulation for RTC_UIE if the underlying rtc chip | ||
105 | driver does not expose RTC_UIE ioctls. Those requests generate | ||
106 | once-per-second update interrupts, used for synchronization. | ||
107 | |||
108 | The emulation code will read the time from the hardware | ||
109 | clock several times per second, please enable this option | ||
110 | only if you know that you really need it. | ||
111 | |||
100 | config RTC_DRV_TEST | 112 | config RTC_DRV_TEST |
101 | tristate "Test driver/device" | 113 | tristate "Test driver/device" |
102 | help | 114 | help |
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 9583cbcc6b79..c404b61386bf 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -143,6 +143,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
143 | rtc->id = id; | 143 | rtc->id = id; |
144 | rtc->ops = ops; | 144 | rtc->ops = ops; |
145 | rtc->owner = owner; | 145 | rtc->owner = owner; |
146 | rtc->irq_freq = 1; | ||
146 | rtc->max_user_freq = 64; | 147 | rtc->max_user_freq = 64; |
147 | rtc->dev.parent = dev; | 148 | rtc->dev.parent = dev; |
148 | rtc->dev.class = rtc_class; | 149 | rtc->dev.class = rtc_class; |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 925006d33109..cb2f0728fd70 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -209,9 +209,8 @@ int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | if (err) | 211 | if (err) |
212 | return err; | 212 | /* nothing */; |
213 | 213 | else if (!rtc->ops) | |
214 | if (!rtc->ops) | ||
215 | err = -ENODEV; | 214 | err = -ENODEV; |
216 | else if (!rtc->ops->alarm_irq_enable) | 215 | else if (!rtc->ops->alarm_irq_enable) |
217 | err = -EINVAL; | 216 | err = -EINVAL; |
@@ -229,6 +228,12 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled) | |||
229 | if (err) | 228 | if (err) |
230 | return err; | 229 | return err; |
231 | 230 | ||
231 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | ||
232 | if (enabled == 0 && rtc->uie_irq_active) { | ||
233 | mutex_unlock(&rtc->ops_lock); | ||
234 | return rtc_dev_update_irq_enable_emul(rtc, 0); | ||
235 | } | ||
236 | #endif | ||
232 | /* make sure we're changing state */ | 237 | /* make sure we're changing state */ |
233 | if (rtc->uie_rtctimer.enabled == enabled) | 238 | if (rtc->uie_rtctimer.enabled == enabled) |
234 | goto out; | 239 | goto out; |
@@ -248,6 +253,16 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled) | |||
248 | 253 | ||
249 | out: | 254 | out: |
250 | mutex_unlock(&rtc->ops_lock); | 255 | mutex_unlock(&rtc->ops_lock); |
256 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | ||
257 | /* | ||
258 | * Enable emulation if the driver did not provide | ||
259 | * the update_irq_enable function pointer or if returned | ||
260 | * -EINVAL to signal that it has been configured without | ||
261 | * interrupts or that are not available at the moment. | ||
262 | */ | ||
263 | if (err == -EINVAL) | ||
264 | err = rtc_dev_update_irq_enable_emul(rtc, enabled); | ||
265 | #endif | ||
251 | return err; | 266 | return err; |
252 | 267 | ||
253 | } | 268 | } |
@@ -263,7 +278,7 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable); | |||
263 | * | 278 | * |
264 | * Triggers the registered irq_task function callback. | 279 | * Triggers the registered irq_task function callback. |
265 | */ | 280 | */ |
266 | static void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode) | 281 | void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode) |
267 | { | 282 | { |
268 | unsigned long flags; | 283 | unsigned long flags; |
269 | 284 | ||
@@ -464,6 +479,9 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) | |||
464 | int err = 0; | 479 | int err = 0; |
465 | unsigned long flags; | 480 | unsigned long flags; |
466 | 481 | ||
482 | if (freq <= 0) | ||
483 | return -EINVAL; | ||
484 | |||
467 | spin_lock_irqsave(&rtc->irq_task_lock, flags); | 485 | spin_lock_irqsave(&rtc->irq_task_lock, flags); |
468 | if (rtc->irq_task != NULL && task == NULL) | 486 | if (rtc->irq_task != NULL && task == NULL) |
469 | err = -EBUSY; | 487 | err = -EBUSY; |
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c index b2752b6e7a2f..e725d51e773d 100644 --- a/drivers/rtc/rtc-at32ap700x.c +++ b/drivers/rtc/rtc-at32ap700x.c | |||
@@ -134,36 +134,29 @@ static int at32_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
134 | return ret; | 134 | return ret; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int at32_rtc_ioctl(struct device *dev, unsigned int cmd, | 137 | static int at32_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
138 | unsigned long arg) | ||
139 | { | 138 | { |
140 | struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); | 139 | struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); |
141 | int ret = 0; | 140 | int ret = 0; |
142 | 141 | ||
143 | spin_lock_irq(&rtc->lock); | 142 | spin_lock_irq(&rtc->lock); |
144 | 143 | ||
145 | switch (cmd) { | 144 | if(enabled) { |
146 | case RTC_AIE_ON: | ||
147 | if (rtc_readl(rtc, VAL) > rtc->alarm_time) { | 145 | if (rtc_readl(rtc, VAL) > rtc->alarm_time) { |
148 | ret = -EINVAL; | 146 | ret = -EINVAL; |
149 | break; | 147 | goto out; |
150 | } | 148 | } |
151 | rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL) | 149 | rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL) |
152 | | RTC_BIT(CTRL_TOPEN)); | 150 | | RTC_BIT(CTRL_TOPEN)); |
153 | rtc_writel(rtc, ICR, RTC_BIT(ICR_TOPI)); | 151 | rtc_writel(rtc, ICR, RTC_BIT(ICR_TOPI)); |
154 | rtc_writel(rtc, IER, RTC_BIT(IER_TOPI)); | 152 | rtc_writel(rtc, IER, RTC_BIT(IER_TOPI)); |
155 | break; | 153 | } else { |
156 | case RTC_AIE_OFF: | ||
157 | rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL) | 154 | rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL) |
158 | & ~RTC_BIT(CTRL_TOPEN)); | 155 | & ~RTC_BIT(CTRL_TOPEN)); |
159 | rtc_writel(rtc, IDR, RTC_BIT(IDR_TOPI)); | 156 | rtc_writel(rtc, IDR, RTC_BIT(IDR_TOPI)); |
160 | rtc_writel(rtc, ICR, RTC_BIT(ICR_TOPI)); | 157 | rtc_writel(rtc, ICR, RTC_BIT(ICR_TOPI)); |
161 | break; | ||
162 | default: | ||
163 | ret = -ENOIOCTLCMD; | ||
164 | break; | ||
165 | } | 158 | } |
166 | 159 | out: | |
167 | spin_unlock_irq(&rtc->lock); | 160 | spin_unlock_irq(&rtc->lock); |
168 | 161 | ||
169 | return ret; | 162 | return ret; |
@@ -195,11 +188,11 @@ static irqreturn_t at32_rtc_interrupt(int irq, void *dev_id) | |||
195 | } | 188 | } |
196 | 189 | ||
197 | static struct rtc_class_ops at32_rtc_ops = { | 190 | static struct rtc_class_ops at32_rtc_ops = { |
198 | .ioctl = at32_rtc_ioctl, | ||
199 | .read_time = at32_rtc_readtime, | 191 | .read_time = at32_rtc_readtime, |
200 | .set_time = at32_rtc_settime, | 192 | .set_time = at32_rtc_settime, |
201 | .read_alarm = at32_rtc_readalarm, | 193 | .read_alarm = at32_rtc_readalarm, |
202 | .set_alarm = at32_rtc_setalarm, | 194 | .set_alarm = at32_rtc_setalarm, |
195 | .alarm_irq_enable = at32_rtc_alarm_irq_enable, | ||
203 | }; | 196 | }; |
204 | 197 | ||
205 | static int __init at32_rtc_probe(struct platform_device *pdev) | 198 | static int __init at32_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index bc8bbca9a2e2..26d1cf5d19ae 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -195,13 +195,6 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
195 | 195 | ||
196 | /* important: scrub old status before enabling IRQs */ | 196 | /* important: scrub old status before enabling IRQs */ |
197 | switch (cmd) { | 197 | switch (cmd) { |
198 | case RTC_AIE_OFF: /* alarm off */ | ||
199 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | ||
200 | break; | ||
201 | case RTC_AIE_ON: /* alarm on */ | ||
202 | at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | ||
203 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | ||
204 | break; | ||
205 | case RTC_UIE_OFF: /* update off */ | 198 | case RTC_UIE_OFF: /* update off */ |
206 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_SECEV); | 199 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_SECEV); |
207 | break; | 200 | break; |
@@ -217,6 +210,18 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
217 | return ret; | 210 | return ret; |
218 | } | 211 | } |
219 | 212 | ||
213 | static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
214 | { | ||
215 | pr_debug("%s(): cmd=%08x\n", __func__, enabled); | ||
216 | |||
217 | if (enabled) { | ||
218 | at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | ||
219 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | ||
220 | } else | ||
221 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
220 | /* | 225 | /* |
221 | * Provide additional RTC information in /proc/driver/rtc | 226 | * Provide additional RTC information in /proc/driver/rtc |
222 | */ | 227 | */ |
@@ -270,6 +275,7 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
270 | .read_alarm = at91_rtc_readalarm, | 275 | .read_alarm = at91_rtc_readalarm, |
271 | .set_alarm = at91_rtc_setalarm, | 276 | .set_alarm = at91_rtc_setalarm, |
272 | .proc = at91_rtc_proc, | 277 | .proc = at91_rtc_proc, |
278 | .alarm_irq_enable = at91_rtc_alarm_irq_enable, | ||
273 | }; | 279 | }; |
274 | 280 | ||
275 | /* | 281 | /* |
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index f677e0710ca1..c36749e4c926 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -229,12 +229,6 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
229 | dev_dbg(dev, "ioctl: cmd=%08x, arg=%08lx, mr %08x\n", cmd, arg, mr); | 229 | dev_dbg(dev, "ioctl: cmd=%08x, arg=%08lx, mr %08x\n", cmd, arg, mr); |
230 | 230 | ||
231 | switch (cmd) { | 231 | switch (cmd) { |
232 | case RTC_AIE_OFF: /* alarm off */ | ||
233 | rtt_writel(rtc, MR, mr & ~AT91_RTT_ALMIEN); | ||
234 | break; | ||
235 | case RTC_AIE_ON: /* alarm on */ | ||
236 | rtt_writel(rtc, MR, mr | AT91_RTT_ALMIEN); | ||
237 | break; | ||
238 | case RTC_UIE_OFF: /* update off */ | 232 | case RTC_UIE_OFF: /* update off */ |
239 | rtt_writel(rtc, MR, mr & ~AT91_RTT_RTTINCIEN); | 233 | rtt_writel(rtc, MR, mr & ~AT91_RTT_RTTINCIEN); |
240 | break; | 234 | break; |
@@ -249,6 +243,19 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
249 | return ret; | 243 | return ret; |
250 | } | 244 | } |
251 | 245 | ||
246 | static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
247 | { | ||
248 | struct sam9_rtc *rtc = dev_get_drvdata(dev); | ||
249 | u32 mr = rtt_readl(rtc, MR); | ||
250 | |||
251 | dev_dbg(dev, "alarm_irq_enable: enabled=%08x, mr %08x\n", enabled, mr); | ||
252 | if (enabled) | ||
253 | rtt_writel(rtc, MR, mr | AT91_RTT_ALMIEN); | ||
254 | else | ||
255 | rtt_writel(rtc, MR, mr & ~AT91_RTT_ALMIEN); | ||
256 | return 0; | ||
257 | } | ||
258 | |||
252 | /* | 259 | /* |
253 | * Provide additional RTC information in /proc/driver/rtc | 260 | * Provide additional RTC information in /proc/driver/rtc |
254 | */ | 261 | */ |
@@ -302,6 +309,7 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
302 | .read_alarm = at91_rtc_readalarm, | 309 | .read_alarm = at91_rtc_readalarm, |
303 | .set_alarm = at91_rtc_setalarm, | 310 | .set_alarm = at91_rtc_setalarm, |
304 | .proc = at91_rtc_proc, | 311 | .proc = at91_rtc_proc, |
312 | .alarm_irq_enabled = at91_rtc_alarm_irq_enable, | ||
305 | }; | 313 | }; |
306 | 314 | ||
307 | /* | 315 | /* |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index b4b6087f2234..17971d93354d 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
@@ -259,15 +259,6 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar | |||
259 | bfin_rtc_int_clear(~RTC_ISTAT_SEC); | 259 | bfin_rtc_int_clear(~RTC_ISTAT_SEC); |
260 | break; | 260 | break; |
261 | 261 | ||
262 | case RTC_AIE_ON: | ||
263 | dev_dbg_stamp(dev); | ||
264 | bfin_rtc_int_set_alarm(rtc); | ||
265 | break; | ||
266 | case RTC_AIE_OFF: | ||
267 | dev_dbg_stamp(dev); | ||
268 | bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); | ||
269 | break; | ||
270 | |||
271 | default: | 262 | default: |
272 | dev_dbg_stamp(dev); | 263 | dev_dbg_stamp(dev); |
273 | ret = -ENOIOCTLCMD; | 264 | ret = -ENOIOCTLCMD; |
@@ -276,6 +267,17 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar | |||
276 | return ret; | 267 | return ret; |
277 | } | 268 | } |
278 | 269 | ||
270 | static int bfin_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
271 | { | ||
272 | struct bfin_rtc *rtc = dev_get_drvdata(dev); | ||
273 | |||
274 | dev_dbg_stamp(dev); | ||
275 | if (enabled) | ||
276 | bfin_rtc_int_set_alarm(rtc); | ||
277 | else | ||
278 | bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); | ||
279 | } | ||
280 | |||
279 | static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) | 281 | static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) |
280 | { | 282 | { |
281 | struct bfin_rtc *rtc = dev_get_drvdata(dev); | 283 | struct bfin_rtc *rtc = dev_get_drvdata(dev); |
@@ -362,6 +364,7 @@ static struct rtc_class_ops bfin_rtc_ops = { | |||
362 | .read_alarm = bfin_rtc_read_alarm, | 364 | .read_alarm = bfin_rtc_read_alarm, |
363 | .set_alarm = bfin_rtc_set_alarm, | 365 | .set_alarm = bfin_rtc_set_alarm, |
364 | .proc = bfin_rtc_proc, | 366 | .proc = bfin_rtc_proc, |
367 | .alarm_irq_enable = bfin_rtc_alarm_irq_enable, | ||
365 | }; | 368 | }; |
366 | 369 | ||
367 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) | 370 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 212b16edafc0..d0e06edb14c5 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -46,6 +46,105 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
46 | return err; | 46 | return err; |
47 | } | 47 | } |
48 | 48 | ||
49 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | ||
50 | /* | ||
51 | * Routine to poll RTC seconds field for change as often as possible, | ||
52 | * after first RTC_UIE use timer to reduce polling | ||
53 | */ | ||
54 | static void rtc_uie_task(struct work_struct *work) | ||
55 | { | ||
56 | struct rtc_device *rtc = | ||
57 | container_of(work, struct rtc_device, uie_task); | ||
58 | struct rtc_time tm; | ||
59 | int num = 0; | ||
60 | int err; | ||
61 | |||
62 | err = rtc_read_time(rtc, &tm); | ||
63 | |||
64 | spin_lock_irq(&rtc->irq_lock); | ||
65 | if (rtc->stop_uie_polling || err) { | ||
66 | rtc->uie_task_active = 0; | ||
67 | } else if (rtc->oldsecs != tm.tm_sec) { | ||
68 | num = (tm.tm_sec + 60 - rtc->oldsecs) % 60; | ||
69 | rtc->oldsecs = tm.tm_sec; | ||
70 | rtc->uie_timer.expires = jiffies + HZ - (HZ/10); | ||
71 | rtc->uie_timer_active = 1; | ||
72 | rtc->uie_task_active = 0; | ||
73 | add_timer(&rtc->uie_timer); | ||
74 | } else if (schedule_work(&rtc->uie_task) == 0) { | ||
75 | rtc->uie_task_active = 0; | ||
76 | } | ||
77 | spin_unlock_irq(&rtc->irq_lock); | ||
78 | if (num) | ||
79 | rtc_handle_legacy_irq(rtc, num, RTC_UF); | ||
80 | } | ||
81 | static void rtc_uie_timer(unsigned long data) | ||
82 | { | ||
83 | struct rtc_device *rtc = (struct rtc_device *)data; | ||
84 | unsigned long flags; | ||
85 | |||
86 | spin_lock_irqsave(&rtc->irq_lock, flags); | ||
87 | rtc->uie_timer_active = 0; | ||
88 | rtc->uie_task_active = 1; | ||
89 | if ((schedule_work(&rtc->uie_task) == 0)) | ||
90 | rtc->uie_task_active = 0; | ||
91 | spin_unlock_irqrestore(&rtc->irq_lock, flags); | ||
92 | } | ||
93 | |||
94 | static int clear_uie(struct rtc_device *rtc) | ||
95 | { | ||
96 | spin_lock_irq(&rtc->irq_lock); | ||
97 | if (rtc->uie_irq_active) { | ||
98 | rtc->stop_uie_polling = 1; | ||
99 | if (rtc->uie_timer_active) { | ||
100 | spin_unlock_irq(&rtc->irq_lock); | ||
101 | del_timer_sync(&rtc->uie_timer); | ||
102 | spin_lock_irq(&rtc->irq_lock); | ||
103 | rtc->uie_timer_active = 0; | ||
104 | } | ||
105 | if (rtc->uie_task_active) { | ||
106 | spin_unlock_irq(&rtc->irq_lock); | ||
107 | flush_scheduled_work(); | ||
108 | spin_lock_irq(&rtc->irq_lock); | ||
109 | } | ||
110 | rtc->uie_irq_active = 0; | ||
111 | } | ||
112 | spin_unlock_irq(&rtc->irq_lock); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static int set_uie(struct rtc_device *rtc) | ||
117 | { | ||
118 | struct rtc_time tm; | ||
119 | int err; | ||
120 | |||
121 | err = rtc_read_time(rtc, &tm); | ||
122 | if (err) | ||
123 | return err; | ||
124 | spin_lock_irq(&rtc->irq_lock); | ||
125 | if (!rtc->uie_irq_active) { | ||
126 | rtc->uie_irq_active = 1; | ||
127 | rtc->stop_uie_polling = 0; | ||
128 | rtc->oldsecs = tm.tm_sec; | ||
129 | rtc->uie_task_active = 1; | ||
130 | if (schedule_work(&rtc->uie_task) == 0) | ||
131 | rtc->uie_task_active = 0; | ||
132 | } | ||
133 | rtc->irq_data = 0; | ||
134 | spin_unlock_irq(&rtc->irq_lock); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, unsigned int enabled) | ||
139 | { | ||
140 | if (enabled) | ||
141 | return set_uie(rtc); | ||
142 | else | ||
143 | return clear_uie(rtc); | ||
144 | } | ||
145 | EXPORT_SYMBOL(rtc_dev_update_irq_enable_emul); | ||
146 | |||
147 | #endif /* CONFIG_RTC_INTF_DEV_UIE_EMUL */ | ||
49 | 148 | ||
50 | static ssize_t | 149 | static ssize_t |
51 | rtc_dev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 150 | rtc_dev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
@@ -154,19 +253,7 @@ static long rtc_dev_ioctl(struct file *file, | |||
154 | if (err) | 253 | if (err) |
155 | goto done; | 254 | goto done; |
156 | 255 | ||
157 | /* try the driver's ioctl interface */ | 256 | /* |
158 | if (ops->ioctl) { | ||
159 | err = ops->ioctl(rtc->dev.parent, cmd, arg); | ||
160 | if (err != -ENOIOCTLCMD) { | ||
161 | mutex_unlock(&rtc->ops_lock); | ||
162 | return err; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | /* if the driver does not provide the ioctl interface | ||
167 | * or if that particular ioctl was not implemented | ||
168 | * (-ENOIOCTLCMD), we will try to emulate here. | ||
169 | * | ||
170 | * Drivers *SHOULD NOT* provide ioctl implementations | 257 | * Drivers *SHOULD NOT* provide ioctl implementations |
171 | * for these requests. Instead, provide methods to | 258 | * for these requests. Instead, provide methods to |
172 | * support the following code, so that the RTC's main | 259 | * support the following code, so that the RTC's main |
@@ -329,7 +416,12 @@ static long rtc_dev_ioctl(struct file *file, | |||
329 | return err; | 416 | return err; |
330 | 417 | ||
331 | default: | 418 | default: |
332 | err = -ENOTTY; | 419 | /* Finally try the driver's ioctl interface */ |
420 | if (ops->ioctl) { | ||
421 | err = ops->ioctl(rtc->dev.parent, cmd, arg); | ||
422 | if (err == -ENOIOCTLCMD) | ||
423 | err = -ENOTTY; | ||
424 | } | ||
333 | break; | 425 | break; |
334 | } | 426 | } |
335 | 427 | ||
@@ -394,6 +486,11 @@ void rtc_dev_prepare(struct rtc_device *rtc) | |||
394 | 486 | ||
395 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); | 487 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); |
396 | 488 | ||
489 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | ||
490 | INIT_WORK(&rtc->uie_task, rtc_uie_task); | ||
491 | setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); | ||
492 | #endif | ||
493 | |||
397 | cdev_init(&rtc->char_dev, &rtc_dev_fops); | 494 | cdev_init(&rtc->char_dev, &rtc_dev_fops); |
398 | rtc->char_dev.owner = rtc->owner; | 495 | rtc->char_dev.owner = rtc->owner; |
399 | } | 496 | } |
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c index bf430f9091ed..60ce69600828 100644 --- a/drivers/rtc/rtc-ds1286.c +++ b/drivers/rtc/rtc-ds1286.c | |||
@@ -40,6 +40,26 @@ static inline void ds1286_rtc_write(struct ds1286_priv *priv, u8 data, int reg) | |||
40 | __raw_writel(data, &priv->rtcregs[reg]); | 40 | __raw_writel(data, &priv->rtcregs[reg]); |
41 | } | 41 | } |
42 | 42 | ||
43 | |||
44 | static int ds1286_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
45 | { | ||
46 | struct ds1286_priv *priv = dev_get_drvdata(dev); | ||
47 | unsigned long flags; | ||
48 | unsigned char val; | ||
49 | |||
50 | /* Allow or mask alarm interrupts */ | ||
51 | spin_lock_irqsave(&priv->lock, flags); | ||
52 | val = ds1286_rtc_read(priv, RTC_CMD); | ||
53 | if (enabled) | ||
54 | val &= ~RTC_TDM; | ||
55 | else | ||
56 | val |= RTC_TDM; | ||
57 | ds1286_rtc_write(priv, val, RTC_CMD); | ||
58 | spin_unlock_irqrestore(&priv->lock, flags); | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
43 | #ifdef CONFIG_RTC_INTF_DEV | 63 | #ifdef CONFIG_RTC_INTF_DEV |
44 | 64 | ||
45 | static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 65 | static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) |
@@ -49,22 +69,6 @@ static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
49 | unsigned char val; | 69 | unsigned char val; |
50 | 70 | ||
51 | switch (cmd) { | 71 | switch (cmd) { |
52 | case RTC_AIE_OFF: | ||
53 | /* Mask alarm int. enab. bit */ | ||
54 | spin_lock_irqsave(&priv->lock, flags); | ||
55 | val = ds1286_rtc_read(priv, RTC_CMD); | ||
56 | val |= RTC_TDM; | ||
57 | ds1286_rtc_write(priv, val, RTC_CMD); | ||
58 | spin_unlock_irqrestore(&priv->lock, flags); | ||
59 | break; | ||
60 | case RTC_AIE_ON: | ||
61 | /* Allow alarm interrupts. */ | ||
62 | spin_lock_irqsave(&priv->lock, flags); | ||
63 | val = ds1286_rtc_read(priv, RTC_CMD); | ||
64 | val &= ~RTC_TDM; | ||
65 | ds1286_rtc_write(priv, val, RTC_CMD); | ||
66 | spin_unlock_irqrestore(&priv->lock, flags); | ||
67 | break; | ||
68 | case RTC_WIE_OFF: | 72 | case RTC_WIE_OFF: |
69 | /* Mask watchdog int. enab. bit */ | 73 | /* Mask watchdog int. enab. bit */ |
70 | spin_lock_irqsave(&priv->lock, flags); | 74 | spin_lock_irqsave(&priv->lock, flags); |
@@ -316,12 +320,13 @@ static int ds1286_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
316 | } | 320 | } |
317 | 321 | ||
318 | static const struct rtc_class_ops ds1286_ops = { | 322 | static const struct rtc_class_ops ds1286_ops = { |
319 | .ioctl = ds1286_ioctl, | 323 | .ioctl = ds1286_ioctl, |
320 | .proc = ds1286_proc, | 324 | .proc = ds1286_proc, |
321 | .read_time = ds1286_read_time, | 325 | .read_time = ds1286_read_time, |
322 | .set_time = ds1286_set_time, | 326 | .set_time = ds1286_set_time, |
323 | .read_alarm = ds1286_read_alarm, | 327 | .read_alarm = ds1286_read_alarm, |
324 | .set_alarm = ds1286_set_alarm, | 328 | .set_alarm = ds1286_set_alarm, |
329 | .alarm_irq_enable = ds1286_alarm_irq_enable, | ||
325 | }; | 330 | }; |
326 | 331 | ||
327 | static int __devinit ds1286_probe(struct platform_device *pdev) | 332 | static int __devinit ds1286_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c index 077af1d7b9e4..57fbcc149ba7 100644 --- a/drivers/rtc/rtc-ds1305.c +++ b/drivers/rtc/rtc-ds1305.c | |||
@@ -139,49 +139,32 @@ static u8 hour2bcd(bool hr12, int hour) | |||
139 | * Interface to RTC framework | 139 | * Interface to RTC framework |
140 | */ | 140 | */ |
141 | 141 | ||
142 | #ifdef CONFIG_RTC_INTF_DEV | 142 | static int ds1305_alarm_irq_enable(struct device *dev, unsigned int enabled) |
143 | |||
144 | /* | ||
145 | * Context: caller holds rtc->ops_lock (to protect ds1305->ctrl) | ||
146 | */ | ||
147 | static int ds1305_ioctl(struct device *dev, unsigned cmd, unsigned long arg) | ||
148 | { | 143 | { |
149 | struct ds1305 *ds1305 = dev_get_drvdata(dev); | 144 | struct ds1305 *ds1305 = dev_get_drvdata(dev); |
150 | u8 buf[2]; | 145 | u8 buf[2]; |
151 | int status = -ENOIOCTLCMD; | 146 | long err = -EINVAL; |
152 | 147 | ||
153 | buf[0] = DS1305_WRITE | DS1305_CONTROL; | 148 | buf[0] = DS1305_WRITE | DS1305_CONTROL; |
154 | buf[1] = ds1305->ctrl[0]; | 149 | buf[1] = ds1305->ctrl[0]; |
155 | 150 | ||
156 | switch (cmd) { | 151 | if (enabled) { |
157 | case RTC_AIE_OFF: | ||
158 | status = 0; | ||
159 | if (!(buf[1] & DS1305_AEI0)) | ||
160 | goto done; | ||
161 | buf[1] &= ~DS1305_AEI0; | ||
162 | break; | ||
163 | |||
164 | case RTC_AIE_ON: | ||
165 | status = 0; | ||
166 | if (ds1305->ctrl[0] & DS1305_AEI0) | 152 | if (ds1305->ctrl[0] & DS1305_AEI0) |
167 | goto done; | 153 | goto done; |
168 | buf[1] |= DS1305_AEI0; | 154 | buf[1] |= DS1305_AEI0; |
169 | break; | 155 | } else { |
170 | } | 156 | if (!(buf[1] & DS1305_AEI0)) |
171 | if (status == 0) { | 157 | goto done; |
172 | status = spi_write_then_read(ds1305->spi, buf, sizeof buf, | 158 | buf[1] &= ~DS1305_AEI0; |
173 | NULL, 0); | ||
174 | if (status >= 0) | ||
175 | ds1305->ctrl[0] = buf[1]; | ||
176 | } | 159 | } |
177 | 160 | err = spi_write_then_read(ds1305->spi, buf, sizeof buf, NULL, 0); | |
161 | if (err >= 0) | ||
162 | ds1305->ctrl[0] = buf[1]; | ||
178 | done: | 163 | done: |
179 | return status; | 164 | return err; |
165 | |||
180 | } | 166 | } |
181 | 167 | ||
182 | #else | ||
183 | #define ds1305_ioctl NULL | ||
184 | #endif | ||
185 | 168 | ||
186 | /* | 169 | /* |
187 | * Get/set of date and time is pretty normal. | 170 | * Get/set of date and time is pretty normal. |
@@ -460,12 +443,12 @@ done: | |||
460 | #endif | 443 | #endif |
461 | 444 | ||
462 | static const struct rtc_class_ops ds1305_ops = { | 445 | static const struct rtc_class_ops ds1305_ops = { |
463 | .ioctl = ds1305_ioctl, | ||
464 | .read_time = ds1305_get_time, | 446 | .read_time = ds1305_get_time, |
465 | .set_time = ds1305_set_time, | 447 | .set_time = ds1305_set_time, |
466 | .read_alarm = ds1305_get_alarm, | 448 | .read_alarm = ds1305_get_alarm, |
467 | .set_alarm = ds1305_set_alarm, | 449 | .set_alarm = ds1305_set_alarm, |
468 | .proc = ds1305_proc, | 450 | .proc = ds1305_proc, |
451 | .alarm_irq_enable = ds1305_alarm_irq_enable, | ||
469 | }; | 452 | }; |
470 | 453 | ||
471 | static void ds1305_work(struct work_struct *work) | 454 | static void ds1305_work(struct work_struct *work) |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 0d559b6416dd..4724ba3acf1a 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -495,50 +495,27 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
495 | return 0; | 495 | return 0; |
496 | } | 496 | } |
497 | 497 | ||
498 | static int ds1307_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 498 | static int ds1307_alarm_irq_enable(struct device *dev, unsigned int enabled) |
499 | { | 499 | { |
500 | struct i2c_client *client = to_i2c_client(dev); | 500 | struct i2c_client *client = to_i2c_client(dev); |
501 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 501 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
502 | int ret; | 502 | int ret; |
503 | 503 | ||
504 | switch (cmd) { | 504 | if (!test_bit(HAS_ALARM, &ds1307->flags)) |
505 | case RTC_AIE_OFF: | 505 | return -ENOTTY; |
506 | if (!test_bit(HAS_ALARM, &ds1307->flags)) | ||
507 | return -ENOTTY; | ||
508 | |||
509 | ret = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL); | ||
510 | if (ret < 0) | ||
511 | return ret; | ||
512 | |||
513 | ret &= ~DS1337_BIT_A1IE; | ||
514 | |||
515 | ret = i2c_smbus_write_byte_data(client, | ||
516 | DS1337_REG_CONTROL, ret); | ||
517 | if (ret < 0) | ||
518 | return ret; | ||
519 | |||
520 | break; | ||
521 | |||
522 | case RTC_AIE_ON: | ||
523 | if (!test_bit(HAS_ALARM, &ds1307->flags)) | ||
524 | return -ENOTTY; | ||
525 | 506 | ||
526 | ret = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL); | 507 | ret = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL); |
527 | if (ret < 0) | 508 | if (ret < 0) |
528 | return ret; | 509 | return ret; |
529 | 510 | ||
511 | if (enabled) | ||
530 | ret |= DS1337_BIT_A1IE; | 512 | ret |= DS1337_BIT_A1IE; |
513 | else | ||
514 | ret &= ~DS1337_BIT_A1IE; | ||
531 | 515 | ||
532 | ret = i2c_smbus_write_byte_data(client, | 516 | ret = i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, ret); |
533 | DS1337_REG_CONTROL, ret); | 517 | if (ret < 0) |
534 | if (ret < 0) | 518 | return ret; |
535 | return ret; | ||
536 | |||
537 | break; | ||
538 | |||
539 | default: | ||
540 | return -ENOIOCTLCMD; | ||
541 | } | ||
542 | 519 | ||
543 | return 0; | 520 | return 0; |
544 | } | 521 | } |
@@ -548,7 +525,7 @@ static const struct rtc_class_ops ds13xx_rtc_ops = { | |||
548 | .set_time = ds1307_set_time, | 525 | .set_time = ds1307_set_time, |
549 | .read_alarm = ds1337_read_alarm, | 526 | .read_alarm = ds1337_read_alarm, |
550 | .set_alarm = ds1337_set_alarm, | 527 | .set_alarm = ds1337_set_alarm, |
551 | .ioctl = ds1307_ioctl, | 528 | .alarm_irq_enable = ds1307_alarm_irq_enable, |
552 | }; | 529 | }; |
553 | 530 | ||
554 | /*----------------------------------------------------------------------*/ | 531 | /*----------------------------------------------------------------------*/ |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 47fb6357c346..d834a63ec4b0 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -307,42 +307,25 @@ unlock: | |||
307 | mutex_unlock(&ds1374->mutex); | 307 | mutex_unlock(&ds1374->mutex); |
308 | } | 308 | } |
309 | 309 | ||
310 | static int ds1374_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 310 | static int ds1374_alarm_irq_enable(struct device *dev, unsigned int enabled) |
311 | { | 311 | { |
312 | struct i2c_client *client = to_i2c_client(dev); | 312 | struct i2c_client *client = to_i2c_client(dev); |
313 | struct ds1374 *ds1374 = i2c_get_clientdata(client); | 313 | struct ds1374 *ds1374 = i2c_get_clientdata(client); |
314 | int ret = -ENOIOCTLCMD; | 314 | int ret; |
315 | 315 | ||
316 | mutex_lock(&ds1374->mutex); | 316 | mutex_lock(&ds1374->mutex); |
317 | 317 | ||
318 | switch (cmd) { | 318 | ret = i2c_smbus_read_byte_data(client, DS1374_REG_CR); |
319 | case RTC_AIE_OFF: | 319 | if (ret < 0) |
320 | ret = i2c_smbus_read_byte_data(client, DS1374_REG_CR); | 320 | goto out; |
321 | if (ret < 0) | ||
322 | goto out; | ||
323 | |||
324 | ret &= ~DS1374_REG_CR_WACE; | ||
325 | |||
326 | ret = i2c_smbus_write_byte_data(client, DS1374_REG_CR, ret); | ||
327 | if (ret < 0) | ||
328 | goto out; | ||
329 | |||
330 | break; | ||
331 | |||
332 | case RTC_AIE_ON: | ||
333 | ret = i2c_smbus_read_byte_data(client, DS1374_REG_CR); | ||
334 | if (ret < 0) | ||
335 | goto out; | ||
336 | 321 | ||
322 | if (enabled) { | ||
337 | ret |= DS1374_REG_CR_WACE | DS1374_REG_CR_AIE; | 323 | ret |= DS1374_REG_CR_WACE | DS1374_REG_CR_AIE; |
338 | ret &= ~DS1374_REG_CR_WDALM; | 324 | ret &= ~DS1374_REG_CR_WDALM; |
339 | 325 | } else { | |
340 | ret = i2c_smbus_write_byte_data(client, DS1374_REG_CR, ret); | 326 | ret &= ~DS1374_REG_CR_WACE; |
341 | if (ret < 0) | ||
342 | goto out; | ||
343 | |||
344 | break; | ||
345 | } | 327 | } |
328 | ret = i2c_smbus_write_byte_data(client, DS1374_REG_CR, ret); | ||
346 | 329 | ||
347 | out: | 330 | out: |
348 | mutex_unlock(&ds1374->mutex); | 331 | mutex_unlock(&ds1374->mutex); |
@@ -354,7 +337,7 @@ static const struct rtc_class_ops ds1374_rtc_ops = { | |||
354 | .set_time = ds1374_set_time, | 337 | .set_time = ds1374_set_time, |
355 | .read_alarm = ds1374_read_alarm, | 338 | .read_alarm = ds1374_read_alarm, |
356 | .set_alarm = ds1374_set_alarm, | 339 | .set_alarm = ds1374_set_alarm, |
357 | .ioctl = ds1374_ioctl, | 340 | .alarm_irq_enable = ds1374_alarm_irq_enable, |
358 | }; | 341 | }; |
359 | 342 | ||
360 | static int ds1374_probe(struct i2c_client *client, | 343 | static int ds1374_probe(struct i2c_client *client, |
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 5a8daa358066..69fe664a2228 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -213,41 +213,27 @@ static int m41t80_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
213 | return m41t80_set_datetime(to_i2c_client(dev), tm); | 213 | return m41t80_set_datetime(to_i2c_client(dev), tm); |
214 | } | 214 | } |
215 | 215 | ||
216 | #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) | 216 | static int m41t80_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
217 | static int | ||
218 | m41t80_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | ||
219 | { | 217 | { |
220 | struct i2c_client *client = to_i2c_client(dev); | 218 | struct i2c_client *client = to_i2c_client(dev); |
221 | int rc; | 219 | int rc; |
222 | 220 | ||
223 | switch (cmd) { | ||
224 | case RTC_AIE_OFF: | ||
225 | case RTC_AIE_ON: | ||
226 | break; | ||
227 | default: | ||
228 | return -ENOIOCTLCMD; | ||
229 | } | ||
230 | |||
231 | rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON); | 221 | rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON); |
232 | if (rc < 0) | 222 | if (rc < 0) |
233 | goto err; | 223 | goto err; |
234 | switch (cmd) { | 224 | |
235 | case RTC_AIE_OFF: | 225 | if (enabled) |
236 | rc &= ~M41T80_ALMON_AFE; | ||
237 | break; | ||
238 | case RTC_AIE_ON: | ||
239 | rc |= M41T80_ALMON_AFE; | 226 | rc |= M41T80_ALMON_AFE; |
240 | break; | 227 | else |
241 | } | 228 | rc &= ~M41T80_ALMON_AFE; |
229 | |||
242 | if (i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, rc) < 0) | 230 | if (i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, rc) < 0) |
243 | goto err; | 231 | goto err; |
232 | |||
244 | return 0; | 233 | return 0; |
245 | err: | 234 | err: |
246 | return -EIO; | 235 | return -EIO; |
247 | } | 236 | } |
248 | #else | ||
249 | #define m41t80_rtc_ioctl NULL | ||
250 | #endif | ||
251 | 237 | ||
252 | static int m41t80_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t) | 238 | static int m41t80_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
253 | { | 239 | { |
@@ -374,7 +360,7 @@ static struct rtc_class_ops m41t80_rtc_ops = { | |||
374 | .read_alarm = m41t80_rtc_read_alarm, | 360 | .read_alarm = m41t80_rtc_read_alarm, |
375 | .set_alarm = m41t80_rtc_set_alarm, | 361 | .set_alarm = m41t80_rtc_set_alarm, |
376 | .proc = m41t80_rtc_proc, | 362 | .proc = m41t80_rtc_proc, |
377 | .ioctl = m41t80_rtc_ioctl, | 363 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, |
378 | }; | 364 | }; |
379 | 365 | ||
380 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) | 366 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) |
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index a99a0b554eb8..3978f4caf724 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -263,30 +263,21 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
263 | /* | 263 | /* |
264 | * Handle commands from user-space | 264 | * Handle commands from user-space |
265 | */ | 265 | */ |
266 | static int m48t59_rtc_ioctl(struct device *dev, unsigned int cmd, | 266 | static int m48t59_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
267 | unsigned long arg) | ||
268 | { | 267 | { |
269 | struct platform_device *pdev = to_platform_device(dev); | 268 | struct platform_device *pdev = to_platform_device(dev); |
270 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; | 269 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; |
271 | struct m48t59_private *m48t59 = platform_get_drvdata(pdev); | 270 | struct m48t59_private *m48t59 = platform_get_drvdata(pdev); |
272 | unsigned long flags; | 271 | unsigned long flags; |
273 | int ret = 0; | ||
274 | 272 | ||
275 | spin_lock_irqsave(&m48t59->lock, flags); | 273 | spin_lock_irqsave(&m48t59->lock, flags); |
276 | switch (cmd) { | 274 | if (enabled) |
277 | case RTC_AIE_OFF: /* alarm interrupt off */ | ||
278 | M48T59_WRITE(0x00, M48T59_INTR); | ||
279 | break; | ||
280 | case RTC_AIE_ON: /* alarm interrupt on */ | ||
281 | M48T59_WRITE(M48T59_INTR_AFE, M48T59_INTR); | 275 | M48T59_WRITE(M48T59_INTR_AFE, M48T59_INTR); |
282 | break; | 276 | else |
283 | default: | 277 | M48T59_WRITE(0x00, M48T59_INTR); |
284 | ret = -ENOIOCTLCMD; | ||
285 | break; | ||
286 | } | ||
287 | spin_unlock_irqrestore(&m48t59->lock, flags); | 278 | spin_unlock_irqrestore(&m48t59->lock, flags); |
288 | 279 | ||
289 | return ret; | 280 | return 0; |
290 | } | 281 | } |
291 | 282 | ||
292 | static int m48t59_rtc_proc(struct device *dev, struct seq_file *seq) | 283 | static int m48t59_rtc_proc(struct device *dev, struct seq_file *seq) |
@@ -330,12 +321,12 @@ static irqreturn_t m48t59_rtc_interrupt(int irq, void *dev_id) | |||
330 | } | 321 | } |
331 | 322 | ||
332 | static const struct rtc_class_ops m48t59_rtc_ops = { | 323 | static const struct rtc_class_ops m48t59_rtc_ops = { |
333 | .ioctl = m48t59_rtc_ioctl, | ||
334 | .read_time = m48t59_rtc_read_time, | 324 | .read_time = m48t59_rtc_read_time, |
335 | .set_time = m48t59_rtc_set_time, | 325 | .set_time = m48t59_rtc_set_time, |
336 | .read_alarm = m48t59_rtc_readalarm, | 326 | .read_alarm = m48t59_rtc_readalarm, |
337 | .set_alarm = m48t59_rtc_setalarm, | 327 | .set_alarm = m48t59_rtc_setalarm, |
338 | .proc = m48t59_rtc_proc, | 328 | .proc = m48t59_rtc_proc, |
329 | .alarm_irq_enable = m48t59_rtc_alarm_irq_enable, | ||
339 | }; | 330 | }; |
340 | 331 | ||
341 | static const struct rtc_class_ops m48t02_rtc_ops = { | 332 | static const struct rtc_class_ops m48t02_rtc_ops = { |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index bcd0cf63eb16..1db62db8469d 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c | |||
@@ -255,42 +255,21 @@ static int mrst_irq_set_state(struct device *dev, int enabled) | |||
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
258 | #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) | ||
259 | |||
260 | /* Currently, the vRTC doesn't support UIE ON/OFF */ | 258 | /* Currently, the vRTC doesn't support UIE ON/OFF */ |
261 | static int | 259 | static int mrst_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
262 | mrst_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | ||
263 | { | 260 | { |
264 | struct mrst_rtc *mrst = dev_get_drvdata(dev); | 261 | struct mrst_rtc *mrst = dev_get_drvdata(dev); |
265 | unsigned long flags; | 262 | unsigned long flags; |
266 | 263 | ||
267 | switch (cmd) { | ||
268 | case RTC_AIE_OFF: | ||
269 | case RTC_AIE_ON: | ||
270 | if (!mrst->irq) | ||
271 | return -EINVAL; | ||
272 | break; | ||
273 | default: | ||
274 | /* PIE ON/OFF is handled by mrst_irq_set_state() */ | ||
275 | return -ENOIOCTLCMD; | ||
276 | } | ||
277 | |||
278 | spin_lock_irqsave(&rtc_lock, flags); | 264 | spin_lock_irqsave(&rtc_lock, flags); |
279 | switch (cmd) { | 265 | if (enabled) |
280 | case RTC_AIE_OFF: /* alarm off */ | ||
281 | mrst_irq_disable(mrst, RTC_AIE); | ||
282 | break; | ||
283 | case RTC_AIE_ON: /* alarm on */ | ||
284 | mrst_irq_enable(mrst, RTC_AIE); | 266 | mrst_irq_enable(mrst, RTC_AIE); |
285 | break; | 267 | else |
286 | } | 268 | mrst_irq_disable(mrst, RTC_AIE); |
287 | spin_unlock_irqrestore(&rtc_lock, flags); | 269 | spin_unlock_irqrestore(&rtc_lock, flags); |
288 | return 0; | 270 | return 0; |
289 | } | 271 | } |
290 | 272 | ||
291 | #else | ||
292 | #define mrst_rtc_ioctl NULL | ||
293 | #endif | ||
294 | 273 | ||
295 | #if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE) | 274 | #if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE) |
296 | 275 | ||
@@ -317,13 +296,13 @@ static int mrst_procfs(struct device *dev, struct seq_file *seq) | |||
317 | #endif | 296 | #endif |
318 | 297 | ||
319 | static const struct rtc_class_ops mrst_rtc_ops = { | 298 | static const struct rtc_class_ops mrst_rtc_ops = { |
320 | .ioctl = mrst_rtc_ioctl, | ||
321 | .read_time = mrst_read_time, | 299 | .read_time = mrst_read_time, |
322 | .set_time = mrst_set_time, | 300 | .set_time = mrst_set_time, |
323 | .read_alarm = mrst_read_alarm, | 301 | .read_alarm = mrst_read_alarm, |
324 | .set_alarm = mrst_set_alarm, | 302 | .set_alarm = mrst_set_alarm, |
325 | .proc = mrst_procfs, | 303 | .proc = mrst_procfs, |
326 | .irq_set_state = mrst_irq_set_state, | 304 | .irq_set_state = mrst_irq_set_state, |
305 | .alarm_irq_enable = mrst_rtc_alarm_irq_enable, | ||
327 | }; | 306 | }; |
328 | 307 | ||
329 | static struct mrst_rtc mrst_rtc; | 308 | static struct mrst_rtc mrst_rtc; |
diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c index b2fff0ca49f8..67820626e18f 100644 --- a/drivers/rtc/rtc-msm6242.c +++ b/drivers/rtc/rtc-msm6242.c | |||
@@ -82,7 +82,7 @@ static inline unsigned int msm6242_read(struct msm6242_priv *priv, | |||
82 | static inline void msm6242_write(struct msm6242_priv *priv, unsigned int val, | 82 | static inline void msm6242_write(struct msm6242_priv *priv, unsigned int val, |
83 | unsigned int reg) | 83 | unsigned int reg) |
84 | { | 84 | { |
85 | return __raw_writel(val, &priv->regs[reg]); | 85 | __raw_writel(val, &priv->regs[reg]); |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline void msm6242_set(struct msm6242_priv *priv, unsigned int val, | 88 | static inline void msm6242_set(struct msm6242_priv *priv, unsigned int val, |
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index bcca47298554..60627a764514 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c | |||
@@ -169,25 +169,19 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
171 | 171 | ||
172 | static int mv_rtc_ioctl(struct device *dev, unsigned int cmd, | 172 | static int mv_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
173 | unsigned long arg) | ||
174 | { | 173 | { |
175 | struct platform_device *pdev = to_platform_device(dev); | 174 | struct platform_device *pdev = to_platform_device(dev); |
176 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 175 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
177 | void __iomem *ioaddr = pdata->ioaddr; | 176 | void __iomem *ioaddr = pdata->ioaddr; |
178 | 177 | ||
179 | if (pdata->irq < 0) | 178 | if (pdata->irq < 0) |
180 | return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */ | 179 | return -EINVAL; /* fall back into rtc-dev's emulation */ |
181 | switch (cmd) { | 180 | |
182 | case RTC_AIE_OFF: | 181 | if (enabled) |
183 | writel(0, ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); | ||
184 | break; | ||
185 | case RTC_AIE_ON: | ||
186 | writel(1, ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); | 182 | writel(1, ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
187 | break; | 183 | else |
188 | default: | 184 | writel(0, ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
189 | return -ENOIOCTLCMD; | ||
190 | } | ||
191 | return 0; | 185 | return 0; |
192 | } | 186 | } |
193 | 187 | ||
@@ -216,7 +210,7 @@ static const struct rtc_class_ops mv_rtc_alarm_ops = { | |||
216 | .set_time = mv_rtc_set_time, | 210 | .set_time = mv_rtc_set_time, |
217 | .read_alarm = mv_rtc_read_alarm, | 211 | .read_alarm = mv_rtc_read_alarm, |
218 | .set_alarm = mv_rtc_set_alarm, | 212 | .set_alarm = mv_rtc_set_alarm, |
219 | .ioctl = mv_rtc_ioctl, | 213 | .alarm_irq_enable = mv_rtc_alarm_irq_enable, |
220 | }; | 214 | }; |
221 | 215 | ||
222 | static int __devinit mv_rtc_probe(struct platform_device *pdev) | 216 | static int __devinit mv_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index e72b523c79a5..b4dbf3a319b3 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -143,8 +143,6 @@ omap_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
143 | u8 reg; | 143 | u8 reg; |
144 | 144 | ||
145 | switch (cmd) { | 145 | switch (cmd) { |
146 | case RTC_AIE_OFF: | ||
147 | case RTC_AIE_ON: | ||
148 | case RTC_UIE_OFF: | 146 | case RTC_UIE_OFF: |
149 | case RTC_UIE_ON: | 147 | case RTC_UIE_ON: |
150 | break; | 148 | break; |
@@ -156,13 +154,6 @@ omap_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
156 | rtc_wait_not_busy(); | 154 | rtc_wait_not_busy(); |
157 | reg = rtc_read(OMAP_RTC_INTERRUPTS_REG); | 155 | reg = rtc_read(OMAP_RTC_INTERRUPTS_REG); |
158 | switch (cmd) { | 156 | switch (cmd) { |
159 | /* AIE = Alarm Interrupt Enable */ | ||
160 | case RTC_AIE_OFF: | ||
161 | reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
162 | break; | ||
163 | case RTC_AIE_ON: | ||
164 | reg |= OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
165 | break; | ||
166 | /* UIE = Update Interrupt Enable (1/second) */ | 157 | /* UIE = Update Interrupt Enable (1/second) */ |
167 | case RTC_UIE_OFF: | 158 | case RTC_UIE_OFF: |
168 | reg &= ~OMAP_RTC_INTERRUPTS_IT_TIMER; | 159 | reg &= ~OMAP_RTC_INTERRUPTS_IT_TIMER; |
@@ -182,6 +173,24 @@ omap_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
182 | #define omap_rtc_ioctl NULL | 173 | #define omap_rtc_ioctl NULL |
183 | #endif | 174 | #endif |
184 | 175 | ||
176 | static int omap_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
177 | { | ||
178 | u8 reg; | ||
179 | |||
180 | local_irq_disable(); | ||
181 | rtc_wait_not_busy(); | ||
182 | reg = rtc_read(OMAP_RTC_INTERRUPTS_REG); | ||
183 | if (enabled) | ||
184 | reg |= OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
185 | else | ||
186 | reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
187 | rtc_wait_not_busy(); | ||
188 | rtc_write(reg, OMAP_RTC_INTERRUPTS_REG); | ||
189 | local_irq_enable(); | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
185 | /* this hardware doesn't support "don't care" alarm fields */ | 194 | /* this hardware doesn't support "don't care" alarm fields */ |
186 | static int tm2bcd(struct rtc_time *tm) | 195 | static int tm2bcd(struct rtc_time *tm) |
187 | { | 196 | { |
@@ -309,6 +318,7 @@ static struct rtc_class_ops omap_rtc_ops = { | |||
309 | .set_time = omap_rtc_set_time, | 318 | .set_time = omap_rtc_set_time, |
310 | .read_alarm = omap_rtc_read_alarm, | 319 | .read_alarm = omap_rtc_read_alarm, |
311 | .set_alarm = omap_rtc_set_alarm, | 320 | .set_alarm = omap_rtc_set_alarm, |
321 | .alarm_irq_enable = omap_rtc_alarm_irq_enable, | ||
312 | }; | 322 | }; |
313 | 323 | ||
314 | static int omap_rtc_alarm; | 324 | static int omap_rtc_alarm; |
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index c086fc30a84c..242bbf86c74a 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c | |||
@@ -81,12 +81,16 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
81 | 81 | ||
82 | static int rtc_proc_open(struct inode *inode, struct file *file) | 82 | static int rtc_proc_open(struct inode *inode, struct file *file) |
83 | { | 83 | { |
84 | int ret; | ||
84 | struct rtc_device *rtc = PDE(inode)->data; | 85 | struct rtc_device *rtc = PDE(inode)->data; |
85 | 86 | ||
86 | if (!try_module_get(THIS_MODULE)) | 87 | if (!try_module_get(THIS_MODULE)) |
87 | return -ENODEV; | 88 | return -ENODEV; |
88 | 89 | ||
89 | return single_open(file, rtc_proc_show, rtc); | 90 | ret = single_open(file, rtc_proc_show, rtc); |
91 | if (ret) | ||
92 | module_put(THIS_MODULE); | ||
93 | return ret; | ||
90 | } | 94 | } |
91 | 95 | ||
92 | static int rtc_proc_release(struct inode *inode, struct file *file) | 96 | static int rtc_proc_release(struct inode *inode, struct file *file) |
diff --git a/drivers/rtc/rtc-rp5c01.c b/drivers/rtc/rtc-rp5c01.c index 36eb66184461..694da39b6dd2 100644 --- a/drivers/rtc/rtc-rp5c01.c +++ b/drivers/rtc/rtc-rp5c01.c | |||
@@ -76,7 +76,7 @@ static inline unsigned int rp5c01_read(struct rp5c01_priv *priv, | |||
76 | static inline void rp5c01_write(struct rp5c01_priv *priv, unsigned int val, | 76 | static inline void rp5c01_write(struct rp5c01_priv *priv, unsigned int val, |
77 | unsigned int reg) | 77 | unsigned int reg) |
78 | { | 78 | { |
79 | return __raw_writel(val, &priv->regs[reg]); | 79 | __raw_writel(val, &priv->regs[reg]); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void rp5c01_lock(struct rp5c01_priv *priv) | 82 | static void rp5c01_lock(struct rp5c01_priv *priv) |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index dd14e202c2c8..6aaa1550e3b1 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -299,14 +299,6 @@ rs5c_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
299 | if (rs5c->type == rtc_rs5c372a | 299 | if (rs5c->type == rtc_rs5c372a |
300 | && (buf & RS5C372A_CTRL1_SL1)) | 300 | && (buf & RS5C372A_CTRL1_SL1)) |
301 | return -ENOIOCTLCMD; | 301 | return -ENOIOCTLCMD; |
302 | case RTC_AIE_OFF: | ||
303 | case RTC_AIE_ON: | ||
304 | /* these irq management calls only make sense for chips | ||
305 | * which are wired up to an IRQ. | ||
306 | */ | ||
307 | if (!rs5c->has_irq) | ||
308 | return -ENOIOCTLCMD; | ||
309 | break; | ||
310 | default: | 302 | default: |
311 | return -ENOIOCTLCMD; | 303 | return -ENOIOCTLCMD; |
312 | } | 304 | } |
@@ -317,12 +309,6 @@ rs5c_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
317 | 309 | ||
318 | addr = RS5C_ADDR(RS5C_REG_CTRL1); | 310 | addr = RS5C_ADDR(RS5C_REG_CTRL1); |
319 | switch (cmd) { | 311 | switch (cmd) { |
320 | case RTC_AIE_OFF: /* alarm off */ | ||
321 | buf &= ~RS5C_CTRL1_AALE; | ||
322 | break; | ||
323 | case RTC_AIE_ON: /* alarm on */ | ||
324 | buf |= RS5C_CTRL1_AALE; | ||
325 | break; | ||
326 | case RTC_UIE_OFF: /* update off */ | 312 | case RTC_UIE_OFF: /* update off */ |
327 | buf &= ~RS5C_CTRL1_CT_MASK; | 313 | buf &= ~RS5C_CTRL1_CT_MASK; |
328 | break; | 314 | break; |
@@ -347,6 +333,39 @@ rs5c_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
347 | #endif | 333 | #endif |
348 | 334 | ||
349 | 335 | ||
336 | static int rs5c_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
337 | { | ||
338 | struct i2c_client *client = to_i2c_client(dev); | ||
339 | struct rs5c372 *rs5c = i2c_get_clientdata(client); | ||
340 | unsigned char buf; | ||
341 | int status, addr; | ||
342 | |||
343 | buf = rs5c->regs[RS5C_REG_CTRL1]; | ||
344 | |||
345 | if (!rs5c->has_irq) | ||
346 | return -EINVAL; | ||
347 | |||
348 | status = rs5c_get_regs(rs5c); | ||
349 | if (status < 0) | ||
350 | return status; | ||
351 | |||
352 | addr = RS5C_ADDR(RS5C_REG_CTRL1); | ||
353 | if (enabled) | ||
354 | buf |= RS5C_CTRL1_AALE; | ||
355 | else | ||
356 | buf &= ~RS5C_CTRL1_AALE; | ||
357 | |||
358 | if (i2c_smbus_write_byte_data(client, addr, buf) < 0) { | ||
359 | printk(KERN_WARNING "%s: can't update alarm\n", | ||
360 | rs5c->rtc->name); | ||
361 | status = -EIO; | ||
362 | } else | ||
363 | rs5c->regs[RS5C_REG_CTRL1] = buf; | ||
364 | |||
365 | return status; | ||
366 | } | ||
367 | |||
368 | |||
350 | /* NOTE: Since RTC_WKALM_{RD,SET} were originally defined for EFI, | 369 | /* NOTE: Since RTC_WKALM_{RD,SET} were originally defined for EFI, |
351 | * which only exposes a polled programming interface; and since | 370 | * which only exposes a polled programming interface; and since |
352 | * these calls map directly to those EFI requests; we don't demand | 371 | * these calls map directly to those EFI requests; we don't demand |
@@ -466,6 +485,7 @@ static const struct rtc_class_ops rs5c372_rtc_ops = { | |||
466 | .set_time = rs5c372_rtc_set_time, | 485 | .set_time = rs5c372_rtc_set_time, |
467 | .read_alarm = rs5c_read_alarm, | 486 | .read_alarm = rs5c_read_alarm, |
468 | .set_alarm = rs5c_set_alarm, | 487 | .set_alarm = rs5c_set_alarm, |
488 | .alarm_irq_enable = rs5c_rtc_alarm_irq_enable, | ||
469 | }; | 489 | }; |
470 | 490 | ||
471 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) | 491 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) |
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 88ea52b8647a..5dfe5ffcb0d3 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -314,16 +314,6 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
314 | unsigned long arg) | 314 | unsigned long arg) |
315 | { | 315 | { |
316 | switch (cmd) { | 316 | switch (cmd) { |
317 | case RTC_AIE_OFF: | ||
318 | spin_lock_irq(&sa1100_rtc_lock); | ||
319 | RTSR &= ~RTSR_ALE; | ||
320 | spin_unlock_irq(&sa1100_rtc_lock); | ||
321 | return 0; | ||
322 | case RTC_AIE_ON: | ||
323 | spin_lock_irq(&sa1100_rtc_lock); | ||
324 | RTSR |= RTSR_ALE; | ||
325 | spin_unlock_irq(&sa1100_rtc_lock); | ||
326 | return 0; | ||
327 | case RTC_UIE_OFF: | 317 | case RTC_UIE_OFF: |
328 | spin_lock_irq(&sa1100_rtc_lock); | 318 | spin_lock_irq(&sa1100_rtc_lock); |
329 | RTSR &= ~RTSR_HZE; | 319 | RTSR &= ~RTSR_HZE; |
@@ -338,6 +328,17 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
338 | return -ENOIOCTLCMD; | 328 | return -ENOIOCTLCMD; |
339 | } | 329 | } |
340 | 330 | ||
331 | static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
332 | { | ||
333 | spin_lock_irq(&sa1100_rtc_lock); | ||
334 | if (enabled) | ||
335 | RTSR |= RTSR_ALE; | ||
336 | else | ||
337 | RTSR &= ~RTSR_ALE; | ||
338 | spin_unlock_irq(&sa1100_rtc_lock); | ||
339 | return 0; | ||
340 | } | ||
341 | |||
341 | static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) | 342 | static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) |
342 | { | 343 | { |
343 | rtc_time_to_tm(RCNR, tm); | 344 | rtc_time_to_tm(RCNR, tm); |
@@ -410,6 +411,7 @@ static const struct rtc_class_ops sa1100_rtc_ops = { | |||
410 | .proc = sa1100_rtc_proc, | 411 | .proc = sa1100_rtc_proc, |
411 | .irq_set_freq = sa1100_irq_set_freq, | 412 | .irq_set_freq = sa1100_irq_set_freq, |
412 | .irq_set_state = sa1100_irq_set_state, | 413 | .irq_set_state = sa1100_irq_set_state, |
414 | .alarm_irq_enable = sa1100_rtc_alarm_irq_enable, | ||
413 | }; | 415 | }; |
414 | 416 | ||
415 | static int sa1100_rtc_probe(struct platform_device *pdev) | 417 | static int sa1100_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 06e41ed93230..93314a9e7fa9 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -350,10 +350,6 @@ static int sh_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
350 | unsigned int ret = 0; | 350 | unsigned int ret = 0; |
351 | 351 | ||
352 | switch (cmd) { | 352 | switch (cmd) { |
353 | case RTC_AIE_OFF: | ||
354 | case RTC_AIE_ON: | ||
355 | sh_rtc_setaie(dev, cmd == RTC_AIE_ON); | ||
356 | break; | ||
357 | case RTC_UIE_OFF: | 353 | case RTC_UIE_OFF: |
358 | rtc->periodic_freq &= ~PF_OXS; | 354 | rtc->periodic_freq &= ~PF_OXS; |
359 | sh_rtc_setcie(dev, 0); | 355 | sh_rtc_setcie(dev, 0); |
@@ -369,6 +365,12 @@ static int sh_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
369 | return ret; | 365 | return ret; |
370 | } | 366 | } |
371 | 367 | ||
368 | static int sh_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
369 | { | ||
370 | sh_rtc_setaie(dev, enabled); | ||
371 | return 0; | ||
372 | } | ||
373 | |||
372 | static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | 374 | static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) |
373 | { | 375 | { |
374 | struct platform_device *pdev = to_platform_device(dev); | 376 | struct platform_device *pdev = to_platform_device(dev); |
@@ -604,6 +606,7 @@ static struct rtc_class_ops sh_rtc_ops = { | |||
604 | .irq_set_state = sh_rtc_irq_set_state, | 606 | .irq_set_state = sh_rtc_irq_set_state, |
605 | .irq_set_freq = sh_rtc_irq_set_freq, | 607 | .irq_set_freq = sh_rtc_irq_set_freq, |
606 | .proc = sh_rtc_proc, | 608 | .proc = sh_rtc_proc, |
609 | .alarm_irq_enable = sh_rtc_alarm_irq_enable, | ||
607 | }; | 610 | }; |
608 | 611 | ||
609 | static int __init sh_rtc_probe(struct platform_device *pdev) | 612 | static int __init sh_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 51725f7755b0..a82d6fe97076 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -50,24 +50,9 @@ static int test_rtc_proc(struct device *dev, struct seq_file *seq) | |||
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
52 | 52 | ||
53 | static int test_rtc_ioctl(struct device *dev, unsigned int cmd, | 53 | static int test_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) |
54 | unsigned long arg) | ||
55 | { | 54 | { |
56 | /* We do support interrupts, they're generated | 55 | return 0; |
57 | * using the sysfs interface. | ||
58 | */ | ||
59 | switch (cmd) { | ||
60 | case RTC_PIE_ON: | ||
61 | case RTC_PIE_OFF: | ||
62 | case RTC_UIE_ON: | ||
63 | case RTC_UIE_OFF: | ||
64 | case RTC_AIE_ON: | ||
65 | case RTC_AIE_OFF: | ||
66 | return 0; | ||
67 | |||
68 | default: | ||
69 | return -ENOIOCTLCMD; | ||
70 | } | ||
71 | } | 56 | } |
72 | 57 | ||
73 | static const struct rtc_class_ops test_rtc_ops = { | 58 | static const struct rtc_class_ops test_rtc_ops = { |
@@ -76,7 +61,7 @@ static const struct rtc_class_ops test_rtc_ops = { | |||
76 | .read_alarm = test_rtc_read_alarm, | 61 | .read_alarm = test_rtc_read_alarm, |
77 | .set_alarm = test_rtc_set_alarm, | 62 | .set_alarm = test_rtc_set_alarm, |
78 | .set_mmss = test_rtc_set_mmss, | 63 | .set_mmss = test_rtc_set_mmss, |
79 | .ioctl = test_rtc_ioctl, | 64 | .alarm_irq_enable = test_rtc_alarm_irq_enable, |
80 | }; | 65 | }; |
81 | 66 | ||
82 | static ssize_t test_irq_show(struct device *dev, | 67 | static ssize_t test_irq_show(struct device *dev, |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index c3244244e8cf..769190ac6d11 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -240,26 +240,6 @@ static int vr41xx_rtc_irq_set_state(struct device *dev, int enabled) | |||
240 | static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 240 | static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) |
241 | { | 241 | { |
242 | switch (cmd) { | 242 | switch (cmd) { |
243 | case RTC_AIE_ON: | ||
244 | spin_lock_irq(&rtc_lock); | ||
245 | |||
246 | if (!alarm_enabled) { | ||
247 | enable_irq(aie_irq); | ||
248 | alarm_enabled = 1; | ||
249 | } | ||
250 | |||
251 | spin_unlock_irq(&rtc_lock); | ||
252 | break; | ||
253 | case RTC_AIE_OFF: | ||
254 | spin_lock_irq(&rtc_lock); | ||
255 | |||
256 | if (alarm_enabled) { | ||
257 | disable_irq(aie_irq); | ||
258 | alarm_enabled = 0; | ||
259 | } | ||
260 | |||
261 | spin_unlock_irq(&rtc_lock); | ||
262 | break; | ||
263 | case RTC_EPOCH_READ: | 243 | case RTC_EPOCH_READ: |
264 | return put_user(epoch, (unsigned long __user *)arg); | 244 | return put_user(epoch, (unsigned long __user *)arg); |
265 | case RTC_EPOCH_SET: | 245 | case RTC_EPOCH_SET: |
@@ -275,6 +255,24 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long | |||
275 | return 0; | 255 | return 0; |
276 | } | 256 | } |
277 | 257 | ||
258 | static int vr41xx_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
259 | { | ||
260 | spin_lock_irq(&rtc_lock); | ||
261 | if (enabled) { | ||
262 | if (!alarm_enabled) { | ||
263 | enable_irq(aie_irq); | ||
264 | alarm_enabled = 1; | ||
265 | } | ||
266 | } else { | ||
267 | if (alarm_enabled) { | ||
268 | disable_irq(aie_irq); | ||
269 | alarm_enabled = 0; | ||
270 | } | ||
271 | } | ||
272 | spin_unlock_irq(&rtc_lock); | ||
273 | return 0; | ||
274 | } | ||
275 | |||
278 | static irqreturn_t elapsedtime_interrupt(int irq, void *dev_id) | 276 | static irqreturn_t elapsedtime_interrupt(int irq, void *dev_id) |
279 | { | 277 | { |
280 | struct platform_device *pdev = (struct platform_device *)dev_id; | 278 | struct platform_device *pdev = (struct platform_device *)dev_id; |
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/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 44578b56ad0a..d3e58d763b43 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1561,6 +1561,7 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) | |||
1561 | { | 1561 | { |
1562 | struct Scsi_Host *host = rport_to_shost(rport); | 1562 | struct Scsi_Host *host = rport_to_shost(rport); |
1563 | fc_port_t *fcport = *(fc_port_t **)rport->dd_data; | 1563 | fc_port_t *fcport = *(fc_port_t **)rport->dd_data; |
1564 | unsigned long flags; | ||
1564 | 1565 | ||
1565 | if (!fcport) | 1566 | if (!fcport) |
1566 | return; | 1567 | return; |
@@ -1573,10 +1574,10 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) | |||
1573 | * Transport has effectively 'deleted' the rport, clear | 1574 | * Transport has effectively 'deleted' the rport, clear |
1574 | * all local references. | 1575 | * all local references. |
1575 | */ | 1576 | */ |
1576 | spin_lock_irq(host->host_lock); | 1577 | spin_lock_irqsave(host->host_lock, flags); |
1577 | fcport->rport = fcport->drport = NULL; | 1578 | fcport->rport = fcport->drport = NULL; |
1578 | *((fc_port_t **)rport->dd_data) = NULL; | 1579 | *((fc_port_t **)rport->dd_data) = NULL; |
1579 | spin_unlock_irq(host->host_lock); | 1580 | spin_unlock_irqrestore(host->host_lock, flags); |
1580 | 1581 | ||
1581 | if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) | 1582 | if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) |
1582 | return; | 1583 | return; |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index f948e1a73aec..d9479c3fe5f8 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -2505,11 +2505,12 @@ qla2x00_rport_del(void *data) | |||
2505 | { | 2505 | { |
2506 | fc_port_t *fcport = data; | 2506 | fc_port_t *fcport = data; |
2507 | struct fc_rport *rport; | 2507 | struct fc_rport *rport; |
2508 | unsigned long flags; | ||
2508 | 2509 | ||
2509 | spin_lock_irq(fcport->vha->host->host_lock); | 2510 | spin_lock_irqsave(fcport->vha->host->host_lock, flags); |
2510 | rport = fcport->drport ? fcport->drport: fcport->rport; | 2511 | rport = fcport->drport ? fcport->drport: fcport->rport; |
2511 | fcport->drport = NULL; | 2512 | fcport->drport = NULL; |
2512 | spin_unlock_irq(fcport->vha->host->host_lock); | 2513 | spin_unlock_irqrestore(fcport->vha->host->host_lock, flags); |
2513 | if (rport) | 2514 | if (rport) |
2514 | fc_remote_port_delete(rport); | 2515 | fc_remote_port_delete(rport); |
2515 | } | 2516 | } |
@@ -2879,6 +2880,7 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) | |||
2879 | struct fc_rport_identifiers rport_ids; | 2880 | struct fc_rport_identifiers rport_ids; |
2880 | struct fc_rport *rport; | 2881 | struct fc_rport *rport; |
2881 | struct qla_hw_data *ha = vha->hw; | 2882 | struct qla_hw_data *ha = vha->hw; |
2883 | unsigned long flags; | ||
2882 | 2884 | ||
2883 | qla2x00_rport_del(fcport); | 2885 | qla2x00_rport_del(fcport); |
2884 | 2886 | ||
@@ -2893,9 +2895,9 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) | |||
2893 | "Unable to allocate fc remote port!\n"); | 2895 | "Unable to allocate fc remote port!\n"); |
2894 | return; | 2896 | return; |
2895 | } | 2897 | } |
2896 | spin_lock_irq(fcport->vha->host->host_lock); | 2898 | spin_lock_irqsave(fcport->vha->host->host_lock, flags); |
2897 | *((fc_port_t **)rport->dd_data) = fcport; | 2899 | *((fc_port_t **)rport->dd_data) = fcport; |
2898 | spin_unlock_irq(fcport->vha->host->host_lock); | 2900 | spin_unlock_irqrestore(fcport->vha->host->host_lock, flags); |
2899 | 2901 | ||
2900 | rport->supported_classes = fcport->supported_classes; | 2902 | rport->supported_classes = fcport->supported_classes; |
2901 | 2903 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index c194c23ca1fb..f27724d76cf6 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -562,7 +562,6 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *) | |||
562 | } | 562 | } |
563 | if (atomic_read(&fcport->state) != FCS_ONLINE) { | 563 | if (atomic_read(&fcport->state) != FCS_ONLINE) { |
564 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || | 564 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || |
565 | atomic_read(&fcport->state) == FCS_DEVICE_LOST || | ||
566 | atomic_read(&base_vha->loop_state) == LOOP_DEAD) { | 565 | atomic_read(&base_vha->loop_state) == LOOP_DEAD) { |
567 | cmd->result = DID_NO_CONNECT << 16; | 566 | cmd->result = DID_NO_CONNECT << 16; |
568 | goto qc24_fail_command; | 567 | goto qc24_fail_command; |
@@ -2513,6 +2512,7 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
2513 | { | 2512 | { |
2514 | struct fc_rport *rport; | 2513 | struct fc_rport *rport; |
2515 | scsi_qla_host_t *base_vha; | 2514 | scsi_qla_host_t *base_vha; |
2515 | unsigned long flags; | ||
2516 | 2516 | ||
2517 | if (!fcport->rport) | 2517 | if (!fcport->rport) |
2518 | return; | 2518 | return; |
@@ -2520,9 +2520,9 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *vha, fc_port_t *fcport, | |||
2520 | rport = fcport->rport; | 2520 | rport = fcport->rport; |
2521 | if (defer) { | 2521 | if (defer) { |
2522 | base_vha = pci_get_drvdata(vha->hw->pdev); | 2522 | base_vha = pci_get_drvdata(vha->hw->pdev); |
2523 | spin_lock_irq(vha->host->host_lock); | 2523 | spin_lock_irqsave(vha->host->host_lock, flags); |
2524 | fcport->drport = rport; | 2524 | fcport->drport = rport; |
2525 | spin_unlock_irq(vha->host->host_lock); | 2525 | spin_unlock_irqrestore(vha->host->host_lock, flags); |
2526 | set_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags); | 2526 | set_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags); |
2527 | qla2xxx_wake_dpc(base_vha); | 2527 | qla2xxx_wake_dpc(base_vha); |
2528 | } else | 2528 | } else |
@@ -3282,10 +3282,10 @@ qla2x00_do_dpc(void *data) | |||
3282 | 3282 | ||
3283 | set_user_nice(current, -20); | 3283 | set_user_nice(current, -20); |
3284 | 3284 | ||
3285 | set_current_state(TASK_INTERRUPTIBLE); | ||
3285 | while (!kthread_should_stop()) { | 3286 | while (!kthread_should_stop()) { |
3286 | DEBUG3(printk("qla2x00: DPC handler sleeping\n")); | 3287 | DEBUG3(printk("qla2x00: DPC handler sleeping\n")); |
3287 | 3288 | ||
3288 | set_current_state(TASK_INTERRUPTIBLE); | ||
3289 | schedule(); | 3289 | schedule(); |
3290 | __set_current_state(TASK_RUNNING); | 3290 | __set_current_state(TASK_RUNNING); |
3291 | 3291 | ||
@@ -3454,7 +3454,9 @@ qla2x00_do_dpc(void *data) | |||
3454 | qla2x00_do_dpc_all_vps(base_vha); | 3454 | qla2x00_do_dpc_all_vps(base_vha); |
3455 | 3455 | ||
3456 | ha->dpc_active = 0; | 3456 | ha->dpc_active = 0; |
3457 | set_current_state(TASK_INTERRUPTIBLE); | ||
3457 | } /* End of while(1) */ | 3458 | } /* End of while(1) */ |
3459 | __set_current_state(TASK_RUNNING); | ||
3458 | 3460 | ||
3459 | DEBUG(printk("scsi(%ld): DPC handler exiting\n", base_vha->host_no)); | 3461 | DEBUG(printk("scsi(%ld): DPC handler exiting\n", base_vha->host_no)); |
3460 | 3462 | ||
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 7b310934efed..a6b2d72022fc 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -1671,7 +1671,7 @@ static int do_device_access(struct scsi_cmnd *scmd, | |||
1671 | unsigned long long lba, unsigned int num, int write) | 1671 | unsigned long long lba, unsigned int num, int write) |
1672 | { | 1672 | { |
1673 | int ret; | 1673 | int ret; |
1674 | unsigned int block, rest = 0; | 1674 | unsigned long long block, rest = 0; |
1675 | int (*func)(struct scsi_cmnd *, unsigned char *, int); | 1675 | int (*func)(struct scsi_cmnd *, unsigned char *, int); |
1676 | 1676 | ||
1677 | func = write ? fetch_to_dev_buffer : fill_from_dev_buffer; | 1677 | func = write ? fetch_to_dev_buffer : fill_from_dev_buffer; |
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index de885a0f917a..f33e2dd97934 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c | |||
@@ -173,7 +173,8 @@ int intc_set_priority(unsigned int irq, unsigned int prio) | |||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
176 | #define VALID(x) (x | 0x80) | 176 | #define SENSE_VALID_FLAG 0x80 |
177 | #define VALID(x) (x | SENSE_VALID_FLAG) | ||
177 | 178 | ||
178 | static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { | 179 | static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { |
179 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), | 180 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), |
@@ -201,7 +202,8 @@ static int intc_set_type(struct irq_data *data, unsigned int type) | |||
201 | ihp = intc_find_irq(d->sense, d->nr_sense, irq); | 202 | ihp = intc_find_irq(d->sense, d->nr_sense, irq); |
202 | if (ihp) { | 203 | if (ihp) { |
203 | addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); | 204 | addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); |
204 | intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value); | 205 | intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, |
206 | value & ~SENSE_VALID_FLAG); | ||
205 | } | 207 | } |
206 | 208 | ||
207 | return 0; | 209 | return 0; |
diff --git a/drivers/spi/pxa2xx_spi_pci.c b/drivers/spi/pxa2xx_spi_pci.c index 351d8a375b57..19752b09e155 100644 --- a/drivers/spi/pxa2xx_spi_pci.c +++ b/drivers/spi/pxa2xx_spi_pci.c | |||
@@ -7,10 +7,9 @@ | |||
7 | #include <linux/of_device.h> | 7 | #include <linux/of_device.h> |
8 | #include <linux/spi/pxa2xx_spi.h> | 8 | #include <linux/spi/pxa2xx_spi.h> |
9 | 9 | ||
10 | struct awesome_struct { | 10 | struct ce4100_info { |
11 | struct ssp_device ssp; | 11 | struct ssp_device ssp; |
12 | struct platform_device spi_pdev; | 12 | struct platform_device *spi_pdev; |
13 | struct pxa2xx_spi_master spi_pdata; | ||
14 | }; | 13 | }; |
15 | 14 | ||
16 | static DEFINE_MUTEX(ssp_lock); | 15 | static DEFINE_MUTEX(ssp_lock); |
@@ -51,23 +50,15 @@ void pxa_ssp_free(struct ssp_device *ssp) | |||
51 | } | 50 | } |
52 | EXPORT_SYMBOL_GPL(pxa_ssp_free); | 51 | EXPORT_SYMBOL_GPL(pxa_ssp_free); |
53 | 52 | ||
54 | static void plat_dev_release(struct device *dev) | ||
55 | { | ||
56 | struct awesome_struct *as = container_of(dev, | ||
57 | struct awesome_struct, spi_pdev.dev); | ||
58 | |||
59 | of_device_node_put(&as->spi_pdev.dev); | ||
60 | } | ||
61 | |||
62 | static int __devinit ce4100_spi_probe(struct pci_dev *dev, | 53 | static int __devinit ce4100_spi_probe(struct pci_dev *dev, |
63 | const struct pci_device_id *ent) | 54 | const struct pci_device_id *ent) |
64 | { | 55 | { |
65 | int ret; | 56 | int ret; |
66 | resource_size_t phys_beg; | 57 | resource_size_t phys_beg; |
67 | resource_size_t phys_len; | 58 | resource_size_t phys_len; |
68 | struct awesome_struct *spi_info; | 59 | struct ce4100_info *spi_info; |
69 | struct platform_device *pdev; | 60 | struct platform_device *pdev; |
70 | struct pxa2xx_spi_master *spi_pdata; | 61 | struct pxa2xx_spi_master spi_pdata; |
71 | struct ssp_device *ssp; | 62 | struct ssp_device *ssp; |
72 | 63 | ||
73 | ret = pci_enable_device(dev); | 64 | ret = pci_enable_device(dev); |
@@ -84,33 +75,30 @@ static int __devinit ce4100_spi_probe(struct pci_dev *dev, | |||
84 | return ret; | 75 | return ret; |
85 | } | 76 | } |
86 | 77 | ||
78 | pdev = platform_device_alloc("pxa2xx-spi", dev->devfn); | ||
87 | spi_info = kzalloc(sizeof(*spi_info), GFP_KERNEL); | 79 | spi_info = kzalloc(sizeof(*spi_info), GFP_KERNEL); |
88 | if (!spi_info) { | 80 | if (!pdev || !spi_info ) { |
89 | ret = -ENOMEM; | 81 | ret = -ENOMEM; |
90 | goto err_kz; | 82 | goto err_nomem; |
91 | } | 83 | } |
92 | ssp = &spi_info->ssp; | 84 | memset(&spi_pdata, 0, sizeof(spi_pdata)); |
93 | pdev = &spi_info->spi_pdev; | 85 | spi_pdata.num_chipselect = dev->devfn; |
94 | spi_pdata = &spi_info->spi_pdata; | ||
95 | 86 | ||
96 | pdev->name = "pxa2xx-spi"; | 87 | ret = platform_device_add_data(pdev, &spi_pdata, sizeof(spi_pdata)); |
97 | pdev->id = dev->devfn; | 88 | if (ret) |
98 | pdev->dev.parent = &dev->dev; | 89 | goto err_nomem; |
99 | pdev->dev.platform_data = &spi_info->spi_pdata; | ||
100 | 90 | ||
91 | pdev->dev.parent = &dev->dev; | ||
101 | #ifdef CONFIG_OF | 92 | #ifdef CONFIG_OF |
102 | pdev->dev.of_node = dev->dev.of_node; | 93 | pdev->dev.of_node = dev->dev.of_node; |
103 | #endif | 94 | #endif |
104 | pdev->dev.release = plat_dev_release; | 95 | ssp = &spi_info->ssp; |
105 | |||
106 | spi_pdata->num_chipselect = dev->devfn; | ||
107 | |||
108 | ssp->phys_base = pci_resource_start(dev, 0); | 96 | ssp->phys_base = pci_resource_start(dev, 0); |
109 | ssp->mmio_base = ioremap(phys_beg, phys_len); | 97 | ssp->mmio_base = ioremap(phys_beg, phys_len); |
110 | if (!ssp->mmio_base) { | 98 | if (!ssp->mmio_base) { |
111 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); | 99 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); |
112 | ret = -EIO; | 100 | ret = -EIO; |
113 | goto err_remap; | 101 | goto err_nomem; |
114 | } | 102 | } |
115 | ssp->irq = dev->irq; | 103 | ssp->irq = dev->irq; |
116 | ssp->port_id = pdev->id; | 104 | ssp->port_id = pdev->id; |
@@ -122,7 +110,7 @@ static int __devinit ce4100_spi_probe(struct pci_dev *dev, | |||
122 | 110 | ||
123 | pci_set_drvdata(dev, spi_info); | 111 | pci_set_drvdata(dev, spi_info); |
124 | 112 | ||
125 | ret = platform_device_register(pdev); | 113 | ret = platform_device_add(pdev); |
126 | if (ret) | 114 | if (ret) |
127 | goto err_dev_add; | 115 | goto err_dev_add; |
128 | 116 | ||
@@ -135,27 +123,21 @@ err_dev_add: | |||
135 | mutex_unlock(&ssp_lock); | 123 | mutex_unlock(&ssp_lock); |
136 | iounmap(ssp->mmio_base); | 124 | iounmap(ssp->mmio_base); |
137 | 125 | ||
138 | err_remap: | 126 | err_nomem: |
139 | kfree(spi_info); | ||
140 | |||
141 | err_kz: | ||
142 | release_mem_region(phys_beg, phys_len); | 127 | release_mem_region(phys_beg, phys_len); |
143 | 128 | platform_device_put(pdev); | |
129 | kfree(spi_info); | ||
144 | return ret; | 130 | return ret; |
145 | } | 131 | } |
146 | 132 | ||
147 | static void __devexit ce4100_spi_remove(struct pci_dev *dev) | 133 | static void __devexit ce4100_spi_remove(struct pci_dev *dev) |
148 | { | 134 | { |
149 | struct awesome_struct *spi_info; | 135 | struct ce4100_info *spi_info; |
150 | struct platform_device *pdev; | ||
151 | struct ssp_device *ssp; | 136 | struct ssp_device *ssp; |
152 | 137 | ||
153 | spi_info = pci_get_drvdata(dev); | 138 | spi_info = pci_get_drvdata(dev); |
154 | |||
155 | ssp = &spi_info->ssp; | 139 | ssp = &spi_info->ssp; |
156 | pdev = &spi_info->spi_pdev; | 140 | platform_device_unregister(spi_info->spi_pdev); |
157 | |||
158 | platform_device_unregister(pdev); | ||
159 | 141 | ||
160 | iounmap(ssp->mmio_base); | 142 | iounmap(ssp->mmio_base); |
161 | release_mem_region(pci_resource_start(dev, 0), | 143 | release_mem_region(pci_resource_start(dev, 0), |
@@ -171,7 +153,6 @@ static void __devexit ce4100_spi_remove(struct pci_dev *dev) | |||
171 | } | 153 | } |
172 | 154 | ||
173 | static struct pci_device_id ce4100_spi_devices[] __devinitdata = { | 155 | static struct pci_device_id ce4100_spi_devices[] __devinitdata = { |
174 | |||
175 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) }, | 156 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) }, |
176 | { }, | 157 | { }, |
177 | }; | 158 | }; |
diff --git a/drivers/spi/spi_sh_msiof.c b/drivers/spi/spi_sh_msiof.c index 56f60c8ea0ab..2c665fceaac7 100644 --- a/drivers/spi/spi_sh_msiof.c +++ b/drivers/spi/spi_sh_msiof.c | |||
@@ -509,9 +509,11 @@ static int sh_msiof_spi_txrx(struct spi_device *spi, struct spi_transfer *t) | |||
509 | bytes_done = 0; | 509 | bytes_done = 0; |
510 | 510 | ||
511 | while (bytes_done < t->len) { | 511 | while (bytes_done < t->len) { |
512 | void *rx_buf = t->rx_buf ? t->rx_buf + bytes_done : NULL; | ||
513 | const void *tx_buf = t->tx_buf ? t->tx_buf + bytes_done : NULL; | ||
512 | n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo, | 514 | n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo, |
513 | t->tx_buf + bytes_done, | 515 | tx_buf, |
514 | t->rx_buf + bytes_done, | 516 | rx_buf, |
515 | words, bits); | 517 | words, bits); |
516 | if (n < 0) | 518 | if (n < 0) |
517 | break; | 519 | break; |
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..cd8392badff0 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 |
@@ -259,9 +263,7 @@ ieee_set_channel(struct ieee80211_hw *hw, struct ieee80211_channel *chan, | |||
259 | switch (type) { | 263 | switch (type) { |
260 | case NL80211_CHAN_HT20: | 264 | case NL80211_CHAN_HT20: |
261 | case NL80211_CHAN_NO_HT: | 265 | case NL80211_CHAN_NO_HT: |
262 | WL_LOCK(wl); | ||
263 | err = wlc_set(wl->wlc, WLC_SET_CHANNEL, chan->hw_value); | 266 | err = wlc_set(wl->wlc, WLC_SET_CHANNEL, chan->hw_value); |
264 | WL_UNLOCK(wl); | ||
265 | break; | 267 | break; |
266 | case NL80211_CHAN_HT40MINUS: | 268 | case NL80211_CHAN_HT40MINUS: |
267 | case NL80211_CHAN_HT40PLUS: | 269 | case NL80211_CHAN_HT40PLUS: |
@@ -281,6 +283,7 @@ static int wl_ops_config(struct ieee80211_hw *hw, u32 changed) | |||
281 | int err = 0; | 283 | int err = 0; |
282 | int new_int; | 284 | int new_int; |
283 | 285 | ||
286 | WL_LOCK(wl); | ||
284 | if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { | 287 | if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { |
285 | WL_NONE("%s: Setting listen interval to %d\n", | 288 | WL_NONE("%s: Setting listen interval to %d\n", |
286 | __func__, conf->listen_interval); | 289 | __func__, conf->listen_interval); |
@@ -337,6 +340,7 @@ static int wl_ops_config(struct ieee80211_hw *hw, u32 changed) | |||
337 | } | 340 | } |
338 | 341 | ||
339 | config_out: | 342 | config_out: |
343 | WL_UNLOCK(wl); | ||
340 | return err; | 344 | return err; |
341 | } | 345 | } |
342 | 346 | ||
@@ -455,13 +459,21 @@ wl_ops_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) | |||
455 | 459 | ||
456 | static void wl_ops_sw_scan_start(struct ieee80211_hw *hw) | 460 | static void wl_ops_sw_scan_start(struct ieee80211_hw *hw) |
457 | { | 461 | { |
462 | struct wl_info *wl = hw->priv; | ||
458 | WL_NONE("Scan Start\n"); | 463 | WL_NONE("Scan Start\n"); |
464 | WL_LOCK(wl); | ||
465 | wlc_scan_start(wl->wlc); | ||
466 | WL_UNLOCK(wl); | ||
459 | return; | 467 | return; |
460 | } | 468 | } |
461 | 469 | ||
462 | static void wl_ops_sw_scan_complete(struct ieee80211_hw *hw) | 470 | static void wl_ops_sw_scan_complete(struct ieee80211_hw *hw) |
463 | { | 471 | { |
472 | struct wl_info *wl = hw->priv; | ||
464 | WL_NONE("Scan Complete\n"); | 473 | WL_NONE("Scan Complete\n"); |
474 | WL_LOCK(wl); | ||
475 | wlc_scan_stop(wl->wlc); | ||
476 | WL_UNLOCK(wl); | ||
465 | return; | 477 | return; |
466 | } | 478 | } |
467 | 479 | ||
@@ -779,7 +791,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs, | |||
779 | wl_found++; | 791 | wl_found++; |
780 | return wl; | 792 | return wl; |
781 | 793 | ||
782 | fail: | 794 | fail: |
783 | wl_free(wl); | 795 | wl_free(wl); |
784 | fail1: | 796 | fail1: |
785 | return NULL; | 797 | return NULL; |
@@ -1090,7 +1102,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1090 | return 0; | 1102 | return 0; |
1091 | } | 1103 | } |
1092 | 1104 | ||
1093 | #ifdef LINUXSTA_PS | ||
1094 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) | 1105 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) |
1095 | { | 1106 | { |
1096 | struct wl_info *wl; | 1107 | struct wl_info *wl; |
@@ -1105,11 +1116,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1105 | return -ENODEV; | 1116 | return -ENODEV; |
1106 | } | 1117 | } |
1107 | 1118 | ||
1119 | /* only need to flag hw is down for proper resume */ | ||
1108 | WL_LOCK(wl); | 1120 | WL_LOCK(wl); |
1109 | wl_down(wl); | ||
1110 | wl->pub->hw_up = false; | 1121 | wl->pub->hw_up = false; |
1111 | WL_UNLOCK(wl); | 1122 | WL_UNLOCK(wl); |
1112 | pci_save_state(pdev, wl->pci_psstate); | 1123 | |
1124 | pci_save_state(pdev); | ||
1113 | pci_disable_device(pdev); | 1125 | pci_disable_device(pdev); |
1114 | return pci_set_power_state(pdev, PCI_D3hot); | 1126 | return pci_set_power_state(pdev, PCI_D3hot); |
1115 | } | 1127 | } |
@@ -1133,7 +1145,7 @@ static int wl_resume(struct pci_dev *pdev) | |||
1133 | if (err) | 1145 | if (err) |
1134 | return err; | 1146 | return err; |
1135 | 1147 | ||
1136 | pci_restore_state(pdev, wl->pci_psstate); | 1148 | pci_restore_state(pdev); |
1137 | 1149 | ||
1138 | err = pci_enable_device(pdev); | 1150 | err = pci_enable_device(pdev); |
1139 | if (err) | 1151 | if (err) |
@@ -1145,13 +1157,12 @@ static int wl_resume(struct pci_dev *pdev) | |||
1145 | if ((val & 0x0000ff00) != 0) | 1157 | if ((val & 0x0000ff00) != 0) |
1146 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); | 1158 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); |
1147 | 1159 | ||
1148 | WL_LOCK(wl); | 1160 | /* |
1149 | err = wl_up(wl); | 1161 | * done. driver will be put in up state |
1150 | WL_UNLOCK(wl); | 1162 | * in wl_ops_add_interface() call. |
1151 | 1163 | */ | |
1152 | return err; | 1164 | return err; |
1153 | } | 1165 | } |
1154 | #endif /* LINUXSTA_PS */ | ||
1155 | 1166 | ||
1156 | static void wl_remove(struct pci_dev *pdev) | 1167 | static void wl_remove(struct pci_dev *pdev) |
1157 | { | 1168 | { |
@@ -1184,14 +1195,12 @@ static void wl_remove(struct pci_dev *pdev) | |||
1184 | } | 1195 | } |
1185 | 1196 | ||
1186 | static struct pci_driver wl_pci_driver = { | 1197 | static struct pci_driver wl_pci_driver = { |
1187 | .name = "brcm80211", | 1198 | .name = "brcm80211", |
1188 | .probe = wl_pci_probe, | 1199 | .probe = wl_pci_probe, |
1189 | #ifdef LINUXSTA_PS | 1200 | .suspend = wl_suspend, |
1190 | .suspend = wl_suspend, | 1201 | .resume = wl_resume, |
1191 | .resume = wl_resume, | 1202 | .remove = __devexit_p(wl_remove), |
1192 | #endif /* LINUXSTA_PS */ | 1203 | .id_table = wl_id_table, |
1193 | .remove = __devexit_p(wl_remove), | ||
1194 | .id_table = wl_id_table, | ||
1195 | }; | 1204 | }; |
1196 | 1205 | ||
1197 | /** | 1206 | /** |
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c index 1d5d01ac0a9b..e37e8058e2b8 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); |
@@ -8462,3 +8461,16 @@ static void wlc_txq_free(struct wlc_info *wlc, struct osl_info *osh, | |||
8462 | 8461 | ||
8463 | kfree(qi); | 8462 | kfree(qi); |
8464 | } | 8463 | } |
8464 | |||
8465 | /* | ||
8466 | * Flag 'scan in progress' to withold dynamic phy calibration | ||
8467 | */ | ||
8468 | void wlc_scan_start(struct wlc_info *wlc) | ||
8469 | { | ||
8470 | wlc_phy_hold_upd(wlc->band->pi, PHY_HOLD_FOR_SCAN, true); | ||
8471 | } | ||
8472 | |||
8473 | void wlc_scan_stop(struct wlc_info *wlc) | ||
8474 | { | ||
8475 | wlc_phy_hold_upd(wlc->band->pi, PHY_HOLD_FOR_SCAN, false); | ||
8476 | } | ||
diff --git a/drivers/staging/brcm80211/sys/wlc_pub.h b/drivers/staging/brcm80211/sys/wlc_pub.h index 146a6904a39b..aff413001b70 100644 --- a/drivers/staging/brcm80211/sys/wlc_pub.h +++ b/drivers/staging/brcm80211/sys/wlc_pub.h | |||
@@ -570,6 +570,8 @@ extern void wlc_enable_mac(struct wlc_info *wlc); | |||
570 | extern u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate); | 570 | extern u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate); |
571 | extern u32 wlc_get_rspec_history(struct wlc_bsscfg *cfg); | 571 | extern u32 wlc_get_rspec_history(struct wlc_bsscfg *cfg); |
572 | extern u32 wlc_get_current_highest_rate(struct wlc_bsscfg *cfg); | 572 | extern u32 wlc_get_current_highest_rate(struct wlc_bsscfg *cfg); |
573 | extern void wlc_scan_start(struct wlc_info *wlc); | ||
574 | extern void wlc_scan_stop(struct wlc_info *wlc); | ||
573 | 575 | ||
574 | static inline int wlc_iovar_getuint(struct wlc_info *wlc, const char *name, | 576 | static inline int wlc_iovar_getuint(struct wlc_info *wlc, const char *name, |
575 | uint *arg) | 577 | uint *arg) |
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index aad47326d6dc..1502d80f6f78 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig | |||
@@ -439,6 +439,7 @@ config COMEDI_NI_AT_AO | |||
439 | config COMEDI_NI_ATMIO | 439 | config COMEDI_NI_ATMIO |
440 | tristate "NI AT-MIO E series ISA-PNP card support" | 440 | tristate "NI AT-MIO E series ISA-PNP card support" |
441 | depends on ISAPNP && COMEDI_NI_TIO && COMEDI_NI_COMMON | 441 | depends on ISAPNP && COMEDI_NI_TIO && COMEDI_NI_COMMON |
442 | select COMEDI_8255 | ||
442 | default N | 443 | default N |
443 | ---help--- | 444 | ---help--- |
444 | Enable support for National Instruments AT-MIO E series cards | 445 | Enable support for National Instruments AT-MIO E series cards |
@@ -1040,6 +1041,8 @@ config COMEDI_NI_PCIDIO | |||
1040 | config COMEDI_NI_PCIMIO | 1041 | config COMEDI_NI_PCIMIO |
1041 | tristate "NI PCI-MIO-E series and M series support" | 1042 | tristate "NI PCI-MIO-E series and M series support" |
1042 | depends on COMEDI_NI_TIO && COMEDI_NI_COMMON | 1043 | depends on COMEDI_NI_TIO && COMEDI_NI_COMMON |
1044 | select COMEDI_8255 | ||
1045 | select COMEDI_FC | ||
1043 | default N | 1046 | default N |
1044 | ---help--- | 1047 | ---help--- |
1045 | Enable support for National Instruments PCI-MIO-E series and M series | 1048 | Enable support for National Instruments PCI-MIO-E series and M series |
@@ -1164,6 +1167,7 @@ config COMEDI_NI_LABPC_CS | |||
1164 | config COMEDI_NI_MIO_CS | 1167 | config COMEDI_NI_MIO_CS |
1165 | tristate "NI DAQCard E series PCMCIA support" | 1168 | tristate "NI DAQCard E series PCMCIA support" |
1166 | depends on COMEDI_NI_TIO && COMEDI_NI_COMMON | 1169 | depends on COMEDI_NI_TIO && COMEDI_NI_COMMON |
1170 | select COMEDI_8255 | ||
1167 | select COMEDI_FC | 1171 | select COMEDI_FC |
1168 | default N | 1172 | default N |
1169 | ---help--- | 1173 | ---help--- |
@@ -1268,7 +1272,6 @@ config COMEDI_MITE | |||
1268 | config COMEDI_NI_TIO | 1272 | config COMEDI_NI_TIO |
1269 | tristate "NI general purpose counter support" | 1273 | tristate "NI general purpose counter support" |
1270 | depends on COMEDI_MITE | 1274 | depends on COMEDI_MITE |
1271 | select COMEDI_8255 | ||
1272 | default N | 1275 | default N |
1273 | ---help--- | 1276 | ---help--- |
1274 | Enable support for National Instruments general purpose counters. | 1277 | Enable support for National Instruments general purpose counters. |
diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index cd25b241cc1f..fd274e9c7b78 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c | |||
@@ -61,8 +61,6 @@ | |||
61 | #define PCI_DAQ_SIZE 4096 | 61 | #define PCI_DAQ_SIZE 4096 |
62 | #define PCI_DAQ_SIZE_660X 8192 | 62 | #define PCI_DAQ_SIZE_660X 8192 |
63 | 63 | ||
64 | MODULE_LICENSE("GPL"); | ||
65 | |||
66 | struct mite_struct *mite_devices; | 64 | struct mite_struct *mite_devices; |
67 | EXPORT_SYMBOL(mite_devices); | 65 | EXPORT_SYMBOL(mite_devices); |
68 | 66 | ||
diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 14e716e99a5c..54741c9e1af5 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c | |||
@@ -527,3 +527,7 @@ static void __exit driver_ni6527_cleanup_module(void) | |||
527 | 527 | ||
528 | module_init(driver_ni6527_init_module); | 528 | module_init(driver_ni6527_init_module); |
529 | module_exit(driver_ni6527_cleanup_module); | 529 | module_exit(driver_ni6527_cleanup_module); |
530 | |||
531 | MODULE_AUTHOR("Comedi http://www.comedi.org"); | ||
532 | MODULE_DESCRIPTION("Comedi low-level driver"); | ||
533 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 8b8e2aaf77fb..403fc0997d37 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c | |||
@@ -871,3 +871,7 @@ static void __exit driver_ni_65xx_cleanup_module(void) | |||
871 | 871 | ||
872 | module_init(driver_ni_65xx_init_module); | 872 | module_init(driver_ni_65xx_init_module); |
873 | module_exit(driver_ni_65xx_cleanup_module); | 873 | module_exit(driver_ni_65xx_cleanup_module); |
874 | |||
875 | MODULE_AUTHOR("Comedi http://www.comedi.org"); | ||
876 | MODULE_DESCRIPTION("Comedi low-level driver"); | ||
877 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 6612b085c4ef..ca2aeaa9449c 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c | |||
@@ -1421,3 +1421,7 @@ static int ni_660x_dio_insn_config(struct comedi_device *dev, | |||
1421 | }; | 1421 | }; |
1422 | return 0; | 1422 | return 0; |
1423 | } | 1423 | } |
1424 | |||
1425 | MODULE_AUTHOR("Comedi http://www.comedi.org"); | ||
1426 | MODULE_DESCRIPTION("Comedi low-level driver"); | ||
1427 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index e9f034efdc6f..d8d91f90060e 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c | |||
@@ -384,3 +384,7 @@ static int ni_670x_find_device(struct comedi_device *dev, int bus, int slot) | |||
384 | mite_list_devices(); | 384 | mite_list_devices(); |
385 | return -EIO; | 385 | return -EIO; |
386 | } | 386 | } |
387 | |||
388 | MODULE_AUTHOR("Comedi http://www.comedi.org"); | ||
389 | MODULE_DESCRIPTION("Comedi low-level driver"); | ||
390 | MODULE_LICENSE("GPL"); | ||
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/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 84a15c34e484..005d2fe86ee4 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c | |||
@@ -1354,3 +1354,7 @@ static void __exit driver_pcidio_cleanup_module(void) | |||
1354 | 1354 | ||
1355 | module_init(driver_pcidio_init_module); | 1355 | module_init(driver_pcidio_init_module); |
1356 | module_exit(driver_pcidio_cleanup_module); | 1356 | module_exit(driver_pcidio_cleanup_module); |
1357 | |||
1358 | MODULE_AUTHOR("Comedi http://www.comedi.org"); | ||
1359 | MODULE_DESCRIPTION("Comedi low-level driver"); | ||
1360 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 23a381247285..9148abdad074 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c | |||
@@ -1853,3 +1853,7 @@ static int pcimio_dio_change(struct comedi_device *dev, | |||
1853 | 1853 | ||
1854 | return 0; | 1854 | return 0; |
1855 | } | 1855 | } |
1856 | |||
1857 | MODULE_AUTHOR("Comedi http://www.comedi.org"); | ||
1858 | MODULE_DESCRIPTION("Comedi low-level driver"); | ||
1859 | MODULE_LICENSE("GPL"); | ||
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..b41c9640b72d 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c | |||
@@ -236,6 +236,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
236 | if (status == 1) { | 236 | if (status == 1) { |
237 | netif_carrier_on(net); | 237 | netif_carrier_on(net); |
238 | netif_wake_queue(net); | 238 | netif_wake_queue(net); |
239 | netif_notify_peers(net); | ||
239 | } else { | 240 | } else { |
240 | netif_carrier_off(net); | 241 | netif_carrier_off(net); |
241 | netif_stop_queue(net); | 242 | netif_stop_queue(net); |
@@ -358,7 +359,6 @@ static int netvsc_probe(struct device *device) | |||
358 | 359 | ||
359 | /* Set initial state */ | 360 | /* Set initial state */ |
360 | netif_carrier_off(net); | 361 | netif_carrier_off(net); |
361 | netif_stop_queue(net); | ||
362 | 362 | ||
363 | net_device_ctx = netdev_priv(net); | 363 | net_device_ctx = netdev_priv(net); |
364 | net_device_ctx->device_ctx = device_ctx; | 364 | 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/intel_sst/intelmid_v2_control.c b/drivers/staging/intel_sst/intelmid_v2_control.c index e38e89df6e84..e2f6d6a3c850 100644 --- a/drivers/staging/intel_sst/intelmid_v2_control.c +++ b/drivers/staging/intel_sst/intelmid_v2_control.c | |||
@@ -874,7 +874,10 @@ static int nc_set_selected_input_dev(u8 value) | |||
874 | sc_access[3].reg_addr = 0x109; | 874 | sc_access[3].reg_addr = 0x109; |
875 | sc_access[3].mask = MASK6; | 875 | sc_access[3].mask = MASK6; |
876 | sc_access[3].value = 0x00; | 876 | sc_access[3].value = 0x00; |
877 | num_val = 4; | 877 | sc_access[4].reg_addr = 0x104; |
878 | sc_access[4].value = 0x3C; | ||
879 | sc_access[4].mask = 0xff; | ||
880 | num_val = 5; | ||
878 | break; | 881 | break; |
879 | default: | 882 | default: |
880 | return -EINVAL; | 883 | return -EINVAL; |
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/msm/msm_fb.c b/drivers/staging/msm/msm_fb.c index 23fa049b51f2..a2f29d464051 100644 --- a/drivers/staging/msm/msm_fb.c +++ b/drivers/staging/msm/msm_fb.c | |||
@@ -347,7 +347,7 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
347 | if ((!mfd) || (mfd->key != MFD_KEY)) | 347 | if ((!mfd) || (mfd->key != MFD_KEY)) |
348 | return 0; | 348 | return 0; |
349 | 349 | ||
350 | acquire_console_sem(); | 350 | console_lock(); |
351 | fb_set_suspend(mfd->fbi, 1); | 351 | fb_set_suspend(mfd->fbi, 1); |
352 | 352 | ||
353 | ret = msm_fb_suspend_sub(mfd); | 353 | ret = msm_fb_suspend_sub(mfd); |
@@ -358,7 +358,7 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
358 | pdev->dev.power.power_state = state; | 358 | pdev->dev.power.power_state = state; |
359 | } | 359 | } |
360 | 360 | ||
361 | release_console_sem(); | 361 | console_unlock(); |
362 | return ret; | 362 | return ret; |
363 | } | 363 | } |
364 | #else | 364 | #else |
@@ -431,11 +431,11 @@ static int msm_fb_resume(struct platform_device *pdev) | |||
431 | if ((!mfd) || (mfd->key != MFD_KEY)) | 431 | if ((!mfd) || (mfd->key != MFD_KEY)) |
432 | return 0; | 432 | return 0; |
433 | 433 | ||
434 | acquire_console_sem(); | 434 | console_lock(); |
435 | ret = msm_fb_resume_sub(mfd); | 435 | ret = msm_fb_resume_sub(mfd); |
436 | pdev->dev.power.power_state = PMSG_ON; | 436 | pdev->dev.power.power_state = PMSG_ON; |
437 | fb_set_suspend(mfd->fbi, 1); | 437 | fb_set_suspend(mfd->fbi, 1); |
438 | release_console_sem(); | 438 | console_unlock(); |
439 | 439 | ||
440 | return ret; | 440 | return ret; |
441 | } | 441 | } |
diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index 9f26dc9408bb..56a283d1a74d 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c | |||
@@ -373,17 +373,17 @@ static void dcon_source_switch(struct work_struct *work) | |||
373 | * | 373 | * |
374 | * For now, we just hope.. | 374 | * For now, we just hope.. |
375 | */ | 375 | */ |
376 | acquire_console_sem(); | 376 | console_lock(); |
377 | ignore_fb_events = 1; | 377 | ignore_fb_events = 1; |
378 | if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) { | 378 | if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) { |
379 | ignore_fb_events = 0; | 379 | ignore_fb_events = 0; |
380 | release_console_sem(); | 380 | console_unlock(); |
381 | printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n"); | 381 | printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n"); |
382 | dcon_pending = DCON_SOURCE_DCON; | 382 | dcon_pending = DCON_SOURCE_DCON; |
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | ignore_fb_events = 0; | 385 | ignore_fb_events = 0; |
386 | release_console_sem(); | 386 | console_unlock(); |
387 | 387 | ||
388 | /* And turn off the DCON */ | 388 | /* And turn off the DCON */ |
389 | pdata->set_dconload(1); | 389 | pdata->set_dconload(1); |
@@ -435,12 +435,12 @@ static void dcon_source_switch(struct work_struct *work) | |||
435 | } | 435 | } |
436 | } | 436 | } |
437 | 437 | ||
438 | acquire_console_sem(); | 438 | console_lock(); |
439 | ignore_fb_events = 1; | 439 | ignore_fb_events = 1; |
440 | if (fb_blank(fbinfo, FB_BLANK_POWERDOWN)) | 440 | if (fb_blank(fbinfo, FB_BLANK_POWERDOWN)) |
441 | printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n"); | 441 | printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n"); |
442 | ignore_fb_events = 0; | 442 | ignore_fb_events = 0; |
443 | release_console_sem(); | 443 | console_unlock(); |
444 | 444 | ||
445 | printk(KERN_INFO "olpc-dcon: The DCON has control\n"); | 445 | printk(KERN_INFO "olpc-dcon: The DCON has control\n"); |
446 | break; | 446 | break; |
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/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c index 0bc113c44d39..d007e4a12c14 100644 --- a/drivers/staging/sm7xx/smtcfb.c +++ b/drivers/staging/sm7xx/smtcfb.c | |||
@@ -1044,9 +1044,9 @@ static int __maybe_unused smtcfb_suspend(struct pci_dev *pdev, pm_message_t msg) | |||
1044 | 1044 | ||
1045 | /* when doing suspend, call fb apis and pci apis */ | 1045 | /* when doing suspend, call fb apis and pci apis */ |
1046 | if (msg.event == PM_EVENT_SUSPEND) { | 1046 | if (msg.event == PM_EVENT_SUSPEND) { |
1047 | acquire_console_sem(); | 1047 | console_lock(); |
1048 | fb_set_suspend(&sfb->fb, 1); | 1048 | fb_set_suspend(&sfb->fb, 1); |
1049 | release_console_sem(); | 1049 | console_unlock(); |
1050 | retv = pci_save_state(pdev); | 1050 | retv = pci_save_state(pdev); |
1051 | pci_disable_device(pdev); | 1051 | pci_disable_device(pdev); |
1052 | retv = pci_choose_state(pdev, msg); | 1052 | retv = pci_choose_state(pdev, msg); |
@@ -1105,9 +1105,9 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev) | |||
1105 | 1105 | ||
1106 | smtcfb_setmode(sfb); | 1106 | smtcfb_setmode(sfb); |
1107 | 1107 | ||
1108 | acquire_console_sem(); | 1108 | console_lock(); |
1109 | fb_set_suspend(&sfb->fb, 0); | 1109 | fb_set_suspend(&sfb->fb, 0); |
1110 | release_console_sem(); | 1110 | console_unlock(); |
1111 | 1111 | ||
1112 | return 0; | 1112 | return 0; |
1113 | } | 1113 | } |
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/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 5415712f01f8..4bd8cbdaee76 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c | |||
@@ -227,6 +227,7 @@ static int zram_read(struct zram *zram, struct bio *bio) | |||
227 | 227 | ||
228 | if (zram_test_flag(zram, index, ZRAM_ZERO)) { | 228 | if (zram_test_flag(zram, index, ZRAM_ZERO)) { |
229 | handle_zero_page(page); | 229 | handle_zero_page(page); |
230 | index++; | ||
230 | continue; | 231 | continue; |
231 | } | 232 | } |
232 | 233 | ||
@@ -235,12 +236,14 @@ static int zram_read(struct zram *zram, struct bio *bio) | |||
235 | pr_debug("Read before write: sector=%lu, size=%u", | 236 | pr_debug("Read before write: sector=%lu, size=%u", |
236 | (ulong)(bio->bi_sector), bio->bi_size); | 237 | (ulong)(bio->bi_sector), bio->bi_size); |
237 | /* Do nothing */ | 238 | /* Do nothing */ |
239 | index++; | ||
238 | continue; | 240 | continue; |
239 | } | 241 | } |
240 | 242 | ||
241 | /* Page is stored uncompressed since it's incompressible */ | 243 | /* Page is stored uncompressed since it's incompressible */ |
242 | if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { | 244 | if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { |
243 | handle_uncompressed_page(zram, page, index); | 245 | handle_uncompressed_page(zram, page, index); |
246 | index++; | ||
244 | continue; | 247 | continue; |
245 | } | 248 | } |
246 | 249 | ||
@@ -320,6 +323,7 @@ static int zram_write(struct zram *zram, struct bio *bio) | |||
320 | mutex_unlock(&zram->lock); | 323 | mutex_unlock(&zram->lock); |
321 | zram_stat_inc(&zram->stats.pages_zero); | 324 | zram_stat_inc(&zram->stats.pages_zero); |
322 | zram_set_flag(zram, index, ZRAM_ZERO); | 325 | zram_set_flag(zram, index, ZRAM_ZERO); |
326 | index++; | ||
323 | continue; | 327 | continue; |
324 | } | 328 | } |
325 | 329 | ||
diff --git a/drivers/target/Makefile b/drivers/target/Makefile index 5cfd70819f08..973bb190ef57 100644 --- a/drivers/target/Makefile +++ b/drivers/target/Makefile | |||
@@ -13,8 +13,7 @@ target_core_mod-y := target_core_configfs.o \ | |||
13 | target_core_transport.o \ | 13 | target_core_transport.o \ |
14 | target_core_cdb.o \ | 14 | target_core_cdb.o \ |
15 | target_core_ua.o \ | 15 | target_core_ua.o \ |
16 | target_core_rd.o \ | 16 | target_core_rd.o |
17 | target_core_mib.o | ||
18 | 17 | ||
19 | obj-$(CONFIG_TARGET_CORE) += target_core_mod.o | 18 | obj-$(CONFIG_TARGET_CORE) += target_core_mod.o |
20 | 19 | ||
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 2764510798b0..caf8dc18ee0a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/parser.h> | 37 | #include <linux/parser.h> |
38 | #include <linux/syscalls.h> | 38 | #include <linux/syscalls.h> |
39 | #include <linux/configfs.h> | 39 | #include <linux/configfs.h> |
40 | #include <linux/proc_fs.h> | ||
41 | 40 | ||
42 | #include <target/target_core_base.h> | 41 | #include <target/target_core_base.h> |
43 | #include <target/target_core_device.h> | 42 | #include <target/target_core_device.h> |
@@ -1971,13 +1970,35 @@ static void target_core_dev_release(struct config_item *item) | |||
1971 | { | 1970 | { |
1972 | struct se_subsystem_dev *se_dev = container_of(to_config_group(item), | 1971 | struct se_subsystem_dev *se_dev = container_of(to_config_group(item), |
1973 | struct se_subsystem_dev, se_dev_group); | 1972 | struct se_subsystem_dev, se_dev_group); |
1974 | struct config_group *dev_cg; | 1973 | struct se_hba *hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item); |
1975 | 1974 | struct se_subsystem_api *t = hba->transport; | |
1976 | if (!(se_dev)) | 1975 | struct config_group *dev_cg = &se_dev->se_dev_group; |
1977 | return; | ||
1978 | 1976 | ||
1979 | dev_cg = &se_dev->se_dev_group; | ||
1980 | kfree(dev_cg->default_groups); | 1977 | kfree(dev_cg->default_groups); |
1978 | /* | ||
1979 | * This pointer will set when the storage is enabled with: | ||
1980 | *`echo 1 > $CONFIGFS/core/$HBA/$DEV/dev_enable` | ||
1981 | */ | ||
1982 | if (se_dev->se_dev_ptr) { | ||
1983 | printk(KERN_INFO "Target_Core_ConfigFS: Calling se_free_" | ||
1984 | "virtual_device() for se_dev_ptr: %p\n", | ||
1985 | se_dev->se_dev_ptr); | ||
1986 | |||
1987 | se_free_virtual_device(se_dev->se_dev_ptr, hba); | ||
1988 | } else { | ||
1989 | /* | ||
1990 | * Release struct se_subsystem_dev->se_dev_su_ptr.. | ||
1991 | */ | ||
1992 | printk(KERN_INFO "Target_Core_ConfigFS: Calling t->free_" | ||
1993 | "device() for se_dev_su_ptr: %p\n", | ||
1994 | se_dev->se_dev_su_ptr); | ||
1995 | |||
1996 | t->free_device(se_dev->se_dev_su_ptr); | ||
1997 | } | ||
1998 | |||
1999 | printk(KERN_INFO "Target_Core_ConfigFS: Deallocating se_subsystem" | ||
2000 | "_dev_t: %p\n", se_dev); | ||
2001 | kfree(se_dev); | ||
1981 | } | 2002 | } |
1982 | 2003 | ||
1983 | static ssize_t target_core_dev_show(struct config_item *item, | 2004 | static ssize_t target_core_dev_show(struct config_item *item, |
@@ -2140,7 +2161,16 @@ static struct configfs_attribute *target_core_alua_lu_gp_attrs[] = { | |||
2140 | NULL, | 2161 | NULL, |
2141 | }; | 2162 | }; |
2142 | 2163 | ||
2164 | static void target_core_alua_lu_gp_release(struct config_item *item) | ||
2165 | { | ||
2166 | struct t10_alua_lu_gp *lu_gp = container_of(to_config_group(item), | ||
2167 | struct t10_alua_lu_gp, lu_gp_group); | ||
2168 | |||
2169 | core_alua_free_lu_gp(lu_gp); | ||
2170 | } | ||
2171 | |||
2143 | static struct configfs_item_operations target_core_alua_lu_gp_ops = { | 2172 | static struct configfs_item_operations target_core_alua_lu_gp_ops = { |
2173 | .release = target_core_alua_lu_gp_release, | ||
2144 | .show_attribute = target_core_alua_lu_gp_attr_show, | 2174 | .show_attribute = target_core_alua_lu_gp_attr_show, |
2145 | .store_attribute = target_core_alua_lu_gp_attr_store, | 2175 | .store_attribute = target_core_alua_lu_gp_attr_store, |
2146 | }; | 2176 | }; |
@@ -2191,9 +2221,11 @@ static void target_core_alua_drop_lu_gp( | |||
2191 | printk(KERN_INFO "Target_Core_ConfigFS: Releasing ALUA Logical Unit" | 2221 | printk(KERN_INFO "Target_Core_ConfigFS: Releasing ALUA Logical Unit" |
2192 | " Group: core/alua/lu_gps/%s, ID: %hu\n", | 2222 | " Group: core/alua/lu_gps/%s, ID: %hu\n", |
2193 | config_item_name(item), lu_gp->lu_gp_id); | 2223 | config_item_name(item), lu_gp->lu_gp_id); |
2194 | 2224 | /* | |
2225 | * core_alua_free_lu_gp() is called from target_core_alua_lu_gp_ops->release() | ||
2226 | * -> target_core_alua_lu_gp_release() | ||
2227 | */ | ||
2195 | config_item_put(item); | 2228 | config_item_put(item); |
2196 | core_alua_free_lu_gp(lu_gp); | ||
2197 | } | 2229 | } |
2198 | 2230 | ||
2199 | static struct configfs_group_operations target_core_alua_lu_gps_group_ops = { | 2231 | static struct configfs_group_operations target_core_alua_lu_gps_group_ops = { |
@@ -2549,7 +2581,16 @@ static struct configfs_attribute *target_core_alua_tg_pt_gp_attrs[] = { | |||
2549 | NULL, | 2581 | NULL, |
2550 | }; | 2582 | }; |
2551 | 2583 | ||
2584 | static void target_core_alua_tg_pt_gp_release(struct config_item *item) | ||
2585 | { | ||
2586 | struct t10_alua_tg_pt_gp *tg_pt_gp = container_of(to_config_group(item), | ||
2587 | struct t10_alua_tg_pt_gp, tg_pt_gp_group); | ||
2588 | |||
2589 | core_alua_free_tg_pt_gp(tg_pt_gp); | ||
2590 | } | ||
2591 | |||
2552 | static struct configfs_item_operations target_core_alua_tg_pt_gp_ops = { | 2592 | static struct configfs_item_operations target_core_alua_tg_pt_gp_ops = { |
2593 | .release = target_core_alua_tg_pt_gp_release, | ||
2553 | .show_attribute = target_core_alua_tg_pt_gp_attr_show, | 2594 | .show_attribute = target_core_alua_tg_pt_gp_attr_show, |
2554 | .store_attribute = target_core_alua_tg_pt_gp_attr_store, | 2595 | .store_attribute = target_core_alua_tg_pt_gp_attr_store, |
2555 | }; | 2596 | }; |
@@ -2602,9 +2643,11 @@ static void target_core_alua_drop_tg_pt_gp( | |||
2602 | printk(KERN_INFO "Target_Core_ConfigFS: Releasing ALUA Target Port" | 2643 | printk(KERN_INFO "Target_Core_ConfigFS: Releasing ALUA Target Port" |
2603 | " Group: alua/tg_pt_gps/%s, ID: %hu\n", | 2644 | " Group: alua/tg_pt_gps/%s, ID: %hu\n", |
2604 | config_item_name(item), tg_pt_gp->tg_pt_gp_id); | 2645 | config_item_name(item), tg_pt_gp->tg_pt_gp_id); |
2605 | 2646 | /* | |
2647 | * core_alua_free_tg_pt_gp() is called from target_core_alua_tg_pt_gp_ops->release() | ||
2648 | * -> target_core_alua_tg_pt_gp_release(). | ||
2649 | */ | ||
2606 | config_item_put(item); | 2650 | config_item_put(item); |
2607 | core_alua_free_tg_pt_gp(tg_pt_gp); | ||
2608 | } | 2651 | } |
2609 | 2652 | ||
2610 | static struct configfs_group_operations target_core_alua_tg_pt_gps_group_ops = { | 2653 | static struct configfs_group_operations target_core_alua_tg_pt_gps_group_ops = { |
@@ -2771,13 +2814,11 @@ static void target_core_drop_subdev( | |||
2771 | struct se_subsystem_api *t; | 2814 | struct se_subsystem_api *t; |
2772 | struct config_item *df_item; | 2815 | struct config_item *df_item; |
2773 | struct config_group *dev_cg, *tg_pt_gp_cg; | 2816 | struct config_group *dev_cg, *tg_pt_gp_cg; |
2774 | int i, ret; | 2817 | int i; |
2775 | 2818 | ||
2776 | hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item); | 2819 | hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item); |
2777 | 2820 | ||
2778 | if (mutex_lock_interruptible(&hba->hba_access_mutex)) | 2821 | mutex_lock(&hba->hba_access_mutex); |
2779 | goto out; | ||
2780 | |||
2781 | t = hba->transport; | 2822 | t = hba->transport; |
2782 | 2823 | ||
2783 | spin_lock(&se_global->g_device_lock); | 2824 | spin_lock(&se_global->g_device_lock); |
@@ -2791,7 +2832,10 @@ static void target_core_drop_subdev( | |||
2791 | config_item_put(df_item); | 2832 | config_item_put(df_item); |
2792 | } | 2833 | } |
2793 | kfree(tg_pt_gp_cg->default_groups); | 2834 | kfree(tg_pt_gp_cg->default_groups); |
2794 | core_alua_free_tg_pt_gp(T10_ALUA(se_dev)->default_tg_pt_gp); | 2835 | /* |
2836 | * core_alua_free_tg_pt_gp() is called from ->default_tg_pt_gp | ||
2837 | * directly from target_core_alua_tg_pt_gp_release(). | ||
2838 | */ | ||
2795 | T10_ALUA(se_dev)->default_tg_pt_gp = NULL; | 2839 | T10_ALUA(se_dev)->default_tg_pt_gp = NULL; |
2796 | 2840 | ||
2797 | dev_cg = &se_dev->se_dev_group; | 2841 | dev_cg = &se_dev->se_dev_group; |
@@ -2800,38 +2844,12 @@ static void target_core_drop_subdev( | |||
2800 | dev_cg->default_groups[i] = NULL; | 2844 | dev_cg->default_groups[i] = NULL; |
2801 | config_item_put(df_item); | 2845 | config_item_put(df_item); |
2802 | } | 2846 | } |
2803 | |||
2804 | config_item_put(item); | ||
2805 | /* | 2847 | /* |
2806 | * This pointer will set when the storage is enabled with: | 2848 | * The releasing of se_dev and associated se_dev->se_dev_ptr is done |
2807 | * `echo 1 > $CONFIGFS/core/$HBA/$DEV/dev_enable` | 2849 | * from target_core_dev_item_ops->release() ->target_core_dev_release(). |
2808 | */ | 2850 | */ |
2809 | if (se_dev->se_dev_ptr) { | 2851 | config_item_put(item); |
2810 | printk(KERN_INFO "Target_Core_ConfigFS: Calling se_free_" | ||
2811 | "virtual_device() for se_dev_ptr: %p\n", | ||
2812 | se_dev->se_dev_ptr); | ||
2813 | |||
2814 | ret = se_free_virtual_device(se_dev->se_dev_ptr, hba); | ||
2815 | if (ret < 0) | ||
2816 | goto hba_out; | ||
2817 | } else { | ||
2818 | /* | ||
2819 | * Release struct se_subsystem_dev->se_dev_su_ptr.. | ||
2820 | */ | ||
2821 | printk(KERN_INFO "Target_Core_ConfigFS: Calling t->free_" | ||
2822 | "device() for se_dev_su_ptr: %p\n", | ||
2823 | se_dev->se_dev_su_ptr); | ||
2824 | |||
2825 | t->free_device(se_dev->se_dev_su_ptr); | ||
2826 | } | ||
2827 | |||
2828 | printk(KERN_INFO "Target_Core_ConfigFS: Deallocating se_subsystem" | ||
2829 | "_dev_t: %p\n", se_dev); | ||
2830 | |||
2831 | hba_out: | ||
2832 | mutex_unlock(&hba->hba_access_mutex); | 2852 | mutex_unlock(&hba->hba_access_mutex); |
2833 | out: | ||
2834 | kfree(se_dev); | ||
2835 | } | 2853 | } |
2836 | 2854 | ||
2837 | static struct configfs_group_operations target_core_hba_group_ops = { | 2855 | static struct configfs_group_operations target_core_hba_group_ops = { |
@@ -2914,6 +2932,13 @@ SE_HBA_ATTR(hba_mode, S_IRUGO | S_IWUSR); | |||
2914 | 2932 | ||
2915 | CONFIGFS_EATTR_OPS(target_core_hba, se_hba, hba_group); | 2933 | CONFIGFS_EATTR_OPS(target_core_hba, se_hba, hba_group); |
2916 | 2934 | ||
2935 | static void target_core_hba_release(struct config_item *item) | ||
2936 | { | ||
2937 | struct se_hba *hba = container_of(to_config_group(item), | ||
2938 | struct se_hba, hba_group); | ||
2939 | core_delete_hba(hba); | ||
2940 | } | ||
2941 | |||
2917 | static struct configfs_attribute *target_core_hba_attrs[] = { | 2942 | static struct configfs_attribute *target_core_hba_attrs[] = { |
2918 | &target_core_hba_hba_info.attr, | 2943 | &target_core_hba_hba_info.attr, |
2919 | &target_core_hba_hba_mode.attr, | 2944 | &target_core_hba_hba_mode.attr, |
@@ -2921,6 +2946,7 @@ static struct configfs_attribute *target_core_hba_attrs[] = { | |||
2921 | }; | 2946 | }; |
2922 | 2947 | ||
2923 | static struct configfs_item_operations target_core_hba_item_ops = { | 2948 | static struct configfs_item_operations target_core_hba_item_ops = { |
2949 | .release = target_core_hba_release, | ||
2924 | .show_attribute = target_core_hba_attr_show, | 2950 | .show_attribute = target_core_hba_attr_show, |
2925 | .store_attribute = target_core_hba_attr_store, | 2951 | .store_attribute = target_core_hba_attr_store, |
2926 | }; | 2952 | }; |
@@ -2997,10 +3023,11 @@ static void target_core_call_delhbafromtarget( | |||
2997 | struct config_group *group, | 3023 | struct config_group *group, |
2998 | struct config_item *item) | 3024 | struct config_item *item) |
2999 | { | 3025 | { |
3000 | struct se_hba *hba = item_to_hba(item); | 3026 | /* |
3001 | 3027 | * core_delete_hba() is called from target_core_hba_item_ops->release() | |
3028 | * -> target_core_hba_release() | ||
3029 | */ | ||
3002 | config_item_put(item); | 3030 | config_item_put(item); |
3003 | core_delete_hba(hba); | ||
3004 | } | 3031 | } |
3005 | 3032 | ||
3006 | static struct configfs_group_operations target_core_group_ops = { | 3033 | static struct configfs_group_operations target_core_group_ops = { |
@@ -3022,7 +3049,6 @@ static int target_core_init_configfs(void) | |||
3022 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; | 3049 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; |
3023 | struct config_group *lu_gp_cg = NULL; | 3050 | struct config_group *lu_gp_cg = NULL; |
3024 | struct configfs_subsystem *subsys; | 3051 | struct configfs_subsystem *subsys; |
3025 | struct proc_dir_entry *scsi_target_proc = NULL; | ||
3026 | struct t10_alua_lu_gp *lu_gp; | 3052 | struct t10_alua_lu_gp *lu_gp; |
3027 | int ret; | 3053 | int ret; |
3028 | 3054 | ||
@@ -3128,21 +3154,10 @@ static int target_core_init_configfs(void) | |||
3128 | if (core_dev_setup_virtual_lun0() < 0) | 3154 | if (core_dev_setup_virtual_lun0() < 0) |
3129 | goto out; | 3155 | goto out; |
3130 | 3156 | ||
3131 | scsi_target_proc = proc_mkdir("scsi_target", 0); | ||
3132 | if (!(scsi_target_proc)) { | ||
3133 | printk(KERN_ERR "proc_mkdir(scsi_target, 0) failed\n"); | ||
3134 | goto out; | ||
3135 | } | ||
3136 | ret = init_scsi_target_mib(); | ||
3137 | if (ret < 0) | ||
3138 | goto out; | ||
3139 | |||
3140 | return 0; | 3157 | return 0; |
3141 | 3158 | ||
3142 | out: | 3159 | out: |
3143 | configfs_unregister_subsystem(subsys); | 3160 | configfs_unregister_subsystem(subsys); |
3144 | if (scsi_target_proc) | ||
3145 | remove_proc_entry("scsi_target", 0); | ||
3146 | core_dev_release_virtual_lun0(); | 3161 | core_dev_release_virtual_lun0(); |
3147 | rd_module_exit(); | 3162 | rd_module_exit(); |
3148 | out_global: | 3163 | out_global: |
@@ -3178,8 +3193,7 @@ static void target_core_exit_configfs(void) | |||
3178 | config_item_put(item); | 3193 | config_item_put(item); |
3179 | } | 3194 | } |
3180 | kfree(lu_gp_cg->default_groups); | 3195 | kfree(lu_gp_cg->default_groups); |
3181 | core_alua_free_lu_gp(se_global->default_lu_gp); | 3196 | lu_gp_cg->default_groups = NULL; |
3182 | se_global->default_lu_gp = NULL; | ||
3183 | 3197 | ||
3184 | alua_cg = &se_global->alua_group; | 3198 | alua_cg = &se_global->alua_group; |
3185 | for (i = 0; alua_cg->default_groups[i]; i++) { | 3199 | for (i = 0; alua_cg->default_groups[i]; i++) { |
@@ -3188,6 +3202,7 @@ static void target_core_exit_configfs(void) | |||
3188 | config_item_put(item); | 3202 | config_item_put(item); |
3189 | } | 3203 | } |
3190 | kfree(alua_cg->default_groups); | 3204 | kfree(alua_cg->default_groups); |
3205 | alua_cg->default_groups = NULL; | ||
3191 | 3206 | ||
3192 | hba_cg = &se_global->target_core_hbagroup; | 3207 | hba_cg = &se_global->target_core_hbagroup; |
3193 | for (i = 0; hba_cg->default_groups[i]; i++) { | 3208 | for (i = 0; hba_cg->default_groups[i]; i++) { |
@@ -3196,20 +3211,20 @@ static void target_core_exit_configfs(void) | |||
3196 | config_item_put(item); | 3211 | config_item_put(item); |
3197 | } | 3212 | } |
3198 | kfree(hba_cg->default_groups); | 3213 | kfree(hba_cg->default_groups); |
3199 | 3214 | hba_cg->default_groups = NULL; | |
3200 | for (i = 0; subsys->su_group.default_groups[i]; i++) { | 3215 | /* |
3201 | item = &subsys->su_group.default_groups[i]->cg_item; | 3216 | * We expect subsys->su_group.default_groups to be released |
3202 | subsys->su_group.default_groups[i] = NULL; | 3217 | * by configfs subsystem provider logic.. |
3203 | config_item_put(item); | 3218 | */ |
3204 | } | 3219 | configfs_unregister_subsystem(subsys); |
3205 | kfree(subsys->su_group.default_groups); | 3220 | kfree(subsys->su_group.default_groups); |
3206 | 3221 | ||
3207 | configfs_unregister_subsystem(subsys); | 3222 | core_alua_free_lu_gp(se_global->default_lu_gp); |
3223 | se_global->default_lu_gp = NULL; | ||
3224 | |||
3208 | printk(KERN_INFO "TARGET_CORE[0]: Released ConfigFS Fabric" | 3225 | printk(KERN_INFO "TARGET_CORE[0]: Released ConfigFS Fabric" |
3209 | " Infrastructure\n"); | 3226 | " Infrastructure\n"); |
3210 | 3227 | ||
3211 | remove_scsi_target_mib(); | ||
3212 | remove_proc_entry("scsi_target", 0); | ||
3213 | core_dev_release_virtual_lun0(); | 3228 | core_dev_release_virtual_lun0(); |
3214 | rd_module_exit(); | 3229 | rd_module_exit(); |
3215 | release_se_global(); | 3230 | release_se_global(); |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 317ce58d426d..5da051a07fa3 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -373,11 +373,11 @@ int core_update_device_list_for_node( | |||
373 | /* | 373 | /* |
374 | * deve->se_lun_acl will be NULL for demo-mode created LUNs | 374 | * deve->se_lun_acl will be NULL for demo-mode created LUNs |
375 | * that have not been explictly concerted to MappedLUNs -> | 375 | * that have not been explictly concerted to MappedLUNs -> |
376 | * struct se_lun_acl. | 376 | * struct se_lun_acl, but we remove deve->alua_port_list from |
377 | * port->sep_alua_list. This also means that active UAs and | ||
378 | * NodeACL context specific PR metadata for demo-mode | ||
379 | * MappedLUN *deve will be released below.. | ||
377 | */ | 380 | */ |
378 | if (!(deve->se_lun_acl)) | ||
379 | return 0; | ||
380 | |||
381 | spin_lock_bh(&port->sep_alua_lock); | 381 | spin_lock_bh(&port->sep_alua_lock); |
382 | list_del(&deve->alua_port_list); | 382 | list_del(&deve->alua_port_list); |
383 | spin_unlock_bh(&port->sep_alua_lock); | 383 | spin_unlock_bh(&port->sep_alua_lock); |
@@ -395,12 +395,14 @@ int core_update_device_list_for_node( | |||
395 | printk(KERN_ERR "struct se_dev_entry->se_lun_acl" | 395 | printk(KERN_ERR "struct se_dev_entry->se_lun_acl" |
396 | " already set for demo mode -> explict" | 396 | " already set for demo mode -> explict" |
397 | " LUN ACL transition\n"); | 397 | " LUN ACL transition\n"); |
398 | spin_unlock_irq(&nacl->device_list_lock); | ||
398 | return -1; | 399 | return -1; |
399 | } | 400 | } |
400 | if (deve->se_lun != lun) { | 401 | if (deve->se_lun != lun) { |
401 | printk(KERN_ERR "struct se_dev_entry->se_lun does" | 402 | printk(KERN_ERR "struct se_dev_entry->se_lun does" |
402 | " match passed struct se_lun for demo mode" | 403 | " match passed struct se_lun for demo mode" |
403 | " -> explict LUN ACL transition\n"); | 404 | " -> explict LUN ACL transition\n"); |
405 | spin_unlock_irq(&nacl->device_list_lock); | ||
404 | return -1; | 406 | return -1; |
405 | } | 407 | } |
406 | deve->se_lun_acl = lun_acl; | 408 | deve->se_lun_acl = lun_acl; |
@@ -865,9 +867,6 @@ static void se_dev_stop(struct se_device *dev) | |||
865 | } | 867 | } |
866 | } | 868 | } |
867 | spin_unlock(&hba->device_lock); | 869 | spin_unlock(&hba->device_lock); |
868 | |||
869 | while (atomic_read(&hba->dev_mib_access_count)) | ||
870 | cpu_relax(); | ||
871 | } | 870 | } |
872 | 871 | ||
873 | int se_dev_check_online(struct se_device *dev) | 872 | int se_dev_check_online(struct se_device *dev) |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 32b148d7e261..b65d1c8e7740 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -214,12 +214,22 @@ TCM_MAPPEDLUN_ATTR(write_protect, S_IRUGO | S_IWUSR); | |||
214 | 214 | ||
215 | CONFIGFS_EATTR_OPS(target_fabric_mappedlun, se_lun_acl, se_lun_group); | 215 | CONFIGFS_EATTR_OPS(target_fabric_mappedlun, se_lun_acl, se_lun_group); |
216 | 216 | ||
217 | static void target_fabric_mappedlun_release(struct config_item *item) | ||
218 | { | ||
219 | struct se_lun_acl *lacl = container_of(to_config_group(item), | ||
220 | struct se_lun_acl, se_lun_group); | ||
221 | struct se_portal_group *se_tpg = lacl->se_lun_nacl->se_tpg; | ||
222 | |||
223 | core_dev_free_initiator_node_lun_acl(se_tpg, lacl); | ||
224 | } | ||
225 | |||
217 | static struct configfs_attribute *target_fabric_mappedlun_attrs[] = { | 226 | static struct configfs_attribute *target_fabric_mappedlun_attrs[] = { |
218 | &target_fabric_mappedlun_write_protect.attr, | 227 | &target_fabric_mappedlun_write_protect.attr, |
219 | NULL, | 228 | NULL, |
220 | }; | 229 | }; |
221 | 230 | ||
222 | static struct configfs_item_operations target_fabric_mappedlun_item_ops = { | 231 | static struct configfs_item_operations target_fabric_mappedlun_item_ops = { |
232 | .release = target_fabric_mappedlun_release, | ||
223 | .show_attribute = target_fabric_mappedlun_attr_show, | 233 | .show_attribute = target_fabric_mappedlun_attr_show, |
224 | .store_attribute = target_fabric_mappedlun_attr_store, | 234 | .store_attribute = target_fabric_mappedlun_attr_store, |
225 | .allow_link = target_fabric_mappedlun_link, | 235 | .allow_link = target_fabric_mappedlun_link, |
@@ -337,15 +347,21 @@ static void target_fabric_drop_mappedlun( | |||
337 | struct config_group *group, | 347 | struct config_group *group, |
338 | struct config_item *item) | 348 | struct config_item *item) |
339 | { | 349 | { |
340 | struct se_lun_acl *lacl = container_of(to_config_group(item), | ||
341 | struct se_lun_acl, se_lun_group); | ||
342 | struct se_portal_group *se_tpg = lacl->se_lun_nacl->se_tpg; | ||
343 | |||
344 | config_item_put(item); | 350 | config_item_put(item); |
345 | core_dev_free_initiator_node_lun_acl(se_tpg, lacl); | 351 | } |
352 | |||
353 | static void target_fabric_nacl_base_release(struct config_item *item) | ||
354 | { | ||
355 | struct se_node_acl *se_nacl = container_of(to_config_group(item), | ||
356 | struct se_node_acl, acl_group); | ||
357 | struct se_portal_group *se_tpg = se_nacl->se_tpg; | ||
358 | struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; | ||
359 | |||
360 | tf->tf_ops.fabric_drop_nodeacl(se_nacl); | ||
346 | } | 361 | } |
347 | 362 | ||
348 | static struct configfs_item_operations target_fabric_nacl_base_item_ops = { | 363 | static struct configfs_item_operations target_fabric_nacl_base_item_ops = { |
364 | .release = target_fabric_nacl_base_release, | ||
349 | .show_attribute = target_fabric_nacl_base_attr_show, | 365 | .show_attribute = target_fabric_nacl_base_attr_show, |
350 | .store_attribute = target_fabric_nacl_base_attr_store, | 366 | .store_attribute = target_fabric_nacl_base_attr_store, |
351 | }; | 367 | }; |
@@ -404,9 +420,6 @@ static void target_fabric_drop_nodeacl( | |||
404 | struct config_group *group, | 420 | struct config_group *group, |
405 | struct config_item *item) | 421 | struct config_item *item) |
406 | { | 422 | { |
407 | struct se_portal_group *se_tpg = container_of(group, | ||
408 | struct se_portal_group, tpg_acl_group); | ||
409 | struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; | ||
410 | struct se_node_acl *se_nacl = container_of(to_config_group(item), | 423 | struct se_node_acl *se_nacl = container_of(to_config_group(item), |
411 | struct se_node_acl, acl_group); | 424 | struct se_node_acl, acl_group); |
412 | struct config_item *df_item; | 425 | struct config_item *df_item; |
@@ -419,9 +432,10 @@ static void target_fabric_drop_nodeacl( | |||
419 | nacl_cg->default_groups[i] = NULL; | 432 | nacl_cg->default_groups[i] = NULL; |
420 | config_item_put(df_item); | 433 | config_item_put(df_item); |
421 | } | 434 | } |
422 | 435 | /* | |
436 | * struct se_node_acl free is done in target_fabric_nacl_base_release() | ||
437 | */ | ||
423 | config_item_put(item); | 438 | config_item_put(item); |
424 | tf->tf_ops.fabric_drop_nodeacl(se_nacl); | ||
425 | } | 439 | } |
426 | 440 | ||
427 | static struct configfs_group_operations target_fabric_nacl_group_ops = { | 441 | static struct configfs_group_operations target_fabric_nacl_group_ops = { |
@@ -437,7 +451,18 @@ TF_CIT_SETUP(tpg_nacl, NULL, &target_fabric_nacl_group_ops, NULL); | |||
437 | 451 | ||
438 | CONFIGFS_EATTR_OPS(target_fabric_np_base, se_tpg_np, tpg_np_group); | 452 | CONFIGFS_EATTR_OPS(target_fabric_np_base, se_tpg_np, tpg_np_group); |
439 | 453 | ||
454 | static void target_fabric_np_base_release(struct config_item *item) | ||
455 | { | ||
456 | struct se_tpg_np *se_tpg_np = container_of(to_config_group(item), | ||
457 | struct se_tpg_np, tpg_np_group); | ||
458 | struct se_portal_group *se_tpg = se_tpg_np->tpg_np_parent; | ||
459 | struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; | ||
460 | |||
461 | tf->tf_ops.fabric_drop_np(se_tpg_np); | ||
462 | } | ||
463 | |||
440 | static struct configfs_item_operations target_fabric_np_base_item_ops = { | 464 | static struct configfs_item_operations target_fabric_np_base_item_ops = { |
465 | .release = target_fabric_np_base_release, | ||
441 | .show_attribute = target_fabric_np_base_attr_show, | 466 | .show_attribute = target_fabric_np_base_attr_show, |
442 | .store_attribute = target_fabric_np_base_attr_store, | 467 | .store_attribute = target_fabric_np_base_attr_store, |
443 | }; | 468 | }; |
@@ -466,6 +491,7 @@ static struct config_group *target_fabric_make_np( | |||
466 | if (!(se_tpg_np) || IS_ERR(se_tpg_np)) | 491 | if (!(se_tpg_np) || IS_ERR(se_tpg_np)) |
467 | return ERR_PTR(-EINVAL); | 492 | return ERR_PTR(-EINVAL); |
468 | 493 | ||
494 | se_tpg_np->tpg_np_parent = se_tpg; | ||
469 | config_group_init_type_name(&se_tpg_np->tpg_np_group, name, | 495 | config_group_init_type_name(&se_tpg_np->tpg_np_group, name, |
470 | &TF_CIT_TMPL(tf)->tfc_tpg_np_base_cit); | 496 | &TF_CIT_TMPL(tf)->tfc_tpg_np_base_cit); |
471 | 497 | ||
@@ -476,14 +502,10 @@ static void target_fabric_drop_np( | |||
476 | struct config_group *group, | 502 | struct config_group *group, |
477 | struct config_item *item) | 503 | struct config_item *item) |
478 | { | 504 | { |
479 | struct se_portal_group *se_tpg = container_of(group, | 505 | /* |
480 | struct se_portal_group, tpg_np_group); | 506 | * struct se_tpg_np is released via target_fabric_np_base_release() |
481 | struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; | 507 | */ |
482 | struct se_tpg_np *se_tpg_np = container_of(to_config_group(item), | ||
483 | struct se_tpg_np, tpg_np_group); | ||
484 | |||
485 | config_item_put(item); | 508 | config_item_put(item); |
486 | tf->tf_ops.fabric_drop_np(se_tpg_np); | ||
487 | } | 509 | } |
488 | 510 | ||
489 | static struct configfs_group_operations target_fabric_np_group_ops = { | 511 | static struct configfs_group_operations target_fabric_np_group_ops = { |
@@ -814,7 +836,18 @@ TF_CIT_SETUP(tpg_param, &target_fabric_tpg_param_item_ops, NULL, NULL); | |||
814 | */ | 836 | */ |
815 | CONFIGFS_EATTR_OPS(target_fabric_tpg, se_portal_group, tpg_group); | 837 | CONFIGFS_EATTR_OPS(target_fabric_tpg, se_portal_group, tpg_group); |
816 | 838 | ||
839 | static void target_fabric_tpg_release(struct config_item *item) | ||
840 | { | ||
841 | struct se_portal_group *se_tpg = container_of(to_config_group(item), | ||
842 | struct se_portal_group, tpg_group); | ||
843 | struct se_wwn *wwn = se_tpg->se_tpg_wwn; | ||
844 | struct target_fabric_configfs *tf = wwn->wwn_tf; | ||
845 | |||
846 | tf->tf_ops.fabric_drop_tpg(se_tpg); | ||
847 | } | ||
848 | |||
817 | static struct configfs_item_operations target_fabric_tpg_base_item_ops = { | 849 | static struct configfs_item_operations target_fabric_tpg_base_item_ops = { |
850 | .release = target_fabric_tpg_release, | ||
818 | .show_attribute = target_fabric_tpg_attr_show, | 851 | .show_attribute = target_fabric_tpg_attr_show, |
819 | .store_attribute = target_fabric_tpg_attr_store, | 852 | .store_attribute = target_fabric_tpg_attr_store, |
820 | }; | 853 | }; |
@@ -872,8 +905,6 @@ static void target_fabric_drop_tpg( | |||
872 | struct config_group *group, | 905 | struct config_group *group, |
873 | struct config_item *item) | 906 | struct config_item *item) |
874 | { | 907 | { |
875 | struct se_wwn *wwn = container_of(group, struct se_wwn, wwn_group); | ||
876 | struct target_fabric_configfs *tf = wwn->wwn_tf; | ||
877 | struct se_portal_group *se_tpg = container_of(to_config_group(item), | 908 | struct se_portal_group *se_tpg = container_of(to_config_group(item), |
878 | struct se_portal_group, tpg_group); | 909 | struct se_portal_group, tpg_group); |
879 | struct config_group *tpg_cg = &se_tpg->tpg_group; | 910 | struct config_group *tpg_cg = &se_tpg->tpg_group; |
@@ -890,15 +921,28 @@ static void target_fabric_drop_tpg( | |||
890 | } | 921 | } |
891 | 922 | ||
892 | config_item_put(item); | 923 | config_item_put(item); |
893 | tf->tf_ops.fabric_drop_tpg(se_tpg); | ||
894 | } | 924 | } |
895 | 925 | ||
926 | static void target_fabric_release_wwn(struct config_item *item) | ||
927 | { | ||
928 | struct se_wwn *wwn = container_of(to_config_group(item), | ||
929 | struct se_wwn, wwn_group); | ||
930 | struct target_fabric_configfs *tf = wwn->wwn_tf; | ||
931 | |||
932 | tf->tf_ops.fabric_drop_wwn(wwn); | ||
933 | } | ||
934 | |||
935 | static struct configfs_item_operations target_fabric_tpg_item_ops = { | ||
936 | .release = target_fabric_release_wwn, | ||
937 | }; | ||
938 | |||
896 | static struct configfs_group_operations target_fabric_tpg_group_ops = { | 939 | static struct configfs_group_operations target_fabric_tpg_group_ops = { |
897 | .make_group = target_fabric_make_tpg, | 940 | .make_group = target_fabric_make_tpg, |
898 | .drop_item = target_fabric_drop_tpg, | 941 | .drop_item = target_fabric_drop_tpg, |
899 | }; | 942 | }; |
900 | 943 | ||
901 | TF_CIT_SETUP(tpg, NULL, &target_fabric_tpg_group_ops, NULL); | 944 | TF_CIT_SETUP(tpg, &target_fabric_tpg_item_ops, &target_fabric_tpg_group_ops, |
945 | NULL); | ||
902 | 946 | ||
903 | /* End of tfc_tpg_cit */ | 947 | /* End of tfc_tpg_cit */ |
904 | 948 | ||
@@ -932,13 +976,7 @@ static void target_fabric_drop_wwn( | |||
932 | struct config_group *group, | 976 | struct config_group *group, |
933 | struct config_item *item) | 977 | struct config_item *item) |
934 | { | 978 | { |
935 | struct target_fabric_configfs *tf = container_of(group, | ||
936 | struct target_fabric_configfs, tf_group); | ||
937 | struct se_wwn *wwn = container_of(to_config_group(item), | ||
938 | struct se_wwn, wwn_group); | ||
939 | |||
940 | config_item_put(item); | 979 | config_item_put(item); |
941 | tf->tf_ops.fabric_drop_wwn(wwn); | ||
942 | } | 980 | } |
943 | 981 | ||
944 | static struct configfs_group_operations target_fabric_wwn_group_ops = { | 982 | static struct configfs_group_operations target_fabric_wwn_group_ops = { |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index c6e0d757e76e..67f0c09983c8 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -154,7 +154,7 @@ static struct se_device *iblock_create_virtdevice( | |||
154 | 154 | ||
155 | bd = blkdev_get_by_path(ib_dev->ibd_udev_path, | 155 | bd = blkdev_get_by_path(ib_dev->ibd_udev_path, |
156 | FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev); | 156 | FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev); |
157 | if (!(bd)) | 157 | if (IS_ERR(bd)) |
158 | goto failed; | 158 | goto failed; |
159 | /* | 159 | /* |
160 | * Setup the local scope queue_limits from struct request_queue->limits | 160 | * Setup the local scope queue_limits from struct request_queue->limits |
@@ -220,8 +220,10 @@ static void iblock_free_device(void *p) | |||
220 | { | 220 | { |
221 | struct iblock_dev *ib_dev = p; | 221 | struct iblock_dev *ib_dev = p; |
222 | 222 | ||
223 | blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL); | 223 | if (ib_dev->ibd_bd != NULL) |
224 | bioset_free(ib_dev->ibd_bio_set); | 224 | blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL); |
225 | if (ib_dev->ibd_bio_set != NULL) | ||
226 | bioset_free(ib_dev->ibd_bio_set); | ||
225 | kfree(ib_dev); | 227 | kfree(ib_dev); |
226 | } | 228 | } |
227 | 229 | ||
diff --git a/drivers/target/target_core_mib.c b/drivers/target/target_core_mib.c deleted file mode 100644 index d5a48aa0d2d1..000000000000 --- a/drivers/target/target_core_mib.c +++ /dev/null | |||
@@ -1,1078 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | * Filename: target_core_mib.c | ||
3 | * | ||
4 | * Copyright (c) 2006-2007 SBE, Inc. All Rights Reserved. | ||
5 | * Copyright (c) 2007-2010 Rising Tide Systems | ||
6 | * Copyright (c) 2008-2010 Linux-iSCSI.org | ||
7 | * | ||
8 | * Nicholas A. Bellinger <nab@linux-iscsi.org> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
23 | * | ||
24 | ******************************************************************************/ | ||
25 | |||
26 | |||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/timer.h> | ||
31 | #include <linux/string.h> | ||
32 | #include <linux/version.h> | ||
33 | #include <generated/utsrelease.h> | ||
34 | #include <linux/utsname.h> | ||
35 | #include <linux/proc_fs.h> | ||
36 | #include <linux/seq_file.h> | ||
37 | #include <linux/blkdev.h> | ||
38 | #include <scsi/scsi.h> | ||
39 | #include <scsi/scsi_device.h> | ||
40 | #include <scsi/scsi_host.h> | ||
41 | |||
42 | #include <target/target_core_base.h> | ||
43 | #include <target/target_core_transport.h> | ||
44 | #include <target/target_core_fabric_ops.h> | ||
45 | #include <target/target_core_configfs.h> | ||
46 | |||
47 | #include "target_core_hba.h" | ||
48 | #include "target_core_mib.h" | ||
49 | |||
50 | /* SCSI mib table index */ | ||
51 | static struct scsi_index_table scsi_index_table; | ||
52 | |||
53 | #ifndef INITIAL_JIFFIES | ||
54 | #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ)) | ||
55 | #endif | ||
56 | |||
57 | /* SCSI Instance Table */ | ||
58 | #define SCSI_INST_SW_INDEX 1 | ||
59 | #define SCSI_TRANSPORT_INDEX 1 | ||
60 | |||
61 | #define NONE "None" | ||
62 | #define ISPRINT(a) ((a >= ' ') && (a <= '~')) | ||
63 | |||
64 | static inline int list_is_first(const struct list_head *list, | ||
65 | const struct list_head *head) | ||
66 | { | ||
67 | return list->prev == head; | ||
68 | } | ||
69 | |||
70 | static void *locate_hba_start( | ||
71 | struct seq_file *seq, | ||
72 | loff_t *pos) | ||
73 | { | ||
74 | spin_lock(&se_global->g_device_lock); | ||
75 | return seq_list_start(&se_global->g_se_dev_list, *pos); | ||
76 | } | ||
77 | |||
78 | static void *locate_hba_next( | ||
79 | struct seq_file *seq, | ||
80 | void *v, | ||
81 | loff_t *pos) | ||
82 | { | ||
83 | return seq_list_next(v, &se_global->g_se_dev_list, pos); | ||
84 | } | ||
85 | |||
86 | static void locate_hba_stop(struct seq_file *seq, void *v) | ||
87 | { | ||
88 | spin_unlock(&se_global->g_device_lock); | ||
89 | } | ||
90 | |||
91 | /**************************************************************************** | ||
92 | * SCSI MIB Tables | ||
93 | ****************************************************************************/ | ||
94 | |||
95 | /* | ||
96 | * SCSI Instance Table | ||
97 | */ | ||
98 | static void *scsi_inst_seq_start( | ||
99 | struct seq_file *seq, | ||
100 | loff_t *pos) | ||
101 | { | ||
102 | spin_lock(&se_global->hba_lock); | ||
103 | return seq_list_start(&se_global->g_hba_list, *pos); | ||
104 | } | ||
105 | |||
106 | static void *scsi_inst_seq_next( | ||
107 | struct seq_file *seq, | ||
108 | void *v, | ||
109 | loff_t *pos) | ||
110 | { | ||
111 | return seq_list_next(v, &se_global->g_hba_list, pos); | ||
112 | } | ||
113 | |||
114 | static void scsi_inst_seq_stop(struct seq_file *seq, void *v) | ||
115 | { | ||
116 | spin_unlock(&se_global->hba_lock); | ||
117 | } | ||
118 | |||
119 | static int scsi_inst_seq_show(struct seq_file *seq, void *v) | ||
120 | { | ||
121 | struct se_hba *hba = list_entry(v, struct se_hba, hba_list); | ||
122 | |||
123 | if (list_is_first(&hba->hba_list, &se_global->g_hba_list)) | ||
124 | seq_puts(seq, "inst sw_indx\n"); | ||
125 | |||
126 | seq_printf(seq, "%u %u\n", hba->hba_index, SCSI_INST_SW_INDEX); | ||
127 | seq_printf(seq, "plugin: %s version: %s\n", | ||
128 | hba->transport->name, TARGET_CORE_VERSION); | ||
129 | |||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static const struct seq_operations scsi_inst_seq_ops = { | ||
134 | .start = scsi_inst_seq_start, | ||
135 | .next = scsi_inst_seq_next, | ||
136 | .stop = scsi_inst_seq_stop, | ||
137 | .show = scsi_inst_seq_show | ||
138 | }; | ||
139 | |||
140 | static int scsi_inst_seq_open(struct inode *inode, struct file *file) | ||
141 | { | ||
142 | return seq_open(file, &scsi_inst_seq_ops); | ||
143 | } | ||
144 | |||
145 | static const struct file_operations scsi_inst_seq_fops = { | ||
146 | .owner = THIS_MODULE, | ||
147 | .open = scsi_inst_seq_open, | ||
148 | .read = seq_read, | ||
149 | .llseek = seq_lseek, | ||
150 | .release = seq_release, | ||
151 | }; | ||
152 | |||
153 | /* | ||
154 | * SCSI Device Table | ||
155 | */ | ||
156 | static void *scsi_dev_seq_start(struct seq_file *seq, loff_t *pos) | ||
157 | { | ||
158 | return locate_hba_start(seq, pos); | ||
159 | } | ||
160 | |||
161 | static void *scsi_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
162 | { | ||
163 | return locate_hba_next(seq, v, pos); | ||
164 | } | ||
165 | |||
166 | static void scsi_dev_seq_stop(struct seq_file *seq, void *v) | ||
167 | { | ||
168 | locate_hba_stop(seq, v); | ||
169 | } | ||
170 | |||
171 | static int scsi_dev_seq_show(struct seq_file *seq, void *v) | ||
172 | { | ||
173 | struct se_hba *hba; | ||
174 | struct se_subsystem_dev *se_dev = list_entry(v, struct se_subsystem_dev, | ||
175 | g_se_dev_list); | ||
176 | struct se_device *dev = se_dev->se_dev_ptr; | ||
177 | char str[28]; | ||
178 | int k; | ||
179 | |||
180 | if (list_is_first(&se_dev->g_se_dev_list, &se_global->g_se_dev_list)) | ||
181 | seq_puts(seq, "inst indx role ports\n"); | ||
182 | |||
183 | if (!(dev)) | ||
184 | return 0; | ||
185 | |||
186 | hba = dev->se_hba; | ||
187 | if (!(hba)) { | ||
188 | /* Log error ? */ | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | seq_printf(seq, "%u %u %s %u\n", hba->hba_index, | ||
193 | dev->dev_index, "Target", dev->dev_port_count); | ||
194 | |||
195 | memcpy(&str[0], (void *)DEV_T10_WWN(dev), 28); | ||
196 | |||
197 | /* vendor */ | ||
198 | for (k = 0; k < 8; k++) | ||
199 | str[k] = ISPRINT(DEV_T10_WWN(dev)->vendor[k]) ? | ||
200 | DEV_T10_WWN(dev)->vendor[k] : 0x20; | ||
201 | str[k] = 0x20; | ||
202 | |||
203 | /* model */ | ||
204 | for (k = 0; k < 16; k++) | ||
205 | str[k+9] = ISPRINT(DEV_T10_WWN(dev)->model[k]) ? | ||
206 | DEV_T10_WWN(dev)->model[k] : 0x20; | ||
207 | str[k + 9] = 0; | ||
208 | |||
209 | seq_printf(seq, "dev_alias: %s\n", str); | ||
210 | |||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static const struct seq_operations scsi_dev_seq_ops = { | ||
215 | .start = scsi_dev_seq_start, | ||
216 | .next = scsi_dev_seq_next, | ||
217 | .stop = scsi_dev_seq_stop, | ||
218 | .show = scsi_dev_seq_show | ||
219 | }; | ||
220 | |||
221 | static int scsi_dev_seq_open(struct inode *inode, struct file *file) | ||
222 | { | ||
223 | return seq_open(file, &scsi_dev_seq_ops); | ||
224 | } | ||
225 | |||
226 | static const struct file_operations scsi_dev_seq_fops = { | ||
227 | .owner = THIS_MODULE, | ||
228 | .open = scsi_dev_seq_open, | ||
229 | .read = seq_read, | ||
230 | .llseek = seq_lseek, | ||
231 | .release = seq_release, | ||
232 | }; | ||
233 | |||
234 | /* | ||
235 | * SCSI Port Table | ||
236 | */ | ||
237 | static void *scsi_port_seq_start(struct seq_file *seq, loff_t *pos) | ||
238 | { | ||
239 | return locate_hba_start(seq, pos); | ||
240 | } | ||
241 | |||
242 | static void *scsi_port_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
243 | { | ||
244 | return locate_hba_next(seq, v, pos); | ||
245 | } | ||
246 | |||
247 | static void scsi_port_seq_stop(struct seq_file *seq, void *v) | ||
248 | { | ||
249 | locate_hba_stop(seq, v); | ||
250 | } | ||
251 | |||
252 | static int scsi_port_seq_show(struct seq_file *seq, void *v) | ||
253 | { | ||
254 | struct se_hba *hba; | ||
255 | struct se_subsystem_dev *se_dev = list_entry(v, struct se_subsystem_dev, | ||
256 | g_se_dev_list); | ||
257 | struct se_device *dev = se_dev->se_dev_ptr; | ||
258 | struct se_port *sep, *sep_tmp; | ||
259 | |||
260 | if (list_is_first(&se_dev->g_se_dev_list, &se_global->g_se_dev_list)) | ||
261 | seq_puts(seq, "inst device indx role busy_count\n"); | ||
262 | |||
263 | if (!(dev)) | ||
264 | return 0; | ||
265 | |||
266 | hba = dev->se_hba; | ||
267 | if (!(hba)) { | ||
268 | /* Log error ? */ | ||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | /* FIXME: scsiPortBusyStatuses count */ | ||
273 | spin_lock(&dev->se_port_lock); | ||
274 | list_for_each_entry_safe(sep, sep_tmp, &dev->dev_sep_list, sep_list) { | ||
275 | seq_printf(seq, "%u %u %u %s%u %u\n", hba->hba_index, | ||
276 | dev->dev_index, sep->sep_index, "Device", | ||
277 | dev->dev_index, 0); | ||
278 | } | ||
279 | spin_unlock(&dev->se_port_lock); | ||
280 | |||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | static const struct seq_operations scsi_port_seq_ops = { | ||
285 | .start = scsi_port_seq_start, | ||
286 | .next = scsi_port_seq_next, | ||
287 | .stop = scsi_port_seq_stop, | ||
288 | .show = scsi_port_seq_show | ||
289 | }; | ||
290 | |||
291 | static int scsi_port_seq_open(struct inode *inode, struct file *file) | ||
292 | { | ||
293 | return seq_open(file, &scsi_port_seq_ops); | ||
294 | } | ||
295 | |||
296 | static const struct file_operations scsi_port_seq_fops = { | ||
297 | .owner = THIS_MODULE, | ||
298 | .open = scsi_port_seq_open, | ||
299 | .read = seq_read, | ||
300 | .llseek = seq_lseek, | ||
301 | .release = seq_release, | ||
302 | }; | ||
303 | |||
304 | /* | ||
305 | * SCSI Transport Table | ||
306 | */ | ||
307 | static void *scsi_transport_seq_start(struct seq_file *seq, loff_t *pos) | ||
308 | { | ||
309 | return locate_hba_start(seq, pos); | ||
310 | } | ||
311 | |||
312 | static void *scsi_transport_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
313 | { | ||
314 | return locate_hba_next(seq, v, pos); | ||
315 | } | ||
316 | |||
317 | static void scsi_transport_seq_stop(struct seq_file *seq, void *v) | ||
318 | { | ||
319 | locate_hba_stop(seq, v); | ||
320 | } | ||
321 | |||
322 | static int scsi_transport_seq_show(struct seq_file *seq, void *v) | ||
323 | { | ||
324 | struct se_hba *hba; | ||
325 | struct se_subsystem_dev *se_dev = list_entry(v, struct se_subsystem_dev, | ||
326 | g_se_dev_list); | ||
327 | struct se_device *dev = se_dev->se_dev_ptr; | ||
328 | struct se_port *se, *se_tmp; | ||
329 | struct se_portal_group *tpg; | ||
330 | struct t10_wwn *wwn; | ||
331 | char buf[64]; | ||
332 | |||
333 | if (list_is_first(&se_dev->g_se_dev_list, &se_global->g_se_dev_list)) | ||
334 | seq_puts(seq, "inst device indx dev_name\n"); | ||
335 | |||
336 | if (!(dev)) | ||
337 | return 0; | ||
338 | |||
339 | hba = dev->se_hba; | ||
340 | if (!(hba)) { | ||
341 | /* Log error ? */ | ||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | wwn = DEV_T10_WWN(dev); | ||
346 | |||
347 | spin_lock(&dev->se_port_lock); | ||
348 | list_for_each_entry_safe(se, se_tmp, &dev->dev_sep_list, sep_list) { | ||
349 | tpg = se->sep_tpg; | ||
350 | sprintf(buf, "scsiTransport%s", | ||
351 | TPG_TFO(tpg)->get_fabric_name()); | ||
352 | |||
353 | seq_printf(seq, "%u %s %u %s+%s\n", | ||
354 | hba->hba_index, /* scsiTransportIndex */ | ||
355 | buf, /* scsiTransportType */ | ||
356 | (TPG_TFO(tpg)->tpg_get_inst_index != NULL) ? | ||
357 | TPG_TFO(tpg)->tpg_get_inst_index(tpg) : | ||
358 | 0, | ||
359 | TPG_TFO(tpg)->tpg_get_wwn(tpg), | ||
360 | (strlen(wwn->unit_serial)) ? | ||
361 | /* scsiTransportDevName */ | ||
362 | wwn->unit_serial : wwn->vendor); | ||
363 | } | ||
364 | spin_unlock(&dev->se_port_lock); | ||
365 | |||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | static const struct seq_operations scsi_transport_seq_ops = { | ||
370 | .start = scsi_transport_seq_start, | ||
371 | .next = scsi_transport_seq_next, | ||
372 | .stop = scsi_transport_seq_stop, | ||
373 | .show = scsi_transport_seq_show | ||
374 | }; | ||
375 | |||
376 | static int scsi_transport_seq_open(struct inode *inode, struct file *file) | ||
377 | { | ||
378 | return seq_open(file, &scsi_transport_seq_ops); | ||
379 | } | ||
380 | |||
381 | static const struct file_operations scsi_transport_seq_fops = { | ||
382 | .owner = THIS_MODULE, | ||
383 | .open = scsi_transport_seq_open, | ||
384 | .read = seq_read, | ||
385 | .llseek = seq_lseek, | ||
386 | .release = seq_release, | ||
387 | }; | ||
388 | |||
389 | /* | ||
390 | * SCSI Target Device Table | ||
391 | */ | ||
392 | static void *scsi_tgt_dev_seq_start(struct seq_file *seq, loff_t *pos) | ||
393 | { | ||
394 | return locate_hba_start(seq, pos); | ||
395 | } | ||
396 | |||
397 | static void *scsi_tgt_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
398 | { | ||
399 | return locate_hba_next(seq, v, pos); | ||
400 | } | ||
401 | |||
402 | static void scsi_tgt_dev_seq_stop(struct seq_file *seq, void *v) | ||
403 | { | ||
404 | locate_hba_stop(seq, v); | ||
405 | } | ||
406 | |||
407 | |||
408 | #define LU_COUNT 1 /* for now */ | ||
409 | static int scsi_tgt_dev_seq_show(struct seq_file *seq, void *v) | ||
410 | { | ||
411 | struct se_hba *hba; | ||
412 | struct se_subsystem_dev *se_dev = list_entry(v, struct se_subsystem_dev, | ||
413 | g_se_dev_list); | ||
414 | struct se_device *dev = se_dev->se_dev_ptr; | ||
415 | int non_accessible_lus = 0; | ||
416 | char status[16]; | ||
417 | |||
418 | if (list_is_first(&se_dev->g_se_dev_list, &se_global->g_se_dev_list)) | ||
419 | seq_puts(seq, "inst indx num_LUs status non_access_LUs" | ||
420 | " resets\n"); | ||
421 | |||
422 | if (!(dev)) | ||
423 | return 0; | ||
424 | |||
425 | hba = dev->se_hba; | ||
426 | if (!(hba)) { | ||
427 | /* Log error ? */ | ||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | switch (dev->dev_status) { | ||
432 | case TRANSPORT_DEVICE_ACTIVATED: | ||
433 | strcpy(status, "activated"); | ||
434 | break; | ||
435 | case TRANSPORT_DEVICE_DEACTIVATED: | ||
436 | strcpy(status, "deactivated"); | ||
437 | non_accessible_lus = 1; | ||
438 | break; | ||
439 | case TRANSPORT_DEVICE_SHUTDOWN: | ||
440 | strcpy(status, "shutdown"); | ||
441 | non_accessible_lus = 1; | ||
442 | break; | ||
443 | case TRANSPORT_DEVICE_OFFLINE_ACTIVATED: | ||
444 | case TRANSPORT_DEVICE_OFFLINE_DEACTIVATED: | ||
445 | strcpy(status, "offline"); | ||
446 | non_accessible_lus = 1; | ||
447 | break; | ||
448 | default: | ||
449 | sprintf(status, "unknown(%d)", dev->dev_status); | ||
450 | non_accessible_lus = 1; | ||
451 | } | ||
452 | |||
453 | seq_printf(seq, "%u %u %u %s %u %u\n", | ||
454 | hba->hba_index, dev->dev_index, LU_COUNT, | ||
455 | status, non_accessible_lus, dev->num_resets); | ||
456 | |||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static const struct seq_operations scsi_tgt_dev_seq_ops = { | ||
461 | .start = scsi_tgt_dev_seq_start, | ||
462 | .next = scsi_tgt_dev_seq_next, | ||
463 | .stop = scsi_tgt_dev_seq_stop, | ||
464 | .show = scsi_tgt_dev_seq_show | ||
465 | }; | ||
466 | |||
467 | static int scsi_tgt_dev_seq_open(struct inode *inode, struct file *file) | ||
468 | { | ||
469 | return seq_open(file, &scsi_tgt_dev_seq_ops); | ||
470 | } | ||
471 | |||
472 | static const struct file_operations scsi_tgt_dev_seq_fops = { | ||
473 | .owner = THIS_MODULE, | ||
474 | .open = scsi_tgt_dev_seq_open, | ||
475 | .read = seq_read, | ||
476 | .llseek = seq_lseek, | ||
477 | .release = seq_release, | ||
478 | }; | ||
479 | |||
480 | /* | ||
481 | * SCSI Target Port Table | ||
482 | */ | ||
483 | static void *scsi_tgt_port_seq_start(struct seq_file *seq, loff_t *pos) | ||
484 | { | ||
485 | return locate_hba_start(seq, pos); | ||
486 | } | ||
487 | |||
488 | static void *scsi_tgt_port_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
489 | { | ||
490 | return locate_hba_next(seq, v, pos); | ||
491 | } | ||
492 | |||
493 | static void scsi_tgt_port_seq_stop(struct seq_file *seq, void *v) | ||
494 | { | ||
495 | locate_hba_stop(seq, v); | ||
496 | } | ||
497 | |||
498 | static int scsi_tgt_port_seq_show(struct seq_file *seq, void *v) | ||
499 | { | ||
500 | struct se_hba *hba; | ||
501 | struct se_subsystem_dev *se_dev = list_entry(v, struct se_subsystem_dev, | ||
502 | g_se_dev_list); | ||
503 | struct se_device *dev = se_dev->se_dev_ptr; | ||
504 | struct se_port *sep, *sep_tmp; | ||
505 | struct se_portal_group *tpg; | ||
506 | u32 rx_mbytes, tx_mbytes; | ||
507 | unsigned long long num_cmds; | ||
508 | char buf[64]; | ||
509 | |||
510 | if (list_is_first(&se_dev->g_se_dev_list, &se_global->g_se_dev_list)) | ||
511 | seq_puts(seq, "inst device indx name port_index in_cmds" | ||
512 | " write_mbytes read_mbytes hs_in_cmds\n"); | ||
513 | |||
514 | if (!(dev)) | ||
515 | return 0; | ||
516 | |||
517 | hba = dev->se_hba; | ||
518 | if (!(hba)) { | ||
519 | /* Log error ? */ | ||
520 | return 0; | ||
521 | } | ||
522 | |||
523 | spin_lock(&dev->se_port_lock); | ||
524 | list_for_each_entry_safe(sep, sep_tmp, &dev->dev_sep_list, sep_list) { | ||
525 | tpg = sep->sep_tpg; | ||
526 | sprintf(buf, "%sPort#", | ||
527 | TPG_TFO(tpg)->get_fabric_name()); | ||
528 | |||
529 | seq_printf(seq, "%u %u %u %s%d %s%s%d ", | ||
530 | hba->hba_index, | ||
531 | dev->dev_index, | ||
532 | sep->sep_index, | ||
533 | buf, sep->sep_index, | ||
534 | TPG_TFO(tpg)->tpg_get_wwn(tpg), "+t+", | ||
535 | TPG_TFO(tpg)->tpg_get_tag(tpg)); | ||
536 | |||
537 | spin_lock(&sep->sep_lun->lun_sep_lock); | ||
538 | num_cmds = sep->sep_stats.cmd_pdus; | ||
539 | rx_mbytes = (sep->sep_stats.rx_data_octets >> 20); | ||
540 | tx_mbytes = (sep->sep_stats.tx_data_octets >> 20); | ||
541 | spin_unlock(&sep->sep_lun->lun_sep_lock); | ||
542 | |||
543 | seq_printf(seq, "%llu %u %u %u\n", num_cmds, | ||
544 | rx_mbytes, tx_mbytes, 0); | ||
545 | } | ||
546 | spin_unlock(&dev->se_port_lock); | ||
547 | |||
548 | return 0; | ||
549 | } | ||
550 | |||
551 | static const struct seq_operations scsi_tgt_port_seq_ops = { | ||
552 | .start = scsi_tgt_port_seq_start, | ||
553 | .next = scsi_tgt_port_seq_next, | ||
554 | .stop = scsi_tgt_port_seq_stop, | ||
555 | .show = scsi_tgt_port_seq_show | ||
556 | }; | ||
557 | |||
558 | static int scsi_tgt_port_seq_open(struct inode *inode, struct file *file) | ||
559 | { | ||
560 | return seq_open(file, &scsi_tgt_port_seq_ops); | ||
561 | } | ||
562 | |||
563 | static const struct file_operations scsi_tgt_port_seq_fops = { | ||
564 | .owner = THIS_MODULE, | ||
565 | .open = scsi_tgt_port_seq_open, | ||
566 | .read = seq_read, | ||
567 | .llseek = seq_lseek, | ||
568 | .release = seq_release, | ||
569 | }; | ||
570 | |||
571 | /* | ||
572 | * SCSI Authorized Initiator Table: | ||
573 | * It contains the SCSI Initiators authorized to be attached to one of the | ||
574 | * local Target ports. | ||
575 | * Iterates through all active TPGs and extracts the info from the ACLs | ||
576 | */ | ||
577 | static void *scsi_auth_intr_seq_start(struct seq_file *seq, loff_t *pos) | ||
578 | { | ||
579 | spin_lock_bh(&se_global->se_tpg_lock); | ||
580 | return seq_list_start(&se_global->g_se_tpg_list, *pos); | ||
581 | } | ||
582 | |||
583 | static void *scsi_auth_intr_seq_next(struct seq_file *seq, void *v, | ||
584 | loff_t *pos) | ||
585 | { | ||
586 | return seq_list_next(v, &se_global->g_se_tpg_list, pos); | ||
587 | } | ||
588 | |||
589 | static void scsi_auth_intr_seq_stop(struct seq_file *seq, void *v) | ||
590 | { | ||
591 | spin_unlock_bh(&se_global->se_tpg_lock); | ||
592 | } | ||
593 | |||
594 | static int scsi_auth_intr_seq_show(struct seq_file *seq, void *v) | ||
595 | { | ||
596 | struct se_portal_group *se_tpg = list_entry(v, struct se_portal_group, | ||
597 | se_tpg_list); | ||
598 | struct se_dev_entry *deve; | ||
599 | struct se_lun *lun; | ||
600 | struct se_node_acl *se_nacl; | ||
601 | int j; | ||
602 | |||
603 | if (list_is_first(&se_tpg->se_tpg_list, | ||
604 | &se_global->g_se_tpg_list)) | ||
605 | seq_puts(seq, "inst dev port indx dev_or_port intr_name " | ||
606 | "map_indx att_count num_cmds read_mbytes " | ||
607 | "write_mbytes hs_num_cmds creation_time row_status\n"); | ||
608 | |||
609 | if (!(se_tpg)) | ||
610 | return 0; | ||
611 | |||
612 | spin_lock(&se_tpg->acl_node_lock); | ||
613 | list_for_each_entry(se_nacl, &se_tpg->acl_node_list, acl_list) { | ||
614 | |||
615 | atomic_inc(&se_nacl->mib_ref_count); | ||
616 | smp_mb__after_atomic_inc(); | ||
617 | spin_unlock(&se_tpg->acl_node_lock); | ||
618 | |||
619 | spin_lock_irq(&se_nacl->device_list_lock); | ||
620 | for (j = 0; j < TRANSPORT_MAX_LUNS_PER_TPG; j++) { | ||
621 | deve = &se_nacl->device_list[j]; | ||
622 | if (!(deve->lun_flags & | ||
623 | TRANSPORT_LUNFLAGS_INITIATOR_ACCESS) || | ||
624 | (!deve->se_lun)) | ||
625 | continue; | ||
626 | lun = deve->se_lun; | ||
627 | if (!lun->lun_se_dev) | ||
628 | continue; | ||
629 | |||
630 | seq_printf(seq, "%u %u %u %u %u %s %u %u %u %u %u %u" | ||
631 | " %u %s\n", | ||
632 | /* scsiInstIndex */ | ||
633 | (TPG_TFO(se_tpg)->tpg_get_inst_index != NULL) ? | ||
634 | TPG_TFO(se_tpg)->tpg_get_inst_index(se_tpg) : | ||
635 | 0, | ||
636 | /* scsiDeviceIndex */ | ||
637 | lun->lun_se_dev->dev_index, | ||
638 | /* scsiAuthIntrTgtPortIndex */ | ||
639 | TPG_TFO(se_tpg)->tpg_get_tag(se_tpg), | ||
640 | /* scsiAuthIntrIndex */ | ||
641 | se_nacl->acl_index, | ||
642 | /* scsiAuthIntrDevOrPort */ | ||
643 | 1, | ||
644 | /* scsiAuthIntrName */ | ||
645 | se_nacl->initiatorname[0] ? | ||
646 | se_nacl->initiatorname : NONE, | ||
647 | /* FIXME: scsiAuthIntrLunMapIndex */ | ||
648 | 0, | ||
649 | /* scsiAuthIntrAttachedTimes */ | ||
650 | deve->attach_count, | ||
651 | /* scsiAuthIntrOutCommands */ | ||
652 | deve->total_cmds, | ||
653 | /* scsiAuthIntrReadMegaBytes */ | ||
654 | (u32)(deve->read_bytes >> 20), | ||
655 | /* scsiAuthIntrWrittenMegaBytes */ | ||
656 | (u32)(deve->write_bytes >> 20), | ||
657 | /* FIXME: scsiAuthIntrHSOutCommands */ | ||
658 | 0, | ||
659 | /* scsiAuthIntrLastCreation */ | ||
660 | (u32)(((u32)deve->creation_time - | ||
661 | INITIAL_JIFFIES) * 100 / HZ), | ||
662 | /* FIXME: scsiAuthIntrRowStatus */ | ||
663 | "Ready"); | ||
664 | } | ||
665 | spin_unlock_irq(&se_nacl->device_list_lock); | ||
666 | |||
667 | spin_lock(&se_tpg->acl_node_lock); | ||
668 | atomic_dec(&se_nacl->mib_ref_count); | ||
669 | smp_mb__after_atomic_dec(); | ||
670 | } | ||
671 | spin_unlock(&se_tpg->acl_node_lock); | ||
672 | |||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | static const struct seq_operations scsi_auth_intr_seq_ops = { | ||
677 | .start = scsi_auth_intr_seq_start, | ||
678 | .next = scsi_auth_intr_seq_next, | ||
679 | .stop = scsi_auth_intr_seq_stop, | ||
680 | .show = scsi_auth_intr_seq_show | ||
681 | }; | ||
682 | |||
683 | static int scsi_auth_intr_seq_open(struct inode *inode, struct file *file) | ||
684 | { | ||
685 | return seq_open(file, &scsi_auth_intr_seq_ops); | ||
686 | } | ||
687 | |||
688 | static const struct file_operations scsi_auth_intr_seq_fops = { | ||
689 | .owner = THIS_MODULE, | ||
690 | .open = scsi_auth_intr_seq_open, | ||
691 | .read = seq_read, | ||
692 | .llseek = seq_lseek, | ||
693 | .release = seq_release, | ||
694 | }; | ||
695 | |||
696 | /* | ||
697 | * SCSI Attached Initiator Port Table: | ||
698 | * It lists the SCSI Initiators attached to one of the local Target ports. | ||
699 | * Iterates through all active TPGs and use active sessions from each TPG | ||
700 | * to list the info fo this table. | ||
701 | */ | ||
702 | static void *scsi_att_intr_port_seq_start(struct seq_file *seq, loff_t *pos) | ||
703 | { | ||
704 | spin_lock_bh(&se_global->se_tpg_lock); | ||
705 | return seq_list_start(&se_global->g_se_tpg_list, *pos); | ||
706 | } | ||
707 | |||
708 | static void *scsi_att_intr_port_seq_next(struct seq_file *seq, void *v, | ||
709 | loff_t *pos) | ||
710 | { | ||
711 | return seq_list_next(v, &se_global->g_se_tpg_list, pos); | ||
712 | } | ||
713 | |||
714 | static void scsi_att_intr_port_seq_stop(struct seq_file *seq, void *v) | ||
715 | { | ||
716 | spin_unlock_bh(&se_global->se_tpg_lock); | ||
717 | } | ||
718 | |||
719 | static int scsi_att_intr_port_seq_show(struct seq_file *seq, void *v) | ||
720 | { | ||
721 | struct se_portal_group *se_tpg = list_entry(v, struct se_portal_group, | ||
722 | se_tpg_list); | ||
723 | struct se_dev_entry *deve; | ||
724 | struct se_lun *lun; | ||
725 | struct se_node_acl *se_nacl; | ||
726 | struct se_session *se_sess; | ||
727 | unsigned char buf[64]; | ||
728 | int j; | ||
729 | |||
730 | if (list_is_first(&se_tpg->se_tpg_list, | ||
731 | &se_global->g_se_tpg_list)) | ||
732 | seq_puts(seq, "inst dev port indx port_auth_indx port_name" | ||
733 | " port_ident\n"); | ||
734 | |||
735 | if (!(se_tpg)) | ||
736 | return 0; | ||
737 | |||
738 | spin_lock(&se_tpg->session_lock); | ||
739 | list_for_each_entry(se_sess, &se_tpg->tpg_sess_list, sess_list) { | ||
740 | if ((TPG_TFO(se_tpg)->sess_logged_in(se_sess)) || | ||
741 | (!se_sess->se_node_acl) || | ||
742 | (!se_sess->se_node_acl->device_list)) | ||
743 | continue; | ||
744 | |||
745 | atomic_inc(&se_sess->mib_ref_count); | ||
746 | smp_mb__after_atomic_inc(); | ||
747 | se_nacl = se_sess->se_node_acl; | ||
748 | atomic_inc(&se_nacl->mib_ref_count); | ||
749 | smp_mb__after_atomic_inc(); | ||
750 | spin_unlock(&se_tpg->session_lock); | ||
751 | |||
752 | spin_lock_irq(&se_nacl->device_list_lock); | ||
753 | for (j = 0; j < TRANSPORT_MAX_LUNS_PER_TPG; j++) { | ||
754 | deve = &se_nacl->device_list[j]; | ||
755 | if (!(deve->lun_flags & | ||
756 | TRANSPORT_LUNFLAGS_INITIATOR_ACCESS) || | ||
757 | (!deve->se_lun)) | ||
758 | continue; | ||
759 | |||
760 | lun = deve->se_lun; | ||
761 | if (!lun->lun_se_dev) | ||
762 | continue; | ||
763 | |||
764 | memset(buf, 0, 64); | ||
765 | if (TPG_TFO(se_tpg)->sess_get_initiator_sid != NULL) | ||
766 | TPG_TFO(se_tpg)->sess_get_initiator_sid( | ||
767 | se_sess, (unsigned char *)&buf[0], 64); | ||
768 | |||
769 | seq_printf(seq, "%u %u %u %u %u %s+i+%s\n", | ||
770 | /* scsiInstIndex */ | ||
771 | (TPG_TFO(se_tpg)->tpg_get_inst_index != NULL) ? | ||
772 | TPG_TFO(se_tpg)->tpg_get_inst_index(se_tpg) : | ||
773 | 0, | ||
774 | /* scsiDeviceIndex */ | ||
775 | lun->lun_se_dev->dev_index, | ||
776 | /* scsiPortIndex */ | ||
777 | TPG_TFO(se_tpg)->tpg_get_tag(se_tpg), | ||
778 | /* scsiAttIntrPortIndex */ | ||
779 | (TPG_TFO(se_tpg)->sess_get_index != NULL) ? | ||
780 | TPG_TFO(se_tpg)->sess_get_index(se_sess) : | ||
781 | 0, | ||
782 | /* scsiAttIntrPortAuthIntrIdx */ | ||
783 | se_nacl->acl_index, | ||
784 | /* scsiAttIntrPortName */ | ||
785 | se_nacl->initiatorname[0] ? | ||
786 | se_nacl->initiatorname : NONE, | ||
787 | /* scsiAttIntrPortIdentifier */ | ||
788 | buf); | ||
789 | } | ||
790 | spin_unlock_irq(&se_nacl->device_list_lock); | ||
791 | |||
792 | spin_lock(&se_tpg->session_lock); | ||
793 | atomic_dec(&se_nacl->mib_ref_count); | ||
794 | smp_mb__after_atomic_dec(); | ||
795 | atomic_dec(&se_sess->mib_ref_count); | ||
796 | smp_mb__after_atomic_dec(); | ||
797 | } | ||
798 | spin_unlock(&se_tpg->session_lock); | ||
799 | |||
800 | return 0; | ||
801 | } | ||
802 | |||
803 | static const struct seq_operations scsi_att_intr_port_seq_ops = { | ||
804 | .start = scsi_att_intr_port_seq_start, | ||
805 | .next = scsi_att_intr_port_seq_next, | ||
806 | .stop = scsi_att_intr_port_seq_stop, | ||
807 | .show = scsi_att_intr_port_seq_show | ||
808 | }; | ||
809 | |||
810 | static int scsi_att_intr_port_seq_open(struct inode *inode, struct file *file) | ||
811 | { | ||
812 | return seq_open(file, &scsi_att_intr_port_seq_ops); | ||
813 | } | ||
814 | |||
815 | static const struct file_operations scsi_att_intr_port_seq_fops = { | ||
816 | .owner = THIS_MODULE, | ||
817 | .open = scsi_att_intr_port_seq_open, | ||
818 | .read = seq_read, | ||
819 | .llseek = seq_lseek, | ||
820 | .release = seq_release, | ||
821 | }; | ||
822 | |||
823 | /* | ||
824 | * SCSI Logical Unit Table | ||
825 | */ | ||
826 | static void *scsi_lu_seq_start(struct seq_file *seq, loff_t *pos) | ||
827 | { | ||
828 | return locate_hba_start(seq, pos); | ||
829 | } | ||
830 | |||
831 | static void *scsi_lu_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
832 | { | ||
833 | return locate_hba_next(seq, v, pos); | ||
834 | } | ||
835 | |||
836 | static void scsi_lu_seq_stop(struct seq_file *seq, void *v) | ||
837 | { | ||
838 | locate_hba_stop(seq, v); | ||
839 | } | ||
840 | |||
841 | #define SCSI_LU_INDEX 1 | ||
842 | static int scsi_lu_seq_show(struct seq_file *seq, void *v) | ||
843 | { | ||
844 | struct se_hba *hba; | ||
845 | struct se_subsystem_dev *se_dev = list_entry(v, struct se_subsystem_dev, | ||
846 | g_se_dev_list); | ||
847 | struct se_device *dev = se_dev->se_dev_ptr; | ||
848 | int j; | ||
849 | char str[28]; | ||
850 | |||
851 | if (list_is_first(&se_dev->g_se_dev_list, &se_global->g_se_dev_list)) | ||
852 | seq_puts(seq, "inst dev indx LUN lu_name vend prod rev" | ||
853 | " dev_type status state-bit num_cmds read_mbytes" | ||
854 | " write_mbytes resets full_stat hs_num_cmds creation_time\n"); | ||
855 | |||
856 | if (!(dev)) | ||
857 | return 0; | ||
858 | |||
859 | hba = dev->se_hba; | ||
860 | if (!(hba)) { | ||
861 | /* Log error ? */ | ||
862 | return 0; | ||
863 | } | ||
864 | |||
865 | /* Fix LU state, if we can read it from the device */ | ||
866 | seq_printf(seq, "%u %u %u %llu %s", hba->hba_index, | ||
867 | dev->dev_index, SCSI_LU_INDEX, | ||
868 | (unsigned long long)0, /* FIXME: scsiLuDefaultLun */ | ||
869 | (strlen(DEV_T10_WWN(dev)->unit_serial)) ? | ||
870 | /* scsiLuWwnName */ | ||
871 | (char *)&DEV_T10_WWN(dev)->unit_serial[0] : | ||
872 | "None"); | ||
873 | |||
874 | memcpy(&str[0], (void *)DEV_T10_WWN(dev), 28); | ||
875 | /* scsiLuVendorId */ | ||
876 | for (j = 0; j < 8; j++) | ||
877 | str[j] = ISPRINT(DEV_T10_WWN(dev)->vendor[j]) ? | ||
878 | DEV_T10_WWN(dev)->vendor[j] : 0x20; | ||
879 | str[8] = 0; | ||
880 | seq_printf(seq, " %s", str); | ||
881 | |||
882 | /* scsiLuProductId */ | ||
883 | for (j = 0; j < 16; j++) | ||
884 | str[j] = ISPRINT(DEV_T10_WWN(dev)->model[j]) ? | ||
885 | DEV_T10_WWN(dev)->model[j] : 0x20; | ||
886 | str[16] = 0; | ||
887 | seq_printf(seq, " %s", str); | ||
888 | |||
889 | /* scsiLuRevisionId */ | ||
890 | for (j = 0; j < 4; j++) | ||
891 | str[j] = ISPRINT(DEV_T10_WWN(dev)->revision[j]) ? | ||
892 | DEV_T10_WWN(dev)->revision[j] : 0x20; | ||
893 | str[4] = 0; | ||
894 | seq_printf(seq, " %s", str); | ||
895 | |||
896 | seq_printf(seq, " %u %s %s %llu %u %u %u %u %u %u\n", | ||
897 | /* scsiLuPeripheralType */ | ||
898 | TRANSPORT(dev)->get_device_type(dev), | ||
899 | (dev->dev_status == TRANSPORT_DEVICE_ACTIVATED) ? | ||
900 | "available" : "notavailable", /* scsiLuStatus */ | ||
901 | "exposed", /* scsiLuState */ | ||
902 | (unsigned long long)dev->num_cmds, | ||
903 | /* scsiLuReadMegaBytes */ | ||
904 | (u32)(dev->read_bytes >> 20), | ||
905 | /* scsiLuWrittenMegaBytes */ | ||
906 | (u32)(dev->write_bytes >> 20), | ||
907 | dev->num_resets, /* scsiLuInResets */ | ||
908 | 0, /* scsiLuOutTaskSetFullStatus */ | ||
909 | 0, /* scsiLuHSInCommands */ | ||
910 | (u32)(((u32)dev->creation_time - INITIAL_JIFFIES) * | ||
911 | 100 / HZ)); | ||
912 | |||
913 | return 0; | ||
914 | } | ||
915 | |||
916 | static const struct seq_operations scsi_lu_seq_ops = { | ||
917 | .start = scsi_lu_seq_start, | ||
918 | .next = scsi_lu_seq_next, | ||
919 | .stop = scsi_lu_seq_stop, | ||
920 | .show = scsi_lu_seq_show | ||
921 | }; | ||
922 | |||
923 | static int scsi_lu_seq_open(struct inode *inode, struct file *file) | ||
924 | { | ||
925 | return seq_open(file, &scsi_lu_seq_ops); | ||
926 | } | ||
927 | |||
928 | static const struct file_operations scsi_lu_seq_fops = { | ||
929 | .owner = THIS_MODULE, | ||
930 | .open = scsi_lu_seq_open, | ||
931 | .read = seq_read, | ||
932 | .llseek = seq_lseek, | ||
933 | .release = seq_release, | ||
934 | }; | ||
935 | |||
936 | /****************************************************************************/ | ||
937 | |||
938 | /* | ||
939 | * Remove proc fs entries | ||
940 | */ | ||
941 | void remove_scsi_target_mib(void) | ||
942 | { | ||
943 | remove_proc_entry("scsi_target/mib/scsi_inst", NULL); | ||
944 | remove_proc_entry("scsi_target/mib/scsi_dev", NULL); | ||
945 | remove_proc_entry("scsi_target/mib/scsi_port", NULL); | ||
946 | remove_proc_entry("scsi_target/mib/scsi_transport", NULL); | ||
947 | remove_proc_entry("scsi_target/mib/scsi_tgt_dev", NULL); | ||
948 | remove_proc_entry("scsi_target/mib/scsi_tgt_port", NULL); | ||
949 | remove_proc_entry("scsi_target/mib/scsi_auth_intr", NULL); | ||
950 | remove_proc_entry("scsi_target/mib/scsi_att_intr_port", NULL); | ||
951 | remove_proc_entry("scsi_target/mib/scsi_lu", NULL); | ||
952 | remove_proc_entry("scsi_target/mib", NULL); | ||
953 | } | ||
954 | |||
955 | /* | ||
956 | * Create proc fs entries for the mib tables | ||
957 | */ | ||
958 | int init_scsi_target_mib(void) | ||
959 | { | ||
960 | struct proc_dir_entry *dir_entry; | ||
961 | struct proc_dir_entry *scsi_inst_entry; | ||
962 | struct proc_dir_entry *scsi_dev_entry; | ||
963 | struct proc_dir_entry *scsi_port_entry; | ||
964 | struct proc_dir_entry *scsi_transport_entry; | ||
965 | struct proc_dir_entry *scsi_tgt_dev_entry; | ||
966 | struct proc_dir_entry *scsi_tgt_port_entry; | ||
967 | struct proc_dir_entry *scsi_auth_intr_entry; | ||
968 | struct proc_dir_entry *scsi_att_intr_port_entry; | ||
969 | struct proc_dir_entry *scsi_lu_entry; | ||
970 | |||
971 | dir_entry = proc_mkdir("scsi_target/mib", NULL); | ||
972 | if (!(dir_entry)) { | ||
973 | printk(KERN_ERR "proc_mkdir() failed.\n"); | ||
974 | return -1; | ||
975 | } | ||
976 | |||
977 | scsi_inst_entry = | ||
978 | create_proc_entry("scsi_target/mib/scsi_inst", 0, NULL); | ||
979 | if (scsi_inst_entry) | ||
980 | scsi_inst_entry->proc_fops = &scsi_inst_seq_fops; | ||
981 | else | ||
982 | goto error; | ||
983 | |||
984 | scsi_dev_entry = | ||
985 | create_proc_entry("scsi_target/mib/scsi_dev", 0, NULL); | ||
986 | if (scsi_dev_entry) | ||
987 | scsi_dev_entry->proc_fops = &scsi_dev_seq_fops; | ||
988 | else | ||
989 | goto error; | ||
990 | |||
991 | scsi_port_entry = | ||
992 | create_proc_entry("scsi_target/mib/scsi_port", 0, NULL); | ||
993 | if (scsi_port_entry) | ||
994 | scsi_port_entry->proc_fops = &scsi_port_seq_fops; | ||
995 | else | ||
996 | goto error; | ||
997 | |||
998 | scsi_transport_entry = | ||
999 | create_proc_entry("scsi_target/mib/scsi_transport", 0, NULL); | ||
1000 | if (scsi_transport_entry) | ||
1001 | scsi_transport_entry->proc_fops = &scsi_transport_seq_fops; | ||
1002 | else | ||
1003 | goto error; | ||
1004 | |||
1005 | scsi_tgt_dev_entry = | ||
1006 | create_proc_entry("scsi_target/mib/scsi_tgt_dev", 0, NULL); | ||
1007 | if (scsi_tgt_dev_entry) | ||
1008 | scsi_tgt_dev_entry->proc_fops = &scsi_tgt_dev_seq_fops; | ||
1009 | else | ||
1010 | goto error; | ||
1011 | |||
1012 | scsi_tgt_port_entry = | ||
1013 | create_proc_entry("scsi_target/mib/scsi_tgt_port", 0, NULL); | ||
1014 | if (scsi_tgt_port_entry) | ||
1015 | scsi_tgt_port_entry->proc_fops = &scsi_tgt_port_seq_fops; | ||
1016 | else | ||
1017 | goto error; | ||
1018 | |||
1019 | scsi_auth_intr_entry = | ||
1020 | create_proc_entry("scsi_target/mib/scsi_auth_intr", 0, NULL); | ||
1021 | if (scsi_auth_intr_entry) | ||
1022 | scsi_auth_intr_entry->proc_fops = &scsi_auth_intr_seq_fops; | ||
1023 | else | ||
1024 | goto error; | ||
1025 | |||
1026 | scsi_att_intr_port_entry = | ||
1027 | create_proc_entry("scsi_target/mib/scsi_att_intr_port", 0, NULL); | ||
1028 | if (scsi_att_intr_port_entry) | ||
1029 | scsi_att_intr_port_entry->proc_fops = | ||
1030 | &scsi_att_intr_port_seq_fops; | ||
1031 | else | ||
1032 | goto error; | ||
1033 | |||
1034 | scsi_lu_entry = create_proc_entry("scsi_target/mib/scsi_lu", 0, NULL); | ||
1035 | if (scsi_lu_entry) | ||
1036 | scsi_lu_entry->proc_fops = &scsi_lu_seq_fops; | ||
1037 | else | ||
1038 | goto error; | ||
1039 | |||
1040 | return 0; | ||
1041 | |||
1042 | error: | ||
1043 | printk(KERN_ERR "create_proc_entry() failed.\n"); | ||
1044 | remove_scsi_target_mib(); | ||
1045 | return -1; | ||
1046 | } | ||
1047 | |||
1048 | /* | ||
1049 | * Initialize the index table for allocating unique row indexes to various mib | ||
1050 | * tables | ||
1051 | */ | ||
1052 | void init_scsi_index_table(void) | ||
1053 | { | ||
1054 | memset(&scsi_index_table, 0, sizeof(struct scsi_index_table)); | ||
1055 | spin_lock_init(&scsi_index_table.lock); | ||
1056 | } | ||
1057 | |||
1058 | /* | ||
1059 | * Allocate a new row index for the entry type specified | ||
1060 | */ | ||
1061 | u32 scsi_get_new_index(scsi_index_t type) | ||
1062 | { | ||
1063 | u32 new_index; | ||
1064 | |||
1065 | if ((type < 0) || (type >= SCSI_INDEX_TYPE_MAX)) { | ||
1066 | printk(KERN_ERR "Invalid index type %d\n", type); | ||
1067 | return -1; | ||
1068 | } | ||
1069 | |||
1070 | spin_lock(&scsi_index_table.lock); | ||
1071 | new_index = ++scsi_index_table.scsi_mib_index[type]; | ||
1072 | if (new_index == 0) | ||
1073 | new_index = ++scsi_index_table.scsi_mib_index[type]; | ||
1074 | spin_unlock(&scsi_index_table.lock); | ||
1075 | |||
1076 | return new_index; | ||
1077 | } | ||
1078 | EXPORT_SYMBOL(scsi_get_new_index); | ||
diff --git a/drivers/target/target_core_mib.h b/drivers/target/target_core_mib.h deleted file mode 100644 index 277204633850..000000000000 --- a/drivers/target/target_core_mib.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | #ifndef TARGET_CORE_MIB_H | ||
2 | #define TARGET_CORE_MIB_H | ||
3 | |||
4 | typedef enum { | ||
5 | SCSI_INST_INDEX, | ||
6 | SCSI_DEVICE_INDEX, | ||
7 | SCSI_AUTH_INTR_INDEX, | ||
8 | SCSI_INDEX_TYPE_MAX | ||
9 | } scsi_index_t; | ||
10 | |||
11 | struct scsi_index_table { | ||
12 | spinlock_t lock; | ||
13 | u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX]; | ||
14 | } ____cacheline_aligned; | ||
15 | |||
16 | /* SCSI Port stats */ | ||
17 | struct scsi_port_stats { | ||
18 | u64 cmd_pdus; | ||
19 | u64 tx_data_octets; | ||
20 | u64 rx_data_octets; | ||
21 | } ____cacheline_aligned; | ||
22 | |||
23 | extern int init_scsi_target_mib(void); | ||
24 | extern void remove_scsi_target_mib(void); | ||
25 | extern void init_scsi_index_table(void); | ||
26 | extern u32 scsi_get_new_index(scsi_index_t); | ||
27 | |||
28 | #endif /*** TARGET_CORE_MIB_H ***/ | ||
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 742d24609a9b..f2a08477a68c 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -462,8 +462,8 @@ static struct se_device *pscsi_create_type_disk( | |||
462 | */ | 462 | */ |
463 | bd = blkdev_get_by_path(se_dev->se_dev_udev_path, | 463 | bd = blkdev_get_by_path(se_dev->se_dev_udev_path, |
464 | FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv); | 464 | FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv); |
465 | if (!(bd)) { | 465 | if (IS_ERR(bd)) { |
466 | printk("pSCSI: blkdev_get_by_path() failed\n"); | 466 | printk(KERN_ERR "pSCSI: blkdev_get_by_path() failed\n"); |
467 | scsi_device_put(sd); | 467 | scsi_device_put(sd); |
468 | return NULL; | 468 | return NULL; |
469 | } | 469 | } |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index abfa81a57115..c26f67467623 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -275,7 +275,6 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( | |||
275 | spin_lock_init(&acl->device_list_lock); | 275 | spin_lock_init(&acl->device_list_lock); |
276 | spin_lock_init(&acl->nacl_sess_lock); | 276 | spin_lock_init(&acl->nacl_sess_lock); |
277 | atomic_set(&acl->acl_pr_ref_count, 0); | 277 | atomic_set(&acl->acl_pr_ref_count, 0); |
278 | atomic_set(&acl->mib_ref_count, 0); | ||
279 | acl->queue_depth = TPG_TFO(tpg)->tpg_get_default_depth(tpg); | 278 | acl->queue_depth = TPG_TFO(tpg)->tpg_get_default_depth(tpg); |
280 | snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname); | 279 | snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname); |
281 | acl->se_tpg = tpg; | 280 | acl->se_tpg = tpg; |
@@ -318,12 +317,6 @@ void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *nacl) | |||
318 | cpu_relax(); | 317 | cpu_relax(); |
319 | } | 318 | } |
320 | 319 | ||
321 | void core_tpg_wait_for_mib_ref(struct se_node_acl *nacl) | ||
322 | { | ||
323 | while (atomic_read(&nacl->mib_ref_count) != 0) | ||
324 | cpu_relax(); | ||
325 | } | ||
326 | |||
327 | void core_tpg_clear_object_luns(struct se_portal_group *tpg) | 320 | void core_tpg_clear_object_luns(struct se_portal_group *tpg) |
328 | { | 321 | { |
329 | int i, ret; | 322 | int i, ret; |
@@ -480,7 +473,6 @@ int core_tpg_del_initiator_node_acl( | |||
480 | spin_unlock_bh(&tpg->session_lock); | 473 | spin_unlock_bh(&tpg->session_lock); |
481 | 474 | ||
482 | core_tpg_wait_for_nacl_pr_ref(acl); | 475 | core_tpg_wait_for_nacl_pr_ref(acl); |
483 | core_tpg_wait_for_mib_ref(acl); | ||
484 | core_clear_initiator_node_from_tpg(acl, tpg); | 476 | core_clear_initiator_node_from_tpg(acl, tpg); |
485 | core_free_device_list_for_node(acl, tpg); | 477 | core_free_device_list_for_node(acl, tpg); |
486 | 478 | ||
@@ -701,6 +693,8 @@ EXPORT_SYMBOL(core_tpg_register); | |||
701 | 693 | ||
702 | int core_tpg_deregister(struct se_portal_group *se_tpg) | 694 | int core_tpg_deregister(struct se_portal_group *se_tpg) |
703 | { | 695 | { |
696 | struct se_node_acl *nacl, *nacl_tmp; | ||
697 | |||
704 | printk(KERN_INFO "TARGET_CORE[%s]: Deallocating %s struct se_portal_group" | 698 | printk(KERN_INFO "TARGET_CORE[%s]: Deallocating %s struct se_portal_group" |
705 | " for endpoint: %s Portal Tag %u\n", | 699 | " for endpoint: %s Portal Tag %u\n", |
706 | (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) ? | 700 | (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) ? |
@@ -714,6 +708,25 @@ int core_tpg_deregister(struct se_portal_group *se_tpg) | |||
714 | 708 | ||
715 | while (atomic_read(&se_tpg->tpg_pr_ref_count) != 0) | 709 | while (atomic_read(&se_tpg->tpg_pr_ref_count) != 0) |
716 | cpu_relax(); | 710 | cpu_relax(); |
711 | /* | ||
712 | * Release any remaining demo-mode generated se_node_acl that have | ||
713 | * not been released because of TFO->tpg_check_demo_mode_cache() == 1 | ||
714 | * in transport_deregister_session(). | ||
715 | */ | ||
716 | spin_lock_bh(&se_tpg->acl_node_lock); | ||
717 | list_for_each_entry_safe(nacl, nacl_tmp, &se_tpg->acl_node_list, | ||
718 | acl_list) { | ||
719 | list_del(&nacl->acl_list); | ||
720 | se_tpg->num_node_acls--; | ||
721 | spin_unlock_bh(&se_tpg->acl_node_lock); | ||
722 | |||
723 | core_tpg_wait_for_nacl_pr_ref(nacl); | ||
724 | core_free_device_list_for_node(nacl, se_tpg); | ||
725 | TPG_TFO(se_tpg)->tpg_release_fabric_acl(se_tpg, nacl); | ||
726 | |||
727 | spin_lock_bh(&se_tpg->acl_node_lock); | ||
728 | } | ||
729 | spin_unlock_bh(&se_tpg->acl_node_lock); | ||
717 | 730 | ||
718 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) | 731 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) |
719 | core_tpg_release_virtual_lun0(se_tpg); | 732 | core_tpg_release_virtual_lun0(se_tpg); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 28b6292ff298..236e22d8cfae 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -379,6 +379,40 @@ void release_se_global(void) | |||
379 | se_global = NULL; | 379 | se_global = NULL; |
380 | } | 380 | } |
381 | 381 | ||
382 | /* SCSI statistics table index */ | ||
383 | static struct scsi_index_table scsi_index_table; | ||
384 | |||
385 | /* | ||
386 | * Initialize the index table for allocating unique row indexes to various mib | ||
387 | * tables. | ||
388 | */ | ||
389 | void init_scsi_index_table(void) | ||
390 | { | ||
391 | memset(&scsi_index_table, 0, sizeof(struct scsi_index_table)); | ||
392 | spin_lock_init(&scsi_index_table.lock); | ||
393 | } | ||
394 | |||
395 | /* | ||
396 | * Allocate a new row index for the entry type specified | ||
397 | */ | ||
398 | u32 scsi_get_new_index(scsi_index_t type) | ||
399 | { | ||
400 | u32 new_index; | ||
401 | |||
402 | if ((type < 0) || (type >= SCSI_INDEX_TYPE_MAX)) { | ||
403 | printk(KERN_ERR "Invalid index type %d\n", type); | ||
404 | return -EINVAL; | ||
405 | } | ||
406 | |||
407 | spin_lock(&scsi_index_table.lock); | ||
408 | new_index = ++scsi_index_table.scsi_mib_index[type]; | ||
409 | if (new_index == 0) | ||
410 | new_index = ++scsi_index_table.scsi_mib_index[type]; | ||
411 | spin_unlock(&scsi_index_table.lock); | ||
412 | |||
413 | return new_index; | ||
414 | } | ||
415 | |||
382 | void transport_init_queue_obj(struct se_queue_obj *qobj) | 416 | void transport_init_queue_obj(struct se_queue_obj *qobj) |
383 | { | 417 | { |
384 | atomic_set(&qobj->queue_cnt, 0); | 418 | atomic_set(&qobj->queue_cnt, 0); |
@@ -437,7 +471,6 @@ struct se_session *transport_init_session(void) | |||
437 | } | 471 | } |
438 | INIT_LIST_HEAD(&se_sess->sess_list); | 472 | INIT_LIST_HEAD(&se_sess->sess_list); |
439 | INIT_LIST_HEAD(&se_sess->sess_acl_list); | 473 | INIT_LIST_HEAD(&se_sess->sess_acl_list); |
440 | atomic_set(&se_sess->mib_ref_count, 0); | ||
441 | 474 | ||
442 | return se_sess; | 475 | return se_sess; |
443 | } | 476 | } |
@@ -546,12 +579,6 @@ void transport_deregister_session(struct se_session *se_sess) | |||
546 | transport_free_session(se_sess); | 579 | transport_free_session(se_sess); |
547 | return; | 580 | return; |
548 | } | 581 | } |
549 | /* | ||
550 | * Wait for possible reference in drivers/target/target_core_mib.c: | ||
551 | * scsi_att_intr_port_seq_show() | ||
552 | */ | ||
553 | while (atomic_read(&se_sess->mib_ref_count) != 0) | ||
554 | cpu_relax(); | ||
555 | 582 | ||
556 | spin_lock_bh(&se_tpg->session_lock); | 583 | spin_lock_bh(&se_tpg->session_lock); |
557 | list_del(&se_sess->sess_list); | 584 | list_del(&se_sess->sess_list); |
@@ -574,7 +601,6 @@ void transport_deregister_session(struct se_session *se_sess) | |||
574 | spin_unlock_bh(&se_tpg->acl_node_lock); | 601 | spin_unlock_bh(&se_tpg->acl_node_lock); |
575 | 602 | ||
576 | core_tpg_wait_for_nacl_pr_ref(se_nacl); | 603 | core_tpg_wait_for_nacl_pr_ref(se_nacl); |
577 | core_tpg_wait_for_mib_ref(se_nacl); | ||
578 | core_free_device_list_for_node(se_nacl, se_tpg); | 604 | core_free_device_list_for_node(se_nacl, se_tpg); |
579 | TPG_TFO(se_tpg)->tpg_release_fabric_acl(se_tpg, | 605 | TPG_TFO(se_tpg)->tpg_release_fabric_acl(se_tpg, |
580 | se_nacl); | 606 | se_nacl); |
@@ -4827,6 +4853,8 @@ static int transport_do_se_mem_map( | |||
4827 | 4853 | ||
4828 | return ret; | 4854 | return ret; |
4829 | } | 4855 | } |
4856 | |||
4857 | BUG_ON(list_empty(se_mem_list)); | ||
4830 | /* | 4858 | /* |
4831 | * This is the normal path for all normal non BIDI and BIDI-COMMAND | 4859 | * This is the normal path for all normal non BIDI and BIDI-COMMAND |
4832 | * WRITE payloads.. If we need to do BIDI READ passthrough for | 4860 | * WRITE payloads.. If we need to do BIDI READ passthrough for |
@@ -5008,7 +5036,9 @@ transport_map_control_cmd_to_task(struct se_cmd *cmd) | |||
5008 | struct se_mem *se_mem = NULL, *se_mem_lout = NULL; | 5036 | struct se_mem *se_mem = NULL, *se_mem_lout = NULL; |
5009 | u32 se_mem_cnt = 0, task_offset = 0; | 5037 | u32 se_mem_cnt = 0, task_offset = 0; |
5010 | 5038 | ||
5011 | BUG_ON(list_empty(cmd->t_task->t_mem_list)); | 5039 | if (!list_empty(T_TASK(cmd)->t_mem_list)) |
5040 | se_mem = list_entry(T_TASK(cmd)->t_mem_list->next, | ||
5041 | struct se_mem, se_list); | ||
5012 | 5042 | ||
5013 | ret = transport_do_se_mem_map(dev, task, | 5043 | ret = transport_do_se_mem_map(dev, task, |
5014 | cmd->t_task->t_mem_list, NULL, se_mem, | 5044 | cmd->t_task->t_mem_list, NULL, se_mem, |
diff --git a/drivers/tty/hvc/Makefile b/drivers/tty/hvc/Makefile index e6bed5f177ff..d79e7e9bf9d2 100644 --- a/drivers/tty/hvc/Makefile +++ b/drivers/tty/hvc/Makefile | |||
@@ -10,4 +10,3 @@ obj-$(CONFIG_HVC_XEN) += hvc_xen.o | |||
10 | obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o | 10 | obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o |
11 | obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o | 11 | obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o |
12 | obj-$(CONFIG_HVCS) += hvcs.o | 12 | obj-$(CONFIG_HVCS) += hvcs.o |
13 | obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o | ||
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 44b8412a04e8..aa2e5d3eb01a 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -2414,6 +2414,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm, | |||
2414 | 2414 | ||
2415 | gsm->initiator = c->initiator; | 2415 | gsm->initiator = c->initiator; |
2416 | gsm->mru = c->mru; | 2416 | gsm->mru = c->mru; |
2417 | gsm->mtu = c->mtu; | ||
2417 | gsm->encoding = c->encapsulation; | 2418 | gsm->encoding = c->encapsulation; |
2418 | gsm->adaption = c->adaption; | 2419 | gsm->adaption = c->adaption; |
2419 | gsm->n2 = c->n2; | 2420 | gsm->n2 = c->n2; |
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/68328serial.c b/drivers/tty/serial/68328serial.c index be0ebce36e54..de0160e3f8c4 100644 --- a/drivers/tty/serial/68328serial.c +++ b/drivers/tty/serial/68328serial.c | |||
@@ -262,7 +262,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status) | |||
262 | 262 | ||
263 | static void receive_chars(struct m68k_serial *info, unsigned short rx) | 263 | static void receive_chars(struct m68k_serial *info, unsigned short rx) |
264 | { | 264 | { |
265 | struct tty_struct *tty = info->port.tty; | 265 | struct tty_struct *tty = info->tty; |
266 | m68328_uart *uart = &uart_addr[info->line]; | 266 | m68328_uart *uart = &uart_addr[info->line]; |
267 | unsigned char ch, flag; | 267 | unsigned char ch, flag; |
268 | 268 | ||
@@ -329,7 +329,7 @@ static void transmit_chars(struct m68k_serial *info) | |||
329 | goto clear_and_return; | 329 | goto clear_and_return; |
330 | } | 330 | } |
331 | 331 | ||
332 | if((info->xmit_cnt <= 0) || info->port.tty->stopped) { | 332 | if((info->xmit_cnt <= 0) || info->tty->stopped) { |
333 | /* That's peculiar... TX ints off */ | 333 | /* That's peculiar... TX ints off */ |
334 | uart->ustcnt &= ~USTCNT_TX_INTR_MASK; | 334 | uart->ustcnt &= ~USTCNT_TX_INTR_MASK; |
335 | goto clear_and_return; | 335 | goto clear_and_return; |
@@ -383,7 +383,7 @@ static void do_softint(struct work_struct *work) | |||
383 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); | 383 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); |
384 | struct tty_struct *tty; | 384 | struct tty_struct *tty; |
385 | 385 | ||
386 | tty = info->port.tty; | 386 | tty = info->tty; |
387 | if (!tty) | 387 | if (!tty) |
388 | return; | 388 | return; |
389 | #if 0 | 389 | #if 0 |
@@ -407,7 +407,7 @@ static void do_serial_hangup(struct work_struct *work) | |||
407 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); | 407 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); |
408 | struct tty_struct *tty; | 408 | struct tty_struct *tty; |
409 | 409 | ||
410 | tty = info->port.tty; | 410 | tty = info->tty; |
411 | if (!tty) | 411 | if (!tty) |
412 | return; | 412 | return; |
413 | 413 | ||
@@ -451,8 +451,8 @@ static int startup(struct m68k_serial * info) | |||
451 | uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; | 451 | uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; |
452 | #endif | 452 | #endif |
453 | 453 | ||
454 | if (info->port.tty) | 454 | if (info->tty) |
455 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); | 455 | clear_bit(TTY_IO_ERROR, &info->tty->flags); |
456 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 456 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
457 | 457 | ||
458 | /* | 458 | /* |
@@ -486,8 +486,8 @@ static void shutdown(struct m68k_serial * info) | |||
486 | info->xmit_buf = 0; | 486 | info->xmit_buf = 0; |
487 | } | 487 | } |
488 | 488 | ||
489 | if (info->port.tty) | 489 | if (info->tty) |
490 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); | 490 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
491 | 491 | ||
492 | info->flags &= ~S_INITIALIZED; | 492 | info->flags &= ~S_INITIALIZED; |
493 | local_irq_restore(flags); | 493 | local_irq_restore(flags); |
@@ -553,9 +553,9 @@ static void change_speed(struct m68k_serial *info) | |||
553 | unsigned cflag; | 553 | unsigned cflag; |
554 | int i; | 554 | int i; |
555 | 555 | ||
556 | if (!info->port.tty || !info->port.tty->termios) | 556 | if (!info->tty || !info->tty->termios) |
557 | return; | 557 | return; |
558 | cflag = info->port.tty->termios->c_cflag; | 558 | cflag = info->tty->termios->c_cflag; |
559 | if (!(port = info->port)) | 559 | if (!(port = info->port)) |
560 | return; | 560 | return; |
561 | 561 | ||
@@ -970,7 +970,6 @@ static void send_break(struct m68k_serial * info, unsigned int duration) | |||
970 | static int rs_ioctl(struct tty_struct *tty, struct file * file, | 970 | static int rs_ioctl(struct tty_struct *tty, struct file * file, |
971 | unsigned int cmd, unsigned long arg) | 971 | unsigned int cmd, unsigned long arg) |
972 | { | 972 | { |
973 | int error; | ||
974 | struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; | 973 | struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; |
975 | int retval; | 974 | int retval; |
976 | 975 | ||
@@ -1104,7 +1103,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1104 | tty_ldisc_flush(tty); | 1103 | tty_ldisc_flush(tty); |
1105 | tty->closing = 0; | 1104 | tty->closing = 0; |
1106 | info->event = 0; | 1105 | info->event = 0; |
1107 | info->port.tty = NULL; | 1106 | info->tty = NULL; |
1108 | #warning "This is not and has never been valid so fix it" | 1107 | #warning "This is not and has never been valid so fix it" |
1109 | #if 0 | 1108 | #if 0 |
1110 | if (tty->ldisc.num != ldiscs[N_TTY].num) { | 1109 | if (tty->ldisc.num != ldiscs[N_TTY].num) { |
@@ -1142,7 +1141,7 @@ void rs_hangup(struct tty_struct *tty) | |||
1142 | info->event = 0; | 1141 | info->event = 0; |
1143 | info->count = 0; | 1142 | info->count = 0; |
1144 | info->flags &= ~S_NORMAL_ACTIVE; | 1143 | info->flags &= ~S_NORMAL_ACTIVE; |
1145 | info->port.tty = NULL; | 1144 | info->tty = NULL; |
1146 | wake_up_interruptible(&info->open_wait); | 1145 | wake_up_interruptible(&info->open_wait); |
1147 | } | 1146 | } |
1148 | 1147 | ||
@@ -1261,7 +1260,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) | |||
1261 | 1260 | ||
1262 | info->count++; | 1261 | info->count++; |
1263 | tty->driver_data = info; | 1262 | tty->driver_data = info; |
1264 | info->port.tty = tty; | 1263 | info->tty = tty; |
1265 | 1264 | ||
1266 | /* | 1265 | /* |
1267 | * Start up serial port | 1266 | * Start up serial port |
@@ -1338,7 +1337,7 @@ rs68328_init(void) | |||
1338 | info = &m68k_soft[i]; | 1337 | info = &m68k_soft[i]; |
1339 | info->magic = SERIAL_MAGIC; | 1338 | info->magic = SERIAL_MAGIC; |
1340 | info->port = (int) &uart_addr[i]; | 1339 | info->port = (int) &uart_addr[i]; |
1341 | info->port.tty = NULL; | 1340 | info->tty = NULL; |
1342 | info->irq = uart_irqs[i]; | 1341 | info->irq = uart_irqs[i]; |
1343 | info->custom_divisor = 16; | 1342 | info->custom_divisor = 16; |
1344 | info->close_delay = 50; | 1343 | info->close_delay = 50; |
diff --git a/drivers/tty/serial/68360serial.c b/drivers/tty/serial/68360serial.c index 88b13356ec10..bc21eeae8fde 100644 --- a/drivers/tty/serial/68360serial.c +++ b/drivers/tty/serial/68360serial.c | |||
@@ -2428,6 +2428,7 @@ static const struct tty_operations rs_360_ops = { | |||
2428 | /* .read_proc = rs_360_read_proc, */ | 2428 | /* .read_proc = rs_360_read_proc, */ |
2429 | .tiocmget = rs_360_tiocmget, | 2429 | .tiocmget = rs_360_tiocmget, |
2430 | .tiocmset = rs_360_tiocmset, | 2430 | .tiocmset = rs_360_tiocmset, |
2431 | .get_icount = rs_360_get_icount, | ||
2431 | }; | 2432 | }; |
2432 | 2433 | ||
2433 | static int __init rs_360_init(void) | 2434 | static int __init rs_360_init(void) |
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/serial/bfin_5xx.c b/drivers/tty/serial/bfin_5xx.c index e381b895b04d..9b1ff2b6bb37 100644 --- a/drivers/tty/serial/bfin_5xx.c +++ b/drivers/tty/serial/bfin_5xx.c | |||
@@ -370,10 +370,8 @@ static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id) | |||
370 | { | 370 | { |
371 | struct bfin_serial_port *uart = dev_id; | 371 | struct bfin_serial_port *uart = dev_id; |
372 | 372 | ||
373 | spin_lock(&uart->port.lock); | ||
374 | while (UART_GET_LSR(uart) & DR) | 373 | while (UART_GET_LSR(uart) & DR) |
375 | bfin_serial_rx_chars(uart); | 374 | bfin_serial_rx_chars(uart); |
376 | spin_unlock(&uart->port.lock); | ||
377 | 375 | ||
378 | return IRQ_HANDLED; | 376 | return IRQ_HANDLED; |
379 | } | 377 | } |
@@ -490,9 +488,8 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | |||
490 | { | 488 | { |
491 | int x_pos, pos; | 489 | int x_pos, pos; |
492 | 490 | ||
493 | dma_disable_irq(uart->tx_dma_channel); | 491 | dma_disable_irq_nosync(uart->rx_dma_channel); |
494 | dma_disable_irq(uart->rx_dma_channel); | 492 | spin_lock_bh(&uart->rx_lock); |
495 | spin_lock_bh(&uart->port.lock); | ||
496 | 493 | ||
497 | /* 2D DMA RX buffer ring is used. Because curr_y_count and | 494 | /* 2D DMA RX buffer ring is used. Because curr_y_count and |
498 | * curr_x_count can't be read as an atomic operation, | 495 | * curr_x_count can't be read as an atomic operation, |
@@ -523,8 +520,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | |||
523 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; | 520 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; |
524 | } | 521 | } |
525 | 522 | ||
526 | spin_unlock_bh(&uart->port.lock); | 523 | spin_unlock_bh(&uart->rx_lock); |
527 | dma_enable_irq(uart->tx_dma_channel); | ||
528 | dma_enable_irq(uart->rx_dma_channel); | 524 | dma_enable_irq(uart->rx_dma_channel); |
529 | 525 | ||
530 | mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES); | 526 | mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES); |
@@ -571,7 +567,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) | |||
571 | unsigned short irqstat; | 567 | unsigned short irqstat; |
572 | int x_pos, pos; | 568 | int x_pos, pos; |
573 | 569 | ||
574 | spin_lock(&uart->port.lock); | 570 | spin_lock(&uart->rx_lock); |
575 | irqstat = get_dma_curr_irqstat(uart->rx_dma_channel); | 571 | irqstat = get_dma_curr_irqstat(uart->rx_dma_channel); |
576 | clear_dma_irqstat(uart->rx_dma_channel); | 572 | clear_dma_irqstat(uart->rx_dma_channel); |
577 | 573 | ||
@@ -589,7 +585,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) | |||
589 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; | 585 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; |
590 | } | 586 | } |
591 | 587 | ||
592 | spin_unlock(&uart->port.lock); | 588 | spin_unlock(&uart->rx_lock); |
593 | 589 | ||
594 | return IRQ_HANDLED; | 590 | return IRQ_HANDLED; |
595 | } | 591 | } |
@@ -1332,6 +1328,7 @@ static int bfin_serial_probe(struct platform_device *pdev) | |||
1332 | } | 1328 | } |
1333 | 1329 | ||
1334 | #ifdef CONFIG_SERIAL_BFIN_DMA | 1330 | #ifdef CONFIG_SERIAL_BFIN_DMA |
1331 | spin_lock_init(&uart->rx_lock); | ||
1335 | uart->tx_done = 1; | 1332 | uart->tx_done = 1; |
1336 | uart->tx_count = 0; | 1333 | uart->tx_count = 0; |
1337 | 1334 | ||
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c index beb1afa27d8d..7b951adac54b 100644 --- a/drivers/tty/serial/max3100.c +++ b/drivers/tty/serial/max3100.c | |||
@@ -601,7 +601,7 @@ static int max3100_startup(struct uart_port *port) | |||
601 | s->rts = 0; | 601 | s->rts = 0; |
602 | 602 | ||
603 | sprintf(b, "max3100-%d", s->minor); | 603 | sprintf(b, "max3100-%d", s->minor); |
604 | s->workqueue = create_freezeable_workqueue(b); | 604 | s->workqueue = create_freezable_workqueue(b); |
605 | if (!s->workqueue) { | 605 | if (!s->workqueue) { |
606 | dev_warn(&s->spi->dev, "cannot create workqueue\n"); | 606 | dev_warn(&s->spi->dev, "cannot create workqueue\n"); |
607 | return -EBUSY; | 607 | return -EBUSY; |
diff --git a/drivers/tty/serial/max3107.c b/drivers/tty/serial/max3107.c index 910870edf708..750b4f627315 100644 --- a/drivers/tty/serial/max3107.c +++ b/drivers/tty/serial/max3107.c | |||
@@ -833,7 +833,7 @@ static int max3107_startup(struct uart_port *port) | |||
833 | struct max3107_port *s = container_of(port, struct max3107_port, port); | 833 | struct max3107_port *s = container_of(port, struct max3107_port, port); |
834 | 834 | ||
835 | /* Initialize work queue */ | 835 | /* Initialize work queue */ |
836 | s->workqueue = create_freezeable_workqueue("max3107"); | 836 | s->workqueue = create_freezable_workqueue("max3107"); |
837 | if (!s->workqueue) { | 837 | if (!s->workqueue) { |
838 | dev_err(&s->spi->dev, "Workqueue creation failed\n"); | 838 | dev_err(&s->spi->dev, "Workqueue creation failed\n"); |
839 | return -EBUSY; | 839 | return -EBUSY; |
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c index a2f2b3254499..602d9845c52f 100644 --- a/drivers/tty/serial/sb1250-duart.c +++ b/drivers/tty/serial/sb1250-duart.c | |||
@@ -829,7 +829,7 @@ static void __init sbd_probe_duarts(void) | |||
829 | #ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE | 829 | #ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE |
830 | /* | 830 | /* |
831 | * Serial console stuff. Very basic, polling driver for doing serial | 831 | * Serial console stuff. Very basic, polling driver for doing serial |
832 | * console output. The console_sem is held by the caller, so we | 832 | * console output. The console_lock is held by the caller, so we |
833 | * shouldn't be interrupted for more console activity. | 833 | * shouldn't be interrupted for more console activity. |
834 | */ | 834 | */ |
835 | static void sbd_console_putchar(struct uart_port *uport, int ch) | 835 | static void sbd_console_putchar(struct uart_port *uport, int ch) |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index c556ed9db13d..81f13958e751 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <asm/irq_regs.h> | 46 | #include <asm/irq_regs.h> |
47 | 47 | ||
48 | /* Whether we react on sysrq keys or just ignore them */ | 48 | /* Whether we react on sysrq keys or just ignore them */ |
49 | static int __read_mostly sysrq_enabled = 1; | 49 | static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE; |
50 | static bool __read_mostly sysrq_always_enabled; | 50 | static bool __read_mostly sysrq_always_enabled; |
51 | 51 | ||
52 | static bool sysrq_on(void) | 52 | static bool sysrq_on(void) |
@@ -571,6 +571,7 @@ struct sysrq_state { | |||
571 | unsigned int alt_use; | 571 | unsigned int alt_use; |
572 | bool active; | 572 | bool active; |
573 | bool need_reinject; | 573 | bool need_reinject; |
574 | bool reinjecting; | ||
574 | }; | 575 | }; |
575 | 576 | ||
576 | static void sysrq_reinject_alt_sysrq(struct work_struct *work) | 577 | static void sysrq_reinject_alt_sysrq(struct work_struct *work) |
@@ -581,6 +582,10 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work) | |||
581 | unsigned int alt_code = sysrq->alt_use; | 582 | unsigned int alt_code = sysrq->alt_use; |
582 | 583 | ||
583 | if (sysrq->need_reinject) { | 584 | if (sysrq->need_reinject) { |
585 | /* we do not want the assignment to be reordered */ | ||
586 | sysrq->reinjecting = true; | ||
587 | mb(); | ||
588 | |||
584 | /* Simulate press and release of Alt + SysRq */ | 589 | /* Simulate press and release of Alt + SysRq */ |
585 | input_inject_event(handle, EV_KEY, alt_code, 1); | 590 | input_inject_event(handle, EV_KEY, alt_code, 1); |
586 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1); | 591 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1); |
@@ -589,6 +594,9 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work) | |||
589 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0); | 594 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0); |
590 | input_inject_event(handle, EV_KEY, alt_code, 0); | 595 | input_inject_event(handle, EV_KEY, alt_code, 0); |
591 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); | 596 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); |
597 | |||
598 | mb(); | ||
599 | sysrq->reinjecting = false; | ||
592 | } | 600 | } |
593 | } | 601 | } |
594 | 602 | ||
@@ -599,6 +607,13 @@ static bool sysrq_filter(struct input_handle *handle, | |||
599 | bool was_active = sysrq->active; | 607 | bool was_active = sysrq->active; |
600 | bool suppress; | 608 | bool suppress; |
601 | 609 | ||
610 | /* | ||
611 | * Do not filter anything if we are in the process of re-injecting | ||
612 | * Alt+SysRq combination. | ||
613 | */ | ||
614 | if (sysrq->reinjecting) | ||
615 | return false; | ||
616 | |||
602 | switch (type) { | 617 | switch (type) { |
603 | 618 | ||
604 | case EV_SYN: | 619 | case EV_SYN: |
@@ -629,7 +644,7 @@ static bool sysrq_filter(struct input_handle *handle, | |||
629 | sysrq->alt_use = sysrq->alt; | 644 | sysrq->alt_use = sysrq->alt; |
630 | /* | 645 | /* |
631 | * If nothing else will be pressed we'll need | 646 | * If nothing else will be pressed we'll need |
632 | * to * re-inject Alt-SysRq keysroke. | 647 | * to re-inject Alt-SysRq keysroke. |
633 | */ | 648 | */ |
634 | sysrq->need_reinject = true; | 649 | sysrq->need_reinject = true; |
635 | } | 650 | } |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 464d09d97873..0065da4b11c1 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -3256,8 +3256,8 @@ static ssize_t show_cons_active(struct device *dev, | |||
3256 | struct console *c; | 3256 | struct console *c; |
3257 | ssize_t count = 0; | 3257 | ssize_t count = 0; |
3258 | 3258 | ||
3259 | acquire_console_sem(); | 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) |
@@ -3271,7 +3271,7 @@ static ssize_t show_cons_active(struct device *dev, | |||
3271 | while (i--) | 3271 | while (i--) |
3272 | count += sprintf(buf + count, "%s%d%c", | 3272 | count += sprintf(buf + count, "%s%d%c", |
3273 | cs[i]->name, cs[i]->index, i ? ' ':'\n'); | 3273 | cs[i]->name, cs[i]->index, i ? ' ':'\n'); |
3274 | release_console_sem(); | 3274 | console_unlock(); |
3275 | 3275 | ||
3276 | return count; | 3276 | return count; |
3277 | } | 3277 | } |
@@ -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/selection.c b/drivers/tty/vt/selection.c index ebae344ce910..c956ed6c83a3 100644 --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c | |||
@@ -316,9 +316,9 @@ int paste_selection(struct tty_struct *tty) | |||
316 | /* always called with BTM from vt_ioctl */ | 316 | /* always called with BTM from vt_ioctl */ |
317 | WARN_ON(!tty_locked()); | 317 | WARN_ON(!tty_locked()); |
318 | 318 | ||
319 | acquire_console_sem(); | 319 | console_lock(); |
320 | poke_blanked_console(); | 320 | poke_blanked_console(); |
321 | release_console_sem(); | 321 | console_unlock(); |
322 | 322 | ||
323 | ld = tty_ldisc_ref(tty); | 323 | ld = tty_ldisc_ref(tty); |
324 | if (!ld) { | 324 | if (!ld) { |
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index eab3a1ff99e4..a672ed192d33 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c | |||
@@ -202,7 +202,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
202 | /* Select the proper current console and verify | 202 | /* Select the proper current console and verify |
203 | * sanity of the situation under the console lock. | 203 | * sanity of the situation under the console lock. |
204 | */ | 204 | */ |
205 | acquire_console_sem(); | 205 | console_lock(); |
206 | 206 | ||
207 | attr = (currcons & 128); | 207 | attr = (currcons & 128); |
208 | currcons = (currcons & 127); | 208 | currcons = (currcons & 127); |
@@ -336,9 +336,9 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
336 | * the pagefault handling code may want to call printk(). | 336 | * the pagefault handling code may want to call printk(). |
337 | */ | 337 | */ |
338 | 338 | ||
339 | release_console_sem(); | 339 | console_unlock(); |
340 | ret = copy_to_user(buf, con_buf_start, orig_count); | 340 | ret = copy_to_user(buf, con_buf_start, orig_count); |
341 | acquire_console_sem(); | 341 | console_lock(); |
342 | 342 | ||
343 | if (ret) { | 343 | if (ret) { |
344 | read += (orig_count - ret); | 344 | read += (orig_count - ret); |
@@ -354,7 +354,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
354 | if (read) | 354 | if (read) |
355 | ret = read; | 355 | ret = read; |
356 | unlock_out: | 356 | unlock_out: |
357 | release_console_sem(); | 357 | console_unlock(); |
358 | mutex_unlock(&con_buf_mtx); | 358 | mutex_unlock(&con_buf_mtx); |
359 | return ret; | 359 | return ret; |
360 | } | 360 | } |
@@ -379,7 +379,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
379 | /* Select the proper current console and verify | 379 | /* Select the proper current console and verify |
380 | * sanity of the situation under the console lock. | 380 | * sanity of the situation under the console lock. |
381 | */ | 381 | */ |
382 | acquire_console_sem(); | 382 | console_lock(); |
383 | 383 | ||
384 | attr = (currcons & 128); | 384 | attr = (currcons & 128); |
385 | currcons = (currcons & 127); | 385 | currcons = (currcons & 127); |
@@ -414,9 +414,9 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
414 | /* Temporarily drop the console lock so that we can read | 414 | /* Temporarily drop the console lock so that we can read |
415 | * in the write data from userspace safely. | 415 | * in the write data from userspace safely. |
416 | */ | 416 | */ |
417 | release_console_sem(); | 417 | console_unlock(); |
418 | ret = copy_from_user(con_buf, buf, this_round); | 418 | ret = copy_from_user(con_buf, buf, this_round); |
419 | acquire_console_sem(); | 419 | console_lock(); |
420 | 420 | ||
421 | if (ret) { | 421 | if (ret) { |
422 | this_round -= ret; | 422 | this_round -= ret; |
@@ -542,7 +542,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
542 | vcs_scr_updated(vc); | 542 | vcs_scr_updated(vc); |
543 | 543 | ||
544 | unlock_out: | 544 | unlock_out: |
545 | release_console_sem(); | 545 | console_unlock(); |
546 | 546 | ||
547 | mutex_unlock(&con_buf_mtx); | 547 | mutex_unlock(&con_buf_mtx); |
548 | 548 | ||
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 76407eca9ab0..147ede3423df 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -1003,9 +1003,9 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws) | |||
1003 | struct vc_data *vc = tty->driver_data; | 1003 | struct vc_data *vc = tty->driver_data; |
1004 | int ret; | 1004 | int ret; |
1005 | 1005 | ||
1006 | acquire_console_sem(); | 1006 | console_lock(); |
1007 | ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); | 1007 | ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); |
1008 | release_console_sem(); | 1008 | console_unlock(); |
1009 | return ret; | 1009 | return ret; |
1010 | } | 1010 | } |
1011 | 1011 | ||
@@ -1271,7 +1271,7 @@ static void default_attr(struct vc_data *vc) | |||
1271 | vc->vc_color = vc->vc_def_color; | 1271 | vc->vc_color = vc->vc_def_color; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | /* console_sem is held */ | 1274 | /* console_lock is held */ |
1275 | static void csi_m(struct vc_data *vc) | 1275 | static void csi_m(struct vc_data *vc) |
1276 | { | 1276 | { |
1277 | int i; | 1277 | int i; |
@@ -1415,7 +1415,7 @@ int mouse_reporting(void) | |||
1415 | return vc_cons[fg_console].d->vc_report_mouse; | 1415 | return vc_cons[fg_console].d->vc_report_mouse; |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | /* console_sem is held */ | 1418 | /* console_lock is held */ |
1419 | static void set_mode(struct vc_data *vc, int on_off) | 1419 | static void set_mode(struct vc_data *vc, int on_off) |
1420 | { | 1420 | { |
1421 | int i; | 1421 | int i; |
@@ -1485,7 +1485,7 @@ static void set_mode(struct vc_data *vc, int on_off) | |||
1485 | } | 1485 | } |
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | /* console_sem is held */ | 1488 | /* console_lock is held */ |
1489 | static void setterm_command(struct vc_data *vc) | 1489 | static void setterm_command(struct vc_data *vc) |
1490 | { | 1490 | { |
1491 | switch(vc->vc_par[0]) { | 1491 | switch(vc->vc_par[0]) { |
@@ -1545,7 +1545,7 @@ static void setterm_command(struct vc_data *vc) | |||
1545 | } | 1545 | } |
1546 | } | 1546 | } |
1547 | 1547 | ||
1548 | /* console_sem is held */ | 1548 | /* console_lock is held */ |
1549 | static void csi_at(struct vc_data *vc, unsigned int nr) | 1549 | static void csi_at(struct vc_data *vc, unsigned int nr) |
1550 | { | 1550 | { |
1551 | if (nr > vc->vc_cols - vc->vc_x) | 1551 | if (nr > vc->vc_cols - vc->vc_x) |
@@ -1555,7 +1555,7 @@ static void csi_at(struct vc_data *vc, unsigned int nr) | |||
1555 | insert_char(vc, nr); | 1555 | insert_char(vc, nr); |
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | /* console_sem is held */ | 1558 | /* console_lock is held */ |
1559 | static void csi_L(struct vc_data *vc, unsigned int nr) | 1559 | static void csi_L(struct vc_data *vc, unsigned int nr) |
1560 | { | 1560 | { |
1561 | if (nr > vc->vc_rows - vc->vc_y) | 1561 | if (nr > vc->vc_rows - vc->vc_y) |
@@ -1566,7 +1566,7 @@ static void csi_L(struct vc_data *vc, unsigned int nr) | |||
1566 | vc->vc_need_wrap = 0; | 1566 | vc->vc_need_wrap = 0; |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | /* console_sem is held */ | 1569 | /* console_lock is held */ |
1570 | static void csi_P(struct vc_data *vc, unsigned int nr) | 1570 | static void csi_P(struct vc_data *vc, unsigned int nr) |
1571 | { | 1571 | { |
1572 | if (nr > vc->vc_cols - vc->vc_x) | 1572 | if (nr > vc->vc_cols - vc->vc_x) |
@@ -1576,7 +1576,7 @@ static void csi_P(struct vc_data *vc, unsigned int nr) | |||
1576 | delete_char(vc, nr); | 1576 | delete_char(vc, nr); |
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | /* console_sem is held */ | 1579 | /* console_lock is held */ |
1580 | static void csi_M(struct vc_data *vc, unsigned int nr) | 1580 | static void csi_M(struct vc_data *vc, unsigned int nr) |
1581 | { | 1581 | { |
1582 | if (nr > vc->vc_rows - vc->vc_y) | 1582 | if (nr > vc->vc_rows - vc->vc_y) |
@@ -1587,7 +1587,7 @@ static void csi_M(struct vc_data *vc, unsigned int nr) | |||
1587 | vc->vc_need_wrap = 0; | 1587 | vc->vc_need_wrap = 0; |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | /* console_sem is held (except via vc_init->reset_terminal */ | 1590 | /* console_lock is held (except via vc_init->reset_terminal */ |
1591 | static void save_cur(struct vc_data *vc) | 1591 | static void save_cur(struct vc_data *vc) |
1592 | { | 1592 | { |
1593 | vc->vc_saved_x = vc->vc_x; | 1593 | vc->vc_saved_x = vc->vc_x; |
@@ -1603,7 +1603,7 @@ static void save_cur(struct vc_data *vc) | |||
1603 | vc->vc_saved_G1 = vc->vc_G1_charset; | 1603 | vc->vc_saved_G1 = vc->vc_G1_charset; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | /* console_sem is held */ | 1606 | /* console_lock is held */ |
1607 | static void restore_cur(struct vc_data *vc) | 1607 | static void restore_cur(struct vc_data *vc) |
1608 | { | 1608 | { |
1609 | gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); | 1609 | gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); |
@@ -1625,7 +1625,7 @@ enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, | |||
1625 | EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, | 1625 | EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, |
1626 | ESpalette }; | 1626 | ESpalette }; |
1627 | 1627 | ||
1628 | /* console_sem is held (except via vc_init()) */ | 1628 | /* console_lock is held (except via vc_init()) */ |
1629 | static void reset_terminal(struct vc_data *vc, int do_clear) | 1629 | static void reset_terminal(struct vc_data *vc, int do_clear) |
1630 | { | 1630 | { |
1631 | vc->vc_top = 0; | 1631 | vc->vc_top = 0; |
@@ -1685,7 +1685,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) | |||
1685 | csi_J(vc, 2); | 1685 | csi_J(vc, 2); |
1686 | } | 1686 | } |
1687 | 1687 | ||
1688 | /* console_sem is held */ | 1688 | /* console_lock is held */ |
1689 | static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | 1689 | static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) |
1690 | { | 1690 | { |
1691 | /* | 1691 | /* |
@@ -2119,7 +2119,7 @@ static int is_double_width(uint32_t ucs) | |||
2119 | return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); | 2119 | return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); |
2120 | } | 2120 | } |
2121 | 2121 | ||
2122 | /* acquires console_sem */ | 2122 | /* acquires console_lock */ |
2123 | static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) | 2123 | static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) |
2124 | { | 2124 | { |
2125 | #ifdef VT_BUF_VRAM_ONLY | 2125 | #ifdef VT_BUF_VRAM_ONLY |
@@ -2147,11 +2147,11 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2147 | 2147 | ||
2148 | might_sleep(); | 2148 | might_sleep(); |
2149 | 2149 | ||
2150 | acquire_console_sem(); | 2150 | console_lock(); |
2151 | vc = tty->driver_data; | 2151 | vc = tty->driver_data; |
2152 | if (vc == NULL) { | 2152 | if (vc == NULL) { |
2153 | printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); | 2153 | printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); |
2154 | release_console_sem(); | 2154 | console_unlock(); |
2155 | return 0; | 2155 | return 0; |
2156 | } | 2156 | } |
2157 | 2157 | ||
@@ -2159,7 +2159,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2159 | if (!vc_cons_allocated(currcons)) { | 2159 | if (!vc_cons_allocated(currcons)) { |
2160 | /* could this happen? */ | 2160 | /* could this happen? */ |
2161 | printk_once("con_write: tty %d not allocated\n", currcons+1); | 2161 | printk_once("con_write: tty %d not allocated\n", currcons+1); |
2162 | release_console_sem(); | 2162 | console_unlock(); |
2163 | return 0; | 2163 | return 0; |
2164 | } | 2164 | } |
2165 | 2165 | ||
@@ -2375,7 +2375,7 @@ rescan_last_byte: | |||
2375 | } | 2375 | } |
2376 | FLUSH | 2376 | FLUSH |
2377 | console_conditional_schedule(); | 2377 | console_conditional_schedule(); |
2378 | release_console_sem(); | 2378 | console_unlock(); |
2379 | notify_update(vc); | 2379 | notify_update(vc); |
2380 | return n; | 2380 | return n; |
2381 | #undef FLUSH | 2381 | #undef FLUSH |
@@ -2388,11 +2388,11 @@ rescan_last_byte: | |||
2388 | * us to do the switches asynchronously (needed when we want | 2388 | * us to do the switches asynchronously (needed when we want |
2389 | * to switch due to a keyboard interrupt). Synchronization | 2389 | * to switch due to a keyboard interrupt). Synchronization |
2390 | * with other console code and prevention of re-entrancy is | 2390 | * with other console code and prevention of re-entrancy is |
2391 | * ensured with console_sem. | 2391 | * ensured with console_lock. |
2392 | */ | 2392 | */ |
2393 | static void console_callback(struct work_struct *ignored) | 2393 | static void console_callback(struct work_struct *ignored) |
2394 | { | 2394 | { |
2395 | acquire_console_sem(); | 2395 | console_lock(); |
2396 | 2396 | ||
2397 | if (want_console >= 0) { | 2397 | if (want_console >= 0) { |
2398 | if (want_console != fg_console && | 2398 | if (want_console != fg_console && |
@@ -2422,7 +2422,7 @@ static void console_callback(struct work_struct *ignored) | |||
2422 | } | 2422 | } |
2423 | notify_update(vc_cons[fg_console].d); | 2423 | notify_update(vc_cons[fg_console].d); |
2424 | 2424 | ||
2425 | release_console_sem(); | 2425 | console_unlock(); |
2426 | } | 2426 | } |
2427 | 2427 | ||
2428 | int set_console(int nr) | 2428 | int set_console(int nr) |
@@ -2603,7 +2603,7 @@ static struct console vt_console_driver = { | |||
2603 | */ | 2603 | */ |
2604 | 2604 | ||
2605 | /* | 2605 | /* |
2606 | * Generally a bit racy with respect to console_sem(). | 2606 | * Generally a bit racy with respect to console_lock();. |
2607 | * | 2607 | * |
2608 | * There are some functions which don't need it. | 2608 | * There are some functions which don't need it. |
2609 | * | 2609 | * |
@@ -2629,17 +2629,17 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) | |||
2629 | switch (type) | 2629 | switch (type) |
2630 | { | 2630 | { |
2631 | case TIOCL_SETSEL: | 2631 | case TIOCL_SETSEL: |
2632 | acquire_console_sem(); | 2632 | console_lock(); |
2633 | ret = set_selection((struct tiocl_selection __user *)(p+1), tty); | 2633 | ret = set_selection((struct tiocl_selection __user *)(p+1), tty); |
2634 | release_console_sem(); | 2634 | console_unlock(); |
2635 | break; | 2635 | break; |
2636 | case TIOCL_PASTESEL: | 2636 | case TIOCL_PASTESEL: |
2637 | ret = paste_selection(tty); | 2637 | ret = paste_selection(tty); |
2638 | break; | 2638 | break; |
2639 | case TIOCL_UNBLANKSCREEN: | 2639 | case TIOCL_UNBLANKSCREEN: |
2640 | acquire_console_sem(); | 2640 | console_lock(); |
2641 | unblank_screen(); | 2641 | unblank_screen(); |
2642 | release_console_sem(); | 2642 | console_unlock(); |
2643 | break; | 2643 | break; |
2644 | case TIOCL_SELLOADLUT: | 2644 | case TIOCL_SELLOADLUT: |
2645 | ret = sel_loadlut(p); | 2645 | ret = sel_loadlut(p); |
@@ -2688,10 +2688,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) | |||
2688 | } | 2688 | } |
2689 | break; | 2689 | break; |
2690 | case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ | 2690 | case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ |
2691 | acquire_console_sem(); | 2691 | console_lock(); |
2692 | ignore_poke = 1; | 2692 | ignore_poke = 1; |
2693 | do_blank_screen(0); | 2693 | do_blank_screen(0); |
2694 | release_console_sem(); | 2694 | console_unlock(); |
2695 | break; | 2695 | break; |
2696 | case TIOCL_BLANKEDSCREEN: | 2696 | case TIOCL_BLANKEDSCREEN: |
2697 | ret = console_blanked; | 2697 | ret = console_blanked; |
@@ -2790,11 +2790,11 @@ static void con_flush_chars(struct tty_struct *tty) | |||
2790 | return; | 2790 | return; |
2791 | 2791 | ||
2792 | /* if we race with con_close(), vt may be null */ | 2792 | /* if we race with con_close(), vt may be null */ |
2793 | acquire_console_sem(); | 2793 | console_lock(); |
2794 | vc = tty->driver_data; | 2794 | vc = tty->driver_data; |
2795 | if (vc) | 2795 | if (vc) |
2796 | set_cursor(vc); | 2796 | set_cursor(vc); |
2797 | release_console_sem(); | 2797 | console_unlock(); |
2798 | } | 2798 | } |
2799 | 2799 | ||
2800 | /* | 2800 | /* |
@@ -2805,7 +2805,7 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2805 | unsigned int currcons = tty->index; | 2805 | unsigned int currcons = tty->index; |
2806 | int ret = 0; | 2806 | int ret = 0; |
2807 | 2807 | ||
2808 | acquire_console_sem(); | 2808 | console_lock(); |
2809 | if (tty->driver_data == NULL) { | 2809 | if (tty->driver_data == NULL) { |
2810 | ret = vc_allocate(currcons); | 2810 | ret = vc_allocate(currcons); |
2811 | if (ret == 0) { | 2811 | if (ret == 0) { |
@@ -2813,7 +2813,7 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2813 | 2813 | ||
2814 | /* Still being freed */ | 2814 | /* Still being freed */ |
2815 | if (vc->port.tty) { | 2815 | if (vc->port.tty) { |
2816 | release_console_sem(); | 2816 | console_unlock(); |
2817 | return -ERESTARTSYS; | 2817 | return -ERESTARTSYS; |
2818 | } | 2818 | } |
2819 | tty->driver_data = vc; | 2819 | tty->driver_data = vc; |
@@ -2827,11 +2827,11 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2827 | tty->termios->c_iflag |= IUTF8; | 2827 | tty->termios->c_iflag |= IUTF8; |
2828 | else | 2828 | else |
2829 | tty->termios->c_iflag &= ~IUTF8; | 2829 | tty->termios->c_iflag &= ~IUTF8; |
2830 | release_console_sem(); | 2830 | console_unlock(); |
2831 | return ret; | 2831 | return ret; |
2832 | } | 2832 | } |
2833 | } | 2833 | } |
2834 | release_console_sem(); | 2834 | console_unlock(); |
2835 | return ret; | 2835 | return ret; |
2836 | } | 2836 | } |
2837 | 2837 | ||
@@ -2844,9 +2844,9 @@ static void con_shutdown(struct tty_struct *tty) | |||
2844 | { | 2844 | { |
2845 | struct vc_data *vc = tty->driver_data; | 2845 | struct vc_data *vc = tty->driver_data; |
2846 | BUG_ON(vc == NULL); | 2846 | BUG_ON(vc == NULL); |
2847 | acquire_console_sem(); | 2847 | console_lock(); |
2848 | vc->port.tty = NULL; | 2848 | vc->port.tty = NULL; |
2849 | release_console_sem(); | 2849 | console_unlock(); |
2850 | tty_shutdown(tty); | 2850 | tty_shutdown(tty); |
2851 | } | 2851 | } |
2852 | 2852 | ||
@@ -2893,13 +2893,13 @@ static int __init con_init(void) | |||
2893 | struct vc_data *vc; | 2893 | struct vc_data *vc; |
2894 | unsigned int currcons = 0, i; | 2894 | unsigned int currcons = 0, i; |
2895 | 2895 | ||
2896 | acquire_console_sem(); | 2896 | console_lock(); |
2897 | 2897 | ||
2898 | if (conswitchp) | 2898 | if (conswitchp) |
2899 | display_desc = conswitchp->con_startup(); | 2899 | display_desc = conswitchp->con_startup(); |
2900 | if (!display_desc) { | 2900 | if (!display_desc) { |
2901 | fg_console = 0; | 2901 | fg_console = 0; |
2902 | release_console_sem(); | 2902 | console_unlock(); |
2903 | return 0; | 2903 | return 0; |
2904 | } | 2904 | } |
2905 | 2905 | ||
@@ -2946,7 +2946,7 @@ static int __init con_init(void) | |||
2946 | printable = 1; | 2946 | printable = 1; |
2947 | printk("\n"); | 2947 | printk("\n"); |
2948 | 2948 | ||
2949 | release_console_sem(); | 2949 | console_unlock(); |
2950 | 2950 | ||
2951 | #ifdef CONFIG_VT_CONSOLE | 2951 | #ifdef CONFIG_VT_CONSOLE |
2952 | register_console(&vt_console_driver); | 2952 | register_console(&vt_console_driver); |
@@ -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 | ||
@@ -3037,7 +3037,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, | |||
3037 | if (!try_module_get(owner)) | 3037 | if (!try_module_get(owner)) |
3038 | return -ENODEV; | 3038 | return -ENODEV; |
3039 | 3039 | ||
3040 | acquire_console_sem(); | 3040 | console_lock(); |
3041 | 3041 | ||
3042 | /* check if driver is registered */ | 3042 | /* check if driver is registered */ |
3043 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3043 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
@@ -3122,7 +3122,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, | |||
3122 | 3122 | ||
3123 | retval = 0; | 3123 | retval = 0; |
3124 | err: | 3124 | err: |
3125 | release_console_sem(); | 3125 | console_unlock(); |
3126 | module_put(owner); | 3126 | module_put(owner); |
3127 | return retval; | 3127 | return retval; |
3128 | }; | 3128 | }; |
@@ -3171,7 +3171,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3171 | if (!try_module_get(owner)) | 3171 | if (!try_module_get(owner)) |
3172 | return -ENODEV; | 3172 | return -ENODEV; |
3173 | 3173 | ||
3174 | acquire_console_sem(); | 3174 | console_lock(); |
3175 | 3175 | ||
3176 | /* check if driver is registered and if it is unbindable */ | 3176 | /* check if driver is registered and if it is unbindable */ |
3177 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3177 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
@@ -3185,7 +3185,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3185 | } | 3185 | } |
3186 | 3186 | ||
3187 | if (retval) { | 3187 | if (retval) { |
3188 | release_console_sem(); | 3188 | console_unlock(); |
3189 | goto err; | 3189 | goto err; |
3190 | } | 3190 | } |
3191 | 3191 | ||
@@ -3204,12 +3204,12 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3204 | } | 3204 | } |
3205 | 3205 | ||
3206 | if (retval) { | 3206 | if (retval) { |
3207 | release_console_sem(); | 3207 | console_unlock(); |
3208 | goto err; | 3208 | goto err; |
3209 | } | 3209 | } |
3210 | 3210 | ||
3211 | if (!con_is_bound(csw)) { | 3211 | if (!con_is_bound(csw)) { |
3212 | release_console_sem(); | 3212 | console_unlock(); |
3213 | goto err; | 3213 | goto err; |
3214 | } | 3214 | } |
3215 | 3215 | ||
@@ -3238,7 +3238,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3238 | if (!con_is_bound(csw)) | 3238 | if (!con_is_bound(csw)) |
3239 | con_driver->flag &= ~CON_DRIVER_FLAG_INIT; | 3239 | con_driver->flag &= ~CON_DRIVER_FLAG_INIT; |
3240 | 3240 | ||
3241 | release_console_sem(); | 3241 | console_unlock(); |
3242 | /* ignore return value, binding should not fail */ | 3242 | /* ignore return value, binding should not fail */ |
3243 | bind_con_driver(defcsw, first, last, deflt); | 3243 | bind_con_driver(defcsw, first, last, deflt); |
3244 | err: | 3244 | err: |
@@ -3538,14 +3538,14 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3538 | if (!try_module_get(owner)) | 3538 | if (!try_module_get(owner)) |
3539 | return -ENODEV; | 3539 | return -ENODEV; |
3540 | 3540 | ||
3541 | acquire_console_sem(); | 3541 | console_lock(); |
3542 | 3542 | ||
3543 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3543 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3544 | con_driver = ®istered_con_driver[i]; | 3544 | con_driver = ®istered_con_driver[i]; |
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) |
@@ -3592,7 +3592,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3592 | } | 3592 | } |
3593 | 3593 | ||
3594 | err: | 3594 | err: |
3595 | release_console_sem(); | 3595 | console_unlock(); |
3596 | module_put(owner); | 3596 | module_put(owner); |
3597 | return retval; | 3597 | return retval; |
3598 | } | 3598 | } |
@@ -3613,7 +3613,7 @@ int unregister_con_driver(const struct consw *csw) | |||
3613 | { | 3613 | { |
3614 | int i, retval = -ENODEV; | 3614 | int i, retval = -ENODEV; |
3615 | 3615 | ||
3616 | acquire_console_sem(); | 3616 | console_lock(); |
3617 | 3617 | ||
3618 | /* cannot unregister a bound driver */ | 3618 | /* cannot unregister a bound driver */ |
3619 | if (con_is_bound(csw)) | 3619 | if (con_is_bound(csw)) |
@@ -3639,7 +3639,7 @@ int unregister_con_driver(const struct consw *csw) | |||
3639 | } | 3639 | } |
3640 | } | 3640 | } |
3641 | err: | 3641 | err: |
3642 | release_console_sem(); | 3642 | console_unlock(); |
3643 | return retval; | 3643 | return retval; |
3644 | } | 3644 | } |
3645 | EXPORT_SYMBOL(unregister_con_driver); | 3645 | EXPORT_SYMBOL(unregister_con_driver); |
@@ -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 | ||
@@ -3934,9 +3939,9 @@ int con_set_cmap(unsigned char __user *arg) | |||
3934 | { | 3939 | { |
3935 | int rc; | 3940 | int rc; |
3936 | 3941 | ||
3937 | acquire_console_sem(); | 3942 | console_lock(); |
3938 | rc = set_get_cmap (arg,1); | 3943 | rc = set_get_cmap (arg,1); |
3939 | release_console_sem(); | 3944 | console_unlock(); |
3940 | 3945 | ||
3941 | return rc; | 3946 | return rc; |
3942 | } | 3947 | } |
@@ -3945,9 +3950,9 @@ int con_get_cmap(unsigned char __user *arg) | |||
3945 | { | 3950 | { |
3946 | int rc; | 3951 | int rc; |
3947 | 3952 | ||
3948 | acquire_console_sem(); | 3953 | console_lock(); |
3949 | rc = set_get_cmap (arg,0); | 3954 | rc = set_get_cmap (arg,0); |
3950 | release_console_sem(); | 3955 | console_unlock(); |
3951 | 3956 | ||
3952 | return rc; | 3957 | return rc; |
3953 | } | 3958 | } |
@@ -3994,12 +3999,12 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op) | |||
3994 | } else | 3999 | } else |
3995 | font.data = NULL; | 4000 | font.data = NULL; |
3996 | 4001 | ||
3997 | acquire_console_sem(); | 4002 | console_lock(); |
3998 | if (vc->vc_sw->con_font_get) | 4003 | if (vc->vc_sw->con_font_get) |
3999 | rc = vc->vc_sw->con_font_get(vc, &font); | 4004 | rc = vc->vc_sw->con_font_get(vc, &font); |
4000 | else | 4005 | else |
4001 | rc = -ENOSYS; | 4006 | rc = -ENOSYS; |
4002 | release_console_sem(); | 4007 | console_unlock(); |
4003 | 4008 | ||
4004 | if (rc) | 4009 | if (rc) |
4005 | goto out; | 4010 | goto out; |
@@ -4076,12 +4081,12 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op) | |||
4076 | font.data = memdup_user(op->data, size); | 4081 | font.data = memdup_user(op->data, size); |
4077 | if (IS_ERR(font.data)) | 4082 | if (IS_ERR(font.data)) |
4078 | return PTR_ERR(font.data); | 4083 | return PTR_ERR(font.data); |
4079 | acquire_console_sem(); | 4084 | console_lock(); |
4080 | if (vc->vc_sw->con_font_set) | 4085 | if (vc->vc_sw->con_font_set) |
4081 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); | 4086 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); |
4082 | else | 4087 | else |
4083 | rc = -ENOSYS; | 4088 | rc = -ENOSYS; |
4084 | release_console_sem(); | 4089 | console_unlock(); |
4085 | kfree(font.data); | 4090 | kfree(font.data); |
4086 | return rc; | 4091 | return rc; |
4087 | } | 4092 | } |
@@ -4103,12 +4108,12 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) | |||
4103 | else | 4108 | else |
4104 | name[MAX_FONT_NAME - 1] = 0; | 4109 | name[MAX_FONT_NAME - 1] = 0; |
4105 | 4110 | ||
4106 | acquire_console_sem(); | 4111 | console_lock(); |
4107 | if (vc->vc_sw->con_font_default) | 4112 | if (vc->vc_sw->con_font_default) |
4108 | rc = vc->vc_sw->con_font_default(vc, &font, s); | 4113 | rc = vc->vc_sw->con_font_default(vc, &font, s); |
4109 | else | 4114 | else |
4110 | rc = -ENOSYS; | 4115 | rc = -ENOSYS; |
4111 | release_console_sem(); | 4116 | console_unlock(); |
4112 | if (!rc) { | 4117 | if (!rc) { |
4113 | op->width = font.width; | 4118 | op->width = font.width; |
4114 | op->height = font.height; | 4119 | op->height = font.height; |
@@ -4124,7 +4129,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4124 | if (vc->vc_mode != KD_TEXT) | 4129 | if (vc->vc_mode != KD_TEXT) |
4125 | return -EINVAL; | 4130 | return -EINVAL; |
4126 | 4131 | ||
4127 | acquire_console_sem(); | 4132 | console_lock(); |
4128 | if (!vc->vc_sw->con_font_copy) | 4133 | if (!vc->vc_sw->con_font_copy) |
4129 | rc = -ENOSYS; | 4134 | rc = -ENOSYS; |
4130 | else if (con < 0 || !vc_cons_allocated(con)) | 4135 | else if (con < 0 || !vc_cons_allocated(con)) |
@@ -4133,7 +4138,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4133 | rc = 0; | 4138 | rc = 0; |
4134 | else | 4139 | else |
4135 | rc = vc->vc_sw->con_font_copy(vc, con); | 4140 | rc = vc->vc_sw->con_font_copy(vc, con); |
4136 | release_console_sem(); | 4141 | console_unlock(); |
4137 | return rc; | 4142 | return rc; |
4138 | } | 4143 | } |
4139 | 4144 | ||
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 6b68a0fb4611..1235ebda6e1c 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c | |||
@@ -649,12 +649,12 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
649 | /* | 649 | /* |
650 | * explicitly blank/unblank the screen if switching modes | 650 | * explicitly blank/unblank the screen if switching modes |
651 | */ | 651 | */ |
652 | acquire_console_sem(); | 652 | console_lock(); |
653 | if (arg == KD_TEXT) | 653 | if (arg == KD_TEXT) |
654 | do_unblank_screen(1); | 654 | do_unblank_screen(1); |
655 | else | 655 | else |
656 | do_blank_screen(1); | 656 | do_blank_screen(1); |
657 | release_console_sem(); | 657 | console_unlock(); |
658 | break; | 658 | break; |
659 | 659 | ||
660 | case KDGETMODE: | 660 | case KDGETMODE: |
@@ -893,7 +893,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
893 | ret = -EINVAL; | 893 | ret = -EINVAL; |
894 | goto out; | 894 | goto out; |
895 | } | 895 | } |
896 | acquire_console_sem(); | 896 | console_lock(); |
897 | vc->vt_mode = tmp; | 897 | vc->vt_mode = tmp; |
898 | /* the frsig is ignored, so we set it to 0 */ | 898 | /* the frsig is ignored, so we set it to 0 */ |
899 | vc->vt_mode.frsig = 0; | 899 | vc->vt_mode.frsig = 0; |
@@ -901,7 +901,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
901 | vc->vt_pid = get_pid(task_pid(current)); | 901 | vc->vt_pid = get_pid(task_pid(current)); |
902 | /* no switch is required -- saw@shade.msu.ru */ | 902 | /* no switch is required -- saw@shade.msu.ru */ |
903 | vc->vt_newvt = -1; | 903 | vc->vt_newvt = -1; |
904 | release_console_sem(); | 904 | console_unlock(); |
905 | break; | 905 | break; |
906 | } | 906 | } |
907 | 907 | ||
@@ -910,9 +910,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
910 | struct vt_mode tmp; | 910 | struct vt_mode tmp; |
911 | int rc; | 911 | int rc; |
912 | 912 | ||
913 | acquire_console_sem(); | 913 | console_lock(); |
914 | memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode)); | 914 | memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode)); |
915 | release_console_sem(); | 915 | console_unlock(); |
916 | 916 | ||
917 | rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); | 917 | rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); |
918 | if (rc) | 918 | if (rc) |
@@ -965,9 +965,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
965 | ret = -ENXIO; | 965 | ret = -ENXIO; |
966 | else { | 966 | else { |
967 | arg--; | 967 | arg--; |
968 | acquire_console_sem(); | 968 | console_lock(); |
969 | ret = vc_allocate(arg); | 969 | ret = vc_allocate(arg); |
970 | release_console_sem(); | 970 | console_unlock(); |
971 | if (ret) | 971 | if (ret) |
972 | break; | 972 | break; |
973 | set_console(arg); | 973 | set_console(arg); |
@@ -990,7 +990,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
990 | ret = -ENXIO; | 990 | ret = -ENXIO; |
991 | else { | 991 | else { |
992 | vsa.console--; | 992 | vsa.console--; |
993 | acquire_console_sem(); | 993 | console_lock(); |
994 | ret = vc_allocate(vsa.console); | 994 | ret = vc_allocate(vsa.console); |
995 | if (ret == 0) { | 995 | if (ret == 0) { |
996 | struct vc_data *nvc; | 996 | struct vc_data *nvc; |
@@ -1003,7 +1003,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1003 | put_pid(nvc->vt_pid); | 1003 | put_pid(nvc->vt_pid); |
1004 | nvc->vt_pid = get_pid(task_pid(current)); | 1004 | nvc->vt_pid = get_pid(task_pid(current)); |
1005 | } | 1005 | } |
1006 | release_console_sem(); | 1006 | console_unlock(); |
1007 | if (ret) | 1007 | if (ret) |
1008 | break; | 1008 | break; |
1009 | /* Commence switch and lock */ | 1009 | /* Commence switch and lock */ |
@@ -1044,7 +1044,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1044 | /* | 1044 | /* |
1045 | * Switching-from response | 1045 | * Switching-from response |
1046 | */ | 1046 | */ |
1047 | acquire_console_sem(); | 1047 | console_lock(); |
1048 | if (vc->vt_newvt >= 0) { | 1048 | if (vc->vt_newvt >= 0) { |
1049 | if (arg == 0) | 1049 | if (arg == 0) |
1050 | /* | 1050 | /* |
@@ -1063,7 +1063,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1063 | vc->vt_newvt = -1; | 1063 | vc->vt_newvt = -1; |
1064 | ret = vc_allocate(newvt); | 1064 | ret = vc_allocate(newvt); |
1065 | if (ret) { | 1065 | if (ret) { |
1066 | release_console_sem(); | 1066 | console_unlock(); |
1067 | break; | 1067 | break; |
1068 | } | 1068 | } |
1069 | /* | 1069 | /* |
@@ -1083,7 +1083,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1083 | if (arg != VT_ACKACQ) | 1083 | if (arg != VT_ACKACQ) |
1084 | ret = -EINVAL; | 1084 | ret = -EINVAL; |
1085 | } | 1085 | } |
1086 | release_console_sem(); | 1086 | console_unlock(); |
1087 | break; | 1087 | break; |
1088 | 1088 | ||
1089 | /* | 1089 | /* |
@@ -1096,20 +1096,20 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1096 | } | 1096 | } |
1097 | if (arg == 0) { | 1097 | if (arg == 0) { |
1098 | /* deallocate all unused consoles, but leave 0 */ | 1098 | /* deallocate all unused consoles, but leave 0 */ |
1099 | acquire_console_sem(); | 1099 | console_lock(); |
1100 | for (i=1; i<MAX_NR_CONSOLES; i++) | 1100 | for (i=1; i<MAX_NR_CONSOLES; i++) |
1101 | if (! VT_BUSY(i)) | 1101 | if (! VT_BUSY(i)) |
1102 | vc_deallocate(i); | 1102 | vc_deallocate(i); |
1103 | release_console_sem(); | 1103 | console_unlock(); |
1104 | } else { | 1104 | } else { |
1105 | /* deallocate a single console, if possible */ | 1105 | /* deallocate a single console, if possible */ |
1106 | arg--; | 1106 | arg--; |
1107 | if (VT_BUSY(arg)) | 1107 | if (VT_BUSY(arg)) |
1108 | ret = -EBUSY; | 1108 | ret = -EBUSY; |
1109 | else if (arg) { /* leave 0 */ | 1109 | else if (arg) { /* leave 0 */ |
1110 | acquire_console_sem(); | 1110 | console_lock(); |
1111 | vc_deallocate(arg); | 1111 | vc_deallocate(arg); |
1112 | release_console_sem(); | 1112 | console_unlock(); |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | break; | 1115 | break; |
@@ -1126,7 +1126,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1126 | get_user(cc, &vtsizes->v_cols)) | 1126 | get_user(cc, &vtsizes->v_cols)) |
1127 | ret = -EFAULT; | 1127 | ret = -EFAULT; |
1128 | else { | 1128 | else { |
1129 | acquire_console_sem(); | 1129 | console_lock(); |
1130 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 1130 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1131 | vc = vc_cons[i].d; | 1131 | vc = vc_cons[i].d; |
1132 | 1132 | ||
@@ -1135,7 +1135,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1135 | vc_resize(vc_cons[i].d, cc, ll); | 1135 | vc_resize(vc_cons[i].d, cc, ll); |
1136 | } | 1136 | } |
1137 | } | 1137 | } |
1138 | release_console_sem(); | 1138 | console_unlock(); |
1139 | } | 1139 | } |
1140 | break; | 1140 | break; |
1141 | } | 1141 | } |
@@ -1187,14 +1187,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1187 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 1187 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1188 | if (!vc_cons[i].d) | 1188 | if (!vc_cons[i].d) |
1189 | continue; | 1189 | continue; |
1190 | acquire_console_sem(); | 1190 | console_lock(); |
1191 | if (vlin) | 1191 | if (vlin) |
1192 | vc_cons[i].d->vc_scan_lines = vlin; | 1192 | vc_cons[i].d->vc_scan_lines = vlin; |
1193 | if (clin) | 1193 | if (clin) |
1194 | vc_cons[i].d->vc_font.height = clin; | 1194 | vc_cons[i].d->vc_font.height = clin; |
1195 | vc_cons[i].d->vc_resize_user = 1; | 1195 | vc_cons[i].d->vc_resize_user = 1; |
1196 | vc_resize(vc_cons[i].d, cc, ll); | 1196 | vc_resize(vc_cons[i].d, cc, ll); |
1197 | release_console_sem(); | 1197 | console_unlock(); |
1198 | } | 1198 | } |
1199 | break; | 1199 | break; |
1200 | } | 1200 | } |
@@ -1367,7 +1367,7 @@ void vc_SAK(struct work_struct *work) | |||
1367 | struct vc_data *vc; | 1367 | struct vc_data *vc; |
1368 | struct tty_struct *tty; | 1368 | struct tty_struct *tty; |
1369 | 1369 | ||
1370 | acquire_console_sem(); | 1370 | console_lock(); |
1371 | vc = vc_con->d; | 1371 | vc = vc_con->d; |
1372 | if (vc) { | 1372 | if (vc) { |
1373 | tty = vc->port.tty; | 1373 | tty = vc->port.tty; |
@@ -1379,7 +1379,7 @@ void vc_SAK(struct work_struct *work) | |||
1379 | __do_SAK(tty); | 1379 | __do_SAK(tty); |
1380 | reset_vc(vc); | 1380 | reset_vc(vc); |
1381 | } | 1381 | } |
1382 | release_console_sem(); | 1382 | console_unlock(); |
1383 | } | 1383 | } |
1384 | 1384 | ||
1385 | #ifdef CONFIG_COMPAT | 1385 | #ifdef CONFIG_COMPAT |
@@ -1737,10 +1737,10 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1737 | { | 1737 | { |
1738 | int prev; | 1738 | int prev; |
1739 | 1739 | ||
1740 | acquire_console_sem(); | 1740 | console_lock(); |
1741 | /* Graphics mode - up to X */ | 1741 | /* Graphics mode - up to X */ |
1742 | if (disable_vt_switch) { | 1742 | if (disable_vt_switch) { |
1743 | release_console_sem(); | 1743 | console_unlock(); |
1744 | return 0; | 1744 | return 0; |
1745 | } | 1745 | } |
1746 | prev = fg_console; | 1746 | prev = fg_console; |
@@ -1748,7 +1748,7 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1748 | if (alloc && vc_allocate(vt)) { | 1748 | if (alloc && vc_allocate(vt)) { |
1749 | /* we can't have a free VC for now. Too bad, | 1749 | /* we can't have a free VC for now. Too bad, |
1750 | * we don't want to mess the screen for now. */ | 1750 | * we don't want to mess the screen for now. */ |
1751 | release_console_sem(); | 1751 | console_unlock(); |
1752 | return -ENOSPC; | 1752 | return -ENOSPC; |
1753 | } | 1753 | } |
1754 | 1754 | ||
@@ -1758,10 +1758,10 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1758 | * Let the calling function know so it can decide | 1758 | * Let the calling function know so it can decide |
1759 | * what to do. | 1759 | * what to do. |
1760 | */ | 1760 | */ |
1761 | release_console_sem(); | 1761 | console_unlock(); |
1762 | return -EIO; | 1762 | return -EIO; |
1763 | } | 1763 | } |
1764 | release_console_sem(); | 1764 | console_unlock(); |
1765 | tty_lock(); | 1765 | tty_lock(); |
1766 | if (vt_waitactive(vt + 1)) { | 1766 | if (vt_waitactive(vt + 1)) { |
1767 | pr_debug("Suspend: Can't switch VCs."); | 1767 | pr_debug("Suspend: Can't switch VCs."); |
@@ -1781,8 +1781,8 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1781 | */ | 1781 | */ |
1782 | void pm_set_vt_switch(int do_switch) | 1782 | void pm_set_vt_switch(int do_switch) |
1783 | { | 1783 | { |
1784 | acquire_console_sem(); | 1784 | console_lock(); |
1785 | disable_vt_switch = !do_switch; | 1785 | disable_vt_switch = !do_switch; |
1786 | release_console_sem(); | 1786 | console_unlock(); |
1787 | } | 1787 | } |
1788 | EXPORT_SYMBOL(pm_set_vt_switch); | 1788 | EXPORT_SYMBOL(pm_set_vt_switch); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d6ede989ff22..4ab49d4eebf4 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1607,6 +1607,7 @@ static const struct usb_device_id acm_ids[] = { | |||
1607 | { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ | 1607 | { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ |
1608 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ | 1608 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ |
1609 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ | 1609 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ |
1610 | { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */ | ||
1610 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ | 1611 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ |
1611 | 1612 | ||
1612 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1613 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
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/hcd.c b/drivers/usb/core/hcd.c index 6a95017fa62b..e935f71d7a34 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1955,7 +1955,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
1955 | 1955 | ||
1956 | dev_dbg(&rhdev->dev, "usb %s%s\n", | 1956 | dev_dbg(&rhdev->dev, "usb %s%s\n", |
1957 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); | 1957 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); |
1958 | clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | ||
1959 | if (!hcd->driver->bus_resume) | 1958 | if (!hcd->driver->bus_resume) |
1960 | return -ENOENT; | 1959 | return -ENOENT; |
1961 | if (hcd->state == HC_STATE_RUNNING) | 1960 | if (hcd->state == HC_STATE_RUNNING) |
@@ -1963,6 +1962,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
1963 | 1962 | ||
1964 | hcd->state = HC_STATE_RESUMING; | 1963 | hcd->state = HC_STATE_RESUMING; |
1965 | status = hcd->driver->bus_resume(hcd); | 1964 | status = hcd->driver->bus_resume(hcd); |
1965 | clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | ||
1966 | if (status == 0) { | 1966 | if (status == 0) { |
1967 | /* TRSMRCY = 10 msec */ | 1967 | /* TRSMRCY = 10 msec */ |
1968 | msleep(10); | 1968 | msleep(10); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b98efae6a1cf..d041c6826e43 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 | } |
@@ -2732,6 +2753,11 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2732 | udev->ttport = hdev->ttport; | 2753 | udev->ttport = hdev->ttport; |
2733 | } else if (udev->speed != USB_SPEED_HIGH | 2754 | } else if (udev->speed != USB_SPEED_HIGH |
2734 | && hdev->speed == USB_SPEED_HIGH) { | 2755 | && hdev->speed == USB_SPEED_HIGH) { |
2756 | if (!hub->tt.hub) { | ||
2757 | dev_err(&udev->dev, "parent hub has no TT\n"); | ||
2758 | retval = -EINVAL; | ||
2759 | goto fail; | ||
2760 | } | ||
2735 | udev->tt = &hub->tt; | 2761 | udev->tt = &hub->tt; |
2736 | udev->ttport = port1; | 2762 | udev->ttport = port1; |
2737 | } | 2763 | } |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1dc9739277b4..d50099675f28 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 |
@@ -541,6 +546,8 @@ config USB_GADGET_CI13XXX_MSM | |||
541 | ci13xxx_udc core. | 546 | ci13xxx_udc core. |
542 | This driver depends on OTG driver for PHY initialization, | 547 | This driver depends on OTG driver for PHY initialization, |
543 | clock management, powering up VBUS, and power management. | 548 | clock management, powering up VBUS, and power management. |
549 | This driver is not supported on boards like trout which | ||
550 | has an external PHY. | ||
544 | 551 | ||
545 | Say "y" to link the driver statically, or "m" to build a | 552 | Say "y" to link the driver statically, or "m" to build a |
546 | dynamically linked module called "ci13xxx_msm" and force all | 553 | dynamically linked module called "ci13xxx_msm" and force all |
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/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index b5dbb2308f56..6d8e533949eb 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -293,6 +293,7 @@ | |||
293 | 293 | ||
294 | #include <linux/usb/ch9.h> | 294 | #include <linux/usb/ch9.h> |
295 | #include <linux/usb/gadget.h> | 295 | #include <linux/usb/gadget.h> |
296 | #include <linux/usb/composite.h> | ||
296 | 297 | ||
297 | #include "gadget_chips.h" | 298 | #include "gadget_chips.h" |
298 | 299 | ||
@@ -2763,7 +2764,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common, | |||
2763 | return ERR_PTR(-ENOMEM); | 2764 | return ERR_PTR(-ENOMEM); |
2764 | common->free_storage_on_release = 1; | 2765 | common->free_storage_on_release = 1; |
2765 | } else { | 2766 | } else { |
2766 | memset(common, 0, sizeof common); | 2767 | memset(common, 0, sizeof *common); |
2767 | common->free_storage_on_release = 0; | 2768 | common->free_storage_on_release = 0; |
2768 | } | 2769 | } |
2769 | 2770 | ||
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/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 20d43da319ae..015118535f77 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -258,7 +258,7 @@ static int pipe_buffer_setting(struct r8a66597 *r8a66597, | |||
258 | break; | 258 | break; |
259 | case R8A66597_BULK: | 259 | case R8A66597_BULK: |
260 | /* isochronous pipes may be used as bulk pipes */ | 260 | /* isochronous pipes may be used as bulk pipes */ |
261 | if (info->pipe > R8A66597_BASE_PIPENUM_BULK) | 261 | if (info->pipe >= R8A66597_BASE_PIPENUM_BULK) |
262 | bufnum = info->pipe - R8A66597_BASE_PIPENUM_BULK; | 262 | bufnum = info->pipe - R8A66597_BASE_PIPENUM_BULK; |
263 | else | 263 | else |
264 | bufnum = info->pipe - R8A66597_BASE_PIPENUM_ISOC; | 264 | bufnum = info->pipe - R8A66597_BASE_PIPENUM_ISOC; |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 24046c0f5878..0e6afa260ed8 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -151,6 +151,8 @@ config USB_EHCI_MSM | |||
151 | Qualcomm chipsets. Root Hub has inbuilt TT. | 151 | Qualcomm chipsets. Root Hub has inbuilt TT. |
152 | This driver depends on OTG driver for PHY initialization, | 152 | This driver depends on OTG driver for PHY initialization, |
153 | clock management, powering up VBUS, and power management. | 153 | clock management, powering up VBUS, and power management. |
154 | This driver is not supported on boards like trout which | ||
155 | has an external PHY. | ||
154 | 156 | ||
155 | config USB_EHCI_HCD_PPC_OF | 157 | config USB_EHCI_HCD_PPC_OF |
156 | bool "EHCI support for PPC USB controller on OF platform bus" | 158 | bool "EHCI support for PPC USB controller on OF platform bus" |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 2baf8a849086..a869e3c103d3 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -227,8 +227,8 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev) | |||
227 | * mark HW unaccessible. The PM and USB cores make sure that | 227 | * mark HW unaccessible. The PM and USB cores make sure that |
228 | * the root hub is either suspended or stopped. | 228 | * the root hub is either suspended or stopped. |
229 | */ | 229 | */ |
230 | spin_lock_irqsave(&ehci->lock, flags); | ||
231 | ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); | 230 | ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); |
231 | spin_lock_irqsave(&ehci->lock, flags); | ||
232 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | 232 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
233 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); | 233 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); |
234 | 234 | ||
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-hub.c b/drivers/usb/host/ehci-hub.c index 796ea0c8900f..8a515f0d5988 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -111,6 +111,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
111 | { | 111 | { |
112 | int port; | 112 | int port; |
113 | u32 temp; | 113 | u32 temp; |
114 | unsigned long flags; | ||
114 | 115 | ||
115 | /* If remote wakeup is enabled for the root hub but disabled | 116 | /* If remote wakeup is enabled for the root hub but disabled |
116 | * for the controller, we must adjust all the port wakeup flags | 117 | * for the controller, we must adjust all the port wakeup flags |
@@ -120,6 +121,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
120 | if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) | 121 | if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) |
121 | return; | 122 | return; |
122 | 123 | ||
124 | spin_lock_irqsave(&ehci->lock, flags); | ||
125 | |||
123 | /* clear phy low-power mode before changing wakeup flags */ | 126 | /* clear phy low-power mode before changing wakeup flags */ |
124 | if (ehci->has_hostpc) { | 127 | if (ehci->has_hostpc) { |
125 | port = HCS_N_PORTS(ehci->hcs_params); | 128 | port = HCS_N_PORTS(ehci->hcs_params); |
@@ -131,7 +134,9 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
131 | temp = ehci_readl(ehci, hostpc_reg); | 134 | temp = ehci_readl(ehci, hostpc_reg); |
132 | ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); | 135 | ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); |
133 | } | 136 | } |
137 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
134 | msleep(5); | 138 | msleep(5); |
139 | spin_lock_irqsave(&ehci->lock, flags); | ||
135 | } | 140 | } |
136 | 141 | ||
137 | port = HCS_N_PORTS(ehci->hcs_params); | 142 | port = HCS_N_PORTS(ehci->hcs_params); |
@@ -170,6 +175,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
170 | /* Does the root hub have a port wakeup pending? */ | 175 | /* Does the root hub have a port wakeup pending? */ |
171 | if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) | 176 | if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) |
172 | usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); | 177 | usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); |
178 | |||
179 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
173 | } | 180 | } |
174 | 181 | ||
175 | static int ehci_bus_suspend (struct usb_hcd *hcd) | 182 | static int ehci_bus_suspend (struct usb_hcd *hcd) |
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-omap.c b/drivers/usb/host/ehci-omap.c index 680f2ef4e59f..f784ceb862a3 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -796,7 +796,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
796 | hcd = usb_create_hcd(&ehci_omap_hc_driver, &pdev->dev, | 796 | hcd = usb_create_hcd(&ehci_omap_hc_driver, &pdev->dev, |
797 | dev_name(&pdev->dev)); | 797 | dev_name(&pdev->dev)); |
798 | if (!hcd) { | 798 | if (!hcd) { |
799 | dev_dbg(&pdev->dev, "failed to create hcd with err %d\n", ret); | 799 | dev_err(&pdev->dev, "failed to create hcd with err %d\n", ret); |
800 | ret = -ENOMEM; | 800 | ret = -ENOMEM; |
801 | goto err_create_hcd; | 801 | goto err_create_hcd; |
802 | } | 802 | } |
@@ -864,7 +864,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
864 | 864 | ||
865 | ret = omap_start_ehc(omap, hcd); | 865 | ret = omap_start_ehc(omap, hcd); |
866 | if (ret) { | 866 | if (ret) { |
867 | dev_dbg(&pdev->dev, "failed to start ehci\n"); | 867 | dev_err(&pdev->dev, "failed to start ehci with err %d\n", ret); |
868 | goto err_start; | 868 | goto err_start; |
869 | } | 869 | } |
870 | 870 | ||
@@ -879,7 +879,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
879 | 879 | ||
880 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); | 880 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); |
881 | if (ret) { | 881 | if (ret) { |
882 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | 882 | dev_err(&pdev->dev, "failed to add hcd with err %d\n", ret); |
883 | goto err_add_hcd; | 883 | goto err_add_hcd; |
884 | } | 884 | } |
885 | 885 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 76179c39c0e3..07bb982e59f6 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); |
@@ -360,8 +367,8 @@ static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
360 | * mark HW unaccessible. The PM and USB cores make sure that | 367 | * mark HW unaccessible. The PM and USB cores make sure that |
361 | * the root hub is either suspended or stopped. | 368 | * the root hub is either suspended or stopped. |
362 | */ | 369 | */ |
363 | spin_lock_irqsave (&ehci->lock, flags); | ||
364 | ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup); | 370 | ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup); |
371 | spin_lock_irqsave (&ehci->lock, flags); | ||
365 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | 372 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
366 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); | 373 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); |
367 | 374 | ||
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/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 990f06b89eaa..2e9602a10e9b 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -861,6 +861,7 @@ static int sl811h_urb_enqueue( | |||
861 | DBG("dev %d ep%d maxpacket %d\n", | 861 | DBG("dev %d ep%d maxpacket %d\n", |
862 | udev->devnum, epnum, ep->maxpacket); | 862 | udev->devnum, epnum, ep->maxpacket); |
863 | retval = -EINVAL; | 863 | retval = -EINVAL; |
864 | kfree(ep); | ||
864 | goto fail; | 865 | goto fail; |
865 | } | 866 | } |
866 | 867 | ||
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/musb/blackfin.c b/drivers/usb/musb/blackfin.c index eeba228eb2af..9d49d1cd7ce2 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -404,6 +404,7 @@ static int bfin_musb_init(struct musb *musb) | |||
404 | musb->xceiv->set_power = bfin_musb_set_power; | 404 | musb->xceiv->set_power = bfin_musb_set_power; |
405 | 405 | ||
406 | musb->isr = blackfin_interrupt; | 406 | musb->isr = blackfin_interrupt; |
407 | musb->double_buffer_not_ok = true; | ||
407 | 408 | ||
408 | return 0; | 409 | return 0; |
409 | } | 410 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 07cf394e491b..54a8bd1047d6 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -128,12 +128,7 @@ MODULE_ALIAS("platform:" MUSB_DRIVER_NAME); | |||
128 | 128 | ||
129 | static inline struct musb *dev_to_musb(struct device *dev) | 129 | static inline struct musb *dev_to_musb(struct device *dev) |
130 | { | 130 | { |
131 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
132 | /* usbcore insists dev->driver_data is a "struct hcd *" */ | ||
133 | return hcd_to_musb(dev_get_drvdata(dev)); | ||
134 | #else | ||
135 | return dev_get_drvdata(dev); | 131 | return dev_get_drvdata(dev); |
136 | #endif | ||
137 | } | 132 | } |
138 | 133 | ||
139 | /*-------------------------------------------------------------------------*/ | 134 | /*-------------------------------------------------------------------------*/ |
@@ -1876,10 +1871,9 @@ allocate_instance(struct device *dev, | |||
1876 | musb = kzalloc(sizeof *musb, GFP_KERNEL); | 1871 | musb = kzalloc(sizeof *musb, GFP_KERNEL); |
1877 | if (!musb) | 1872 | if (!musb) |
1878 | return NULL; | 1873 | return NULL; |
1879 | dev_set_drvdata(dev, musb); | ||
1880 | 1874 | ||
1881 | #endif | 1875 | #endif |
1882 | 1876 | dev_set_drvdata(dev, musb); | |
1883 | musb->mregs = mbase; | 1877 | musb->mregs = mbase; |
1884 | musb->ctrl_base = mbase; | 1878 | musb->ctrl_base = mbase; |
1885 | musb->nIrq = -ENODEV; | 1879 | musb->nIrq = -ENODEV; |
@@ -2191,7 +2185,7 @@ static int __init musb_probe(struct platform_device *pdev) | |||
2191 | void __iomem *base; | 2185 | void __iomem *base; |
2192 | 2186 | ||
2193 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2187 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2194 | if (!iomem || irq == 0) | 2188 | if (!iomem || irq <= 0) |
2195 | return -ENODEV; | 2189 | return -ENODEV; |
2196 | 2190 | ||
2197 | base = ioremap(iomem->start, resource_size(iomem)); | 2191 | base = ioremap(iomem->start, resource_size(iomem)); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index d0c236f8e191..d74a8113ae74 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -488,6 +488,18 @@ struct musb { | |||
488 | unsigned set_address:1; | 488 | unsigned set_address:1; |
489 | unsigned test_mode:1; | 489 | unsigned test_mode:1; |
490 | unsigned softconnect:1; | 490 | unsigned softconnect:1; |
491 | /* | ||
492 | * FIXME: Remove this flag. | ||
493 | * | ||
494 | * This is only added to allow Blackfin to work | ||
495 | * with current driver. For some unknown reason | ||
496 | * Blackfin doesn't work with double buffering | ||
497 | * and that's enabled by default. | ||
498 | * | ||
499 | * We added this flag to forcefully disable double | ||
500 | * buffering until we get it working. | ||
501 | */ | ||
502 | unsigned double_buffer_not_ok:1 __deprecated; | ||
491 | 503 | ||
492 | u8 address; | 504 | u8 address; |
493 | u8 test_mode_nr; | 505 | u8 test_mode_nr; |
diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h index 916065ba9e70..3a97c4e2d4f5 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h | |||
@@ -169,6 +169,9 @@ struct dma_controller { | |||
169 | dma_addr_t dma_addr, | 169 | dma_addr_t dma_addr, |
170 | u32 length); | 170 | u32 length); |
171 | int (*channel_abort)(struct dma_channel *); | 171 | int (*channel_abort)(struct dma_channel *); |
172 | int (*is_compatible)(struct dma_channel *channel, | ||
173 | u16 maxpacket, | ||
174 | void *buf, u32 length); | ||
172 | }; | 175 | }; |
173 | 176 | ||
174 | /* called after channel_program(), may indicate a fault */ | 177 | /* called after channel_program(), may indicate a fault */ |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index ed58c6c8f15c..2fe304611dcf 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -92,11 +92,33 @@ | |||
92 | 92 | ||
93 | /* ----------------------------------------------------------------------- */ | 93 | /* ----------------------------------------------------------------------- */ |
94 | 94 | ||
95 | #define is_buffer_mapped(req) (is_dma_capable() && \ | ||
96 | (req->map_state != UN_MAPPED)) | ||
97 | |||
95 | /* Maps the buffer to dma */ | 98 | /* Maps the buffer to dma */ |
96 | 99 | ||
97 | static inline void map_dma_buffer(struct musb_request *request, | 100 | static inline void map_dma_buffer(struct musb_request *request, |
98 | struct musb *musb) | 101 | struct musb *musb, struct musb_ep *musb_ep) |
99 | { | 102 | { |
103 | int compatible = true; | ||
104 | struct dma_controller *dma = musb->dma_controller; | ||
105 | |||
106 | request->map_state = UN_MAPPED; | ||
107 | |||
108 | if (!is_dma_capable() || !musb_ep->dma) | ||
109 | return; | ||
110 | |||
111 | /* Check if DMA engine can handle this request. | ||
112 | * DMA code must reject the USB request explicitly. | ||
113 | * Default behaviour is to map the request. | ||
114 | */ | ||
115 | if (dma->is_compatible) | ||
116 | compatible = dma->is_compatible(musb_ep->dma, | ||
117 | musb_ep->packet_sz, request->request.buf, | ||
118 | request->request.length); | ||
119 | if (!compatible) | ||
120 | return; | ||
121 | |||
100 | if (request->request.dma == DMA_ADDR_INVALID) { | 122 | if (request->request.dma == DMA_ADDR_INVALID) { |
101 | request->request.dma = dma_map_single( | 123 | request->request.dma = dma_map_single( |
102 | musb->controller, | 124 | musb->controller, |
@@ -105,7 +127,7 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
105 | request->tx | 127 | request->tx |
106 | ? DMA_TO_DEVICE | 128 | ? DMA_TO_DEVICE |
107 | : DMA_FROM_DEVICE); | 129 | : DMA_FROM_DEVICE); |
108 | request->mapped = 1; | 130 | request->map_state = MUSB_MAPPED; |
109 | } else { | 131 | } else { |
110 | dma_sync_single_for_device(musb->controller, | 132 | dma_sync_single_for_device(musb->controller, |
111 | request->request.dma, | 133 | request->request.dma, |
@@ -113,7 +135,7 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
113 | request->tx | 135 | request->tx |
114 | ? DMA_TO_DEVICE | 136 | ? DMA_TO_DEVICE |
115 | : DMA_FROM_DEVICE); | 137 | : DMA_FROM_DEVICE); |
116 | request->mapped = 0; | 138 | request->map_state = PRE_MAPPED; |
117 | } | 139 | } |
118 | } | 140 | } |
119 | 141 | ||
@@ -121,11 +143,14 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
121 | static inline void unmap_dma_buffer(struct musb_request *request, | 143 | static inline void unmap_dma_buffer(struct musb_request *request, |
122 | struct musb *musb) | 144 | struct musb *musb) |
123 | { | 145 | { |
146 | if (!is_buffer_mapped(request)) | ||
147 | return; | ||
148 | |||
124 | if (request->request.dma == DMA_ADDR_INVALID) { | 149 | if (request->request.dma == DMA_ADDR_INVALID) { |
125 | DBG(20, "not unmapping a never mapped buffer\n"); | 150 | DBG(20, "not unmapping a never mapped buffer\n"); |
126 | return; | 151 | return; |
127 | } | 152 | } |
128 | if (request->mapped) { | 153 | if (request->map_state == MUSB_MAPPED) { |
129 | dma_unmap_single(musb->controller, | 154 | dma_unmap_single(musb->controller, |
130 | request->request.dma, | 155 | request->request.dma, |
131 | request->request.length, | 156 | request->request.length, |
@@ -133,16 +158,15 @@ static inline void unmap_dma_buffer(struct musb_request *request, | |||
133 | ? DMA_TO_DEVICE | 158 | ? DMA_TO_DEVICE |
134 | : DMA_FROM_DEVICE); | 159 | : DMA_FROM_DEVICE); |
135 | request->request.dma = DMA_ADDR_INVALID; | 160 | request->request.dma = DMA_ADDR_INVALID; |
136 | request->mapped = 0; | 161 | } else { /* PRE_MAPPED */ |
137 | } else { | ||
138 | dma_sync_single_for_cpu(musb->controller, | 162 | dma_sync_single_for_cpu(musb->controller, |
139 | request->request.dma, | 163 | request->request.dma, |
140 | request->request.length, | 164 | request->request.length, |
141 | request->tx | 165 | request->tx |
142 | ? DMA_TO_DEVICE | 166 | ? DMA_TO_DEVICE |
143 | : DMA_FROM_DEVICE); | 167 | : DMA_FROM_DEVICE); |
144 | |||
145 | } | 168 | } |
169 | request->map_state = UN_MAPPED; | ||
146 | } | 170 | } |
147 | 171 | ||
148 | /* | 172 | /* |
@@ -172,8 +196,7 @@ __acquires(ep->musb->lock) | |||
172 | 196 | ||
173 | ep->busy = 1; | 197 | ep->busy = 1; |
174 | spin_unlock(&musb->lock); | 198 | spin_unlock(&musb->lock); |
175 | if (is_dma_capable() && ep->dma) | 199 | unmap_dma_buffer(req, musb); |
176 | unmap_dma_buffer(req, musb); | ||
177 | if (request->status == 0) | 200 | if (request->status == 0) |
178 | DBG(5, "%s done request %p, %d/%d\n", | 201 | DBG(5, "%s done request %p, %d/%d\n", |
179 | ep->end_point.name, request, | 202 | ep->end_point.name, request, |
@@ -335,7 +358,7 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
335 | csr); | 358 | csr); |
336 | 359 | ||
337 | #ifndef CONFIG_MUSB_PIO_ONLY | 360 | #ifndef CONFIG_MUSB_PIO_ONLY |
338 | if (is_dma_capable() && musb_ep->dma) { | 361 | if (is_buffer_mapped(req)) { |
339 | struct dma_controller *c = musb->dma_controller; | 362 | struct dma_controller *c = musb->dma_controller; |
340 | size_t request_size; | 363 | size_t request_size; |
341 | 364 | ||
@@ -436,8 +459,7 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
436 | * Unmap the dma buffer back to cpu if dma channel | 459 | * Unmap the dma buffer back to cpu if dma channel |
437 | * programming fails | 460 | * programming fails |
438 | */ | 461 | */ |
439 | if (is_dma_capable() && musb_ep->dma) | 462 | unmap_dma_buffer(req, musb); |
440 | unmap_dma_buffer(req, musb); | ||
441 | 463 | ||
442 | musb_write_fifo(musb_ep->hw_ep, fifo_count, | 464 | musb_write_fifo(musb_ep->hw_ep, fifo_count, |
443 | (u8 *) (request->buf + request->actual)); | 465 | (u8 *) (request->buf + request->actual)); |
@@ -627,7 +649,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
627 | return; | 649 | return; |
628 | } | 650 | } |
629 | 651 | ||
630 | if (is_cppi_enabled() && musb_ep->dma) { | 652 | if (is_cppi_enabled() && is_buffer_mapped(req)) { |
631 | struct dma_controller *c = musb->dma_controller; | 653 | struct dma_controller *c = musb->dma_controller; |
632 | struct dma_channel *channel = musb_ep->dma; | 654 | struct dma_channel *channel = musb_ep->dma; |
633 | 655 | ||
@@ -658,7 +680,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
658 | len = musb_readw(epio, MUSB_RXCOUNT); | 680 | len = musb_readw(epio, MUSB_RXCOUNT); |
659 | if (request->actual < request->length) { | 681 | if (request->actual < request->length) { |
660 | #ifdef CONFIG_USB_INVENTRA_DMA | 682 | #ifdef CONFIG_USB_INVENTRA_DMA |
661 | if (is_dma_capable() && musb_ep->dma) { | 683 | if (is_buffer_mapped(req)) { |
662 | struct dma_controller *c; | 684 | struct dma_controller *c; |
663 | struct dma_channel *channel; | 685 | struct dma_channel *channel; |
664 | int use_dma = 0; | 686 | int use_dma = 0; |
@@ -742,7 +764,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
742 | fifo_count = min_t(unsigned, len, fifo_count); | 764 | fifo_count = min_t(unsigned, len, fifo_count); |
743 | 765 | ||
744 | #ifdef CONFIG_USB_TUSB_OMAP_DMA | 766 | #ifdef CONFIG_USB_TUSB_OMAP_DMA |
745 | if (tusb_dma_omap() && musb_ep->dma) { | 767 | if (tusb_dma_omap() && is_buffer_mapped(req)) { |
746 | struct dma_controller *c = musb->dma_controller; | 768 | struct dma_controller *c = musb->dma_controller; |
747 | struct dma_channel *channel = musb_ep->dma; | 769 | struct dma_channel *channel = musb_ep->dma; |
748 | u32 dma_addr = request->dma + request->actual; | 770 | u32 dma_addr = request->dma + request->actual; |
@@ -762,7 +784,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
762 | * programming fails. This buffer is mapped if the | 784 | * programming fails. This buffer is mapped if the |
763 | * channel allocation is successful | 785 | * channel allocation is successful |
764 | */ | 786 | */ |
765 | if (is_dma_capable() && musb_ep->dma) { | 787 | if (is_buffer_mapped(req)) { |
766 | unmap_dma_buffer(req, musb); | 788 | unmap_dma_buffer(req, musb); |
767 | 789 | ||
768 | /* | 790 | /* |
@@ -989,7 +1011,11 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
989 | /* Set TXMAXP with the FIFO size of the endpoint | 1011 | /* Set TXMAXP with the FIFO size of the endpoint |
990 | * to disable double buffering mode. | 1012 | * to disable double buffering mode. |
991 | */ | 1013 | */ |
992 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); | 1014 | if (musb->double_buffer_not_ok) |
1015 | musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); | ||
1016 | else | ||
1017 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | ||
1018 | | (musb_ep->hb_mult << 11)); | ||
993 | 1019 | ||
994 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; | 1020 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; |
995 | if (musb_readw(regs, MUSB_TXCSR) | 1021 | if (musb_readw(regs, MUSB_TXCSR) |
@@ -1025,7 +1051,11 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
1025 | /* Set RXMAXP with the FIFO size of the endpoint | 1051 | /* Set RXMAXP with the FIFO size of the endpoint |
1026 | * to disable double buffering mode. | 1052 | * to disable double buffering mode. |
1027 | */ | 1053 | */ |
1028 | musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); | 1054 | if (musb->double_buffer_not_ok) |
1055 | musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_tx); | ||
1056 | else | ||
1057 | musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | ||
1058 | | (musb_ep->hb_mult << 11)); | ||
1029 | 1059 | ||
1030 | /* force shared fifo to OUT-only mode */ | 1060 | /* force shared fifo to OUT-only mode */ |
1031 | if (hw_ep->is_shared_fifo) { | 1061 | if (hw_ep->is_shared_fifo) { |
@@ -1214,10 +1244,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1214 | request->epnum = musb_ep->current_epnum; | 1244 | request->epnum = musb_ep->current_epnum; |
1215 | request->tx = musb_ep->is_in; | 1245 | request->tx = musb_ep->is_in; |
1216 | 1246 | ||
1217 | if (is_dma_capable() && musb_ep->dma) | 1247 | map_dma_buffer(request, musb, musb_ep); |
1218 | map_dma_buffer(request, musb); | ||
1219 | else | ||
1220 | request->mapped = 0; | ||
1221 | 1248 | ||
1222 | spin_lock_irqsave(&musb->lock, lockflags); | 1249 | spin_lock_irqsave(&musb->lock, lockflags); |
1223 | 1250 | ||
diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h index dec8dc008191..a55354fbccf5 100644 --- a/drivers/usb/musb/musb_gadget.h +++ b/drivers/usb/musb/musb_gadget.h | |||
@@ -35,13 +35,19 @@ | |||
35 | #ifndef __MUSB_GADGET_H | 35 | #ifndef __MUSB_GADGET_H |
36 | #define __MUSB_GADGET_H | 36 | #define __MUSB_GADGET_H |
37 | 37 | ||
38 | enum buffer_map_state { | ||
39 | UN_MAPPED = 0, | ||
40 | PRE_MAPPED, | ||
41 | MUSB_MAPPED | ||
42 | }; | ||
43 | |||
38 | struct musb_request { | 44 | struct musb_request { |
39 | struct usb_request request; | 45 | struct usb_request request; |
40 | struct musb_ep *ep; | 46 | struct musb_ep *ep; |
41 | struct musb *musb; | 47 | struct musb *musb; |
42 | u8 tx; /* endpoint direction */ | 48 | u8 tx; /* endpoint direction */ |
43 | u8 epnum; | 49 | u8 epnum; |
44 | u8 mapped; | 50 | enum buffer_map_state map_state; |
45 | }; | 51 | }; |
46 | 52 | ||
47 | static inline struct musb_request *to_musb_request(struct usb_request *req) | 53 | static inline struct musb_request *to_musb_request(struct usb_request *req) |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 4d5bcb4e14d2..0f523d7db57b 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -609,7 +609,7 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep) | |||
609 | /* Set RXMAXP with the FIFO size of the endpoint | 609 | /* Set RXMAXP with the FIFO size of the endpoint |
610 | * to disable double buffer mode. | 610 | * to disable double buffer mode. |
611 | */ | 611 | */ |
612 | if (musb->hwvers < MUSB_HWVERS_2000) | 612 | if (musb->double_buffer_not_ok) |
613 | musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx); | 613 | musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx); |
614 | else | 614 | else |
615 | musb_writew(ep->regs, MUSB_RXMAXP, | 615 | musb_writew(ep->regs, MUSB_RXMAXP, |
@@ -784,14 +784,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum, | |||
784 | /* protocol/endpoint/interval/NAKlimit */ | 784 | /* protocol/endpoint/interval/NAKlimit */ |
785 | if (epnum) { | 785 | if (epnum) { |
786 | musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); | 786 | musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); |
787 | if (can_bulk_split(musb, qh->type)) | 787 | if (musb->double_buffer_not_ok) |
788 | musb_writew(epio, MUSB_TXMAXP, | 788 | musb_writew(epio, MUSB_TXMAXP, |
789 | packet_sz | 789 | hw_ep->max_packet_sz_tx); |
790 | | ((hw_ep->max_packet_sz_tx / | ||
791 | packet_sz) - 1) << 11); | ||
792 | else | 790 | else |
793 | musb_writew(epio, MUSB_TXMAXP, | 791 | musb_writew(epio, MUSB_TXMAXP, |
794 | packet_sz); | 792 | qh->maxpacket | |
793 | ((qh->hb_mult - 1) << 11)); | ||
795 | musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg); | 794 | musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg); |
796 | } else { | 795 | } else { |
797 | musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg); | 796 | musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg); |
diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h index f763d62f151c..21056c924c74 100644 --- a/drivers/usb/musb/musbhsdma.h +++ b/drivers/usb/musb/musbhsdma.h | |||
@@ -94,24 +94,33 @@ static inline void musb_write_hsdma_addr(void __iomem *mbase, | |||
94 | { | 94 | { |
95 | musb_writew(mbase, | 95 | musb_writew(mbase, |
96 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_LOW), | 96 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_LOW), |
97 | ((u16)((u32) dma_addr & 0xFFFF))); | 97 | dma_addr); |
98 | musb_writew(mbase, | 98 | musb_writew(mbase, |
99 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_HIGH), | 99 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_HIGH), |
100 | ((u16)(((u32) dma_addr >> 16) & 0xFFFF))); | 100 | (dma_addr >> 16)); |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline u32 musb_read_hsdma_count(void __iomem *mbase, u8 bchannel) | 103 | static inline u32 musb_read_hsdma_count(void __iomem *mbase, u8 bchannel) |
104 | { | 104 | { |
105 | return musb_readl(mbase, | 105 | u32 count = musb_readw(mbase, |
106 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH)); | 106 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH)); |
107 | |||
108 | count = count << 16; | ||
109 | |||
110 | count |= musb_readw(mbase, | ||
111 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_LOW)); | ||
112 | |||
113 | return count; | ||
107 | } | 114 | } |
108 | 115 | ||
109 | static inline void musb_write_hsdma_count(void __iomem *mbase, | 116 | static inline void musb_write_hsdma_count(void __iomem *mbase, |
110 | u8 bchannel, u32 len) | 117 | u8 bchannel, u32 len) |
111 | { | 118 | { |
112 | musb_writel(mbase, | 119 | musb_writew(mbase, |
120 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_LOW),len); | ||
121 | musb_writew(mbase, | ||
113 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH), | 122 | MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH), |
114 | len); | 123 | (len >> 16)); |
115 | } | 124 | } |
116 | 125 | ||
117 | #endif /* CONFIG_BLACKFIN */ | 126 | #endif /* CONFIG_BLACKFIN */ |
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index 9fb875d5f09c..9ffc8237fb4b 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig | |||
@@ -103,6 +103,8 @@ config USB_MSM_OTG_72K | |||
103 | required after resetting the hardware and power management. | 103 | required after resetting the hardware and power management. |
104 | This driver is required even for peripheral only or host only | 104 | This driver is required even for peripheral only or host only |
105 | mode configurations. | 105 | mode configurations. |
106 | This driver is not supported on boards like trout which | ||
107 | has an external PHY. | ||
106 | 108 | ||
107 | config AB8500_USB | 109 | config AB8500_USB |
108 | tristate "AB8500 USB Transceiver Driver" | 110 | tristate "AB8500 USB Transceiver Driver" |
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..f349a3629d00 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -100,6 +100,7 @@ struct ftdi_sio_quirk { | |||
100 | static int ftdi_jtag_probe(struct usb_serial *serial); | 100 | static int ftdi_jtag_probe(struct usb_serial *serial); |
101 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); | 101 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); |
102 | static int ftdi_NDI_device_setup(struct usb_serial *serial); | 102 | static int ftdi_NDI_device_setup(struct usb_serial *serial); |
103 | static int ftdi_stmclite_probe(struct usb_serial *serial); | ||
103 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); | 104 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); |
104 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); | 105 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); |
105 | 106 | ||
@@ -123,6 +124,10 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
123 | .port_probe = ftdi_HE_TIRA1_setup, | 124 | .port_probe = ftdi_HE_TIRA1_setup, |
124 | }; | 125 | }; |
125 | 126 | ||
127 | static struct ftdi_sio_quirk ftdi_stmclite_quirk = { | ||
128 | .probe = ftdi_stmclite_probe, | ||
129 | }; | ||
130 | |||
126 | /* | 131 | /* |
127 | * The 8U232AM has the same API as the sio except for: | 132 | * The 8U232AM has the same API as the sio except for: |
128 | * - it can support MUCH higher baudrates; up to: | 133 | * - it can support MUCH higher baudrates; up to: |
@@ -616,6 +621,7 @@ static struct usb_device_id id_table_combined [] = { | |||
616 | { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, | 621 | { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, |
617 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, | 622 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, |
618 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, | 623 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
624 | { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, | ||
619 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, | 625 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, |
620 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, | 626 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
621 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, | 627 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, |
@@ -676,7 +682,17 @@ static struct usb_device_id id_table_combined [] = { | |||
676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | 682 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, | 683 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, |
678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 684 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
679 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 685 | { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, |
686 | { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, | ||
687 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, | ||
688 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, | ||
689 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, | ||
690 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, | ||
691 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, | ||
692 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, | ||
693 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, | ||
694 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, | ||
695 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, | ||
680 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 696 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
681 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 697 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
682 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 698 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
@@ -800,6 +816,8 @@ static struct usb_device_id id_table_combined [] = { | |||
800 | { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, | 816 | { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, |
801 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), | 817 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), |
802 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 818 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
819 | { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), | ||
820 | .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, | ||
803 | { }, /* Optional parameter entry */ | 821 | { }, /* Optional parameter entry */ |
804 | { } /* Terminating entry */ | 822 | { } /* Terminating entry */ |
805 | }; | 823 | }; |
@@ -1699,6 +1717,25 @@ static int ftdi_jtag_probe(struct usb_serial *serial) | |||
1699 | } | 1717 | } |
1700 | 1718 | ||
1701 | /* | 1719 | /* |
1720 | * First and second port on STMCLiteadaptors is reserved for JTAG interface | ||
1721 | * and the forth port for pio | ||
1722 | */ | ||
1723 | static int ftdi_stmclite_probe(struct usb_serial *serial) | ||
1724 | { | ||
1725 | struct usb_device *udev = serial->dev; | ||
1726 | struct usb_interface *interface = serial->interface; | ||
1727 | |||
1728 | dbg("%s", __func__); | ||
1729 | |||
1730 | if (interface == udev->actconfig->interface[2]) | ||
1731 | return 0; | ||
1732 | |||
1733 | dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n"); | ||
1734 | |||
1735 | return -ENODEV; | ||
1736 | } | ||
1737 | |||
1738 | /* | ||
1702 | * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. | 1739 | * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. |
1703 | * We have to correct it if we want to read from it. | 1740 | * We have to correct it if we want to read from it. |
1704 | */ | 1741 | */ |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index bf0867285481..117e8e6f93c6 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -518,6 +518,12 @@ | |||
518 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | 518 | #define RATOC_PRODUCT_ID_USB60F 0xb020 |
519 | 519 | ||
520 | /* | 520 | /* |
521 | * Acton Research Corp. | ||
522 | */ | ||
523 | #define ACTON_VID 0x0647 /* Vendor ID */ | ||
524 | #define ACTON_SPECTRAPRO_PID 0x0100 | ||
525 | |||
526 | /* | ||
521 | * Contec products (http://www.contec.com) | 527 | * Contec products (http://www.contec.com) |
522 | * Submitted by Daniel Sangorrin | 528 | * Submitted by Daniel Sangorrin |
523 | */ | 529 | */ |
@@ -569,11 +575,23 @@ | |||
569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 575 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
570 | 576 | ||
571 | /* | 577 | /* |
572 | * Icom ID-1 digital transceiver | 578 | * Definitions for Icom Inc. devices |
573 | */ | 579 | */ |
574 | 580 | #define ICOM_VID 0x0C26 /* Icom vendor ID */ | |
575 | #define ICOM_ID1_VID 0x0C26 | 581 | /* Note: ID-1 is a communications tranceiver for HAM-radio operators */ |
576 | #define ICOM_ID1_PID 0x0004 | 582 | #define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ |
583 | /* Note: OPC is an Optional cable to connect an Icom Tranceiver */ | ||
584 | #define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ | ||
585 | /* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ | ||
586 | #define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ | ||
587 | #define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */ | ||
588 | #define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/ | ||
589 | #define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */ | ||
590 | #define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */ | ||
591 | #define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */ | ||
592 | #define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */ | ||
593 | #define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */ | ||
594 | #define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */ | ||
577 | 595 | ||
578 | /* | 596 | /* |
579 | * GN Otometrics (http://www.otometrics.com) | 597 | * GN Otometrics (http://www.otometrics.com) |
@@ -1022,6 +1040,12 @@ | |||
1022 | #define WHT_PID 0x0004 /* Wireless Handheld Terminal */ | 1040 | #define WHT_PID 0x0004 /* Wireless Handheld Terminal */ |
1023 | 1041 | ||
1024 | /* | 1042 | /* |
1043 | * STMicroelectonics | ||
1044 | */ | ||
1045 | #define ST_VID 0x0483 | ||
1046 | #define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */ | ||
1047 | |||
1048 | /* | ||
1025 | * Papouch products (http://www.papouch.com/) | 1049 | * Papouch products (http://www.papouch.com/) |
1026 | * Submitted by Folkert van Heusden | 1050 | * Submitted by Folkert van Heusden |
1027 | */ | 1051 | */ |
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_edgeport.c b/drivers/usb/serial/io_edgeport.c index cd769ef24f8a..3b246d93cf22 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2889,8 +2889,8 @@ static void load_application_firmware(struct edgeport_serial *edge_serial) | |||
2889 | 2889 | ||
2890 | dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); | 2890 | dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); |
2891 | 2891 | ||
2892 | edge_serial->product_info.FirmwareMajorVersion = fw->data[0]; | 2892 | edge_serial->product_info.FirmwareMajorVersion = rec->data[0]; |
2893 | edge_serial->product_info.FirmwareMinorVersion = fw->data[1]; | 2893 | edge_serial->product_info.FirmwareMinorVersion = rec->data[1]; |
2894 | edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); | 2894 | edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); |
2895 | 2895 | ||
2896 | for (rec = ihex_next_binrec(rec); rec; | 2896 | for (rec = ihex_next_binrec(rec); rec; |
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/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index b2902f307b47..a910004f4079 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -369,9 +369,9 @@ failed_1port: | |||
369 | 369 | ||
370 | static void __exit ti_exit(void) | 370 | static void __exit ti_exit(void) |
371 | { | 371 | { |
372 | usb_deregister(&ti_usb_driver); | ||
372 | usb_serial_deregister(&ti_1port_device); | 373 | usb_serial_deregister(&ti_1port_device); |
373 | usb_serial_deregister(&ti_2port_device); | 374 | usb_serial_deregister(&ti_2port_device); |
374 | usb_deregister(&ti_usb_driver); | ||
375 | } | 375 | } |
376 | 376 | ||
377 | 377 | ||
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..c1602b8c5594 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. |
@@ -1388,6 +1397,13 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, | |||
1388 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1397 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1389 | US_FL_IGNORE_RESIDUE ), | 1398 | US_FL_IGNORE_RESIDUE ), |
1390 | 1399 | ||
1400 | /* Submitted by Nick Holloway */ | ||
1401 | UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100, | ||
1402 | "VTech", | ||
1403 | "Kidizoom", | ||
1404 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1405 | US_FL_FIX_CAPACITY ), | ||
1406 | |||
1391 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1407 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
1392 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1408 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
1393 | "Sony Ericsson", | 1409 | "Sony Ericsson", |
@@ -1872,6 +1888,22 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
1872 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1888 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1873 | US_FL_NO_READ_DISC_INFO ), | 1889 | US_FL_NO_READ_DISC_INFO ), |
1874 | 1890 | ||
1891 | /* Patch by Richard Schütz <r.schtz@t-online.de> | ||
1892 | * This external hard drive enclosure uses a JMicron chip which | ||
1893 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | ||
1894 | UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000, | ||
1895 | "TrekStor GmbH & Co. KG", | ||
1896 | "DataStation maxi g.u", | ||
1897 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1898 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | ||
1899 | |||
1900 | /* Reported by Jasper Mackenzie <scarletpimpernal@hotmail.com> */ | ||
1901 | UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000, | ||
1902 | "Coby Electronics", | ||
1903 | "MP3 Player", | ||
1904 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1905 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), | ||
1906 | |||
1875 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, | 1907 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
1876 | "ST", | 1908 | "ST", |
1877 | "2A", | 1909 | "2A", |
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c index d583bea608fd..391ac939f011 100644 --- a/drivers/video/arkfb.c +++ b/drivers/video/arkfb.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/svga.h> | 23 | #include <linux/svga.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/console.h> /* Why should fb driver call console functions? because acquire_console_sem() */ | 26 | #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ |
27 | #include <video/vga.h> | 27 | #include <video/vga.h> |
28 | 28 | ||
29 | #ifdef CONFIG_MTRR | 29 | #ifdef CONFIG_MTRR |
@@ -1091,12 +1091,12 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state) | |||
1091 | 1091 | ||
1092 | dev_info(info->device, "suspend\n"); | 1092 | dev_info(info->device, "suspend\n"); |
1093 | 1093 | ||
1094 | acquire_console_sem(); | 1094 | console_lock(); |
1095 | mutex_lock(&(par->open_lock)); | 1095 | mutex_lock(&(par->open_lock)); |
1096 | 1096 | ||
1097 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { | 1097 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { |
1098 | mutex_unlock(&(par->open_lock)); | 1098 | mutex_unlock(&(par->open_lock)); |
1099 | release_console_sem(); | 1099 | console_unlock(); |
1100 | return 0; | 1100 | return 0; |
1101 | } | 1101 | } |
1102 | 1102 | ||
@@ -1107,7 +1107,7 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state) | |||
1107 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1107 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1108 | 1108 | ||
1109 | mutex_unlock(&(par->open_lock)); | 1109 | mutex_unlock(&(par->open_lock)); |
1110 | release_console_sem(); | 1110 | console_unlock(); |
1111 | 1111 | ||
1112 | return 0; | 1112 | return 0; |
1113 | } | 1113 | } |
@@ -1122,7 +1122,7 @@ static int ark_pci_resume (struct pci_dev* dev) | |||
1122 | 1122 | ||
1123 | dev_info(info->device, "resume\n"); | 1123 | dev_info(info->device, "resume\n"); |
1124 | 1124 | ||
1125 | acquire_console_sem(); | 1125 | console_lock(); |
1126 | mutex_lock(&(par->open_lock)); | 1126 | mutex_lock(&(par->open_lock)); |
1127 | 1127 | ||
1128 | if (par->ref_count == 0) | 1128 | if (par->ref_count == 0) |
@@ -1141,7 +1141,7 @@ static int ark_pci_resume (struct pci_dev* dev) | |||
1141 | 1141 | ||
1142 | fail: | 1142 | fail: |
1143 | mutex_unlock(&(par->open_lock)); | 1143 | mutex_unlock(&(par->open_lock)); |
1144 | release_console_sem(); | 1144 | console_unlock(); |
1145 | return 0; | 1145 | return 0; |
1146 | } | 1146 | } |
1147 | #else | 1147 | #else |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index dd9de2e80580..4cb6a576c567 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1860,11 +1860,11 @@ static void aty128_early_resume(void *data) | |||
1860 | { | 1860 | { |
1861 | struct aty128fb_par *par = data; | 1861 | struct aty128fb_par *par = data; |
1862 | 1862 | ||
1863 | if (try_acquire_console_sem()) | 1863 | if (!console_trylock()) |
1864 | return; | 1864 | return; |
1865 | pci_restore_state(par->pdev); | 1865 | pci_restore_state(par->pdev); |
1866 | aty128_do_resume(par->pdev); | 1866 | aty128_do_resume(par->pdev); |
1867 | release_console_sem(); | 1867 | console_unlock(); |
1868 | } | 1868 | } |
1869 | #endif /* CONFIG_PPC_PMAC */ | 1869 | #endif /* CONFIG_PPC_PMAC */ |
1870 | 1870 | ||
@@ -2438,7 +2438,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2438 | 2438 | ||
2439 | printk(KERN_DEBUG "aty128fb: suspending...\n"); | 2439 | printk(KERN_DEBUG "aty128fb: suspending...\n"); |
2440 | 2440 | ||
2441 | acquire_console_sem(); | 2441 | console_lock(); |
2442 | 2442 | ||
2443 | fb_set_suspend(info, 1); | 2443 | fb_set_suspend(info, 1); |
2444 | 2444 | ||
@@ -2470,7 +2470,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2470 | if (state.event != PM_EVENT_ON) | 2470 | if (state.event != PM_EVENT_ON) |
2471 | aty128_set_suspend(par, 1); | 2471 | aty128_set_suspend(par, 1); |
2472 | 2472 | ||
2473 | release_console_sem(); | 2473 | console_unlock(); |
2474 | 2474 | ||
2475 | pdev->dev.power.power_state = state; | 2475 | pdev->dev.power.power_state = state; |
2476 | 2476 | ||
@@ -2527,9 +2527,9 @@ static int aty128_pci_resume(struct pci_dev *pdev) | |||
2527 | { | 2527 | { |
2528 | int rc; | 2528 | int rc; |
2529 | 2529 | ||
2530 | acquire_console_sem(); | 2530 | console_lock(); |
2531 | rc = aty128_do_resume(pdev); | 2531 | rc = aty128_do_resume(pdev); |
2532 | release_console_sem(); | 2532 | console_unlock(); |
2533 | 2533 | ||
2534 | return rc; | 2534 | return rc; |
2535 | } | 2535 | } |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 767ab4fb1a05..94e293fce1d2 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2069,7 +2069,7 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2069 | if (state.event == pdev->dev.power.power_state.event) | 2069 | if (state.event == pdev->dev.power.power_state.event) |
2070 | return 0; | 2070 | return 0; |
2071 | 2071 | ||
2072 | acquire_console_sem(); | 2072 | console_lock(); |
2073 | 2073 | ||
2074 | fb_set_suspend(info, 1); | 2074 | fb_set_suspend(info, 1); |
2075 | 2075 | ||
@@ -2097,14 +2097,14 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2097 | par->lock_blank = 0; | 2097 | par->lock_blank = 0; |
2098 | atyfb_blank(FB_BLANK_UNBLANK, info); | 2098 | atyfb_blank(FB_BLANK_UNBLANK, info); |
2099 | fb_set_suspend(info, 0); | 2099 | fb_set_suspend(info, 0); |
2100 | release_console_sem(); | 2100 | console_unlock(); |
2101 | return -EIO; | 2101 | return -EIO; |
2102 | } | 2102 | } |
2103 | #else | 2103 | #else |
2104 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 2104 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
2105 | #endif | 2105 | #endif |
2106 | 2106 | ||
2107 | release_console_sem(); | 2107 | console_unlock(); |
2108 | 2108 | ||
2109 | pdev->dev.power.power_state = state; | 2109 | pdev->dev.power.power_state = state; |
2110 | 2110 | ||
@@ -2133,7 +2133,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2133 | if (pdev->dev.power.power_state.event == PM_EVENT_ON) | 2133 | if (pdev->dev.power.power_state.event == PM_EVENT_ON) |
2134 | return 0; | 2134 | return 0; |
2135 | 2135 | ||
2136 | acquire_console_sem(); | 2136 | console_lock(); |
2137 | 2137 | ||
2138 | /* | 2138 | /* |
2139 | * PCI state will have been restored by the core, so | 2139 | * PCI state will have been restored by the core, so |
@@ -2161,7 +2161,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2161 | par->lock_blank = 0; | 2161 | par->lock_blank = 0; |
2162 | atyfb_blank(FB_BLANK_UNBLANK, info); | 2162 | atyfb_blank(FB_BLANK_UNBLANK, info); |
2163 | 2163 | ||
2164 | release_console_sem(); | 2164 | console_unlock(); |
2165 | 2165 | ||
2166 | pdev->dev.power.power_state = PMSG_ON; | 2166 | pdev->dev.power.power_state = PMSG_ON; |
2167 | 2167 | ||
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index c4e17642d9c5..92bda5848516 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2626,7 +2626,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
2626 | goto done; | 2626 | goto done; |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | acquire_console_sem(); | 2629 | console_lock(); |
2630 | 2630 | ||
2631 | fb_set_suspend(info, 1); | 2631 | fb_set_suspend(info, 1); |
2632 | 2632 | ||
@@ -2690,7 +2690,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
2690 | if (rinfo->pm_mode & radeon_pm_d2) | 2690 | if (rinfo->pm_mode & radeon_pm_d2) |
2691 | radeon_set_suspend(rinfo, 1); | 2691 | radeon_set_suspend(rinfo, 1); |
2692 | 2692 | ||
2693 | release_console_sem(); | 2693 | console_unlock(); |
2694 | 2694 | ||
2695 | done: | 2695 | done: |
2696 | pdev->dev.power.power_state = mesg; | 2696 | pdev->dev.power.power_state = mesg; |
@@ -2715,10 +2715,10 @@ int radeonfb_pci_resume(struct pci_dev *pdev) | |||
2715 | return 0; | 2715 | return 0; |
2716 | 2716 | ||
2717 | if (rinfo->no_schedule) { | 2717 | if (rinfo->no_schedule) { |
2718 | if (try_acquire_console_sem()) | 2718 | if (!console_trylock()) |
2719 | return 0; | 2719 | return 0; |
2720 | } else | 2720 | } else |
2721 | acquire_console_sem(); | 2721 | console_lock(); |
2722 | 2722 | ||
2723 | printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n", | 2723 | printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n", |
2724 | pci_name(pdev), pdev->dev.power.power_state.event); | 2724 | pci_name(pdev), pdev->dev.power.power_state.event); |
@@ -2783,7 +2783,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev) | |||
2783 | pdev->dev.power.power_state = PMSG_ON; | 2783 | pdev->dev.power.power_state = PMSG_ON; |
2784 | 2784 | ||
2785 | bail: | 2785 | bail: |
2786 | release_console_sem(); | 2786 | console_unlock(); |
2787 | 2787 | ||
2788 | return rc; | 2788 | return rc; |
2789 | } | 2789 | } |
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c index 18c507874ff1..47c21fb2c82f 100644 --- a/drivers/video/bf537-lq035.c +++ b/drivers/video/bf537-lq035.c | |||
@@ -696,6 +696,7 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
696 | { | 696 | { |
697 | struct backlight_properties props; | 697 | struct backlight_properties props; |
698 | dma_addr_t dma_handle; | 698 | dma_addr_t dma_handle; |
699 | int ret; | ||
699 | 700 | ||
700 | if (request_dma(CH_PPI, KBUILD_MODNAME)) { | 701 | if (request_dma(CH_PPI, KBUILD_MODNAME)) { |
701 | pr_err("couldn't request PPI DMA\n"); | 702 | pr_err("couldn't request PPI DMA\n"); |
@@ -704,17 +705,16 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
704 | 705 | ||
705 | if (request_ports()) { | 706 | if (request_ports()) { |
706 | pr_err("couldn't request gpio port\n"); | 707 | pr_err("couldn't request gpio port\n"); |
707 | free_dma(CH_PPI); | 708 | ret = -EFAULT; |
708 | return -EFAULT; | 709 | goto out_ports; |
709 | } | 710 | } |
710 | 711 | ||
711 | fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, | 712 | fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, |
712 | &dma_handle, GFP_KERNEL); | 713 | &dma_handle, GFP_KERNEL); |
713 | if (fb_buffer == NULL) { | 714 | if (fb_buffer == NULL) { |
714 | pr_err("couldn't allocate dma buffer\n"); | 715 | pr_err("couldn't allocate dma buffer\n"); |
715 | free_dma(CH_PPI); | 716 | ret = -ENOMEM; |
716 | free_ports(); | 717 | goto out_dma_coherent; |
717 | return -ENOMEM; | ||
718 | } | 718 | } |
719 | 719 | ||
720 | if (L1_DATA_A_LENGTH) | 720 | if (L1_DATA_A_LENGTH) |
@@ -725,10 +725,8 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
725 | 725 | ||
726 | if (dma_desc_table == NULL) { | 726 | if (dma_desc_table == NULL) { |
727 | pr_err("couldn't allocate dma descriptor\n"); | 727 | pr_err("couldn't allocate dma descriptor\n"); |
728 | free_dma(CH_PPI); | 728 | ret = -ENOMEM; |
729 | free_ports(); | 729 | goto out_table; |
730 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
731 | return -ENOMEM; | ||
732 | } | 730 | } |
733 | 731 | ||
734 | bfin_lq035_fb.screen_base = (void *)fb_buffer; | 732 | bfin_lq035_fb.screen_base = (void *)fb_buffer; |
@@ -771,31 +769,21 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
771 | bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); | 769 | bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); |
772 | if (bfin_lq035_fb.pseudo_palette == NULL) { | 770 | if (bfin_lq035_fb.pseudo_palette == NULL) { |
773 | pr_err("failed to allocate pseudo_palette\n"); | 771 | pr_err("failed to allocate pseudo_palette\n"); |
774 | free_dma(CH_PPI); | 772 | ret = -ENOMEM; |
775 | free_ports(); | 773 | goto out_palette; |
776 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
777 | return -ENOMEM; | ||
778 | } | 774 | } |
779 | 775 | ||
780 | if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { | 776 | if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { |
781 | pr_err("failed to allocate colormap (%d entries)\n", | 777 | pr_err("failed to allocate colormap (%d entries)\n", |
782 | NBR_PALETTE); | 778 | NBR_PALETTE); |
783 | free_dma(CH_PPI); | 779 | ret = -EFAULT; |
784 | free_ports(); | 780 | goto out_cmap; |
785 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
786 | kfree(bfin_lq035_fb.pseudo_palette); | ||
787 | return -EFAULT; | ||
788 | } | 781 | } |
789 | 782 | ||
790 | if (register_framebuffer(&bfin_lq035_fb) < 0) { | 783 | if (register_framebuffer(&bfin_lq035_fb) < 0) { |
791 | pr_err("unable to register framebuffer\n"); | 784 | pr_err("unable to register framebuffer\n"); |
792 | free_dma(CH_PPI); | 785 | ret = -EINVAL; |
793 | free_ports(); | 786 | goto out_reg; |
794 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
795 | fb_buffer = NULL; | ||
796 | kfree(bfin_lq035_fb.pseudo_palette); | ||
797 | fb_dealloc_cmap(&bfin_lq035_fb.cmap); | ||
798 | return -EINVAL; | ||
799 | } | 787 | } |
800 | 788 | ||
801 | i2c_add_driver(&ad5280_driver); | 789 | i2c_add_driver(&ad5280_driver); |
@@ -807,11 +795,31 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
807 | 795 | ||
808 | lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, | 796 | lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, |
809 | &bfin_lcd_ops); | 797 | &bfin_lcd_ops); |
798 | if (IS_ERR(lcd_dev)) { | ||
799 | pr_err("unable to register lcd\n"); | ||
800 | ret = PTR_ERR(lcd_dev); | ||
801 | goto out_lcd; | ||
802 | } | ||
810 | lcd_dev->props.max_contrast = 255, | 803 | lcd_dev->props.max_contrast = 255, |
811 | 804 | ||
812 | pr_info("initialized"); | 805 | pr_info("initialized"); |
813 | 806 | ||
814 | return 0; | 807 | return 0; |
808 | out_lcd: | ||
809 | unregister_framebuffer(&bfin_lq035_fb); | ||
810 | out_reg: | ||
811 | fb_dealloc_cmap(&bfin_lq035_fb.cmap); | ||
812 | out_cmap: | ||
813 | kfree(bfin_lq035_fb.pseudo_palette); | ||
814 | out_palette: | ||
815 | out_table: | ||
816 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
817 | fb_buffer = NULL; | ||
818 | out_dma_coherent: | ||
819 | free_ports(); | ||
820 | out_ports: | ||
821 | free_dma(CH_PPI); | ||
822 | return ret; | ||
815 | } | 823 | } |
816 | 824 | ||
817 | static int __devexit bfin_lq035_remove(struct platform_device *pdev) | 825 | static int __devexit bfin_lq035_remove(struct platform_device *pdev) |
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index d637e1f53172..cff742abdc5d 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c | |||
@@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
460 | if (!(state.event & PM_EVENT_SLEEP)) | 460 | if (!(state.event & PM_EVENT_SLEEP)) |
461 | goto done; | 461 | goto done; |
462 | 462 | ||
463 | acquire_console_sem(); | 463 | console_lock(); |
464 | chipsfb_blank(1, p); | 464 | chipsfb_blank(1, p); |
465 | fb_set_suspend(p, 1); | 465 | fb_set_suspend(p, 1); |
466 | release_console_sem(); | 466 | console_unlock(); |
467 | done: | 467 | done: |
468 | pdev->dev.power.power_state = state; | 468 | pdev->dev.power.power_state = state; |
469 | return 0; | 469 | return 0; |
@@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev) | |||
473 | { | 473 | { |
474 | struct fb_info *p = pci_get_drvdata(pdev); | 474 | struct fb_info *p = pci_get_drvdata(pdev); |
475 | 475 | ||
476 | acquire_console_sem(); | 476 | console_lock(); |
477 | fb_set_suspend(p, 0); | 477 | fb_set_suspend(p, 0); |
478 | chipsfb_blank(0, p); | 478 | chipsfb_blank(0, p); |
479 | release_console_sem(); | 479 | console_unlock(); |
480 | 480 | ||
481 | pdev->dev.power.power_state = PMSG_ON; | 481 | pdev->dev.power.power_state = PMSG_ON; |
482 | return 0; | 482 | return 0; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 7ccc967831f0..9c092b8d64e6 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -375,14 +375,14 @@ static void fb_flashcursor(struct work_struct *work) | |||
375 | int c; | 375 | int c; |
376 | int mode; | 376 | int mode; |
377 | 377 | ||
378 | acquire_console_sem(); | 378 | console_lock(); |
379 | if (ops && ops->currcon != -1) | 379 | if (ops && ops->currcon != -1) |
380 | vc = vc_cons[ops->currcon].d; | 380 | vc = vc_cons[ops->currcon].d; |
381 | 381 | ||
382 | if (!vc || !CON_IS_VISIBLE(vc) || | 382 | if (!vc || !CON_IS_VISIBLE(vc) || |
383 | registered_fb[con2fb_map[vc->vc_num]] != info || | 383 | registered_fb[con2fb_map[vc->vc_num]] != info || |
384 | vc->vc_deccm != 1) { | 384 | vc->vc_deccm != 1) { |
385 | release_console_sem(); | 385 | console_unlock(); |
386 | return; | 386 | return; |
387 | } | 387 | } |
388 | 388 | ||
@@ -392,7 +392,7 @@ static void fb_flashcursor(struct work_struct *work) | |||
392 | CM_ERASE : CM_DRAW; | 392 | CM_ERASE : CM_DRAW; |
393 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), | 393 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), |
394 | get_color(vc, info, c, 0)); | 394 | get_color(vc, info, c, 0)); |
395 | release_console_sem(); | 395 | console_unlock(); |
396 | } | 396 | } |
397 | 397 | ||
398 | static void cursor_timer_handler(unsigned long dev_addr) | 398 | static void cursor_timer_handler(unsigned long dev_addr) |
@@ -836,7 +836,7 @@ static int set_con2fb_map(int unit, int newidx, int user) | |||
836 | 836 | ||
837 | found = search_fb_in_map(newidx); | 837 | found = search_fb_in_map(newidx); |
838 | 838 | ||
839 | acquire_console_sem(); | 839 | console_lock(); |
840 | con2fb_map[unit] = newidx; | 840 | con2fb_map[unit] = newidx; |
841 | if (!err && !found) | 841 | if (!err && !found) |
842 | err = con2fb_acquire_newinfo(vc, info, unit, oldidx); | 842 | err = con2fb_acquire_newinfo(vc, info, unit, oldidx); |
@@ -863,7 +863,7 @@ static int set_con2fb_map(int unit, int newidx, int user) | |||
863 | if (!search_fb_in_map(info_idx)) | 863 | if (!search_fb_in_map(info_idx)) |
864 | info_idx = newidx; | 864 | info_idx = newidx; |
865 | 865 | ||
866 | release_console_sem(); | 866 | console_unlock(); |
867 | return err; | 867 | return err; |
868 | } | 868 | } |
869 | 869 | ||
@@ -3321,7 +3321,7 @@ static ssize_t store_rotate(struct device *device, | |||
3321 | if (fbcon_has_exited) | 3321 | if (fbcon_has_exited) |
3322 | return count; | 3322 | return count; |
3323 | 3323 | ||
3324 | acquire_console_sem(); | 3324 | console_lock(); |
3325 | idx = con2fb_map[fg_console]; | 3325 | idx = con2fb_map[fg_console]; |
3326 | 3326 | ||
3327 | if (idx == -1 || registered_fb[idx] == NULL) | 3327 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3331,7 +3331,7 @@ static ssize_t store_rotate(struct device *device, | |||
3331 | rotate = simple_strtoul(buf, last, 0); | 3331 | rotate = simple_strtoul(buf, last, 0); |
3332 | fbcon_rotate(info, rotate); | 3332 | fbcon_rotate(info, rotate); |
3333 | err: | 3333 | err: |
3334 | release_console_sem(); | 3334 | console_unlock(); |
3335 | return count; | 3335 | return count; |
3336 | } | 3336 | } |
3337 | 3337 | ||
@@ -3346,7 +3346,7 @@ static ssize_t store_rotate_all(struct device *device, | |||
3346 | if (fbcon_has_exited) | 3346 | if (fbcon_has_exited) |
3347 | return count; | 3347 | return count; |
3348 | 3348 | ||
3349 | acquire_console_sem(); | 3349 | console_lock(); |
3350 | idx = con2fb_map[fg_console]; | 3350 | idx = con2fb_map[fg_console]; |
3351 | 3351 | ||
3352 | if (idx == -1 || registered_fb[idx] == NULL) | 3352 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3356,7 +3356,7 @@ static ssize_t store_rotate_all(struct device *device, | |||
3356 | rotate = simple_strtoul(buf, last, 0); | 3356 | rotate = simple_strtoul(buf, last, 0); |
3357 | fbcon_rotate_all(info, rotate); | 3357 | fbcon_rotate_all(info, rotate); |
3358 | err: | 3358 | err: |
3359 | release_console_sem(); | 3359 | console_unlock(); |
3360 | return count; | 3360 | return count; |
3361 | } | 3361 | } |
3362 | 3362 | ||
@@ -3369,7 +3369,7 @@ static ssize_t show_rotate(struct device *device, | |||
3369 | if (fbcon_has_exited) | 3369 | if (fbcon_has_exited) |
3370 | return 0; | 3370 | return 0; |
3371 | 3371 | ||
3372 | acquire_console_sem(); | 3372 | console_lock(); |
3373 | idx = con2fb_map[fg_console]; | 3373 | idx = con2fb_map[fg_console]; |
3374 | 3374 | ||
3375 | if (idx == -1 || registered_fb[idx] == NULL) | 3375 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3378,7 +3378,7 @@ static ssize_t show_rotate(struct device *device, | |||
3378 | info = registered_fb[idx]; | 3378 | info = registered_fb[idx]; |
3379 | rotate = fbcon_get_rotate(info); | 3379 | rotate = fbcon_get_rotate(info); |
3380 | err: | 3380 | err: |
3381 | release_console_sem(); | 3381 | console_unlock(); |
3382 | return snprintf(buf, PAGE_SIZE, "%d\n", rotate); | 3382 | return snprintf(buf, PAGE_SIZE, "%d\n", rotate); |
3383 | } | 3383 | } |
3384 | 3384 | ||
@@ -3392,7 +3392,7 @@ static ssize_t show_cursor_blink(struct device *device, | |||
3392 | if (fbcon_has_exited) | 3392 | if (fbcon_has_exited) |
3393 | return 0; | 3393 | return 0; |
3394 | 3394 | ||
3395 | acquire_console_sem(); | 3395 | console_lock(); |
3396 | idx = con2fb_map[fg_console]; | 3396 | idx = con2fb_map[fg_console]; |
3397 | 3397 | ||
3398 | if (idx == -1 || registered_fb[idx] == NULL) | 3398 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3406,7 +3406,7 @@ static ssize_t show_cursor_blink(struct device *device, | |||
3406 | 3406 | ||
3407 | blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; | 3407 | blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; |
3408 | err: | 3408 | err: |
3409 | release_console_sem(); | 3409 | console_unlock(); |
3410 | return snprintf(buf, PAGE_SIZE, "%d\n", blink); | 3410 | return snprintf(buf, PAGE_SIZE, "%d\n", blink); |
3411 | } | 3411 | } |
3412 | 3412 | ||
@@ -3421,7 +3421,7 @@ static ssize_t store_cursor_blink(struct device *device, | |||
3421 | if (fbcon_has_exited) | 3421 | if (fbcon_has_exited) |
3422 | return count; | 3422 | return count; |
3423 | 3423 | ||
3424 | acquire_console_sem(); | 3424 | console_lock(); |
3425 | idx = con2fb_map[fg_console]; | 3425 | idx = con2fb_map[fg_console]; |
3426 | 3426 | ||
3427 | if (idx == -1 || registered_fb[idx] == NULL) | 3427 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3443,7 +3443,7 @@ static ssize_t store_cursor_blink(struct device *device, | |||
3443 | } | 3443 | } |
3444 | 3444 | ||
3445 | err: | 3445 | err: |
3446 | release_console_sem(); | 3446 | console_unlock(); |
3447 | return count; | 3447 | return count; |
3448 | } | 3448 | } |
3449 | 3449 | ||
@@ -3482,7 +3482,7 @@ static void fbcon_start(void) | |||
3482 | if (num_registered_fb) { | 3482 | if (num_registered_fb) { |
3483 | int i; | 3483 | int i; |
3484 | 3484 | ||
3485 | acquire_console_sem(); | 3485 | console_lock(); |
3486 | 3486 | ||
3487 | for (i = 0; i < FB_MAX; i++) { | 3487 | for (i = 0; i < FB_MAX; i++) { |
3488 | if (registered_fb[i] != NULL) { | 3488 | if (registered_fb[i] != NULL) { |
@@ -3491,7 +3491,7 @@ static void fbcon_start(void) | |||
3491 | } | 3491 | } |
3492 | } | 3492 | } |
3493 | 3493 | ||
3494 | release_console_sem(); | 3494 | console_unlock(); |
3495 | fbcon_takeover(0); | 3495 | fbcon_takeover(0); |
3496 | } | 3496 | } |
3497 | } | 3497 | } |
@@ -3552,7 +3552,7 @@ static int __init fb_console_init(void) | |||
3552 | { | 3552 | { |
3553 | int i; | 3553 | int i; |
3554 | 3554 | ||
3555 | acquire_console_sem(); | 3555 | console_lock(); |
3556 | fb_register_client(&fbcon_event_notifier); | 3556 | fb_register_client(&fbcon_event_notifier); |
3557 | fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, | 3557 | fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, |
3558 | "fbcon"); | 3558 | "fbcon"); |
@@ -3568,7 +3568,7 @@ static int __init fb_console_init(void) | |||
3568 | for (i = 0; i < MAX_NR_CONSOLES; i++) | 3568 | for (i = 0; i < MAX_NR_CONSOLES; i++) |
3569 | con2fb_map[i] = -1; | 3569 | con2fb_map[i] = -1; |
3570 | 3570 | ||
3571 | release_console_sem(); | 3571 | console_unlock(); |
3572 | fbcon_start(); | 3572 | fbcon_start(); |
3573 | return 0; | 3573 | return 0; |
3574 | } | 3574 | } |
@@ -3591,12 +3591,12 @@ static void __exit fbcon_deinit_device(void) | |||
3591 | 3591 | ||
3592 | static void __exit fb_console_exit(void) | 3592 | static void __exit fb_console_exit(void) |
3593 | { | 3593 | { |
3594 | acquire_console_sem(); | 3594 | console_lock(); |
3595 | fb_unregister_client(&fbcon_event_notifier); | 3595 | fb_unregister_client(&fbcon_event_notifier); |
3596 | fbcon_deinit_device(); | 3596 | fbcon_deinit_device(); |
3597 | device_destroy(fb_class, MKDEV(0, 0)); | 3597 | device_destroy(fb_class, MKDEV(0, 0)); |
3598 | fbcon_exit(); | 3598 | fbcon_exit(); |
3599 | release_console_sem(); | 3599 | console_unlock(); |
3600 | unregister_con_driver(&fb_con); | 3600 | unregister_con_driver(&fb_con); |
3601 | } | 3601 | } |
3602 | 3602 | ||
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index c97491b8b39b..915fd74da7a2 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -202,11 +202,7 @@ static void vgacon_scrollback_init(int pitch) | |||
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | /* | 205 | static void vgacon_scrollback_startup(void) |
206 | * Called only duing init so call of alloc_bootmen is ok. | ||
207 | * Marked __init_refok to silence modpost. | ||
208 | */ | ||
209 | static void __init_refok vgacon_scrollback_startup(void) | ||
210 | { | 206 | { |
211 | vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT); | 207 | vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT); |
212 | vgacon_scrollback_init(vga_video_num_columns * 2); | 208 | vgacon_scrollback_init(vga_video_num_columns * 2); |
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index c265aed09e04..8d61ef96eedd 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -1092,9 +1092,10 @@ static int __init fb_probe(struct platform_device *device) | |||
1092 | 1092 | ||
1093 | irq_freq: | 1093 | irq_freq: |
1094 | #ifdef CONFIG_CPU_FREQ | 1094 | #ifdef CONFIG_CPU_FREQ |
1095 | lcd_da8xx_cpufreq_deregister(par); | ||
1096 | #endif | ||
1095 | err_cpu_freq: | 1097 | err_cpu_freq: |
1096 | unregister_framebuffer(da8xx_fb_info); | 1098 | unregister_framebuffer(da8xx_fb_info); |
1097 | #endif | ||
1098 | 1099 | ||
1099 | err_dealloc_cmap: | 1100 | err_dealloc_cmap: |
1100 | fb_dealloc_cmap(&da8xx_fb_info->cmap); | 1101 | fb_dealloc_cmap(&da8xx_fb_info->cmap); |
@@ -1130,14 +1131,14 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state) | |||
1130 | struct fb_info *info = platform_get_drvdata(dev); | 1131 | struct fb_info *info = platform_get_drvdata(dev); |
1131 | struct da8xx_fb_par *par = info->par; | 1132 | struct da8xx_fb_par *par = info->par; |
1132 | 1133 | ||
1133 | acquire_console_sem(); | 1134 | console_lock(); |
1134 | if (par->panel_power_ctrl) | 1135 | if (par->panel_power_ctrl) |
1135 | par->panel_power_ctrl(0); | 1136 | par->panel_power_ctrl(0); |
1136 | 1137 | ||
1137 | fb_set_suspend(info, 1); | 1138 | fb_set_suspend(info, 1); |
1138 | lcd_disable_raster(); | 1139 | lcd_disable_raster(); |
1139 | clk_disable(par->lcdc_clk); | 1140 | clk_disable(par->lcdc_clk); |
1140 | release_console_sem(); | 1141 | console_unlock(); |
1141 | 1142 | ||
1142 | return 0; | 1143 | return 0; |
1143 | } | 1144 | } |
@@ -1146,14 +1147,14 @@ static int fb_resume(struct platform_device *dev) | |||
1146 | struct fb_info *info = platform_get_drvdata(dev); | 1147 | struct fb_info *info = platform_get_drvdata(dev); |
1147 | struct da8xx_fb_par *par = info->par; | 1148 | struct da8xx_fb_par *par = info->par; |
1148 | 1149 | ||
1149 | acquire_console_sem(); | 1150 | console_lock(); |
1150 | if (par->panel_power_ctrl) | 1151 | if (par->panel_power_ctrl) |
1151 | par->panel_power_ctrl(1); | 1152 | par->panel_power_ctrl(1); |
1152 | 1153 | ||
1153 | clk_enable(par->lcdc_clk); | 1154 | clk_enable(par->lcdc_clk); |
1154 | lcd_enable_raster(); | 1155 | lcd_enable_raster(); |
1155 | fb_set_suspend(info, 0); | 1156 | fb_set_suspend(info, 0); |
1156 | release_console_sem(); | 1157 | console_unlock(); |
1157 | 1158 | ||
1158 | return 0; | 1159 | return 0; |
1159 | } | 1160 | } |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 4ac1201ad6c2..e2bf95370e40 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1036,11 +1036,11 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1036 | return -EFAULT; | 1036 | return -EFAULT; |
1037 | if (!lock_fb_info(info)) | 1037 | if (!lock_fb_info(info)) |
1038 | return -ENODEV; | 1038 | return -ENODEV; |
1039 | acquire_console_sem(); | 1039 | console_lock(); |
1040 | info->flags |= FBINFO_MISC_USEREVENT; | 1040 | info->flags |= FBINFO_MISC_USEREVENT; |
1041 | ret = fb_set_var(info, &var); | 1041 | ret = fb_set_var(info, &var); |
1042 | info->flags &= ~FBINFO_MISC_USEREVENT; | 1042 | info->flags &= ~FBINFO_MISC_USEREVENT; |
1043 | release_console_sem(); | 1043 | console_unlock(); |
1044 | unlock_fb_info(info); | 1044 | unlock_fb_info(info); |
1045 | if (!ret && copy_to_user(argp, &var, sizeof(var))) | 1045 | if (!ret && copy_to_user(argp, &var, sizeof(var))) |
1046 | ret = -EFAULT; | 1046 | ret = -EFAULT; |
@@ -1072,9 +1072,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1072 | return -EFAULT; | 1072 | return -EFAULT; |
1073 | if (!lock_fb_info(info)) | 1073 | if (!lock_fb_info(info)) |
1074 | return -ENODEV; | 1074 | return -ENODEV; |
1075 | acquire_console_sem(); | 1075 | console_lock(); |
1076 | ret = fb_pan_display(info, &var); | 1076 | ret = fb_pan_display(info, &var); |
1077 | release_console_sem(); | 1077 | console_unlock(); |
1078 | unlock_fb_info(info); | 1078 | unlock_fb_info(info); |
1079 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) | 1079 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) |
1080 | return -EFAULT; | 1080 | return -EFAULT; |
@@ -1119,11 +1119,11 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1119 | case FBIOBLANK: | 1119 | case FBIOBLANK: |
1120 | if (!lock_fb_info(info)) | 1120 | if (!lock_fb_info(info)) |
1121 | return -ENODEV; | 1121 | return -ENODEV; |
1122 | acquire_console_sem(); | 1122 | console_lock(); |
1123 | info->flags |= FBINFO_MISC_USEREVENT; | 1123 | info->flags |= FBINFO_MISC_USEREVENT; |
1124 | ret = fb_blank(info, arg); | 1124 | ret = fb_blank(info, arg); |
1125 | info->flags &= ~FBINFO_MISC_USEREVENT; | 1125 | info->flags &= ~FBINFO_MISC_USEREVENT; |
1126 | release_console_sem(); | 1126 | console_unlock(); |
1127 | unlock_fb_info(info); | 1127 | unlock_fb_info(info); |
1128 | break; | 1128 | break; |
1129 | default: | 1129 | default: |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 0a08f1341227..f4a32779168b 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -90,11 +90,11 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) | |||
90 | int err; | 90 | int err; |
91 | 91 | ||
92 | var->activate |= FB_ACTIVATE_FORCE; | 92 | var->activate |= FB_ACTIVATE_FORCE; |
93 | acquire_console_sem(); | 93 | console_lock(); |
94 | fb_info->flags |= FBINFO_MISC_USEREVENT; | 94 | fb_info->flags |= FBINFO_MISC_USEREVENT; |
95 | err = fb_set_var(fb_info, var); | 95 | err = fb_set_var(fb_info, var); |
96 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; | 96 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; |
97 | release_console_sem(); | 97 | console_unlock(); |
98 | if (err) | 98 | if (err) |
99 | return err; | 99 | return err; |
100 | return 0; | 100 | return 0; |
@@ -175,7 +175,7 @@ static ssize_t store_modes(struct device *device, | |||
175 | if (i * sizeof(struct fb_videomode) != count) | 175 | if (i * sizeof(struct fb_videomode) != count) |
176 | return -EINVAL; | 176 | return -EINVAL; |
177 | 177 | ||
178 | acquire_console_sem(); | 178 | console_lock(); |
179 | list_splice(&fb_info->modelist, &old_list); | 179 | list_splice(&fb_info->modelist, &old_list); |
180 | fb_videomode_to_modelist((const struct fb_videomode *)buf, i, | 180 | fb_videomode_to_modelist((const struct fb_videomode *)buf, i, |
181 | &fb_info->modelist); | 181 | &fb_info->modelist); |
@@ -185,7 +185,7 @@ static ssize_t store_modes(struct device *device, | |||
185 | } else | 185 | } else |
186 | fb_destroy_modelist(&old_list); | 186 | fb_destroy_modelist(&old_list); |
187 | 187 | ||
188 | release_console_sem(); | 188 | console_unlock(); |
189 | 189 | ||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
@@ -301,11 +301,11 @@ static ssize_t store_blank(struct device *device, | |||
301 | char *last = NULL; | 301 | char *last = NULL; |
302 | int err; | 302 | int err; |
303 | 303 | ||
304 | acquire_console_sem(); | 304 | console_lock(); |
305 | fb_info->flags |= FBINFO_MISC_USEREVENT; | 305 | fb_info->flags |= FBINFO_MISC_USEREVENT; |
306 | err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); | 306 | err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); |
307 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; | 307 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; |
308 | release_console_sem(); | 308 | console_unlock(); |
309 | if (err < 0) | 309 | if (err < 0) |
310 | return err; | 310 | return err; |
311 | return count; | 311 | return count; |
@@ -364,9 +364,9 @@ static ssize_t store_pan(struct device *device, | |||
364 | return -EINVAL; | 364 | return -EINVAL; |
365 | var.yoffset = simple_strtoul(last, &last, 0); | 365 | var.yoffset = simple_strtoul(last, &last, 0); |
366 | 366 | ||
367 | acquire_console_sem(); | 367 | console_lock(); |
368 | err = fb_pan_display(fb_info, &var); | 368 | err = fb_pan_display(fb_info, &var); |
369 | release_console_sem(); | 369 | console_unlock(); |
370 | 370 | ||
371 | if (err < 0) | 371 | if (err < 0) |
372 | return err; | 372 | return err; |
@@ -399,9 +399,9 @@ static ssize_t store_fbstate(struct device *device, | |||
399 | 399 | ||
400 | state = simple_strtoul(buf, &last, 0); | 400 | state = simple_strtoul(buf, &last, 0); |
401 | 401 | ||
402 | acquire_console_sem(); | 402 | console_lock(); |
403 | fb_set_suspend(fb_info, (int)state); | 403 | fb_set_suspend(fb_info, (int)state); |
404 | release_console_sem(); | 404 | console_unlock(); |
405 | 405 | ||
406 | return count; | 406 | return count; |
407 | } | 407 | } |
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index 70b1d9d51c96..b4f19db9bb54 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -344,10 +344,10 @@ static int gxfb_suspend(struct pci_dev *pdev, pm_message_t state) | |||
344 | struct fb_info *info = pci_get_drvdata(pdev); | 344 | struct fb_info *info = pci_get_drvdata(pdev); |
345 | 345 | ||
346 | if (state.event == PM_EVENT_SUSPEND) { | 346 | if (state.event == PM_EVENT_SUSPEND) { |
347 | acquire_console_sem(); | 347 | console_lock(); |
348 | gx_powerdown(info); | 348 | gx_powerdown(info); |
349 | fb_set_suspend(info, 1); | 349 | fb_set_suspend(info, 1); |
350 | release_console_sem(); | 350 | console_unlock(); |
351 | } | 351 | } |
352 | 352 | ||
353 | /* there's no point in setting PCI states; we emulate PCI, so | 353 | /* there's no point in setting PCI states; we emulate PCI, so |
@@ -361,7 +361,7 @@ static int gxfb_resume(struct pci_dev *pdev) | |||
361 | struct fb_info *info = pci_get_drvdata(pdev); | 361 | struct fb_info *info = pci_get_drvdata(pdev); |
362 | int ret; | 362 | int ret; |
363 | 363 | ||
364 | acquire_console_sem(); | 364 | console_lock(); |
365 | ret = gx_powerup(info); | 365 | ret = gx_powerup(info); |
366 | if (ret) { | 366 | if (ret) { |
367 | printk(KERN_ERR "gxfb: power up failed!\n"); | 367 | printk(KERN_ERR "gxfb: power up failed!\n"); |
@@ -369,7 +369,7 @@ static int gxfb_resume(struct pci_dev *pdev) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | fb_set_suspend(info, 0); | 371 | fb_set_suspend(info, 0); |
372 | release_console_sem(); | 372 | console_unlock(); |
373 | return 0; | 373 | return 0; |
374 | } | 374 | } |
375 | #endif | 375 | #endif |
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c index 39bdbedf43b4..416851ca8754 100644 --- a/drivers/video/geode/lxfb_core.c +++ b/drivers/video/geode/lxfb_core.c | |||
@@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev, pm_message_t state) | |||
465 | struct fb_info *info = pci_get_drvdata(pdev); | 465 | struct fb_info *info = pci_get_drvdata(pdev); |
466 | 466 | ||
467 | if (state.event == PM_EVENT_SUSPEND) { | 467 | if (state.event == PM_EVENT_SUSPEND) { |
468 | acquire_console_sem(); | 468 | console_lock(); |
469 | lx_powerdown(info); | 469 | lx_powerdown(info); |
470 | fb_set_suspend(info, 1); | 470 | fb_set_suspend(info, 1); |
471 | release_console_sem(); | 471 | console_unlock(); |
472 | } | 472 | } |
473 | 473 | ||
474 | /* there's no point in setting PCI states; we emulate PCI, so | 474 | /* there's no point in setting PCI states; we emulate PCI, so |
@@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev) | |||
482 | struct fb_info *info = pci_get_drvdata(pdev); | 482 | struct fb_info *info = pci_get_drvdata(pdev); |
483 | int ret; | 483 | int ret; |
484 | 484 | ||
485 | acquire_console_sem(); | 485 | console_lock(); |
486 | ret = lx_powerup(info); | 486 | ret = lx_powerup(info); |
487 | if (ret) { | 487 | if (ret) { |
488 | printk(KERN_ERR "lxfb: power up failed!\n"); | 488 | printk(KERN_ERR "lxfb: power up failed!\n"); |
@@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev) | |||
490 | } | 490 | } |
491 | 491 | ||
492 | fb_set_suspend(info, 0); | 492 | fb_set_suspend(info, 0); |
493 | release_console_sem(); | 493 | console_unlock(); |
494 | return 0; | 494 | return 0; |
495 | } | 495 | } |
496 | #else | 496 | #else |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 5743ea25e818..318f6fb895b2 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -1574,7 +1574,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1574 | return 0; | 1574 | return 0; |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | acquire_console_sem(); | 1577 | console_lock(); |
1578 | fb_set_suspend(info, 1); | 1578 | fb_set_suspend(info, 1); |
1579 | 1579 | ||
1580 | if (info->fbops->fb_sync) | 1580 | if (info->fbops->fb_sync) |
@@ -1587,7 +1587,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1587 | pci_save_state(dev); | 1587 | pci_save_state(dev); |
1588 | pci_disable_device(dev); | 1588 | pci_disable_device(dev); |
1589 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); | 1589 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); |
1590 | release_console_sem(); | 1590 | console_unlock(); |
1591 | 1591 | ||
1592 | return 0; | 1592 | return 0; |
1593 | } | 1593 | } |
@@ -1605,7 +1605,7 @@ static int i810fb_resume(struct pci_dev *dev) | |||
1605 | return 0; | 1605 | return 0; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | acquire_console_sem(); | 1608 | console_lock(); |
1609 | pci_set_power_state(dev, PCI_D0); | 1609 | pci_set_power_state(dev, PCI_D0); |
1610 | pci_restore_state(dev); | 1610 | pci_restore_state(dev); |
1611 | 1611 | ||
@@ -1621,7 +1621,7 @@ static int i810fb_resume(struct pci_dev *dev) | |||
1621 | fb_set_suspend (info, 0); | 1621 | fb_set_suspend (info, 0); |
1622 | info->fbops->fb_blank(VESA_NO_BLANKING, info); | 1622 | info->fbops->fb_blank(VESA_NO_BLANKING, info); |
1623 | fail: | 1623 | fail: |
1624 | release_console_sem(); | 1624 | console_unlock(); |
1625 | return 0; | 1625 | return 0; |
1626 | } | 1626 | } |
1627 | /*********************************************************************** | 1627 | /*********************************************************************** |
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c index 670ecaa0385a..de366937c933 100644 --- a/drivers/video/jz4740_fb.c +++ b/drivers/video/jz4740_fb.c | |||
@@ -778,9 +778,9 @@ static int jzfb_suspend(struct device *dev) | |||
778 | { | 778 | { |
779 | struct jzfb *jzfb = dev_get_drvdata(dev); | 779 | struct jzfb *jzfb = dev_get_drvdata(dev); |
780 | 780 | ||
781 | acquire_console_sem(); | 781 | console_lock(); |
782 | fb_set_suspend(jzfb->fb, 1); | 782 | fb_set_suspend(jzfb->fb, 1); |
783 | release_console_sem(); | 783 | console_unlock(); |
784 | 784 | ||
785 | mutex_lock(&jzfb->lock); | 785 | mutex_lock(&jzfb->lock); |
786 | if (jzfb->is_enabled) | 786 | if (jzfb->is_enabled) |
@@ -800,9 +800,9 @@ static int jzfb_resume(struct device *dev) | |||
800 | jzfb_enable(jzfb); | 800 | jzfb_enable(jzfb); |
801 | mutex_unlock(&jzfb->lock); | 801 | mutex_unlock(&jzfb->lock); |
802 | 802 | ||
803 | acquire_console_sem(); | 803 | console_lock(); |
804 | fb_set_suspend(jzfb->fb, 0); | 804 | fb_set_suspend(jzfb->fb, 0); |
805 | release_console_sem(); | 805 | console_unlock(); |
806 | 806 | ||
807 | return 0; | 807 | return 0; |
808 | } | 808 | } |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index cb013919e9ce..7e3a490e8d76 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -1177,9 +1177,9 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
1177 | struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); | 1177 | struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); |
1178 | struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; | 1178 | struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; |
1179 | 1179 | ||
1180 | acquire_console_sem(); | 1180 | console_lock(); |
1181 | fb_set_suspend(mx3fb->fbi, 1); | 1181 | fb_set_suspend(mx3fb->fbi, 1); |
1182 | release_console_sem(); | 1182 | console_unlock(); |
1183 | 1183 | ||
1184 | if (mx3_fbi->blank == FB_BLANK_UNBLANK) { | 1184 | if (mx3_fbi->blank == FB_BLANK_UNBLANK) { |
1185 | sdc_disable_channel(mx3_fbi); | 1185 | sdc_disable_channel(mx3_fbi); |
@@ -1202,9 +1202,9 @@ static int mx3fb_resume(struct platform_device *pdev) | |||
1202 | sdc_set_brightness(mx3fb, mx3fb->backlight_level); | 1202 | sdc_set_brightness(mx3fb, mx3fb->backlight_level); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | acquire_console_sem(); | 1205 | console_lock(); |
1206 | fb_set_suspend(mx3fb->fbi, 0); | 1206 | fb_set_suspend(mx3fb->fbi, 0); |
1207 | release_console_sem(); | 1207 | console_unlock(); |
1208 | 1208 | ||
1209 | return 0; | 1209 | return 0; |
1210 | } | 1210 | } |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index 62498bd662fc..f838d9e277f0 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
@@ -696,6 +696,8 @@ static int nuc900fb_remove(struct platform_device *pdev) | |||
696 | nuc900fb_stop_lcd(fbinfo); | 696 | nuc900fb_stop_lcd(fbinfo); |
697 | msleep(1); | 697 | msleep(1); |
698 | 698 | ||
699 | unregister_framebuffer(fbinfo); | ||
700 | nuc900fb_cpufreq_deregister(fbi); | ||
699 | nuc900fb_unmap_video_memory(fbinfo); | 701 | nuc900fb_unmap_video_memory(fbinfo); |
700 | 702 | ||
701 | iounmap(fbi->io); | 703 | iounmap(fbi->io); |
@@ -723,7 +725,7 @@ static int nuc900fb_suspend(struct platform_device *dev, pm_message_t state) | |||
723 | struct fb_info *fbinfo = platform_get_drvdata(dev); | 725 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
724 | struct nuc900fb_info *info = fbinfo->par; | 726 | struct nuc900fb_info *info = fbinfo->par; |
725 | 727 | ||
726 | nuc900fb_stop_lcd(); | 728 | nuc900fb_stop_lcd(fbinfo); |
727 | msleep(1); | 729 | msleep(1); |
728 | clk_disable(info->clk); | 730 | clk_disable(info->clk); |
729 | return 0; | 731 | return 0; |
@@ -740,7 +742,7 @@ static int nuc900fb_resume(struct platform_device *dev) | |||
740 | msleep(1); | 742 | msleep(1); |
741 | 743 | ||
742 | nuc900fb_init_registers(fbinfo); | 744 | nuc900fb_init_registers(fbinfo); |
743 | nuc900fb_activate_var(bfinfo); | 745 | nuc900fb_activate_var(fbinfo); |
744 | 746 | ||
745 | return 0; | 747 | return 0; |
746 | } | 748 | } |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index efe10ff86d63..081dc4745274 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -1057,7 +1057,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1057 | 1057 | ||
1058 | if (mesg.event == PM_EVENT_PRETHAW) | 1058 | if (mesg.event == PM_EVENT_PRETHAW) |
1059 | mesg.event = PM_EVENT_FREEZE; | 1059 | mesg.event = PM_EVENT_FREEZE; |
1060 | acquire_console_sem(); | 1060 | console_lock(); |
1061 | par->pm_state = mesg.event; | 1061 | par->pm_state = mesg.event; |
1062 | 1062 | ||
1063 | if (mesg.event & PM_EVENT_SLEEP) { | 1063 | if (mesg.event & PM_EVENT_SLEEP) { |
@@ -1070,7 +1070,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1070 | } | 1070 | } |
1071 | dev->dev.power.power_state = mesg; | 1071 | dev->dev.power.power_state = mesg; |
1072 | 1072 | ||
1073 | release_console_sem(); | 1073 | console_unlock(); |
1074 | return 0; | 1074 | return 0; |
1075 | } | 1075 | } |
1076 | 1076 | ||
@@ -1079,7 +1079,7 @@ static int nvidiafb_resume(struct pci_dev *dev) | |||
1079 | struct fb_info *info = pci_get_drvdata(dev); | 1079 | struct fb_info *info = pci_get_drvdata(dev); |
1080 | struct nvidia_par *par = info->par; | 1080 | struct nvidia_par *par = info->par; |
1081 | 1081 | ||
1082 | acquire_console_sem(); | 1082 | console_lock(); |
1083 | pci_set_power_state(dev, PCI_D0); | 1083 | pci_set_power_state(dev, PCI_D0); |
1084 | 1084 | ||
1085 | if (par->pm_state != PM_EVENT_FREEZE) { | 1085 | if (par->pm_state != PM_EVENT_FREEZE) { |
@@ -1097,7 +1097,7 @@ static int nvidiafb_resume(struct pci_dev *dev) | |||
1097 | nvidiafb_blank(FB_BLANK_UNBLANK, info); | 1097 | nvidiafb_blank(FB_BLANK_UNBLANK, info); |
1098 | 1098 | ||
1099 | fail: | 1099 | fail: |
1100 | release_console_sem(); | 1100 | console_unlock(); |
1101 | return 0; | 1101 | return 0; |
1102 | } | 1102 | } |
1103 | #else | 1103 | #else |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 9c0144ee7ae5..65560a1a0439 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -513,9 +513,9 @@ static int ps3fb_release(struct fb_info *info, int user) | |||
513 | if (atomic_dec_and_test(&ps3fb.f_count)) { | 513 | if (atomic_dec_and_test(&ps3fb.f_count)) { |
514 | if (atomic_read(&ps3fb.ext_flip)) { | 514 | if (atomic_read(&ps3fb.ext_flip)) { |
515 | atomic_set(&ps3fb.ext_flip, 0); | 515 | atomic_set(&ps3fb.ext_flip, 0); |
516 | if (!try_acquire_console_sem()) { | 516 | if (console_trylock()) { |
517 | ps3fb_sync(info, 0); /* single buffer */ | 517 | ps3fb_sync(info, 0); /* single buffer */ |
518 | release_console_sem(); | 518 | console_unlock(); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | } | 521 | } |
@@ -830,14 +830,14 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
830 | if (vmode) { | 830 | if (vmode) { |
831 | var = info->var; | 831 | var = info->var; |
832 | fb_videomode_to_var(&var, vmode); | 832 | fb_videomode_to_var(&var, vmode); |
833 | acquire_console_sem(); | 833 | console_lock(); |
834 | info->flags |= FBINFO_MISC_USEREVENT; | 834 | info->flags |= FBINFO_MISC_USEREVENT; |
835 | /* Force, in case only special bits changed */ | 835 | /* Force, in case only special bits changed */ |
836 | var.activate |= FB_ACTIVATE_FORCE; | 836 | var.activate |= FB_ACTIVATE_FORCE; |
837 | par->new_mode_id = val; | 837 | par->new_mode_id = val; |
838 | retval = fb_set_var(info, &var); | 838 | retval = fb_set_var(info, &var); |
839 | info->flags &= ~FBINFO_MISC_USEREVENT; | 839 | info->flags &= ~FBINFO_MISC_USEREVENT; |
840 | release_console_sem(); | 840 | console_unlock(); |
841 | } | 841 | } |
842 | break; | 842 | break; |
843 | } | 843 | } |
@@ -881,9 +881,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
881 | break; | 881 | break; |
882 | 882 | ||
883 | dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); | 883 | dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); |
884 | acquire_console_sem(); | 884 | console_lock(); |
885 | retval = ps3fb_sync(info, val); | 885 | retval = ps3fb_sync(info, val); |
886 | release_console_sem(); | 886 | console_unlock(); |
887 | break; | 887 | break; |
888 | 888 | ||
889 | default: | 889 | default: |
@@ -903,9 +903,9 @@ static int ps3fbd(void *arg) | |||
903 | set_current_state(TASK_INTERRUPTIBLE); | 903 | set_current_state(TASK_INTERRUPTIBLE); |
904 | if (ps3fb.is_kicked) { | 904 | if (ps3fb.is_kicked) { |
905 | ps3fb.is_kicked = 0; | 905 | ps3fb.is_kicked = 0; |
906 | acquire_console_sem(); | 906 | console_lock(); |
907 | ps3fb_sync(info, 0); /* single buffer */ | 907 | ps3fb_sync(info, 0); /* single buffer */ |
908 | release_console_sem(); | 908 | console_unlock(); |
909 | } | 909 | } |
910 | schedule(); | 910 | schedule(); |
911 | } | 911 | } |
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c index cea6403ae71c..35f61dd0cb3a 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
@@ -701,16 +701,12 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev) | |||
701 | */ | 701 | */ |
702 | pxa168fb_init_mode(info, mi); | 702 | pxa168fb_init_mode(info, mi); |
703 | 703 | ||
704 | ret = pxa168fb_check_var(&info->var, info); | ||
705 | if (ret) | ||
706 | goto failed_free_fbmem; | ||
707 | |||
708 | /* | 704 | /* |
709 | * Fill in sane defaults. | 705 | * Fill in sane defaults. |
710 | */ | 706 | */ |
711 | ret = pxa168fb_check_var(&info->var, info); | 707 | ret = pxa168fb_check_var(&info->var, info); |
712 | if (ret) | 708 | if (ret) |
713 | goto failed; | 709 | goto failed_free_fbmem; |
714 | 710 | ||
715 | /* | 711 | /* |
716 | * enable controller clock | 712 | * enable controller clock |
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index b81168df253d..cf4beb9dc9bb 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * pxa3xx-gc.c - Linux kernel module for PXA3xx graphics controllers | 2 | * pxa3xx-gcu.c - Linux kernel module for PXA3xx graphics controllers |
3 | * | 3 | * |
4 | * This driver needs a DirectFB counterpart in user space, communication | 4 | * This driver needs a DirectFB counterpart in user space, communication |
5 | * is handled via mmap()ed memory areas and an ioctl. | 5 | * is handled via mmap()ed memory areas and an ioctl. |
@@ -421,7 +421,7 @@ pxa3xx_gcu_misc_write(struct file *filp, const char *buff, | |||
421 | buffer->next = priv->free; | 421 | buffer->next = priv->free; |
422 | priv->free = buffer; | 422 | priv->free = buffer; |
423 | spin_unlock_irqrestore(&priv->spinlock, flags); | 423 | spin_unlock_irqrestore(&priv->spinlock, flags); |
424 | return ret; | 424 | return -EFAULT; |
425 | } | 425 | } |
426 | 426 | ||
427 | buffer->length = words; | 427 | buffer->length = words; |
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index dce8c97b4333..75738a928610 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/svga.h> | 22 | #include <linux/svga.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/console.h> /* Why should fb driver call console functions? because acquire_console_sem() */ | 25 | #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ |
26 | #include <video/vga.h> | 26 | #include <video/vga.h> |
27 | 27 | ||
28 | #ifdef CONFIG_MTRR | 28 | #ifdef CONFIG_MTRR |
@@ -1113,12 +1113,12 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
1113 | 1113 | ||
1114 | dev_info(info->device, "suspend\n"); | 1114 | dev_info(info->device, "suspend\n"); |
1115 | 1115 | ||
1116 | acquire_console_sem(); | 1116 | console_lock(); |
1117 | mutex_lock(&(par->open_lock)); | 1117 | mutex_lock(&(par->open_lock)); |
1118 | 1118 | ||
1119 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { | 1119 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { |
1120 | mutex_unlock(&(par->open_lock)); | 1120 | mutex_unlock(&(par->open_lock)); |
1121 | release_console_sem(); | 1121 | console_unlock(); |
1122 | return 0; | 1122 | return 0; |
1123 | } | 1123 | } |
1124 | 1124 | ||
@@ -1129,7 +1129,7 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
1129 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1129 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1130 | 1130 | ||
1131 | mutex_unlock(&(par->open_lock)); | 1131 | mutex_unlock(&(par->open_lock)); |
1132 | release_console_sem(); | 1132 | console_unlock(); |
1133 | 1133 | ||
1134 | return 0; | 1134 | return 0; |
1135 | } | 1135 | } |
@@ -1145,12 +1145,12 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1145 | 1145 | ||
1146 | dev_info(info->device, "resume\n"); | 1146 | dev_info(info->device, "resume\n"); |
1147 | 1147 | ||
1148 | acquire_console_sem(); | 1148 | console_lock(); |
1149 | mutex_lock(&(par->open_lock)); | 1149 | mutex_lock(&(par->open_lock)); |
1150 | 1150 | ||
1151 | if (par->ref_count == 0) { | 1151 | if (par->ref_count == 0) { |
1152 | mutex_unlock(&(par->open_lock)); | 1152 | mutex_unlock(&(par->open_lock)); |
1153 | release_console_sem(); | 1153 | console_unlock(); |
1154 | return 0; | 1154 | return 0; |
1155 | } | 1155 | } |
1156 | 1156 | ||
@@ -1159,7 +1159,7 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1159 | err = pci_enable_device(dev); | 1159 | err = pci_enable_device(dev); |
1160 | if (err) { | 1160 | if (err) { |
1161 | mutex_unlock(&(par->open_lock)); | 1161 | mutex_unlock(&(par->open_lock)); |
1162 | release_console_sem(); | 1162 | console_unlock(); |
1163 | dev_err(info->device, "error %d enabling device for resume\n", err); | 1163 | dev_err(info->device, "error %d enabling device for resume\n", err); |
1164 | return err; | 1164 | return err; |
1165 | } | 1165 | } |
@@ -1169,7 +1169,7 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1169 | fb_set_suspend(info, 0); | 1169 | fb_set_suspend(info, 0); |
1170 | 1170 | ||
1171 | mutex_unlock(&(par->open_lock)); | 1171 | mutex_unlock(&(par->open_lock)); |
1172 | release_console_sem(); | 1172 | console_unlock(); |
1173 | 1173 | ||
1174 | return 0; | 1174 | return 0; |
1175 | } | 1175 | } |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 842d157e1025..487911e2926c 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -2373,7 +2373,7 @@ static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
2373 | if (mesg.event == PM_EVENT_FREEZE) | 2373 | if (mesg.event == PM_EVENT_FREEZE) |
2374 | return 0; | 2374 | return 0; |
2375 | 2375 | ||
2376 | acquire_console_sem(); | 2376 | console_lock(); |
2377 | fb_set_suspend(info, 1); | 2377 | fb_set_suspend(info, 1); |
2378 | 2378 | ||
2379 | if (info->fbops->fb_sync) | 2379 | if (info->fbops->fb_sync) |
@@ -2385,7 +2385,7 @@ static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
2385 | pci_save_state(dev); | 2385 | pci_save_state(dev); |
2386 | pci_disable_device(dev); | 2386 | pci_disable_device(dev); |
2387 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); | 2387 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); |
2388 | release_console_sem(); | 2388 | console_unlock(); |
2389 | 2389 | ||
2390 | return 0; | 2390 | return 0; |
2391 | } | 2391 | } |
@@ -2409,7 +2409,7 @@ static int savagefb_resume(struct pci_dev* dev) | |||
2409 | return 0; | 2409 | return 0; |
2410 | } | 2410 | } |
2411 | 2411 | ||
2412 | acquire_console_sem(); | 2412 | console_lock(); |
2413 | 2413 | ||
2414 | pci_set_power_state(dev, PCI_D0); | 2414 | pci_set_power_state(dev, PCI_D0); |
2415 | pci_restore_state(dev); | 2415 | pci_restore_state(dev); |
@@ -2423,7 +2423,7 @@ static int savagefb_resume(struct pci_dev* dev) | |||
2423 | savagefb_set_par(info); | 2423 | savagefb_set_par(info); |
2424 | fb_set_suspend(info, 0); | 2424 | fb_set_suspend(info, 0); |
2425 | savagefb_blank(FB_BLANK_UNBLANK, info); | 2425 | savagefb_blank(FB_BLANK_UNBLANK, info); |
2426 | release_console_sem(); | 2426 | console_unlock(); |
2427 | 2427 | ||
2428 | return 0; | 2428 | return 0; |
2429 | } | 2429 | } |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 74d9f546a2e8..2b9e56a6bde4 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1151,7 +1151,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1151 | 1151 | ||
1152 | ch = info->par; | 1152 | ch = info->par; |
1153 | 1153 | ||
1154 | acquire_console_sem(); | 1154 | console_lock(); |
1155 | 1155 | ||
1156 | /* HDMI plug in */ | 1156 | /* HDMI plug in */ |
1157 | if (!sh_hdmi_must_reconfigure(hdmi) && | 1157 | if (!sh_hdmi_must_reconfigure(hdmi) && |
@@ -1171,7 +1171,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1171 | fb_set_suspend(info, 0); | 1171 | fb_set_suspend(info, 0); |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | release_console_sem(); | 1174 | console_unlock(); |
1175 | } else { | 1175 | } else { |
1176 | ret = 0; | 1176 | ret = 0; |
1177 | if (!hdmi->info) | 1177 | if (!hdmi->info) |
@@ -1181,12 +1181,12 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1181 | fb_destroy_modedb(hdmi->monspec.modedb); | 1181 | fb_destroy_modedb(hdmi->monspec.modedb); |
1182 | hdmi->monspec.modedb = NULL; | 1182 | hdmi->monspec.modedb = NULL; |
1183 | 1183 | ||
1184 | acquire_console_sem(); | 1184 | console_lock(); |
1185 | 1185 | ||
1186 | /* HDMI disconnect */ | 1186 | /* HDMI disconnect */ |
1187 | fb_set_suspend(hdmi->info, 1); | 1187 | fb_set_suspend(hdmi->info, 1); |
1188 | 1188 | ||
1189 | release_console_sem(); | 1189 | console_unlock(); |
1190 | pm_runtime_put(hdmi->dev); | 1190 | pm_runtime_put(hdmi->dev); |
1191 | } | 1191 | } |
1192 | 1192 | ||
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index bd4840a8a6b7..bf12e53aed5c 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -912,9 +912,9 @@ static int sh_mobile_release(struct fb_info *info, int user) | |||
912 | 912 | ||
913 | /* Nothing to reconfigure, when called from fbcon */ | 913 | /* Nothing to reconfigure, when called from fbcon */ |
914 | if (user) { | 914 | if (user) { |
915 | acquire_console_sem(); | 915 | console_lock(); |
916 | sh_mobile_fb_reconfig(info); | 916 | sh_mobile_fb_reconfig(info); |
917 | release_console_sem(); | 917 | console_unlock(); |
918 | } | 918 | } |
919 | 919 | ||
920 | mutex_unlock(&ch->open_lock); | 920 | mutex_unlock(&ch->open_lock); |
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index b7dc1800efa9..bcb44a594ebc 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -2010,9 +2010,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info, | |||
2010 | 2010 | ||
2011 | /* tell console/fb driver we are suspending */ | 2011 | /* tell console/fb driver we are suspending */ |
2012 | 2012 | ||
2013 | acquire_console_sem(); | 2013 | console_lock(); |
2014 | fb_set_suspend(fbi, 1); | 2014 | fb_set_suspend(fbi, 1); |
2015 | release_console_sem(); | 2015 | console_unlock(); |
2016 | 2016 | ||
2017 | /* backup copies in case chip is powered down over suspend */ | 2017 | /* backup copies in case chip is powered down over suspend */ |
2018 | 2018 | ||
@@ -2069,9 +2069,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info, | |||
2069 | memcpy_toio(par->cursor.k_addr, par->store_cursor, | 2069 | memcpy_toio(par->cursor.k_addr, par->store_cursor, |
2070 | par->cursor.size); | 2070 | par->cursor.size); |
2071 | 2071 | ||
2072 | acquire_console_sem(); | 2072 | console_lock(); |
2073 | fb_set_suspend(fbi, 0); | 2073 | fb_set_suspend(fbi, 0); |
2074 | release_console_sem(); | 2074 | console_unlock(); |
2075 | 2075 | ||
2076 | vfree(par->store_fb); | 2076 | vfree(par->store_fb); |
2077 | vfree(par->store_cursor); | 2077 | vfree(par->store_cursor); |
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c index 6913fe168c25..dfef88c803d4 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/tmiofb.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | /* Why should fb driver call console functions? because acquire_console_sem() */ | 28 | /* Why should fb driver call console functions? because console_lock() */ |
29 | #include <linux/console.h> | 29 | #include <linux/console.h> |
30 | #include <linux/mfd/core.h> | 30 | #include <linux/mfd/core.h> |
31 | #include <linux/mfd/tmio.h> | 31 | #include <linux/mfd/tmio.h> |
@@ -944,7 +944,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state) | |||
944 | struct mfd_cell *cell = dev->dev.platform_data; | 944 | struct mfd_cell *cell = dev->dev.platform_data; |
945 | int retval = 0; | 945 | int retval = 0; |
946 | 946 | ||
947 | acquire_console_sem(); | 947 | console_lock(); |
948 | 948 | ||
949 | fb_set_suspend(info, 1); | 949 | fb_set_suspend(info, 1); |
950 | 950 | ||
@@ -965,7 +965,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state) | |||
965 | if (cell->suspend) | 965 | if (cell->suspend) |
966 | retval = cell->suspend(dev); | 966 | retval = cell->suspend(dev); |
967 | 967 | ||
968 | release_console_sem(); | 968 | console_unlock(); |
969 | 969 | ||
970 | return retval; | 970 | return retval; |
971 | } | 971 | } |
@@ -976,7 +976,7 @@ static int tmiofb_resume(struct platform_device *dev) | |||
976 | struct mfd_cell *cell = dev->dev.platform_data; | 976 | struct mfd_cell *cell = dev->dev.platform_data; |
977 | int retval = 0; | 977 | int retval = 0; |
978 | 978 | ||
979 | acquire_console_sem(); | 979 | console_lock(); |
980 | 980 | ||
981 | if (cell->resume) { | 981 | if (cell->resume) { |
982 | retval = cell->resume(dev); | 982 | retval = cell->resume(dev); |
@@ -992,7 +992,7 @@ static int tmiofb_resume(struct platform_device *dev) | |||
992 | 992 | ||
993 | fb_set_suspend(info, 0); | 993 | fb_set_suspend(info, 0); |
994 | out: | 994 | out: |
995 | release_console_sem(); | 995 | console_unlock(); |
996 | return retval; | 996 | return retval; |
997 | } | 997 | } |
998 | #else | 998 | #else |
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 289edd519527..4e66349e4366 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -1674,17 +1674,17 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres) | |||
1674 | #ifdef CONFIG_PM | 1674 | #ifdef CONFIG_PM |
1675 | static int viafb_suspend(void *unused) | 1675 | static int viafb_suspend(void *unused) |
1676 | { | 1676 | { |
1677 | acquire_console_sem(); | 1677 | console_lock(); |
1678 | fb_set_suspend(viafbinfo, 1); | 1678 | fb_set_suspend(viafbinfo, 1); |
1679 | viafb_sync(viafbinfo); | 1679 | viafb_sync(viafbinfo); |
1680 | release_console_sem(); | 1680 | console_unlock(); |
1681 | 1681 | ||
1682 | return 0; | 1682 | return 0; |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | static int viafb_resume(void *unused) | 1685 | static int viafb_resume(void *unused) |
1686 | { | 1686 | { |
1687 | acquire_console_sem(); | 1687 | console_lock(); |
1688 | if (viaparinfo->shared->vdev->engine_mmio) | 1688 | if (viaparinfo->shared->vdev->engine_mmio) |
1689 | viafb_reset_engine(viaparinfo); | 1689 | viafb_reset_engine(viaparinfo); |
1690 | viafb_set_par(viafbinfo); | 1690 | viafb_set_par(viafbinfo); |
@@ -1692,7 +1692,7 @@ static int viafb_resume(void *unused) | |||
1692 | viafb_set_par(viafbinfo1); | 1692 | viafb_set_par(viafbinfo1); |
1693 | fb_set_suspend(viafbinfo, 0); | 1693 | fb_set_suspend(viafbinfo, 0); |
1694 | 1694 | ||
1695 | release_console_sem(); | 1695 | console_unlock(); |
1696 | return 0; | 1696 | return 0; |
1697 | } | 1697 | } |
1698 | 1698 | ||
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c index 85d76ec4c63e..a2965ab92cfb 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/vt8623fb.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/svga.h> | 23 | #include <linux/svga.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/console.h> /* Why should fb driver call console functions? because acquire_console_sem() */ | 26 | #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ |
27 | #include <video/vga.h> | 27 | #include <video/vga.h> |
28 | 28 | ||
29 | #ifdef CONFIG_MTRR | 29 | #ifdef CONFIG_MTRR |
@@ -819,12 +819,12 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
819 | 819 | ||
820 | dev_info(info->device, "suspend\n"); | 820 | dev_info(info->device, "suspend\n"); |
821 | 821 | ||
822 | acquire_console_sem(); | 822 | console_lock(); |
823 | mutex_lock(&(par->open_lock)); | 823 | mutex_lock(&(par->open_lock)); |
824 | 824 | ||
825 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { | 825 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { |
826 | mutex_unlock(&(par->open_lock)); | 826 | mutex_unlock(&(par->open_lock)); |
827 | release_console_sem(); | 827 | console_unlock(); |
828 | return 0; | 828 | return 0; |
829 | } | 829 | } |
830 | 830 | ||
@@ -835,7 +835,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
835 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 835 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
836 | 836 | ||
837 | mutex_unlock(&(par->open_lock)); | 837 | mutex_unlock(&(par->open_lock)); |
838 | release_console_sem(); | 838 | console_unlock(); |
839 | 839 | ||
840 | return 0; | 840 | return 0; |
841 | } | 841 | } |
@@ -850,7 +850,7 @@ static int vt8623_pci_resume(struct pci_dev* dev) | |||
850 | 850 | ||
851 | dev_info(info->device, "resume\n"); | 851 | dev_info(info->device, "resume\n"); |
852 | 852 | ||
853 | acquire_console_sem(); | 853 | console_lock(); |
854 | mutex_lock(&(par->open_lock)); | 854 | mutex_lock(&(par->open_lock)); |
855 | 855 | ||
856 | if (par->ref_count == 0) | 856 | if (par->ref_count == 0) |
@@ -869,7 +869,7 @@ static int vt8623_pci_resume(struct pci_dev* dev) | |||
869 | 869 | ||
870 | fail: | 870 | fail: |
871 | mutex_unlock(&(par->open_lock)); | 871 | mutex_unlock(&(par->open_lock)); |
872 | release_console_sem(); | 872 | console_unlock(); |
873 | 873 | ||
874 | return 0; | 874 | return 0; |
875 | } | 875 | } |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index 3e6934d4bea8..a20218c2fda8 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -491,12 +491,12 @@ xenfb_make_preferred_console(void) | |||
491 | if (console_set_on_cmdline) | 491 | if (console_set_on_cmdline) |
492 | return; | 492 | return; |
493 | 493 | ||
494 | acquire_console_sem(); | 494 | console_lock(); |
495 | for_each_console(c) { | 495 | for_each_console(c) { |
496 | if (!strcmp(c->name, "tty") && c->index == 0) | 496 | if (!strcmp(c->name, "tty") && c->index == 0) |
497 | break; | 497 | break; |
498 | } | 498 | } |
499 | release_console_sem(); | 499 | console_unlock(); |
500 | if (c) { | 500 | if (c) { |
501 | unregister_console(c); | 501 | unregister_console(c); |
502 | c->flags |= CON_CONSDEV; | 502 | c->flags |= CON_CONSDEV; |
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index 3a7e9ff8a746..38e96ab90945 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
@@ -593,19 +593,17 @@ static int __devinit omap_hdq_probe(struct platform_device *pdev) | |||
593 | 593 | ||
594 | /* get interface & functional clock objects */ | 594 | /* get interface & functional clock objects */ |
595 | hdq_data->hdq_ick = clk_get(&pdev->dev, "ick"); | 595 | hdq_data->hdq_ick = clk_get(&pdev->dev, "ick"); |
596 | hdq_data->hdq_fck = clk_get(&pdev->dev, "fck"); | 596 | if (IS_ERR(hdq_data->hdq_ick)) { |
597 | dev_dbg(&pdev->dev, "Can't get HDQ ick clock object\n"); | ||
598 | ret = PTR_ERR(hdq_data->hdq_ick); | ||
599 | goto err_ick; | ||
600 | } | ||
597 | 601 | ||
598 | if (IS_ERR(hdq_data->hdq_ick) || IS_ERR(hdq_data->hdq_fck)) { | 602 | hdq_data->hdq_fck = clk_get(&pdev->dev, "fck"); |
599 | dev_dbg(&pdev->dev, "Can't get HDQ clock objects\n"); | 603 | if (IS_ERR(hdq_data->hdq_fck)) { |
600 | if (IS_ERR(hdq_data->hdq_ick)) { | 604 | dev_dbg(&pdev->dev, "Can't get HDQ fck clock object\n"); |
601 | ret = PTR_ERR(hdq_data->hdq_ick); | 605 | ret = PTR_ERR(hdq_data->hdq_fck); |
602 | goto err_clk; | 606 | goto err_fck; |
603 | } | ||
604 | if (IS_ERR(hdq_data->hdq_fck)) { | ||
605 | ret = PTR_ERR(hdq_data->hdq_fck); | ||
606 | clk_put(hdq_data->hdq_ick); | ||
607 | goto err_clk; | ||
608 | } | ||
609 | } | 607 | } |
610 | 608 | ||
611 | hdq_data->hdq_usecount = 0; | 609 | hdq_data->hdq_usecount = 0; |
@@ -665,10 +663,12 @@ err_fnclk: | |||
665 | clk_disable(hdq_data->hdq_ick); | 663 | clk_disable(hdq_data->hdq_ick); |
666 | 664 | ||
667 | err_intfclk: | 665 | err_intfclk: |
668 | clk_put(hdq_data->hdq_ick); | ||
669 | clk_put(hdq_data->hdq_fck); | 666 | clk_put(hdq_data->hdq_fck); |
670 | 667 | ||
671 | err_clk: | 668 | err_fck: |
669 | clk_put(hdq_data->hdq_ick); | ||
670 | |||
671 | err_ick: | ||
672 | iounmap(hdq_data->hdq_base); | 672 | iounmap(hdq_data->hdq_base); |
673 | 673 | ||
674 | err_ioremap: | 674 | err_ioremap: |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 2e2400e7322e..31649b7b672f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -862,12 +862,12 @@ config SBC_EPX_C3_WATCHDOG | |||
862 | 862 | ||
863 | # M68K Architecture | 863 | # M68K Architecture |
864 | 864 | ||
865 | config M548x_WATCHDOG | 865 | config M54xx_WATCHDOG |
866 | tristate "MCF548x watchdog support" | 866 | tristate "MCF54xx watchdog support" |
867 | depends on M548x | 867 | depends on M548x |
868 | help | 868 | help |
869 | To compile this driver as a module, choose M here: the | 869 | To compile this driver as a module, choose M here: the |
870 | module will be called m548x_wdt. | 870 | module will be called m54xx_wdt. |
871 | 871 | ||
872 | # MIPS Architecture | 872 | # MIPS Architecture |
873 | 873 | ||
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index dd776651917c..20e44c4782b3 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -106,7 +106,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o | |||
106 | # M32R Architecture | 106 | # M32R Architecture |
107 | 107 | ||
108 | # M68K Architecture | 108 | # M68K Architecture |
109 | obj-$(CONFIG_M548x_WATCHDOG) += m548x_wdt.o | 109 | obj-$(CONFIG_M54xx_WATCHDOG) += m54xx_wdt.o |
110 | 110 | ||
111 | # MIPS Architecture | 111 | # MIPS Architecture |
112 | obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o | 112 | obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o |
diff --git a/drivers/watchdog/m548x_wdt.c b/drivers/watchdog/m54xx_wdt.c index cabbcfe1c847..4d43286074aa 100644 --- a/drivers/watchdog/m548x_wdt.c +++ b/drivers/watchdog/m54xx_wdt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/watchdog/m548x_wdt.c | 2 | * drivers/watchdog/m54xx_wdt.c |
3 | * | 3 | * |
4 | * Watchdog driver for ColdFire MCF548x processors | 4 | * Watchdog driver for ColdFire MCF547x & MCF548x processors |
5 | * Copyright 2010 (c) Philippe De Muyter <phdm@macqel.be> | 5 | * Copyright 2010 (c) Philippe De Muyter <phdm@macqel.be> |
6 | * | 6 | * |
7 | * Adapted from the IXP4xx watchdog driver, which carries these notices: | 7 | * Adapted from the IXP4xx watchdog driver, which carries these notices: |
@@ -29,8 +29,8 @@ | |||
29 | #include <linux/uaccess.h> | 29 | #include <linux/uaccess.h> |
30 | 30 | ||
31 | #include <asm/coldfire.h> | 31 | #include <asm/coldfire.h> |
32 | #include <asm/m548xsim.h> | 32 | #include <asm/m54xxsim.h> |
33 | #include <asm/m548xgpt.h> | 33 | #include <asm/m54xxgpt.h> |
34 | 34 | ||
35 | static int nowayout = WATCHDOG_NOWAYOUT; | 35 | static int nowayout = WATCHDOG_NOWAYOUT; |
36 | static unsigned int heartbeat = 30; /* (secs) Default is 0.5 minute */ | 36 | static unsigned int heartbeat = 30; /* (secs) Default is 0.5 minute */ |
@@ -76,7 +76,7 @@ static void wdt_keepalive(void) | |||
76 | __raw_writel(gms0, MCF_MBAR + MCF_GPT_GMS0); | 76 | __raw_writel(gms0, MCF_MBAR + MCF_GPT_GMS0); |
77 | } | 77 | } |
78 | 78 | ||
79 | static int m548x_wdt_open(struct inode *inode, struct file *file) | 79 | static int m54xx_wdt_open(struct inode *inode, struct file *file) |
80 | { | 80 | { |
81 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | 81 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) |
82 | return -EBUSY; | 82 | return -EBUSY; |
@@ -86,7 +86,7 @@ static int m548x_wdt_open(struct inode *inode, struct file *file) | |||
86 | return nonseekable_open(inode, file); | 86 | return nonseekable_open(inode, file); |
87 | } | 87 | } |
88 | 88 | ||
89 | static ssize_t m548x_wdt_write(struct file *file, const char *data, | 89 | static ssize_t m54xx_wdt_write(struct file *file, const char *data, |
90 | size_t len, loff_t *ppos) | 90 | size_t len, loff_t *ppos) |
91 | { | 91 | { |
92 | if (len) { | 92 | if (len) { |
@@ -112,10 +112,10 @@ static ssize_t m548x_wdt_write(struct file *file, const char *data, | |||
112 | static const struct watchdog_info ident = { | 112 | static const struct watchdog_info ident = { |
113 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | | 113 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | |
114 | WDIOF_KEEPALIVEPING, | 114 | WDIOF_KEEPALIVEPING, |
115 | .identity = "Coldfire M548x Watchdog", | 115 | .identity = "Coldfire M54xx Watchdog", |
116 | }; | 116 | }; |
117 | 117 | ||
118 | static long m548x_wdt_ioctl(struct file *file, unsigned int cmd, | 118 | static long m54xx_wdt_ioctl(struct file *file, unsigned int cmd, |
119 | unsigned long arg) | 119 | unsigned long arg) |
120 | { | 120 | { |
121 | int ret = -ENOTTY; | 121 | int ret = -ENOTTY; |
@@ -161,7 +161,7 @@ static long m548x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
161 | return ret; | 161 | return ret; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int m548x_wdt_release(struct inode *inode, struct file *file) | 164 | static int m54xx_wdt_release(struct inode *inode, struct file *file) |
165 | { | 165 | { |
166 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | 166 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) |
167 | wdt_disable(); | 167 | wdt_disable(); |
@@ -177,45 +177,45 @@ static int m548x_wdt_release(struct inode *inode, struct file *file) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | static const struct file_operations m548x_wdt_fops = { | 180 | static const struct file_operations m54xx_wdt_fops = { |
181 | .owner = THIS_MODULE, | 181 | .owner = THIS_MODULE, |
182 | .llseek = no_llseek, | 182 | .llseek = no_llseek, |
183 | .write = m548x_wdt_write, | 183 | .write = m54xx_wdt_write, |
184 | .unlocked_ioctl = m548x_wdt_ioctl, | 184 | .unlocked_ioctl = m54xx_wdt_ioctl, |
185 | .open = m548x_wdt_open, | 185 | .open = m54xx_wdt_open, |
186 | .release = m548x_wdt_release, | 186 | .release = m54xx_wdt_release, |
187 | }; | 187 | }; |
188 | 188 | ||
189 | static struct miscdevice m548x_wdt_miscdev = { | 189 | static struct miscdevice m54xx_wdt_miscdev = { |
190 | .minor = WATCHDOG_MINOR, | 190 | .minor = WATCHDOG_MINOR, |
191 | .name = "watchdog", | 191 | .name = "watchdog", |
192 | .fops = &m548x_wdt_fops, | 192 | .fops = &m54xx_wdt_fops, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | static int __init m548x_wdt_init(void) | 195 | static int __init m54xx_wdt_init(void) |
196 | { | 196 | { |
197 | if (!request_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4, | 197 | if (!request_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4, |
198 | "Coldfire M548x Watchdog")) { | 198 | "Coldfire M54xx Watchdog")) { |
199 | printk(KERN_WARNING | 199 | printk(KERN_WARNING |
200 | "Coldfire M548x Watchdog : I/O region busy\n"); | 200 | "Coldfire M54xx Watchdog : I/O region busy\n"); |
201 | return -EBUSY; | 201 | return -EBUSY; |
202 | } | 202 | } |
203 | printk(KERN_INFO "ColdFire watchdog driver is loaded.\n"); | 203 | printk(KERN_INFO "ColdFire watchdog driver is loaded.\n"); |
204 | 204 | ||
205 | return misc_register(&m548x_wdt_miscdev); | 205 | return misc_register(&m54xx_wdt_miscdev); |
206 | } | 206 | } |
207 | 207 | ||
208 | static void __exit m548x_wdt_exit(void) | 208 | static void __exit m54xx_wdt_exit(void) |
209 | { | 209 | { |
210 | misc_deregister(&m548x_wdt_miscdev); | 210 | misc_deregister(&m54xx_wdt_miscdev); |
211 | release_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4); | 211 | release_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4); |
212 | } | 212 | } |
213 | 213 | ||
214 | module_init(m548x_wdt_init); | 214 | module_init(m54xx_wdt_init); |
215 | module_exit(m548x_wdt_exit); | 215 | module_exit(m54xx_wdt_exit); |
216 | 216 | ||
217 | MODULE_AUTHOR("Philippe De Muyter <phdm@macqel.be>"); | 217 | MODULE_AUTHOR("Philippe De Muyter <phdm@macqel.be>"); |
218 | MODULE_DESCRIPTION("Coldfire M548x Watchdog"); | 218 | MODULE_DESCRIPTION("Coldfire M54xx Watchdog"); |
219 | 219 | ||
220 | module_param(heartbeat, int, 0); | 220 | module_param(heartbeat, int, 0); |
221 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 30s)"); | 221 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 30s)"); |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index db8c4c4ac880..24177272bcb8 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -37,11 +37,19 @@ static enum shutdown_state shutting_down = SHUTDOWN_INVALID; | |||
37 | #ifdef CONFIG_PM_SLEEP | 37 | #ifdef CONFIG_PM_SLEEP |
38 | static int xen_hvm_suspend(void *data) | 38 | static int xen_hvm_suspend(void *data) |
39 | { | 39 | { |
40 | int err; | ||
40 | struct sched_shutdown r = { .reason = SHUTDOWN_suspend }; | 41 | struct sched_shutdown r = { .reason = SHUTDOWN_suspend }; |
41 | int *cancelled = data; | 42 | int *cancelled = data; |
42 | 43 | ||
43 | BUG_ON(!irqs_disabled()); | 44 | BUG_ON(!irqs_disabled()); |
44 | 45 | ||
46 | err = sysdev_suspend(PMSG_SUSPEND); | ||
47 | if (err) { | ||
48 | printk(KERN_ERR "xen_hvm_suspend: sysdev_suspend failed: %d\n", | ||
49 | err); | ||
50 | return err; | ||
51 | } | ||
52 | |||
45 | *cancelled = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); | 53 | *cancelled = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); |
46 | 54 | ||
47 | xen_hvm_post_suspend(*cancelled); | 55 | xen_hvm_post_suspend(*cancelled); |
@@ -53,6 +61,8 @@ static int xen_hvm_suspend(void *data) | |||
53 | xen_timer_resume(); | 61 | xen_timer_resume(); |
54 | } | 62 | } |
55 | 63 | ||
64 | sysdev_resume(); | ||
65 | |||
56 | return 0; | 66 | return 0; |
57 | } | 67 | } |
58 | 68 | ||