Linux 2.6.34-rc3
[pohmelfs.git] / drivers / mfd / tmio_core.c
blobeddc19ae464becb8887c479945368183e328af84
1 /*
2 * Copyright(c) 2009 Ian Molton <spyro@f2s.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #include <linux/mfd/tmio.h>
11 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base)
13 /* Enable the MMC/SD Control registers */
14 sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
15 sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
17 /* Disable SD power during suspend */
18 sd_config_write8(cnf, shift, CNF_PWR_CTL_3, 0x01);
20 /* The below is required but why? FIXME */
21 sd_config_write8(cnf, shift, CNF_STOP_CLK_CTL, 0x1f);
23 /* Power down SD bus */
24 sd_config_write8(cnf, shift, CNF_PWR_CTL_2, 0x00);
26 return 0;
28 EXPORT_SYMBOL(tmio_core_mmc_enable);
30 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base)
33 /* Enable the MMC/SD Control registers */
34 sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
35 sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
37 return 0;
39 EXPORT_SYMBOL(tmio_core_mmc_resume);
41 void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state)
43 sd_config_write8(cnf, shift, CNF_PWR_CTL_2, state ? 0x02 : 0x00);
45 EXPORT_SYMBOL(tmio_core_mmc_pwr);
47 void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state)
49 sd_config_write8(cnf, shift, CNF_SD_CLK_MODE, state ? 1 : 0);
51 EXPORT_SYMBOL(tmio_core_mmc_clk_div);