rk3288: remove the shielding code of power domain
[firefly-linux-kernel-4.4.55.git] / drivers / clk / clk-gate.c
index 15114febfd923a4093c7b90b33be6e7754be27e7..790306e921c8ad55bcad26adaeb77c2b378c8db7 100644 (file)
@@ -53,12 +53,18 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable)
        if (gate->lock)
                spin_lock_irqsave(gate->lock, flags);
 
-       reg = readl(gate->reg);
-
-       if (set)
-               reg |= BIT(gate->bit_idx);
-       else
-               reg &= ~BIT(gate->bit_idx);
+       if (gate->flags & CLK_GATE_HIWORD_MASK) {
+               reg = BIT(gate->bit_idx + 16);
+               if (set)
+                       reg |= BIT(gate->bit_idx);
+       } else {
+               reg = readl(gate->reg);
+
+               if (set)
+                       reg |= BIT(gate->bit_idx);
+               else
+                       reg &= ~BIT(gate->bit_idx);
+       }
 
        writel(reg, gate->reg);
 
@@ -121,6 +127,13 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
        struct clk *clk;
        struct clk_init_data init;
 
+       if (clk_gate_flags & CLK_GATE_HIWORD_MASK) {
+               if (bit_idx > 16) {
+                       pr_err("gate bit exceeds LOWORD field\n");
+                       return ERR_PTR(-EINVAL);
+               }
+       }
+
        /* allocate the gate */
        gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL);
        if (!gate) {