aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorDenis Karpov <ext-denis.2.karpov@nokia.com>2009-09-22 19:44:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:35 -0400
commit70a3341a711f27ae77714ae7dd360a4e7e2d5e7c (patch)
tree788fb410c328c8db7081ddc3c30a9f5cb6bad409 /drivers/mmc/host
parent4dffd7a251172d78a157ff45ec1207012f44774a (diff)
omap_hsmmc: code refactoring
Functions', structures', variables' names are changed to start with omap_hsmmc_ prefix. Signed-off-by: Denis Karpov <ext-denis.2.karpov@nokia.com> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Acked-by: Matt Fleming <matt@console-pimps.org> Cc: Ian Molton <ian@mnementh.co.uk> Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com> Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com> Cc: Denis Karpov <ext-denis.2.karpov@nokia.com> Cc: Pierre Ossman <pierre@ossman.eu> Cc: Philip Langdale <philipl@overt.org> Cc: "Madhusudhan" <madhu.cr@ti.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c320
1 files changed, 161 insertions, 159 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0bfea9c2a597..20746e4f00b3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -135,7 +135,7 @@
135#define OMAP_HSMMC_WRITE(base, reg, val) \ 135#define OMAP_HSMMC_WRITE(base, reg, val) \
136 __raw_writel((val), (base) + OMAP_HSMMC_##reg) 136 __raw_writel((val), (base) + OMAP_HSMMC_##reg)
137 137
138struct mmc_omap_host { 138struct omap_hsmmc_host {
139 struct device *dev; 139 struct device *dev;
140 struct mmc_host *mmc; 140 struct mmc_host *mmc;
141 struct mmc_request *mrq; 141 struct mmc_request *mrq;
@@ -174,7 +174,7 @@ struct mmc_omap_host {
174/* 174/*
175 * Stop clock to the card 175 * Stop clock to the card
176 */ 176 */
177static void omap_mmc_stop_clock(struct mmc_omap_host *host) 177static void omap_hsmmc_stop_clock(struct omap_hsmmc_host *host)
178{ 178{
179 OMAP_HSMMC_WRITE(host->base, SYSCTL, 179 OMAP_HSMMC_WRITE(host->base, SYSCTL,
180 OMAP_HSMMC_READ(host->base, SYSCTL) & ~CEN); 180 OMAP_HSMMC_READ(host->base, SYSCTL) & ~CEN);
@@ -188,7 +188,7 @@ static void omap_mmc_stop_clock(struct mmc_omap_host *host)
188 * Restore the MMC host context, if it was lost as result of a 188 * Restore the MMC host context, if it was lost as result of a
189 * power state change. 189 * power state change.
190 */ 190 */
191static int omap_mmc_restore_ctx(struct mmc_omap_host *host) 191static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
192{ 192{
193 struct mmc_ios *ios = &host->mmc->ios; 193 struct mmc_ios *ios = &host->mmc->ios;
194 struct omap_mmc_platform_data *pdata = host->pdata; 194 struct omap_mmc_platform_data *pdata = host->pdata;
@@ -316,7 +316,7 @@ out:
316/* 316/*
317 * Save the MMC host context (store the number of power state changes so far). 317 * Save the MMC host context (store the number of power state changes so far).
318 */ 318 */
319static void omap_mmc_save_ctx(struct mmc_omap_host *host) 319static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
320{ 320{
321 struct omap_mmc_platform_data *pdata = host->pdata; 321 struct omap_mmc_platform_data *pdata = host->pdata;
322 int context_loss; 322 int context_loss;
@@ -331,12 +331,12 @@ static void omap_mmc_save_ctx(struct mmc_omap_host *host)
331 331
332#else 332#else
333 333
334static int omap_mmc_restore_ctx(struct mmc_omap_host *host) 334static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
335{ 335{
336 return 0; 336 return 0;
337} 337}
338 338
339static void omap_mmc_save_ctx(struct mmc_omap_host *host) 339static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
340{ 340{
341} 341}
342 342
@@ -346,7 +346,7 @@ static void omap_mmc_save_ctx(struct mmc_omap_host *host)
346 * Send init stream sequence to card 346 * Send init stream sequence to card
347 * before sending IDLE command 347 * before sending IDLE command
348 */ 348 */
349static void send_init_stream(struct mmc_omap_host *host) 349static void send_init_stream(struct omap_hsmmc_host *host)
350{ 350{
351 int reg = 0; 351 int reg = 0;
352 unsigned long timeout; 352 unsigned long timeout;
@@ -370,7 +370,7 @@ static void send_init_stream(struct mmc_omap_host *host)
370} 370}
371 371
372static inline 372static inline
373int mmc_omap_cover_is_closed(struct mmc_omap_host *host) 373int omap_hsmmc_cover_is_closed(struct omap_hsmmc_host *host)
374{ 374{
375 int r = 1; 375 int r = 1;
376 376
@@ -380,35 +380,35 @@ int mmc_omap_cover_is_closed(struct mmc_omap_host *host)
380} 380}
381 381
382static ssize_t 382static ssize_t
383mmc_omap_show_cover_switch(struct device *dev, struct device_attribute *attr, 383omap_hsmmc_show_cover_switch(struct device *dev, struct device_attribute *attr,
384 char *buf) 384 char *buf)
385{ 385{
386 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); 386 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev);
387 struct mmc_omap_host *host = mmc_priv(mmc); 387 struct omap_hsmmc_host *host = mmc_priv(mmc);
388 388
389 return sprintf(buf, "%s\n", mmc_omap_cover_is_closed(host) ? "closed" : 389 return sprintf(buf, "%s\n",
390 "open"); 390 omap_hsmmc_cover_is_closed(host) ? "closed" : "open");
391} 391}
392 392
393static DEVICE_ATTR(cover_switch, S_IRUGO, mmc_omap_show_cover_switch, NULL); 393static DEVICE_ATTR(cover_switch, S_IRUGO, omap_hsmmc_show_cover_switch, NULL);
394 394
395static ssize_t 395static ssize_t
396mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr, 396omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
397 char *buf) 397 char *buf)
398{ 398{
399 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); 399 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev);
400 struct mmc_omap_host *host = mmc_priv(mmc); 400 struct omap_hsmmc_host *host = mmc_priv(mmc);
401 401
402 return sprintf(buf, "%s\n", mmc_slot(host).name); 402 return sprintf(buf, "%s\n", mmc_slot(host).name);
403} 403}
404 404
405static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL); 405static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);
406 406
407/* 407/*
408 * Configure the response type and send the cmd. 408 * Configure the response type and send the cmd.
409 */ 409 */
410static void 410static void
411mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd, 411omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
412 struct mmc_data *data) 412 struct mmc_data *data)
413{ 413{
414 int cmdreg = 0, resptype = 0, cmdtype = 0; 414 int cmdreg = 0, resptype = 0, cmdtype = 0;
@@ -474,7 +474,7 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd,
474} 474}
475 475
476static int 476static int
477mmc_omap_get_dma_dir(struct mmc_omap_host *host, struct mmc_data *data) 477omap_hsmmc_get_dma_dir(struct omap_hsmmc_host *host, struct mmc_data *data)
478{ 478{
479 if (data->flags & MMC_DATA_WRITE) 479 if (data->flags & MMC_DATA_WRITE)
480 return DMA_TO_DEVICE; 480 return DMA_TO_DEVICE;
@@ -486,7 +486,7 @@ mmc_omap_get_dma_dir(struct mmc_omap_host *host, struct mmc_data *data)
486 * Notify the transfer complete to MMC core 486 * Notify the transfer complete to MMC core
487 */ 487 */
488static void 488static void
489mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data) 489omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data)
490{ 490{
491 if (!data) { 491 if (!data) {
492 struct mmc_request *mrq = host->mrq; 492 struct mmc_request *mrq = host->mrq;
@@ -507,7 +507,7 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data)
507 507
508 if (host->use_dma && host->dma_ch != -1) 508 if (host->use_dma && host->dma_ch != -1)
509 dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->dma_len, 509 dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->dma_len,
510 mmc_omap_get_dma_dir(host, data)); 510 omap_hsmmc_get_dma_dir(host, data));
511 511
512 if (!data->error) 512 if (!data->error)
513 data->bytes_xfered += data->blocks * (data->blksz); 513 data->bytes_xfered += data->blocks * (data->blksz);
@@ -519,14 +519,14 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data)
519 mmc_request_done(host->mmc, data->mrq); 519 mmc_request_done(host->mmc, data->mrq);
520 return; 520 return;
521 } 521 }
522 mmc_omap_start_command(host, data->stop, NULL); 522 omap_hsmmc_start_command(host, data->stop, NULL);
523} 523}
524 524
525/* 525/*
526 * Notify the core about command completion 526 * Notify the core about command completion
527 */ 527 */
528static void 528static void
529mmc_omap_cmd_done(struct mmc_omap_host *host, struct mmc_command *cmd) 529omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct mmc_command *cmd)
530{ 530{
531 host->cmd = NULL; 531 host->cmd = NULL;
532 532
@@ -551,13 +551,13 @@ mmc_omap_cmd_done(struct mmc_omap_host *host, struct mmc_command *cmd)
551/* 551/*
552 * DMA clean up for command errors 552 * DMA clean up for command errors
553 */ 553 */
554static void mmc_dma_cleanup(struct mmc_omap_host *host, int errno) 554static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
555{ 555{
556 host->data->error = errno; 556 host->data->error = errno;
557 557
558 if (host->use_dma && host->dma_ch != -1) { 558 if (host->use_dma && host->dma_ch != -1) {
559 dma_unmap_sg(mmc_dev(host->mmc), host->data->sg, host->dma_len, 559 dma_unmap_sg(mmc_dev(host->mmc), host->data->sg, host->dma_len,
560 mmc_omap_get_dma_dir(host, host->data)); 560 omap_hsmmc_get_dma_dir(host, host->data));
561 omap_free_dma(host->dma_ch); 561 omap_free_dma(host->dma_ch);
562 host->dma_ch = -1; 562 host->dma_ch = -1;
563 up(&host->sem); 563 up(&host->sem);
@@ -569,10 +569,10 @@ static void mmc_dma_cleanup(struct mmc_omap_host *host, int errno)
569 * Readable error output 569 * Readable error output
570 */ 570 */
571#ifdef CONFIG_MMC_DEBUG 571#ifdef CONFIG_MMC_DEBUG
572static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status) 572static void omap_hsmmc_report_irq(struct omap_hsmmc_host *host, u32 status)
573{ 573{
574 /* --- means reserved bit without definition at documentation */ 574 /* --- means reserved bit without definition at documentation */
575 static const char *mmc_omap_status_bits[] = { 575 static const char *omap_hsmmc_status_bits[] = {
576 "CC", "TC", "BGE", "---", "BWR", "BRR", "---", "---", "CIRQ", 576 "CC", "TC", "BGE", "---", "BWR", "BRR", "---", "---", "CIRQ",
577 "OBI", "---", "---", "---", "---", "---", "ERRI", "CTO", "CCRC", 577 "OBI", "---", "---", "---", "---", "---", "ERRI", "CTO", "CCRC",
578 "CEB", "CIE", "DTO", "DCRC", "DEB", "---", "ACE", "---", 578 "CEB", "CIE", "DTO", "DCRC", "DEB", "---", "ACE", "---",
@@ -585,9 +585,9 @@ static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status)
585 len = sprintf(buf, "MMC IRQ 0x%x :", status); 585 len = sprintf(buf, "MMC IRQ 0x%x :", status);
586 buf += len; 586 buf += len;
587 587
588 for (i = 0; i < ARRAY_SIZE(mmc_omap_status_bits); i++) 588 for (i = 0; i < ARRAY_SIZE(omap_hsmmc_status_bits); i++)
589 if (status & (1 << i)) { 589 if (status & (1 << i)) {
590 len = sprintf(buf, " %s", mmc_omap_status_bits[i]); 590 len = sprintf(buf, " %s", omap_hsmmc_status_bits[i]);
591 buf += len; 591 buf += len;
592 } 592 }
593 593
@@ -602,8 +602,8 @@ static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status)
602 * SRC or SRD bit of SYSCTL register 602 * SRC or SRD bit of SYSCTL register
603 * Can be called from interrupt context 603 * Can be called from interrupt context
604 */ 604 */
605static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host, 605static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
606 unsigned long bit) 606 unsigned long bit)
607{ 607{
608 unsigned long i = 0; 608 unsigned long i = 0;
609 unsigned long limit = (loops_per_jiffy * 609 unsigned long limit = (loops_per_jiffy *
@@ -625,9 +625,9 @@ static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host,
625/* 625/*
626 * MMC controller IRQ handler 626 * MMC controller IRQ handler
627 */ 627 */
628static irqreturn_t mmc_omap_irq(int irq, void *dev_id) 628static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
629{ 629{
630 struct mmc_omap_host *host = dev_id; 630 struct omap_hsmmc_host *host = dev_id;
631 struct mmc_data *data; 631 struct mmc_data *data;
632 int end_cmd = 0, end_trans = 0, status; 632 int end_cmd = 0, end_trans = 0, status;
633 633
@@ -648,14 +648,14 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
648 648
649 if (status & ERR) { 649 if (status & ERR) {
650#ifdef CONFIG_MMC_DEBUG 650#ifdef CONFIG_MMC_DEBUG
651 mmc_omap_report_irq(host, status); 651 omap_hsmmc_report_irq(host, status);
652#endif 652#endif
653 if ((status & CMD_TIMEOUT) || 653 if ((status & CMD_TIMEOUT) ||
654 (status & CMD_CRC)) { 654 (status & CMD_CRC)) {
655 if (host->cmd) { 655 if (host->cmd) {
656 if (status & CMD_TIMEOUT) { 656 if (status & CMD_TIMEOUT) {
657 mmc_omap_reset_controller_fsm(host, 657 omap_hsmmc_reset_controller_fsm(host,
658 SRC); 658 SRC);
659 host->cmd->error = -ETIMEDOUT; 659 host->cmd->error = -ETIMEDOUT;
660 } else { 660 } else {
661 host->cmd->error = -EILSEQ; 661 host->cmd->error = -EILSEQ;
@@ -664,9 +664,10 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
664 } 664 }
665 if (host->data || host->response_busy) { 665 if (host->data || host->response_busy) {
666 if (host->data) 666 if (host->data)
667 mmc_dma_cleanup(host, -ETIMEDOUT); 667 omap_hsmmc_dma_cleanup(host,
668 -ETIMEDOUT);
668 host->response_busy = 0; 669 host->response_busy = 0;
669 mmc_omap_reset_controller_fsm(host, SRD); 670 omap_hsmmc_reset_controller_fsm(host, SRD);
670 } 671 }
671 } 672 }
672 if ((status & DATA_TIMEOUT) || 673 if ((status & DATA_TIMEOUT) ||
@@ -676,11 +677,11 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
676 -ETIMEDOUT : -EILSEQ; 677 -ETIMEDOUT : -EILSEQ;
677 678
678 if (host->data) 679 if (host->data)
679 mmc_dma_cleanup(host, err); 680 omap_hsmmc_dma_cleanup(host, err);
680 else 681 else
681 host->mrq->cmd->error = err; 682 host->mrq->cmd->error = err;
682 host->response_busy = 0; 683 host->response_busy = 0;
683 mmc_omap_reset_controller_fsm(host, SRD); 684 omap_hsmmc_reset_controller_fsm(host, SRD);
684 end_trans = 1; 685 end_trans = 1;
685 } 686 }
686 } 687 }
@@ -699,16 +700,16 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
699 OMAP_HSMMC_READ(host->base, STAT); 700 OMAP_HSMMC_READ(host->base, STAT);
700 701
701 if (end_cmd || ((status & CC) && host->cmd)) 702 if (end_cmd || ((status & CC) && host->cmd))
702 mmc_omap_cmd_done(host, host->cmd); 703 omap_hsmmc_cmd_done(host, host->cmd);
703 if ((end_trans || (status & TC)) && host->mrq) 704 if ((end_trans || (status & TC)) && host->mrq)
704 mmc_omap_xfer_done(host, data); 705 omap_hsmmc_xfer_done(host, data);
705 706
706 spin_unlock(&host->irq_lock); 707 spin_unlock(&host->irq_lock);
707 708
708 return IRQ_HANDLED; 709 return IRQ_HANDLED;
709} 710}
710 711
711static void set_sd_bus_power(struct mmc_omap_host *host) 712static void set_sd_bus_power(struct omap_hsmmc_host *host)
712{ 713{
713 unsigned long i; 714 unsigned long i;
714 715
@@ -728,7 +729,7 @@ static void set_sd_bus_power(struct mmc_omap_host *host)
728 * The MMC2 transceiver controls are used instead of DAT4..DAT7. 729 * The MMC2 transceiver controls are used instead of DAT4..DAT7.
729 * Some chips, like eMMC ones, use internal transceivers. 730 * Some chips, like eMMC ones, use internal transceivers.
730 */ 731 */
731static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) 732static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
732{ 733{
733 u32 reg_val = 0; 734 u32 reg_val = 0;
734 int ret; 735 int ret;
@@ -759,7 +760,7 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
759 /* 760 /*
760 * If a MMC dual voltage card is detected, the set_ios fn calls 761 * If a MMC dual voltage card is detected, the set_ios fn calls
761 * this fn with VDD bit set for 1.8V. Upon card removal from the 762 * this fn with VDD bit set for 1.8V. Upon card removal from the
762 * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. 763 * slot, omap_hsmmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF.
763 * 764 *
764 * Cope with a bit of slop in the range ... per data sheets: 765 * Cope with a bit of slop in the range ... per data sheets:
765 * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max, 766 * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max,
@@ -788,10 +789,10 @@ err:
788/* 789/*
789 * Work Item to notify the core about card insertion/removal 790 * Work Item to notify the core about card insertion/removal
790 */ 791 */
791static void mmc_omap_detect(struct work_struct *work) 792static void omap_hsmmc_detect(struct work_struct *work)
792{ 793{
793 struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, 794 struct omap_hsmmc_host *host =
794 mmc_carddetect_work); 795 container_of(work, struct omap_hsmmc_host, mmc_carddetect_work);
795 struct omap_mmc_slot_data *slot = &mmc_slot(host); 796 struct omap_mmc_slot_data *slot = &mmc_slot(host);
796 int carddetect; 797 int carddetect;
797 798
@@ -809,8 +810,9 @@ static void mmc_omap_detect(struct work_struct *work)
809 mmc_detect_change(host->mmc, (HZ * 200) / 1000); 810 mmc_detect_change(host->mmc, (HZ * 200) / 1000);
810 } else { 811 } else {
811 mmc_host_enable(host->mmc); 812 mmc_host_enable(host->mmc);
812 mmc_omap_reset_controller_fsm(host, SRD); 813 omap_hsmmc_reset_controller_fsm(host, SRD);
813 mmc_host_lazy_disable(host->mmc); 814 mmc_host_lazy_disable(host->mmc);
815
814 mmc_detect_change(host->mmc, (HZ * 50) / 1000); 816 mmc_detect_change(host->mmc, (HZ * 50) / 1000);
815 } 817 }
816} 818}
@@ -818,9 +820,9 @@ static void mmc_omap_detect(struct work_struct *work)
818/* 820/*
819 * ISR for handling card insertion and removal 821 * ISR for handling card insertion and removal
820 */ 822 */
821static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id) 823static irqreturn_t omap_hsmmc_cd_handler(int irq, void *dev_id)
822{ 824{
823 struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; 825 struct omap_hsmmc_host *host = (struct omap_hsmmc_host *)dev_id;
824 826
825 if (host->suspended) 827 if (host->suspended)
826 return IRQ_HANDLED; 828 return IRQ_HANDLED;
@@ -829,7 +831,7 @@ static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id)
829 return IRQ_HANDLED; 831 return IRQ_HANDLED;
830} 832}
831 833
832static int mmc_omap_get_dma_sync_dev(struct mmc_omap_host *host, 834static int omap_hsmmc_get_dma_sync_dev(struct omap_hsmmc_host *host,
833 struct mmc_data *data) 835 struct mmc_data *data)
834{ 836{
835 int sync_dev; 837 int sync_dev;
@@ -841,7 +843,7 @@ static int mmc_omap_get_dma_sync_dev(struct mmc_omap_host *host,
841 return sync_dev; 843 return sync_dev;
842} 844}
843 845
844static void mmc_omap_config_dma_params(struct mmc_omap_host *host, 846static void omap_hsmmc_config_dma_params(struct omap_hsmmc_host *host,
845 struct mmc_data *data, 847 struct mmc_data *data,
846 struct scatterlist *sgl) 848 struct scatterlist *sgl)
847{ 849{
@@ -865,7 +867,7 @@ static void mmc_omap_config_dma_params(struct mmc_omap_host *host,
865 867
866 omap_set_dma_transfer_params(dma_ch, OMAP_DMA_DATA_TYPE_S32, 868 omap_set_dma_transfer_params(dma_ch, OMAP_DMA_DATA_TYPE_S32,
867 blksz / 4, nblk, OMAP_DMA_SYNC_FRAME, 869 blksz / 4, nblk, OMAP_DMA_SYNC_FRAME,
868 mmc_omap_get_dma_sync_dev(host, data), 870 omap_hsmmc_get_dma_sync_dev(host, data),
869 !(data->flags & MMC_DATA_WRITE)); 871 !(data->flags & MMC_DATA_WRITE));
870 872
871 omap_start_dma(dma_ch); 873 omap_start_dma(dma_ch);
@@ -874,9 +876,9 @@ static void mmc_omap_config_dma_params(struct mmc_omap_host *host,
874/* 876/*
875 * DMA call back function 877 * DMA call back function
876 */ 878 */
877static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) 879static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *data)
878{ 880{
879 struct mmc_omap_host *host = data; 881 struct omap_hsmmc_host *host = data;
880 882
881 if (ch_status & OMAP2_DMA_MISALIGNED_ERR_IRQ) 883 if (ch_status & OMAP2_DMA_MISALIGNED_ERR_IRQ)
882 dev_dbg(mmc_dev(host->mmc), "MISALIGNED_ADRS_ERR\n"); 884 dev_dbg(mmc_dev(host->mmc), "MISALIGNED_ADRS_ERR\n");
@@ -887,7 +889,7 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
887 host->dma_sg_idx++; 889 host->dma_sg_idx++;
888 if (host->dma_sg_idx < host->dma_len) { 890 if (host->dma_sg_idx < host->dma_len) {
889 /* Fire up the next transfer. */ 891 /* Fire up the next transfer. */
890 mmc_omap_config_dma_params(host, host->data, 892 omap_hsmmc_config_dma_params(host, host->data,
891 host->data->sg + host->dma_sg_idx); 893 host->data->sg + host->dma_sg_idx);
892 return; 894 return;
893 } 895 }
@@ -904,8 +906,8 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
904/* 906/*
905 * Routine to configure and start DMA for the MMC card 907 * Routine to configure and start DMA for the MMC card
906 */ 908 */
907static int 909static int omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host,
908mmc_omap_start_dma_transfer(struct mmc_omap_host *host, struct mmc_request *req) 910 struct mmc_request *req)
909{ 911{
910 int dma_ch = 0, ret = 0, err = 1, i; 912 int dma_ch = 0, ret = 0, err = 1, i;
911 struct mmc_data *data = req->data; 913 struct mmc_data *data = req->data;
@@ -942,8 +944,8 @@ mmc_omap_start_dma_transfer(struct mmc_omap_host *host, struct mmc_request *req)
942 return err; 944 return err;
943 } 945 }
944 946
945 ret = omap_request_dma(mmc_omap_get_dma_sync_dev(host, data), "MMC/SD", 947 ret = omap_request_dma(omap_hsmmc_get_dma_sync_dev(host, data),
946 mmc_omap_dma_cb, host, &dma_ch); 948 "MMC/SD", omap_hsmmc_dma_cb, host, &dma_ch);
947 if (ret != 0) { 949 if (ret != 0) {
948 dev_err(mmc_dev(host->mmc), 950 dev_err(mmc_dev(host->mmc),
949 "%s: omap_request_dma() failed with %d\n", 951 "%s: omap_request_dma() failed with %d\n",
@@ -952,16 +954,16 @@ mmc_omap_start_dma_transfer(struct mmc_omap_host *host, struct mmc_request *req)
952 } 954 }
953 955
954 host->dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, 956 host->dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg,
955 data->sg_len, mmc_omap_get_dma_dir(host, data)); 957 data->sg_len, omap_hsmmc_get_dma_dir(host, data));
956 host->dma_ch = dma_ch; 958 host->dma_ch = dma_ch;
957 host->dma_sg_idx = 0; 959 host->dma_sg_idx = 0;
958 960
959 mmc_omap_config_dma_params(host, data, data->sg); 961 omap_hsmmc_config_dma_params(host, data, data->sg);
960 962
961 return 0; 963 return 0;
962} 964}
963 965
964static void set_data_timeout(struct mmc_omap_host *host, 966static void set_data_timeout(struct omap_hsmmc_host *host,
965 struct mmc_request *req) 967 struct mmc_request *req)
966{ 968{
967 unsigned int timeout, cycle_ns; 969 unsigned int timeout, cycle_ns;
@@ -1001,7 +1003,7 @@ static void set_data_timeout(struct mmc_omap_host *host,
1001 * Configure block length for MMC/SD cards and initiate the transfer. 1003 * Configure block length for MMC/SD cards and initiate the transfer.
1002 */ 1004 */
1003static int 1005static int
1004mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) 1006omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req)
1005{ 1007{
1006 int ret; 1008 int ret;
1007 host->data = req->data; 1009 host->data = req->data;
@@ -1016,7 +1018,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
1016 set_data_timeout(host, req); 1018 set_data_timeout(host, req);
1017 1019
1018 if (host->use_dma) { 1020 if (host->use_dma) {
1019 ret = mmc_omap_start_dma_transfer(host, req); 1021 ret = omap_hsmmc_start_dma_transfer(host, req);
1020 if (ret != 0) { 1022 if (ret != 0) {
1021 dev_dbg(mmc_dev(host->mmc), "MMC start dma failure\n"); 1023 dev_dbg(mmc_dev(host->mmc), "MMC start dma failure\n");
1022 return ret; 1024 return ret;
@@ -1028,9 +1030,9 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
1028/* 1030/*
1029 * Request function. for read/write operation 1031 * Request function. for read/write operation
1030 */ 1032 */
1031static void omap_mmc_request(struct mmc_host *mmc, struct mmc_request *req) 1033static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
1032{ 1034{
1033 struct mmc_omap_host *host = mmc_priv(mmc); 1035 struct omap_hsmmc_host *host = mmc_priv(mmc);
1034 int err; 1036 int err;
1035 1037
1036 /* 1038 /*
@@ -1042,7 +1044,7 @@ static void omap_mmc_request(struct mmc_host *mmc, struct mmc_request *req)
1042 spin_lock_irqsave(&host->irq_lock, host->flags); 1044 spin_lock_irqsave(&host->irq_lock, host->flags);
1043 WARN_ON(host->mrq != NULL); 1045 WARN_ON(host->mrq != NULL);
1044 host->mrq = req; 1046 host->mrq = req;
1045 err = mmc_omap_prepare_data(host, req); 1047 err = omap_hsmmc_prepare_data(host, req);
1046 if (err) { 1048 if (err) {
1047 req->cmd->error = err; 1049 req->cmd->error = err;
1048 if (req->data) 1050 if (req->data)
@@ -1054,14 +1056,13 @@ static void omap_mmc_request(struct mmc_host *mmc, struct mmc_request *req)
1054 return; 1056 return;
1055 } 1057 }
1056 1058
1057 mmc_omap_start_command(host, req->cmd, req->data); 1059 omap_hsmmc_start_command(host, req->cmd, req->data);
1058} 1060}
1059 1061
1060
1061/* Routine to configure clock values. Exposed API to core */ 1062/* Routine to configure clock values. Exposed API to core */
1062static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 1063static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1063{ 1064{
1064 struct mmc_omap_host *host = mmc_priv(mmc); 1065 struct omap_hsmmc_host *host = mmc_priv(mmc);
1065 u16 dsor = 0; 1066 u16 dsor = 0;
1066 unsigned long regval; 1067 unsigned long regval;
1067 unsigned long timeout; 1068 unsigned long timeout;
@@ -1120,8 +1121,8 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1120 * MMC_POWER_UP upon recalculating the voltage. 1121 * MMC_POWER_UP upon recalculating the voltage.
1121 * vdd 1.8v. 1122 * vdd 1.8v.
1122 */ 1123 */
1123 if (omap_mmc_switch_opcond(host, ios->vdd) != 0) 1124 if (omap_hsmmc_switch_opcond(host, ios->vdd) != 0)
1124 dev_dbg(mmc_dev(host->mmc), 1125 dev_dbg(mmc_dev(host->mmc),
1125 "Switch operation failed\n"); 1126 "Switch operation failed\n");
1126 } 1127 }
1127 } 1128 }
@@ -1137,7 +1138,7 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1137 if (dsor > 250) 1138 if (dsor > 250)
1138 dsor = 250; 1139 dsor = 250;
1139 } 1140 }
1140 omap_mmc_stop_clock(host); 1141 omap_hsmmc_stop_clock(host);
1141 regval = OMAP_HSMMC_READ(host->base, SYSCTL); 1142 regval = OMAP_HSMMC_READ(host->base, SYSCTL);
1142 regval = regval & ~(CLKD_MASK); 1143 regval = regval & ~(CLKD_MASK);
1143 regval = regval | (dsor << 6) | (DTO << 16); 1144 regval = regval | (dsor << 6) | (DTO << 16);
@@ -1171,7 +1172,7 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1171 1172
1172static int omap_hsmmc_get_cd(struct mmc_host *mmc) 1173static int omap_hsmmc_get_cd(struct mmc_host *mmc)
1173{ 1174{
1174 struct mmc_omap_host *host = mmc_priv(mmc); 1175 struct omap_hsmmc_host *host = mmc_priv(mmc);
1175 1176
1176 if (!mmc_slot(host).card_detect) 1177 if (!mmc_slot(host).card_detect)
1177 return -ENOSYS; 1178 return -ENOSYS;
@@ -1180,14 +1181,14 @@ static int omap_hsmmc_get_cd(struct mmc_host *mmc)
1180 1181
1181static int omap_hsmmc_get_ro(struct mmc_host *mmc) 1182static int omap_hsmmc_get_ro(struct mmc_host *mmc)
1182{ 1183{
1183 struct mmc_omap_host *host = mmc_priv(mmc); 1184 struct omap_hsmmc_host *host = mmc_priv(mmc);
1184 1185
1185 if (!mmc_slot(host).get_ro) 1186 if (!mmc_slot(host).get_ro)
1186 return -ENOSYS; 1187 return -ENOSYS;
1187 return mmc_slot(host).get_ro(host->dev, 0); 1188 return mmc_slot(host).get_ro(host->dev, 0);
1188} 1189}
1189 1190
1190static void omap_hsmmc_init(struct mmc_omap_host *host) 1191static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
1191{ 1192{
1192 u32 hctl, capa, value; 1193 u32 hctl, capa, value;
1193 1194
@@ -1233,9 +1234,9 @@ static void omap_hsmmc_init(struct mmc_omap_host *host)
1233enum {ENABLED = 0, DISABLED, CARDSLEEP, REGSLEEP, OFF}; 1234enum {ENABLED = 0, DISABLED, CARDSLEEP, REGSLEEP, OFF};
1234 1235
1235/* Handler for [ENABLED -> DISABLED] transition */ 1236/* Handler for [ENABLED -> DISABLED] transition */
1236static int omap_mmc_enabled_to_disabled(struct mmc_omap_host *host) 1237static int omap_hsmmc_enabled_to_disabled(struct omap_hsmmc_host *host)
1237{ 1238{
1238 omap_mmc_save_ctx(host); 1239 omap_hsmmc_context_save(host);
1239 clk_disable(host->fclk); 1240 clk_disable(host->fclk);
1240 host->dpm_state = DISABLED; 1241 host->dpm_state = DISABLED;
1241 1242
@@ -1248,7 +1249,7 @@ static int omap_mmc_enabled_to_disabled(struct mmc_omap_host *host)
1248} 1249}
1249 1250
1250/* Handler for [DISABLED -> REGSLEEP / CARDSLEEP] transition */ 1251/* Handler for [DISABLED -> REGSLEEP / CARDSLEEP] transition */
1251static int omap_mmc_disabled_to_sleep(struct mmc_omap_host *host) 1252static int omap_hsmmc_disabled_to_sleep(struct omap_hsmmc_host *host)
1252{ 1253{
1253 int err, new_state; 1254 int err, new_state;
1254 1255
@@ -1256,7 +1257,7 @@ static int omap_mmc_disabled_to_sleep(struct mmc_omap_host *host)
1256 return 0; 1257 return 0;
1257 1258
1258 clk_enable(host->fclk); 1259 clk_enable(host->fclk);
1259 omap_mmc_restore_ctx(host); 1260 omap_hsmmc_context_restore(host);
1260 if (mmc_card_can_sleep(host->mmc)) { 1261 if (mmc_card_can_sleep(host->mmc)) {
1261 err = mmc_card_sleep(host->mmc); 1262 err = mmc_card_sleep(host->mmc);
1262 if (err < 0) { 1263 if (err < 0) {
@@ -1265,8 +1266,9 @@ static int omap_mmc_disabled_to_sleep(struct mmc_omap_host *host)
1265 return err; 1266 return err;
1266 } 1267 }
1267 new_state = CARDSLEEP; 1268 new_state = CARDSLEEP;
1268 } else 1269 } else {
1269 new_state = REGSLEEP; 1270 new_state = REGSLEEP;
1271 }
1270 if (mmc_slot(host).set_sleep) 1272 if (mmc_slot(host).set_sleep)
1271 mmc_slot(host).set_sleep(host->dev, host->slot_id, 1, 0, 1273 mmc_slot(host).set_sleep(host->dev, host->slot_id, 1, 0,
1272 new_state == CARDSLEEP); 1274 new_state == CARDSLEEP);
@@ -1289,7 +1291,7 @@ static int omap_mmc_disabled_to_sleep(struct mmc_omap_host *host)
1289} 1291}
1290 1292
1291/* Handler for [REGSLEEP / CARDSLEEP -> OFF] transition */ 1293/* Handler for [REGSLEEP / CARDSLEEP -> OFF] transition */
1292static int omap_mmc_sleep_to_off(struct mmc_omap_host *host) 1294static int omap_hsmmc_sleep_to_off(struct omap_hsmmc_host *host)
1293{ 1295{
1294 if (!mmc_try_claim_host(host->mmc)) 1296 if (!mmc_try_claim_host(host->mmc))
1295 return 0; 1297 return 0;
@@ -1317,7 +1319,7 @@ static int omap_mmc_sleep_to_off(struct mmc_omap_host *host)
1317} 1319}
1318 1320
1319/* Handler for [DISABLED -> ENABLED] transition */ 1321/* Handler for [DISABLED -> ENABLED] transition */
1320static int omap_mmc_disabled_to_enabled(struct mmc_omap_host *host) 1322static int omap_hsmmc_disabled_to_enabled(struct omap_hsmmc_host *host)
1321{ 1323{
1322 int err; 1324 int err;
1323 1325
@@ -1325,8 +1327,7 @@ static int omap_mmc_disabled_to_enabled(struct mmc_omap_host *host)
1325 if (err < 0) 1327 if (err < 0)
1326 return err; 1328 return err;
1327 1329
1328 omap_mmc_restore_ctx(host); 1330 omap_hsmmc_context_restore(host);
1329
1330 host->dpm_state = ENABLED; 1331 host->dpm_state = ENABLED;
1331 1332
1332 dev_dbg(mmc_dev(host->mmc), "DISABLED -> ENABLED\n"); 1333 dev_dbg(mmc_dev(host->mmc), "DISABLED -> ENABLED\n");
@@ -1335,13 +1336,13 @@ static int omap_mmc_disabled_to_enabled(struct mmc_omap_host *host)
1335} 1336}
1336 1337
1337/* Handler for [SLEEP -> ENABLED] transition */ 1338/* Handler for [SLEEP -> ENABLED] transition */
1338static int omap_mmc_sleep_to_enabled(struct mmc_omap_host *host) 1339static int omap_hsmmc_sleep_to_enabled(struct omap_hsmmc_host *host)
1339{ 1340{
1340 if (!mmc_try_claim_host(host->mmc)) 1341 if (!mmc_try_claim_host(host->mmc))
1341 return 0; 1342 return 0;
1342 1343
1343 clk_enable(host->fclk); 1344 clk_enable(host->fclk);
1344 omap_mmc_restore_ctx(host); 1345 omap_hsmmc_context_restore(host);
1345 if (mmc_slot(host).set_sleep) 1346 if (mmc_slot(host).set_sleep)
1346 mmc_slot(host).set_sleep(host->dev, host->slot_id, 0, 1347 mmc_slot(host).set_sleep(host->dev, host->slot_id, 0,
1347 host->vdd, host->dpm_state == CARDSLEEP); 1348 host->vdd, host->dpm_state == CARDSLEEP);
@@ -1359,12 +1360,12 @@ static int omap_mmc_sleep_to_enabled(struct mmc_omap_host *host)
1359} 1360}
1360 1361
1361/* Handler for [OFF -> ENABLED] transition */ 1362/* Handler for [OFF -> ENABLED] transition */
1362static int omap_mmc_off_to_enabled(struct mmc_omap_host *host) 1363static int omap_hsmmc_off_to_enabled(struct omap_hsmmc_host *host)
1363{ 1364{
1364 clk_enable(host->fclk); 1365 clk_enable(host->fclk);
1365 1366
1366 omap_mmc_restore_ctx(host); 1367 omap_hsmmc_context_restore(host);
1367 omap_hsmmc_init(host); 1368 omap_hsmmc_conf_bus_power(host);
1368 mmc_power_restore_host(host->mmc); 1369 mmc_power_restore_host(host->mmc);
1369 1370
1370 host->dpm_state = ENABLED; 1371 host->dpm_state = ENABLED;
@@ -1377,18 +1378,18 @@ static int omap_mmc_off_to_enabled(struct mmc_omap_host *host)
1377/* 1378/*
1378 * Bring MMC host to ENABLED from any other PM state. 1379 * Bring MMC host to ENABLED from any other PM state.
1379 */ 1380 */
1380static int omap_mmc_enable(struct mmc_host *mmc) 1381static int omap_hsmmc_enable(struct mmc_host *mmc)
1381{ 1382{
1382 struct mmc_omap_host *host = mmc_priv(mmc); 1383 struct omap_hsmmc_host *host = mmc_priv(mmc);
1383 1384
1384 switch (host->dpm_state) { 1385 switch (host->dpm_state) {
1385 case DISABLED: 1386 case DISABLED:
1386 return omap_mmc_disabled_to_enabled(host); 1387 return omap_hsmmc_disabled_to_enabled(host);
1387 case CARDSLEEP: 1388 case CARDSLEEP:
1388 case REGSLEEP: 1389 case REGSLEEP:
1389 return omap_mmc_sleep_to_enabled(host); 1390 return omap_hsmmc_sleep_to_enabled(host);
1390 case OFF: 1391 case OFF:
1391 return omap_mmc_off_to_enabled(host); 1392 return omap_hsmmc_off_to_enabled(host);
1392 default: 1393 default:
1393 dev_dbg(mmc_dev(host->mmc), "UNKNOWN state\n"); 1394 dev_dbg(mmc_dev(host->mmc), "UNKNOWN state\n");
1394 return -EINVAL; 1395 return -EINVAL;
@@ -1398,68 +1399,68 @@ static int omap_mmc_enable(struct mmc_host *mmc)
1398/* 1399/*
1399 * Bring MMC host in PM state (one level deeper). 1400 * Bring MMC host in PM state (one level deeper).
1400 */ 1401 */
1401static int omap_mmc_disable(struct mmc_host *mmc, int lazy) 1402static int omap_hsmmc_disable(struct mmc_host *mmc, int lazy)
1402{ 1403{
1403 struct mmc_omap_host *host = mmc_priv(mmc); 1404 struct omap_hsmmc_host *host = mmc_priv(mmc);
1404 1405
1405 switch (host->dpm_state) { 1406 switch (host->dpm_state) {
1406 case ENABLED: { 1407 case ENABLED: {
1407 int delay; 1408 int delay;
1408 1409
1409 delay = omap_mmc_enabled_to_disabled(host); 1410 delay = omap_hsmmc_enabled_to_disabled(host);
1410 if (lazy || delay < 0) 1411 if (lazy || delay < 0)
1411 return delay; 1412 return delay;
1412 return 0; 1413 return 0;
1413 } 1414 }
1414 case DISABLED: 1415 case DISABLED:
1415 return omap_mmc_disabled_to_sleep(host); 1416 return omap_hsmmc_disabled_to_sleep(host);
1416 case CARDSLEEP: 1417 case CARDSLEEP:
1417 case REGSLEEP: 1418 case REGSLEEP:
1418 return omap_mmc_sleep_to_off(host); 1419 return omap_hsmmc_sleep_to_off(host);
1419 default: 1420 default:
1420 dev_dbg(mmc_dev(host->mmc), "UNKNOWN state\n"); 1421 dev_dbg(mmc_dev(host->mmc), "UNKNOWN state\n");
1421 return -EINVAL; 1422 return -EINVAL;
1422 } 1423 }
1423} 1424}
1424 1425
1425static int omap_mmc_enable_fclk(struct mmc_host *mmc) 1426static int omap_hsmmc_enable_fclk(struct mmc_host *mmc)
1426{ 1427{
1427 struct mmc_omap_host *host = mmc_priv(mmc); 1428 struct omap_hsmmc_host *host = mmc_priv(mmc);
1428 int err; 1429 int err;
1429 1430
1430 err = clk_enable(host->fclk); 1431 err = clk_enable(host->fclk);
1431 if (err) 1432 if (err)
1432 return err; 1433 return err;
1433 dev_dbg(mmc_dev(host->mmc), "mmc_fclk: enabled\n"); 1434 dev_dbg(mmc_dev(host->mmc), "mmc_fclk: enabled\n");
1434 omap_mmc_restore_ctx(host); 1435 omap_hsmmc_context_restore(host);
1435 return 0; 1436 return 0;
1436} 1437}
1437 1438
1438static int omap_mmc_disable_fclk(struct mmc_host *mmc, int lazy) 1439static int omap_hsmmc_disable_fclk(struct mmc_host *mmc, int lazy)
1439{ 1440{
1440 struct mmc_omap_host *host = mmc_priv(mmc); 1441 struct omap_hsmmc_host *host = mmc_priv(mmc);
1441 1442
1442 omap_mmc_save_ctx(host); 1443 omap_hsmmc_context_save(host);
1443 clk_disable(host->fclk); 1444 clk_disable(host->fclk);
1444 dev_dbg(mmc_dev(host->mmc), "mmc_fclk: disabled\n"); 1445 dev_dbg(mmc_dev(host->mmc), "mmc_fclk: disabled\n");
1445 return 0; 1446 return 0;
1446} 1447}
1447 1448
1448static const struct mmc_host_ops mmc_omap_ops = { 1449static const struct mmc_host_ops omap_hsmmc_ops = {
1449 .enable = omap_mmc_enable_fclk, 1450 .enable = omap_hsmmc_enable_fclk,
1450 .disable = omap_mmc_disable_fclk, 1451 .disable = omap_hsmmc_disable_fclk,
1451 .request = omap_mmc_request, 1452 .request = omap_hsmmc_request,
1452 .set_ios = omap_mmc_set_ios, 1453 .set_ios = omap_hsmmc_set_ios,
1453 .get_cd = omap_hsmmc_get_cd, 1454 .get_cd = omap_hsmmc_get_cd,
1454 .get_ro = omap_hsmmc_get_ro, 1455 .get_ro = omap_hsmmc_get_ro,
1455 /* NYET -- enable_sdio_irq */ 1456 /* NYET -- enable_sdio_irq */
1456}; 1457};
1457 1458
1458static const struct mmc_host_ops mmc_omap_ps_ops = { 1459static const struct mmc_host_ops omap_hsmmc_ps_ops = {
1459 .enable = omap_mmc_enable, 1460 .enable = omap_hsmmc_enable,
1460 .disable = omap_mmc_disable, 1461 .disable = omap_hsmmc_disable,
1461 .request = omap_mmc_request, 1462 .request = omap_hsmmc_request,
1462 .set_ios = omap_mmc_set_ios, 1463 .set_ios = omap_hsmmc_set_ios,
1463 .get_cd = omap_hsmmc_get_cd, 1464 .get_cd = omap_hsmmc_get_cd,
1464 .get_ro = omap_hsmmc_get_ro, 1465 .get_ro = omap_hsmmc_get_ro,
1465 /* NYET -- enable_sdio_irq */ 1466 /* NYET -- enable_sdio_irq */
@@ -1467,15 +1468,14 @@ static const struct mmc_host_ops mmc_omap_ps_ops = {
1467 1468
1468#ifdef CONFIG_DEBUG_FS 1469#ifdef CONFIG_DEBUG_FS
1469 1470
1470static int mmc_regs_show(struct seq_file *s, void *data) 1471static int omap_hsmmc_regs_show(struct seq_file *s, void *data)
1471{ 1472{
1472 struct mmc_host *mmc = s->private; 1473 struct mmc_host *mmc = s->private;
1473 struct mmc_omap_host *host = mmc_priv(mmc); 1474 struct omap_hsmmc_host *host = mmc_priv(mmc);
1474 struct omap_mmc_platform_data *pdata = host->pdata;
1475 int context_loss = 0; 1475 int context_loss = 0;
1476 1476
1477 if (pdata->get_context_loss_count) 1477 if (host->pdata->get_context_loss_count)
1478 context_loss = pdata->get_context_loss_count(host->dev); 1478 context_loss = host->pdata->get_context_loss_count(host->dev);
1479 1479
1480 seq_printf(s, "mmc%d:\n" 1480 seq_printf(s, "mmc%d:\n"
1481 " enabled:\t%d\n" 1481 " enabled:\t%d\n"
@@ -1517,19 +1517,19 @@ static int mmc_regs_show(struct seq_file *s, void *data)
1517 return 0; 1517 return 0;
1518} 1518}
1519 1519
1520static int mmc_regs_open(struct inode *inode, struct file *file) 1520static int omap_hsmmc_regs_open(struct inode *inode, struct file *file)
1521{ 1521{
1522 return single_open(file, mmc_regs_show, inode->i_private); 1522 return single_open(file, omap_hsmmc_regs_show, inode->i_private);
1523} 1523}
1524 1524
1525static const struct file_operations mmc_regs_fops = { 1525static const struct file_operations mmc_regs_fops = {
1526 .open = mmc_regs_open, 1526 .open = omap_hsmmc_regs_open,
1527 .read = seq_read, 1527 .read = seq_read,
1528 .llseek = seq_lseek, 1528 .llseek = seq_lseek,
1529 .release = single_release, 1529 .release = single_release,
1530}; 1530};
1531 1531
1532static void omap_mmc_debugfs(struct mmc_host *mmc) 1532static void omap_hsmmc_debugfs(struct mmc_host *mmc)
1533{ 1533{
1534 if (mmc->debugfs_root) 1534 if (mmc->debugfs_root)
1535 debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root, 1535 debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root,
@@ -1538,17 +1538,17 @@ static void omap_mmc_debugfs(struct mmc_host *mmc)
1538 1538
1539#else 1539#else
1540 1540
1541static void omap_mmc_debugfs(struct mmc_host *mmc) 1541static void omap_hsmmc_debugfs(struct mmc_host *mmc)
1542{ 1542{
1543} 1543}
1544 1544
1545#endif 1545#endif
1546 1546
1547static int __init omap_mmc_probe(struct platform_device *pdev) 1547static int __init omap_hsmmc_probe(struct platform_device *pdev)
1548{ 1548{
1549 struct omap_mmc_platform_data *pdata = pdev->dev.platform_data; 1549 struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;
1550 struct mmc_host *mmc; 1550 struct mmc_host *mmc;
1551 struct mmc_omap_host *host = NULL; 1551 struct omap_hsmmc_host *host = NULL;
1552 struct resource *res; 1552 struct resource *res;
1553 int ret = 0, irq; 1553 int ret = 0, irq;
1554 1554
@@ -1572,7 +1572,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1572 if (res == NULL) 1572 if (res == NULL)
1573 return -EBUSY; 1573 return -EBUSY;
1574 1574
1575 mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); 1575 mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev);
1576 if (!mmc) { 1576 if (!mmc) {
1577 ret = -ENOMEM; 1577 ret = -ENOMEM;
1578 goto err; 1578 goto err;
@@ -1593,12 +1593,12 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1593 host->power_mode = -1; 1593 host->power_mode = -1;
1594 1594
1595 platform_set_drvdata(pdev, host); 1595 platform_set_drvdata(pdev, host);
1596 INIT_WORK(&host->mmc_carddetect_work, mmc_omap_detect); 1596 INIT_WORK(&host->mmc_carddetect_work, omap_hsmmc_detect);
1597 1597
1598 if (mmc_slot(host).power_saving) 1598 if (mmc_slot(host).power_saving)
1599 mmc->ops = &mmc_omap_ps_ops; 1599 mmc->ops = &omap_hsmmc_ps_ops;
1600 else 1600 else
1601 mmc->ops = &mmc_omap_ops; 1601 mmc->ops = &omap_hsmmc_ops;
1602 1602
1603 mmc->f_min = 400000; 1603 mmc->f_min = 400000;
1604 mmc->f_max = 52000000; 1604 mmc->f_max = 52000000;
@@ -1620,7 +1620,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1620 goto err1; 1620 goto err1;
1621 } 1621 }
1622 1622
1623 omap_mmc_save_ctx(host); 1623 omap_hsmmc_context_save(host);
1624 1624
1625 mmc->caps |= MMC_CAP_DISABLE; 1625 mmc->caps |= MMC_CAP_DISABLE;
1626 mmc_set_disable_delay(mmc, OMAP_MMC_DISABLED_TIMEOUT); 1626 mmc_set_disable_delay(mmc, OMAP_MMC_DISABLED_TIMEOUT);
@@ -1674,7 +1674,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1674 if (mmc_slot(host).nonremovable) 1674 if (mmc_slot(host).nonremovable)
1675 mmc->caps |= MMC_CAP_NONREMOVABLE; 1675 mmc->caps |= MMC_CAP_NONREMOVABLE;
1676 1676
1677 omap_hsmmc_init(host); 1677 omap_hsmmc_conf_bus_power(host);
1678 1678
1679 /* Select DMA lines */ 1679 /* Select DMA lines */
1680 switch (host->id) { 1680 switch (host->id) {
@@ -1696,7 +1696,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1696 } 1696 }
1697 1697
1698 /* Request IRQ for MMC operations */ 1698 /* Request IRQ for MMC operations */
1699 ret = request_irq(host->irq, mmc_omap_irq, IRQF_DISABLED, 1699 ret = request_irq(host->irq, omap_hsmmc_irq, IRQF_DISABLED,
1700 mmc_hostname(mmc), host); 1700 mmc_hostname(mmc), host);
1701 if (ret) { 1701 if (ret) {
1702 dev_dbg(mmc_dev(host->mmc), "Unable to grab HSMMC IRQ\n"); 1702 dev_dbg(mmc_dev(host->mmc), "Unable to grab HSMMC IRQ\n");
@@ -1706,7 +1706,8 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1706 /* initialize power supplies, gpios, etc */ 1706 /* initialize power supplies, gpios, etc */
1707 if (pdata->init != NULL) { 1707 if (pdata->init != NULL) {
1708 if (pdata->init(&pdev->dev) != 0) { 1708 if (pdata->init(&pdev->dev) != 0) {
1709 dev_dbg(mmc_dev(host->mmc), "late init error\n"); 1709 dev_dbg(mmc_dev(host->mmc),
1710 "Unable to configure MMC IRQs\n");
1710 goto err_irq_cd_init; 1711 goto err_irq_cd_init;
1711 } 1712 }
1712 } 1713 }
@@ -1715,7 +1716,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1715 /* Request IRQ for card detect */ 1716 /* Request IRQ for card detect */
1716 if ((mmc_slot(host).card_detect_irq)) { 1717 if ((mmc_slot(host).card_detect_irq)) {
1717 ret = request_irq(mmc_slot(host).card_detect_irq, 1718 ret = request_irq(mmc_slot(host).card_detect_irq,
1718 omap_mmc_cd_handler, 1719 omap_hsmmc_cd_handler,
1719 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING 1720 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
1720 | IRQF_DISABLED, 1721 | IRQF_DISABLED,
1721 mmc_hostname(mmc), host); 1722 mmc_hostname(mmc), host);
@@ -1745,7 +1746,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1745 goto err_cover_switch; 1746 goto err_cover_switch;
1746 } 1747 }
1747 1748
1748 omap_mmc_debugfs(mmc); 1749 omap_hsmmc_debugfs(mmc);
1749 1750
1750 return 0; 1751 return 0;
1751 1752
@@ -1777,9 +1778,9 @@ err:
1777 return ret; 1778 return ret;
1778} 1779}
1779 1780
1780static int omap_mmc_remove(struct platform_device *pdev) 1781static int omap_hsmmc_remove(struct platform_device *pdev)
1781{ 1782{
1782 struct mmc_omap_host *host = platform_get_drvdata(pdev); 1783 struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
1783 struct resource *res; 1784 struct resource *res;
1784 1785
1785 if (host) { 1786 if (host) {
@@ -1814,10 +1815,10 @@ static int omap_mmc_remove(struct platform_device *pdev)
1814} 1815}
1815 1816
1816#ifdef CONFIG_PM 1817#ifdef CONFIG_PM
1817static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state) 1818static int omap_hsmmc_suspend(struct platform_device *pdev, pm_message_t state)
1818{ 1819{
1819 int ret = 0; 1820 int ret = 0;
1820 struct mmc_omap_host *host = platform_get_drvdata(pdev); 1821 struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
1821 1822
1822 if (host && host->suspended) 1823 if (host && host->suspended)
1823 return 0; 1824 return 0;
@@ -1865,10 +1866,10 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
1865} 1866}
1866 1867
1867/* Routine to resume the MMC device */ 1868/* Routine to resume the MMC device */
1868static int omap_mmc_resume(struct platform_device *pdev) 1869static int omap_hsmmc_resume(struct platform_device *pdev)
1869{ 1870{
1870 int ret = 0; 1871 int ret = 0;
1871 struct mmc_omap_host *host = platform_get_drvdata(pdev); 1872 struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
1872 1873
1873 if (host && !host->suspended) 1874 if (host && !host->suspended)
1874 return 0; 1875 return 0;
@@ -1887,7 +1888,7 @@ static int omap_mmc_resume(struct platform_device *pdev)
1887 goto clk_en_err; 1888 goto clk_en_err;
1888 } 1889 }
1889 1890
1890 omap_hsmmc_init(host); 1891 omap_hsmmc_conf_bus_power(host);
1891 1892
1892 if (host->pdata->resume) { 1893 if (host->pdata->resume) {
1893 ret = host->pdata->resume(&pdev->dev, host->slot_id); 1894 ret = host->pdata->resume(&pdev->dev, host->slot_id);
@@ -1900,6 +1901,7 @@ static int omap_mmc_resume(struct platform_device *pdev)
1900 ret = mmc_resume_host(host->mmc); 1901 ret = mmc_resume_host(host->mmc);
1901 if (ret == 0) 1902 if (ret == 0)
1902 host->suspended = 0; 1903 host->suspended = 0;
1904
1903 mmc_host_lazy_disable(host->mmc); 1905 mmc_host_lazy_disable(host->mmc);
1904 } 1906 }
1905 1907
@@ -1912,34 +1914,34 @@ clk_en_err:
1912} 1914}
1913 1915
1914#else 1916#else
1915#define omap_mmc_suspend NULL 1917#define omap_hsmmc_suspend NULL
1916#define omap_mmc_resume NULL 1918#define omap_hsmmc_resume NULL
1917#endif 1919#endif
1918 1920
1919static struct platform_driver omap_mmc_driver = { 1921static struct platform_driver omap_hsmmc_driver = {
1920 .remove = omap_mmc_remove, 1922 .remove = omap_hsmmc_remove,
1921 .suspend = omap_mmc_suspend, 1923 .suspend = omap_hsmmc_suspend,
1922 .resume = omap_mmc_resume, 1924 .resume = omap_hsmmc_resume,
1923 .driver = { 1925 .driver = {
1924 .name = DRIVER_NAME, 1926 .name = DRIVER_NAME,
1925 .owner = THIS_MODULE, 1927 .owner = THIS_MODULE,
1926 }, 1928 },
1927}; 1929};
1928 1930
1929static int __init omap_mmc_init(void) 1931static int __init omap_hsmmc_init(void)
1930{ 1932{
1931 /* Register the MMC driver */ 1933 /* Register the MMC driver */
1932 return platform_driver_probe(&omap_mmc_driver, omap_mmc_probe); 1934 return platform_driver_register(&omap_hsmmc_driver);
1933} 1935}
1934 1936
1935static void __exit omap_mmc_cleanup(void) 1937static void __exit omap_hsmmc_cleanup(void)
1936{ 1938{
1937 /* Unregister MMC driver */ 1939 /* Unregister MMC driver */
1938 platform_driver_unregister(&omap_mmc_driver); 1940 platform_driver_unregister(&omap_hsmmc_driver);
1939} 1941}
1940 1942
1941module_init(omap_mmc_init); 1943module_init(omap_hsmmc_init);
1942module_exit(omap_mmc_cleanup); 1944module_exit(omap_hsmmc_cleanup);
1943 1945
1944MODULE_DESCRIPTION("OMAP High Speed Multimedia Card driver"); 1946MODULE_DESCRIPTION("OMAP High Speed Multimedia Card driver");
1945MODULE_LICENSE("GPL"); 1947MODULE_LICENSE("GPL");