]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
HSMMC: Make loopback clock configurable
authorGrazvydas Ignotas <notasas@gmail.com>
Thu, 13 Nov 2008 21:40:04 +0000 (23:40 +0200)
committerTony Lindgren <tony@atomide.com>
Thu, 13 Nov 2008 23:06:42 +0000 (15:06 -0800)
Some boards use input clock from external pin for MMC/SDIO
modules in OMAP chips. Make that option selectable instead of
forcing loop back clock on everyone.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/mmc-twl4030.c
arch/arm/mach-omap2/mmc-twl4030.h

index b1fe0f344711419009098d7043fab6247def306a..0ea6ba6b8671646715976c59a76588af815ef832 100644 (file)
@@ -250,8 +250,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
                        omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
                }
 
-               /* REVISIT: Loop back clock not needed for 2430? */
-               if (!cpu_is_omap2430()) {
+               if (c->mmc->slots[0].internal_clock) {
                        reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
                        reg |= OMAP2_MMCSDIO1ADPCLKISEL;
                        omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
@@ -298,11 +297,13 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vd
        struct twl_mmc_controller *c = &hsmmc[1];
 
        if (power_on) {
-               u32 reg;
+               if (c->mmc->slots[0].internal_clock) {
+                       u32 reg;
 
-               reg = omap_ctrl_readl(control_devconf1_offset);
-               reg |= OMAP2_MMCSDIO2ADPCLKISEL;
-               omap_ctrl_writel(reg, control_devconf1_offset);
+                       reg = omap_ctrl_readl(control_devconf1_offset);
+                       reg |= OMAP2_MMCSDIO2ADPCLKISEL;
+                       omap_ctrl_writel(reg, control_devconf1_offset);
+               }
                ret = twl_mmc_set_voltage(c, vdd);
        } else {
                ret = twl_mmc_set_voltage(c, 0);
@@ -354,6 +355,7 @@ void __init hsmmc_init(struct twl4030_hsmmc_info *controllers)
                                        MMC_VDD_29_30 |
                                        MMC_VDD_30_31 | MMC_VDD_31_32;
                mmc->slots[0].wires = c->wires;
+               mmc->slots[0].internal_clock = !c->ext_clock;
                mmc->dma_mask = 0xffffffff;
 
                /* note: twl4030 card detect GPIOs normally switch VMMCx ... */
index a2e60fed79827c2413bcc9a7d527a8ee6d8a1497..e2d58a28f248864c033ab71faf8b6cc46ada4916 100644 (file)
@@ -11,6 +11,7 @@ struct twl4030_hsmmc_info {
        u8      wires;          /* 1/4/8 wires */
        int     gpio_cd;        /* or -EINVAL */
        int     gpio_wp;        /* or -EINVAL */
+       int     ext_clock:1;    /* use external pin for input clock */
 };
 
 #if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \