diff options
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r-- | drivers/mmc/sdhci.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 4dab5ec392ea..20711acb0120 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -35,6 +35,8 @@ static unsigned int debug_quirks = 0; | |||
35 | 35 | ||
36 | #define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) | 36 | #define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) |
37 | #define SDHCI_QUIRK_FORCE_DMA (1<<1) | 37 | #define SDHCI_QUIRK_FORCE_DMA (1<<1) |
38 | /* Controller doesn't like some resets when there is no card inserted. */ | ||
39 | #define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2) | ||
38 | 40 | ||
39 | static const struct pci_device_id pci_ids[] __devinitdata = { | 41 | static const struct pci_device_id pci_ids[] __devinitdata = { |
40 | { | 42 | { |
@@ -51,7 +53,8 @@ static const struct pci_device_id pci_ids[] __devinitdata = { | |||
51 | .device = PCI_DEVICE_ID_RICOH_R5C822, | 53 | .device = PCI_DEVICE_ID_RICOH_R5C822, |
52 | .subvendor = PCI_ANY_ID, | 54 | .subvendor = PCI_ANY_ID, |
53 | .subdevice = PCI_ANY_ID, | 55 | .subdevice = PCI_ANY_ID, |
54 | .driver_data = SDHCI_QUIRK_FORCE_DMA, | 56 | .driver_data = SDHCI_QUIRK_FORCE_DMA | |
57 | SDHCI_QUIRK_NO_CARD_NO_RESET, | ||
55 | }, | 58 | }, |
56 | 59 | ||
57 | { | 60 | { |
@@ -125,6 +128,12 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask) | |||
125 | { | 128 | { |
126 | unsigned long timeout; | 129 | unsigned long timeout; |
127 | 130 | ||
131 | if (host->chip->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) { | ||
132 | if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & | ||
133 | SDHCI_CARD_PRESENT)) | ||
134 | return; | ||
135 | } | ||
136 | |||
128 | writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); | 137 | writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); |
129 | 138 | ||
130 | if (mask & SDHCI_RESET_ALL) | 139 | if (mask & SDHCI_RESET_ALL) |
@@ -717,6 +726,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
717 | } else | 726 | } else |
718 | sdhci_send_command(host, mrq->cmd); | 727 | sdhci_send_command(host, mrq->cmd); |
719 | 728 | ||
729 | mmiowb(); | ||
720 | spin_unlock_irqrestore(&host->lock, flags); | 730 | spin_unlock_irqrestore(&host->lock, flags); |
721 | } | 731 | } |
722 | 732 | ||
@@ -753,6 +763,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
753 | ctrl &= ~SDHCI_CTRL_4BITBUS; | 763 | ctrl &= ~SDHCI_CTRL_4BITBUS; |
754 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); | 764 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); |
755 | 765 | ||
766 | mmiowb(); | ||
756 | spin_unlock_irqrestore(&host->lock, flags); | 767 | spin_unlock_irqrestore(&host->lock, flags); |
757 | } | 768 | } |
758 | 769 | ||
@@ -860,6 +871,7 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
860 | 871 | ||
861 | sdhci_deactivate_led(host); | 872 | sdhci_deactivate_led(host); |
862 | 873 | ||
874 | mmiowb(); | ||
863 | spin_unlock_irqrestore(&host->lock, flags); | 875 | spin_unlock_irqrestore(&host->lock, flags); |
864 | 876 | ||
865 | mmc_request_done(host->mmc, mrq); | 877 | mmc_request_done(host->mmc, mrq); |
@@ -893,6 +905,7 @@ static void sdhci_timeout_timer(unsigned long data) | |||
893 | } | 905 | } |
894 | } | 906 | } |
895 | 907 | ||
908 | mmiowb(); | ||
896 | spin_unlock_irqrestore(&host->lock, flags); | 909 | spin_unlock_irqrestore(&host->lock, flags); |
897 | } | 910 | } |
898 | 911 | ||
@@ -1030,6 +1043,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
1030 | 1043 | ||
1031 | result = IRQ_HANDLED; | 1044 | result = IRQ_HANDLED; |
1032 | 1045 | ||
1046 | mmiowb(); | ||
1033 | out: | 1047 | out: |
1034 | spin_unlock(&host->lock); | 1048 | spin_unlock(&host->lock); |
1035 | 1049 | ||
@@ -1095,6 +1109,7 @@ static int sdhci_resume (struct pci_dev *pdev) | |||
1095 | if (chip->hosts[i]->flags & SDHCI_USE_DMA) | 1109 | if (chip->hosts[i]->flags & SDHCI_USE_DMA) |
1096 | pci_set_master(pdev); | 1110 | pci_set_master(pdev); |
1097 | sdhci_init(chip->hosts[i]); | 1111 | sdhci_init(chip->hosts[i]); |
1112 | mmiowb(); | ||
1098 | ret = mmc_resume_host(chip->hosts[i]->mmc); | 1113 | ret = mmc_resume_host(chip->hosts[i]->mmc); |
1099 | if (ret) | 1114 | if (ret) |
1100 | return ret; | 1115 | return ret; |
@@ -1168,6 +1183,9 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1168 | host = mmc_priv(mmc); | 1183 | host = mmc_priv(mmc); |
1169 | host->mmc = mmc; | 1184 | host->mmc = mmc; |
1170 | 1185 | ||
1186 | host->chip = chip; | ||
1187 | chip->hosts[slot] = host; | ||
1188 | |||
1171 | host->bar = first_bar + slot; | 1189 | host->bar = first_bar + slot; |
1172 | 1190 | ||
1173 | host->addr = pci_resource_start(pdev, host->bar); | 1191 | host->addr = pci_resource_start(pdev, host->bar); |
@@ -1324,8 +1342,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1324 | sdhci_dumpregs(host); | 1342 | sdhci_dumpregs(host); |
1325 | #endif | 1343 | #endif |
1326 | 1344 | ||
1327 | host->chip = chip; | 1345 | mmiowb(); |
1328 | chip->hosts[slot] = host; | ||
1329 | 1346 | ||
1330 | mmc_add_host(mmc); | 1347 | mmc_add_host(mmc); |
1331 | 1348 | ||