• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂64abfc9b6bb3721621d5132e112ae2e91c57d8bb (tree)
時間2019-01-10 23:28:28
作者Tom Rini <trini@kons...>
CommiterTom Rini

Log Message

Merge branch 'master' of git://git.denx.de/u-boot-sunxi

Change Summary

差異

--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -19,6 +19,13 @@
1919 #include <asm/arch/mmc.h>
2020 #include <asm-generic/gpio.h>
2121
22+#ifdef CONFIG_DM_MMC
23+struct sunxi_mmc_variant {
24+ u16 gate_offset;
25+ u16 mclk_offset;
26+};
27+#endif
28+
2229 struct sunxi_mmc_plat {
2330 struct mmc_config cfg;
2431 struct mmc mmc;
@@ -32,6 +39,9 @@ struct sunxi_mmc_priv {
3239 int cd_inverted; /* Inverted Card Detect */
3340 struct sunxi_mmc *reg;
3441 struct mmc_config cfg;
42+#ifdef CONFIG_DM_MMC
43+ const struct sunxi_mmc_variant *variant;
44+#endif
3545 };
3646
3747 #if !CONFIG_IS_ENABLED(DM_MMC)
@@ -599,7 +609,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
599609 struct sunxi_mmc_priv *priv = dev_get_priv(dev);
600610 struct mmc_config *cfg = &plat->cfg;
601611 struct ofnode_phandle_args args;
602- u32 *gate_reg;
612+ u32 *gate_reg, *ccu_reg;
603613 int bus_width, ret;
604614
605615 cfg->name = dev->name;
@@ -618,21 +628,21 @@ static int sunxi_mmc_probe(struct udevice *dev)
618628 cfg->f_max = 52000000;
619629
620630 priv->reg = (void *)dev_read_addr(dev);
631+ priv->variant =
632+ (const struct sunxi_mmc_variant *)dev_get_driver_data(dev);
621633
622634 /* We don't have a sunxi clock driver so find the clock address here */
623635 ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0,
624636 1, &args);
625637 if (ret)
626638 return ret;
627- priv->mclkreg = (u32 *)ofnode_get_addr(args.node);
639+ ccu_reg = (u32 *)ofnode_get_addr(args.node);
628640
629- ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0,
630- 0, &args);
631- if (ret)
632- return ret;
633- gate_reg = (u32 *)ofnode_get_addr(args.node);
634- setbits_le32(gate_reg, 1 << args.args[0]);
635- priv->mmc_no = args.args[0] - 8;
641+ priv->mmc_no = ((uintptr_t)priv->reg - SUNXI_MMC0_BASE) / 0x1000;
642+ priv->mclkreg = (void *)ccu_reg +
643+ (priv->variant->mclk_offset + (priv->mmc_no * 4));
644+ gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
645+ setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
636646
637647 ret = mmc_set_mod_clk(priv, 24000000);
638648 if (ret)
@@ -665,11 +675,25 @@ static int sunxi_mmc_bind(struct udevice *dev)
665675 return mmc_bind(dev, &plat->mmc, &plat->cfg);
666676 }
667677
678+static const struct sunxi_mmc_variant sun4i_a10_variant = {
679+ .gate_offset = 0x60,
680+ .mclk_offset = 0x88,
681+};
682+
668683 static const struct udevice_id sunxi_mmc_ids[] = {
669- { .compatible = "allwinner,sun4i-a10-mmc" },
670- { .compatible = "allwinner,sun5i-a13-mmc" },
671- { .compatible = "allwinner,sun7i-a20-mmc" },
672- { }
684+ {
685+ .compatible = "allwinner,sun4i-a10-mmc",
686+ .data = (ulong)&sun4i_a10_variant,
687+ },
688+ {
689+ .compatible = "allwinner,sun5i-a13-mmc",
690+ .data = (ulong)&sun4i_a10_variant,
691+ },
692+ {
693+ .compatible = "allwinner,sun7i-a20-mmc",
694+ .data = (ulong)&sun4i_a10_variant,
695+ },
696+ { /* sentinel */ }
673697 };
674698
675699 U_BOOT_DRIVER(sunxi_mmc_drv) = {