diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2013-03-18 05:16:50 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-03-18 05:16:50 -0700 |
commit | bdcc859c7daf7f4e893eddb5ae057bac7e68ce22 (patch) | |
tree | cb2d2b66352b3ded90ef1be0283d7be6cbdba426 | |
parent | c371213377756a8ce392b90a9869a8a2946da5f1 (diff) | |
parent | e2ec5a406925af16922f1dd758ed73528f238f75 (diff) | |
download | lk-bdcc859c7daf7f4e893eddb5ae057bac7e68ce22.tar.gz |
Merge "msm_shared: mmc: Fix glitch during sd clock change"
-rw-r--r-- | platform/msm_shared/include/mmc.h | 5 | ||||
-rw-r--r-- | platform/msm_shared/mmc.c | 39 |
2 files changed, 42 insertions, 2 deletions
diff --git a/platform/msm_shared/include/mmc.h b/platform/msm_shared/include/mmc.h index eee414ee..43ae0577 100644 --- a/platform/msm_shared/include/mmc.h +++ b/platform/msm_shared/include/mmc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -58,6 +58,7 @@ extern unsigned int mmc_boot_mci_base; #define MMC_BOOT_MCI_CLK MMC_BOOT_MCI_REG(0x004) /* 16 bits */ /* Enable MCI bus clock - 0: clock disabled 1: enabled */ #define MMC_BOOT_MCI_CLK_ENABLE (1 << 8) +#define MMC_BOOT_MCI_CLK_DISABLE (0 << 8) /* Disable clk o/p when bus idle- 0:always enabled 1:enabled when bus active */ #define MMC_BOOT_MCI_CLK_PWRSAVE (1 << 9) /* Enable Widebus mode - 00: 1 bit mode 10:4 bit mode 01/11: 8 bit mode */ @@ -603,4 +604,6 @@ unsigned int mmc_erase_card(unsigned long long data_addr, struct mmc_boot_host *get_mmc_host(void); struct mmc_boot_card *get_mmc_card(void); void mmc_mclk_reg_wr_delay(); +void mmc_boot_mci_clk_enable(); +void mmc_boot_mci_clk_disable(); #endif diff --git a/platform/msm_shared/mmc.c b/platform/msm_shared/mmc.c index 527ba58b..8db6c113 100644 --- a/platform/msm_shared/mmc.c +++ b/platform/msm_shared/mmc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -2953,6 +2953,43 @@ struct mmc_boot_card *get_mmc_card(void) return &mmc_card; } +/* + * Disable MCI clk + */ +void mmc_boot_mci_clk_disable() +{ + uint32_t reg = 0; + + reg |= MMC_BOOT_MCI_CLK_DISABLE; + writel(reg, MMC_BOOT_MCI_CLK); + + /* Wait for the MMC_BOOT_MCI_CLK write to go through. */ + mmc_mclk_reg_wr_delay(); +} + +/* + * Enable MCI CLK + */ +void mmc_boot_mci_clk_enable() +{ + uint32_t reg = 0; + + reg |= MMC_BOOT_MCI_CLK_ENABLE; + reg |= MMC_BOOT_MCI_CLK_ENA_FLOW; + reg |= MMC_BOOT_MCI_CLK_IN_FEEDBACK; + writel(reg, MMC_BOOT_MCI_CLK); + + /* Wait for the MMC_BOOT_MCI_CLK write to go through. */ + mmc_mclk_reg_wr_delay(); + + /* Enable power save */ + reg |= MMC_BOOT_MCI_CLK_PWRSAVE; + writel(reg, MMC_BOOT_MCI_CLK); + + /* Wait for the MMC_BOOT_MCI_CLK write to go through. */ + mmc_mclk_reg_wr_delay(); +} + #if MMC_BOOT_BAM void mmc_boot_dml_init() |