Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1 | /* 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 Gortmaker | a4df3ae | 2011-07-03 15:15:51 -0400 | [diff] [blame^] | 17 | #include <linux/module.h> |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 18 | #include <linux/pci.h> |
| 19 | #include <linux/dma-mapping.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 20 | #include <linux/slab.h> |
Maxim Levitsky | ccc92c2 | 2010-08-10 18:01:42 -0700 | [diff] [blame] | 21 | #include <linux/device.h> |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 22 | #include <linux/mmc/host.h> |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 23 | #include <linux/scatterlist.h> |
| 24 | #include <linux/io.h> |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 25 | |
| 26 | #include "sdhci.h" |
| 27 | |
| 28 | /* |
| 29 | * PCI registers |
| 30 | */ |
| 31 | |
| 32 | #define PCI_SDHCI_IFPIO 0x00 |
| 33 | #define PCI_SDHCI_IFDMA 0x01 |
| 34 | #define PCI_SDHCI_IFVENDOR 0x02 |
| 35 | |
| 36 | #define PCI_SLOT_INFO 0x40 /* 8 bits */ |
| 37 | #define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7) |
| 38 | #define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07 |
| 39 | |
| 40 | #define MAX_SLOTS 8 |
| 41 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 42 | struct sdhci_pci_chip; |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 43 | struct sdhci_pci_slot; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 44 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 45 | struct sdhci_pci_fixes { |
| 46 | unsigned int quirks; |
| 47 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 48 | int (*probe) (struct sdhci_pci_chip *); |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 49 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 50 | int (*probe_slot) (struct sdhci_pci_slot *); |
| 51 | void (*remove_slot) (struct sdhci_pci_slot *, int); |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 52 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 53 | int (*suspend) (struct sdhci_pci_chip *, |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 54 | pm_message_t); |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 55 | int (*resume) (struct sdhci_pci_chip *); |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 56 | }; |
| 57 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 58 | struct sdhci_pci_slot { |
| 59 | struct sdhci_pci_chip *chip; |
| 60 | struct sdhci_host *host; |
| 61 | |
| 62 | int pci_bar; |
| 63 | }; |
| 64 | |
| 65 | struct sdhci_pci_chip { |
| 66 | struct pci_dev *pdev; |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 67 | |
| 68 | unsigned int quirks; |
| 69 | const struct sdhci_pci_fixes *fixes; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 70 | |
| 71 | int num_slots; /* Slots on controller */ |
| 72 | struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */ |
| 73 | }; |
| 74 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 75 | |
| 76 | /*****************************************************************************\ |
| 77 | * * |
| 78 | * Hardware specific quirk handling * |
| 79 | * * |
| 80 | \*****************************************************************************/ |
| 81 | |
| 82 | static int ricoh_probe(struct sdhci_pci_chip *chip) |
| 83 | { |
Chris Ball | c99436f | 2009-09-22 16:45:22 -0700 | [diff] [blame] | 84 | if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG || |
| 85 | chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY) |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 86 | chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET; |
Maxim Levitsky | ccc92c2 | 2010-08-10 18:01:42 -0700 | [diff] [blame] | 87 | return 0; |
| 88 | } |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 89 | |
Maxim Levitsky | ccc92c2 | 2010-08-10 18:01:42 -0700 | [diff] [blame] | 90 | static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot) |
| 91 | { |
| 92 | slot->host->caps = |
| 93 | ((0x21 << SDHCI_TIMEOUT_CLK_SHIFT) |
| 94 | & SDHCI_TIMEOUT_CLK_MASK) | |
| 95 | |
| 96 | ((0x21 << SDHCI_CLOCK_BASE_SHIFT) |
| 97 | & SDHCI_CLOCK_BASE_MASK) | |
| 98 | |
| 99 | SDHCI_TIMEOUT_CLK_UNIT | |
| 100 | SDHCI_CAN_VDD_330 | |
| 101 | SDHCI_CAN_DO_SDMA; |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static int ricoh_mmc_resume(struct sdhci_pci_chip *chip) |
| 106 | { |
| 107 | /* Apply a delay to allow controller to settle */ |
| 108 | /* Otherwise it becomes confused if card state changed |
| 109 | during suspend */ |
| 110 | msleep(500); |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 111 | return 0; |
| 112 | } |
| 113 | |
| 114 | static const struct sdhci_pci_fixes sdhci_ricoh = { |
| 115 | .probe = ricoh_probe, |
Vasily Khoruzhick | 8493829 | 2010-03-05 13:43:46 -0800 | [diff] [blame] | 116 | .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | |
| 117 | SDHCI_QUIRK_FORCE_DMA | |
| 118 | SDHCI_QUIRK_CLOCK_BEFORE_RESET, |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 119 | }; |
| 120 | |
Maxim Levitsky | ccc92c2 | 2010-08-10 18:01:42 -0700 | [diff] [blame] | 121 | static const struct sdhci_pci_fixes sdhci_ricoh_mmc = { |
| 122 | .probe_slot = ricoh_mmc_probe_slot, |
| 123 | .resume = ricoh_mmc_resume, |
| 124 | .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | |
| 125 | SDHCI_QUIRK_CLOCK_BEFORE_RESET | |
| 126 | SDHCI_QUIRK_NO_CARD_NO_RESET | |
| 127 | SDHCI_QUIRK_MISSING_CAPS |
| 128 | }; |
| 129 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 130 | static const struct sdhci_pci_fixes sdhci_ene_712 = { |
| 131 | .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE | |
| 132 | SDHCI_QUIRK_BROKEN_DMA, |
| 133 | }; |
| 134 | |
| 135 | static const struct sdhci_pci_fixes sdhci_ene_714 = { |
| 136 | .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE | |
| 137 | SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS | |
| 138 | SDHCI_QUIRK_BROKEN_DMA, |
| 139 | }; |
| 140 | |
| 141 | static const struct sdhci_pci_fixes sdhci_cafe = { |
| 142 | .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER | |
Andres Salomon | a087489 | 2009-03-02 21:48:20 +0100 | [diff] [blame] | 143 | SDHCI_QUIRK_NO_BUSY_IRQ | |
Pierre Ossman | ee53ab5 | 2008-07-05 00:25:15 +0200 | [diff] [blame] | 144 | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL, |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 145 | }; |
| 146 | |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 147 | /* |
| 148 | * ADMA operation is disabled for Moorestown platform due to |
| 149 | * hardware bugs. |
| 150 | */ |
Jacob Pan | 35ac6f0 | 2010-11-09 13:57:29 +0000 | [diff] [blame] | 151 | static int mrst_hc_probe(struct sdhci_pci_chip *chip) |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 152 | { |
| 153 | /* |
Jacob Pan | 35ac6f0 | 2010-11-09 13:57:29 +0000 | [diff] [blame] | 154 | * slots number is fixed here for MRST as SDIO3/5 are never used and |
| 155 | * have hardware bugs. |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 156 | */ |
| 157 | chip->num_slots = 1; |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = { |
| 162 | .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT, |
| 163 | }; |
| 164 | |
Jacob Pan | 35ac6f0 | 2010-11-09 13:57:29 +0000 | [diff] [blame] | 165 | static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = { |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 166 | .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT, |
Jacob Pan | 35ac6f0 | 2010-11-09 13:57:29 +0000 | [diff] [blame] | 167 | .probe = mrst_hc_probe, |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 168 | }; |
| 169 | |
Xiaochen Shen | 2922905 | 2010-10-04 15:24:52 +0100 | [diff] [blame] | 170 | static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = { |
| 171 | .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, |
| 172 | }; |
| 173 | |
| 174 | static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc_sdio = { |
| 175 | .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, |
| 176 | }; |
| 177 | |
Jennifer Li | 26daa1e | 2010-11-17 23:01:59 -0500 | [diff] [blame] | 178 | /* O2Micro extra registers */ |
| 179 | #define O2_SD_LOCK_WP 0xD3 |
| 180 | #define O2_SD_MULTI_VCC3V 0xEE |
| 181 | #define O2_SD_CLKREQ 0xEC |
| 182 | #define O2_SD_CAPS 0xE0 |
| 183 | #define O2_SD_ADMA1 0xE2 |
| 184 | #define O2_SD_ADMA2 0xE7 |
| 185 | #define O2_SD_INF_MOD 0xF1 |
| 186 | |
| 187 | static int o2_probe(struct sdhci_pci_chip *chip) |
| 188 | { |
| 189 | int ret; |
| 190 | u8 scratch; |
| 191 | |
| 192 | switch (chip->pdev->device) { |
| 193 | case PCI_DEVICE_ID_O2_8220: |
| 194 | case PCI_DEVICE_ID_O2_8221: |
| 195 | case PCI_DEVICE_ID_O2_8320: |
| 196 | case PCI_DEVICE_ID_O2_8321: |
| 197 | /* This extra setup is required due to broken ADMA. */ |
| 198 | ret = pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch); |
| 199 | if (ret) |
| 200 | return ret; |
| 201 | scratch &= 0x7f; |
| 202 | pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); |
| 203 | |
| 204 | /* Set Multi 3 to VCC3V# */ |
| 205 | pci_write_config_byte(chip->pdev, O2_SD_MULTI_VCC3V, 0x08); |
| 206 | |
| 207 | /* Disable CLK_REQ# support after media DET */ |
| 208 | ret = pci_read_config_byte(chip->pdev, O2_SD_CLKREQ, &scratch); |
| 209 | if (ret) |
| 210 | return ret; |
| 211 | scratch |= 0x20; |
| 212 | pci_write_config_byte(chip->pdev, O2_SD_CLKREQ, scratch); |
| 213 | |
| 214 | /* Choose capabilities, enable SDMA. We have to write 0x01 |
| 215 | * to the capabilities register first to unlock it. |
| 216 | */ |
| 217 | ret = pci_read_config_byte(chip->pdev, O2_SD_CAPS, &scratch); |
| 218 | if (ret) |
| 219 | return ret; |
| 220 | scratch |= 0x01; |
| 221 | pci_write_config_byte(chip->pdev, O2_SD_CAPS, scratch); |
| 222 | pci_write_config_byte(chip->pdev, O2_SD_CAPS, 0x73); |
| 223 | |
| 224 | /* Disable ADMA1/2 */ |
| 225 | pci_write_config_byte(chip->pdev, O2_SD_ADMA1, 0x39); |
| 226 | pci_write_config_byte(chip->pdev, O2_SD_ADMA2, 0x08); |
| 227 | |
| 228 | /* Disable the infinite transfer mode */ |
| 229 | ret = pci_read_config_byte(chip->pdev, O2_SD_INF_MOD, &scratch); |
| 230 | if (ret) |
| 231 | return ret; |
| 232 | scratch |= 0x08; |
| 233 | pci_write_config_byte(chip->pdev, O2_SD_INF_MOD, scratch); |
| 234 | |
| 235 | /* Lock WP */ |
| 236 | ret = pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch); |
| 237 | if (ret) |
| 238 | return ret; |
| 239 | scratch |= 0x80; |
| 240 | pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); |
| 241 | } |
| 242 | |
| 243 | return 0; |
| 244 | } |
| 245 | |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 246 | static int jmicron_pmos(struct sdhci_pci_chip *chip, int on) |
| 247 | { |
| 248 | u8 scratch; |
| 249 | int ret; |
| 250 | |
| 251 | ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch); |
| 252 | if (ret) |
| 253 | return ret; |
| 254 | |
| 255 | /* |
| 256 | * Turn PMOS on [bit 0], set over current detection to 2.4 V |
| 257 | * [bit 1:2] and enable over current debouncing [bit 6]. |
| 258 | */ |
| 259 | if (on) |
| 260 | scratch |= 0x47; |
| 261 | else |
| 262 | scratch &= ~0x47; |
| 263 | |
| 264 | ret = pci_write_config_byte(chip->pdev, 0xAE, scratch); |
| 265 | if (ret) |
| 266 | return ret; |
| 267 | |
| 268 | return 0; |
| 269 | } |
| 270 | |
| 271 | static int jmicron_probe(struct sdhci_pci_chip *chip) |
| 272 | { |
| 273 | int ret; |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 274 | u16 mmcdev = 0; |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 275 | |
Pierre Ossman | 93fc48c | 2008-06-28 18:21:41 +0200 | [diff] [blame] | 276 | if (chip->pdev->revision == 0) { |
| 277 | chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR | |
| 278 | SDHCI_QUIRK_32BIT_DMA_SIZE | |
Pierre Ossman | 2134a92 | 2008-06-28 18:28:51 +0200 | [diff] [blame] | 279 | SDHCI_QUIRK_32BIT_ADMA_SIZE | |
Pierre Ossman | 4a3cba3 | 2008-07-29 00:11:16 +0200 | [diff] [blame] | 280 | SDHCI_QUIRK_RESET_AFTER_REQUEST | |
Pierre Ossman | 86a6a87 | 2009-02-02 21:13:49 +0100 | [diff] [blame] | 281 | SDHCI_QUIRK_BROKEN_SMALL_PIO; |
Pierre Ossman | 93fc48c | 2008-06-28 18:21:41 +0200 | [diff] [blame] | 282 | } |
| 283 | |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 284 | /* |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 285 | * JMicron chips can have two interfaces to the same hardware |
| 286 | * in order to work around limitations in Microsoft's driver. |
| 287 | * We need to make sure we only bind to one of them. |
| 288 | * |
| 289 | * This code assumes two things: |
| 290 | * |
| 291 | * 1. The PCI code adds subfunctions in order. |
| 292 | * |
| 293 | * 2. The MMC interface has a lower subfunction number |
| 294 | * than the SD interface. |
| 295 | */ |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 296 | if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_SD) |
| 297 | mmcdev = PCI_DEVICE_ID_JMICRON_JMB38X_MMC; |
| 298 | else if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD) |
| 299 | mmcdev = PCI_DEVICE_ID_JMICRON_JMB388_ESD; |
| 300 | |
| 301 | if (mmcdev) { |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 302 | struct pci_dev *sd_dev; |
| 303 | |
| 304 | sd_dev = NULL; |
| 305 | while ((sd_dev = pci_get_device(PCI_VENDOR_ID_JMICRON, |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 306 | mmcdev, sd_dev)) != NULL) { |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 307 | if ((PCI_SLOT(chip->pdev->devfn) == |
| 308 | PCI_SLOT(sd_dev->devfn)) && |
| 309 | (chip->pdev->bus == sd_dev->bus)) |
| 310 | break; |
| 311 | } |
| 312 | |
| 313 | if (sd_dev) { |
| 314 | pci_dev_put(sd_dev); |
| 315 | dev_info(&chip->pdev->dev, "Refusing to bind to " |
| 316 | "secondary interface.\n"); |
| 317 | return -ENODEV; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | /* |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 322 | * JMicron chips need a bit of a nudge to enable the power |
| 323 | * output pins. |
| 324 | */ |
| 325 | ret = jmicron_pmos(chip, 1); |
| 326 | if (ret) { |
| 327 | dev_err(&chip->pdev->dev, "Failure enabling card power\n"); |
| 328 | return ret; |
| 329 | } |
| 330 | |
Takashi Iwai | 82b0e23 | 2011-04-21 20:26:38 +0200 | [diff] [blame] | 331 | /* quirk for unsable RO-detection on JM388 chips */ |
| 332 | if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD || |
| 333 | chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) |
| 334 | chip->quirks |= SDHCI_QUIRK_UNSTABLE_RO_DETECT; |
| 335 | |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 336 | return 0; |
| 337 | } |
| 338 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 339 | static void jmicron_enable_mmc(struct sdhci_host *host, int on) |
| 340 | { |
| 341 | u8 scratch; |
| 342 | |
| 343 | scratch = readb(host->ioaddr + 0xC0); |
| 344 | |
| 345 | if (on) |
| 346 | scratch |= 0x01; |
| 347 | else |
| 348 | scratch &= ~0x01; |
| 349 | |
| 350 | writeb(scratch, host->ioaddr + 0xC0); |
| 351 | } |
| 352 | |
| 353 | static int jmicron_probe_slot(struct sdhci_pci_slot *slot) |
| 354 | { |
Pierre Ossman | 2134a92 | 2008-06-28 18:28:51 +0200 | [diff] [blame] | 355 | if (slot->chip->pdev->revision == 0) { |
| 356 | u16 version; |
| 357 | |
| 358 | version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION); |
| 359 | version = (version & SDHCI_VENDOR_VER_MASK) >> |
| 360 | SDHCI_VENDOR_VER_SHIFT; |
| 361 | |
| 362 | /* |
| 363 | * Older versions of the chip have lots of nasty glitches |
| 364 | * in the ADMA engine. It's best just to avoid it |
| 365 | * completely. |
| 366 | */ |
| 367 | if (version < 0xAC) |
| 368 | slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; |
| 369 | } |
| 370 | |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 371 | /* JM388 MMC doesn't support 1.8V while SD supports it */ |
| 372 | if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) { |
| 373 | slot->host->ocr_avail_sd = MMC_VDD_32_33 | MMC_VDD_33_34 | |
| 374 | MMC_VDD_29_30 | MMC_VDD_30_31 | |
| 375 | MMC_VDD_165_195; /* allow 1.8V */ |
| 376 | slot->host->ocr_avail_mmc = MMC_VDD_32_33 | MMC_VDD_33_34 | |
| 377 | MMC_VDD_29_30 | MMC_VDD_30_31; /* no 1.8V for MMC */ |
| 378 | } |
| 379 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 380 | /* |
| 381 | * The secondary interface requires a bit set to get the |
| 382 | * interrupts. |
| 383 | */ |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 384 | if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || |
| 385 | slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 386 | jmicron_enable_mmc(slot->host, 1); |
| 387 | |
Takashi Iwai | d75c108 | 2010-12-16 17:54:14 +0100 | [diff] [blame] | 388 | slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST; |
| 389 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 390 | return 0; |
| 391 | } |
| 392 | |
Pierre Ossman | 1e72859 | 2008-04-16 19:13:13 +0200 | [diff] [blame] | 393 | static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 394 | { |
Pierre Ossman | 1e72859 | 2008-04-16 19:13:13 +0200 | [diff] [blame] | 395 | if (dead) |
| 396 | return; |
| 397 | |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 398 | if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || |
| 399 | slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 400 | jmicron_enable_mmc(slot->host, 0); |
| 401 | } |
| 402 | |
| 403 | static int jmicron_suspend(struct sdhci_pci_chip *chip, pm_message_t state) |
| 404 | { |
| 405 | int i; |
| 406 | |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 407 | if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || |
| 408 | chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 409 | for (i = 0; i < chip->num_slots; i++) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 410 | jmicron_enable_mmc(chip->slots[i]->host, 0); |
| 411 | } |
| 412 | |
| 413 | return 0; |
| 414 | } |
| 415 | |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 416 | static int jmicron_resume(struct sdhci_pci_chip *chip) |
| 417 | { |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 418 | int ret, i; |
| 419 | |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 420 | if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || |
| 421 | chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 422 | for (i = 0; i < chip->num_slots; i++) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 423 | jmicron_enable_mmc(chip->slots[i]->host, 1); |
| 424 | } |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 425 | |
| 426 | ret = jmicron_pmos(chip, 1); |
| 427 | if (ret) { |
| 428 | dev_err(&chip->pdev->dev, "Failure enabling card power\n"); |
| 429 | return ret; |
| 430 | } |
| 431 | |
| 432 | return 0; |
| 433 | } |
| 434 | |
Jennifer Li | 26daa1e | 2010-11-17 23:01:59 -0500 | [diff] [blame] | 435 | static const struct sdhci_pci_fixes sdhci_o2 = { |
| 436 | .probe = o2_probe, |
| 437 | }; |
| 438 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 439 | static const struct sdhci_pci_fixes sdhci_jmicron = { |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 440 | .probe = jmicron_probe, |
| 441 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 442 | .probe_slot = jmicron_probe_slot, |
| 443 | .remove_slot = jmicron_remove_slot, |
| 444 | |
| 445 | .suspend = jmicron_suspend, |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 446 | .resume = jmicron_resume, |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 447 | }; |
| 448 | |
Nicolas Pitre | a7a6186 | 2009-12-14 18:01:26 -0800 | [diff] [blame] | 449 | /* SysKonnect CardBus2SDIO extra registers */ |
| 450 | #define SYSKT_CTRL 0x200 |
| 451 | #define SYSKT_RDFIFO_STAT 0x204 |
| 452 | #define SYSKT_WRFIFO_STAT 0x208 |
| 453 | #define SYSKT_POWER_DATA 0x20c |
| 454 | #define SYSKT_POWER_330 0xef |
| 455 | #define SYSKT_POWER_300 0xf8 |
| 456 | #define SYSKT_POWER_184 0xcc |
| 457 | #define SYSKT_POWER_CMD 0x20d |
| 458 | #define SYSKT_POWER_START (1 << 7) |
| 459 | #define SYSKT_POWER_STATUS 0x20e |
| 460 | #define SYSKT_POWER_STATUS_OK (1 << 0) |
| 461 | #define SYSKT_BOARD_REV 0x210 |
| 462 | #define SYSKT_CHIP_REV 0x211 |
| 463 | #define SYSKT_CONF_DATA 0x212 |
| 464 | #define SYSKT_CONF_DATA_1V8 (1 << 2) |
| 465 | #define SYSKT_CONF_DATA_2V5 (1 << 1) |
| 466 | #define SYSKT_CONF_DATA_3V3 (1 << 0) |
| 467 | |
| 468 | static int syskt_probe(struct sdhci_pci_chip *chip) |
| 469 | { |
| 470 | if ((chip->pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) { |
| 471 | chip->pdev->class &= ~0x0000FF; |
| 472 | chip->pdev->class |= PCI_SDHCI_IFDMA; |
| 473 | } |
| 474 | return 0; |
| 475 | } |
| 476 | |
| 477 | static int syskt_probe_slot(struct sdhci_pci_slot *slot) |
| 478 | { |
| 479 | int tm, ps; |
| 480 | |
| 481 | u8 board_rev = readb(slot->host->ioaddr + SYSKT_BOARD_REV); |
| 482 | u8 chip_rev = readb(slot->host->ioaddr + SYSKT_CHIP_REV); |
| 483 | dev_info(&slot->chip->pdev->dev, "SysKonnect CardBus2SDIO, " |
| 484 | "board rev %d.%d, chip rev %d.%d\n", |
| 485 | board_rev >> 4, board_rev & 0xf, |
| 486 | chip_rev >> 4, chip_rev & 0xf); |
| 487 | if (chip_rev >= 0x20) |
| 488 | slot->host->quirks |= SDHCI_QUIRK_FORCE_DMA; |
| 489 | |
| 490 | writeb(SYSKT_POWER_330, slot->host->ioaddr + SYSKT_POWER_DATA); |
| 491 | writeb(SYSKT_POWER_START, slot->host->ioaddr + SYSKT_POWER_CMD); |
| 492 | udelay(50); |
| 493 | tm = 10; /* Wait max 1 ms */ |
| 494 | do { |
| 495 | ps = readw(slot->host->ioaddr + SYSKT_POWER_STATUS); |
| 496 | if (ps & SYSKT_POWER_STATUS_OK) |
| 497 | break; |
| 498 | udelay(100); |
| 499 | } while (--tm); |
| 500 | if (!tm) { |
| 501 | dev_err(&slot->chip->pdev->dev, |
| 502 | "power regulator never stabilized"); |
| 503 | writeb(0, slot->host->ioaddr + SYSKT_POWER_CMD); |
| 504 | return -ENODEV; |
| 505 | } |
| 506 | |
| 507 | return 0; |
| 508 | } |
| 509 | |
| 510 | static const struct sdhci_pci_fixes sdhci_syskt = { |
| 511 | .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER, |
| 512 | .probe = syskt_probe, |
| 513 | .probe_slot = syskt_probe_slot, |
| 514 | }; |
| 515 | |
Harald Welte | 557b069 | 2009-06-18 16:53:38 +0200 | [diff] [blame] | 516 | static int via_probe(struct sdhci_pci_chip *chip) |
| 517 | { |
| 518 | if (chip->pdev->revision == 0x10) |
| 519 | chip->quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER; |
| 520 | |
| 521 | return 0; |
| 522 | } |
| 523 | |
| 524 | static const struct sdhci_pci_fixes sdhci_via = { |
| 525 | .probe = via_probe, |
| 526 | }; |
| 527 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 528 | static const struct pci_device_id pci_ids[] __devinitdata = { |
| 529 | { |
| 530 | .vendor = PCI_VENDOR_ID_RICOH, |
| 531 | .device = PCI_DEVICE_ID_RICOH_R5C822, |
| 532 | .subvendor = PCI_ANY_ID, |
| 533 | .subdevice = PCI_ANY_ID, |
| 534 | .driver_data = (kernel_ulong_t)&sdhci_ricoh, |
| 535 | }, |
| 536 | |
| 537 | { |
Maxim Levitsky | ccc92c2 | 2010-08-10 18:01:42 -0700 | [diff] [blame] | 538 | .vendor = PCI_VENDOR_ID_RICOH, |
| 539 | .device = 0x843, |
| 540 | .subvendor = PCI_ANY_ID, |
| 541 | .subdevice = PCI_ANY_ID, |
| 542 | .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc, |
| 543 | }, |
| 544 | |
| 545 | { |
Pablo Castillo | 568133e | 2010-08-10 18:02:01 -0700 | [diff] [blame] | 546 | .vendor = PCI_VENDOR_ID_RICOH, |
| 547 | .device = 0xe822, |
| 548 | .subvendor = PCI_ANY_ID, |
| 549 | .subdevice = PCI_ANY_ID, |
| 550 | .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc, |
| 551 | }, |
| 552 | |
| 553 | { |
Manoj Iyer | 5fd11c0 | 2011-02-11 16:25:31 -0600 | [diff] [blame] | 554 | .vendor = PCI_VENDOR_ID_RICOH, |
| 555 | .device = 0xe823, |
| 556 | .subvendor = PCI_ANY_ID, |
| 557 | .subdevice = PCI_ANY_ID, |
| 558 | .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc, |
| 559 | }, |
| 560 | |
| 561 | { |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 562 | .vendor = PCI_VENDOR_ID_ENE, |
| 563 | .device = PCI_DEVICE_ID_ENE_CB712_SD, |
| 564 | .subvendor = PCI_ANY_ID, |
| 565 | .subdevice = PCI_ANY_ID, |
| 566 | .driver_data = (kernel_ulong_t)&sdhci_ene_712, |
| 567 | }, |
| 568 | |
| 569 | { |
| 570 | .vendor = PCI_VENDOR_ID_ENE, |
| 571 | .device = PCI_DEVICE_ID_ENE_CB712_SD_2, |
| 572 | .subvendor = PCI_ANY_ID, |
| 573 | .subdevice = PCI_ANY_ID, |
| 574 | .driver_data = (kernel_ulong_t)&sdhci_ene_712, |
| 575 | }, |
| 576 | |
| 577 | { |
| 578 | .vendor = PCI_VENDOR_ID_ENE, |
| 579 | .device = PCI_DEVICE_ID_ENE_CB714_SD, |
| 580 | .subvendor = PCI_ANY_ID, |
| 581 | .subdevice = PCI_ANY_ID, |
| 582 | .driver_data = (kernel_ulong_t)&sdhci_ene_714, |
| 583 | }, |
| 584 | |
| 585 | { |
| 586 | .vendor = PCI_VENDOR_ID_ENE, |
| 587 | .device = PCI_DEVICE_ID_ENE_CB714_SD_2, |
| 588 | .subvendor = PCI_ANY_ID, |
| 589 | .subdevice = PCI_ANY_ID, |
| 590 | .driver_data = (kernel_ulong_t)&sdhci_ene_714, |
| 591 | }, |
| 592 | |
| 593 | { |
| 594 | .vendor = PCI_VENDOR_ID_MARVELL, |
David Woodhouse | 8c5eb88 | 2008-09-03 09:45:57 +0100 | [diff] [blame] | 595 | .device = PCI_DEVICE_ID_MARVELL_88ALP01_SD, |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 596 | .subvendor = PCI_ANY_ID, |
| 597 | .subdevice = PCI_ANY_ID, |
| 598 | .driver_data = (kernel_ulong_t)&sdhci_cafe, |
| 599 | }, |
| 600 | |
| 601 | { |
| 602 | .vendor = PCI_VENDOR_ID_JMICRON, |
| 603 | .device = PCI_DEVICE_ID_JMICRON_JMB38X_SD, |
| 604 | .subvendor = PCI_ANY_ID, |
| 605 | .subdevice = PCI_ANY_ID, |
| 606 | .driver_data = (kernel_ulong_t)&sdhci_jmicron, |
| 607 | }, |
| 608 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 609 | { |
| 610 | .vendor = PCI_VENDOR_ID_JMICRON, |
| 611 | .device = PCI_DEVICE_ID_JMICRON_JMB38X_MMC, |
| 612 | .subvendor = PCI_ANY_ID, |
| 613 | .subdevice = PCI_ANY_ID, |
| 614 | .driver_data = (kernel_ulong_t)&sdhci_jmicron, |
| 615 | }, |
| 616 | |
Harald Welte | 557b069 | 2009-06-18 16:53:38 +0200 | [diff] [blame] | 617 | { |
Takashi Iwai | 8f230f4 | 2010-12-08 10:04:30 +0100 | [diff] [blame] | 618 | .vendor = PCI_VENDOR_ID_JMICRON, |
| 619 | .device = PCI_DEVICE_ID_JMICRON_JMB388_SD, |
| 620 | .subvendor = PCI_ANY_ID, |
| 621 | .subdevice = PCI_ANY_ID, |
| 622 | .driver_data = (kernel_ulong_t)&sdhci_jmicron, |
| 623 | }, |
| 624 | |
| 625 | { |
| 626 | .vendor = PCI_VENDOR_ID_JMICRON, |
| 627 | .device = PCI_DEVICE_ID_JMICRON_JMB388_ESD, |
| 628 | .subvendor = PCI_ANY_ID, |
| 629 | .subdevice = PCI_ANY_ID, |
| 630 | .driver_data = (kernel_ulong_t)&sdhci_jmicron, |
| 631 | }, |
| 632 | |
| 633 | { |
Nicolas Pitre | a7a6186 | 2009-12-14 18:01:26 -0800 | [diff] [blame] | 634 | .vendor = PCI_VENDOR_ID_SYSKONNECT, |
| 635 | .device = 0x8000, |
| 636 | .subvendor = PCI_ANY_ID, |
| 637 | .subdevice = PCI_ANY_ID, |
| 638 | .driver_data = (kernel_ulong_t)&sdhci_syskt, |
| 639 | }, |
| 640 | |
| 641 | { |
Harald Welte | 557b069 | 2009-06-18 16:53:38 +0200 | [diff] [blame] | 642 | .vendor = PCI_VENDOR_ID_VIA, |
| 643 | .device = 0x95d0, |
| 644 | .subvendor = PCI_ANY_ID, |
| 645 | .subdevice = PCI_ANY_ID, |
| 646 | .driver_data = (kernel_ulong_t)&sdhci_via, |
| 647 | }, |
| 648 | |
Xiaochen Shen | 2922905 | 2010-10-04 15:24:52 +0100 | [diff] [blame] | 649 | { |
| 650 | .vendor = PCI_VENDOR_ID_INTEL, |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 651 | .device = PCI_DEVICE_ID_INTEL_MRST_SD0, |
| 652 | .subvendor = PCI_ANY_ID, |
| 653 | .subdevice = PCI_ANY_ID, |
| 654 | .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc0, |
| 655 | }, |
| 656 | |
| 657 | { |
| 658 | .vendor = PCI_VENDOR_ID_INTEL, |
| 659 | .device = PCI_DEVICE_ID_INTEL_MRST_SD1, |
| 660 | .subvendor = PCI_ANY_ID, |
| 661 | .subdevice = PCI_ANY_ID, |
Jacob Pan | 35ac6f0 | 2010-11-09 13:57:29 +0000 | [diff] [blame] | 662 | .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2, |
| 663 | }, |
| 664 | |
| 665 | { |
| 666 | .vendor = PCI_VENDOR_ID_INTEL, |
| 667 | .device = PCI_DEVICE_ID_INTEL_MRST_SD2, |
| 668 | .subvendor = PCI_ANY_ID, |
| 669 | .subdevice = PCI_ANY_ID, |
| 670 | .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2, |
Alan Cox | f9ee3ea | 2010-10-04 15:25:11 +0100 | [diff] [blame] | 671 | }, |
| 672 | |
| 673 | { |
| 674 | .vendor = PCI_VENDOR_ID_INTEL, |
Xiaochen Shen | 2922905 | 2010-10-04 15:24:52 +0100 | [diff] [blame] | 675 | .device = PCI_DEVICE_ID_INTEL_MFD_SD, |
| 676 | .subvendor = PCI_ANY_ID, |
| 677 | .subdevice = PCI_ANY_ID, |
| 678 | .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sd, |
| 679 | }, |
| 680 | |
| 681 | { |
| 682 | .vendor = PCI_VENDOR_ID_INTEL, |
| 683 | .device = PCI_DEVICE_ID_INTEL_MFD_SDIO1, |
| 684 | .subvendor = PCI_ANY_ID, |
| 685 | .subdevice = PCI_ANY_ID, |
| 686 | .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio, |
| 687 | }, |
| 688 | |
| 689 | { |
| 690 | .vendor = PCI_VENDOR_ID_INTEL, |
| 691 | .device = PCI_DEVICE_ID_INTEL_MFD_SDIO2, |
| 692 | .subvendor = PCI_ANY_ID, |
| 693 | .subdevice = PCI_ANY_ID, |
| 694 | .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio, |
| 695 | }, |
| 696 | |
| 697 | { |
| 698 | .vendor = PCI_VENDOR_ID_INTEL, |
| 699 | .device = PCI_DEVICE_ID_INTEL_MFD_EMMC0, |
| 700 | .subvendor = PCI_ANY_ID, |
| 701 | .subdevice = PCI_ANY_ID, |
| 702 | .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio, |
| 703 | }, |
| 704 | |
| 705 | { |
| 706 | .vendor = PCI_VENDOR_ID_INTEL, |
| 707 | .device = PCI_DEVICE_ID_INTEL_MFD_EMMC1, |
| 708 | .subvendor = PCI_ANY_ID, |
| 709 | .subdevice = PCI_ANY_ID, |
| 710 | .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio, |
| 711 | }, |
| 712 | |
Jennifer Li | 26daa1e | 2010-11-17 23:01:59 -0500 | [diff] [blame] | 713 | { |
| 714 | .vendor = PCI_VENDOR_ID_O2, |
| 715 | .device = PCI_DEVICE_ID_O2_8120, |
| 716 | .subvendor = PCI_ANY_ID, |
| 717 | .subdevice = PCI_ANY_ID, |
| 718 | .driver_data = (kernel_ulong_t)&sdhci_o2, |
| 719 | }, |
| 720 | |
| 721 | { |
| 722 | .vendor = PCI_VENDOR_ID_O2, |
| 723 | .device = PCI_DEVICE_ID_O2_8220, |
| 724 | .subvendor = PCI_ANY_ID, |
| 725 | .subdevice = PCI_ANY_ID, |
| 726 | .driver_data = (kernel_ulong_t)&sdhci_o2, |
| 727 | }, |
| 728 | |
| 729 | { |
| 730 | .vendor = PCI_VENDOR_ID_O2, |
| 731 | .device = PCI_DEVICE_ID_O2_8221, |
| 732 | .subvendor = PCI_ANY_ID, |
| 733 | .subdevice = PCI_ANY_ID, |
| 734 | .driver_data = (kernel_ulong_t)&sdhci_o2, |
| 735 | }, |
| 736 | |
| 737 | { |
| 738 | .vendor = PCI_VENDOR_ID_O2, |
| 739 | .device = PCI_DEVICE_ID_O2_8320, |
| 740 | .subvendor = PCI_ANY_ID, |
| 741 | .subdevice = PCI_ANY_ID, |
| 742 | .driver_data = (kernel_ulong_t)&sdhci_o2, |
| 743 | }, |
| 744 | |
| 745 | { |
| 746 | .vendor = PCI_VENDOR_ID_O2, |
| 747 | .device = PCI_DEVICE_ID_O2_8321, |
| 748 | .subvendor = PCI_ANY_ID, |
| 749 | .subdevice = PCI_ANY_ID, |
| 750 | .driver_data = (kernel_ulong_t)&sdhci_o2, |
| 751 | }, |
| 752 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 753 | { /* Generic SD host controller */ |
| 754 | PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00) |
| 755 | }, |
| 756 | |
| 757 | { /* end: all zeroes */ }, |
| 758 | }; |
| 759 | |
| 760 | MODULE_DEVICE_TABLE(pci, pci_ids); |
| 761 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 762 | /*****************************************************************************\ |
| 763 | * * |
| 764 | * SDHCI core callbacks * |
| 765 | * * |
| 766 | \*****************************************************************************/ |
| 767 | |
| 768 | static int sdhci_pci_enable_dma(struct sdhci_host *host) |
| 769 | { |
| 770 | struct sdhci_pci_slot *slot; |
| 771 | struct pci_dev *pdev; |
| 772 | int ret; |
| 773 | |
| 774 | slot = sdhci_priv(host); |
| 775 | pdev = slot->chip->pdev; |
| 776 | |
| 777 | if (((pdev->class & 0xFFFF00) == (PCI_CLASS_SYSTEM_SDHCI << 8)) && |
| 778 | ((pdev->class & 0x0000FF) != PCI_SDHCI_IFDMA) && |
Richard Röjfors | a13abc7 | 2009-09-22 16:45:30 -0700 | [diff] [blame] | 779 | (host->flags & SDHCI_USE_SDMA)) { |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 780 | dev_warn(&pdev->dev, "Will use DMA mode even though HW " |
| 781 | "doesn't fully claim to support it.\n"); |
| 782 | } |
| 783 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 784 | ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 785 | if (ret) |
| 786 | return ret; |
| 787 | |
| 788 | pci_set_master(pdev); |
| 789 | |
| 790 | return 0; |
| 791 | } |
| 792 | |
| 793 | static struct sdhci_ops sdhci_pci_ops = { |
| 794 | .enable_dma = sdhci_pci_enable_dma, |
| 795 | }; |
| 796 | |
| 797 | /*****************************************************************************\ |
| 798 | * * |
| 799 | * Suspend/resume * |
| 800 | * * |
| 801 | \*****************************************************************************/ |
| 802 | |
| 803 | #ifdef CONFIG_PM |
| 804 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 805 | static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 806 | { |
| 807 | struct sdhci_pci_chip *chip; |
| 808 | struct sdhci_pci_slot *slot; |
Daniel Drake | 5f61970 | 2010-11-04 22:20:39 +0000 | [diff] [blame] | 809 | mmc_pm_flag_t slot_pm_flags; |
Nicolas Pitre | 2f4cbb3 | 2010-03-05 13:43:32 -0800 | [diff] [blame] | 810 | mmc_pm_flag_t pm_flags = 0; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 811 | int i, ret; |
| 812 | |
| 813 | chip = pci_get_drvdata(pdev); |
| 814 | if (!chip) |
| 815 | return 0; |
| 816 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 817 | for (i = 0; i < chip->num_slots; i++) { |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 818 | slot = chip->slots[i]; |
| 819 | if (!slot) |
| 820 | continue; |
| 821 | |
| 822 | ret = sdhci_suspend_host(slot->host, state); |
| 823 | |
| 824 | if (ret) { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 825 | for (i--; i >= 0; i--) |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 826 | sdhci_resume_host(chip->slots[i]->host); |
| 827 | return ret; |
| 828 | } |
Nicolas Pitre | 2f4cbb3 | 2010-03-05 13:43:32 -0800 | [diff] [blame] | 829 | |
Daniel Drake | 5f61970 | 2010-11-04 22:20:39 +0000 | [diff] [blame] | 830 | slot_pm_flags = slot->host->mmc->pm_flags; |
| 831 | if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ) |
| 832 | sdhci_enable_irq_wakeups(slot->host); |
| 833 | |
| 834 | pm_flags |= slot_pm_flags; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 835 | } |
| 836 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 837 | if (chip->fixes && chip->fixes->suspend) { |
| 838 | ret = chip->fixes->suspend(chip, state); |
| 839 | if (ret) { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 840 | for (i = chip->num_slots - 1; i >= 0; i--) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 841 | sdhci_resume_host(chip->slots[i]->host); |
| 842 | return ret; |
| 843 | } |
| 844 | } |
| 845 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 846 | pci_save_state(pdev); |
Nicolas Pitre | 2f4cbb3 | 2010-03-05 13:43:32 -0800 | [diff] [blame] | 847 | if (pm_flags & MMC_PM_KEEP_POWER) { |
Daniel Drake | 5f61970 | 2010-11-04 22:20:39 +0000 | [diff] [blame] | 848 | if (pm_flags & MMC_PM_WAKE_SDIO_IRQ) { |
| 849 | pci_pme_active(pdev, true); |
Nicolas Pitre | 2f4cbb3 | 2010-03-05 13:43:32 -0800 | [diff] [blame] | 850 | pci_enable_wake(pdev, PCI_D3hot, 1); |
Daniel Drake | 5f61970 | 2010-11-04 22:20:39 +0000 | [diff] [blame] | 851 | } |
Nicolas Pitre | 2f4cbb3 | 2010-03-05 13:43:32 -0800 | [diff] [blame] | 852 | pci_set_power_state(pdev, PCI_D3hot); |
| 853 | } else { |
| 854 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); |
| 855 | pci_disable_device(pdev); |
| 856 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
| 857 | } |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 858 | |
| 859 | return 0; |
| 860 | } |
| 861 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 862 | static int sdhci_pci_resume(struct pci_dev *pdev) |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 863 | { |
| 864 | struct sdhci_pci_chip *chip; |
| 865 | struct sdhci_pci_slot *slot; |
| 866 | int i, ret; |
| 867 | |
| 868 | chip = pci_get_drvdata(pdev); |
| 869 | if (!chip) |
| 870 | return 0; |
| 871 | |
| 872 | pci_set_power_state(pdev, PCI_D0); |
| 873 | pci_restore_state(pdev); |
| 874 | ret = pci_enable_device(pdev); |
| 875 | if (ret) |
| 876 | return ret; |
| 877 | |
Pierre Ossman | 45211e2 | 2008-03-24 13:09:09 +0100 | [diff] [blame] | 878 | if (chip->fixes && chip->fixes->resume) { |
| 879 | ret = chip->fixes->resume(chip); |
| 880 | if (ret) |
| 881 | return ret; |
| 882 | } |
| 883 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 884 | for (i = 0; i < chip->num_slots; i++) { |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 885 | slot = chip->slots[i]; |
| 886 | if (!slot) |
| 887 | continue; |
| 888 | |
| 889 | ret = sdhci_resume_host(slot->host); |
| 890 | if (ret) |
| 891 | return ret; |
| 892 | } |
| 893 | |
| 894 | return 0; |
| 895 | } |
| 896 | |
| 897 | #else /* CONFIG_PM */ |
| 898 | |
| 899 | #define sdhci_pci_suspend NULL |
| 900 | #define sdhci_pci_resume NULL |
| 901 | |
| 902 | #endif /* CONFIG_PM */ |
| 903 | |
| 904 | /*****************************************************************************\ |
| 905 | * * |
| 906 | * Device probing/removal * |
| 907 | * * |
| 908 | \*****************************************************************************/ |
| 909 | |
| 910 | static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( |
| 911 | struct pci_dev *pdev, struct sdhci_pci_chip *chip, int bar) |
| 912 | { |
| 913 | struct sdhci_pci_slot *slot; |
| 914 | struct sdhci_host *host; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 915 | int ret; |
| 916 | |
| 917 | if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { |
| 918 | dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar); |
| 919 | return ERR_PTR(-ENODEV); |
| 920 | } |
| 921 | |
| 922 | if (pci_resource_len(pdev, bar) != 0x100) { |
| 923 | dev_err(&pdev->dev, "Invalid iomem size. You may " |
| 924 | "experience problems.\n"); |
| 925 | } |
| 926 | |
| 927 | if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) { |
| 928 | dev_err(&pdev->dev, "Vendor specific interface. Aborting.\n"); |
| 929 | return ERR_PTR(-ENODEV); |
| 930 | } |
| 931 | |
| 932 | if ((pdev->class & 0x0000FF) > PCI_SDHCI_IFVENDOR) { |
| 933 | dev_err(&pdev->dev, "Unknown interface. Aborting.\n"); |
| 934 | return ERR_PTR(-ENODEV); |
| 935 | } |
| 936 | |
| 937 | host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot)); |
| 938 | if (IS_ERR(host)) { |
Dan Carpenter | c60a32c | 2009-04-10 23:31:10 +0200 | [diff] [blame] | 939 | dev_err(&pdev->dev, "cannot allocate host\n"); |
Julia Lawall | dc0fd7b | 2010-05-26 14:42:11 -0700 | [diff] [blame] | 940 | return ERR_CAST(host); |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 941 | } |
| 942 | |
| 943 | slot = sdhci_priv(host); |
| 944 | |
| 945 | slot->chip = chip; |
| 946 | slot->host = host; |
| 947 | slot->pci_bar = bar; |
| 948 | |
| 949 | host->hw_name = "PCI"; |
| 950 | host->ops = &sdhci_pci_ops; |
| 951 | host->quirks = chip->quirks; |
| 952 | |
| 953 | host->irq = pdev->irq; |
| 954 | |
| 955 | ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc)); |
| 956 | if (ret) { |
| 957 | dev_err(&pdev->dev, "cannot request region\n"); |
Dan Carpenter | c60a32c | 2009-04-10 23:31:10 +0200 | [diff] [blame] | 958 | goto free; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 959 | } |
| 960 | |
Arjan van de Ven | 092f82e | 2008-09-28 16:15:56 -0700 | [diff] [blame] | 961 | host->ioaddr = pci_ioremap_bar(pdev, bar); |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 962 | if (!host->ioaddr) { |
| 963 | dev_err(&pdev->dev, "failed to remap registers\n"); |
Chris Ball | 9fdcdbb | 2011-03-29 00:46:12 -0400 | [diff] [blame] | 964 | ret = -ENOMEM; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 965 | goto release; |
| 966 | } |
| 967 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 968 | if (chip->fixes && chip->fixes->probe_slot) { |
| 969 | ret = chip->fixes->probe_slot(slot); |
| 970 | if (ret) |
| 971 | goto unmap; |
| 972 | } |
| 973 | |
Nicolas Pitre | 2f4cbb3 | 2010-03-05 13:43:32 -0800 | [diff] [blame] | 974 | host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ; |
| 975 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 976 | ret = sdhci_add_host(host); |
| 977 | if (ret) |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 978 | goto remove; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 979 | |
| 980 | return slot; |
| 981 | |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 982 | remove: |
| 983 | if (chip->fixes && chip->fixes->remove_slot) |
Pierre Ossman | 1e72859 | 2008-04-16 19:13:13 +0200 | [diff] [blame] | 984 | chip->fixes->remove_slot(slot, 0); |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 985 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 986 | unmap: |
| 987 | iounmap(host->ioaddr); |
| 988 | |
| 989 | release: |
| 990 | pci_release_region(pdev, bar); |
Dan Carpenter | c60a32c | 2009-04-10 23:31:10 +0200 | [diff] [blame] | 991 | |
| 992 | free: |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 993 | sdhci_free_host(host); |
| 994 | |
| 995 | return ERR_PTR(ret); |
| 996 | } |
| 997 | |
| 998 | static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot) |
| 999 | { |
Pierre Ossman | 1e72859 | 2008-04-16 19:13:13 +0200 | [diff] [blame] | 1000 | int dead; |
| 1001 | u32 scratch; |
| 1002 | |
| 1003 | dead = 0; |
| 1004 | scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS); |
| 1005 | if (scratch == (u32)-1) |
| 1006 | dead = 1; |
| 1007 | |
| 1008 | sdhci_remove_host(slot->host, dead); |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 1009 | |
| 1010 | if (slot->chip->fixes && slot->chip->fixes->remove_slot) |
Pierre Ossman | 1e72859 | 2008-04-16 19:13:13 +0200 | [diff] [blame] | 1011 | slot->chip->fixes->remove_slot(slot, dead); |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 1012 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1013 | pci_release_region(slot->chip->pdev, slot->pci_bar); |
Pierre Ossman | 4489428 | 2008-04-04 19:36:59 +0200 | [diff] [blame] | 1014 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1015 | sdhci_free_host(slot->host); |
| 1016 | } |
| 1017 | |
| 1018 | static int __devinit sdhci_pci_probe(struct pci_dev *pdev, |
| 1019 | const struct pci_device_id *ent) |
| 1020 | { |
| 1021 | struct sdhci_pci_chip *chip; |
| 1022 | struct sdhci_pci_slot *slot; |
| 1023 | |
Sergei Shtylyov | cf5e23e | 2011-03-17 16:46:17 -0400 | [diff] [blame] | 1024 | u8 slots, first_bar; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1025 | int ret, i; |
| 1026 | |
| 1027 | BUG_ON(pdev == NULL); |
| 1028 | BUG_ON(ent == NULL); |
| 1029 | |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1030 | dev_info(&pdev->dev, "SDHCI controller found [%04x:%04x] (rev %x)\n", |
Sergei Shtylyov | cf5e23e | 2011-03-17 16:46:17 -0400 | [diff] [blame] | 1031 | (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1032 | |
| 1033 | ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots); |
| 1034 | if (ret) |
| 1035 | return ret; |
| 1036 | |
| 1037 | slots = PCI_SLOT_INFO_SLOTS(slots) + 1; |
| 1038 | dev_dbg(&pdev->dev, "found %d slot(s)\n", slots); |
| 1039 | if (slots == 0) |
| 1040 | return -ENODEV; |
| 1041 | |
| 1042 | BUG_ON(slots > MAX_SLOTS); |
| 1043 | |
| 1044 | ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar); |
| 1045 | if (ret) |
| 1046 | return ret; |
| 1047 | |
| 1048 | first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK; |
| 1049 | |
| 1050 | if (first_bar > 5) { |
| 1051 | dev_err(&pdev->dev, "Invalid first BAR. Aborting.\n"); |
| 1052 | return -ENODEV; |
| 1053 | } |
| 1054 | |
| 1055 | ret = pci_enable_device(pdev); |
| 1056 | if (ret) |
| 1057 | return ret; |
| 1058 | |
| 1059 | chip = kzalloc(sizeof(struct sdhci_pci_chip), GFP_KERNEL); |
| 1060 | if (!chip) { |
| 1061 | ret = -ENOMEM; |
| 1062 | goto err; |
| 1063 | } |
| 1064 | |
| 1065 | chip->pdev = pdev; |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 1066 | chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data; |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 1067 | if (chip->fixes) |
| 1068 | chip->quirks = chip->fixes->quirks; |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1069 | chip->num_slots = slots; |
| 1070 | |
| 1071 | pci_set_drvdata(pdev, chip); |
| 1072 | |
Pierre Ossman | 2260640 | 2008-03-23 19:33:23 +0100 | [diff] [blame] | 1073 | if (chip->fixes && chip->fixes->probe) { |
| 1074 | ret = chip->fixes->probe(chip); |
| 1075 | if (ret) |
| 1076 | goto free; |
| 1077 | } |
| 1078 | |
Alan Cox | 225d85f | 2010-10-04 15:24:21 +0100 | [diff] [blame] | 1079 | slots = chip->num_slots; /* Quirk may have changed this */ |
| 1080 | |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 1081 | for (i = 0; i < slots; i++) { |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1082 | slot = sdhci_pci_probe_slot(pdev, chip, first_bar + i); |
| 1083 | if (IS_ERR(slot)) { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 1084 | for (i--; i >= 0; i--) |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1085 | sdhci_pci_remove_slot(chip->slots[i]); |
| 1086 | ret = PTR_ERR(slot); |
| 1087 | goto free; |
| 1088 | } |
| 1089 | |
| 1090 | chip->slots[i] = slot; |
| 1091 | } |
| 1092 | |
| 1093 | return 0; |
| 1094 | |
| 1095 | free: |
| 1096 | pci_set_drvdata(pdev, NULL); |
| 1097 | kfree(chip); |
| 1098 | |
| 1099 | err: |
| 1100 | pci_disable_device(pdev); |
| 1101 | return ret; |
| 1102 | } |
| 1103 | |
| 1104 | static void __devexit sdhci_pci_remove(struct pci_dev *pdev) |
| 1105 | { |
| 1106 | int i; |
| 1107 | struct sdhci_pci_chip *chip; |
| 1108 | |
| 1109 | chip = pci_get_drvdata(pdev); |
| 1110 | |
| 1111 | if (chip) { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 1112 | for (i = 0; i < chip->num_slots; i++) |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1113 | sdhci_pci_remove_slot(chip->slots[i]); |
| 1114 | |
| 1115 | pci_set_drvdata(pdev, NULL); |
| 1116 | kfree(chip); |
| 1117 | } |
| 1118 | |
| 1119 | pci_disable_device(pdev); |
| 1120 | } |
| 1121 | |
| 1122 | static struct pci_driver sdhci_driver = { |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 1123 | .name = "sdhci-pci", |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1124 | .id_table = pci_ids, |
Ameya Palande | b177bc9 | 2011-04-05 21:13:13 +0300 | [diff] [blame] | 1125 | .probe = sdhci_pci_probe, |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1126 | .remove = __devexit_p(sdhci_pci_remove), |
| 1127 | .suspend = sdhci_pci_suspend, |
| 1128 | .resume = sdhci_pci_resume, |
| 1129 | }; |
| 1130 | |
| 1131 | /*****************************************************************************\ |
| 1132 | * * |
| 1133 | * Driver init/exit * |
| 1134 | * * |
| 1135 | \*****************************************************************************/ |
| 1136 | |
| 1137 | static int __init sdhci_drv_init(void) |
| 1138 | { |
| 1139 | return pci_register_driver(&sdhci_driver); |
| 1140 | } |
| 1141 | |
| 1142 | static void __exit sdhci_drv_exit(void) |
| 1143 | { |
| 1144 | pci_unregister_driver(&sdhci_driver); |
| 1145 | } |
| 1146 | |
| 1147 | module_init(sdhci_drv_init); |
| 1148 | module_exit(sdhci_drv_exit); |
| 1149 | |
Pierre Ossman | 32710e8 | 2009-04-08 20:14:54 +0200 | [diff] [blame] | 1150 | MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>"); |
Pierre Ossman | b8c86fc | 2008-03-18 17:35:49 +0100 | [diff] [blame] | 1151 | MODULE_DESCRIPTION("Secure Digital Host Controller Interface PCI driver"); |
| 1152 | MODULE_LICENSE("GPL"); |