• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/mfd/
1/*
2 * Copyright(c) 2009 Ian Molton <spyro@f2s.com>
3 *
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 */
8
9#include <linux/mfd/tmio.h>
10
11int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base)
12{
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);
16
17	/* Disable SD power during suspend */
18	sd_config_write8(cnf, shift, CNF_PWR_CTL_3, 0x01);
19
20	sd_config_write8(cnf, shift, CNF_STOP_CLK_CTL, 0x1f);
21
22	/* Power down SD bus */
23	sd_config_write8(cnf, shift, CNF_PWR_CTL_2, 0x00);
24
25	return 0;
26}
27EXPORT_SYMBOL(tmio_core_mmc_enable);
28
29int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base)
30{
31
32	/* Enable the MMC/SD Control registers */
33	sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
34	sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
35
36	return 0;
37}
38EXPORT_SYMBOL(tmio_core_mmc_resume);
39
40void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state)
41{
42	sd_config_write8(cnf, shift, CNF_PWR_CTL_2, state ? 0x02 : 0x00);
43}
44EXPORT_SYMBOL(tmio_core_mmc_pwr);
45
46void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state)
47{
48	sd_config_write8(cnf, shift, CNF_SD_CLK_MODE, state ? 1 : 0);
49}
50EXPORT_SYMBOL(tmio_core_mmc_clk_div);
51