blob: 646680a5993acf65d6f5bf89f0dcc6a6f4f219a1 [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>
Ameya Palandeb177bc92011-04-05 21:13:13 +030023#include <linux/scatterlist.h>
24#include <linux/io.h>
Adrian Hunter0f201652011-08-29 16:42:13 +030025#include <linux/gpio.h>
Adrian Hunter66fd8ad2011-10-03 15:33:34 +030026#include <linux/pm_runtime.h>
Adrian Hunter52c506f2011-12-27 15:48:43 +020027#include <linux/mmc/sdhci-pci-data.h>
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010028
29#include "sdhci.h"
30
31/*
32 * PCI registers
33 */
34
35#define PCI_SDHCI_IFPIO 0x00
36#define PCI_SDHCI_IFDMA 0x01
37#define PCI_SDHCI_IFVENDOR 0x02
38
39#define PCI_SLOT_INFO 0x40 /* 8 bits */
40#define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7)
41#define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07
42
43#define MAX_SLOTS 8
44
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010045struct sdhci_pci_chip;
Pierre Ossman44894282008-04-04 19:36:59 +020046struct sdhci_pci_slot;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010047
Pierre Ossman22606402008-03-23 19:33:23 +010048struct sdhci_pci_fixes {
49 unsigned int quirks;
Adrian Hunterc43fd772011-10-17 10:52:44 +030050 bool allow_runtime_pm;
Pierre Ossman22606402008-03-23 19:33:23 +010051
Ameya Palandeb177bc92011-04-05 21:13:13 +030052 int (*probe) (struct sdhci_pci_chip *);
Pierre Ossman45211e22008-03-24 13:09:09 +010053
Ameya Palandeb177bc92011-04-05 21:13:13 +030054 int (*probe_slot) (struct sdhci_pci_slot *);
55 void (*remove_slot) (struct sdhci_pci_slot *, int);
Pierre Ossman44894282008-04-04 19:36:59 +020056
Manuel Lauss29495aa2011-11-03 11:09:45 +010057 int (*suspend) (struct sdhci_pci_chip *);
Ameya Palandeb177bc92011-04-05 21:13:13 +030058 int (*resume) (struct sdhci_pci_chip *);
Pierre Ossman22606402008-03-23 19:33:23 +010059};
60
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010061struct sdhci_pci_slot {
62 struct sdhci_pci_chip *chip;
63 struct sdhci_host *host;
Adrian Hunter52c506f2011-12-27 15:48:43 +020064 struct sdhci_pci_data *data;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010065
66 int pci_bar;
Adrian Hunter0f201652011-08-29 16:42:13 +030067 int rst_n_gpio;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +030068 int cd_gpio;
69 int cd_irq;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010070};
71
72struct sdhci_pci_chip {
73 struct pci_dev *pdev;
Pierre Ossman22606402008-03-23 19:33:23 +010074
75 unsigned int quirks;
Adrian Hunterc43fd772011-10-17 10:52:44 +030076 bool allow_runtime_pm;
Pierre Ossman22606402008-03-23 19:33:23 +010077 const struct sdhci_pci_fixes *fixes;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +010078
79 int num_slots; /* Slots on controller */
80 struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
81};
82
Pierre Ossman22606402008-03-23 19:33:23 +010083
84/*****************************************************************************\
85 * *
86 * Hardware specific quirk handling *
87 * *
88\*****************************************************************************/
89
90static int ricoh_probe(struct sdhci_pci_chip *chip)
91{
Chris Ballc99436f2009-09-22 16:45:22 -070092 if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
93 chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
Pierre Ossman22606402008-03-23 19:33:23 +010094 chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
Maxim Levitskyccc92c22010-08-10 18:01:42 -070095 return 0;
96}
Pierre Ossman22606402008-03-23 19:33:23 +010097
Maxim Levitskyccc92c22010-08-10 18:01:42 -070098static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
99{
100 slot->host->caps =
101 ((0x21 << SDHCI_TIMEOUT_CLK_SHIFT)
102 & SDHCI_TIMEOUT_CLK_MASK) |
103
104 ((0x21 << SDHCI_CLOCK_BASE_SHIFT)
105 & SDHCI_CLOCK_BASE_MASK) |
106
107 SDHCI_TIMEOUT_CLK_UNIT |
108 SDHCI_CAN_VDD_330 |
109 SDHCI_CAN_DO_SDMA;
110 return 0;
111}
112
113static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)
114{
115 /* Apply a delay to allow controller to settle */
116 /* Otherwise it becomes confused if card state changed
117 during suspend */
118 msleep(500);
Pierre Ossman22606402008-03-23 19:33:23 +0100119 return 0;
120}
121
122static const struct sdhci_pci_fixes sdhci_ricoh = {
123 .probe = ricoh_probe,
Vasily Khoruzhick84938292010-03-05 13:43:46 -0800124 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
125 SDHCI_QUIRK_FORCE_DMA |
126 SDHCI_QUIRK_CLOCK_BEFORE_RESET,
Pierre Ossman22606402008-03-23 19:33:23 +0100127};
128
Maxim Levitskyccc92c22010-08-10 18:01:42 -0700129static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
130 .probe_slot = ricoh_mmc_probe_slot,
131 .resume = ricoh_mmc_resume,
132 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
133 SDHCI_QUIRK_CLOCK_BEFORE_RESET |
134 SDHCI_QUIRK_NO_CARD_NO_RESET |
135 SDHCI_QUIRK_MISSING_CAPS
136};
137
Pierre Ossman22606402008-03-23 19:33:23 +0100138static const struct sdhci_pci_fixes sdhci_ene_712 = {
139 .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
140 SDHCI_QUIRK_BROKEN_DMA,
141};
142
143static const struct sdhci_pci_fixes sdhci_ene_714 = {
144 .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
145 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS |
146 SDHCI_QUIRK_BROKEN_DMA,
147};
148
149static const struct sdhci_pci_fixes sdhci_cafe = {
150 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
Andres Salomona0874892009-03-02 21:48:20 +0100151 SDHCI_QUIRK_NO_BUSY_IRQ |
Pierre Ossmanee53ab52008-07-05 00:25:15 +0200152 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
Pierre Ossman22606402008-03-23 19:33:23 +0100153};
154
Major Lee68077b02011-06-29 14:23:46 +0300155static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
156{
157 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
158 return 0;
159}
160
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100161/*
162 * ADMA operation is disabled for Moorestown platform due to
163 * hardware bugs.
164 */
Jacob Pan35ac6f02010-11-09 13:57:29 +0000165static int mrst_hc_probe(struct sdhci_pci_chip *chip)
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100166{
167 /*
Jacob Pan35ac6f02010-11-09 13:57:29 +0000168 * slots number is fixed here for MRST as SDIO3/5 are never used and
169 * have hardware bugs.
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100170 */
171 chip->num_slots = 1;
172 return 0;
173}
174
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300175#ifdef CONFIG_PM_RUNTIME
176
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200177static irqreturn_t sdhci_pci_sd_cd(int irq, void *dev_id)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300178{
179 struct sdhci_pci_slot *slot = dev_id;
180 struct sdhci_host *host = slot->host;
181
182 mmc_detect_change(host->mmc, msecs_to_jiffies(200));
183 return IRQ_HANDLED;
184}
185
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200186static void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300187{
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200188 int err, irq, gpio = slot->cd_gpio;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300189
190 slot->cd_gpio = -EINVAL;
191 slot->cd_irq = -EINVAL;
192
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200193 if (!gpio_is_valid(gpio))
194 return;
195
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300196 err = gpio_request(gpio, "sd_cd");
197 if (err < 0)
198 goto out;
199
200 err = gpio_direction_input(gpio);
201 if (err < 0)
202 goto out_free;
203
204 irq = gpio_to_irq(gpio);
205 if (irq < 0)
206 goto out_free;
207
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200208 err = request_irq(irq, sdhci_pci_sd_cd, IRQF_TRIGGER_RISING |
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300209 IRQF_TRIGGER_FALLING, "sd_cd", slot);
210 if (err)
211 goto out_free;
212
213 slot->cd_gpio = gpio;
214 slot->cd_irq = irq;
215 slot->host->quirks2 |= SDHCI_QUIRK2_OWN_CARD_DETECTION;
216
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200217 return;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300218
219out_free:
220 gpio_free(gpio);
221out:
222 dev_warn(&slot->chip->pdev->dev, "failed to setup card detect wake up\n");
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300223}
224
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200225static void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300226{
227 if (slot->cd_irq >= 0)
228 free_irq(slot->cd_irq, slot);
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200229 if (gpio_is_valid(slot->cd_gpio))
230 gpio_free(slot->cd_gpio);
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300231}
232
233#else
234
Adrian Hunterc5e027a2011-12-27 15:48:44 +0200235static inline void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
236{
237}
238
239static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
240{
241}
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300242
243#endif
244
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300245static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
246{
Adrian Hunter66fd8ad2011-10-03 15:33:34 +0300247 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE;
Adrian Hunterf7c56ef2011-09-23 12:48:21 +0300248 slot->host->mmc->caps2 = MMC_CAP2_BOOTPART_NOACC;
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300249 return 0;
250}
251
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100252static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
253 .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
Major Lee68077b02011-06-29 14:23:46 +0300254 .probe_slot = mrst_hc_probe_slot,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100255};
256
Jacob Pan35ac6f02010-11-09 13:57:29 +0000257static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100258 .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
Jacob Pan35ac6f02010-11-09 13:57:29 +0000259 .probe = mrst_hc_probe,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100260};
261
Xiaochen Shen29229052010-10-04 15:24:52 +0100262static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
263 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunterc43fd772011-10-17 10:52:44 +0300264 .allow_runtime_pm = true,
Xiaochen Shen29229052010-10-04 15:24:52 +0100265};
266
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300267static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
Xiaochen Shen29229052010-10-04 15:24:52 +0100268 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunterc43fd772011-10-17 10:52:44 +0300269 .allow_runtime_pm = true,
Xiaochen Shen29229052010-10-04 15:24:52 +0100270};
271
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300272static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = {
273 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunterc43fd772011-10-17 10:52:44 +0300274 .allow_runtime_pm = true,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300275 .probe_slot = mfd_emmc_probe_slot,
276};
277
Jennifer Li26daa1e2010-11-17 23:01:59 -0500278/* O2Micro extra registers */
279#define O2_SD_LOCK_WP 0xD3
280#define O2_SD_MULTI_VCC3V 0xEE
281#define O2_SD_CLKREQ 0xEC
282#define O2_SD_CAPS 0xE0
283#define O2_SD_ADMA1 0xE2
284#define O2_SD_ADMA2 0xE7
285#define O2_SD_INF_MOD 0xF1
286
287static int o2_probe(struct sdhci_pci_chip *chip)
288{
289 int ret;
290 u8 scratch;
291
292 switch (chip->pdev->device) {
293 case PCI_DEVICE_ID_O2_8220:
294 case PCI_DEVICE_ID_O2_8221:
295 case PCI_DEVICE_ID_O2_8320:
296 case PCI_DEVICE_ID_O2_8321:
297 /* This extra setup is required due to broken ADMA. */
298 ret = pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
299 if (ret)
300 return ret;
301 scratch &= 0x7f;
302 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
303
304 /* Set Multi 3 to VCC3V# */
305 pci_write_config_byte(chip->pdev, O2_SD_MULTI_VCC3V, 0x08);
306
307 /* Disable CLK_REQ# support after media DET */
308 ret = pci_read_config_byte(chip->pdev, O2_SD_CLKREQ, &scratch);
309 if (ret)
310 return ret;
311 scratch |= 0x20;
312 pci_write_config_byte(chip->pdev, O2_SD_CLKREQ, scratch);
313
314 /* Choose capabilities, enable SDMA. We have to write 0x01
315 * to the capabilities register first to unlock it.
316 */
317 ret = pci_read_config_byte(chip->pdev, O2_SD_CAPS, &scratch);
318 if (ret)
319 return ret;
320 scratch |= 0x01;
321 pci_write_config_byte(chip->pdev, O2_SD_CAPS, scratch);
322 pci_write_config_byte(chip->pdev, O2_SD_CAPS, 0x73);
323
324 /* Disable ADMA1/2 */
325 pci_write_config_byte(chip->pdev, O2_SD_ADMA1, 0x39);
326 pci_write_config_byte(chip->pdev, O2_SD_ADMA2, 0x08);
327
328 /* Disable the infinite transfer mode */
329 ret = pci_read_config_byte(chip->pdev, O2_SD_INF_MOD, &scratch);
330 if (ret)
331 return ret;
332 scratch |= 0x08;
333 pci_write_config_byte(chip->pdev, O2_SD_INF_MOD, scratch);
334
335 /* Lock WP */
336 ret = pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
337 if (ret)
338 return ret;
339 scratch |= 0x80;
340 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
341 }
342
343 return 0;
344}
345
Pierre Ossman45211e22008-03-24 13:09:09 +0100346static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)
347{
348 u8 scratch;
349 int ret;
350
351 ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch);
352 if (ret)
353 return ret;
354
355 /*
356 * Turn PMOS on [bit 0], set over current detection to 2.4 V
357 * [bit 1:2] and enable over current debouncing [bit 6].
358 */
359 if (on)
360 scratch |= 0x47;
361 else
362 scratch &= ~0x47;
363
364 ret = pci_write_config_byte(chip->pdev, 0xAE, scratch);
365 if (ret)
366 return ret;
367
368 return 0;
369}
370
371static int jmicron_probe(struct sdhci_pci_chip *chip)
372{
373 int ret;
Takashi Iwai8f230f42010-12-08 10:04:30 +0100374 u16 mmcdev = 0;
Pierre Ossman45211e22008-03-24 13:09:09 +0100375
Pierre Ossman93fc48c2008-06-28 18:21:41 +0200376 if (chip->pdev->revision == 0) {
377 chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
378 SDHCI_QUIRK_32BIT_DMA_SIZE |
Pierre Ossman2134a922008-06-28 18:28:51 +0200379 SDHCI_QUIRK_32BIT_ADMA_SIZE |
Pierre Ossman4a3cba32008-07-29 00:11:16 +0200380 SDHCI_QUIRK_RESET_AFTER_REQUEST |
Pierre Ossman86a6a872009-02-02 21:13:49 +0100381 SDHCI_QUIRK_BROKEN_SMALL_PIO;
Pierre Ossman93fc48c2008-06-28 18:21:41 +0200382 }
383
Pierre Ossman45211e22008-03-24 13:09:09 +0100384 /*
Pierre Ossman44894282008-04-04 19:36:59 +0200385 * JMicron chips can have two interfaces to the same hardware
386 * in order to work around limitations in Microsoft's driver.
387 * We need to make sure we only bind to one of them.
388 *
389 * This code assumes two things:
390 *
391 * 1. The PCI code adds subfunctions in order.
392 *
393 * 2. The MMC interface has a lower subfunction number
394 * than the SD interface.
395 */
Takashi Iwai8f230f42010-12-08 10:04:30 +0100396 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_SD)
397 mmcdev = PCI_DEVICE_ID_JMICRON_JMB38X_MMC;
398 else if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD)
399 mmcdev = PCI_DEVICE_ID_JMICRON_JMB388_ESD;
400
401 if (mmcdev) {
Pierre Ossman44894282008-04-04 19:36:59 +0200402 struct pci_dev *sd_dev;
403
404 sd_dev = NULL;
405 while ((sd_dev = pci_get_device(PCI_VENDOR_ID_JMICRON,
Takashi Iwai8f230f42010-12-08 10:04:30 +0100406 mmcdev, sd_dev)) != NULL) {
Pierre Ossman44894282008-04-04 19:36:59 +0200407 if ((PCI_SLOT(chip->pdev->devfn) ==
408 PCI_SLOT(sd_dev->devfn)) &&
409 (chip->pdev->bus == sd_dev->bus))
410 break;
411 }
412
413 if (sd_dev) {
414 pci_dev_put(sd_dev);
415 dev_info(&chip->pdev->dev, "Refusing to bind to "
416 "secondary interface.\n");
417 return -ENODEV;
418 }
419 }
420
421 /*
Pierre Ossman45211e22008-03-24 13:09:09 +0100422 * JMicron chips need a bit of a nudge to enable the power
423 * output pins.
424 */
425 ret = jmicron_pmos(chip, 1);
426 if (ret) {
427 dev_err(&chip->pdev->dev, "Failure enabling card power\n");
428 return ret;
429 }
430
Takashi Iwai82b0e232011-04-21 20:26:38 +0200431 /* quirk for unsable RO-detection on JM388 chips */
432 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD ||
433 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
434 chip->quirks |= SDHCI_QUIRK_UNSTABLE_RO_DETECT;
435
Pierre Ossman45211e22008-03-24 13:09:09 +0100436 return 0;
437}
438
Pierre Ossman44894282008-04-04 19:36:59 +0200439static void jmicron_enable_mmc(struct sdhci_host *host, int on)
440{
441 u8 scratch;
442
443 scratch = readb(host->ioaddr + 0xC0);
444
445 if (on)
446 scratch |= 0x01;
447 else
448 scratch &= ~0x01;
449
450 writeb(scratch, host->ioaddr + 0xC0);
451}
452
453static int jmicron_probe_slot(struct sdhci_pci_slot *slot)
454{
Pierre Ossman2134a922008-06-28 18:28:51 +0200455 if (slot->chip->pdev->revision == 0) {
456 u16 version;
457
458 version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION);
459 version = (version & SDHCI_VENDOR_VER_MASK) >>
460 SDHCI_VENDOR_VER_SHIFT;
461
462 /*
463 * Older versions of the chip have lots of nasty glitches
464 * in the ADMA engine. It's best just to avoid it
465 * completely.
466 */
467 if (version < 0xAC)
468 slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
469 }
470
Takashi Iwai8f230f42010-12-08 10:04:30 +0100471 /* JM388 MMC doesn't support 1.8V while SD supports it */
472 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
473 slot->host->ocr_avail_sd = MMC_VDD_32_33 | MMC_VDD_33_34 |
474 MMC_VDD_29_30 | MMC_VDD_30_31 |
475 MMC_VDD_165_195; /* allow 1.8V */
476 slot->host->ocr_avail_mmc = MMC_VDD_32_33 | MMC_VDD_33_34 |
477 MMC_VDD_29_30 | MMC_VDD_30_31; /* no 1.8V for MMC */
478 }
479
Pierre Ossman44894282008-04-04 19:36:59 +0200480 /*
481 * The secondary interface requires a bit set to get the
482 * interrupts.
483 */
Takashi Iwai8f230f42010-12-08 10:04:30 +0100484 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
485 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
Pierre Ossman44894282008-04-04 19:36:59 +0200486 jmicron_enable_mmc(slot->host, 1);
487
Takashi Iwaid75c1082010-12-16 17:54:14 +0100488 slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST;
489
Pierre Ossman44894282008-04-04 19:36:59 +0200490 return 0;
491}
492
Pierre Ossman1e728592008-04-16 19:13:13 +0200493static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead)
Pierre Ossman44894282008-04-04 19:36:59 +0200494{
Pierre Ossman1e728592008-04-16 19:13:13 +0200495 if (dead)
496 return;
497
Takashi Iwai8f230f42010-12-08 10:04:30 +0100498 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
499 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
Pierre Ossman44894282008-04-04 19:36:59 +0200500 jmicron_enable_mmc(slot->host, 0);
501}
502
Manuel Lauss29495aa2011-11-03 11:09:45 +0100503static int jmicron_suspend(struct sdhci_pci_chip *chip)
Pierre Ossman44894282008-04-04 19:36:59 +0200504{
505 int i;
506
Takashi Iwai8f230f42010-12-08 10:04:30 +0100507 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
508 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
Ameya Palandeb177bc92011-04-05 21:13:13 +0300509 for (i = 0; i < chip->num_slots; i++)
Pierre Ossman44894282008-04-04 19:36:59 +0200510 jmicron_enable_mmc(chip->slots[i]->host, 0);
511 }
512
513 return 0;
514}
515
Pierre Ossman45211e22008-03-24 13:09:09 +0100516static int jmicron_resume(struct sdhci_pci_chip *chip)
517{
Pierre Ossman44894282008-04-04 19:36:59 +0200518 int ret, i;
519
Takashi Iwai8f230f42010-12-08 10:04:30 +0100520 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
521 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
Ameya Palandeb177bc92011-04-05 21:13:13 +0300522 for (i = 0; i < chip->num_slots; i++)
Pierre Ossman44894282008-04-04 19:36:59 +0200523 jmicron_enable_mmc(chip->slots[i]->host, 1);
524 }
Pierre Ossman45211e22008-03-24 13:09:09 +0100525
526 ret = jmicron_pmos(chip, 1);
527 if (ret) {
528 dev_err(&chip->pdev->dev, "Failure enabling card power\n");
529 return ret;
530 }
531
532 return 0;
533}
534
Jennifer Li26daa1e2010-11-17 23:01:59 -0500535static const struct sdhci_pci_fixes sdhci_o2 = {
536 .probe = o2_probe,
537};
538
Pierre Ossman22606402008-03-23 19:33:23 +0100539static const struct sdhci_pci_fixes sdhci_jmicron = {
Pierre Ossman45211e22008-03-24 13:09:09 +0100540 .probe = jmicron_probe,
541
Pierre Ossman44894282008-04-04 19:36:59 +0200542 .probe_slot = jmicron_probe_slot,
543 .remove_slot = jmicron_remove_slot,
544
545 .suspend = jmicron_suspend,
Pierre Ossman45211e22008-03-24 13:09:09 +0100546 .resume = jmicron_resume,
Pierre Ossman22606402008-03-23 19:33:23 +0100547};
548
Nicolas Pitrea7a61862009-12-14 18:01:26 -0800549/* SysKonnect CardBus2SDIO extra registers */
550#define SYSKT_CTRL 0x200
551#define SYSKT_RDFIFO_STAT 0x204
552#define SYSKT_WRFIFO_STAT 0x208
553#define SYSKT_POWER_DATA 0x20c
554#define SYSKT_POWER_330 0xef
555#define SYSKT_POWER_300 0xf8
556#define SYSKT_POWER_184 0xcc
557#define SYSKT_POWER_CMD 0x20d
558#define SYSKT_POWER_START (1 << 7)
559#define SYSKT_POWER_STATUS 0x20e
560#define SYSKT_POWER_STATUS_OK (1 << 0)
561#define SYSKT_BOARD_REV 0x210
562#define SYSKT_CHIP_REV 0x211
563#define SYSKT_CONF_DATA 0x212
564#define SYSKT_CONF_DATA_1V8 (1 << 2)
565#define SYSKT_CONF_DATA_2V5 (1 << 1)
566#define SYSKT_CONF_DATA_3V3 (1 << 0)
567
568static int syskt_probe(struct sdhci_pci_chip *chip)
569{
570 if ((chip->pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
571 chip->pdev->class &= ~0x0000FF;
572 chip->pdev->class |= PCI_SDHCI_IFDMA;
573 }
574 return 0;
575}
576
577static int syskt_probe_slot(struct sdhci_pci_slot *slot)
578{
579 int tm, ps;
580
581 u8 board_rev = readb(slot->host->ioaddr + SYSKT_BOARD_REV);
582 u8 chip_rev = readb(slot->host->ioaddr + SYSKT_CHIP_REV);
583 dev_info(&slot->chip->pdev->dev, "SysKonnect CardBus2SDIO, "
584 "board rev %d.%d, chip rev %d.%d\n",
585 board_rev >> 4, board_rev & 0xf,
586 chip_rev >> 4, chip_rev & 0xf);
587 if (chip_rev >= 0x20)
588 slot->host->quirks |= SDHCI_QUIRK_FORCE_DMA;
589
590 writeb(SYSKT_POWER_330, slot->host->ioaddr + SYSKT_POWER_DATA);
591 writeb(SYSKT_POWER_START, slot->host->ioaddr + SYSKT_POWER_CMD);
592 udelay(50);
593 tm = 10; /* Wait max 1 ms */
594 do {
595 ps = readw(slot->host->ioaddr + SYSKT_POWER_STATUS);
596 if (ps & SYSKT_POWER_STATUS_OK)
597 break;
598 udelay(100);
599 } while (--tm);
600 if (!tm) {
601 dev_err(&slot->chip->pdev->dev,
602 "power regulator never stabilized");
603 writeb(0, slot->host->ioaddr + SYSKT_POWER_CMD);
604 return -ENODEV;
605 }
606
607 return 0;
608}
609
610static const struct sdhci_pci_fixes sdhci_syskt = {
611 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER,
612 .probe = syskt_probe,
613 .probe_slot = syskt_probe_slot,
614};
615
Harald Welte557b0692009-06-18 16:53:38 +0200616static int via_probe(struct sdhci_pci_chip *chip)
617{
618 if (chip->pdev->revision == 0x10)
619 chip->quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER;
620
621 return 0;
622}
623
624static const struct sdhci_pci_fixes sdhci_via = {
625 .probe = via_probe,
626};
627
Pierre Ossman22606402008-03-23 19:33:23 +0100628static const struct pci_device_id pci_ids[] __devinitdata = {
629 {
630 .vendor = PCI_VENDOR_ID_RICOH,
631 .device = PCI_DEVICE_ID_RICOH_R5C822,
632 .subvendor = PCI_ANY_ID,
633 .subdevice = PCI_ANY_ID,
634 .driver_data = (kernel_ulong_t)&sdhci_ricoh,
635 },
636
637 {
Maxim Levitskyccc92c22010-08-10 18:01:42 -0700638 .vendor = PCI_VENDOR_ID_RICOH,
639 .device = 0x843,
640 .subvendor = PCI_ANY_ID,
641 .subdevice = PCI_ANY_ID,
642 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
643 },
644
645 {
Pablo Castillo568133e2010-08-10 18:02:01 -0700646 .vendor = PCI_VENDOR_ID_RICOH,
647 .device = 0xe822,
648 .subvendor = PCI_ANY_ID,
649 .subdevice = PCI_ANY_ID,
650 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
651 },
652
653 {
Manoj Iyer5fd11c02011-02-11 16:25:31 -0600654 .vendor = PCI_VENDOR_ID_RICOH,
655 .device = 0xe823,
656 .subvendor = PCI_ANY_ID,
657 .subdevice = PCI_ANY_ID,
658 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
659 },
660
661 {
Pierre Ossman22606402008-03-23 19:33:23 +0100662 .vendor = PCI_VENDOR_ID_ENE,
663 .device = PCI_DEVICE_ID_ENE_CB712_SD,
664 .subvendor = PCI_ANY_ID,
665 .subdevice = PCI_ANY_ID,
666 .driver_data = (kernel_ulong_t)&sdhci_ene_712,
667 },
668
669 {
670 .vendor = PCI_VENDOR_ID_ENE,
671 .device = PCI_DEVICE_ID_ENE_CB712_SD_2,
672 .subvendor = PCI_ANY_ID,
673 .subdevice = PCI_ANY_ID,
674 .driver_data = (kernel_ulong_t)&sdhci_ene_712,
675 },
676
677 {
678 .vendor = PCI_VENDOR_ID_ENE,
679 .device = PCI_DEVICE_ID_ENE_CB714_SD,
680 .subvendor = PCI_ANY_ID,
681 .subdevice = PCI_ANY_ID,
682 .driver_data = (kernel_ulong_t)&sdhci_ene_714,
683 },
684
685 {
686 .vendor = PCI_VENDOR_ID_ENE,
687 .device = PCI_DEVICE_ID_ENE_CB714_SD_2,
688 .subvendor = PCI_ANY_ID,
689 .subdevice = PCI_ANY_ID,
690 .driver_data = (kernel_ulong_t)&sdhci_ene_714,
691 },
692
693 {
694 .vendor = PCI_VENDOR_ID_MARVELL,
David Woodhouse8c5eb882008-09-03 09:45:57 +0100695 .device = PCI_DEVICE_ID_MARVELL_88ALP01_SD,
Pierre Ossman22606402008-03-23 19:33:23 +0100696 .subvendor = PCI_ANY_ID,
697 .subdevice = PCI_ANY_ID,
698 .driver_data = (kernel_ulong_t)&sdhci_cafe,
699 },
700
701 {
702 .vendor = PCI_VENDOR_ID_JMICRON,
703 .device = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
704 .subvendor = PCI_ANY_ID,
705 .subdevice = PCI_ANY_ID,
706 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
707 },
708
Pierre Ossman44894282008-04-04 19:36:59 +0200709 {
710 .vendor = PCI_VENDOR_ID_JMICRON,
711 .device = PCI_DEVICE_ID_JMICRON_JMB38X_MMC,
712 .subvendor = PCI_ANY_ID,
713 .subdevice = PCI_ANY_ID,
714 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
715 },
716
Harald Welte557b0692009-06-18 16:53:38 +0200717 {
Takashi Iwai8f230f42010-12-08 10:04:30 +0100718 .vendor = PCI_VENDOR_ID_JMICRON,
719 .device = PCI_DEVICE_ID_JMICRON_JMB388_SD,
720 .subvendor = PCI_ANY_ID,
721 .subdevice = PCI_ANY_ID,
722 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
723 },
724
725 {
726 .vendor = PCI_VENDOR_ID_JMICRON,
727 .device = PCI_DEVICE_ID_JMICRON_JMB388_ESD,
728 .subvendor = PCI_ANY_ID,
729 .subdevice = PCI_ANY_ID,
730 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
731 },
732
733 {
Nicolas Pitrea7a61862009-12-14 18:01:26 -0800734 .vendor = PCI_VENDOR_ID_SYSKONNECT,
735 .device = 0x8000,
736 .subvendor = PCI_ANY_ID,
737 .subdevice = PCI_ANY_ID,
738 .driver_data = (kernel_ulong_t)&sdhci_syskt,
739 },
740
741 {
Harald Welte557b0692009-06-18 16:53:38 +0200742 .vendor = PCI_VENDOR_ID_VIA,
743 .device = 0x95d0,
744 .subvendor = PCI_ANY_ID,
745 .subdevice = PCI_ANY_ID,
746 .driver_data = (kernel_ulong_t)&sdhci_via,
747 },
748
Xiaochen Shen29229052010-10-04 15:24:52 +0100749 {
750 .vendor = PCI_VENDOR_ID_INTEL,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100751 .device = PCI_DEVICE_ID_INTEL_MRST_SD0,
752 .subvendor = PCI_ANY_ID,
753 .subdevice = PCI_ANY_ID,
754 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc0,
755 },
756
757 {
758 .vendor = PCI_VENDOR_ID_INTEL,
759 .device = PCI_DEVICE_ID_INTEL_MRST_SD1,
760 .subvendor = PCI_ANY_ID,
761 .subdevice = PCI_ANY_ID,
Jacob Pan35ac6f02010-11-09 13:57:29 +0000762 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2,
763 },
764
765 {
766 .vendor = PCI_VENDOR_ID_INTEL,
767 .device = PCI_DEVICE_ID_INTEL_MRST_SD2,
768 .subvendor = PCI_ANY_ID,
769 .subdevice = PCI_ANY_ID,
770 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2,
Alan Coxf9ee3ea2010-10-04 15:25:11 +0100771 },
772
773 {
774 .vendor = PCI_VENDOR_ID_INTEL,
Xiaochen Shen29229052010-10-04 15:24:52 +0100775 .device = PCI_DEVICE_ID_INTEL_MFD_SD,
776 .subvendor = PCI_ANY_ID,
777 .subdevice = PCI_ANY_ID,
778 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sd,
779 },
780
781 {
782 .vendor = PCI_VENDOR_ID_INTEL,
783 .device = PCI_DEVICE_ID_INTEL_MFD_SDIO1,
784 .subvendor = PCI_ANY_ID,
785 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300786 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
Xiaochen Shen29229052010-10-04 15:24:52 +0100787 },
788
789 {
790 .vendor = PCI_VENDOR_ID_INTEL,
791 .device = PCI_DEVICE_ID_INTEL_MFD_SDIO2,
792 .subvendor = PCI_ANY_ID,
793 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300794 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
Xiaochen Shen29229052010-10-04 15:24:52 +0100795 },
796
797 {
798 .vendor = PCI_VENDOR_ID_INTEL,
799 .device = PCI_DEVICE_ID_INTEL_MFD_EMMC0,
800 .subvendor = PCI_ANY_ID,
801 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300802 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
Xiaochen Shen29229052010-10-04 15:24:52 +0100803 },
804
805 {
806 .vendor = PCI_VENDOR_ID_INTEL,
807 .device = PCI_DEVICE_ID_INTEL_MFD_EMMC1,
808 .subvendor = PCI_ANY_ID,
809 .subdevice = PCI_ANY_ID,
Adrian Hunter0d013bc2011-06-29 14:23:47 +0300810 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
Xiaochen Shen29229052010-10-04 15:24:52 +0100811 },
812
Jennifer Li26daa1e2010-11-17 23:01:59 -0500813 {
814 .vendor = PCI_VENDOR_ID_O2,
815 .device = PCI_DEVICE_ID_O2_8120,
816 .subvendor = PCI_ANY_ID,
817 .subdevice = PCI_ANY_ID,
818 .driver_data = (kernel_ulong_t)&sdhci_o2,
819 },
820
821 {
822 .vendor = PCI_VENDOR_ID_O2,
823 .device = PCI_DEVICE_ID_O2_8220,
824 .subvendor = PCI_ANY_ID,
825 .subdevice = PCI_ANY_ID,
826 .driver_data = (kernel_ulong_t)&sdhci_o2,
827 },
828
829 {
830 .vendor = PCI_VENDOR_ID_O2,
831 .device = PCI_DEVICE_ID_O2_8221,
832 .subvendor = PCI_ANY_ID,
833 .subdevice = PCI_ANY_ID,
834 .driver_data = (kernel_ulong_t)&sdhci_o2,
835 },
836
837 {
838 .vendor = PCI_VENDOR_ID_O2,
839 .device = PCI_DEVICE_ID_O2_8320,
840 .subvendor = PCI_ANY_ID,
841 .subdevice = PCI_ANY_ID,
842 .driver_data = (kernel_ulong_t)&sdhci_o2,
843 },
844
845 {
846 .vendor = PCI_VENDOR_ID_O2,
847 .device = PCI_DEVICE_ID_O2_8321,
848 .subvendor = PCI_ANY_ID,
849 .subdevice = PCI_ANY_ID,
850 .driver_data = (kernel_ulong_t)&sdhci_o2,
851 },
852
Pierre Ossman22606402008-03-23 19:33:23 +0100853 { /* Generic SD host controller */
854 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
855 },
856
857 { /* end: all zeroes */ },
858};
859
860MODULE_DEVICE_TABLE(pci, pci_ids);
861
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100862/*****************************************************************************\
863 * *
864 * SDHCI core callbacks *
865 * *
866\*****************************************************************************/
867
868static int sdhci_pci_enable_dma(struct sdhci_host *host)
869{
870 struct sdhci_pci_slot *slot;
871 struct pci_dev *pdev;
872 int ret;
873
874 slot = sdhci_priv(host);
875 pdev = slot->chip->pdev;
876
877 if (((pdev->class & 0xFFFF00) == (PCI_CLASS_SYSTEM_SDHCI << 8)) &&
878 ((pdev->class & 0x0000FF) != PCI_SDHCI_IFDMA) &&
Richard Röjforsa13abc72009-09-22 16:45:30 -0700879 (host->flags & SDHCI_USE_SDMA)) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100880 dev_warn(&pdev->dev, "Will use DMA mode even though HW "
881 "doesn't fully claim to support it.\n");
882 }
883
Yang Hongyang284901a2009-04-06 19:01:15 -0700884 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100885 if (ret)
886 return ret;
887
888 pci_set_master(pdev);
889
890 return 0;
891}
892
Major Lee68077b02011-06-29 14:23:46 +0300893static int sdhci_pci_8bit_width(struct sdhci_host *host, int width)
894{
895 u8 ctrl;
896
897 ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
898
899 switch (width) {
900 case MMC_BUS_WIDTH_8:
901 ctrl |= SDHCI_CTRL_8BITBUS;
902 ctrl &= ~SDHCI_CTRL_4BITBUS;
903 break;
904 case MMC_BUS_WIDTH_4:
905 ctrl |= SDHCI_CTRL_4BITBUS;
906 ctrl &= ~SDHCI_CTRL_8BITBUS;
907 break;
908 default:
909 ctrl &= ~(SDHCI_CTRL_8BITBUS | SDHCI_CTRL_4BITBUS);
910 break;
911 }
912
913 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
914
915 return 0;
916}
917
Adrian Hunter0f201652011-08-29 16:42:13 +0300918static void sdhci_pci_hw_reset(struct sdhci_host *host)
919{
920 struct sdhci_pci_slot *slot = sdhci_priv(host);
921 int rst_n_gpio = slot->rst_n_gpio;
922
923 if (!gpio_is_valid(rst_n_gpio))
924 return;
925 gpio_set_value_cansleep(rst_n_gpio, 0);
926 /* For eMMC, minimum is 1us but give it 10us for good measure */
927 udelay(10);
928 gpio_set_value_cansleep(rst_n_gpio, 1);
929 /* For eMMC, minimum is 200us but give it 300us for good measure */
930 usleep_range(300, 1000);
931}
932
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100933static struct sdhci_ops sdhci_pci_ops = {
934 .enable_dma = sdhci_pci_enable_dma,
Major Lee68077b02011-06-29 14:23:46 +0300935 .platform_8bit_width = sdhci_pci_8bit_width,
Adrian Hunter0f201652011-08-29 16:42:13 +0300936 .hw_reset = sdhci_pci_hw_reset,
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100937};
938
939/*****************************************************************************\
940 * *
941 * Suspend/resume *
942 * *
943\*****************************************************************************/
944
945#ifdef CONFIG_PM
946
Manuel Lauss29495aa2011-11-03 11:09:45 +0100947static int sdhci_pci_suspend(struct device *dev)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100948{
Manuel Lauss29495aa2011-11-03 11:09:45 +0100949 struct pci_dev *pdev = to_pci_dev(dev);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100950 struct sdhci_pci_chip *chip;
951 struct sdhci_pci_slot *slot;
Daniel Drake5f619702010-11-04 22:20:39 +0000952 mmc_pm_flag_t slot_pm_flags;
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800953 mmc_pm_flag_t pm_flags = 0;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100954 int i, ret;
955
956 chip = pci_get_drvdata(pdev);
957 if (!chip)
958 return 0;
959
Ameya Palandeb177bc92011-04-05 21:13:13 +0300960 for (i = 0; i < chip->num_slots; i++) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100961 slot = chip->slots[i];
962 if (!slot)
963 continue;
964
Manuel Lauss29495aa2011-11-03 11:09:45 +0100965 ret = sdhci_suspend_host(slot->host);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100966
Axel Linb678b912011-12-03 15:28:05 +0800967 if (ret)
968 goto err_pci_suspend;
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800969
Daniel Drake5f619702010-11-04 22:20:39 +0000970 slot_pm_flags = slot->host->mmc->pm_flags;
971 if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
972 sdhci_enable_irq_wakeups(slot->host);
973
974 pm_flags |= slot_pm_flags;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100975 }
976
Pierre Ossman44894282008-04-04 19:36:59 +0200977 if (chip->fixes && chip->fixes->suspend) {
Manuel Lauss29495aa2011-11-03 11:09:45 +0100978 ret = chip->fixes->suspend(chip);
Axel Linb678b912011-12-03 15:28:05 +0800979 if (ret)
980 goto err_pci_suspend;
Pierre Ossman44894282008-04-04 19:36:59 +0200981 }
982
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100983 pci_save_state(pdev);
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800984 if (pm_flags & MMC_PM_KEEP_POWER) {
Daniel Drake5f619702010-11-04 22:20:39 +0000985 if (pm_flags & MMC_PM_WAKE_SDIO_IRQ) {
986 pci_pme_active(pdev, true);
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800987 pci_enable_wake(pdev, PCI_D3hot, 1);
Daniel Drake5f619702010-11-04 22:20:39 +0000988 }
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800989 pci_set_power_state(pdev, PCI_D3hot);
990 } else {
Manuel Lauss29495aa2011-11-03 11:09:45 +0100991 pci_enable_wake(pdev, PCI_D3hot, 0);
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800992 pci_disable_device(pdev);
Manuel Lauss29495aa2011-11-03 11:09:45 +0100993 pci_set_power_state(pdev, PCI_D3hot);
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -0800994 }
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +0100995
996 return 0;
Axel Linb678b912011-12-03 15:28:05 +0800997
998err_pci_suspend:
999 while (--i >= 0)
1000 sdhci_resume_host(chip->slots[i]->host);
1001 return ret;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001002}
1003
Manuel Lauss29495aa2011-11-03 11:09:45 +01001004static int sdhci_pci_resume(struct device *dev)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001005{
Manuel Lauss29495aa2011-11-03 11:09:45 +01001006 struct pci_dev *pdev = to_pci_dev(dev);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001007 struct sdhci_pci_chip *chip;
1008 struct sdhci_pci_slot *slot;
1009 int i, ret;
1010
1011 chip = pci_get_drvdata(pdev);
1012 if (!chip)
1013 return 0;
1014
1015 pci_set_power_state(pdev, PCI_D0);
1016 pci_restore_state(pdev);
1017 ret = pci_enable_device(pdev);
1018 if (ret)
1019 return ret;
1020
Pierre Ossman45211e22008-03-24 13:09:09 +01001021 if (chip->fixes && chip->fixes->resume) {
1022 ret = chip->fixes->resume(chip);
1023 if (ret)
1024 return ret;
1025 }
1026
Ameya Palandeb177bc92011-04-05 21:13:13 +03001027 for (i = 0; i < chip->num_slots; i++) {
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001028 slot = chip->slots[i];
1029 if (!slot)
1030 continue;
1031
1032 ret = sdhci_resume_host(slot->host);
1033 if (ret)
1034 return ret;
1035 }
1036
1037 return 0;
1038}
1039
1040#else /* CONFIG_PM */
1041
1042#define sdhci_pci_suspend NULL
1043#define sdhci_pci_resume NULL
1044
1045#endif /* CONFIG_PM */
1046
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001047#ifdef CONFIG_PM_RUNTIME
1048
1049static int sdhci_pci_runtime_suspend(struct device *dev)
1050{
1051 struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
1052 struct sdhci_pci_chip *chip;
1053 struct sdhci_pci_slot *slot;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001054 int i, ret;
1055
1056 chip = pci_get_drvdata(pdev);
1057 if (!chip)
1058 return 0;
1059
1060 for (i = 0; i < chip->num_slots; i++) {
1061 slot = chip->slots[i];
1062 if (!slot)
1063 continue;
1064
1065 ret = sdhci_runtime_suspend_host(slot->host);
1066
Axel Linb678b912011-12-03 15:28:05 +08001067 if (ret)
1068 goto err_pci_runtime_suspend;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001069 }
1070
1071 if (chip->fixes && chip->fixes->suspend) {
Manuel Lauss29495aa2011-11-03 11:09:45 +01001072 ret = chip->fixes->suspend(chip);
Axel Linb678b912011-12-03 15:28:05 +08001073 if (ret)
1074 goto err_pci_runtime_suspend;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001075 }
1076
1077 return 0;
Axel Linb678b912011-12-03 15:28:05 +08001078
1079err_pci_runtime_suspend:
1080 while (--i >= 0)
1081 sdhci_runtime_resume_host(chip->slots[i]->host);
1082 return ret;
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001083}
1084
1085static int sdhci_pci_runtime_resume(struct device *dev)
1086{
1087 struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
1088 struct sdhci_pci_chip *chip;
1089 struct sdhci_pci_slot *slot;
1090 int i, ret;
1091
1092 chip = pci_get_drvdata(pdev);
1093 if (!chip)
1094 return 0;
1095
1096 if (chip->fixes && chip->fixes->resume) {
1097 ret = chip->fixes->resume(chip);
1098 if (ret)
1099 return ret;
1100 }
1101
1102 for (i = 0; i < chip->num_slots; i++) {
1103 slot = chip->slots[i];
1104 if (!slot)
1105 continue;
1106
1107 ret = sdhci_runtime_resume_host(slot->host);
1108 if (ret)
1109 return ret;
1110 }
1111
1112 return 0;
1113}
1114
1115static int sdhci_pci_runtime_idle(struct device *dev)
1116{
1117 return 0;
1118}
1119
1120#else
1121
1122#define sdhci_pci_runtime_suspend NULL
1123#define sdhci_pci_runtime_resume NULL
1124#define sdhci_pci_runtime_idle NULL
1125
1126#endif
1127
1128static const struct dev_pm_ops sdhci_pci_pm_ops = {
Manuel Lauss29495aa2011-11-03 11:09:45 +01001129 .suspend = sdhci_pci_suspend,
1130 .resume = sdhci_pci_resume,
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001131 .runtime_suspend = sdhci_pci_runtime_suspend,
1132 .runtime_resume = sdhci_pci_runtime_resume,
1133 .runtime_idle = sdhci_pci_runtime_idle,
1134};
1135
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001136/*****************************************************************************\
1137 * *
1138 * Device probing/removal *
1139 * *
1140\*****************************************************************************/
1141
1142static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
Adrian Hunter52c506f2011-12-27 15:48:43 +02001143 struct pci_dev *pdev, struct sdhci_pci_chip *chip, int first_bar,
1144 int slotno)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001145{
1146 struct sdhci_pci_slot *slot;
1147 struct sdhci_host *host;
Adrian Hunter52c506f2011-12-27 15:48:43 +02001148 int ret, bar = first_bar + slotno;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001149
1150 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1151 dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
1152 return ERR_PTR(-ENODEV);
1153 }
1154
1155 if (pci_resource_len(pdev, bar) != 0x100) {
1156 dev_err(&pdev->dev, "Invalid iomem size. You may "
1157 "experience problems.\n");
1158 }
1159
1160 if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
1161 dev_err(&pdev->dev, "Vendor specific interface. Aborting.\n");
1162 return ERR_PTR(-ENODEV);
1163 }
1164
1165 if ((pdev->class & 0x0000FF) > PCI_SDHCI_IFVENDOR) {
1166 dev_err(&pdev->dev, "Unknown interface. Aborting.\n");
1167 return ERR_PTR(-ENODEV);
1168 }
1169
1170 host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
1171 if (IS_ERR(host)) {
Dan Carpenterc60a32c2009-04-10 23:31:10 +02001172 dev_err(&pdev->dev, "cannot allocate host\n");
Julia Lawalldc0fd7b2010-05-26 14:42:11 -07001173 return ERR_CAST(host);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001174 }
1175
1176 slot = sdhci_priv(host);
1177
1178 slot->chip = chip;
1179 slot->host = host;
1180 slot->pci_bar = bar;
Adrian Hunter0f201652011-08-29 16:42:13 +03001181 slot->rst_n_gpio = -EINVAL;
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001182 slot->cd_gpio = -EINVAL;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001183
Adrian Hunter52c506f2011-12-27 15:48:43 +02001184 /* Retrieve platform data if there is any */
1185 if (*sdhci_pci_get_data)
1186 slot->data = sdhci_pci_get_data(pdev, slotno);
1187
1188 if (slot->data) {
1189 if (slot->data->setup) {
1190 ret = slot->data->setup(slot->data);
1191 if (ret) {
1192 dev_err(&pdev->dev, "platform setup failed\n");
1193 goto free;
1194 }
1195 }
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001196 slot->rst_n_gpio = slot->data->rst_n_gpio;
1197 slot->cd_gpio = slot->data->cd_gpio;
Adrian Hunter52c506f2011-12-27 15:48:43 +02001198 }
1199
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001200 host->hw_name = "PCI";
1201 host->ops = &sdhci_pci_ops;
1202 host->quirks = chip->quirks;
1203
1204 host->irq = pdev->irq;
1205
1206 ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc));
1207 if (ret) {
1208 dev_err(&pdev->dev, "cannot request region\n");
Adrian Hunter52c506f2011-12-27 15:48:43 +02001209 goto cleanup;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001210 }
1211
Arjan van de Ven092f82e2008-09-28 16:15:56 -07001212 host->ioaddr = pci_ioremap_bar(pdev, bar);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001213 if (!host->ioaddr) {
1214 dev_err(&pdev->dev, "failed to remap registers\n");
Chris Ball9fdcdbb2011-03-29 00:46:12 -04001215 ret = -ENOMEM;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001216 goto release;
1217 }
1218
Pierre Ossman44894282008-04-04 19:36:59 +02001219 if (chip->fixes && chip->fixes->probe_slot) {
1220 ret = chip->fixes->probe_slot(slot);
1221 if (ret)
1222 goto unmap;
1223 }
1224
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001225 if (gpio_is_valid(slot->rst_n_gpio)) {
1226 if (!gpio_request(slot->rst_n_gpio, "eMMC_reset")) {
1227 gpio_direction_output(slot->rst_n_gpio, 1);
1228 slot->host->mmc->caps |= MMC_CAP_HW_RESET;
1229 } else {
1230 dev_warn(&pdev->dev, "failed to request rst_n_gpio\n");
1231 slot->rst_n_gpio = -EINVAL;
1232 }
1233 }
1234
Nicolas Pitre2f4cbb32010-03-05 13:43:32 -08001235 host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ;
1236
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001237 ret = sdhci_add_host(host);
1238 if (ret)
Pierre Ossman44894282008-04-04 19:36:59 +02001239 goto remove;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001240
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001241 sdhci_pci_add_own_cd(slot);
1242
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001243 return slot;
1244
Pierre Ossman44894282008-04-04 19:36:59 +02001245remove:
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001246 if (gpio_is_valid(slot->rst_n_gpio))
1247 gpio_free(slot->rst_n_gpio);
1248
Pierre Ossman44894282008-04-04 19:36:59 +02001249 if (chip->fixes && chip->fixes->remove_slot)
Pierre Ossman1e728592008-04-16 19:13:13 +02001250 chip->fixes->remove_slot(slot, 0);
Pierre Ossman44894282008-04-04 19:36:59 +02001251
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001252unmap:
1253 iounmap(host->ioaddr);
1254
1255release:
1256 pci_release_region(pdev, bar);
Dan Carpenterc60a32c2009-04-10 23:31:10 +02001257
Adrian Hunter52c506f2011-12-27 15:48:43 +02001258cleanup:
1259 if (slot->data && slot->data->cleanup)
1260 slot->data->cleanup(slot->data);
1261
Dan Carpenterc60a32c2009-04-10 23:31:10 +02001262free:
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001263 sdhci_free_host(host);
1264
1265 return ERR_PTR(ret);
1266}
1267
1268static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
1269{
Pierre Ossman1e728592008-04-16 19:13:13 +02001270 int dead;
1271 u32 scratch;
1272
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001273 sdhci_pci_remove_own_cd(slot);
1274
Pierre Ossman1e728592008-04-16 19:13:13 +02001275 dead = 0;
1276 scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS);
1277 if (scratch == (u32)-1)
1278 dead = 1;
1279
1280 sdhci_remove_host(slot->host, dead);
Pierre Ossman44894282008-04-04 19:36:59 +02001281
Adrian Hunterc5e027a2011-12-27 15:48:44 +02001282 if (gpio_is_valid(slot->rst_n_gpio))
1283 gpio_free(slot->rst_n_gpio);
1284
Pierre Ossman44894282008-04-04 19:36:59 +02001285 if (slot->chip->fixes && slot->chip->fixes->remove_slot)
Pierre Ossman1e728592008-04-16 19:13:13 +02001286 slot->chip->fixes->remove_slot(slot, dead);
Pierre Ossman44894282008-04-04 19:36:59 +02001287
Adrian Hunter52c506f2011-12-27 15:48:43 +02001288 if (slot->data && slot->data->cleanup)
1289 slot->data->cleanup(slot->data);
1290
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001291 pci_release_region(slot->chip->pdev, slot->pci_bar);
Pierre Ossman44894282008-04-04 19:36:59 +02001292
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001293 sdhci_free_host(slot->host);
1294}
1295
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001296static void __devinit sdhci_pci_runtime_pm_allow(struct device *dev)
1297{
1298 pm_runtime_put_noidle(dev);
1299 pm_runtime_allow(dev);
1300 pm_runtime_set_autosuspend_delay(dev, 50);
1301 pm_runtime_use_autosuspend(dev);
1302 pm_suspend_ignore_children(dev, 1);
1303}
1304
1305static void __devexit sdhci_pci_runtime_pm_forbid(struct device *dev)
1306{
1307 pm_runtime_forbid(dev);
1308 pm_runtime_get_noresume(dev);
1309}
1310
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001311static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
1312 const struct pci_device_id *ent)
1313{
1314 struct sdhci_pci_chip *chip;
1315 struct sdhci_pci_slot *slot;
1316
Sergei Shtylyovcf5e23e2011-03-17 16:46:17 -04001317 u8 slots, first_bar;
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001318 int ret, i;
1319
1320 BUG_ON(pdev == NULL);
1321 BUG_ON(ent == NULL);
1322
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001323 dev_info(&pdev->dev, "SDHCI controller found [%04x:%04x] (rev %x)\n",
Sergei Shtylyovcf5e23e2011-03-17 16:46:17 -04001324 (int)pdev->vendor, (int)pdev->device, (int)pdev->revision);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001325
1326 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots);
1327 if (ret)
1328 return ret;
1329
1330 slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
1331 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
1332 if (slots == 0)
1333 return -ENODEV;
1334
1335 BUG_ON(slots > MAX_SLOTS);
1336
1337 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar);
1338 if (ret)
1339 return ret;
1340
1341 first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
1342
1343 if (first_bar > 5) {
1344 dev_err(&pdev->dev, "Invalid first BAR. Aborting.\n");
1345 return -ENODEV;
1346 }
1347
1348 ret = pci_enable_device(pdev);
1349 if (ret)
1350 return ret;
1351
1352 chip = kzalloc(sizeof(struct sdhci_pci_chip), GFP_KERNEL);
1353 if (!chip) {
1354 ret = -ENOMEM;
1355 goto err;
1356 }
1357
1358 chip->pdev = pdev;
Ameya Palandeb177bc92011-04-05 21:13:13 +03001359 chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
Adrian Hunterc43fd772011-10-17 10:52:44 +03001360 if (chip->fixes) {
Pierre Ossman22606402008-03-23 19:33:23 +01001361 chip->quirks = chip->fixes->quirks;
Adrian Hunterc43fd772011-10-17 10:52:44 +03001362 chip->allow_runtime_pm = chip->fixes->allow_runtime_pm;
1363 }
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001364 chip->num_slots = slots;
1365
1366 pci_set_drvdata(pdev, chip);
1367
Pierre Ossman22606402008-03-23 19:33:23 +01001368 if (chip->fixes && chip->fixes->probe) {
1369 ret = chip->fixes->probe(chip);
1370 if (ret)
1371 goto free;
1372 }
1373
Alan Cox225d85f2010-10-04 15:24:21 +01001374 slots = chip->num_slots; /* Quirk may have changed this */
1375
Ameya Palandeb177bc92011-04-05 21:13:13 +03001376 for (i = 0; i < slots; i++) {
Adrian Hunter52c506f2011-12-27 15:48:43 +02001377 slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i);
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001378 if (IS_ERR(slot)) {
Ameya Palandeb177bc92011-04-05 21:13:13 +03001379 for (i--; i >= 0; i--)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001380 sdhci_pci_remove_slot(chip->slots[i]);
1381 ret = PTR_ERR(slot);
1382 goto free;
1383 }
1384
1385 chip->slots[i] = slot;
1386 }
1387
Adrian Hunterc43fd772011-10-17 10:52:44 +03001388 if (chip->allow_runtime_pm)
1389 sdhci_pci_runtime_pm_allow(&pdev->dev);
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001390
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001391 return 0;
1392
1393free:
1394 pci_set_drvdata(pdev, NULL);
1395 kfree(chip);
1396
1397err:
1398 pci_disable_device(pdev);
1399 return ret;
1400}
1401
1402static void __devexit sdhci_pci_remove(struct pci_dev *pdev)
1403{
1404 int i;
1405 struct sdhci_pci_chip *chip;
1406
1407 chip = pci_get_drvdata(pdev);
1408
1409 if (chip) {
Adrian Hunterc43fd772011-10-17 10:52:44 +03001410 if (chip->allow_runtime_pm)
1411 sdhci_pci_runtime_pm_forbid(&pdev->dev);
1412
Ameya Palandeb177bc92011-04-05 21:13:13 +03001413 for (i = 0; i < chip->num_slots; i++)
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001414 sdhci_pci_remove_slot(chip->slots[i]);
1415
1416 pci_set_drvdata(pdev, NULL);
1417 kfree(chip);
1418 }
1419
1420 pci_disable_device(pdev);
1421}
1422
1423static struct pci_driver sdhci_driver = {
Ameya Palandeb177bc92011-04-05 21:13:13 +03001424 .name = "sdhci-pci",
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001425 .id_table = pci_ids,
Ameya Palandeb177bc92011-04-05 21:13:13 +03001426 .probe = sdhci_pci_probe,
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001427 .remove = __devexit_p(sdhci_pci_remove),
Adrian Hunter66fd8ad2011-10-03 15:33:34 +03001428 .driver = {
1429 .pm = &sdhci_pci_pm_ops
1430 },
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001431};
1432
1433/*****************************************************************************\
1434 * *
1435 * Driver init/exit *
1436 * *
1437\*****************************************************************************/
1438
1439static int __init sdhci_drv_init(void)
1440{
1441 return pci_register_driver(&sdhci_driver);
1442}
1443
1444static void __exit sdhci_drv_exit(void)
1445{
1446 pci_unregister_driver(&sdhci_driver);
1447}
1448
1449module_init(sdhci_drv_init);
1450module_exit(sdhci_drv_exit);
1451
Pierre Ossman32710e82009-04-08 20:14:54 +02001452MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>");
Pierre Ossmanb8c86fc2008-03-18 17:35:49 +01001453MODULE_DESCRIPTION("Secure Digital Host Controller Interface PCI driver");
1454MODULE_LICENSE("GPL");