mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-26 14:40:41 +00:00
mmc: rockchip_sdhci: Use set_clock and config_dll sdhci_ops
Change to configure clock and DLL in set_clock and config_dll ops instead of in the set_ios_post ops. With this change the output clock is turned off while configuring DLL parameters, according to the design recommendations. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
parent
7e74522d5f
commit
b8a63c869c
1 changed files with 15 additions and 13 deletions
|
@ -291,18 +291,24 @@ static int rk3399_sdhci_set_ios_post(struct sdhci_host *host)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rk3568_sdhci_emmc_set_clock(struct sdhci_host *host, unsigned int clock)
|
static void rk3568_sdhci_set_clock(struct sdhci_host *host, u32 div)
|
||||||
{
|
{
|
||||||
struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host);
|
struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host);
|
||||||
|
struct mmc *mmc = host->mmc;
|
||||||
|
ulong rate;
|
||||||
|
|
||||||
|
rate = clk_set_rate(&priv->emmc_clk, mmc->clock);
|
||||||
|
if (IS_ERR_VALUE(rate))
|
||||||
|
printf("%s: Set clock rate failed: %ld\n", __func__, (long)rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rk3568_sdhci_config_dll(struct sdhci_host *host, u32 clock, bool enable)
|
||||||
|
{
|
||||||
int val, ret;
|
int val, ret;
|
||||||
u32 extra;
|
u32 extra;
|
||||||
|
|
||||||
if (clock > host->max_clk)
|
if (!enable)
|
||||||
clock = host->max_clk;
|
return 0;
|
||||||
if (clock)
|
|
||||||
clk_set_rate(&priv->emmc_clk, clock);
|
|
||||||
|
|
||||||
sdhci_set_clock(host->mmc, clock);
|
|
||||||
|
|
||||||
if (clock >= 100 * MHz) {
|
if (clock >= 100 * MHz) {
|
||||||
/* reset DLL */
|
/* reset DLL */
|
||||||
|
@ -386,14 +392,8 @@ static int rk3568_sdhci_set_enhanced_strobe(struct sdhci_host *host)
|
||||||
static int rk3568_sdhci_set_ios_post(struct sdhci_host *host)
|
static int rk3568_sdhci_set_ios_post(struct sdhci_host *host)
|
||||||
{
|
{
|
||||||
struct mmc *mmc = host->mmc;
|
struct mmc *mmc = host->mmc;
|
||||||
uint clock = mmc->clock;
|
|
||||||
u32 reg, vendor_reg;
|
u32 reg, vendor_reg;
|
||||||
|
|
||||||
if (mmc->tran_speed && mmc->clock > mmc->tran_speed)
|
|
||||||
clock = mmc->tran_speed;
|
|
||||||
|
|
||||||
rk3568_sdhci_emmc_set_clock(host, clock);
|
|
||||||
|
|
||||||
if (mmc->selected_mode == MMC_HS_400 || mmc->selected_mode == MMC_HS_400_ES) {
|
if (mmc->selected_mode == MMC_HS_400 || mmc->selected_mode == MMC_HS_400_ES) {
|
||||||
reg = sdhci_readw(host, SDHCI_HOST_CONTROL2);
|
reg = sdhci_readw(host, SDHCI_HOST_CONTROL2);
|
||||||
reg &= ~SDHCI_CTRL_UHS_MASK;
|
reg &= ~SDHCI_CTRL_UHS_MASK;
|
||||||
|
@ -614,6 +614,8 @@ static const struct sdhci_data rk3399_data = {
|
||||||
static const struct sdhci_data rk3568_data = {
|
static const struct sdhci_data rk3568_data = {
|
||||||
.get_phy = rk3568_emmc_get_phy,
|
.get_phy = rk3568_emmc_get_phy,
|
||||||
.set_ios_post = rk3568_sdhci_set_ios_post,
|
.set_ios_post = rk3568_sdhci_set_ios_post,
|
||||||
|
.set_clock = rk3568_sdhci_set_clock,
|
||||||
|
.config_dll = rk3568_sdhci_config_dll,
|
||||||
.set_enhanced_strobe = rk3568_sdhci_set_enhanced_strobe,
|
.set_enhanced_strobe = rk3568_sdhci_set_enhanced_strobe,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue