On Tue, Nov 06, 2007 at 02:33:53AM -0800, akpm@linux-foundation.org wrote:
[mmotm.git] / drivers / mfd / tmio_core.c
blobf88b0639354009223e55fcddc8d8184627d40eec
1 /*
2 * Toshiba TC6393XB SoC support
4 * Copyright(c) 2009 Ian Molton <spyro@f2s.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/mfd/tmio.h>
13 static int shift;
15 int tmio_core_mmc_enable(void __iomem *cnf, unsigned long base)
17 /* Enable the MMC/SD Control registers */
18 sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
19 sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
21 /* Disable SD power during suspend */
22 sd_config_write8(cnf, shift, CNF_PWR_CTL_3, 0x01);
24 /* The below is required but why? FIXME */
25 sd_config_write8(cnf, shift, CNF_STOP_CLK_CTL, 0x1f);
27 /* Power down SD bus*/
28 sd_config_write8(cnf, shift, CNF_PWR_CTL_2, 0x00);
30 return 0;
32 EXPORT_SYMBOL(tmio_core_mmc_enable);
34 int tmio_core_mmc_resume(void __iomem *cnf, unsigned long base)
37 /* Enable the MMC/SD Control registers */
38 sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
39 sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
41 return 0;
43 EXPORT_SYMBOL(tmio_core_mmc_resume);
45 void tmio_core_mmc_pwr(void __iomem *cnf, int state)
47 sd_config_write8(cnf, shift, CNF_PWR_CTL_2, state ? 0x02 : 0x00);
49 EXPORT_SYMBOL(tmio_core_mmc_pwr);
51 void tmio_core_mmc_clk_div(void __iomem *cnf, int state)
53 sd_config_write8(cnf, shift, CNF_SD_CLK_MODE, state ? 1 : 0);
55 EXPORT_SYMBOL(tmio_core_mmc_clk_div);
57 void tmio_core_set_bus_shift(int bus_shift)
59 shift = bus_shift;
61 EXPORT_SYMBOL(tmio_core_set_bus_shift);