2 * linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 driver
4 * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
5 * Copyright (C) 2010 ST-Ericsson AB.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/moduleparam.h>
13 #include <linux/init.h>
14 #include <linux/ioport.h>
15 #include <linux/device.h>
16 #include <linux/interrupt.h>
17 #include <linux/delay.h>
18 #include <linux/err.h>
19 #include <linux/highmem.h>
20 #include <linux/log2.h>
21 #include <linux/mmc/host.h>
22 #include <linux/amba/bus.h>
23 #include <linux/clk.h>
24 #include <linux/scatterlist.h>
25 #include <linux/gpio.h>
26 #include <linux/amba/mmci.h>
27 #include <linux/regulator/consumer.h>
29 #include <asm/div64.h>
31 #include <asm/sizes.h>
35 #define DRIVER_NAME "mmci-pl18x"
37 static unsigned int fmax
= 515633;
40 * struct variant_data - MMCI variant-specific quirks
41 * @clkreg: default value for MCICLOCK register
42 * @clkreg_enable: enable value for MMCICLOCK register
43 * @datalength_bits: number of bits in the MMCIDATALENGTH register
47 unsigned int clkreg_enable
;
48 unsigned int datalength_bits
;
51 static struct variant_data variant_arm
= {
52 .datalength_bits
= 16,
55 static struct variant_data variant_u300
= {
56 .clkreg_enable
= 1 << 13, /* HWFCEN */
57 .datalength_bits
= 16,
60 static struct variant_data variant_ux500
= {
61 .clkreg
= MCI_CLK_ENABLE
,
62 .clkreg_enable
= 1 << 14, /* HWFCEN */
63 .datalength_bits
= 24,
66 * This must be called with host->lock held
68 static void mmci_set_clkreg(struct mmci_host
*host
, unsigned int desired
)
70 struct variant_data
*variant
= host
->variant
;
71 u32 clk
= variant
->clkreg
;
74 if (desired
>= host
->mclk
) {
76 host
->cclk
= host
->mclk
;
78 clk
= host
->mclk
/ (2 * desired
) - 1;
81 host
->cclk
= host
->mclk
/ (2 * (clk
+ 1));
84 clk
|= variant
->clkreg_enable
;
85 clk
|= MCI_CLK_ENABLE
;
86 /* This hasn't proven to be worthwhile */
87 /* clk |= MCI_CLK_PWRSAVE; */
90 if (host
->mmc
->ios
.bus_width
== MMC_BUS_WIDTH_4
)
92 if (host
->mmc
->ios
.bus_width
== MMC_BUS_WIDTH_8
)
93 clk
|= MCI_ST_8BIT_BUS
;
95 writel(clk
, host
->base
+ MMCICLOCK
);
99 mmci_request_end(struct mmci_host
*host
, struct mmc_request
*mrq
)
101 writel(0, host
->base
+ MMCICOMMAND
);
109 mrq
->data
->bytes_xfered
= host
->data_xfered
;
112 * Need to drop the host lock here; mmc_request_done may call
113 * back into the driver...
115 spin_unlock(&host
->lock
);
116 mmc_request_done(host
->mmc
, mrq
);
117 spin_lock(&host
->lock
);
120 static void mmci_stop_data(struct mmci_host
*host
)
122 writel(0, host
->base
+ MMCIDATACTRL
);
123 writel(0, host
->base
+ MMCIMASK1
);
127 static void mmci_init_sg(struct mmci_host
*host
, struct mmc_data
*data
)
129 unsigned int flags
= SG_MITER_ATOMIC
;
131 if (data
->flags
& MMC_DATA_READ
)
132 flags
|= SG_MITER_TO_SG
;
134 flags
|= SG_MITER_FROM_SG
;
136 sg_miter_start(&host
->sg_miter
, data
->sg
, data
->sg_len
, flags
);
139 static void mmci_start_data(struct mmci_host
*host
, struct mmc_data
*data
)
141 unsigned int datactrl
, timeout
, irqmask
;
142 unsigned long long clks
;
146 dev_dbg(mmc_dev(host
->mmc
), "blksz %04x blks %04x flags %08x\n",
147 data
->blksz
, data
->blocks
, data
->flags
);
150 host
->size
= data
->blksz
* data
->blocks
;
151 host
->data_xfered
= 0;
153 mmci_init_sg(host
, data
);
155 clks
= (unsigned long long)data
->timeout_ns
* host
->cclk
;
156 do_div(clks
, 1000000000UL);
158 timeout
= data
->timeout_clks
+ (unsigned int)clks
;
161 writel(timeout
, base
+ MMCIDATATIMER
);
162 writel(host
->size
, base
+ MMCIDATALENGTH
);
164 blksz_bits
= ffs(data
->blksz
) - 1;
165 BUG_ON(1 << blksz_bits
!= data
->blksz
);
167 datactrl
= MCI_DPSM_ENABLE
| blksz_bits
<< 4;
168 if (data
->flags
& MMC_DATA_READ
) {
169 datactrl
|= MCI_DPSM_DIRECTION
;
170 irqmask
= MCI_RXFIFOHALFFULLMASK
;
173 * If we have less than a FIFOSIZE of bytes to transfer,
174 * trigger a PIO interrupt as soon as any data is available.
176 if (host
->size
< MCI_FIFOSIZE
)
177 irqmask
|= MCI_RXDATAAVLBLMASK
;
180 * We don't actually need to include "FIFO empty" here
181 * since its implicit in "FIFO half empty".
183 irqmask
= MCI_TXFIFOHALFEMPTYMASK
;
186 writel(datactrl
, base
+ MMCIDATACTRL
);
187 writel(readl(base
+ MMCIMASK0
) & ~MCI_DATAENDMASK
, base
+ MMCIMASK0
);
188 writel(irqmask
, base
+ MMCIMASK1
);
192 mmci_start_command(struct mmci_host
*host
, struct mmc_command
*cmd
, u32 c
)
194 void __iomem
*base
= host
->base
;
196 dev_dbg(mmc_dev(host
->mmc
), "op %02x arg %08x flags %08x\n",
197 cmd
->opcode
, cmd
->arg
, cmd
->flags
);
199 if (readl(base
+ MMCICOMMAND
) & MCI_CPSM_ENABLE
) {
200 writel(0, base
+ MMCICOMMAND
);
204 c
|= cmd
->opcode
| MCI_CPSM_ENABLE
;
205 if (cmd
->flags
& MMC_RSP_PRESENT
) {
206 if (cmd
->flags
& MMC_RSP_136
)
207 c
|= MCI_CPSM_LONGRSP
;
208 c
|= MCI_CPSM_RESPONSE
;
211 c
|= MCI_CPSM_INTERRUPT
;
215 writel(cmd
->arg
, base
+ MMCIARGUMENT
);
216 writel(c
, base
+ MMCICOMMAND
);
220 mmci_data_irq(struct mmci_host
*host
, struct mmc_data
*data
,
223 if (status
& MCI_DATABLOCKEND
) {
224 host
->data_xfered
+= data
->blksz
;
225 #ifdef CONFIG_ARCH_U300
227 * On the U300 some signal or other is
228 * badly routed so that a data write does
229 * not properly terminate with a MCI_DATAEND
230 * status flag. This quirk will make writes
233 if (data
->flags
& MMC_DATA_WRITE
)
234 status
|= MCI_DATAEND
;
237 if (status
& (MCI_DATACRCFAIL
|MCI_DATATIMEOUT
|MCI_TXUNDERRUN
|MCI_RXOVERRUN
)) {
238 dev_dbg(mmc_dev(host
->mmc
), "MCI ERROR IRQ (status %08x)\n", status
);
239 if (status
& MCI_DATACRCFAIL
)
240 data
->error
= -EILSEQ
;
241 else if (status
& MCI_DATATIMEOUT
)
242 data
->error
= -ETIMEDOUT
;
243 else if (status
& (MCI_TXUNDERRUN
|MCI_RXOVERRUN
))
245 status
|= MCI_DATAEND
;
248 * We hit an error condition. Ensure that any data
249 * partially written to a page is properly coherent.
251 if (data
->flags
& MMC_DATA_READ
) {
252 struct sg_mapping_iter
*sg_miter
= &host
->sg_miter
;
255 local_irq_save(flags
);
256 if (sg_miter_next(sg_miter
)) {
257 flush_dcache_page(sg_miter
->page
);
258 sg_miter_stop(sg_miter
);
260 local_irq_restore(flags
);
263 if (status
& MCI_DATAEND
) {
264 mmci_stop_data(host
);
267 mmci_request_end(host
, data
->mrq
);
269 mmci_start_command(host
, data
->stop
, 0);
275 mmci_cmd_irq(struct mmci_host
*host
, struct mmc_command
*cmd
,
278 void __iomem
*base
= host
->base
;
282 cmd
->resp
[0] = readl(base
+ MMCIRESPONSE0
);
283 cmd
->resp
[1] = readl(base
+ MMCIRESPONSE1
);
284 cmd
->resp
[2] = readl(base
+ MMCIRESPONSE2
);
285 cmd
->resp
[3] = readl(base
+ MMCIRESPONSE3
);
287 if (status
& MCI_CMDTIMEOUT
) {
288 cmd
->error
= -ETIMEDOUT
;
289 } else if (status
& MCI_CMDCRCFAIL
&& cmd
->flags
& MMC_RSP_CRC
) {
290 cmd
->error
= -EILSEQ
;
293 if (!cmd
->data
|| cmd
->error
) {
295 mmci_stop_data(host
);
296 mmci_request_end(host
, cmd
->mrq
);
297 } else if (!(cmd
->data
->flags
& MMC_DATA_READ
)) {
298 mmci_start_data(host
, cmd
->data
);
302 static int mmci_pio_read(struct mmci_host
*host
, char *buffer
, unsigned int remain
)
304 void __iomem
*base
= host
->base
;
307 int host_remain
= host
->size
;
310 int count
= host_remain
- (readl(base
+ MMCIFIFOCNT
) << 2);
318 readsl(base
+ MMCIFIFO
, ptr
, count
>> 2);
322 host_remain
-= count
;
327 status
= readl(base
+ MMCISTATUS
);
328 } while (status
& MCI_RXDATAAVLBL
);
333 static int mmci_pio_write(struct mmci_host
*host
, char *buffer
, unsigned int remain
, u32 status
)
335 void __iomem
*base
= host
->base
;
339 unsigned int count
, maxcnt
;
341 maxcnt
= status
& MCI_TXFIFOEMPTY
? MCI_FIFOSIZE
: MCI_FIFOHALFSIZE
;
342 count
= min(remain
, maxcnt
);
344 writesl(base
+ MMCIFIFO
, ptr
, count
>> 2);
352 status
= readl(base
+ MMCISTATUS
);
353 } while (status
& MCI_TXFIFOHALFEMPTY
);
359 * PIO data transfer IRQ handler.
361 static irqreturn_t
mmci_pio_irq(int irq
, void *dev_id
)
363 struct mmci_host
*host
= dev_id
;
364 struct sg_mapping_iter
*sg_miter
= &host
->sg_miter
;
365 void __iomem
*base
= host
->base
;
369 status
= readl(base
+ MMCISTATUS
);
371 dev_dbg(mmc_dev(host
->mmc
), "irq1 (pio) %08x\n", status
);
373 local_irq_save(flags
);
376 unsigned int remain
, len
;
380 * For write, we only need to test the half-empty flag
381 * here - if the FIFO is completely empty, then by
382 * definition it is more than half empty.
384 * For read, check for data available.
386 if (!(status
& (MCI_TXFIFOHALFEMPTY
|MCI_RXDATAAVLBL
)))
389 if (!sg_miter_next(sg_miter
))
392 buffer
= sg_miter
->addr
;
393 remain
= sg_miter
->length
;
396 if (status
& MCI_RXACTIVE
)
397 len
= mmci_pio_read(host
, buffer
, remain
);
398 if (status
& MCI_TXACTIVE
)
399 len
= mmci_pio_write(host
, buffer
, remain
, status
);
401 sg_miter
->consumed
= len
;
409 if (status
& MCI_RXACTIVE
)
410 flush_dcache_page(sg_miter
->page
);
412 status
= readl(base
+ MMCISTATUS
);
415 sg_miter_stop(sg_miter
);
417 local_irq_restore(flags
);
420 * If we're nearing the end of the read, switch to
421 * "any data available" mode.
423 if (status
& MCI_RXACTIVE
&& host
->size
< MCI_FIFOSIZE
)
424 writel(MCI_RXDATAAVLBLMASK
, base
+ MMCIMASK1
);
427 * If we run out of data, disable the data IRQs; this
428 * prevents a race where the FIFO becomes empty before
429 * the chip itself has disabled the data path, and
430 * stops us racing with our data end IRQ.
432 if (host
->size
== 0) {
433 writel(0, base
+ MMCIMASK1
);
434 writel(readl(base
+ MMCIMASK0
) | MCI_DATAENDMASK
, base
+ MMCIMASK0
);
441 * Handle completion of command and data transfers.
443 static irqreturn_t
mmci_irq(int irq
, void *dev_id
)
445 struct mmci_host
*host
= dev_id
;
449 spin_lock(&host
->lock
);
452 struct mmc_command
*cmd
;
453 struct mmc_data
*data
;
455 status
= readl(host
->base
+ MMCISTATUS
);
456 status
&= readl(host
->base
+ MMCIMASK0
);
457 writel(status
, host
->base
+ MMCICLEAR
);
459 dev_dbg(mmc_dev(host
->mmc
), "irq0 (data+cmd) %08x\n", status
);
462 if (status
& (MCI_DATACRCFAIL
|MCI_DATATIMEOUT
|MCI_TXUNDERRUN
|
463 MCI_RXOVERRUN
|MCI_DATAEND
|MCI_DATABLOCKEND
) && data
)
464 mmci_data_irq(host
, data
, status
);
467 if (status
& (MCI_CMDCRCFAIL
|MCI_CMDTIMEOUT
|MCI_CMDSENT
|MCI_CMDRESPEND
) && cmd
)
468 mmci_cmd_irq(host
, cmd
, status
);
473 spin_unlock(&host
->lock
);
475 return IRQ_RETVAL(ret
);
478 static void mmci_request(struct mmc_host
*mmc
, struct mmc_request
*mrq
)
480 struct mmci_host
*host
= mmc_priv(mmc
);
483 WARN_ON(host
->mrq
!= NULL
);
485 if (mrq
->data
&& !is_power_of_2(mrq
->data
->blksz
)) {
486 dev_err(mmc_dev(mmc
), "unsupported block size (%d bytes)\n",
488 mrq
->cmd
->error
= -EINVAL
;
489 mmc_request_done(mmc
, mrq
);
493 spin_lock_irqsave(&host
->lock
, flags
);
497 if (mrq
->data
&& mrq
->data
->flags
& MMC_DATA_READ
)
498 mmci_start_data(host
, mrq
->data
);
500 mmci_start_command(host
, mrq
->cmd
, 0);
502 spin_unlock_irqrestore(&host
->lock
, flags
);
505 static void mmci_set_ios(struct mmc_host
*mmc
, struct mmc_ios
*ios
)
507 struct mmci_host
*host
= mmc_priv(mmc
);
511 switch (ios
->power_mode
) {
514 regulator_is_enabled(host
->vcc
))
515 regulator_disable(host
->vcc
);
518 #ifdef CONFIG_REGULATOR
520 /* This implicitly enables the regulator */
521 mmc_regulator_set_ocr(host
->vcc
, ios
->vdd
);
523 if (host
->plat
->vdd_handler
)
524 pwr
|= host
->plat
->vdd_handler(mmc_dev(mmc
), ios
->vdd
,
526 /* The ST version does not have this, fall through to POWER_ON */
527 if (host
->hw_designer
!= AMBA_VENDOR_ST
) {
536 if (ios
->bus_mode
== MMC_BUSMODE_OPENDRAIN
) {
537 if (host
->hw_designer
!= AMBA_VENDOR_ST
)
541 * The ST Micro variant use the ROD bit for something
542 * else and only has OD (Open Drain).
548 spin_lock_irqsave(&host
->lock
, flags
);
550 mmci_set_clkreg(host
, ios
->clock
);
552 if (host
->pwr
!= pwr
) {
554 writel(pwr
, host
->base
+ MMCIPOWER
);
557 spin_unlock_irqrestore(&host
->lock
, flags
);
560 static int mmci_get_ro(struct mmc_host
*mmc
)
562 struct mmci_host
*host
= mmc_priv(mmc
);
564 if (host
->gpio_wp
== -ENOSYS
)
567 return gpio_get_value(host
->gpio_wp
);
570 static int mmci_get_cd(struct mmc_host
*mmc
)
572 struct mmci_host
*host
= mmc_priv(mmc
);
575 if (host
->gpio_cd
== -ENOSYS
)
576 status
= host
->plat
->status(mmc_dev(host
->mmc
));
578 status
= !gpio_get_value(host
->gpio_cd
);
581 * Use positive logic throughout - status is zero for no card,
582 * non-zero for card inserted.
587 static const struct mmc_host_ops mmci_ops
= {
588 .request
= mmci_request
,
589 .set_ios
= mmci_set_ios
,
590 .get_ro
= mmci_get_ro
,
591 .get_cd
= mmci_get_cd
,
594 static int __devinit
mmci_probe(struct amba_device
*dev
, struct amba_id
*id
)
596 struct mmci_platform_data
*plat
= dev
->dev
.platform_data
;
597 struct variant_data
*variant
= id
->data
;
598 struct mmci_host
*host
;
599 struct mmc_host
*mmc
;
602 /* must have platform data */
608 ret
= amba_request_regions(dev
, DRIVER_NAME
);
612 mmc
= mmc_alloc_host(sizeof(struct mmci_host
), &dev
->dev
);
618 host
= mmc_priv(mmc
);
621 host
->gpio_wp
= -ENOSYS
;
622 host
->gpio_cd
= -ENOSYS
;
624 host
->hw_designer
= amba_manf(dev
);
625 host
->hw_revision
= amba_rev(dev
);
626 dev_dbg(mmc_dev(mmc
), "designer ID = 0x%02x\n", host
->hw_designer
);
627 dev_dbg(mmc_dev(mmc
), "revision = 0x%01x\n", host
->hw_revision
);
629 host
->clk
= clk_get(&dev
->dev
, NULL
);
630 if (IS_ERR(host
->clk
)) {
631 ret
= PTR_ERR(host
->clk
);
636 ret
= clk_enable(host
->clk
);
641 host
->variant
= variant
;
642 host
->mclk
= clk_get_rate(host
->clk
);
644 * According to the spec, mclk is max 100 MHz,
645 * so we try to adjust the clock down to this,
648 if (host
->mclk
> 100000000) {
649 ret
= clk_set_rate(host
->clk
, 100000000);
652 host
->mclk
= clk_get_rate(host
->clk
);
653 dev_dbg(mmc_dev(mmc
), "eventual mclk rate: %u Hz\n",
656 host
->base
= ioremap(dev
->res
.start
, resource_size(&dev
->res
));
662 mmc
->ops
= &mmci_ops
;
663 mmc
->f_min
= (host
->mclk
+ 511) / 512;
665 * If the platform data supplies a maximum operating
666 * frequency, this takes precedence. Else, we fall back
667 * to using the module parameter, which has a (low)
668 * default value in case it is not specified. Either
669 * value must not exceed the clock rate into the block,
673 mmc
->f_max
= min(host
->mclk
, plat
->f_max
);
675 mmc
->f_max
= min(host
->mclk
, fmax
);
676 dev_dbg(mmc_dev(mmc
), "clocking block at %u Hz\n", mmc
->f_max
);
678 #ifdef CONFIG_REGULATOR
679 /* If we're using the regulator framework, try to fetch a regulator */
680 host
->vcc
= regulator_get(&dev
->dev
, "vmmc");
681 if (IS_ERR(host
->vcc
))
684 int mask
= mmc_regulator_get_ocrmask(host
->vcc
);
687 dev_err(&dev
->dev
, "error getting OCR mask (%d)\n",
690 host
->mmc
->ocr_avail
= (u32
) mask
;
693 "Provided ocr_mask/setpower will not be used "
694 "(using regulator instead)\n");
698 /* Fall back to platform data if no regulator is found */
699 if (host
->vcc
== NULL
)
700 mmc
->ocr_avail
= plat
->ocr_mask
;
701 mmc
->caps
= plat
->capabilities
;
702 mmc
->caps
|= MMC_CAP_NEEDS_POLL
;
707 mmc
->max_hw_segs
= 16;
708 mmc
->max_phys_segs
= NR_SG
;
711 * Since only a certain number of bits are valid in the data length
712 * register, we must ensure that we don't exceed 2^num-1 bytes in a
715 mmc
->max_req_size
= (1 << variant
->datalength_bits
) - 1;
718 * Set the maximum segment size. Since we aren't doing DMA
719 * (yet) we are only limited by the data length register.
721 mmc
->max_seg_size
= mmc
->max_req_size
;
724 * Block size can be up to 2048 bytes, but must be a power of two.
726 mmc
->max_blk_size
= 2048;
729 * No limit on the number of blocks transferred.
731 mmc
->max_blk_count
= mmc
->max_req_size
;
733 spin_lock_init(&host
->lock
);
735 writel(0, host
->base
+ MMCIMASK0
);
736 writel(0, host
->base
+ MMCIMASK1
);
737 writel(0xfff, host
->base
+ MMCICLEAR
);
739 if (gpio_is_valid(plat
->gpio_cd
)) {
740 ret
= gpio_request(plat
->gpio_cd
, DRIVER_NAME
" (cd)");
742 ret
= gpio_direction_input(plat
->gpio_cd
);
744 host
->gpio_cd
= plat
->gpio_cd
;
745 else if (ret
!= -ENOSYS
)
748 if (gpio_is_valid(plat
->gpio_wp
)) {
749 ret
= gpio_request(plat
->gpio_wp
, DRIVER_NAME
" (wp)");
751 ret
= gpio_direction_input(plat
->gpio_wp
);
753 host
->gpio_wp
= plat
->gpio_wp
;
754 else if (ret
!= -ENOSYS
)
758 ret
= request_irq(dev
->irq
[0], mmci_irq
, IRQF_SHARED
, DRIVER_NAME
" (cmd)", host
);
762 ret
= request_irq(dev
->irq
[1], mmci_pio_irq
, IRQF_SHARED
, DRIVER_NAME
" (pio)", host
);
766 writel(MCI_IRQENABLE
, host
->base
+ MMCIMASK0
);
768 amba_set_drvdata(dev
, mmc
);
772 dev_info(&dev
->dev
, "%s: MMCI rev %x cfg %02x at 0x%016llx irq %d,%d\n",
773 mmc_hostname(mmc
), amba_rev(dev
), amba_config(dev
),
774 (unsigned long long)dev
->res
.start
, dev
->irq
[0], dev
->irq
[1]);
779 free_irq(dev
->irq
[0], host
);
781 if (host
->gpio_wp
!= -ENOSYS
)
782 gpio_free(host
->gpio_wp
);
784 if (host
->gpio_cd
!= -ENOSYS
)
785 gpio_free(host
->gpio_cd
);
789 clk_disable(host
->clk
);
795 amba_release_regions(dev
);
800 static int __devexit
mmci_remove(struct amba_device
*dev
)
802 struct mmc_host
*mmc
= amba_get_drvdata(dev
);
804 amba_set_drvdata(dev
, NULL
);
807 struct mmci_host
*host
= mmc_priv(mmc
);
809 mmc_remove_host(mmc
);
811 writel(0, host
->base
+ MMCIMASK0
);
812 writel(0, host
->base
+ MMCIMASK1
);
814 writel(0, host
->base
+ MMCICOMMAND
);
815 writel(0, host
->base
+ MMCIDATACTRL
);
817 free_irq(dev
->irq
[0], host
);
818 free_irq(dev
->irq
[1], host
);
820 if (host
->gpio_wp
!= -ENOSYS
)
821 gpio_free(host
->gpio_wp
);
822 if (host
->gpio_cd
!= -ENOSYS
)
823 gpio_free(host
->gpio_cd
);
826 clk_disable(host
->clk
);
829 if (regulator_is_enabled(host
->vcc
))
830 regulator_disable(host
->vcc
);
831 regulator_put(host
->vcc
);
835 amba_release_regions(dev
);
842 static int mmci_suspend(struct amba_device
*dev
, pm_message_t state
)
844 struct mmc_host
*mmc
= amba_get_drvdata(dev
);
848 struct mmci_host
*host
= mmc_priv(mmc
);
850 ret
= mmc_suspend_host(mmc
);
852 writel(0, host
->base
+ MMCIMASK0
);
858 static int mmci_resume(struct amba_device
*dev
)
860 struct mmc_host
*mmc
= amba_get_drvdata(dev
);
864 struct mmci_host
*host
= mmc_priv(mmc
);
866 writel(MCI_IRQENABLE
, host
->base
+ MMCIMASK0
);
868 ret
= mmc_resume_host(mmc
);
874 #define mmci_suspend NULL
875 #define mmci_resume NULL
878 static struct amba_id mmci_ids
[] = {
882 .data
= &variant_arm
,
887 .data
= &variant_arm
,
889 /* ST Micro variants */
893 .data
= &variant_u300
,
898 .data
= &variant_u300
,
903 .data
= &variant_ux500
,
908 static struct amba_driver mmci_driver
= {
913 .remove
= __devexit_p(mmci_remove
),
914 .suspend
= mmci_suspend
,
915 .resume
= mmci_resume
,
916 .id_table
= mmci_ids
,
919 static int __init
mmci_init(void)
921 return amba_driver_register(&mmci_driver
);
924 static void __exit
mmci_exit(void)
926 amba_driver_unregister(&mmci_driver
);
929 module_init(mmci_init
);
930 module_exit(mmci_exit
);
931 module_param(fmax
, uint
, 0444);
933 MODULE_DESCRIPTION("ARM PrimeCell PL180/181 Multimedia Card Interface driver");
934 MODULE_LICENSE("GPL");