mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
mmc: add hclk_mmc_peri for 3368
Signed-off-by: lintao <lintao@rock-chips.com>
This commit is contained in:
parent
ee9707a058
commit
2e12006ac4
|
|
@ -339,8 +339,8 @@ emmc: rksdmmc@ff0f0000 {
|
|||
interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
clocks = <&clk_emmc>, <&clk_gates21 2>;
|
||||
clock-names = "clk_mmc", "hclk_mmc";
|
||||
clocks = <&clk_emmc>, <&clk_gates21 2>, <&clk_gates20 10>;
|
||||
clock-names = "clk_mmc", "hclk_mmc", "hpclk_mmc";
|
||||
rockchip,grf = <&grf>;
|
||||
num-slots = <1>;
|
||||
fifo-depth = <0x100>;
|
||||
|
|
@ -357,8 +357,8 @@ sdmmc: rksdmmc@ff0c0000 {
|
|||
pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_dectn &sdmmc_bus4>;
|
||||
pinctrl-1 = <&sdmmc_gpio>;
|
||||
cd-gpios = <&gpio2 GPIO_B3 GPIO_ACTIVE_HIGH>;/*CD GPIO*/
|
||||
clocks = <&clk_sdmmc0>, <&clk_gates21 0>;
|
||||
clock-names = "clk_mmc", "hclk_mmc";
|
||||
clocks = <&clk_sdmmc0>, <&clk_gates21 0>, <&clk_gates20 10>;
|
||||
clock-names = "clk_mmc", "hclk_mmc", "hpclk_mmc";
|
||||
rockchip,grf = <&grf>;
|
||||
num-slots = <1>;
|
||||
fifo-depth = <0x100>;
|
||||
|
|
@ -374,8 +374,8 @@ sdio: rksdmmc@ff0d0000 {
|
|||
pinctrl-names = "default","idle";
|
||||
pinctrl-0 = <&sdio0_clk &sdio0_cmd &sdio0_wrprt &sdio0_pwren &sdio0_bkpwr &sdio0_int &sdio0_bus4>;
|
||||
pinctrl-1 = <&sdio0_gpio>;
|
||||
clocks = <&clk_sdio0>, <&clk_gates21 1>;
|
||||
clock-names = "clk_mmc", "hclk_mmc";
|
||||
clocks = <&clk_sdio0>, <&clk_gates21 1>, <&clk_gates20 10>;
|
||||
clock-names = "clk_mmc", "hclk_mmc", "hpclk_mmc";
|
||||
rockchip,grf = <&grf>;
|
||||
num-slots = <1>;
|
||||
fifo-depth = <0x100>;
|
||||
|
|
|
|||
|
|
@ -1522,15 +1522,21 @@ static int dw_mci_set_sdio_status(struct mmc_host *mmc, int val)
|
|||
spin_unlock_bh(&host->lock);
|
||||
|
||||
if(test_bit(DW_MMC_CARD_PRESENT, &slot->flags)){
|
||||
if(__clk_is_enabled(host->hclk_mmc) == false)
|
||||
if (!IS_ERR(host->hpclk_mmc) &&
|
||||
__clk_is_enabled(host->hpclk_mmc) == false)
|
||||
clk_prepare_enable(host->hpclk_mmc);
|
||||
if (__clk_is_enabled(host->hclk_mmc) == false)
|
||||
clk_prepare_enable(host->hclk_mmc);
|
||||
if(__clk_is_enabled(host->clk_mmc) == false)
|
||||
if (__clk_is_enabled(host->clk_mmc) == false)
|
||||
clk_prepare_enable(host->clk_mmc);
|
||||
}else{
|
||||
if(__clk_is_enabled(host->clk_mmc) == true)
|
||||
if (__clk_is_enabled(host->clk_mmc) == true)
|
||||
clk_disable_unprepare(slot->host->clk_mmc);
|
||||
if(__clk_is_enabled(host->hclk_mmc) == true)
|
||||
if (__clk_is_enabled(host->hclk_mmc) == true)
|
||||
clk_disable_unprepare(slot->host->hclk_mmc);
|
||||
if (!IS_ERR(host->hpclk_mmc) &&
|
||||
__clk_is_enabled(host->hpclk_mmc) == true)
|
||||
clk_disable_unprepare(slot->host->hpclk_mmc);
|
||||
}
|
||||
|
||||
mmc_detect_change(slot->mmc, 20);
|
||||
|
|
@ -3868,6 +3874,15 @@ int dw_mci_probe(struct dw_mci *host)
|
|||
else
|
||||
host->data_offset = DATA_240A_OFFSET;
|
||||
|
||||
//hpclk enable
|
||||
host->hpclk_mmc= devm_clk_get(host->dev, "hpclk_mmc");
|
||||
if (IS_ERR(host->hpclk_mmc)) {
|
||||
dev_err(host->dev, "failed to get hpclk_mmc\n");
|
||||
ret = PTR_ERR(host->hpclk_mmc);
|
||||
goto err_hpclk_mmc;
|
||||
}
|
||||
clk_prepare_enable(host->hpclk_mmc);
|
||||
|
||||
//hclk enable
|
||||
host->hclk_mmc= devm_clk_get(host->dev, "hclk_mmc");
|
||||
if (IS_ERR(host->hclk_mmc)) {
|
||||
|
|
@ -4063,12 +4078,14 @@ int dw_mci_probe(struct dw_mci *host)
|
|||
}
|
||||
|
||||
err_clk_mmc:
|
||||
if (!IS_ERR(host->clk_mmc))
|
||||
if (!IS_ERR(host->clk_mmc))
|
||||
clk_disable_unprepare(host->clk_mmc);
|
||||
err_hclk_mmc:
|
||||
if (!IS_ERR(host->hclk_mmc))
|
||||
if (!IS_ERR(host->hclk_mmc))
|
||||
clk_disable_unprepare(host->hclk_mmc);
|
||||
|
||||
err_hpclk_mmc:
|
||||
if (!IS_ERR(host->hpclk_mmc))
|
||||
clk_disable_unprepare(host->hpclk_mmc);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(dw_mci_probe);
|
||||
|
|
@ -4096,21 +4113,23 @@ void dw_mci_remove(struct dw_mci *host)
|
|||
if (host->mmc->restrict_caps & RESTRICT_CARD_TYPE_SD)
|
||||
unregister_pm_notifier(&host->mmc->pm_notify);
|
||||
|
||||
if(host->use_dma && host->dma_ops->exit)
|
||||
if (host->use_dma && host->dma_ops->exit)
|
||||
host->dma_ops->exit(host);
|
||||
|
||||
if (gpio_is_valid(slot->cd_gpio))
|
||||
dw_mci_of_free_cd_gpio_irq(host->dev, slot->cd_gpio, host->mmc);
|
||||
|
||||
if(host->vmmc){
|
||||
if (host->vmmc){
|
||||
regulator_disable(host->vmmc);
|
||||
regulator_put(host->vmmc);
|
||||
}
|
||||
if(!IS_ERR(host->clk_mmc))
|
||||
if (!IS_ERR(host->clk_mmc))
|
||||
clk_disable_unprepare(host->clk_mmc);
|
||||
|
||||
if(!IS_ERR(host->hclk_mmc))
|
||||
if (!IS_ERR(host->hclk_mmc))
|
||||
clk_disable_unprepare(host->hclk_mmc);
|
||||
if (!IS_ERR(host->hpclk_mmc))
|
||||
clk_disable_unprepare(host->hpclk_mmc);
|
||||
}
|
||||
EXPORT_SYMBOL(dw_mci_remove);
|
||||
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ struct dw_mci {
|
|||
struct dw_mci_board *pdata;
|
||||
const struct dw_mci_drv_data *drv_data;
|
||||
void *priv;
|
||||
struct clk *hpclk_mmc;
|
||||
struct clk *hclk_mmc;
|
||||
struct clk *clk_mmc;
|
||||
struct dw_mci_slot *slot[MAX_MCI_SLOTS];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user