ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[linux-3.10.git] / arch / arm / mach-tegra / tegra11_clocks.c
index dfda713..01746af 100644 (file)
 #include <linux/syscore_ops.h>
 #include <linux/platform_device.h>
 #include <linux/clk/tegra.h>
+#include <linux/tegra-soc.h>
+#include <linux/tegra-powergate.h>
 
 #include <asm/clkdev.h>
 
 #include <mach/edp.h>
-#include <mach/hardware.h>
 #include <mach/mc.h>
-#include <mach/powergate.h>
 
 #include "clock.h"
-#include "fuse.h"
 #include "iomap.h"
 #include "dvfs.h"
 #include "pm.h"
@@ -568,7 +567,6 @@ static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);
 static void __iomem *misc_gp_base = IO_ADDRESS(TEGRA_APB_MISC_BASE);
 static void __iomem *reg_xusb_padctl_base = IO_ADDRESS(TEGRA_XUSB_PADCTL_BASE);
 
-#define MISC_GP_HIDREV                         0x804
 #define MISC_GP_TRANSACTOR_SCRATCH_0           0x864
 #define MISC_GP_TRANSACTOR_SCRATCH_LA_ENABLE   (0x1 << 1)
 #define MISC_GP_TRANSACTOR_SCRATCH_DDS_ENABLE  (0x1 << 2)
@@ -590,8 +588,6 @@ static int tegra_periph_clk_enable_refcount[CLK_OUT_ENB_NUM * 32];
        __raw_writel(value, reg_pmc_base + (reg))
 #define pmc_readl(reg) \
        __raw_readl(reg_pmc_base + (reg))
-#define chipid_readl() \
-       __raw_readl(misc_gp_base + MISC_GP_HIDREV)
 #define xusb_padctl_writel(value, reg) \
        __raw_writel(value, reg_xusb_padctl_base + (reg))
 #define xusb_padctl_readl(reg) \
@@ -599,13 +595,15 @@ static int tegra_periph_clk_enable_refcount[CLK_OUT_ENB_NUM * 32];
 
 #define clk_writel_delay(value, reg)                                   \
        do {                                                            \
-               __raw_writel((value), reg_clk_base + (reg));    \
+               __raw_writel((value), reg_clk_base + (reg));            \
+               __raw_readl(reg_clk_base + (reg));                      \
                udelay(2);                                              \
        } while (0)
 
 #define pll_writel_delay(value, reg)                                   \
        do {                                                            \
-               __raw_writel((value), reg_clk_base + (reg));    \
+               __raw_writel((value), reg_clk_base + (reg));            \
+               __raw_readl(reg_clk_base + (reg));                      \
                udelay(1);                                              \
        } while (0)
 
@@ -864,8 +862,10 @@ static void tegra11_super_clk_init(struct clk *c)
                c->mul = 2;
                c->div = 2;
 
-               /* Make sure 7.1 divider is 1:1, clear s/w skipper control */
-               /* FIXME: set? preserve? thermal h/w skipper control */
+               /*
+                * Make sure 7.1 divider is 1:1; clear h/w skipper control -
+                * it will be enabled by soctherm later
+                */
                val = clk_readl(c->reg + SUPER_CLK_DIVIDER);
                BUG_ON(val & SUPER_CLOCK_DIV_U71_MASK);
                val = 0;
