mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / arch / arm / mach-integrator / core.c
blob0fe5e1dc9d891ac9b58d0dac0c8b51f50d10d49a
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * linux/arch/arm/mach-integrator/core.c
5 * Copyright (C) 2000-2003 Deep Blue Solutions Ltd
6 */
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>
20 #include <linux/io.h>
21 #include <linux/stat.h>
22 #include <linux/of.h>
23 #include <linux/of_address.h>
24 #include <linux/pgtable.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/time.h>
29 #include "hardware.h"
30 #include "cm.h"
31 #include "common.h"
33 static DEFINE_RAW_SPINLOCK(cm_lock);
34 static void __iomem *cm_base;
36 /**
37 * cm_get - get the value from the CM_CTRL register
39 u32 cm_get(void)
41 return readl(cm_base + INTEGRATOR_HDR_CTRL_OFFSET);
44 /**
45 * cm_control - update the CM_CTRL register.
46 * @mask: bits to change
47 * @set: bits to set
49 void cm_control(u32 mask, u32 set)
51 unsigned long flags;
52 u32 val;
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 +
64 IRQ_ENABLE_CLEAR);
67 static const struct of_device_id cm_match[] = {
68 { .compatible = "arm,core-module-integrator"},
69 { },
72 void cm_init(void)
74 struct device_node *cm = of_find_matching_node(NULL, cm_match);
76 if (!cm) {
77 pr_crit("no core module node found in device tree\n");
78 return;
80 cm_base = of_iomap(cm, 0);
81 if (!cm_base) {
82 pr_crit("could not remap core module\n");
83 return;
85 cm_clear_irqs();
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);