tmio_mmc: add bus_shift support
[pandora-kernel.git] / drivers / mmc / host / tmio_mmc.c
1 /*
2  *  linux/drivers/mmc/tmio_mmc.c
3  *
4  *  Copyright (C) 2004 Ian Molton
5  *  Copyright (C) 2007 Ian Molton
6  *
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.
10  *
11  * Driver for the MMC / SD / SDIO cell found in:
12  *
13  * TC6393XB TC6391XB TC6387XB T7L66XB
14  *
15  * This driver draws mainly on scattered spec sheets, Reverse engineering
16  * of the toshiba e800  SD driver and some parts of the 2.4 ASIC3 driver (4 bit
17  * support). (Further 4 bit support from a later datasheet).
18  *
19  * TODO:
20  *   Investigate using a workqueue for PIO transfers
21  *   Eliminate FIXMEs
22  *   SDIO support
23  *   Better Power management
24  *   Handle MMC errors better
25  *   double buffer support
26  *
27  */
28 #include <linux/module.h>
29 #include <linux/irq.h>
30 #include <linux/device.h>
31 #include <linux/delay.h>
32 #include <linux/mmc/host.h>
33 #include <linux/mfd/core.h>
34 #include <linux/mfd/tmio.h>
35
36 #include "tmio_mmc.h"
37
38 static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
39 {
40         u32 clk = 0, clock, f_min = host->mmc->f_min;
41
42         if (new_clock) {
43                 for (clock = f_min, clk = 0x100; new_clock >= (clock<<1); ) {
44                         clock <<= 1;
45                         clk >>= 1;
46                 }
47                 if (clk & 0x1)
48                         clk = 0x20000;
49
50                 clk >>= 2;
51                 sd_config_write8(host, CNF_SD_CLK_MODE, (clk & 0x8000) ? 0 : 1);
52                 clk |= 0x100;
53         }
54
55         sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk);
56 }
57
58 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
59 {
60         sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
61         msleep(10);
62         sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &
63                 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
64         msleep(10);
65 }
66
67 static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
68 {
69         sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
70                 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
71         msleep(10);
72         sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
73         msleep(10);
74 }
75
76 static void reset(struct tmio_mmc_host *host)
77 {
78         /* FIXME - should we set stop clock reg here */
79         sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);
80         sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
81         msleep(10);
82         sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
83         sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
84         msleep(10);
85 }
86
87 static void
88 tmio_mmc_finish_request(struct tmio_mmc_host *host)
89 {
90         struct mmc_request *mrq = host->mrq;
91
92         host->mrq = NULL;
93         host->cmd = NULL;
94         host->data = NULL;
95
96         mmc_request_done(host->mmc, mrq);
97 }
98
99 /* These are the bitmasks the tmio chip requires to implement the MMC response
100  * types. Note that R1 and R6 are the same in this scheme. */
101 #define APP_CMD        0x0040
102 #define RESP_NONE      0x0300
103 #define RESP_R1        0x0400
104 #define RESP_R1B       0x0500
105 #define RESP_R2        0x0600
106 #define RESP_R3        0x0700
107 #define DATA_PRESENT   0x0800
108 #define TRANSFER_READ  0x1000
109 #define TRANSFER_MULTI 0x2000
110 #define SECURITY_CMD   0x4000
111
112 static int
113 tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
114 {
115         struct mmc_data *data = host->data;
116         int c = cmd->opcode;
117
118         /* Command 12 is handled by hardware */
119         if (cmd->opcode == 12 && !cmd->arg) {
120                 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x001);
121                 return 0;
122         }
123
124         switch (mmc_resp_type(cmd)) {
125         case MMC_RSP_NONE: c |= RESP_NONE; break;
126         case MMC_RSP_R1:   c |= RESP_R1;   break;
127         case MMC_RSP_R1B:  c |= RESP_R1B;  break;
128         case MMC_RSP_R2:   c |= RESP_R2;   break;
129         case MMC_RSP_R3:   c |= RESP_R3;   break;
130         default:
131                 pr_debug("Unknown response type %d\n", mmc_resp_type(cmd));
132                 return -EINVAL;
133         }
134
135         host->cmd = cmd;
136
137 /* FIXME - this seems to be ok comented out but the spec suggest this bit should
138  *         be set when issuing app commands.
139  *      if(cmd->flags & MMC_FLAG_ACMD)
140  *              c |= APP_CMD;
141  */
142         if (data) {
143                 c |= DATA_PRESENT;
144                 if (data->blocks > 1) {
145                         sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x100);
146                         c |= TRANSFER_MULTI;
147                 }
148                 if (data->flags & MMC_DATA_READ)
149                         c |= TRANSFER_READ;
150         }
151
152         enable_mmc_irqs(host, TMIO_MASK_CMD);
153
154         /* Fire off the command */
155         sd_ctrl_write32(host, CTL_ARG_REG, cmd->arg);
156         sd_ctrl_write16(host, CTL_SD_CMD, c);
157
158         return 0;
159 }
160
161 /* This chip always returns (at least?) as much data as you ask for.
162  * I'm unsure what happens if you ask for less than a block. This should be
163  * looked into to ensure that a funny length read doesnt hose the controller.
164  *
165  */
166 static inline void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
167 {
168         struct mmc_data *data = host->data;
169         unsigned short *buf;
170         unsigned int count;
171         unsigned long flags;
172
173         if (!data) {
174                 pr_debug("Spurious PIO IRQ\n");
175                 return;
176         }
177
178         buf = (unsigned short *)(tmio_mmc_kmap_atomic(host, &flags) +
179               host->sg_off);
180
181         count = host->sg_ptr->length - host->sg_off;
182         if (count > data->blksz)
183                 count = data->blksz;
184
185         pr_debug("count: %08x offset: %08x flags %08x\n",
186             count, host->sg_off, data->flags);
187
188         /* Transfer the data */
189         if (data->flags & MMC_DATA_READ)
190                 sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
191         else
192                 sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
193
194         host->sg_off += count;
195
196         tmio_mmc_kunmap_atomic(host, &flags);
197
198         if (host->sg_off == host->sg_ptr->length)
199                 tmio_mmc_next_sg(host);
200
201         return;
202 }
203
204 static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host)
205 {
206         struct mmc_data *data = host->data;
207         struct mmc_command *stop;
208
209         host->data = NULL;
210
211         if (!data) {
212                 pr_debug("Spurious data end IRQ\n");
213                 return;
214         }
215         stop = data->stop;
216
217         /* FIXME - return correct transfer count on errors */
218         if (!data->error)
219                 data->bytes_xfered = data->blocks * data->blksz;
220         else
221                 data->bytes_xfered = 0;
222
223         pr_debug("Completed data request\n");
224
225         /*FIXME - other drivers allow an optional stop command of any given type
226          *        which we dont do, as the chip can auto generate them.
227          *        Perhaps we can be smarter about when to use auto CMD12 and
228          *        only issue the auto request when we know this is the desired
229          *        stop command, allowing fallback to the stop command the
230          *        upper layers expect. For now, we do what works.
231          */
232
233         if (data->flags & MMC_DATA_READ)
234                 disable_mmc_irqs(host, TMIO_MASK_READOP);
235         else
236                 disable_mmc_irqs(host, TMIO_MASK_WRITEOP);
237
238         if (stop) {
239                 if (stop->opcode == 12 && !stop->arg)
240                         sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x000);
241                 else
242                         BUG();
243         }
244
245         tmio_mmc_finish_request(host);
246 }
247
248 static inline void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
249         unsigned int stat)
250 {
251         struct mmc_command *cmd = host->cmd;
252         int i, addr;
253
254         if (!host->cmd) {
255                 pr_debug("Spurious CMD irq\n");
256                 return;
257         }
258
259         host->cmd = NULL;
260
261         /* This controller is sicker than the PXA one. Not only do we need to
262          * drop the top 8 bits of the first response word, we also need to
263          * modify the order of the response for short response command types.
264          */
265
266         for (i = 3, addr = CTL_RESPONSE ; i >= 0 ; i--, addr += 4)
267                 cmd->resp[i] = sd_ctrl_read32(host, addr);
268
269         if (cmd->flags &  MMC_RSP_136) {
270                 cmd->resp[0] = (cmd->resp[0] << 8) | (cmd->resp[1] >> 24);
271                 cmd->resp[1] = (cmd->resp[1] << 8) | (cmd->resp[2] >> 24);
272                 cmd->resp[2] = (cmd->resp[2] << 8) | (cmd->resp[3] >> 24);
273                 cmd->resp[3] <<= 8;
274         } else if (cmd->flags & MMC_RSP_R3) {
275                 cmd->resp[0] = cmd->resp[3];
276         }
277
278         if (stat & TMIO_STAT_CMDTIMEOUT)
279                 cmd->error = -ETIMEDOUT;
280         else if (stat & TMIO_STAT_CRCFAIL && cmd->flags & MMC_RSP_CRC)
281                 cmd->error = -EILSEQ;
282
283         /* If there is data to handle we enable data IRQs here, and
284          * we will ultimatley finish the request in the data_end handler.
285          * If theres no data or we encountered an error, finish now.
286          */
287         if (host->data && !cmd->error) {
288                 if (host->data->flags & MMC_DATA_READ)
289                         enable_mmc_irqs(host, TMIO_MASK_READOP);
290                 else
291                         enable_mmc_irqs(host, TMIO_MASK_WRITEOP);
292         } else {
293                 tmio_mmc_finish_request(host);
294         }
295
296         return;
297 }
298
299
300 static irqreturn_t tmio_mmc_irq(int irq, void *devid)
301 {
302         struct tmio_mmc_host *host = devid;
303         unsigned int ireg, irq_mask, status;
304
305         pr_debug("MMC IRQ begin\n");
306
307         status = sd_ctrl_read32(host, CTL_STATUS);
308         irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);
309         ireg = status & TMIO_MASK_IRQ & ~irq_mask;
310
311         pr_debug_status(status);
312         pr_debug_status(ireg);
313
314         if (!ireg) {
315                 disable_mmc_irqs(host, status & ~irq_mask);
316
317                 pr_debug("tmio_mmc: Spurious irq, disabling! "
318                         "0x%08x 0x%08x 0x%08x\n", status, irq_mask, ireg);
319                 pr_debug_status(status);
320
321                 goto out;
322         }
323
324         while (ireg) {
325                 /* Card insert / remove attempts */
326                 if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {
327                         ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT |
328                                 TMIO_STAT_CARD_REMOVE);
329                         mmc_detect_change(host->mmc, 0);
330                 }
331
332                 /* CRC and other errors */
333 /*              if (ireg & TMIO_STAT_ERR_IRQ)
334  *                      handled |= tmio_error_irq(host, irq, stat);
335  */
336
337                 /* Command completion */
338                 if (ireg & TMIO_MASK_CMD) {
339                         ack_mmc_irqs(host, TMIO_MASK_CMD);
340                         tmio_mmc_cmd_irq(host, status);
341                 }
342
343                 /* Data transfer */
344                 if (ireg & (TMIO_STAT_RXRDY | TMIO_STAT_TXRQ)) {
345                         ack_mmc_irqs(host, TMIO_STAT_RXRDY | TMIO_STAT_TXRQ);
346                         tmio_mmc_pio_irq(host);
347                 }
348
349                 /* Data transfer completion */
350                 if (ireg & TMIO_STAT_DATAEND) {
351                         ack_mmc_irqs(host, TMIO_STAT_DATAEND);
352                         tmio_mmc_data_irq(host);
353                 }
354
355                 /* Check status - keep going until we've handled it all */
356                 status = sd_ctrl_read32(host, CTL_STATUS);
357                 irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);
358                 ireg = status & TMIO_MASK_IRQ & ~irq_mask;
359
360                 pr_debug("Status at end of loop: %08x\n", status);
361                 pr_debug_status(status);
362         }
363         pr_debug("MMC IRQ end\n");
364
365 out:
366         return IRQ_HANDLED;
367 }
368
369 static int tmio_mmc_start_data(struct tmio_mmc_host *host,
370         struct mmc_data *data)
371 {
372         pr_debug("setup data transfer: blocksize %08x  nr_blocks %d\n",
373             data->blksz, data->blocks);
374
375         /* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */
376         if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
377                 printk(KERN_ERR "%s: %d byte block unsupported in 4 bit mode\n",
378                         mmc_hostname(host->mmc), data->blksz);
379                 return -EINVAL;
380         }
381
382         tmio_mmc_init_sg(host, data);
383         host->data = data;
384
385         /* Set transfer length / blocksize */
386         sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz);
387         sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks);
388
389         return 0;
390 }
391
392 /* Process requests from the MMC layer */
393 static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
394 {
395         struct tmio_mmc_host *host = mmc_priv(mmc);
396         int ret;
397
398         if (host->mrq)
399                 pr_debug("request not null\n");
400
401         host->mrq = mrq;
402
403         if (mrq->data) {
404                 ret = tmio_mmc_start_data(host, mrq->data);
405                 if (ret)
406                         goto fail;
407         }
408
409         ret = tmio_mmc_start_command(host, mrq->cmd);
410
411         if (!ret)
412                 return;
413
414 fail:
415         mrq->cmd->error = ret;
416         mmc_request_done(mmc, mrq);
417 }
418
419 /* Set MMC clock / power.
420  * Note: This controller uses a simple divider scheme therefore it cannot
421  * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as
422  * MMC wont run that fast, it has to be clocked at 12MHz which is the next
423  * slowest setting.
424  */
425 static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
426 {
427         struct tmio_mmc_host *host = mmc_priv(mmc);
428
429         if (ios->clock)
430                 tmio_mmc_set_clock(host, ios->clock);
431
432         /* Power sequence - OFF -> ON -> UP */
433         switch (ios->power_mode) {
434         case MMC_POWER_OFF: /* power down SD bus */
435                 sd_config_write8(host, CNF_PWR_CTL_2, 0x00);
436                 tmio_mmc_clk_stop(host);
437                 break;
438         case MMC_POWER_ON: /* power up SD bus */
439
440                 sd_config_write8(host, CNF_PWR_CTL_2, 0x02);
441                 break;
442         case MMC_POWER_UP: /* start bus clock */
443                 tmio_mmc_clk_start(host);
444                 break;
445         }
446
447         switch (ios->bus_width) {
448         case MMC_BUS_WIDTH_1:
449                 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
450         break;
451         case MMC_BUS_WIDTH_4:
452                 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
453         break;
454         }
455
456         /* Let things settle. delay taken from winCE driver */
457         udelay(140);
458 }
459
460 static int tmio_mmc_get_ro(struct mmc_host *mmc)
461 {
462         struct tmio_mmc_host *host = mmc_priv(mmc);
463
464         return (sd_ctrl_read16(host, CTL_STATUS) & TMIO_STAT_WRPROTECT) ? 0 : 1;
465 }
466
467 static struct mmc_host_ops tmio_mmc_ops = {
468         .request        = tmio_mmc_request,
469         .set_ios        = tmio_mmc_set_ios,
470         .get_ro         = tmio_mmc_get_ro,
471 };
472
473 #ifdef CONFIG_PM
474 static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
475 {
476         struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data;
477         struct mmc_host *mmc = platform_get_drvdata(dev);
478         int ret;
479
480         ret = mmc_suspend_host(mmc, state);
481
482         /* Tell MFD core it can disable us now.*/
483         if (!ret && cell->disable)
484                 cell->disable(dev);
485
486         return ret;
487 }
488
489 static int tmio_mmc_resume(struct platform_device *dev)
490 {
491         struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data;
492         struct mmc_host *mmc = platform_get_drvdata(dev);
493         struct tmio_mmc_host *host = mmc_priv(mmc);
494         int ret = 0;
495
496         /* Enable the MMC/SD Control registers */
497         sd_config_write16(host, CNF_CMD, SDCREN);
498         sd_config_write32(host, CNF_CTL_BASE,
499                 (dev->resource[0].start >> host->bus_shift) & 0xfffe);
500
501         /* Tell the MFD core we are ready to be enabled */
502         if (cell->enable) {
503                 ret = cell->enable(dev);
504                 if (ret)
505                         goto out;
506         }
507
508         mmc_resume_host(mmc);
509
510 out:
511         return ret;
512 }
513 #else
514 #define tmio_mmc_suspend NULL
515 #define tmio_mmc_resume NULL
516 #endif
517
518 static int __devinit tmio_mmc_probe(struct platform_device *dev)
519 {
520         struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data;
521         struct tmio_mmc_data *pdata;
522         struct resource *res_ctl, *res_cnf;
523         struct tmio_mmc_host *host;
524         struct mmc_host *mmc;
525         int ret = -ENOMEM;
526
527         if (dev->num_resources != 3)
528                 goto out;
529
530         res_ctl = platform_get_resource(dev, IORESOURCE_MEM, 0);
531         res_cnf = platform_get_resource(dev, IORESOURCE_MEM, 1);
532         if (!res_ctl || !res_cnf) {
533                 ret = -EINVAL;
534                 goto out;
535         }
536
537         pdata = cell->driver_data;
538         if (!pdata || !pdata->hclk) {
539                 ret = -EINVAL;
540                 goto out;
541         }
542
543         mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &dev->dev);
544         if (!mmc)
545                 goto out;
546
547         host = mmc_priv(mmc);
548         host->mmc = mmc;
549         platform_set_drvdata(dev, mmc);
550
551         /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
552         host->bus_shift = resource_size(res_ctl) >> 10;
553
554         host->ctl = ioremap(res_ctl->start, resource_size(res_ctl));
555         if (!host->ctl)
556                 goto host_free;
557
558         host->cnf = ioremap(res_cnf->start, resource_size(res_cnf));
559         if (!host->cnf)
560                 goto unmap_ctl;
561
562         mmc->ops = &tmio_mmc_ops;
563         mmc->caps = MMC_CAP_4_BIT_DATA;
564         mmc->f_max = pdata->hclk;
565         mmc->f_min = mmc->f_max / 512;
566         mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
567
568         /* Enable the MMC/SD Control registers */
569         sd_config_write16(host, CNF_CMD, SDCREN);
570         sd_config_write32(host, CNF_CTL_BASE,
571                 (dev->resource[0].start >> host->bus_shift) & 0xfffe);
572
573         /* Tell the MFD core we are ready to be enabled */
574         if (cell->enable) {
575                 ret = cell->enable(dev);
576                 if (ret)
577                         goto unmap_cnf;
578         }
579
580         /* Disable SD power during suspend */
581         sd_config_write8(host, CNF_PWR_CTL_3, 0x01);
582
583         /* The below is required but why? FIXME */
584         sd_config_write8(host, CNF_STOP_CLK_CTL, 0x1f);
585
586         /* Power down SD bus*/
587         sd_config_write8(host, CNF_PWR_CTL_2, 0x00);
588
589         tmio_mmc_clk_stop(host);
590         reset(host);
591
592         ret = platform_get_irq(dev, 0);
593         if (ret >= 0)
594                 host->irq = ret;
595         else
596                 goto unmap_cnf;
597
598         disable_mmc_irqs(host, TMIO_MASK_ALL);
599
600         ret = request_irq(host->irq, tmio_mmc_irq, IRQF_DISABLED, "tmio-mmc",
601                 host);
602         if (ret)
603                 goto unmap_cnf;
604
605         set_irq_type(host->irq, IRQ_TYPE_EDGE_FALLING);
606
607         mmc_add_host(mmc);
608
609         printk(KERN_INFO "%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc),
610                (unsigned long)host->ctl, host->irq);
611
612         /* Unmask the IRQs we want to know about */
613         enable_mmc_irqs(host, TMIO_MASK_IRQ);
614
615         return 0;
616
617 unmap_cnf:
618         iounmap(host->cnf);
619 unmap_ctl:
620         iounmap(host->ctl);
621 host_free:
622         mmc_free_host(mmc);
623 out:
624         return ret;
625 }
626
627 static int __devexit tmio_mmc_remove(struct platform_device *dev)
628 {
629         struct mmc_host *mmc = platform_get_drvdata(dev);
630
631         platform_set_drvdata(dev, NULL);
632
633         if (mmc) {
634                 struct tmio_mmc_host *host = mmc_priv(mmc);
635                 mmc_remove_host(mmc);
636                 free_irq(host->irq, host);
637                 iounmap(host->ctl);
638                 iounmap(host->cnf);
639                 mmc_free_host(mmc);
640         }
641
642         return 0;
643 }
644
645 /* ------------------- device registration ----------------------- */
646
647 static struct platform_driver tmio_mmc_driver = {
648         .driver = {
649                 .name = "tmio-mmc",
650                 .owner = THIS_MODULE,
651         },
652         .probe = tmio_mmc_probe,
653         .remove = __devexit_p(tmio_mmc_remove),
654         .suspend = tmio_mmc_suspend,
655         .resume = tmio_mmc_resume,
656 };
657
658
659 static int __init tmio_mmc_init(void)
660 {
661         return platform_driver_register(&tmio_mmc_driver);
662 }
663
664 static void __exit tmio_mmc_exit(void)
665 {
666         platform_driver_unregister(&tmio_mmc_driver);
667 }
668
669 module_init(tmio_mmc_init);
670 module_exit(tmio_mmc_exit);
671
672 MODULE_DESCRIPTION("Toshiba TMIO SD/MMC driver");
673 MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
674 MODULE_LICENSE("GPL v2");
675 MODULE_ALIAS("platform:tmio-mmc");