]> git.sur5r.net Git - u-boot/blobdiff - drivers/cpu/bmips_cpu.c
dm: usb: Convert uclass to livetree
[u-boot] / drivers / cpu / bmips_cpu.c
index 608716309209900cbe8f0c3df2e9b1d828ace1ef..1eb744adcdcfc13be9868e195f7e013022bd60f3 100644 (file)
@@ -30,6 +30,14 @@ DECLARE_GLOBAL_DATA_PTR;
 #define STRAPBUS_6328_FCVO_SHIFT       7
 #define STRAPBUS_6328_FCVO_MASK                (0x1f << STRAPBUS_6328_FCVO_SHIFT)
 
+#define REG_BCM6348_PERF_MIPSPLLCFG    0x34
+#define MIPSPLLCFG_6348_M1CPU_SHIFT    6
+#define MIPSPLLCFG_6348_M1CPU_MASK     (0x7 << MIPSPLLCFG_6348_M1CPU_SHIFT)
+#define MIPSPLLCFG_6348_N2_SHIFT       15
+#define MIPSPLLCFG_6348_N2_MASK                (0x1F << MIPSPLLCFG_6348_N2_SHIFT)
+#define MIPSPLLCFG_6348_N1_SHIFT       20
+#define MIPSPLLCFG_6348_N1_MASK                (0x7 << MIPSPLLCFG_6348_N1_SHIFT)
+
 #define REG_BCM6358_DDR_DMIPSPLLCFG    0x12b8
 #define DMIPSPLLCFG_6358_M1_SHIFT      0
 #define DMIPSPLLCFG_6358_M1_MASK       (0xff << DMIPSPLLCFG_6358_M1_SHIFT)
@@ -88,6 +96,11 @@ static int bmips_long_cpu_desc(struct bmips_cpu_priv *priv, char *buf,
        return 0;
 }
 
+static ulong bcm3380_get_cpu_freq(struct bmips_cpu_priv *priv)
+{
+       return 333000000;
+}
+
 static ulong bcm6328_get_cpu_freq(struct bmips_cpu_priv *priv)
 {
        unsigned int mips_pll_fcvo;
@@ -115,6 +128,23 @@ static ulong bcm6328_get_cpu_freq(struct bmips_cpu_priv *priv)
        }
 }
 
+static ulong bcm6338_get_cpu_freq(struct bmips_cpu_priv *priv)
+{
+       return 240000000;
+}
+
+static ulong bcm6348_get_cpu_freq(struct bmips_cpu_priv *priv)
+{
+       unsigned int tmp, n1, n2, m1;
+
+       tmp = readl_be(priv->regs + REG_BCM6348_PERF_MIPSPLLCFG);
+       n1 = (tmp & MIPSPLLCFG_6348_N1_MASK) >> MIPSPLLCFG_6348_N1_SHIFT;
+       n2 = (tmp & MIPSPLLCFG_6348_N2_MASK) >> MIPSPLLCFG_6348_N2_SHIFT;
+       m1 = (tmp & MIPSPLLCFG_6348_M1CPU_MASK) >> MIPSPLLCFG_6348_M1CPU_SHIFT;
+
+       return (16 * 1000000 * (n1 + 1) * (n2 + 2)) / (m1 + 1);
+}
+
 static ulong bcm6358_get_cpu_freq(struct bmips_cpu_priv *priv)
 {
        unsigned int tmp, n1, n2, m1;
@@ -160,17 +190,40 @@ static int bcm6328_get_cpu_count(struct bmips_cpu_priv *priv)
                return 2;
 }
 
+static int bcm6345_get_cpu_count(struct bmips_cpu_priv *priv)
+{
+       return 1;
+}
+
 static int bcm6358_get_cpu_count(struct bmips_cpu_priv *priv)
 {
        return 2;
 }
 
+static const struct bmips_cpu_hw bmips_cpu_bcm3380 = {
+       .get_cpu_desc = bmips_short_cpu_desc,
+       .get_cpu_freq = bcm3380_get_cpu_freq,
+       .get_cpu_count = bcm6358_get_cpu_count,
+};
+
 static const struct bmips_cpu_hw bmips_cpu_bcm6328 = {
        .get_cpu_desc = bmips_long_cpu_desc,
        .get_cpu_freq = bcm6328_get_cpu_freq,
        .get_cpu_count = bcm6328_get_cpu_count,
 };
 
+static const struct bmips_cpu_hw bmips_cpu_bcm6338 = {
+       .get_cpu_desc = bmips_short_cpu_desc,
+       .get_cpu_freq = bcm6338_get_cpu_freq,
+       .get_cpu_count = bcm6345_get_cpu_count,
+};
+
+static const struct bmips_cpu_hw bmips_cpu_bcm6348 = {
+       .get_cpu_desc = bmips_short_cpu_desc,
+       .get_cpu_freq = bcm6348_get_cpu_freq,
+       .get_cpu_count = bcm6345_get_cpu_count,
+};
+
 static const struct bmips_cpu_hw bmips_cpu_bcm6358 = {
        .get_cpu_desc = bmips_short_cpu_desc,
        .get_cpu_freq = bcm6358_get_cpu_freq,
@@ -247,7 +300,7 @@ int bmips_cpu_probe(struct udevice *dev)
        fdt_addr_t addr;
        fdt_size_t size;
 
-       addr = dev_get_addr_size_index(dev_get_parent(dev), 0, &size);
+       addr = devfdt_get_addr_size_index(dev_get_parent(dev), 0, &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -259,8 +312,17 @@ int bmips_cpu_probe(struct udevice *dev)
 
 static const struct udevice_id bmips_cpu_ids[] = {
        {
+               .compatible = "brcm,bcm3380-cpu",
+               .data = (ulong)&bmips_cpu_bcm3380,
+       }, {
                .compatible = "brcm,bcm6328-cpu",
                .data = (ulong)&bmips_cpu_bcm6328,
+       }, {
+               .compatible = "brcm,bcm6338-cpu",
+               .data = (ulong)&bmips_cpu_bcm6338,
+       }, {
+               .compatible = "brcm,bcm6348-cpu",
+               .data = (ulong)&bmips_cpu_bcm6348,
        }, {
                .compatible = "brcm,bcm6358-cpu",
                .data = (ulong)&bmips_cpu_bcm6358,