blob: b3b0a3e4fca1652e3ceb1759c0bcbd13bcc1d22e [file] [log] [blame]
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001/* linux/drivers/mmc/host/sdhci-pci.c - SDHCI on PCI bus interface
2 *
3 * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
4 *
5 * 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 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * Thanks to the following companies for their support:
11 *
12 * - JMicron (hardware and technical support)
13 */
14
15#include <linux/delay.h>
16#include <linux/highmem.h>
Paul Gortmaker88b47672011-07-03 15:15:51 -040017#include <linux/module.h>
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010018#include <linux/pci.h>
19#include <linux/dma-mapping.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090020#include <linux/slab.h>
Maxim Levitskyccc92c22010-08-10 18:01:42 -070021#include <linux/device.h>
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010022#include <linux/mmc/host.h>
Adrian Huntere1bfad62015-02-06 14:13:00 +020023#include <linux/mmc/mmc.h>
Ameya Palandeb177bc92011-04-05 21:13:13 +030024#include <linux/scatterlist.h>
25#include <linux/io.h>
Adrian Hunter0f201652011-08-29 16:42:13 +030026#include <linux/gpio.h>
Adrian Hunter66fd8ad2011-10-03 15:33:34 +030027#include <linux/pm_runtime.h>
Adrian Hunterff59c522014-09-24 10:27:31 +030028#include <linux/mmc/slot-gpio.h>
Adrian Hunter52c506f2011-12-27 15:48:43 +020029#include <linux/mmc/sdhci-pci-data.h>
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010030
31#include "sdhci.h"
Adam Lee522624f2013-12-18 22:23:38 +080032#include "sdhci-pci.h"
Adam Lee01acf692013-12-19 00:01:26 +080033#include "sdhci-pci-o2micro.h"
Pierre Ossman22606402008-03-23 19:33:23 +010034
35/*****************************************************************************\
36 * *
37 * Hardware specific quirk handling *
38 * *
39\*****************************************************************************/
40
41static int ricoh_probe(struct sdhci_pci_chip *chip)
42{
Chris Ballc99436f2009-09-22 16:45:22 -070043 if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
44 chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
Pierre Ossman22606402008-03-23 19:33:23 +010045 chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
Maxim Levitskyccc92c22010-08-10 18:01:42 -070046 return 0;
47}
Pierre Ossman22606402008-03-23 19:33:23 +010048
Maxim Levitskyccc92c22010-08-10 18:01:42 -070049static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
50{
51 slot->host->caps =
52 ((0x21 << SDHCI_TIMEOUT_CLK_SHIFT)
53 & SDHCI_TIMEOUT_CLK_MASK) |
54
55 ((0x21 << SDHCI_CLOCK_BASE_SHIFT)
56 & SDHCI_CLOCK_BASE_MASK) |
57
58 SDHCI_TIMEOUT_CLK_UNIT |
59 SDHCI_CAN_VDD_330 |
Madhvapathi Sriram1a1f1f02012-10-15 04:47:30 +000060 SDHCI_CAN_DO_HISPD |
Maxim Levitskyccc92c22010-08-10 18:01:42 -070061 SDHCI_CAN_DO_SDMA;
62 return 0;
63}
64
65static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)
66{
67 /* Apply a delay to allow controller to settle */
68 /* Otherwise it becomes confused if card state changed
69 during suspend */
70 msleep(500);
Pierre Ossman22606402008-03-23 19:33:23 +010071 return 0;
72}
73
74static const struct sdhci_pci_fixes sdhci_ricoh = {
75 .probe = ricoh_probe,
Vasily Khoruzhick84938292010-03-05 13:43:46 -080076 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
77 SDHCI_QUIRK_FORCE_DMA |
78 SDHCI_QUIRK_CLOCK_BEFORE_RESET,
Pierre Ossman22606402008-03-23 19:33:23 +010079};
80
Maxim Levitskyccc92c22010-08-10 18:01:42 -070081static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
82 .probe_slot = ricoh_mmc_probe_slot,
83 .resume = ricoh_mmc_resume,
84 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
85 SDHCI_QUIRK_CLOCK_BEFORE_RESET |
86 SDHCI_QUIRK_NO_CARD_NO_RESET |
87 SDHCI_QUIRK_MISSING_CAPS
88};
89
Pierre Ossman22606402008-03-23 19:33:23 +010090static const struct sdhci_pci_fixes sdhci_ene_712 = {
91 .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
92 SDHCI_QUIRK_BROKEN_DMA,
93};
94
95static const struct sdhci_pci_fixes sdhci_ene_714 = {
96 .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
97 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS |
98 SDHCI_QUIRK_BROKEN_DMA,
99};
100
101static const struct sdhci_pci_fixes sdhci_cafe = {
102 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
Andres Salomona0874892009-03-02 21:48:20 +0100103 SDHCI_QUIRK_NO_BUSY_IRQ |
Daniel Drake55fc05b2012-07-03 23:13:39 +0100104 SDHCI_QUIRK_BROKEN_CARD_DETECTION |
Pierre Ossmanee53ab52008-07-05 00:25:15 +0200105 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
Pierre Ossman22606402008-03-23 19:33:23 +0100106};
107
Derek Browne43e968c2014-06-24 06:56:36 -0700108static const struct sdhci_pci_fixes sdhci_intel_qrk = {
109 .quirks = SDHCI_QUIRK_NO_HISPD_BIT,
110};
111
Major Lee68077b02011-06-29 14:23:46 +0300112static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
113{
114 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
115 return 0;
116}
117
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100118/*
119 * ADMA operation is disabled for Moorestown platform due to
120 * hardware bugs.
121 */
Jacob Pan35ac6f02010-11-09 13:57:29 +0000122static int mrst_hc_probe(struct sdhci_pci_chip *chip)
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100123{
124 /*
Jacob Pan35ac6f02010-11-09 13:57:29 +0000125 * slots number is fixed here for MRST as SDIO3/5 are never used and
126 * have hardware bugs.
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100127 */
128 chip->num_slots = 1;
129 return 0;
130}
131
Alexander Stein296e0b02012-03-14 08:38:58 +0100132static int pch_hc_probe_slot(struct sdhci_pci_slot *slot)
133{
134 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
135 return 0;
136}
137
Rafael J. Wysocki162d6f92014-12-05 03:05:33 +0100138#ifdef CONFIG_PM
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300139
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200140static irqreturn_t sdhci_pci_sd_cd(int irq, void *dev_id)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300141{
142 struct sdhci_pci_slot *slot = dev_id;
143 struct sdhci_host *host = slot->host;
144
145 mmc_detect_change(host->mmc, msecs_to_jiffies(200));
146 return IRQ_HANDLED;
147}
148
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200149static void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300150{
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200151 int err, irq, gpio = slot->cd_gpio;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300152
153 slot->cd_gpio = -EINVAL;
154 slot->cd_irq = -EINVAL;
155
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200156 if (!gpio_is_valid(gpio))
157 return;
158
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300159 err = gpio_request(gpio, "sd_cd");
160 if (err < 0)
161 goto out;
162
163 err = gpio_direction_input(gpio);
164 if (err < 0)
165 goto out_free;
166
167 irq = gpio_to_irq(gpio);
168 if (irq < 0)
169 goto out_free;
170
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200171 err = request_irq(irq, sdhci_pci_sd_cd, IRQF_TRIGGER_RISING |
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300172 IRQF_TRIGGER_FALLING, "sd_cd", slot);
173 if (err)
174 goto out_free;
175
176 slot->cd_gpio = gpio;
177 slot->cd_irq = irq;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300178
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200179 return;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300180
181out_free:
182 gpio_free(gpio);
183out:
184 dev_warn(&slot->chip->pdev->dev, "failed to setup card detect wake up\n");
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300185}
186
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200187static void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300188{
189 if (slot->cd_irq >= 0)
190 free_irq(slot->cd_irq, slot);
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200191 if (gpio_is_valid(slot->cd_gpio))
192 gpio_free(slot->cd_gpio);
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300193}
194
195#else
196
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200197static inline void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
198{
199}
200
201static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
202{
203}
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300204
205#endif
206
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300207static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
208{
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300209 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE;
Adrian Hunterda721cf2012-02-07 14:48:53 +0200210 slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC |
211 MMC_CAP2_HC_ERASE_SZ;
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300212 return 0;
213}
214
Adrian Hunter93933502011-12-27 15:48:47 +0200215static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot)
216{
Adrian Hunter012e4672012-01-30 14:27:18 +0200217 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE;
Adrian Hunter93933502011-12-27 15:48:47 +0200218 return 0;
219}
220
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100221static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
222 .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
Major Lee68077b02011-06-29 14:23:46 +0300223 .probe_slot = mrst_hc_probe_slot,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100224};
225
Jacob Pan35ac6f02010-11-09 13:57:29 +0000226static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100227 .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
Jacob Pan35ac6f02010-11-09 13:57:29 +0000228 .probe = mrst_hc_probe,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100229};
230
Xiaochen Shen29229052010-10-04 15:24:52 +0100231static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
232 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunterc43fd772011-10-17 10:52:44 +0300233 .allow_runtime_pm = true,
Adrian Hunter77a01222014-01-13 09:49:16 +0200234 .own_cd_for_runtime_pm = true,
Xiaochen Shen29229052010-10-04 15:24:52 +0100235};
236
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300237static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
Xiaochen Shen29229052010-10-04 15:24:52 +0100238 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunterf3c55a72012-02-07 14:48:55 +0200239 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON,
Adrian Hunterc43fd772011-10-17 10:52:44 +0300240 .allow_runtime_pm = true,
Adrian Hunter93933502011-12-27 15:48:47 +0200241 .probe_slot = mfd_sdio_probe_slot,
Xiaochen Shen29229052010-10-04 15:24:52 +0100242};
243
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300244static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = {
245 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunterc43fd772011-10-17 10:52:44 +0300246 .allow_runtime_pm = true,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300247 .probe_slot = mfd_emmc_probe_slot,
248};
249
Alexander Stein296e0b02012-03-14 08:38:58 +0100250static const struct sdhci_pci_fixes sdhci_intel_pch_sdio = {
251 .quirks = SDHCI_QUIRK_BROKEN_ADMA,
252 .probe_slot = pch_hc_probe_slot,
253};
254
Adrian Hunterc9faff62013-06-13 11:50:26 +0300255static void sdhci_pci_int_hw_reset(struct sdhci_host *host)
256{
257 u8 reg;
258
259 reg = sdhci_readb(host, SDHCI_POWER_CONTROL);
260 reg |= 0x10;
261 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
262 /* For eMMC, minimum is 1us but give it 9us for good measure */
263 udelay(9);
264 reg &= ~0x10;
265 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
266 /* For eMMC, minimum is 200us but give it 300us for good measure */
267 usleep_range(300, 1000);
268}
269
Adrian Huntere1bfad62015-02-06 14:13:00 +0200270static int spt_select_drive_strength(struct sdhci_host *host,
271 struct mmc_card *card,
272 unsigned int max_dtr,
273 int host_drv, int card_drv, int *drv_type)
274{
275 int drive_strength;
276
277 if (sdhci_pci_spt_drive_strength > 0)
278 drive_strength = sdhci_pci_spt_drive_strength & 0xf;
279 else
280 drive_strength = 1; /* 33-ohm */
281
282 if ((mmc_driver_type_mask(drive_strength) & card_drv) == 0)
283 drive_strength = 0; /* Default 50-ohm */
284
285 return drive_strength;
286}
287
288/* Try to read the drive strength from the card */
289static void spt_read_drive_strength(struct sdhci_host *host)
290{
291 u32 val, i, t;
292 u16 m;
293
294 if (sdhci_pci_spt_drive_strength)
295 return;
296
297 sdhci_pci_spt_drive_strength = -1;
298
299 m = sdhci_readw(host, SDHCI_HOST_CONTROL2) & 0x7;
300 if (m != 3 && m != 5)
301 return;
302 val = sdhci_readl(host, SDHCI_PRESENT_STATE);
303 if (val & 0x3)
304 return;
305 sdhci_writel(host, 0x007f0023, SDHCI_INT_ENABLE);
306 sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
307 sdhci_writew(host, 0x10, SDHCI_TRANSFER_MODE);
308 sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
309 sdhci_writew(host, 512, SDHCI_BLOCK_SIZE);
310 sdhci_writew(host, 1, SDHCI_BLOCK_COUNT);
311 sdhci_writel(host, 0, SDHCI_ARGUMENT);
312 sdhci_writew(host, 0x83b, SDHCI_COMMAND);
313 for (i = 0; i < 1000; i++) {
314 val = sdhci_readl(host, SDHCI_INT_STATUS);
315 if (val & 0xffff8000)
316 return;
317 if (val & 0x20)
318 break;
319 udelay(1);
320 }
321 val = sdhci_readl(host, SDHCI_PRESENT_STATE);
322 if (!(val & 0x800))
323 return;
324 for (i = 0; i < 47; i++)
325 val = sdhci_readl(host, SDHCI_BUFFER);
326 t = val & 0xf00;
327 if (t != 0x200 && t != 0x300)
328 return;
329
330 sdhci_pci_spt_drive_strength = 0x10 | ((val >> 12) & 0xf);
331}
332
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300333static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
334{
Adrian Hunterc9faff62013-06-13 11:50:26 +0300335 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
Adrian Hunter6aab23a2014-12-01 15:51:18 +0200336 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
337 MMC_CAP_BUS_WIDTH_TEST |
338 MMC_CAP_WAIT_WHILE_BUSY;
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300339 slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
Adrian Hunterc9faff62013-06-13 11:50:26 +0300340 slot->hw_reset = sdhci_pci_int_hw_reset;
Adrian Huntera06586b2014-09-24 10:27:33 +0300341 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BSW_EMMC)
342 slot->host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
Adrian Huntere1bfad62015-02-06 14:13:00 +0200343 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_SPT_EMMC) {
344 spt_read_drive_strength(slot->host);
345 slot->select_drive_strength = spt_select_drive_strength;
346 }
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300347 return 0;
348}
349
350static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
351{
Adrian Hunter6aab23a2014-12-01 15:51:18 +0200352 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE |
353 MMC_CAP_BUS_WIDTH_TEST |
354 MMC_CAP_WAIT_WHILE_BUSY;
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300355 return 0;
356}
357
Adrian Hunterff59c522014-09-24 10:27:31 +0300358static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
359{
Adrian Hunter6aab23a2014-12-01 15:51:18 +0200360 slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST |
361 MMC_CAP_WAIT_WHILE_BUSY;
Adrian Hunterff59c522014-09-24 10:27:31 +0300362 slot->cd_con_id = NULL;
363 slot->cd_idx = 0;
364 slot->cd_override_level = true;
365 return 0;
366}
367
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300368static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
369 .allow_runtime_pm = true,
370 .probe_slot = byt_emmc_probe_slot,
Adrian Hunterdb6e8cd2014-12-01 15:51:16 +0200371 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Huntere58e4a02014-09-24 10:27:30 +0300372 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
Adrian Hunterb69587e2015-02-06 14:13:01 +0200373 SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 |
Adrian Huntere58e4a02014-09-24 10:27:30 +0300374 SDHCI_QUIRK2_STOP_WITH_TC,
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300375};
376
377static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
Adrian Hunterdb6e8cd2014-12-01 15:51:16 +0200378 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Gao, Yunpengb7574ba2014-09-04 15:18:05 +0800379 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON |
380 SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300381 .allow_runtime_pm = true,
382 .probe_slot = byt_sdio_probe_slot,
383};
384
385static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
Adrian Hunterdb6e8cd2014-12-01 15:51:16 +0200386 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Gao, Yunpengb7574ba2014-09-04 15:18:05 +0800387 .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
Adrian Huntere58e4a02014-09-24 10:27:30 +0300388 SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
389 SDHCI_QUIRK2_STOP_WITH_TC,
Adrian Hunter7396e312013-05-06 12:17:34 +0300390 .allow_runtime_pm = true,
Adrian Hunter77a01222014-01-13 09:49:16 +0200391 .own_cd_for_runtime_pm = true,
Adrian Hunterff59c522014-09-24 10:27:31 +0300392 .probe_slot = byt_sd_probe_slot,
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300393};
394
David Cohen8776a162013-10-01 13:18:15 -0700395/* Define Host controllers for Intel Merrifield platform */
396#define INTEL_MRFL_EMMC_0 0
397#define INTEL_MRFL_EMMC_1 1
398
399static int intel_mrfl_mmc_probe_slot(struct sdhci_pci_slot *slot)
400{
401 if ((PCI_FUNC(slot->chip->pdev->devfn) != INTEL_MRFL_EMMC_0) &&
402 (PCI_FUNC(slot->chip->pdev->devfn) != INTEL_MRFL_EMMC_1))
403 /* SD support is not ready yet */
404 return -ENODEV;
405
406 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
407 MMC_CAP_1_8V_DDR;
408
409 return 0;
410}
411
412static const struct sdhci_pci_fixes sdhci_intel_mrfl_mmc = {
413 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Gao, Yunpengb7574ba2014-09-04 15:18:05 +0800414 .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 |
415 SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
Gao, Yunpengf1b55a52014-08-18 15:05:52 +0800416 .allow_runtime_pm = true,
David Cohen8776a162013-10-01 13:18:15 -0700417 .probe_slot = intel_mrfl_mmc_probe_slot,
418};
419
Jennifer Li26daa1e2010-11-17 23:01:59 -0500420/* O2Micro extra registers */
421#define O2_SD_LOCK_WP 0xD3
422#define O2_SD_MULTI_VCC3V 0xEE
423#define O2_SD_CLKREQ 0xEC
424#define O2_SD_CAPS 0xE0
425#define O2_SD_ADMA1 0xE2
426#define O2_SD_ADMA2 0xE7
427#define O2_SD_INF_MOD 0xF1
428
Pierre Ossman45211e22008-03-24 13:09:09 +0100429static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)
430{
431 u8 scratch;
432 int ret;
433
434 ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch);
435 if (ret)
436 return ret;
437
438 /*
439 * Turn PMOS on [bit 0], set over current detection to 2.4 V
440 * [bit 1:2] and enable over current debouncing [bit 6].
441 */
442 if (on)
443 scratch |= 0x47;
444 else
445 scratch &= ~0x47;
446
447 ret = pci_write_config_byte(chip->pdev, 0xAE, scratch);
448 if (ret)
449 return ret;
450
451 return 0;
452}
453
454static int jmicron_probe(struct sdhci_pci_chip *chip)
455{
456 int ret;
Takashi Iwai8f230f42010-12-08 10:04:30 +0100457 u16 mmcdev = 0;
Pierre Ossman45211e22008-03-24 13:09:09 +0100458
Pierre Ossman93fc48c2008-06-28 18:21:41 +0200459 if (chip->pdev->revision == 0) {
460 chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
461 SDHCI_QUIRK_32BIT_DMA_SIZE |
Pierre Ossman2134a922008-06-28 18:28:51 +0200462 SDHCI_QUIRK_32BIT_ADMA_SIZE |
Pierre Ossman4a3cba32008-07-29 00:11:16 +0200463 SDHCI_QUIRK_RESET_AFTER_REQUEST |
Pierre Ossman86a6a872009-02-02 21:13:49 +0100464 SDHCI_QUIRK_BROKEN_SMALL_PIO;
Pierre Ossman93fc48c2008-06-28 18:21:41 +0200465 }
466
Pierre Ossman45211e22008-03-24 13:09:09 +0100467 /*
Pierre Ossman44894282008-04-04 19:36:59 +0200468 * JMicron chips can have two interfaces to the same hardware
469 * in order to work around limitations in Microsoft's driver.
470 * We need to make sure we only bind to one of them.
471 *
472 * This code assumes two things:
473 *
474 * 1. The PCI code adds subfunctions in order.
475 *
476 * 2. The MMC interface has a lower subfunction number
477 * than the SD interface.
478 */
Takashi Iwai8f230f42010-12-08 10:04:30 +0100479 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_SD)
480 mmcdev = PCI_DEVICE_ID_JMICRON_JMB38X_MMC;
481 else if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD)
482 mmcdev = PCI_DEVICE_ID_JMICRON_JMB388_ESD;
483
484 if (mmcdev) {
Pierre Ossman44894282008-04-04 19:36:59 +0200485 struct pci_dev *sd_dev;
486
487 sd_dev = NULL;
488 while ((sd_dev = pci_get_device(PCI_VENDOR_ID_JMICRON,
Takashi Iwai8f230f42010-12-08 10:04:30 +0100489 mmcdev, sd_dev)) != NULL) {
Pierre Ossman44894282008-04-04 19:36:59 +0200490 if ((PCI_SLOT(chip->pdev->devfn) ==
491 PCI_SLOT(sd_dev->devfn)) &&
492 (chip->pdev->bus == sd_dev->bus))
493 break;
494 }
495
496 if (sd_dev) {
497 pci_dev_put(sd_dev);
498 dev_info(&chip->pdev->dev, "Refusing to bind to "
499 "secondary interface.\n");
500 return -ENODEV;
501 }
502 }
503
504 /*
Pierre Ossman45211e22008-03-24 13:09:09 +0100505 * JMicron chips need a bit of a nudge to enable the power
506 * output pins.
507 */
508 ret = jmicron_pmos(chip, 1);
509 if (ret) {
510 dev_err(&chip->pdev->dev, "Failure enabling card power\n");
511 return ret;
512 }
513
Takashi Iwai82b0e232011-04-21 20:26:38 +0200514 /* quirk for unsable RO-detection on JM388 chips */
515 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD ||
516 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
517 chip->quirks |= SDHCI_QUIRK_UNSTABLE_RO_DETECT;
518
Pierre Ossman45211e22008-03-24 13:09:09 +0100519 return 0;
520}
521
Pierre Ossman44894282008-04-04 19:36:59 +0200522static void jmicron_enable_mmc(struct sdhci_host *host, int on)
523{
524 u8 scratch;
525
526 scratch = readb(host->ioaddr + 0xC0);
527
528 if (on)
529 scratch |= 0x01;
530 else
531 scratch &= ~0x01;
532
533 writeb(scratch, host->ioaddr + 0xC0);
534}
535
536static int jmicron_probe_slot(struct sdhci_pci_slot *slot)
537{
Pierre Ossman2134a922008-06-28 18:28:51 +0200538 if (slot->chip->pdev->revision == 0) {
539 u16 version;
540
541 version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION);
542 version = (version & SDHCI_VENDOR_VER_MASK) >>
543 SDHCI_VENDOR_VER_SHIFT;
544
545 /*
546 * Older versions of the chip have lots of nasty glitches
547 * in the ADMA engine. It's best just to avoid it
548 * completely.
549 */
550 if (version < 0xAC)
551 slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
552 }
553
Takashi Iwai8f230f42010-12-08 10:04:30 +0100554 /* JM388 MMC doesn't support 1.8V while SD supports it */
555 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
556 slot->host->ocr_avail_sd = MMC_VDD_32_33 | MMC_VDD_33_34 |
557 MMC_VDD_29_30 | MMC_VDD_30_31 |
558 MMC_VDD_165_195; /* allow 1.8V */
559 slot->host->ocr_avail_mmc = MMC_VDD_32_33 | MMC_VDD_33_34 |
560 MMC_VDD_29_30 | MMC_VDD_30_31; /* no 1.8V for MMC */
561 }
562
Pierre Ossman44894282008-04-04 19:36:59 +0200563 /*
564 * The secondary interface requires a bit set to get the
565 * interrupts.
566 */
Takashi Iwai8f230f42010-12-08 10:04:30 +0100567 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
568 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
Pierre Ossman44894282008-04-04 19:36:59 +0200569 jmicron_enable_mmc(slot->host, 1);
570
Takashi Iwaid75c1082010-12-16 17:54:14 +0100571 slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST;
572
Pierre Ossman44894282008-04-04 19:36:59 +0200573 return 0;
574}
575
Pierre Ossman1e728592008-04-16 19:13:13 +0200576static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead)
Pierre Ossman44894282008-04-04 19:36:59 +0200577{
Pierre Ossman1e728592008-04-16 19:13:13 +0200578 if (dead)
579 return;
580
Takashi Iwai8f230f42010-12-08 10:04:30 +0100581 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
582 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
Pierre Ossman44894282008-04-04 19:36:59 +0200583 jmicron_enable_mmc(slot->host, 0);
584}
585
Manuel Lauss29495aa2011-11-03 11:09:45 +0100586static int jmicron_suspend(struct sdhci_pci_chip *chip)
Pierre Ossman44894282008-04-04 19:36:59 +0200587{
588 int i;
589
Takashi Iwai8f230f42010-12-08 10:04:30 +0100590 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
591 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
Ameya Palandeb177bc92011-04-05 21:13:13 +0300592 for (i = 0; i < chip->num_slots; i++)
Pierre Ossman44894282008-04-04 19:36:59 +0200593 jmicron_enable_mmc(chip->slots[i]->host, 0);
594 }
595
596 return 0;
597}
598
Pierre Ossman45211e22008-03-24 13:09:09 +0100599static int jmicron_resume(struct sdhci_pci_chip *chip)
600{
Pierre Ossman44894282008-04-04 19:36:59 +0200601 int ret, i;
602
Takashi Iwai8f230f42010-12-08 10:04:30 +0100603 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
604 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
Ameya Palandeb177bc92011-04-05 21:13:13 +0300605 for (i = 0; i < chip->num_slots; i++)
Pierre Ossman44894282008-04-04 19:36:59 +0200606 jmicron_enable_mmc(chip->slots[i]->host, 1);
607 }
Pierre Ossman45211e22008-03-24 13:09:09 +0100608
609 ret = jmicron_pmos(chip, 1);
610 if (ret) {
611 dev_err(&chip->pdev->dev, "Failure enabling card power\n");
612 return ret;
613 }
614
615 return 0;
616}
617
Jennifer Li26daa1e2010-11-17 23:01:59 -0500618static const struct sdhci_pci_fixes sdhci_o2 = {
Adam Lee01acf692013-12-19 00:01:26 +0800619 .probe = sdhci_pci_o2_probe,
620 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adam Lee143b6482015-08-03 14:33:28 +0800621 .quirks2 = SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD,
Adam Lee01acf692013-12-19 00:01:26 +0800622 .probe_slot = sdhci_pci_o2_probe_slot,
623 .resume = sdhci_pci_o2_resume,
Jennifer Li26daa1e2010-11-17 23:01:59 -0500624};
625
Pierre Ossman22606402008-03-23 19:33:23 +0100626static const struct sdhci_pci_fixes sdhci_jmicron = {
Pierre Ossman45211e22008-03-24 13:09:09 +0100627 .probe = jmicron_probe,
628
Pierre Ossman44894282008-04-04 19:36:59 +0200629 .probe_slot = jmicron_probe_slot,
630 .remove_slot = jmicron_remove_slot,
631
632 .suspend = jmicron_suspend,
Pierre Ossman45211e22008-03-24 13:09:09 +0100633 .resume = jmicron_resume,
Pierre Ossman22606402008-03-23 19:33:23 +0100634};
635
Nicolas Pitrea7a61862009-12-14 18:01:26 -0800636/* SysKonnect CardBus2SDIO extra registers */
637#define SYSKT_CTRL 0x200
638#define SYSKT_RDFIFO_STAT 0x204
639#define SYSKT_WRFIFO_STAT 0x208
640#define SYSKT_POWER_DATA 0x20c
641#define SYSKT_POWER_330 0xef
642#define SYSKT_POWER_300 0xf8
643#define SYSKT_POWER_184 0xcc
644#define SYSKT_POWER_CMD 0x20d
645#define SYSKT_POWER_START (1 << 7)
646#define SYSKT_POWER_STATUS 0x20e
647#define SYSKT_POWER_STATUS_OK (1 << 0)
648#define SYSKT_BOARD_REV 0x210
649#define SYSKT_CHIP_REV 0x211
650#define SYSKT_CONF_DATA 0x212
651#define SYSKT_CONF_DATA_1V8 (1 << 2)
652#define SYSKT_CONF_DATA_2V5 (1 << 1)
653#define SYSKT_CONF_DATA_3V3 (1 << 0)
654
655static int syskt_probe(struct sdhci_pci_chip *chip)
656{
657 if ((chip->pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
658 chip->pdev->class &= ~0x0000FF;
659 chip->pdev->class |= PCI_SDHCI_IFDMA;
660 }
661 return 0;
662}
663
664static int syskt_probe_slot(struct sdhci_pci_slot *slot)
665{
666 int tm, ps;
667
668 u8 board_rev = readb(slot->host->ioaddr + SYSKT_BOARD_REV);
669 u8 chip_rev = readb(slot->host->ioaddr + SYSKT_CHIP_REV);
670 dev_info(&slot->chip->pdev->dev, "SysKonnect CardBus2SDIO, "
671 "board rev %d.%d, chip rev %d.%d\n",
672 board_rev >> 4, board_rev & 0xf,
673 chip_rev >> 4, chip_rev & 0xf);
674 if (chip_rev >= 0x20)
675 slot->host->quirks |= SDHCI_QUIRK_FORCE_DMA;
676
677 writeb(SYSKT_POWER_330, slot->host->ioaddr + SYSKT_POWER_DATA);
678 writeb(SYSKT_POWER_START, slot->host->ioaddr + SYSKT_POWER_CMD);
679 udelay(50);
680 tm = 10; /* Wait max 1 ms */
681 do {
682 ps = readw(slot->host->ioaddr + SYSKT_POWER_STATUS);
683 if (ps & SYSKT_POWER_STATUS_OK)
684 break;
685 udelay(100);
686 } while (--tm);
687 if (!tm) {
688 dev_err(&slot->chip->pdev->dev,
689 "power regulator never stabilized");
690 writeb(0, slot->host->ioaddr + SYSKT_POWER_CMD);
691 return -ENODEV;
692 }
693
694 return 0;
695}
696
697static const struct sdhci_pci_fixes sdhci_syskt = {
698 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER,
699 .probe = syskt_probe,
700 .probe_slot = syskt_probe_slot,
701};
702
Harald Welte557b0692009-06-18 16:53:38 +0200703static int via_probe(struct sdhci_pci_chip *chip)
704{
705 if (chip->pdev->revision == 0x10)
706 chip->quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER;
707
708 return 0;
709}
710
711static const struct sdhci_pci_fixes sdhci_via = {
712 .probe = via_probe,
713};
714
Micky Ching9107ebb2014-02-21 18:40:35 +0800715static int rtsx_probe_slot(struct sdhci_pci_slot *slot)
716{
717 slot->host->mmc->caps2 |= MMC_CAP2_HS200;
718 return 0;
719}
720
721static const struct sdhci_pci_fixes sdhci_rtsx = {
722 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
Micky Chinge30b9782015-04-07 11:32:01 +0800723 SDHCI_QUIRK2_BROKEN_64_BIT_DMA |
Micky Ching9107ebb2014-02-21 18:40:35 +0800724 SDHCI_QUIRK2_BROKEN_DDR50,
725 .probe_slot = rtsx_probe_slot,
726};
727
Vincent Wanb5e97d62015-06-11 20:11:47 +0800728/*AMD chipset generation*/
729enum amd_chipset_gen {
730 AMD_CHIPSET_BEFORE_ML,
731 AMD_CHIPSET_CZ,
732 AMD_CHIPSET_NL,
733 AMD_CHIPSET_UNKNOWN,
734};
735
Vincent Wand44f88d2014-11-05 14:09:14 +0800736static int amd_probe(struct sdhci_pci_chip *chip)
737{
738 struct pci_dev *smbus_dev;
Vincent Wanb5e97d62015-06-11 20:11:47 +0800739 enum amd_chipset_gen gen;
Vincent Wand44f88d2014-11-05 14:09:14 +0800740
741 smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
742 PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, NULL);
Vincent Wanb5e97d62015-06-11 20:11:47 +0800743 if (smbus_dev) {
744 gen = AMD_CHIPSET_BEFORE_ML;
745 } else {
746 smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
747 PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
748 if (smbus_dev) {
749 if (smbus_dev->revision < 0x51)
750 gen = AMD_CHIPSET_CZ;
751 else
752 gen = AMD_CHIPSET_NL;
753 } else {
754 gen = AMD_CHIPSET_UNKNOWN;
755 }
756 }
Vincent Wand44f88d2014-11-05 14:09:14 +0800757
Vincent Wanb5e97d62015-06-11 20:11:47 +0800758 if ((gen == AMD_CHIPSET_BEFORE_ML) || (gen == AMD_CHIPSET_CZ)) {
Vincent Wand44f88d2014-11-05 14:09:14 +0800759 chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
Vincent Wane765bfa2014-11-05 14:09:28 +0800760 chip->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
761 }
Vincent Wand44f88d2014-11-05 14:09:14 +0800762
763 return 0;
764}
765
766static const struct sdhci_pci_fixes sdhci_amd = {
767 .probe = amd_probe,
768};
769
Bill Pemberton9647f842012-11-19 13:25:11 -0500770static const struct pci_device_id pci_ids[] = {
Pierre Ossman22606402008-03-23 19:33:23 +0100771 {
772 .vendor = PCI_VENDOR_ID_RICOH,
773 .device = PCI_DEVICE_ID_RICOH_R5C822,
774 .subvendor = PCI_ANY_ID,
775 .subdevice = PCI_ANY_ID,
776 .driver_data = (kernel_ulong_t)&sdhci_ricoh,
777 },
778
779 {
Maxim Levitskyccc92c22010-08-10 18:01:42 -0700780 .vendor = PCI_VENDOR_ID_RICOH,
781 .device = 0x843,
782 .subvendor = PCI_ANY_ID,
783 .subdevice = PCI_ANY_ID,
784 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
785 },
786
787 {
Pablo Castillo568133e2010-08-10 18:02:01 -0700788 .vendor = PCI_VENDOR_ID_RICOH,
789 .device = 0xe822,
790 .subvendor = PCI_ANY_ID,
791 .subdevice = PCI_ANY_ID,
792 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
793 },
794
795 {
Manoj Iyer5fd11c02011-02-11 16:25:31 -0600796 .vendor = PCI_VENDOR_ID_RICOH,
797 .device = 0xe823,
798 .subvendor = PCI_ANY_ID,
799 .subdevice = PCI_ANY_ID,
800 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
801 },
802
803 {
Pierre Ossman22606402008-03-23 19:33:23 +0100804 .vendor = PCI_VENDOR_ID_ENE,
805 .device = PCI_DEVICE_ID_ENE_CB712_SD,
806 .subvendor = PCI_ANY_ID,
807 .subdevice = PCI_ANY_ID,
808 .driver_data = (kernel_ulong_t)&sdhci_ene_712,
809 },
810
811 {
812 .vendor = PCI_VENDOR_ID_ENE,
813 .device = PCI_DEVICE_ID_ENE_CB712_SD_2,
814 .subvendor = PCI_ANY_ID,
815 .subdevice = PCI_ANY_ID,
816 .driver_data = (kernel_ulong_t)&sdhci_ene_712,
817 },
818
819 {
820 .vendor = PCI_VENDOR_ID_ENE,
821 .device = PCI_DEVICE_ID_ENE_CB714_SD,
822 .subvendor = PCI_ANY_ID,
823 .subdevice = PCI_ANY_ID,
824 .driver_data = (kernel_ulong_t)&sdhci_ene_714,
825 },
826
827 {
828 .vendor = PCI_VENDOR_ID_ENE,
829 .device = PCI_DEVICE_ID_ENE_CB714_SD_2,
830 .subvendor = PCI_ANY_ID,
831 .subdevice = PCI_ANY_ID,
832 .driver_data = (kernel_ulong_t)&sdhci_ene_714,
833 },
834
835 {
836 .vendor = PCI_VENDOR_ID_MARVELL,
David Woodhouse8c5eb882008-09-03 09:45:57 +0100837 .device = PCI_DEVICE_ID_MARVELL_88ALP01_SD,
Pierre Ossman22606402008-03-23 19:33:23 +0100838 .subvendor = PCI_ANY_ID,
839 .subdevice = PCI_ANY_ID,
840 .driver_data = (kernel_ulong_t)&sdhci_cafe,
841 },
842
843 {
844 .vendor = PCI_VENDOR_ID_JMICRON,
845 .device = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
846 .subvendor = PCI_ANY_ID,
847 .subdevice = PCI_ANY_ID,
848 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
849 },
850
Pierre Ossman44894282008-04-04 19:36:59 +0200851 {
852 .vendor = PCI_VENDOR_ID_JMICRON,
853 .device = PCI_DEVICE_ID_JMICRON_JMB38X_MMC,
854 .subvendor = PCI_ANY_ID,
855 .subdevice = PCI_ANY_ID,
856 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
857 },
858
Harald Welte557b0692009-06-18 16:53:38 +0200859 {
Takashi Iwai8f230f42010-12-08 10:04:30 +0100860 .vendor = PCI_VENDOR_ID_JMICRON,
861 .device = PCI_DEVICE_ID_JMICRON_JMB388_SD,
862 .subvendor = PCI_ANY_ID,
863 .subdevice = PCI_ANY_ID,
864 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
865 },
866
867 {
868 .vendor = PCI_VENDOR_ID_JMICRON,
869 .device = PCI_DEVICE_ID_JMICRON_JMB388_ESD,
870 .subvendor = PCI_ANY_ID,
871 .subdevice = PCI_ANY_ID,
872 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
873 },
874
875 {
Nicolas Pitrea7a61862009-12-14 18:01:26 -0800876 .vendor = PCI_VENDOR_ID_SYSKONNECT,
877 .device = 0x8000,
878 .subvendor = PCI_ANY_ID,
879 .subdevice = PCI_ANY_ID,
880 .driver_data = (kernel_ulong_t)&sdhci_syskt,
881 },
882
883 {
Harald Welte557b0692009-06-18 16:53:38 +0200884 .vendor = PCI_VENDOR_ID_VIA,
885 .device = 0x95d0,
886 .subvendor = PCI_ANY_ID,
887 .subdevice = PCI_ANY_ID,
888 .driver_data = (kernel_ulong_t)&sdhci_via,
889 },
890
Xiaochen Shen29229052010-10-04 15:24:52 +0100891 {
Micky Ching9107ebb2014-02-21 18:40:35 +0800892 .vendor = PCI_VENDOR_ID_REALTEK,
893 .device = 0x5250,
894 .subvendor = PCI_ANY_ID,
895 .subdevice = PCI_ANY_ID,
896 .driver_data = (kernel_ulong_t)&sdhci_rtsx,
897 },
898
899 {
Xiaochen Shen29229052010-10-04 15:24:52 +0100900 .vendor = PCI_VENDOR_ID_INTEL,
Derek Browne43e968c2014-06-24 06:56:36 -0700901 .device = PCI_DEVICE_ID_INTEL_QRK_SD,
902 .subvendor = PCI_ANY_ID,
903 .subdevice = PCI_ANY_ID,
904 .driver_data = (kernel_ulong_t)&sdhci_intel_qrk,
905 },
906
907 {
908 .vendor = PCI_VENDOR_ID_INTEL,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100909 .device = PCI_DEVICE_ID_INTEL_MRST_SD0,
910 .subvendor = PCI_ANY_ID,
911 .subdevice = PCI_ANY_ID,
912 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc0,
913 },
914
915 {
916 .vendor = PCI_VENDOR_ID_INTEL,
917 .device = PCI_DEVICE_ID_INTEL_MRST_SD1,
918 .subvendor = PCI_ANY_ID,
919 .subdevice = PCI_ANY_ID,
Jacob Pan35ac6f02010-11-09 13:57:29 +0000920 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2,
921 },
922
923 {
924 .vendor = PCI_VENDOR_ID_INTEL,
925 .device = PCI_DEVICE_ID_INTEL_MRST_SD2,
926 .subvendor = PCI_ANY_ID,
927 .subdevice = PCI_ANY_ID,
928 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100929 },
930
931 {
932 .vendor = PCI_VENDOR_ID_INTEL,
Xiaochen Shen29229052010-10-04 15:24:52 +0100933 .device = PCI_DEVICE_ID_INTEL_MFD_SD,
934 .subvendor = PCI_ANY_ID,
935 .subdevice = PCI_ANY_ID,
936 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sd,
937 },
938
939 {
940 .vendor = PCI_VENDOR_ID_INTEL,
941 .device = PCI_DEVICE_ID_INTEL_MFD_SDIO1,
942 .subvendor = PCI_ANY_ID,
943 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300944 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
Xiaochen Shen29229052010-10-04 15:24:52 +0100945 },
946
947 {
948 .vendor = PCI_VENDOR_ID_INTEL,
949 .device = PCI_DEVICE_ID_INTEL_MFD_SDIO2,
950 .subvendor = PCI_ANY_ID,
951 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300952 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
Xiaochen Shen29229052010-10-04 15:24:52 +0100953 },
954
955 {
956 .vendor = PCI_VENDOR_ID_INTEL,
957 .device = PCI_DEVICE_ID_INTEL_MFD_EMMC0,
958 .subvendor = PCI_ANY_ID,
959 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300960 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
Xiaochen Shen29229052010-10-04 15:24:52 +0100961 },
962
963 {
964 .vendor = PCI_VENDOR_ID_INTEL,
965 .device = PCI_DEVICE_ID_INTEL_MFD_EMMC1,
966 .subvendor = PCI_ANY_ID,
967 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300968 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
Xiaochen Shen29229052010-10-04 15:24:52 +0100969 },
970
Jennifer Li26daa1e2010-11-17 23:01:59 -0500971 {
Alexander Stein296e0b02012-03-14 08:38:58 +0100972 .vendor = PCI_VENDOR_ID_INTEL,
973 .device = PCI_DEVICE_ID_INTEL_PCH_SDIO0,
974 .subvendor = PCI_ANY_ID,
975 .subdevice = PCI_ANY_ID,
976 .driver_data = (kernel_ulong_t)&sdhci_intel_pch_sdio,
977 },
978
979 {
980 .vendor = PCI_VENDOR_ID_INTEL,
981 .device = PCI_DEVICE_ID_INTEL_PCH_SDIO1,
982 .subvendor = PCI_ANY_ID,
983 .subdevice = PCI_ANY_ID,
984 .driver_data = (kernel_ulong_t)&sdhci_intel_pch_sdio,
985 },
986
987 {
Adrian Hunter728ef3d2013-04-26 11:27:23 +0300988 .vendor = PCI_VENDOR_ID_INTEL,
989 .device = PCI_DEVICE_ID_INTEL_BYT_EMMC,
990 .subvendor = PCI_ANY_ID,
991 .subdevice = PCI_ANY_ID,
992 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
993 },
994
995 {
996 .vendor = PCI_VENDOR_ID_INTEL,
997 .device = PCI_DEVICE_ID_INTEL_BYT_SDIO,
998 .subvendor = PCI_ANY_ID,
999 .subdevice = PCI_ANY_ID,
1000 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1001 },
1002
1003 {
1004 .vendor = PCI_VENDOR_ID_INTEL,
1005 .device = PCI_DEVICE_ID_INTEL_BYT_SD,
1006 .subvendor = PCI_ANY_ID,
1007 .subdevice = PCI_ANY_ID,
1008 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1009 },
1010
1011 {
Adrian Hunter30d025c2013-06-20 12:57:59 +03001012 .vendor = PCI_VENDOR_ID_INTEL,
1013 .device = PCI_DEVICE_ID_INTEL_BYT_EMMC2,
1014 .subvendor = PCI_ANY_ID,
1015 .subdevice = PCI_ANY_ID,
1016 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1017 },
1018
Alan Cox066173b2014-08-20 13:27:44 +03001019 {
1020 .vendor = PCI_VENDOR_ID_INTEL,
1021 .device = PCI_DEVICE_ID_INTEL_BSW_EMMC,
1022 .subvendor = PCI_ANY_ID,
1023 .subdevice = PCI_ANY_ID,
1024 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1025 },
1026
1027 {
1028 .vendor = PCI_VENDOR_ID_INTEL,
1029 .device = PCI_DEVICE_ID_INTEL_BSW_SDIO,
1030 .subvendor = PCI_ANY_ID,
1031 .subdevice = PCI_ANY_ID,
1032 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1033 },
1034
1035 {
1036 .vendor = PCI_VENDOR_ID_INTEL,
1037 .device = PCI_DEVICE_ID_INTEL_BSW_SD,
1038 .subvendor = PCI_ANY_ID,
1039 .subdevice = PCI_ANY_ID,
1040 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1041 },
Eric Ernstd0520682013-10-21 09:54:41 -07001042
1043 {
1044 .vendor = PCI_VENDOR_ID_INTEL,
1045 .device = PCI_DEVICE_ID_INTEL_CLV_SDIO0,
1046 .subvendor = PCI_ANY_ID,
1047 .subdevice = PCI_ANY_ID,
1048 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sd,
1049 },
1050
1051 {
1052 .vendor = PCI_VENDOR_ID_INTEL,
1053 .device = PCI_DEVICE_ID_INTEL_CLV_SDIO1,
1054 .subvendor = PCI_ANY_ID,
1055 .subdevice = PCI_ANY_ID,
1056 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
1057 },
1058
1059 {
1060 .vendor = PCI_VENDOR_ID_INTEL,
1061 .device = PCI_DEVICE_ID_INTEL_CLV_SDIO2,
1062 .subvendor = PCI_ANY_ID,
1063 .subdevice = PCI_ANY_ID,
1064 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
1065 },
1066
1067 {
1068 .vendor = PCI_VENDOR_ID_INTEL,
1069 .device = PCI_DEVICE_ID_INTEL_CLV_EMMC0,
1070 .subvendor = PCI_ANY_ID,
1071 .subdevice = PCI_ANY_ID,
1072 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
1073 },
1074
1075 {
1076 .vendor = PCI_VENDOR_ID_INTEL,
1077 .device = PCI_DEVICE_ID_INTEL_CLV_EMMC1,
1078 .subvendor = PCI_ANY_ID,
1079 .subdevice = PCI_ANY_ID,
1080 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
1081 },
1082
Adrian Hunter30d025c2013-06-20 12:57:59 +03001083 {
David Cohen8776a162013-10-01 13:18:15 -07001084 .vendor = PCI_VENDOR_ID_INTEL,
1085 .device = PCI_DEVICE_ID_INTEL_MRFL_MMC,
1086 .subvendor = PCI_ANY_ID,
1087 .subdevice = PCI_ANY_ID,
1088 .driver_data = (kernel_ulong_t)&sdhci_intel_mrfl_mmc,
1089 },
Adrian Hunter1f7f2652015-01-05 14:47:58 +02001090
1091 {
1092 .vendor = PCI_VENDOR_ID_INTEL,
1093 .device = PCI_DEVICE_ID_INTEL_SPT_EMMC,
1094 .subvendor = PCI_ANY_ID,
1095 .subdevice = PCI_ANY_ID,
1096 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1097 },
1098
1099 {
1100 .vendor = PCI_VENDOR_ID_INTEL,
1101 .device = PCI_DEVICE_ID_INTEL_SPT_SDIO,
1102 .subvendor = PCI_ANY_ID,
1103 .subdevice = PCI_ANY_ID,
1104 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1105 },
1106
1107 {
1108 .vendor = PCI_VENDOR_ID_INTEL,
1109 .device = PCI_DEVICE_ID_INTEL_SPT_SD,
1110 .subvendor = PCI_ANY_ID,
1111 .subdevice = PCI_ANY_ID,
1112 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1113 },
1114
David Cohen8776a162013-10-01 13:18:15 -07001115 {
Jennifer Li26daa1e2010-11-17 23:01:59 -05001116 .vendor = PCI_VENDOR_ID_O2,
1117 .device = PCI_DEVICE_ID_O2_8120,
1118 .subvendor = PCI_ANY_ID,
1119 .subdevice = PCI_ANY_ID,
1120 .driver_data = (kernel_ulong_t)&sdhci_o2,
1121 },
1122
1123 {
1124 .vendor = PCI_VENDOR_ID_O2,
1125 .device = PCI_DEVICE_ID_O2_8220,
1126 .subvendor = PCI_ANY_ID,
1127 .subdevice = PCI_ANY_ID,
1128 .driver_data = (kernel_ulong_t)&sdhci_o2,
1129 },
1130
1131 {
1132 .vendor = PCI_VENDOR_ID_O2,
1133 .device = PCI_DEVICE_ID_O2_8221,
1134 .subvendor = PCI_ANY_ID,
1135 .subdevice = PCI_ANY_ID,
1136 .driver_data = (kernel_ulong_t)&sdhci_o2,
1137 },
1138
1139 {
1140 .vendor = PCI_VENDOR_ID_O2,
1141 .device = PCI_DEVICE_ID_O2_8320,
1142 .subvendor = PCI_ANY_ID,
1143 .subdevice = PCI_ANY_ID,
1144 .driver_data = (kernel_ulong_t)&sdhci_o2,
1145 },
1146
1147 {
1148 .vendor = PCI_VENDOR_ID_O2,
1149 .device = PCI_DEVICE_ID_O2_8321,
1150 .subvendor = PCI_ANY_ID,
1151 .subdevice = PCI_ANY_ID,
1152 .driver_data = (kernel_ulong_t)&sdhci_o2,
1153 },
1154
Adam Lee01acf692013-12-19 00:01:26 +08001155 {
1156 .vendor = PCI_VENDOR_ID_O2,
1157 .device = PCI_DEVICE_ID_O2_FUJIN2,
1158 .subvendor = PCI_ANY_ID,
1159 .subdevice = PCI_ANY_ID,
1160 .driver_data = (kernel_ulong_t)&sdhci_o2,
1161 },
1162
1163 {
1164 .vendor = PCI_VENDOR_ID_O2,
1165 .device = PCI_DEVICE_ID_O2_SDS0,
1166 .subvendor = PCI_ANY_ID,
1167 .subdevice = PCI_ANY_ID,
1168 .driver_data = (kernel_ulong_t)&sdhci_o2,
1169 },
1170
1171 {
1172 .vendor = PCI_VENDOR_ID_O2,
1173 .device = PCI_DEVICE_ID_O2_SDS1,
1174 .subvendor = PCI_ANY_ID,
1175 .subdevice = PCI_ANY_ID,
1176 .driver_data = (kernel_ulong_t)&sdhci_o2,
1177 },
1178
1179 {
1180 .vendor = PCI_VENDOR_ID_O2,
1181 .device = PCI_DEVICE_ID_O2_SEABIRD0,
1182 .subvendor = PCI_ANY_ID,
1183 .subdevice = PCI_ANY_ID,
1184 .driver_data = (kernel_ulong_t)&sdhci_o2,
1185 },
1186
1187 {
1188 .vendor = PCI_VENDOR_ID_O2,
1189 .device = PCI_DEVICE_ID_O2_SEABIRD1,
1190 .subvendor = PCI_ANY_ID,
1191 .subdevice = PCI_ANY_ID,
1192 .driver_data = (kernel_ulong_t)&sdhci_o2,
1193 },
Vincent Wand44f88d2014-11-05 14:09:14 +08001194 {
1195 .vendor = PCI_VENDOR_ID_AMD,
1196 .device = PCI_ANY_ID,
1197 .class = PCI_CLASS_SYSTEM_SDHCI << 8,
1198 .class_mask = 0xFFFF00,
1199 .subvendor = PCI_ANY_ID,
1200 .subdevice = PCI_ANY_ID,
1201 .driver_data = (kernel_ulong_t)&sdhci_amd,
1202 },
Pierre Ossman22606402008-03-23 19:33:23 +01001203 { /* Generic SD host controller */
1204 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
1205 },
1206
1207 { /* end: all zeroes */ },
1208};
1209
1210MODULE_DEVICE_TABLE(pci, pci_ids);
1211
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001212/*****************************************************************************\
1213 * *
1214 * SDHCI core callbacks *
1215 * *
1216\*****************************************************************************/
1217
1218static int sdhci_pci_enable_dma(struct sdhci_host *host)
1219{
1220 struct sdhci_pci_slot *slot;
1221 struct pci_dev *pdev;
Adrian Hunter3828eca2014-11-04 12:42:48 +02001222 int ret = -1;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001223
1224 slot = sdhci_priv(host);
1225 pdev = slot->chip->pdev;
1226
1227 if (((pdev->class & 0xFFFF00) == (PCI_CLASS_SYSTEM_SDHCI << 8)) &&
1228 ((pdev->class & 0x0000FF) != PCI_SDHCI_IFDMA) &&
Richard Röjforsa13abc72009-09-22 16:45:30 -07001229 (host->flags & SDHCI_USE_SDMA)) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001230 dev_warn(&pdev->dev, "Will use DMA mode even though HW "
1231 "doesn't fully claim to support it.\n");
1232 }
1233
Adrian Hunter3828eca2014-11-04 12:42:48 +02001234 if (host->flags & SDHCI_USE_64_BIT_DMA) {
1235 if (host->quirks2 & SDHCI_QUIRK2_BROKEN_64_BIT_DMA) {
1236 host->flags &= ~SDHCI_USE_64_BIT_DMA;
1237 } else {
1238 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
1239 if (ret)
1240 dev_warn(&pdev->dev, "Failed to set 64-bit DMA mask\n");
1241 }
1242 }
1243 if (ret)
1244 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001245 if (ret)
1246 return ret;
1247
1248 pci_set_master(pdev);
1249
1250 return 0;
1251}
1252
Russell King2317f562014-04-25 12:57:07 +01001253static void sdhci_pci_set_bus_width(struct sdhci_host *host, int width)
Major Lee68077b02011-06-29 14:23:46 +03001254{
1255 u8 ctrl;
1256
1257 ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
1258
1259 switch (width) {
1260 case MMC_BUS_WIDTH_8:
1261 ctrl |= SDHCI_CTRL_8BITBUS;
1262 ctrl &= ~SDHCI_CTRL_4BITBUS;
1263 break;
1264 case MMC_BUS_WIDTH_4:
1265 ctrl |= SDHCI_CTRL_4BITBUS;
1266 ctrl &= ~SDHCI_CTRL_8BITBUS;
1267 break;
1268 default:
1269 ctrl &= ~(SDHCI_CTRL_8BITBUS | SDHCI_CTRL_4BITBUS);
1270 break;
1271 }
1272
1273 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
Major Lee68077b02011-06-29 14:23:46 +03001274}
1275
Adrian Hunterc9faff62013-06-13 11:50:26 +03001276static void sdhci_pci_gpio_hw_reset(struct sdhci_host *host)
Adrian Hunter0f201652011-08-29 16:42:13 +03001277{
1278 struct sdhci_pci_slot *slot = sdhci_priv(host);
1279 int rst_n_gpio = slot->rst_n_gpio;
1280
1281 if (!gpio_is_valid(rst_n_gpio))
1282 return;
1283 gpio_set_value_cansleep(rst_n_gpio, 0);
1284 /* For eMMC, minimum is 1us but give it 10us for good measure */
1285 udelay(10);
1286 gpio_set_value_cansleep(rst_n_gpio, 1);
1287 /* For eMMC, minimum is 200us but give it 300us for good measure */
1288 usleep_range(300, 1000);
1289}
1290
Adrian Hunterc9faff62013-06-13 11:50:26 +03001291static void sdhci_pci_hw_reset(struct sdhci_host *host)
1292{
1293 struct sdhci_pci_slot *slot = sdhci_priv(host);
1294
1295 if (slot->hw_reset)
1296 slot->hw_reset(host);
1297}
1298
Adrian Huntere1bfad62015-02-06 14:13:00 +02001299static int sdhci_pci_select_drive_strength(struct sdhci_host *host,
1300 struct mmc_card *card,
1301 unsigned int max_dtr, int host_drv,
1302 int card_drv, int *drv_type)
1303{
1304 struct sdhci_pci_slot *slot = sdhci_priv(host);
1305
1306 if (!slot->select_drive_strength)
1307 return 0;
1308
1309 return slot->select_drive_strength(host, card, max_dtr, host_drv,
1310 card_drv, drv_type);
1311}
1312
Lars-Peter Clausenc9155682013-03-13 19:26:05 +01001313static const struct sdhci_ops sdhci_pci_ops = {
Russell King17710592014-04-25 12:58:55 +01001314 .set_clock = sdhci_set_clock,
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001315 .enable_dma = sdhci_pci_enable_dma,
Russell King2317f562014-04-25 12:57:07 +01001316 .set_bus_width = sdhci_pci_set_bus_width,
Russell King03231f92014-04-25 12:57:12 +01001317 .reset = sdhci_reset,
Russell King96d7b782014-04-25 12:59:26 +01001318 .set_uhs_signaling = sdhci_set_uhs_signaling,
Adrian Hunter0f201652011-08-29 16:42:13 +03001319 .hw_reset = sdhci_pci_hw_reset,
Adrian Huntere1bfad62015-02-06 14:13:00 +02001320 .select_drive_strength = sdhci_pci_select_drive_strength,
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001321};
1322
1323/*****************************************************************************\
1324 * *
1325 * Suspend/resume *
1326 * *
1327\*****************************************************************************/
1328
1329#ifdef CONFIG_PM
1330
Manuel Lauss29495aa2011-11-03 11:09:45 +01001331static int sdhci_pci_suspend(struct device *dev)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001332{
Manuel Lauss29495aa2011-11-03 11:09:45 +01001333 struct pci_dev *pdev = to_pci_dev(dev);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001334 struct sdhci_pci_chip *chip;
1335 struct sdhci_pci_slot *slot;
Daniel Drake5f619702010-11-04 22:20:39 +00001336 mmc_pm_flag_t slot_pm_flags;
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -08001337 mmc_pm_flag_t pm_flags = 0;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001338 int i, ret;
1339
1340 chip = pci_get_drvdata(pdev);
1341 if (!chip)
1342 return 0;
1343
Ameya Palandeb177bc92011-04-05 21:13:13 +03001344 for (i = 0; i < chip->num_slots; i++) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001345 slot = chip->slots[i];
1346 if (!slot)
1347 continue;
1348
Manuel Lauss29495aa2011-11-03 11:09:45 +01001349 ret = sdhci_suspend_host(slot->host);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001350
Axel Linb678b912011-12-03 15:28:05 +08001351 if (ret)
1352 goto err_pci_suspend;
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -08001353
Daniel Drake5f619702010-11-04 22:20:39 +00001354 slot_pm_flags = slot->host->mmc->pm_flags;
1355 if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
1356 sdhci_enable_irq_wakeups(slot->host);
1357
1358 pm_flags |= slot_pm_flags;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001359 }
1360
Pierre Ossman44894282008-04-04 19:36:59 +02001361 if (chip->fixes && chip->fixes->suspend) {
Manuel Lauss29495aa2011-11-03 11:09:45 +01001362 ret = chip->fixes->suspend(chip);
Axel Linb678b912011-12-03 15:28:05 +08001363 if (ret)
1364 goto err_pci_suspend;
Pierre Ossman44894282008-04-04 19:36:59 +02001365 }
1366
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -08001367 if (pm_flags & MMC_PM_KEEP_POWER) {
Chuanxiao.Dong6b91f2d2014-07-15 17:28:05 +08001368 if (pm_flags & MMC_PM_WAKE_SDIO_IRQ)
1369 device_init_wakeup(dev, true);
1370 else
1371 device_init_wakeup(dev, false);
1372 } else
1373 device_init_wakeup(dev, false);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001374
1375 return 0;
Axel Linb678b912011-12-03 15:28:05 +08001376
1377err_pci_suspend:
1378 while (--i >= 0)
1379 sdhci_resume_host(chip->slots[i]->host);
1380 return ret;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001381}
1382
Manuel Lauss29495aa2011-11-03 11:09:45 +01001383static int sdhci_pci_resume(struct device *dev)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001384{
Manuel Lauss29495aa2011-11-03 11:09:45 +01001385 struct pci_dev *pdev = to_pci_dev(dev);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001386 struct sdhci_pci_chip *chip;
1387 struct sdhci_pci_slot *slot;
1388 int i, ret;
1389
1390 chip = pci_get_drvdata(pdev);
1391 if (!chip)
1392 return 0;
1393
Pierre Ossman45211e22008-03-24 13:09:09 +01001394 if (chip->fixes && chip->fixes->resume) {
1395 ret = chip->fixes->resume(chip);
1396 if (ret)
1397 return ret;
1398 }
1399
Ameya Palandeb177bc92011-04-05 21:13:13 +03001400 for (i = 0; i < chip->num_slots; i++) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001401 slot = chip->slots[i];
1402 if (!slot)
1403 continue;
1404
1405 ret = sdhci_resume_host(slot->host);
1406 if (ret)
1407 return ret;
1408 }
1409
1410 return 0;
1411}
1412
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001413static int sdhci_pci_runtime_suspend(struct device *dev)
1414{
1415 struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
1416 struct sdhci_pci_chip *chip;
1417 struct sdhci_pci_slot *slot;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001418 int i, ret;
1419
1420 chip = pci_get_drvdata(pdev);
1421 if (!chip)
1422 return 0;
1423
1424 for (i = 0; i < chip->num_slots; i++) {
1425 slot = chip->slots[i];
1426 if (!slot)
1427 continue;
1428
1429 ret = sdhci_runtime_suspend_host(slot->host);
1430
Axel Linb678b912011-12-03 15:28:05 +08001431 if (ret)
1432 goto err_pci_runtime_suspend;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001433 }
1434
1435 if (chip->fixes && chip->fixes->suspend) {
Manuel Lauss29495aa2011-11-03 11:09:45 +01001436 ret = chip->fixes->suspend(chip);
Axel Linb678b912011-12-03 15:28:05 +08001437 if (ret)
1438 goto err_pci_runtime_suspend;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001439 }
1440
1441 return 0;
Axel Linb678b912011-12-03 15:28:05 +08001442
1443err_pci_runtime_suspend:
1444 while (--i >= 0)
1445 sdhci_runtime_resume_host(chip->slots[i]->host);
1446 return ret;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001447}
1448
1449static int sdhci_pci_runtime_resume(struct device *dev)
1450{
1451 struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
1452 struct sdhci_pci_chip *chip;
1453 struct sdhci_pci_slot *slot;
1454 int i, ret;
1455
1456 chip = pci_get_drvdata(pdev);
1457 if (!chip)
1458 return 0;
1459
1460 if (chip->fixes && chip->fixes->resume) {
1461 ret = chip->fixes->resume(chip);
1462 if (ret)
1463 return ret;
1464 }
1465
1466 for (i = 0; i < chip->num_slots; i++) {
1467 slot = chip->slots[i];
1468 if (!slot)
1469 continue;
1470
1471 ret = sdhci_runtime_resume_host(slot->host);
1472 if (ret)
1473 return ret;
1474 }
1475
1476 return 0;
1477}
1478
Rafael J. Wysocki162d6f92014-12-05 03:05:33 +01001479#else /* CONFIG_PM */
1480
1481#define sdhci_pci_suspend NULL
1482#define sdhci_pci_resume NULL
1483
1484#endif /* CONFIG_PM */
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001485
1486static const struct dev_pm_ops sdhci_pci_pm_ops = {
Manuel Lauss29495aa2011-11-03 11:09:45 +01001487 .suspend = sdhci_pci_suspend,
1488 .resume = sdhci_pci_resume,
Peter Griffinf3a92b12014-08-12 17:14:28 +01001489 SET_RUNTIME_PM_OPS(sdhci_pci_runtime_suspend,
Ulf Hansson106276b2014-12-10 16:49:23 +01001490 sdhci_pci_runtime_resume, NULL)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001491};
1492
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001493/*****************************************************************************\
1494 * *
1495 * Device probing/removal *
1496 * *
1497\*****************************************************************************/
1498
Bill Pembertonc3be1ef2012-11-19 13:23:06 -05001499static struct sdhci_pci_slot *sdhci_pci_probe_slot(
Adrian Hunter52c506f2011-12-27 15:48:43 +02001500 struct pci_dev *pdev, struct sdhci_pci_chip *chip, int first_bar,
1501 int slotno)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001502{
1503 struct sdhci_pci_slot *slot;
1504 struct sdhci_host *host;
Adrian Hunter52c506f2011-12-27 15:48:43 +02001505 int ret, bar = first_bar + slotno;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001506
1507 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1508 dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
1509 return ERR_PTR(-ENODEV);
1510 }
1511
Adrian Hunter90b3e6c2012-10-18 09:54:31 +03001512 if (pci_resource_len(pdev, bar) < 0x100) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001513 dev_err(&pdev->dev, "Invalid iomem size. You may "
1514 "experience problems.\n");
1515 }
1516
1517 if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
1518 dev_err(&pdev->dev, "Vendor specific interface. Aborting.\n");
1519 return ERR_PTR(-ENODEV);
1520 }
1521
1522 if ((pdev->class & 0x0000FF) > PCI_SDHCI_IFVENDOR) {
1523 dev_err(&pdev->dev, "Unknown interface. Aborting.\n");
1524 return ERR_PTR(-ENODEV);
1525 }
1526
1527 host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
1528 if (IS_ERR(host)) {
Dan Carpenterc60a32c2009-04-10 23:31:10 +02001529 dev_err(&pdev->dev, "cannot allocate host\n");
Julia Lawalldc0fd7b2010-05-26 14:42:11 -07001530 return ERR_CAST(host);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001531 }
1532
1533 slot = sdhci_priv(host);
1534
1535 slot->chip = chip;
1536 slot->host = host;
1537 slot->pci_bar = bar;
Adrian Hunter0f201652011-08-29 16:42:13 +03001538 slot->rst_n_gpio = -EINVAL;
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001539 slot->cd_gpio = -EINVAL;
Adrian Hunterff59c522014-09-24 10:27:31 +03001540 slot->cd_idx = -1;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001541
Adrian Hunter52c506f2011-12-27 15:48:43 +02001542 /* Retrieve platform data if there is any */
1543 if (*sdhci_pci_get_data)
1544 slot->data = sdhci_pci_get_data(pdev, slotno);
1545
1546 if (slot->data) {
1547 if (slot->data->setup) {
1548 ret = slot->data->setup(slot->data);
1549 if (ret) {
1550 dev_err(&pdev->dev, "platform setup failed\n");
1551 goto free;
1552 }
1553 }
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001554 slot->rst_n_gpio = slot->data->rst_n_gpio;
1555 slot->cd_gpio = slot->data->cd_gpio;
Adrian Hunter52c506f2011-12-27 15:48:43 +02001556 }
1557
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001558 host->hw_name = "PCI";
1559 host->ops = &sdhci_pci_ops;
1560 host->quirks = chip->quirks;
Adrian Hunterf3c55a72012-02-07 14:48:55 +02001561 host->quirks2 = chip->quirks2;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001562
1563 host->irq = pdev->irq;
1564
1565 ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc));
1566 if (ret) {
1567 dev_err(&pdev->dev, "cannot request region\n");
Adrian Hunter52c506f2011-12-27 15:48:43 +02001568 goto cleanup;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001569 }
1570
Arjan van de Ven092f82e2008-09-28 16:15:56 -07001571 host->ioaddr = pci_ioremap_bar(pdev, bar);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001572 if (!host->ioaddr) {
1573 dev_err(&pdev->dev, "failed to remap registers\n");
Chris Ball9fdcdbb2011-03-29 00:46:12 -04001574 ret = -ENOMEM;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001575 goto release;
1576 }
1577
Pierre Ossman44894282008-04-04 19:36:59 +02001578 if (chip->fixes && chip->fixes->probe_slot) {
1579 ret = chip->fixes->probe_slot(slot);
1580 if (ret)
1581 goto unmap;
1582 }
1583
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001584 if (gpio_is_valid(slot->rst_n_gpio)) {
1585 if (!gpio_request(slot->rst_n_gpio, "eMMC_reset")) {
1586 gpio_direction_output(slot->rst_n_gpio, 1);
1587 slot->host->mmc->caps |= MMC_CAP_HW_RESET;
Adrian Hunterc9faff62013-06-13 11:50:26 +03001588 slot->hw_reset = sdhci_pci_gpio_hw_reset;
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001589 } else {
1590 dev_warn(&pdev->dev, "failed to request rst_n_gpio\n");
1591 slot->rst_n_gpio = -EINVAL;
1592 }
1593 }
1594
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -08001595 host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ;
Aaron Lueed222a2013-03-05 11:24:52 +08001596 host->mmc->slotno = slotno;
Adrian Huntera08b17b2013-04-15 11:27:25 -04001597 host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -08001598
Adrian Hunterff59c522014-09-24 10:27:31 +03001599 if (slot->cd_idx >= 0 &&
1600 mmc_gpiod_request_cd(host->mmc, slot->cd_con_id, slot->cd_idx,
1601 slot->cd_override_level, 0, NULL)) {
1602 dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
1603 slot->cd_idx = -1;
1604 }
1605
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001606 ret = sdhci_add_host(host);
1607 if (ret)
Pierre Ossman44894282008-04-04 19:36:59 +02001608 goto remove;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001609
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001610 sdhci_pci_add_own_cd(slot);
1611
Adrian Hunter77a01222014-01-13 09:49:16 +02001612 /*
1613 * Check if the chip needs a separate GPIO for card detect to wake up
1614 * from runtime suspend. If it is not there, don't allow runtime PM.
1615 * Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure.
1616 */
Adrian Hunter945be382014-01-21 09:52:39 +02001617 if (chip->fixes && chip->fixes->own_cd_for_runtime_pm &&
Adrian Hunterff59c522014-09-24 10:27:31 +03001618 !gpio_is_valid(slot->cd_gpio) && slot->cd_idx < 0)
Adrian Hunter77a01222014-01-13 09:49:16 +02001619 chip->allow_runtime_pm = false;
1620
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001621 return slot;
1622
Pierre Ossman44894282008-04-04 19:36:59 +02001623remove:
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001624 if (gpio_is_valid(slot->rst_n_gpio))
1625 gpio_free(slot->rst_n_gpio);
1626
Pierre Ossman44894282008-04-04 19:36:59 +02001627 if (chip->fixes && chip->fixes->remove_slot)
Pierre Ossman1e728592008-04-16 19:13:13 +02001628 chip->fixes->remove_slot(slot, 0);
Pierre Ossman44894282008-04-04 19:36:59 +02001629
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001630unmap:
1631 iounmap(host->ioaddr);
1632
1633release:
1634 pci_release_region(pdev, bar);
Dan Carpenterc60a32c2009-04-10 23:31:10 +02001635
Adrian Hunter52c506f2011-12-27 15:48:43 +02001636cleanup:
1637 if (slot->data && slot->data->cleanup)
1638 slot->data->cleanup(slot->data);
1639
Dan Carpenterc60a32c2009-04-10 23:31:10 +02001640free:
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001641 sdhci_free_host(host);
1642
1643 return ERR_PTR(ret);
1644}
1645
1646static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
1647{
Pierre Ossman1e728592008-04-16 19:13:13 +02001648 int dead;
1649 u32 scratch;
1650
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001651 sdhci_pci_remove_own_cd(slot);
1652
Pierre Ossman1e728592008-04-16 19:13:13 +02001653 dead = 0;
1654 scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS);
1655 if (scratch == (u32)-1)
1656 dead = 1;
1657
1658 sdhci_remove_host(slot->host, dead);
Pierre Ossman44894282008-04-04 19:36:59 +02001659
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001660 if (gpio_is_valid(slot->rst_n_gpio))
1661 gpio_free(slot->rst_n_gpio);
1662
Pierre Ossman44894282008-04-04 19:36:59 +02001663 if (slot->chip->fixes && slot->chip->fixes->remove_slot)
Pierre Ossman1e728592008-04-16 19:13:13 +02001664 slot->chip->fixes->remove_slot(slot, dead);
Pierre Ossman44894282008-04-04 19:36:59 +02001665
Adrian Hunter52c506f2011-12-27 15:48:43 +02001666 if (slot->data && slot->data->cleanup)
1667 slot->data->cleanup(slot->data);
1668
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001669 pci_release_region(slot->chip->pdev, slot->pci_bar);
Pierre Ossman44894282008-04-04 19:36:59 +02001670
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001671 sdhci_free_host(slot->host);
1672}
1673
Bill Pembertonc3be1ef2012-11-19 13:23:06 -05001674static void sdhci_pci_runtime_pm_allow(struct device *dev)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001675{
1676 pm_runtime_put_noidle(dev);
1677 pm_runtime_allow(dev);
1678 pm_runtime_set_autosuspend_delay(dev, 50);
1679 pm_runtime_use_autosuspend(dev);
1680 pm_suspend_ignore_children(dev, 1);
1681}
1682
Bill Pemberton6e0ee712012-11-19 13:26:03 -05001683static void sdhci_pci_runtime_pm_forbid(struct device *dev)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001684{
1685 pm_runtime_forbid(dev);
1686 pm_runtime_get_noresume(dev);
1687}
1688
Bill Pembertonc3be1ef2012-11-19 13:23:06 -05001689static int sdhci_pci_probe(struct pci_dev *pdev,
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001690 const struct pci_device_id *ent)
1691{
1692 struct sdhci_pci_chip *chip;
1693 struct sdhci_pci_slot *slot;
1694
Sergei Shtylyovcf5e23e2011-03-17 16:46:17 -04001695 u8 slots, first_bar;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001696 int ret, i;
1697
1698 BUG_ON(pdev == NULL);
1699 BUG_ON(ent == NULL);
1700
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001701 dev_info(&pdev->dev, "SDHCI controller found [%04x:%04x] (rev %x)\n",
Sergei Shtylyovcf5e23e2011-03-17 16:46:17 -04001702 (int)pdev->vendor, (int)pdev->device, (int)pdev->revision);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001703
1704 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots);
1705 if (ret)
1706 return ret;
1707
1708 slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
1709 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
1710 if (slots == 0)
1711 return -ENODEV;
1712
1713 BUG_ON(slots > MAX_SLOTS);
1714
1715 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar);
1716 if (ret)
1717 return ret;
1718
1719 first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
1720
1721 if (first_bar > 5) {
1722 dev_err(&pdev->dev, "Invalid first BAR. Aborting.\n");
1723 return -ENODEV;
1724 }
1725
1726 ret = pci_enable_device(pdev);
1727 if (ret)
1728 return ret;
1729
1730 chip = kzalloc(sizeof(struct sdhci_pci_chip), GFP_KERNEL);
1731 if (!chip) {
1732 ret = -ENOMEM;
1733 goto err;
1734 }
1735
1736 chip->pdev = pdev;
Ameya Palandeb177bc92011-04-05 21:13:13 +03001737 chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
Adrian Hunterc43fd772011-10-17 10:52:44 +03001738 if (chip->fixes) {
Pierre Ossman22606402008-03-23 19:33:23 +01001739 chip->quirks = chip->fixes->quirks;
Adrian Hunterf3c55a72012-02-07 14:48:55 +02001740 chip->quirks2 = chip->fixes->quirks2;
Adrian Hunterc43fd772011-10-17 10:52:44 +03001741 chip->allow_runtime_pm = chip->fixes->allow_runtime_pm;
1742 }
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001743 chip->num_slots = slots;
1744
1745 pci_set_drvdata(pdev, chip);
1746
Pierre Ossman22606402008-03-23 19:33:23 +01001747 if (chip->fixes && chip->fixes->probe) {
1748 ret = chip->fixes->probe(chip);
1749 if (ret)
1750 goto free;
1751 }
1752
Alan Cox225d85f2010-10-04 15:24:21 +01001753 slots = chip->num_slots; /* Quirk may have changed this */
1754
Ameya Palandeb177bc92011-04-05 21:13:13 +03001755 for (i = 0; i < slots; i++) {
Adrian Hunter52c506f2011-12-27 15:48:43 +02001756 slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001757 if (IS_ERR(slot)) {
Ameya Palandeb177bc92011-04-05 21:13:13 +03001758 for (i--; i >= 0; i--)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001759 sdhci_pci_remove_slot(chip->slots[i]);
1760 ret = PTR_ERR(slot);
1761 goto free;
1762 }
1763
1764 chip->slots[i] = slot;
1765 }
1766
Adrian Hunterc43fd772011-10-17 10:52:44 +03001767 if (chip->allow_runtime_pm)
1768 sdhci_pci_runtime_pm_allow(&pdev->dev);
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001769
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001770 return 0;
1771
1772free:
1773 pci_set_drvdata(pdev, NULL);
1774 kfree(chip);
1775
1776err:
1777 pci_disable_device(pdev);
1778 return ret;
1779}
1780
Bill Pemberton6e0ee712012-11-19 13:26:03 -05001781static void sdhci_pci_remove(struct pci_dev *pdev)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001782{
1783 int i;
1784 struct sdhci_pci_chip *chip;
1785
1786 chip = pci_get_drvdata(pdev);
1787
1788 if (chip) {
Adrian Hunterc43fd772011-10-17 10:52:44 +03001789 if (chip->allow_runtime_pm)
1790 sdhci_pci_runtime_pm_forbid(&pdev->dev);
1791
Ameya Palandeb177bc92011-04-05 21:13:13 +03001792 for (i = 0; i < chip->num_slots; i++)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001793 sdhci_pci_remove_slot(chip->slots[i]);
1794
1795 pci_set_drvdata(pdev, NULL);
1796 kfree(chip);
1797 }
1798
1799 pci_disable_device(pdev);
1800}
1801
1802static struct pci_driver sdhci_driver = {
Ameya Palandeb177bc92011-04-05 21:13:13 +03001803 .name = "sdhci-pci",
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001804 .id_table = pci_ids,
Ameya Palandeb177bc92011-04-05 21:13:13 +03001805 .probe = sdhci_pci_probe,
Bill Pemberton0433c142012-11-19 13:20:26 -05001806 .remove = sdhci_pci_remove,
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001807 .driver = {
1808 .pm = &sdhci_pci_pm_ops
1809 },
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001810};
1811
Sachin Kamatacc69642012-08-27 11:57:02 +05301812module_pci_driver(sdhci_driver);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001813
Pierre Ossman32710e82009-04-08 20:14:54 +02001814MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>");
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001815MODULE_DESCRIPTION("Secure Digital Host Controller Interface PCI driver");
1816MODULE_LICENSE("GPL");