aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/r852.c30
-rw-r--r--drivers/mtd/nand/r852.h2
2 files changed, 1 insertions, 31 deletions
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 5169ca6a66bc..d9d7efbc77cc 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -757,11 +757,6 @@ static irqreturn_t r852_irq(int irq, void *data)
757 757
758 spin_lock_irqsave(&dev->irqlock, flags); 758 spin_lock_irqsave(&dev->irqlock, flags);
759 759
760 /* We can recieve shared interrupt while pci is suspended
761 in that case reads will return 0xFFFFFFFF.... */
762 if (dev->insuspend)
763 goto out;
764
765 /* handle card detection interrupts first */ 760 /* handle card detection interrupts first */
766 card_status = r852_read_reg(dev, R852_CARD_IRQ_STA); 761 card_status = r852_read_reg(dev, R852_CARD_IRQ_STA);
767 r852_write_reg(dev, R852_CARD_IRQ_STA, card_status); 762 r852_write_reg(dev, R852_CARD_IRQ_STA, card_status);
@@ -1035,7 +1030,6 @@ void r852_shutdown(struct pci_dev *pci_dev)
1035int r852_suspend(struct device *device) 1030int r852_suspend(struct device *device)
1036{ 1031{
1037 struct r852_device *dev = pci_get_drvdata(to_pci_dev(device)); 1032 struct r852_device *dev = pci_get_drvdata(to_pci_dev(device));
1038 unsigned long flags;
1039 1033
1040 if (dev->ctlreg & R852_CTL_CARDENABLE) 1034 if (dev->ctlreg & R852_CTL_CARDENABLE)
1041 return -EBUSY; 1035 return -EBUSY;
@@ -1047,43 +1041,22 @@ int r852_suspend(struct device *device)
1047 r852_disable_irqs(dev); 1041 r852_disable_irqs(dev);
1048 r852_engine_disable(dev); 1042 r852_engine_disable(dev);
1049 1043
1050 spin_lock_irqsave(&dev->irqlock, flags);
1051 dev->insuspend = 1;
1052 spin_unlock_irqrestore(&dev->irqlock, flags);
1053
1054 /* At that point, even if interrupt handler is running, it will quit */
1055 /* So wait for this to happen explictly */
1056 synchronize_irq(dev->irq);
1057
1058 /* If card was pulled off just during the suspend, which is very 1044 /* If card was pulled off just during the suspend, which is very
1059 unlikely, we will remove it on resume, it too late now 1045 unlikely, we will remove it on resume, it too late now
1060 anyway... */ 1046 anyway... */
1061 dev->card_unstable = 0; 1047 dev->card_unstable = 0;
1062 1048 return 0;
1063 pci_save_state(to_pci_dev(device));
1064 return pci_prepare_to_sleep(to_pci_dev(device));
1065} 1049}
1066 1050
1067int r852_resume(struct device *device) 1051int r852_resume(struct device *device)
1068{ 1052{
1069 struct r852_device *dev = pci_get_drvdata(to_pci_dev(device)); 1053 struct r852_device *dev = pci_get_drvdata(to_pci_dev(device));
1070 unsigned long flags;
1071
1072 /* Turn on the hardware */
1073 pci_back_from_sleep(to_pci_dev(device));
1074 pci_restore_state(to_pci_dev(device));
1075 1054
1076 r852_disable_irqs(dev); 1055 r852_disable_irqs(dev);
1077 r852_card_update_present(dev); 1056 r852_card_update_present(dev);
1078 r852_engine_disable(dev); 1057 r852_engine_disable(dev);
1079 1058
1080 1059
1081 /* Now its safe for IRQ to run */
1082 spin_lock_irqsave(&dev->irqlock, flags);
1083 dev->insuspend = 0;
1084 spin_unlock_irqrestore(&dev->irqlock, flags);
1085
1086
1087 /* If card status changed, just do the work */ 1060 /* If card status changed, just do the work */
1088 if (dev->card_detected != dev->card_registred) { 1061 if (dev->card_detected != dev->card_registred) {
1089 dbg("card was %s during low power state", 1062 dbg("card was %s during low power state",
@@ -1121,7 +1094,6 @@ MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl);
1121 1094
1122SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume); 1095SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume);
1123 1096
1124
1125static struct pci_driver r852_pci_driver = { 1097static struct pci_driver r852_pci_driver = {
1126 .name = DRV_NAME, 1098 .name = DRV_NAME,
1127 .id_table = r852_pci_id_tbl, 1099 .id_table = r852_pci_id_tbl,
diff --git a/drivers/mtd/nand/r852.h b/drivers/mtd/nand/r852.h
index 8096cc280c73..e6a21d9d22c6 100644
--- a/drivers/mtd/nand/r852.h
+++ b/drivers/mtd/nand/r852.h
@@ -140,8 +140,6 @@ struct r852_device {
140 /* interrupt handling */ 140 /* interrupt handling */
141 spinlock_t irqlock; /* IRQ protecting lock */ 141 spinlock_t irqlock; /* IRQ protecting lock */
142 int irq; /* irq num */ 142 int irq; /* irq num */
143 int insuspend; /* device is suspended */
144
145 /* misc */ 143 /* misc */
146 void *tmp_buffer; /* temporary buffer */ 144 void *tmp_buffer; /* temporary buffer */
147 uint8_t ctlreg; /* cached contents of control reg */ 145 uint8_t ctlreg; /* cached contents of control reg */