aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnand Gadiyar <gadiyar@ti.com>2011-03-01 16:12:55 -0500
committerTony Lindgren <tony@atomide.com>2011-03-01 16:12:55 -0500
commite08016d0f4fcfe038a402071ada3073c6ca8d62d (patch)
treeaa768779182f9399de7c679c674d850e15bfd3d0 /arch
parentaca6ad073ea820776bf5bdb87cf82eace35042c8 (diff)
omap: mmc: split out init for 2420
The MMC controller on the OMAP2420 is different from those on the OMAP2430, OMAP3 and OMAP4 families - all of the latter are identical. The one on the OMAP2420 is closer to that on OMAP1 chips. Currently, the n8x0 is the only OMAP2420 platform supported in mainline which registers the MMC controller. Upcoming changes to register the controllers using hwmod data are potentially invasive. To reduce the risk, separate out the 2420 controller registration from the common init function and update its only user. Also seperating out mux settings for OMAP2420. Signed-off-by: Anand Gadiyar <gadiyar@ti.com> Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com> Cc: Tony Lindgren <tony@atomide.com> Cc: Madhusudhan Chikkature <madhu.cr@ti.com> Cc: Chris Ball <cjb@laptop.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c2
-rw-r--r--arch/arm/mach-omap2/devices.c88
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h4
3 files changed, 61 insertions, 33 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index b36cbd21e2d0..e710cd9e079b 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void)
536 } 536 }
537 537
538 mmc_data[0] = &mmc1_data; 538 mmc_data[0] = &mmc1_data;
539 omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); 539 omap242x_init_mmc(mmc_data);
540} 540}
541#else 541#else
542 542
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9ee876fd367a..100bb425e9c3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -650,11 +650,10 @@ err1:
650static inline void omap_hsmmc_reset(void) {} 650static inline void omap_hsmmc_reset(void) {}
651#endif 651#endif
652 652
653#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ 653#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
654 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
655 654
656static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, 655static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
657 int controller_nr) 656 *mmc_controller)
658{ 657{
659 if ((mmc_controller->slots[0].switch_pin > 0) && \ 658 if ((mmc_controller->slots[0].switch_pin > 0) && \
660 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) 659 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
@@ -665,33 +664,61 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
665 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, 664 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
666 OMAP_PIN_INPUT_PULLUP); 665 OMAP_PIN_INPUT_PULLUP);
667 666
668 if (cpu_is_omap2420() && controller_nr == 0) { 667 omap_mux_init_signal("sdmmc_cmd", 0);
669 omap_mux_init_signal("sdmmc_cmd", 0); 668 omap_mux_init_signal("sdmmc_clki", 0);
670 omap_mux_init_signal("sdmmc_clki", 0); 669 omap_mux_init_signal("sdmmc_clko", 0);
671 omap_mux_init_signal("sdmmc_clko", 0); 670 omap_mux_init_signal("sdmmc_dat0", 0);
672 omap_mux_init_signal("sdmmc_dat0", 0); 671 omap_mux_init_signal("sdmmc_dat_dir0", 0);
673 omap_mux_init_signal("sdmmc_dat_dir0", 0); 672 omap_mux_init_signal("sdmmc_cmd_dir", 0);
674 omap_mux_init_signal("sdmmc_cmd_dir", 0); 673 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
675 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) { 674 omap_mux_init_signal("sdmmc_dat1", 0);
676 omap_mux_init_signal("sdmmc_dat1", 0); 675 omap_mux_init_signal("sdmmc_dat2", 0);
677 omap_mux_init_signal("sdmmc_dat2", 0); 676 omap_mux_init_signal("sdmmc_dat3", 0);
678 omap_mux_init_signal("sdmmc_dat3", 0); 677 omap_mux_init_signal("sdmmc_dat_dir1", 0);
679 omap_mux_init_signal("sdmmc_dat_dir1", 0); 678 omap_mux_init_signal("sdmmc_dat_dir2", 0);
680 omap_mux_init_signal("sdmmc_dat_dir2", 0); 679 omap_mux_init_signal("sdmmc_dat_dir3", 0);
681 omap_mux_init_signal("sdmmc_dat_dir3", 0); 680 }
682 }
683 681
684 /* 682 /*
685 * Use internal loop-back in MMC/SDIO Module Input Clock 683 * Use internal loop-back in MMC/SDIO Module Input Clock
686 * selection 684 * selection
687 */ 685 */
688 if (mmc_controller->slots[0].internal_clock) { 686 if (mmc_controller->slots[0].internal_clock) {
689 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); 687 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
690 v |= (1 << 24); 688 v |= (1 << 24);
691 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); 689 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
692 } 690 }
691}
692
693void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
694{
695 char *name = "mmci-omap";
696
697 if (!mmc_data[0]) {
698 pr_err("%s fails: Incomplete platform data\n", __func__);
699 return;
693 } 700 }
694 701
702 omap242x_mmc_mux(mmc_data[0]);
703 omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE,
704 INT_24XX_MMC_IRQ, mmc_data[0]);
705}
706
707#endif
708
709#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
710
711static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
712 int controller_nr)
713{
714 if ((mmc_controller->slots[0].switch_pin > 0) && \
715 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
716 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
717 OMAP_PIN_INPUT_PULLUP);
718 if ((mmc_controller->slots[0].gpio_wp > 0) && \
719 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
720 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
721 OMAP_PIN_INPUT_PULLUP);
695 if (cpu_is_omap34xx()) { 722 if (cpu_is_omap34xx()) {
696 if (controller_nr == 0) { 723 if (controller_nr == 0) {
697 omap_mux_init_signal("sdmmc1_clk", 724 omap_mux_init_signal("sdmmc1_clk",
@@ -808,10 +835,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
808 continue; 835 continue;
809 } 836 }
810 837
811 if (cpu_is_omap2420()) { 838 if (cpu_is_omap44xx()) {
812 size = OMAP2420_MMC_SIZE;
813 name = "mmci-omap";
814 } else if (cpu_is_omap44xx()) {
815 if (i < 3) 839 if (i < 3)
816 irq += OMAP44XX_IRQ_GIC_START; 840 irq += OMAP44XX_IRQ_GIC_START;
817 size = OMAP4_HSMMC_SIZE; 841 size = OMAP4_HSMMC_SIZE;
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index f57f36abb07e..e5de5d452b3e 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -159,6 +159,7 @@ extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
159 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 159 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
160void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, 160void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
161 int nr_controllers); 161 int nr_controllers);
162void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
162void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, 163void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
163 int nr_controllers); 164 int nr_controllers);
164int omap_mmc_add(const char *name, int id, unsigned long base, 165int omap_mmc_add(const char *name, int id, unsigned long base,
@@ -169,6 +170,9 @@ static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
169 int nr_controllers) 170 int nr_controllers)
170{ 171{
171} 172}
173static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
174{
175}
172static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, 176static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
173 int nr_controllers) 177 int nr_controllers)
174{ 178{