1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2015 Freescale Semiconductor Inc.
8 #define pr_fmt(fmt) "%s: " fmt, __func__
10 #include <linux/kernel.h>
12 #include <linux/of_address.h>
13 #include <linux/fsl/guts.h>
16 #include <asm/fsl_pm.h>
20 static struct ccsr_guts __iomem *guts;
23 static void mpc85xx_irq_mask(int cpu)
28 static void mpc85xx_irq_unmask(int cpu)
33 static void mpc85xx_cpu_die(int cpu)
37 tmp = (mfspr(SPRN_HID0) & ~(HID0_DOZE|HID0_SLEEP)) | HID0_NAP;
38 mtspr(SPRN_HID0, tmp);
51 static void mpc85xx_cpu_up_prepare(int cpu)
57 static void mpc85xx_freeze_time_base(bool freeze)
61 mask = CCSR_GUTS_DEVDISR_TB0 | CCSR_GUTS_DEVDISR_TB1;
63 setbits32(&guts->devdisr, mask);
65 clrbits32(&guts->devdisr, mask);
67 in_be32(&guts->devdisr);
70 static const struct of_device_id mpc85xx_smp_guts_ids[] = {
71 { .compatible = "fsl,mpc8572-guts", },
72 { .compatible = "fsl,p1020-guts", },
73 { .compatible = "fsl,p1021-guts", },
74 { .compatible = "fsl,p1022-guts", },
75 { .compatible = "fsl,p1023-guts", },
76 { .compatible = "fsl,p2020-guts", },
77 { .compatible = "fsl,bsc9132-guts", },
81 static const struct fsl_pm_ops mpc85xx_pm_ops = {
82 .freeze_time_base = mpc85xx_freeze_time_base,
84 .irq_mask = mpc85xx_irq_mask,
85 .irq_unmask = mpc85xx_irq_unmask,
86 .cpu_die = mpc85xx_cpu_die,
87 .cpu_up_prepare = mpc85xx_cpu_up_prepare,
91 int __init mpc85xx_setup_pmc(void)
93 struct device_node *np;
95 np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids);
97 guts = of_iomap(np, 0);
100 pr_err("Could not map guts node address\n");
103 qoriq_pm_ops = &mpc85xx_pm_ops;