Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-hisi / hotplug.c
index 84e6919f68c7316f3b866a0ba61087066eaa111d..a129aae7260286fcaf77bc110bce3dea71fb679e 100644 (file)
@@ -65,6 +65,9 @@
 #define PMC0_CPU1_PMC_ENABLE           (1 << 7)
 #define PMC0_CPU1_POWERDOWN            (1 << 3)
 
+#define HIP01_PERI9                    0x50
+#define PERI9_CPU1_RESET               (1 << 1)
+
 enum {
        HI3620_CTRL,
        ERROR_CTRL,
@@ -209,6 +212,34 @@ void hix5hd2_set_cpu(int cpu, bool enable)
        }
 }
 
+void hip01_set_cpu(int cpu, bool enable)
+{
+       unsigned int temp;
+       struct device_node *np;
+
+       if (!ctrl_base) {
+               np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
+               if (np)
+                       ctrl_base = of_iomap(np, 0);
+               else
+                       BUG();
+       }
+
+       if (enable) {
+               /* reset on CPU1  */
+               temp = readl_relaxed(ctrl_base + HIP01_PERI9);
+               temp |= PERI9_CPU1_RESET;
+               writel_relaxed(temp, ctrl_base + HIP01_PERI9);
+
+               udelay(50);
+
+               /* unreset on CPU1 */
+               temp = readl_relaxed(ctrl_base + HIP01_PERI9);
+               temp &= ~PERI9_CPU1_RESET;
+               writel_relaxed(temp, ctrl_base + HIP01_PERI9);
+       }
+}
+
 static inline void cpu_enter_lowpower(void)
 {
        unsigned int v;