@@ -1253,7 +1253,7 @@ static int tegra11_cpu_clk_set_rate(struct clk *c, unsigned long rate)
        bool is_dfll = c->parent->parent == c->u.cpu.dynamic;
 
        /* On SILICON allow CPU rate change only if cpu regulator is connected.
-          Ignore regulator connection on FPGA and SIMULATION platforms. */
+          Ignore regulator connection on FPGA platforms. */
 #ifdef CONFIG_TEGRA_SILICON_PLATFORM
        if (c->dvfs) {
                if (!c->dvfs->dvfs_rail)
@@ -1436,8 +1436,8 @@ static int tegra11_cpu_cmplx_clk_set_parent(struct clk *c, struct clk *p)
                ret = clk_set_rate(p_source, rate);
                if (ret)
                        goto abort;
-       } else if ((p->parent->parent == dfll) || ((p->u.cpu.dynamic == dfll) &&
-                       (dfll->state != UNINITIALIZED) && use_dfll)) {
+       } else if ((p->parent->parent == dfll) ||
+                  (p->dvfs && tegra_dvfs_is_dfll_range(p->dvfs, rate))) {
                /* LP => G (DFLL selected as clock source) switch:
                 * set DFLL rate ready (DFLL is still disabled)
                 * (set target p_source as dfll, G source is already selected)
@@ -1487,23 +1487,11 @@ static int tegra11_cpu_cmplx_clk_set_parent(struct clk *c, struct clk *p)
                goto abort;
        }
 
-       /* Disabling old parent scales old mode voltage rail */
-       if (c->refcnt)
-               clk_disable(c->parent);
-       if (p_source_old) {
-               clk_disable(p->parent);
-               clk_disable(p_source_old);
-       }
-
-       clk_reparent(c, p);
-
        /*
         * Lock DFLL now (resume closed loop VDD_CPU control).
-        * G CPU operations are always resumed on DFLL if it can be used, even
-        * when autoswitch between PLL and DFLL is allowed, and resume rate is
-        * low enough to run on PLL. This makes CPU clock source ready for
-        * speedy ramp with cl_dvfs controlling volatge (and that ramp is the
-        * most likely reason for going to G CPU in the 1st place)
+        * G CPU operations are resumed on DFLL if it was the last G CPU
+        * clock source, or if resume rate is in DFLL usage range in case
+        * when auto-switch between PLL and DFLL is enabled.
         */
        if (p_source == dfll) {
                if (tegra_dvfs_rail_is_dfll_mode(tegra_cpu_rail)) {
@@ -1515,6 +1503,16 @@ static int tegra11_cpu_cmplx_clk_set_parent(struct clk *c, struct clk *p)
                }
        }
 
+       /* Disabling old parent scales old mode voltage rail */
+       if (c->refcnt)
+               clk_disable(c->parent);
+       if (p_source_old) {
+               clk_disable(p->parent);
+               clk_disable(p_source_old);
+       }
+
+       clk_reparent(c, p);
+
        tegra_dvfs_rail_mode_updating(tegra_cpu_rail, false);
        return 0;
 
@@ -1848,7 +1846,6 @@ static struct clk_ops tegra_blink_clk_ops = {
 static int tegra11_pll_clk_wait_for_lock(
        struct clk *c, u32 lock_reg, u32 lock_bits)
 {
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
 #if USE_PLL_LOCK_BITS
        int i;
        u32 val = 0;
@@ -1878,7 +1875,6 @@ static int tegra11_pll_clk_wait_for_lock(
        }
 #endif
        udelay(c->u.pll.lock_delay);
-#endif
        return 0;
 }
 
@@ -2504,9 +2500,7 @@ static void tegra11_pllcx_clk_init(struct clk *c)
         * and no enabled module clocks should use it as a source during clock
         * init.
         */
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
        BUG_ON(c->state == ON);
-#endif
        /*
         * Most of PLLCX register fields are shadowed, and can not be read
         * directly from PLL h/w. Hence, actual PLLCX boot state is unknown.
@@ -2723,9 +2717,7 @@ static void pllx_set_defaults(struct clk *c, unsigned long input_rate)
 
        /* Only s/w dyn ramp control is supported */
        val = clk_readl(PLLX_HW_CTRL_CFG);
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
        BUG_ON(!(val & PLLX_HW_CTRL_CFG_SWCTRL));
-#endif
 
        pllxc_get_dyn_steps(c, input_rate, &step_a, &step_b);
        val = step_a << PLLX_MISC2_DYNRAMP_STEPA_SHIFT;
@@ -2743,11 +2735,9 @@ static void pllx_set_defaults(struct clk *c, unsigned long input_rate)
 
        /* Check/set IDDQ */
        val = clk_readl(c->reg + PLL_MISCN(c, 3));
-       if (c->state == ON) {
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
+       if (c->state == ON)
                BUG_ON(val & PLLX_MISC3_IDDQ);
-#endif
-       } else {
+       else {
                val |= PLLX_MISC3_IDDQ;
                clk_writel(val, c->reg + PLL_MISCN(c, 3));
        }
@@ -2778,9 +2768,7 @@ static void pllc_set_defaults(struct clk *c, unsigned long input_rate)
        clk_writel(val, c->reg + PLL_MISC(c));
 
        if (c->state == ON) {
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
                BUG_ON(val & PLLC_MISC_IDDQ);
-#endif
        } else {
                val |= PLLC_MISC_IDDQ;
                clk_writel(val, c->reg + PLL_MISC(c));
@@ -2994,10 +2982,8 @@ static void pllm_set_defaults(struct clk *c, unsigned long input_rate)
 
        if (c->state != ON)
                val |= PLLM_MISC_IDDQ;
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
        else
                BUG_ON(val & PLLM_MISC_IDDQ);
-#endif
 
        clk_writel(val, c->reg + PLL_MISC(c));
 }
@@ -3161,10 +3147,8 @@ static void pllre_set_defaults(struct clk *c, unsigned long input_rate)
 
        if (c->state != ON)
                val |= PLLRE_MISC_IDDQ;
-#ifndef CONFIG_TEGRA_SIMULATION_PLATFORM
        else
                BUG_ON(val & PLLRE_MISC_IDDQ);
-#endif
 
        clk_writel(val, c->reg + PLL_MISC(c));
 }
@@ -3683,11 +3667,17 @@ static int tegra11_use_dfll_cb(const char *arg, const struct kernel_param *kp)
        unsigned long c_flags, p_flags;
        unsigned int old_use_dfll;
        struct clk *c = tegra_get_clock_by_name("cpu");
+       struct clk *dfll = tegra_get_clock_by_name("dfll_cpu");
 
-       if (!c->parent || !c->parent->dvfs)
+       if (!c->parent || !c->parent->dvfs || !dfll)
                return -ENOSYS;
 
        clk_lock_save(c, &c_flags);
+       if (dfll->state == UNINITIALIZED) {
+               pr_err("%s: DFLL is not initialized\n", __func__);
+               clk_unlock_restore(c, &c_flags);
+               return -ENOSYS;
+       }
        if (c->parent->u.cpu.mode == MODE_LP) {
                pr_err("%s: DFLL is not used on LP CPU\n", __func__);
                clk_unlock_restore(c, &c_flags);
@@ -3940,14 +3930,20 @@ static void tegra11_periph_clk_init(struct clk *c)
                c->parent = mux->input;
        } else {
                if (c->flags & PLLU) {
-                       /* for xusb_hs clock enforce PLLU source during init */
+                       /* for xusb_hs clock enforce SS div2 source */
                        val &= ~periph_clk_source_mask(c);
-                       val |= c->inputs[0].value << periph_clk_source_shift(c);
                        clk_writel_delay(val, c->reg);
                }
                c->parent = c->inputs[0].input;
        }
 
+       /* if peripheral is left under reset - enforce safe rate */
+       if (!(c->flags & PERIPH_NO_RESET) &&
+           (clk_readl(PERIPH_CLK_TO_RST_REG(c)) & PERIPH_CLK_TO_BIT(c))) {
+               tegra_periph_clk_safe_rate_init(c);
+                val = clk_readl(c->reg);
+       }
+
        if (c->flags & DIV_U71) {
                u32 divu71 = val & PERIPH_CLK_SOURCE_DIVU71_MASK;
                if (c->flags & DIV_U71_IDLE) {
@@ -4009,7 +4005,7 @@ static int tegra11_periph_clk_enable(struct clk *c)
        clk_writel_delay(PERIPH_CLK_TO_BIT(c), PERIPH_CLK_TO_ENB_SET_REG(c));
        if (!(c->flags & PERIPH_NO_RESET) && !(c->flags & PERIPH_MANUAL_RESET)) {
                if (clk_readl(PERIPH_CLK_TO_RST_REG(c)) & PERIPH_CLK_TO_BIT(c)) {
-                       udelay(5);      /* reset propagation delay */
+                       udelay(RESET_PROPAGATION_DELAY);
                        clk_writel(PERIPH_CLK_TO_BIT(c), PERIPH_CLK_TO_RST_CLR_REG(c));
                }
        }
@@ -4035,7 +4031,7 @@ static void tegra11_periph_clk_disable(struct clk *c)
                 * flush the write operation in apb bus. This will avoid the
                 * peripheral access after disabling clock*/
                if (c->flags & PERIPH_ON_APB)
-                       val = chipid_readl();
+                       val = tegra_read_chipid();
 
                clk_writel_delay(
                        PERIPH_CLK_TO_BIT(c), PERIPH_CLK_TO_ENB_CLR_REG(c));
@@ -4059,7 +4055,7 @@ static void tegra11_periph_clk_reset(struct clk *c, bool assert)
                         * will avoid the peripheral access after disabling
                         * clock */
                        if (c->flags & PERIPH_ON_APB)
-                               val = chipid_readl();
+                               val = tegra_read_chipid();
 
                        clk_writel(PERIPH_CLK_TO_BIT(c),
                                   PERIPH_CLK_TO_RST_SET_REG(c));
@@ -4195,8 +4191,154 @@ static struct clk_ops tegra_periph_clk_ops = {
        .reset                  = &tegra11_periph_clk_reset,
 };
 
+/* 1x shared bus ops */
+static long tegra11_1xbus_round_updown(struct clk *c, unsigned long rate,
+                                           bool up)
+{
+       int divider;
+       unsigned long source_rate, round_rate;
+       struct clk *new_parent;
+
+       rate = max(rate, c->min_rate);
+
+       new_parent = (rate <= c->u.periph.threshold) ?
+               c->u.periph.pll_low : c->u.periph.pll_high;
+       source_rate = clk_get_rate(new_parent);
+
+       divider = clk_div71_get_divider(source_rate, rate, c->flags,
+               up ? ROUND_DIVIDER_DOWN : ROUND_DIVIDER_UP);
+
+       if (divider < 0)
+               return c->min_rate;
+
+       round_rate = source_rate * 2 / (divider + 2);
+
+       if (round_rate > c->max_rate) {
+               divider += c->flags & DIV_U71_INT ? 2 : 1;
+#if !DIVIDER_1_5_ALLOWED
+               divider = max(2, divider);
+#endif
+               round_rate = source_rate * 2 / (divider + 2);
+       }
+
+       if (new_parent == c->u.periph.pll_high) {
+               /* Prevent oscillation across threshold */
+               if (round_rate <= c->u.periph.threshold)
+                       round_rate = c->u.periph.threshold;
+       }
+       return round_rate;
+}
+
+static long tegra11_1xbus_round_rate(struct clk *c, unsigned long rate)
+{
+       return tegra11_1xbus_round_updown(c, rate, true);
+}
+
+static int tegra11_1xbus_set_rate(struct clk *c, unsigned long rate)
+{
+       /* Compensate rate truncating during rounding */
+       return tegra11_periph_clk_set_rate(c, rate + 1);
+}
+
+static int tegra11_clk_1xbus_update(struct clk *c)
+{
+       int ret;
+       struct clk *new_parent;
+       unsigned long rate, old_rate;
+
+       if (detach_shared_bus)
+               return 0;
+
+       rate = tegra11_clk_shared_bus_update(c, NULL, NULL, NULL);
+
+       old_rate = clk_get_rate_locked(c);
+       pr_debug("\n1xbus %s: rate %lu on parent %s: new request %lu\n",
+                c->name, old_rate, c->parent->name, rate);
+       if (rate == old_rate)
+               return 0;
+
+       if (!c->u.periph.min_div_low || !c->u.periph.min_div_high) {
+               unsigned long r, m = c->max_rate;
+               r = clk_get_rate(c->u.periph.pll_low);
+               c->u.periph.min_div_low = DIV_ROUND_UP(r, m) * c->mul;
+               r = clk_get_rate(c->u.periph.pll_high);
+               c->u.periph.min_div_high = DIV_ROUND_UP(r, m) * c->mul;
+       }
+
+       new_parent = (rate <= c->u.periph.threshold) ?
+               c->u.periph.pll_low : c->u.periph.pll_high;
+
+       /*
+        * The transition procedure below is guaranteed to switch to the target
+        * parent/rate without violation of max clock limits. It would attempt
+        * to switch without dip in bus rate if it is possible, but this cannot
+        * be guaranteed (example: switch from 408 MHz : 1 to 624 MHz : 2 with
+        * maximum bus limit 408 MHz will be executed as 408 => 204 => 312 MHz,
+        * and there is no way to avoid rate dip in this case).
+        */
+       if (new_parent != c->parent) {
+               int interim_div = 0;
+               /* Switching to pll_high may over-clock bus if current divider
+                  is too small - increase divider to safe value */
+               if ((new_parent == c->u.periph.pll_high) &&
+                   (c->div < c->u.periph.min_div_high))
+                       interim_div = c->u.periph.min_div_high;
+
+               /* Switching to pll_low may dip down rate if current divider
+                  is too big - decrease divider as much as we can */
+               if ((new_parent == c->u.periph.pll_low) &&
+                   (c->div > c->u.periph.min_div_low))
+                       interim_div = c->u.periph.min_div_low;
+
+               if (interim_div) {
+                       u64 interim_rate = old_rate * c->div;
+                       do_div(interim_rate, interim_div);
+                       ret = clk_set_rate_locked(c, interim_rate);
+                       if (ret) {
+                               pr_err("Failed to set %s rate to %lu\n",
+                                      c->name, (unsigned long)interim_rate);
+                               return ret;
+                       }
+                       pr_debug("1xbus %s: rate %lu on parent %s\n", c->name,
+                                clk_get_rate_locked(c), c->parent->name);
+               }
+
+               ret = clk_set_parent_locked(c, new_parent);
+               if (ret) {
+                       pr_err("Failed to set %s parent %s\n",
+                              c->name, new_parent->name);
+                       return ret;
+               }
+
+               old_rate = clk_get_rate_locked(c);
+               pr_debug("1xbus %s: rate %lu on parent %s\n", c->name,
+                        old_rate, c->parent->name);
+               if (rate == old_rate)
+                       return 0;
+       }
+
+       ret = clk_set_rate_locked(c, rate);
+       if (ret) {
+               pr_err("Failed to set %s rate to %lu\n", c->name, rate);
+               return ret;
+       }
+       pr_debug("1xbus %s: rate %lu on parent %s\n", c->name,
+                clk_get_rate_locked(c), c->parent->name);
+       return 0;
+
+}
+
+static struct clk_ops tegra_1xbus_clk_ops = {
+       .init                   = &tegra11_periph_clk_init,
+       .enable                 = &tegra11_periph_clk_enable,
+       .disable                = &tegra11_periph_clk_disable,
+       .set_parent             = &tegra11_periph_clk_set_parent,
+       .set_rate               = &tegra11_1xbus_set_rate,
+       .round_rate             = &tegra11_1xbus_round_rate,
+       .reset                  = &tegra11_periph_clk_reset,
+       .shared_bus_update      = &tegra11_clk_1xbus_update,
+};
 
-#if !defined(CONFIG_TEGRA_SIMULATION_PLATFORM)
 /* msenc clock propagation WAR for bug 1005168 */
 static int tegra11_msenc_clk_enable(struct clk *c)
 {
@@ -4220,7 +4362,6 @@ static struct clk_ops tegra_msenc_clk_ops = {
        .round_rate             = &tegra11_periph_clk_round_rate,
        .reset                  = &tegra11_periph_clk_reset,
 };
-#endif
 /* Periph extended clock configuration ops */
 static int
 tegra11_vi_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
@@ -4719,10 +4860,14 @@ static int tegra11_clk_cbus_enable(struct clk *c)
        return 0;
 }
 
+/* select 5 steps below top rate as fine granularity region */
+#define CBUS_FINE_GRANULARITY          12000000        /* 12 MHz */
+#define CBUS_FINE_GRANULARITY_RANGE    (5 * CBUS_FINE_GRANULARITY)
+
 static long tegra11_clk_cbus_round_updown(struct clk *c, unsigned long rate,
                                          bool up)
 {
-       int i;
+       int i, n;
 
        if (!c->dvfs) {
                if (!c->min_rate)
@@ -4744,6 +4889,27 @@ static long tegra11_clk_cbus_round_updown(struct clk *c, unsigned long rate,
        }
        rate = max(rate, c->min_rate);
 
+       /* for top rates in fine granularity region don't clip to dvfs table */
+       n = c->dvfs->num_freqs;
+       if ((n >= 2) && (c->dvfs->millivolts[n-1] <= c->dvfs->max_millivolts) &&
+           (rate > c->dvfs->freqs[n-2])) {
+               unsigned long threshold = max(c->dvfs->freqs[n-1],
+                       c->dvfs->freqs[n-2] + CBUS_FINE_GRANULARITY_RANGE);
+               threshold -= CBUS_FINE_GRANULARITY_RANGE;
+
+               if (rate == threshold)
+                       return threshold;
+
+               if (rate < threshold)
+                       return up ? threshold : c->dvfs->freqs[n-2];
+
+               rate = (up ? DIV_ROUND_UP(rate, CBUS_FINE_GRANULARITY) :
+                       rate / CBUS_FINE_GRANULARITY) * CBUS_FINE_GRANULARITY;
+               rate = clamp(rate, threshold, c->dvfs->freqs[n-1]);
+               return rate;
+       }
+
+       /* clip rate to dvfs table steps */
        for (i = 0; ; i++) {
                unsigned long f = c->dvfs->freqs[i];
                int mv = c->dvfs->millivolts[i];
@@ -5084,6 +5250,7 @@ static unsigned long tegra11_clk_shared_bus_update(struct clk *bus,
        unsigned long bw = 0;
        unsigned long iso_bw = 0;
        unsigned long ceiling = bus->max_rate;
+       unsigned long ceiling_but_iso = bus->max_rate;
        u32 usage_flags = 0;
 
        list_for_each_entry(c, &bus->shared_bus_list,
@@ -5095,7 +5262,8 @@ static unsigned long tegra11_clk_shared_bus_update(struct clk *bus,
                 * bus just because ceiling is set.
                 */
                if (c->u.shared_bus_user.enabled ||
-                   (c->u.shared_bus_user.mode == SHARED_CEILING)) {
+                   (c->u.shared_bus_user.mode == SHARED_CEILING) ||
+                   (c->u.shared_bus_user.mode == SHARED_CEILING_BUT_ISO)) {
                        unsigned long request_rate = c->u.shared_bus_user.rate *
                                (c->div ? : 1);
                        usage_flags |= c->u.shared_bus_user.usage_flag;
@@ -5111,6 +5279,10 @@ static unsigned long tegra11_clk_shared_bus_update(struct clk *bus,
                                if (bw > bus->max_rate)
                                        bw = bus->max_rate;
                                break;
+                       case SHARED_CEILING_BUT_ISO:
+                               ceiling_but_iso =
+                                       min(request_rate, ceiling_but_iso);
+                               break;
                        case SHARED_CEILING:
                                ceiling = min(request_rate, ceiling);
                                break;
@@ -5142,9 +5314,10 @@ static unsigned long tegra11_clk_shared_bus_update(struct clk *bus,
 
        if (bus->flags & PERIPH_EMC_ENB)
                bw = tegra_emc_apply_efficiency(
-                       bw, iso_bw, bus->max_rate, usage_flags);
+                       bw, iso_bw, bus->max_rate, usage_flags, NULL);
 
        rate = override_rate ? : max(rate, bw);
+       ceiling = min(ceiling, ceiling_but_iso);
        ceiling = override_rate ? bus->max_rate : ceiling;
 
        if (bus_top && bus_slow && rate_cap) {
@@ -5193,7 +5366,8 @@ static void tegra_clk_shared_bus_user_init(struct clk *c)
        c->state = OFF;
        c->set = true;
 
-       if (c->u.shared_bus_user.mode == SHARED_CEILING) {
+       if ((c->u.shared_bus_user.mode == SHARED_CEILING) ||
+           (c->u.shared_bus_user.mode == SHARED_CEILING_BUT_ISO)) {
                c->state = ON;
                c->refcnt++;
        }
@@ -5700,7 +5874,7 @@ static struct clk_pll_freq_table tegra_pll_d_freq_table[] = {
        { 19200000, 216000000, 720, 16, 4, 12},
        { 26000000, 216000000, 864, 26, 4, 12},
 
-       { 12000000, 594000000,  99,  2, 1, 15},
+       { 12000000, 594000000,  99,  1, 2, 15},
        { 13000000, 594000000, 594, 13, 1, 12},
        { 16800000, 594000000, 495, 14, 1, 12},
        { 19200000, 594000000, 495, 16, 1, 12},
@@ -5885,9 +6059,6 @@ static struct clk tegra_pll_x_out0 = {
        .max_rate  = 700000000,
 };
 
-/* FIXME: remove; for now, should be always checked-in as "0" */
-#define USE_LP_CPU_TO_TEST_DFLL                0
-
 static struct clk tegra_dfll_cpu = {
        .name      = "dfll_cpu",
        .flags     = DFLL,
@@ -6156,9 +6327,6 @@ static struct clk_mux_sel mux_cclk_lp[] = {
        /* { .input = &tegra_pll_c2,    .value = 6}, - no use on tegra11x */
        /* { .input = &tegra_clk_c3,    .value = 7}, - no use on tegra11x */
        { .input = &tegra_pll_x_out0,   .value = 8},
-#if USE_LP_CPU_TO_TEST_DFLL
-       { .input = &tegra_dfll_cpu,     .value = 15},
-#endif
        { .input = &tegra_pll_x,        .value = 8 | SUPER_LP_DIV2_BYPASS},
        { 0, 0},
 };
@@ -6223,9 +6391,6 @@ static struct clk tegra_clk_virtual_cpu_lp = {
        .u.cpu = {
                .main      = &tegra_pll_x,
                .backup    = &tegra_pll_p_out4,
-#if USE_LP_CPU_TO_TEST_DFLL
-               .dynamic   = &tegra_dfll_cpu,
-#endif
                .mode      = MODE_LP,
        },
 };
@@ -6463,13 +6628,6 @@ static struct clk_mux_sel mux_clk_32k[] = {
        { 0, 0},
 };
 
-/* xusb_hs has an alternative source, that is not used - therefore, xusb_hs
-   is modeled as a single source mux */
-static struct clk_mux_sel mux_pllu_60M[] = {
-       { .input = &tegra_pll_u_60M, .value = 1},
-       { 0, 0},
-};
-
 static struct raw_notifier_head emc_rate_change_nh;
 
 static struct clk tegra_clk_emc = {
@@ -6486,6 +6644,31 @@ static struct clk tegra_clk_emc = {
        .rate_change_nh = &emc_rate_change_nh,
 };
 
+static struct raw_notifier_head host1x_rate_change_nh;
+
+static struct clk tegra_clk_host1x = {
+       .name      = "host1x",
+       .lookup    = {
+               .dev_id = "host1x",
+       },
+       .ops       = &tegra_1xbus_clk_ops,
+       .reg       = 0x180,
+       .inputs    = mux_pllm_pllc_pllp_plla,
+       .flags     = MUX | DIV_U71 | DIV_U71_INT,
+       .max_rate  = 384000000,
+       .min_rate  = 12000000,
+       .u.periph = {
+               .clk_num   = 28,
+               .pll_low = &tegra_pll_p,
+#ifdef CONFIG_TEGRA_PLLM_SCALED
+               .pll_high = &tegra_pll_c,
+#else
+               .pll_high = &tegra_pll_m,
+#endif
+       },
+       .rate_change_nh = &host1x_rate_change_nh,
+};
+
 #ifdef CONFIG_TEGRA_DUAL_CBUS
 
 static struct raw_notifier_head c2bus_rate_change_nh;
@@ -6495,7 +6678,7 @@ static struct clk tegra_clk_c2bus = {
        .name      = "c2bus",
        .parent    = &tegra_pll_c2,
        .ops       = &tegra_clk_cbus_ops,
-       .max_rate  = 700000000,
+       .max_rate  = 864000000,
        .mul       = 1,
        .div       = 1,
        .flags     = PERIPH_ON_CBUS,
@@ -6570,6 +6753,35 @@ static struct clk tegra_clk_cbus = {
 };
 #endif
 
+static void tegra11_camera_mclk_init(struct clk *c)
+{
+       c->state = OFF;
+       c->set = true;
+       c->parent = tegra_get_clock_by_name("vi_sensor");
+       c->max_rate = c->parent->max_rate;
+}
+
+static int tegra11_camera_mclk_set_rate(struct clk *c, unsigned long rate)
+{
+       return clk_set_rate(c->parent, rate);
+}
+
+static struct clk_ops tegra_camera_mclk_ops = {
+       .init     = tegra11_camera_mclk_init,
+       .enable   = tegra11_periph_clk_enable,
+       .disable  = tegra11_periph_clk_disable,
+       .set_rate = tegra11_camera_mclk_set_rate,
+};
+
+static struct clk tegra_camera_mclk = {
+       .name = "mclk",
+       .ops = &tegra_camera_mclk_ops,
+       .u.periph = {
+               .clk_num = 92, /* csus */
+       },
+       .flags = PERIPH_NO_RESET,
+};
+
 #define PERIPH_CLK(_name, _dev, _con, _clk_num, _reg, _max, _inputs, _flags) \
        {                                               \
                .name      = _name,                     \
@@ -6677,8 +6889,8 @@ struct clk tegra_list_clks[] = {
        D_AUDIO_CLK("dam0",     "tegra30-dam.0",        NULL,   108,    0x3d8,  19910000,  mux_d_audio_clk,     MUX | DIV_U71 | PERIPH_ON_APB),
        D_AUDIO_CLK("dam1",     "tegra30-dam.1",        NULL,   109,    0x3dc,  19910000,  mux_d_audio_clk,     MUX | DIV_U71 | PERIPH_ON_APB),
        D_AUDIO_CLK("dam2",     "tegra30-dam.2",        NULL,   110,    0x3e0,  19910000,  mux_d_audio_clk,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("adx",       "adx",                  NULL,   154,    0x638,  19910000,  mux_plla_pllc_pllp_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("amx",       "amx",                  NULL,   153,    0x63c,  19910000,  mux_plla_pllc_pllp_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("adx",       "adx",                  NULL,   154,    0x638,  24730000,  mux_plla_pllc_pllp_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("amx",       "amx",                  NULL,   153,    0x63c,  24730000,  mux_plla_pllc_pllp_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("hda",       "tegra30-hda",          "hda",          125,    0x428,  48000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("hda2codec_2x",      "tegra30-hda",  "hda2codec",    111,    0x3e4,  48000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("hda2hdmi",  "tegra30-hda",          "hda2hdmi",     128,    0,      48000000,  mux_clk_m,                   PERIPH_ON_APB),
@@ -6698,6 +6910,7 @@ struct clk tegra_list_clks[] = {
        PERIPH_CLK("vcp",       "tegra-avp",            "vcp",  29,     0,      250000000, mux_clk_m,                   0),
        PERIPH_CLK("bsea",      "tegra-avp",            "bsea", 62,     0,      250000000, mux_clk_m,                   0),
        PERIPH_CLK("bsev",      "tegra-aes",            "bsev", 63,     0,      250000000, mux_clk_m,                   0),
+       PERIPH_CLK("cec",       "tegra_cec",            NULL,   136,    0,      250000000, mux_clk_m,                   PERIPH_ON_APB),
        PERIPH_CLK("vde",       "vde",                  NULL,   61,     0x1c8,  600000000, mux_pllp_pllc2_c_c3_pllm_clkm,       MUX | MUX8 | DIV_U71 | DIV_U71_INT),
        PERIPH_CLK("csite",     "csite",                NULL,   73,     0x1d4,  144000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("la",        "la",                   NULL,   76,     0x1f8,  26000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
@@ -6710,25 +6923,20 @@ struct clk tegra_list_clks[] = {
        PERIPH_CLK("i2c3",      "tegra11-i2c.2",        "div-clk",      67,     0x1b8,  136000000, mux_pllp_clkm,       MUX | DIV_U16 | PERIPH_ON_APB),
        PERIPH_CLK("i2c4",      "tegra11-i2c.3",        "div-clk",      103,    0x3c4,  136000000, mux_pllp_clkm,       MUX | DIV_U16 | PERIPH_ON_APB),
        PERIPH_CLK("i2c5",      "tegra11-i2c.4",        "div-clk",      47,     0x128,  64000000,  mux_pllp_clkm,       MUX | DIV_U16 | PERIPH_ON_APB),
-       PERIPH_CLK("mipi-cal",  "mipi-cal",             NULL,   56,     0,      60000000,  mux_clk_m,   0),
+       PERIPH_CLK("mipi-cal",  "mipi-cal",             NULL,   56,     0,      60000000,  mux_clk_m,                   PERIPH_ON_APB),
        PERIPH_CLK("mipi-cal-fixed", "mipi-cal-fixed",  NULL,   0,      0,      108000000, mux_pllp_out3,       PERIPH_NO_ENB),
-       PERIPH_CLK("uarta",     "tegra_uart.0",         NULL,   6,      0x178,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
-       PERIPH_CLK("uartb",     "tegra_uart.1",         NULL,   7,      0x17c,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
-       PERIPH_CLK("uartc",     "tegra_uart.2",         NULL,   55,     0x1a0,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
-       PERIPH_CLK("uartd",     "tegra_uart.3",         NULL,   65,     0x1c0,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
+       PERIPH_CLK("uarta",     "serial-tegra.0",       NULL,   6,      0x178,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
+       PERIPH_CLK("uartb",     "serial-tegra.1",       NULL,   7,      0x17c,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
+       PERIPH_CLK("uartc",     "serial-tegra.2",       NULL,   55,     0x1a0,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
+       PERIPH_CLK("uartd",     "serial-tegra.3",       NULL,   65,     0x1c0,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
        PERIPH_CLK("uarte",     "tegra_uart.4",         NULL,   66,     0x1c4,  800000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U151 | DIV_U151_UART | PERIPH_ON_APB),
-       PERIPH_CLK("3d",        "3d",                   NULL,   24,     0x158,  700000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET),
-       PERIPH_CLK("2d",        "2d",                   NULL,   21,     0x15c,  700000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE),
+       PERIPH_CLK("3d",        "3d",                   NULL,   24,     0x158,  864000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET),
+       PERIPH_CLK("2d",        "2d",                   NULL,   21,     0x15c,  864000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE),
        PERIPH_CLK_EX("vi",     "vi",                   "vi",   20,     0x148,  425000000, mux_pllm_pllc_pllp_plla,     MUX | DIV_U71 | DIV_U71_INT, &tegra_vi_clk_ops),
-       PERIPH_CLK("vi_sensor", "vi",                   "vi_sensor",    20,     0x1a8,  150000000, mux_pllm_pllc_pllp_plla,     MUX | DIV_U71 | PERIPH_NO_RESET),
-       PERIPH_CLK("epp",       "epp",                  NULL,   19,     0x16c,  700000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT),
-#ifdef CONFIG_TEGRA_SIMULATION_PLATFORM
-       PERIPH_CLK("msenc",     "msenc",                NULL,   60,     0x170,  600000000, mux_pllm_pllc_pllp_plla,     MUX | DIV_U71 | DIV_U71_INT),
-#else
+       PERIPH_CLK("vi_sensor", NULL,                   "vi_sensor",    20,     0x1a8,  150000000, mux_pllm_pllc_pllp_plla,     MUX | DIV_U71 | PERIPH_NO_RESET),
+       PERIPH_CLK("epp",       "epp",                  NULL,   19,     0x16c,  864000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT),
        PERIPH_CLK_EX("msenc",  "msenc",                NULL,   91,     0x1f0,  600000000, mux_pllm_pllc2_c_c3_pllp_plla,       MUX | MUX8 | DIV_U71 | DIV_U71_INT, &tegra_msenc_clk_ops),
-#endif
        PERIPH_CLK("tsec",      "tsec",                 NULL,   83,     0x1f4,  600000000, mux_pllp_pllc2_c_c3_pllm_clkm,       MUX | MUX8 | DIV_U71 | DIV_U71_INT),
-       PERIPH_CLK("host1x",    "host1x",               NULL,   28,     0x180,  384000000, mux_pllm_pllc_pllp_plla,     MUX | DIV_U71 | DIV_U71_INT),
        PERIPH_CLK_EX("dtv",    "dtv",                  NULL,   79,     0x1dc,  250000000, mux_clk_m,                   PERIPH_ON_APB,  &tegra_dtv_clk_ops),
        PERIPH_CLK("hdmi",      "hdmi",                 NULL,   51,     0x18c,  297000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm,     MUX | MUX8 | DIV_U71),
        PERIPH_CLK("disp1",     "tegradc.0",            NULL,   27,     0x138,  600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm,     MUX | MUX8),
@@ -6772,6 +6980,8 @@ struct clk tegra_list_clks[] = {
        SHARED_CLK("usb1.sclk", "tegra-ehci.0",         "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
        SHARED_CLK("usb2.sclk", "tegra-ehci.1",         "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
        SHARED_CLK("usb3.sclk", "tegra-ehci.2",         "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
+       SHARED_CLK("sdmmc3.sclk",       "sdhci-tegra.2",        "sclk", &tegra_clk_sbus_cmplx,  NULL,   0,      0),
+       SHARED_CLK("sdmmc4.sclk", "sdhci-tegra.3",      "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
        SHARED_CLK("wake.sclk", "wake_sclk",            "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
        SHARED_CLK("camera.sclk",       "vi",           "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
        SHARED_CLK("mon.avp",   "tegra_actmon",         "avp",  &tegra_clk_sbus_cmplx, NULL, 0, 0),
@@ -6779,17 +6989,14 @@ struct clk tegra_list_clks[] = {
        SHARED_CLK("cap.throttle.sclk", "cap_throttle", NULL,   &tegra_clk_sbus_cmplx, NULL, 0, SHARED_CEILING),
        SHARED_CLK("floor.sclk", "floor_sclk",          NULL,   &tegra_clk_sbus_cmplx, NULL, 0, 0),
        SHARED_CLK("override.sclk", "override_sclk",    NULL,   &tegra_clk_sbus_cmplx, NULL, 0, SHARED_OVERRIDE),
-       SHARED_CLK("sbc1.sclk", "tegra11-spi.0",        "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
-       SHARED_CLK("sbc2.sclk", "tegra11-spi.1",        "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
-       SHARED_CLK("sbc3.sclk", "tegra11-spi.2",        "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
-       SHARED_CLK("sbc4.sclk", "tegra11-spi.3",        "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
-       SHARED_CLK("sbc5.sclk", "tegra11-spi.4",        "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
-       SHARED_CLK("sbc6.sclk", "tegra11-spi.5",        "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
 
        SHARED_EMC_CLK("avp.emc",       "tegra-avp",    "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
-       SHARED_EMC_CLK("cpu.emc",       "cpu",          "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
-       SHARED_EMC_CLK("disp1.emc",     "tegradc.0",    "emc",  &tegra_clk_emc, NULL, 0, SHARED_ISO_BW, BIT(EMC_USER_DC)),
-       SHARED_EMC_CLK("disp2.emc",     "tegradc.1",    "emc",  &tegra_clk_emc, NULL, 0, SHARED_ISO_BW, BIT(EMC_USER_DC)),
+       SHARED_EMC_CLK("disp1.emc", "tegradc.0",        "emc",  &tegra_clk_emc,
+                               NULL, 0, SHARED_ISO_BW, BIT(EMC_USER_DC1)),
+       SHARED_EMC_CLK("disp2.emc", "tegradc.1",        "emc",  &tegra_clk_emc,
+                               NULL, 0, SHARED_ISO_BW, BIT(EMC_USER_DC2)),
+       SHARED_EMC_CLK("mon_cpu.emc",   "tegra_mon",            "cpu_emc",
+                                               &tegra_clk_emc, NULL, 0, 0, 0),
        SHARED_EMC_CLK("hdmi.emc",      "hdmi",         "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
        SHARED_EMC_CLK("usbd.emc",      "tegra-udc.0",  "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
        SHARED_EMC_CLK("usb1.emc",      "tegra-ehci.0", "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
@@ -6802,6 +7009,7 @@ struct clk tegra_list_clks[] = {
        SHARED_EMC_CLK("2d.emc",        "tegra_gr2d",   "emc",  &tegra_clk_emc, NULL, 0, 0,             BIT(EMC_USER_2D)),
        SHARED_EMC_CLK("msenc.emc",     "tegra_msenc",  "emc",  &tegra_clk_emc, NULL, 0, SHARED_BW,     BIT(EMC_USER_MSENC)),
        SHARED_EMC_CLK("tsec.emc",      "tegra_tsec",   "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
+       SHARED_EMC_CLK("sdmmc3.emc",    "sdhci-tegra.2",        "emc",  &tegra_clk_emc, NULL,   0,      0,      0),
        SHARED_EMC_CLK("sdmmc4.emc", "sdhci-tegra.3",   "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
        SHARED_EMC_CLK("camera.emc", "vi",              "emc",  &tegra_clk_emc, NULL, 0, SHARED_ISO_BW, BIT(EMC_USER_VI)),
        SHARED_EMC_CLK("iso.emc",       "iso",          "emc",  &tegra_clk_emc, NULL, 0, 0, 0),
@@ -6809,6 +7017,7 @@ struct clk tegra_list_clks[] = {
        SHARED_EMC_CLK("override.emc", "override.emc",  NULL,   &tegra_clk_emc, NULL, 0, SHARED_OVERRIDE, 0),
        SHARED_EMC_CLK("edp.emc",       "edp.emc",      NULL,   &tegra_clk_emc, NULL, 0, SHARED_CEILING, 0),
        SHARED_EMC_CLK("battery.emc", "battery_edp",    "emc",  &tegra_clk_emc, NULL, 0, SHARED_CEILING, 0),
+       SHARED_EMC_CLK("floor.profile.emc", "profile.emc", NULL, &tegra_clk_emc, NULL,  0, 0, 0),
 
 #ifdef CONFIG_TEGRA_DUAL_CBUS
        DUAL_CBUS_CLK("3d.cbus",        "tegra_gr3d",           "gr3d", &tegra_clk_c2bus, "3d",  0, 0),
@@ -6821,6 +7030,7 @@ struct clk tegra_list_clks[] = {
        SHARED_CLK("edp.c2bus",         "edp.c2bus",            NULL,   &tegra_clk_c2bus, NULL,  0, SHARED_CEILING),
        SHARED_CLK("battery.c2bus",     "battery_edp",          "gpu",  &tegra_clk_c2bus, NULL,  0, SHARED_CEILING),
        SHARED_CLK("cap.profile.c2bus", "profile.c2bus",        NULL,   &tegra_clk_c2bus, NULL,  0, SHARED_CEILING),
+       SHARED_CLK("floor.profile.c2bus", "profile.c2bus",      NULL,   &tegra_clk_c2bus, NULL,  0, 0),
 
        DUAL_CBUS_CLK("msenc.cbus",     "tegra_msenc",          "msenc",  &tegra_clk_c3bus, "msenc", 0, 0),
        DUAL_CBUS_CLK("tsec.cbus",      "tegra_tsec",           "tsec",   &tegra_clk_c3bus, "tsec", 0, 0),
@@ -6845,7 +7055,21 @@ struct clk tegra_list_clks[] = {
        SHARED_CLK("edp.cbus",  "edp.cbus",             NULL,   &tegra_clk_cbus, NULL,  0, SHARED_CEILING),
        SHARED_CLK("battery.cbus", "battery_edp",       "gpu",  &tegra_clk_cbus, NULL,  0, SHARED_CEILING),
        SHARED_CLK("cap.profile.cbus", "profile.cbus",  NULL,   &tegra_clk_cbus, NULL,  0, SHARED_CEILING),
+       SHARED_CLK("floor.profile.cbus", "profile.cbus", NULL,  &tegra_clk_cbus, NULL,  0, 0),
 #endif
+       SHARED_CLK("nv.host1x", "tegra_host1x",         "host1x", &tegra_clk_host1x, NULL,  0, 0),
+       SHARED_CLK("vi.host1x", "tegra_vi",             "host1x", &tegra_clk_host1x, NULL,  0, 0),
+       SHARED_CLK("cap.host1x", "cap.host1x",          NULL,     &tegra_clk_host1x, NULL,  0, SHARED_CEILING),
+       SHARED_CLK("floor.host1x", "floor.host1x",      NULL,     &tegra_clk_host1x, NULL,  0, 0),
+       SHARED_CLK("override.host1x", "override.host1x", NULL,    &tegra_clk_host1x, NULL,  0, SHARED_OVERRIDE),
+       SHARED_CLK("floor.profile.host1x", "profile.host1x", NULL, &tegra_clk_host1x, NULL,  0, 0),
+
+       SHARED_CLK("sbc1.sclk", "spi_tegra.0", "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
+       SHARED_CLK("sbc2.sclk", "spi_tegra.1", "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
+       SHARED_CLK("sbc3.sclk", "spi_tegra.2", "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
+       SHARED_CLK("sbc4.sclk", "spi_tegra.3", "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
+       SHARED_CLK("sbc5.sclk", "spi_tegra.4", "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
+       SHARED_CLK("sbc6.sclk", "spi_tegra.5", "sclk", &tegra_clk_sbus_cmplx, NULL, 0, 0),
 };
 
 
@@ -6867,32 +7091,49 @@ static struct clk tegra_xusb_source_clks[] = {
        PERIPH_CLK("xusb_host_src",     XUSB_ID, "host_src",    143,    0x600,  120000000, mux_clkm_pllp_pllc_pllre,    MUX | MUX8 | DIV_U71 | DIV_U71_INT | PERIPH_NO_RESET | PERIPH_ON_APB),
        PERIPH_CLK("xusb_falcon_src",   XUSB_ID, "falcon_src",  143,    0x604,  350000000, mux_clkm_pllp_pllc_pllre,    MUX | MUX8 | DIV_U71 | DIV_U71_INT | PERIPH_NO_RESET),
        PERIPH_CLK("xusb_fs_src",       XUSB_ID, "fs_src",      143,    0x608,   48000000, mux_clkm_48M_pllp_480M,      MUX | DIV_U71 | DIV_U71_INT | PERIPH_NO_RESET),
-       PERIPH_CLK("xusb_ss_src",       XUSB_ID, "ss_src",      143,    0x610,  120000000, mux_clkm_pllre_clk32_480M_pllc_ref,  MUX | MUX8 | DIV_U71 | DIV_U71_INT | PERIPH_NO_RESET),
+       PERIPH_CLK("xusb_ss_src",       XUSB_ID, "ss_src",      143,    0x610,  122400000, mux_clkm_pllre_clk32_480M_pllc_ref,  MUX | MUX8 | DIV_U71 | DIV_U71_INT | PERIPH_NO_RESET),
        PERIPH_CLK("xusb_dev_src",      XUSB_ID, "dev_src",     95,     0x60c,  120000000, mux_clkm_pllp_pllc_pllre,    MUX | MUX8 | DIV_U71 |  DIV_U71_INT | PERIPH_NO_RESET | PERIPH_ON_APB),
-       {
-               .name      = "xusb_hs_src",
-               .lookup    = {
-                       .dev_id    = XUSB_ID,
-                       .con_id    = "hs_src",
-               },
-               .ops       = &tegra_periph_clk_ops,
-               .reg       = 0x610,
-               .inputs    = mux_pllu_60M,
-               .flags     = PLLU | PERIPH_NO_ENB,
-               .max_rate  = 60000000,
-               .u.periph = {
-                       .src_mask  = 0x1 << 25,
-                       .src_shift = 25,
-               },
-       },
        SHARED_EMC_CLK("xusb.emc",      XUSB_ID, "emc", &tegra_clk_emc, NULL,   0,      SHARED_BW, 0),
 };
 
+static struct clk tegra_xusb_ss_div2 = {
+       .name      = "xusb_ss_div2",
+       .ops       = &tegra_clk_m_div_ops,
+       .parent    = &tegra_xusb_source_clks[3],
+       .mul       = 1,
+       .div       = 2,
+       .state     = OFF,
+       .max_rate  = 61200000,
+};
+
+static struct clk_mux_sel mux_ss_div2_pllu_60M[] = {
+       { .input = &tegra_xusb_ss_div2, .value = 0},
+       { .input = &tegra_pll_u_60M,    .value = 1},
+       { 0, 0},
+};
+
+static struct clk tegra_xusb_hs_src = {
+       .name      = "xusb_hs_src",
+       .lookup    = {
+               .dev_id    = XUSB_ID,
+               .con_id    = "hs_src",
+       },
+       .ops       = &tegra_periph_clk_ops,
+       .reg       = 0x610,
+       .inputs    = mux_ss_div2_pllu_60M,
+       .flags     = PLLU | PERIPH_NO_ENB,
+       .max_rate  = 61200000,
+       .u.periph = {
+               .src_mask  = 0x1 << 25,
+               .src_shift = 25,
+       },
+};
+
 static struct clk_mux_sel mux_xusb_host[] = {
        { .input = &tegra_xusb_source_clks[0], .value = 0},
        { .input = &tegra_xusb_source_clks[1], .value = 1},
        { .input = &tegra_xusb_source_clks[2], .value = 2},
-       { .input = &tegra_xusb_source_clks[5], .value = 5},
+       { .input = &tegra_xusb_hs_src,         .value = 5},
        { 0, 0},
 };
 
@@ -6916,7 +7157,6 @@ static struct clk tegra_xusb_coupled_clks[] = {
        PERIPH_CLK_EX("xusb_dev",  XUSB_ID, "dev",  95, 0, 120000000, mux_xusb_dev,  0, &tegra_clk_coupled_gate_ops),
 };
 
-
 #define CLK_DUPLICATE(_name, _dev, _con)               \
        {                                               \
                .name   = _name,                        \
@@ -6984,8 +7224,17 @@ struct clk_duplicate tegra_clk_duplicates[] = {
        CLK_DUPLICATE("vde.cbus", "nvavp", "vde"),
        CLK_DUPLICATE("i2c5", "tegra_cl_dvfs", "i2c"),
        CLK_DUPLICATE("cpu_g", "tegra_cl_dvfs", "safe_dvfs"),
-       CLK_DUPLICATE("host1x", "tegra_host1x", "host1x"),
        CLK_DUPLICATE("epp.cbus", "tegra_isp", "epp"),
+       CLK_DUPLICATE("i2s0", NULL, "i2s0"),
+       CLK_DUPLICATE("i2s1", NULL, "i2s1"),
+       CLK_DUPLICATE("i2s2", NULL, "i2s2"),
+       CLK_DUPLICATE("i2s3", NULL, "i2s3"),
+       CLK_DUPLICATE("i2s4", NULL, "i2s4"),
+       CLK_DUPLICATE("dam0", NULL, "dam0"),
+       CLK_DUPLICATE("dam1", NULL, "dam1"),
+       CLK_DUPLICATE("dam2", NULL, "dam2"),
+       CLK_DUPLICATE("spdif_in", NULL, "spdif_in"),
+       CLK_DUPLICATE("mclk", NULL, "default_mclk"),
 };
 
 struct clk *tegra_ptr_clks[] = {
@@ -7036,6 +7285,7 @@ struct clk *tegra_ptr_clks[] = {
        &tegra_clk_cop,
        &tegra_clk_sbus_cmplx,
        &tegra_clk_emc,
+       &tegra_clk_host1x,
 #ifdef CONFIG_TEGRA_DUAL_CBUS
        &tegra_clk_c2bus,
        &tegra_clk_c3bus,
@@ -7116,16 +7366,19 @@ static void tegra11_pllp_init_dependencies(unsigned long pllp_rate)
                tegra_pll_p_out1.u.pll_div.default_rate = 28800000;
                tegra_pll_p_out3.u.pll_div.default_rate = 72000000;
                tegra_clk_sbus_cmplx.u.system.threshold = 108000000;
+               tegra_clk_host1x.u.periph.threshold = 108000000;
                break;
        case 408000000:
                tegra_pll_p_out1.u.pll_div.default_rate = 9600000;
                tegra_pll_p_out3.u.pll_div.default_rate = 102000000;
                tegra_clk_sbus_cmplx.u.system.threshold = 204000000;
+               tegra_clk_host1x.u.periph.threshold = 204000000;
                break;
        case 204000000:
                tegra_pll_p_out1.u.pll_div.default_rate = 4800000;
                tegra_pll_p_out3.u.pll_div.default_rate = 102000000;
                tegra_clk_sbus_cmplx.u.system.threshold = 204000000;
+               tegra_clk_host1x.u.periph.threshold = 204000000;
                break;
        default:
                pr_err("tegra: PLLP rate: %lu is not supported\n", pllp_rate);
@@ -7548,7 +7801,6 @@ static void tegra11_clk_resume(void)
        clk_writel(*ctx++, CPU_SOFTRST_CTRL1);
        clk_writel(*ctx++, CPU_SOFTRST_CTRL2);
 
-       /* FIXME: DFLL? */
        /* Since we are going to reset devices and switch clock sources in this
         * function, plls and secondary dividers is required to be enabled. The
         * actual value will be restored back later. Note that boot plls: pllm,
@@ -7623,6 +7875,8 @@ static void tegra11_clk_resume(void)
                off <= PERIPH_CLK_SOURCE_SOC_THERM; off += 4)
                clk_writel(*ctx++, off);
 
+       udelay(RESET_PROPAGATION_DELAY);
+
        clk_writel(*ctx++, RST_DEVICES_L);
        clk_writel(*ctx++, RST_DEVICES_H);
        clk_writel(*ctx++, RST_DEVICES_U);
@@ -7636,7 +7890,6 @@ static void tegra11_clk_resume(void)
        clk_writel(*ctx++, CLK_OUT_ENB_U);
 
        /* For LP0 resume, clk to lpcpu is required to be on */
-       /* FIXME: should be saved as on? */
        val = *ctx++;
        val |= CLK_OUT_ENB_V_CLK_ENB_CPULP_EN;
        clk_writel(val, CLK_OUT_ENB_V);
@@ -7689,21 +7942,24 @@ static void tegra11_clk_resume(void)
        p = tegra_clk_emc.parent;
        tegra11_periph_clk_init(&tegra_clk_emc);
 
+       /* Turn Off pll_m if it was OFF before suspend, and emc was not switched
+          to pll_m across suspend; re-init pll_m to sync s/w and h/w states */
+       if ((tegra_pll_m.state == OFF) &&
+           (&tegra_pll_m != tegra_clk_emc.parent))
+               tegra11_pllm_clk_disable(&tegra_pll_m);
+       tegra11_pllm_clk_init(&tegra_pll_m);
+
        if (p != tegra_clk_emc.parent) {
-               /* FIXME: old parent is left enabled here even if EMC was its
-                  only child before suspend (may happen on Tegra11 !!) */
                pr_debug("EMC parent(refcount) across suspend: %s(%d) : %s(%d)",
                        p->name, p->refcnt, tegra_clk_emc.parent->name,
                        tegra_clk_emc.parent->refcnt);
 
-               BUG_ON(!p->refcnt);
-               p->refcnt--;
-
-               /* the new parent is enabled by low level code, but ref count
-                  need to be updated up to the root */
-               p = tegra_clk_emc.parent;
-               while (p && ((p->refcnt++) == 0))
-                       p = p->parent;
+               /* emc switched to the new parent by low level code, but ref
+                  count and s/w state need to be updated */
+               clk_disable(p);
+               clk_enable(tegra_clk_emc.parent);
+               tegra_dvfs_set_rate(&tegra_clk_emc,
+                                   clk_get_rate_all_locked(&tegra_clk_emc));
        }
        tegra_emc_timing_invalidate();
 
@@ -7715,6 +7971,8 @@ static void tegra11_clk_resume(void)
 static struct syscore_ops tegra_clk_syscore_ops = {
        .suspend = tegra11_clk_suspend,
        .resume = tegra11_clk_resume,
+       .save = tegra11_clk_suspend,
+       .restore = tegra11_clk_resume,
 };
 #endif
 
@@ -7772,6 +8030,20 @@ static void __init tegra11_cpu_car_ops_init(void)
        tegra_cpu_car_ops = &tegra11_cpu_car_ops;
 }
 
+static void tegra11_init_xusb_clocks(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(tegra_xusb_source_clks); i++)
+               tegra11_init_one_clock(&tegra_xusb_source_clks[i]);
+
+       tegra11_init_one_clock(&tegra_xusb_ss_div2);
+       tegra11_init_one_clock(&tegra_xusb_hs_src);
+
+       for (i = 0; i < ARRAY_SIZE(tegra_xusb_coupled_clks); i++)
+               tegra11_init_one_clock(&tegra_xusb_coupled_clks[i]);
+}
+
 void __init tegra11x_init_clocks(void)
 {
        int i;
@@ -7783,6 +8055,8 @@ void __init tegra11x_init_clocks(void)
        for (i = 0; i < ARRAY_SIZE(tegra_list_clks); i++)
                tegra11_init_one_clock(&tegra_list_clks[i]);
 
+       tegra11_init_one_clock(&tegra_camera_mclk);
+
        for (i = 0; i < ARRAY_SIZE(tegra_sync_source_list); i++)
                tegra11_init_one_clock(&tegra_sync_source_list[i]);
        for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_list); i++)
@@ -7794,11 +8068,7 @@ void __init tegra11x_init_clocks(void)
        for (i = 0; i < ARRAY_SIZE(tegra_clk_out_list); i++)
                tegra11_init_one_clock(&tegra_clk_out_list[i]);
 
-       for (i = 0; i < ARRAY_SIZE(tegra_xusb_source_clks); i++)
-               tegra11_init_one_clock(&tegra_xusb_source_clks[i]);
-
-       for (i = 0; i < ARRAY_SIZE(tegra_xusb_coupled_clks); i++)
-               tegra11_init_one_clock(&tegra_xusb_coupled_clks[i]);
+       tegra11_init_xusb_clocks();
 
        for (i = 0; i < ARRAY_SIZE(tegra_clk_duplicates); i++) {
                c = tegra_get_clock_by_name(tegra_clk_duplicates[i].name);
@@ -7820,4 +8090,12 @@ void __init tegra11x_init_clocks(void)
 #ifdef CONFIG_PM_SLEEP
        register_syscore_ops(&tegra_clk_syscore_ops);
 #endif
+
+}
+
+static int __init tegra11x_clk_late_init(void)
+{
+       clk_disable(&tegra_pll_re_vco);
+       return 0;
 }
+late_initcall(tegra11x_clk_late_init);