2 * linux/arch/arm/mach-integrator/core.c
4 * Copyright (C) 2000-2003 Deep Blue Solutions Ltd
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/device.h>
14 #include <linux/spinlock.h>
16 #include <asm/hardware.h>
19 #include <asm/hardware/amba.h>
20 #include <asm/arch/cm.h>
22 static struct amba_device rtc_device = {
27 .start = INTEGRATOR_RTC_BASE,
28 .end = INTEGRATOR_RTC_BASE + SZ_4K - 1,
29 .flags = IORESOURCE_MEM,
31 .irq = { IRQ_RTCINT, NO_IRQ },
32 .periphid = 0x00041030,
35 static struct amba_device uart0_device = {
40 .start = INTEGRATOR_UART0_BASE,
41 .end = INTEGRATOR_UART0_BASE + SZ_4K - 1,
42 .flags = IORESOURCE_MEM,
44 .irq = { IRQ_UARTINT0, NO_IRQ },
45 .periphid = 0x0041010,
48 static struct amba_device uart1_device = {
53 .start = INTEGRATOR_UART1_BASE,
54 .end = INTEGRATOR_UART1_BASE + SZ_4K - 1,
55 .flags = IORESOURCE_MEM,
57 .irq = { IRQ_UARTINT1, NO_IRQ },
58 .periphid = 0x0041010,
61 static struct amba_device kmi0_device = {
67 .end = KMI0_BASE + SZ_4K - 1,
68 .flags = IORESOURCE_MEM,
70 .irq = { IRQ_KMIINT0, NO_IRQ },
71 .periphid = 0x00041050,
74 static struct amba_device kmi1_device = {
80 .end = KMI1_BASE + SZ_4K - 1,
81 .flags = IORESOURCE_MEM,
83 .irq = { IRQ_KMIINT1, NO_IRQ },
84 .periphid = 0x00041050,
87 static struct amba_device *amba_devs[] __initdata = {
95 static int __init integrator_init(void)
99 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
100 struct amba_device *d = amba_devs[i];
101 amba_device_register(d, &iomem_resource);
107 arch_initcall(integrator_init);
109 #define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
111 static spinlock_t cm_lock;
114 * cm_control - update the CM_CTRL register.
115 * @mask: bits to change
118 void cm_control(u32 mask, u32 set)
123 spin_lock_irqsave(&cm_lock, flags);
124 val = readl(CM_CTRL) & ~mask;
125 writel(val | set, CM_CTRL);
126 spin_unlock_irqrestore(&cm_lock, flags);
129 EXPORT_SYMBOL(cm_control);