1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-integrator/core.c
5 * Copyright (C) 2000-2003 Deep Blue Solutions Ltd
7 #include <linux/types.h>
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/device.h>
11 #include <linux/export.h>
12 #include <linux/spinlock.h>
13 #include <linux/interrupt.h>
14 #include <linux/irq.h>
15 #include <linux/memblock.h>
16 #include <linux/sched.h>
17 #include <linux/smp.h>
18 #include <linux/amba/bus.h>
19 #include <linux/amba/serial.h>
21 #include <linux/stat.h>
23 #include <linux/of_address.h>
24 #include <linux/pgtable.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/time.h>
33 static DEFINE_RAW_SPINLOCK(cm_lock
);
34 static void __iomem
*cm_base
;
37 * cm_get - get the value from the CM_CTRL register
41 return readl(cm_base
+ INTEGRATOR_HDR_CTRL_OFFSET
);
45 * cm_control - update the CM_CTRL register.
46 * @mask: bits to change
49 void cm_control(u32 mask
, u32 set
)
54 raw_spin_lock_irqsave(&cm_lock
, flags
);
55 val
= readl(cm_base
+ INTEGRATOR_HDR_CTRL_OFFSET
) & ~mask
;
56 writel(val
| set
, cm_base
+ INTEGRATOR_HDR_CTRL_OFFSET
);
57 raw_spin_unlock_irqrestore(&cm_lock
, flags
);
60 void cm_clear_irqs(void)
62 /* disable core module IRQs */
63 writel(0xffffffffU
, cm_base
+ INTEGRATOR_HDR_IC_OFFSET
+
67 static const struct of_device_id cm_match
[] = {
68 { .compatible
= "arm,core-module-integrator"},
74 struct device_node
*cm
= of_find_matching_node(NULL
, cm_match
);
77 pr_crit("no core module node found in device tree\n");
80 cm_base
= of_iomap(cm
, 0);
82 pr_crit("could not remap core module\n");
89 * We need to stop things allocating the low memory; ideally we need a
90 * better implementation of GFP_DMA which does not assume that DMA-able
91 * memory starts at zero.
93 void __init
integrator_reserve(void)
95 memblock_reserve(PHYS_OFFSET
, __pa(swapper_pg_dir
) - PHYS_OFFSET
);