Linux 4.1.16
[linux/fpc-iii.git] / drivers / mfd / tmio_core.c
blob83af78c1b0ebede74c588e6913e62a6f321dfb59
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/export.h>
10 #include <linux/mfd/tmio.h>
12 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base)
14 /* Enable the MMC/SD Control registers */
15 sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
16 sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
18 /* Disable SD power during suspend */
19 sd_config_write8(cnf, shift, CNF_PWR_CTL_3, 0x01);
21 /* The below is required but why? FIXME */
22 sd_config_write8(cnf, shift, CNF_STOP_CLK_CTL, 0x1f);
24 /* Power down SD bus */
25 sd_config_write8(cnf, shift, CNF_PWR_CTL_2, 0x00);
27 return 0;
29 EXPORT_SYMBOL(tmio_core_mmc_enable);
31 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base)
34 /* Enable the MMC/SD Control registers */
35 sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
36 sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
38 return 0;
40 EXPORT_SYMBOL(tmio_core_mmc_resume);
42 void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state)
44 sd_config_write8(cnf, shift, CNF_PWR_CTL_2, state ? 0x02 : 0x00);
46 EXPORT_SYMBOL(tmio_core_mmc_pwr);
48 void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state)
50 sd_config_write8(cnf, shift, CNF_SD_CLK_MODE, state ? 1 : 0);
52 EXPORT_SYMBOL(tmio_core_mmc_clk_div);