core.c 3.4 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8
/*
 *  linux/arch/arm/mach-shark/arch.c
 *
 *  Architecture specific stuff.
 */
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
9
#include <linux/irq.h>
L
Linus Torvalds 已提交
10 11
#include <linux/sched.h>
#include <linux/serial_8250.h>
12
#include <linux/io.h>
L
Linus Torvalds 已提交
13 14 15 16 17 18 19 20 21 22

#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/leds.h>
#include <asm/param.h>

#include <asm/mach/map.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>

23 24 25 26 27 28
#define IO_BASE                 0xe0000000
#define IO_SIZE                 0x08000000
#define IO_START                0x40000000
#define ROMCARD_SIZE            0x08000000
#define ROMCARD_START           0x10000000

29
void arch_reset(char mode, const char *cmd)
30 31 32 33 34 35 36 37 38 39
{
        short temp;
        /* Reset the Machine via pc[3] of the sequoia chipset */
        outw(0x09,0x24);
        temp=inw(0x26);
        temp = temp | (1<<3) | (1<<10);
        outw(0x09,0x24);
        outw(temp,0x26);
}

L
Linus Torvalds 已提交
40 41 42 43 44
static struct plat_serial8250_port serial_platform_data[] = {
	{
		.iobase		= 0x3f8,
		.irq		= 4,
		.uartclk	= 1843200,
45
		.regshift	= 0,
L
Linus Torvalds 已提交
46 47 48 49 50 51 52
		.iotype		= UPIO_PORT,
		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
	},
	{
		.iobase		= 0x2f8,
		.irq		= 3,
		.uartclk	= 1843200,
53
		.regshift	= 0,
L
Linus Torvalds 已提交
54 55 56 57 58 59 60 61
		.iotype		= UPIO_PORT,
		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
	},
	{ },
};

static struct platform_device serial_device = {
	.name			= "serial8250",
62
	.id			= PLAT8250_DEV_PLATFORM,
L
Linus Torvalds 已提交
63 64 65 66 67
	.dev			= {
		.platform_data	= serial_platform_data,
	},
};

68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
static struct resource rtc_resources[] = {
	[0] = {
		.start	= 0x70,
		.end	= 0x73,
		.flags	= IORESOURCE_IO,
	},
	[1] = {
		.start	= IRQ_ISA_RTC_ALARM,
		.end	= IRQ_ISA_RTC_ALARM,
		.flags	= IORESOURCE_IRQ,
	}
};

static struct platform_device rtc_device = {
	.name		= "rtc_cmos",
	.id		= -1,
	.resource	= rtc_resources,
	.num_resources	= ARRAY_SIZE(rtc_resources),
};

L
Linus Torvalds 已提交
88 89 90 91 92
static int __init shark_init(void)
{
	int ret;

	if (machine_is_shark())
93 94 95
	{
	        ret = platform_device_register(&rtc_device);
		if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
L
Linus Torvalds 已提交
96
		ret = platform_device_register(&serial_device);
97 98 99
		if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
	}
	return 0;
L
Linus Torvalds 已提交
100 101 102 103 104 105 106
}

arch_initcall(shark_init);

extern void shark_init_irq(void);

static struct map_desc shark_io_desc[] __initdata = {
107 108 109 110 111 112
	{
		.virtual	= IO_BASE,
		.pfn		= __phys_to_pfn(IO_START),
		.length		= IO_SIZE,
		.type		= MT_DEVICE
	}
L
Linus Torvalds 已提交
113 114 115 116 117 118 119 120 121 122 123
};

static void __init shark_map_io(void)
{
	iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
}

#define IRQ_TIMER 0
#define HZ_TIME ((1193180 + HZ/2) / HZ)

static irqreturn_t
124
shark_timer_interrupt(int irq, void *dev_id)
L
Linus Torvalds 已提交
125
{
126
	timer_tick();
L
Linus Torvalds 已提交
127 128 129 130 131
	return IRQ_HANDLED;
}

static struct irqaction shark_timer_irq = {
	.name		= "Shark Timer Tick",
B
Bernhard Walle 已提交
132
	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
133
	.handler	= shark_timer_interrupt,
L
Linus Torvalds 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
};

/*
 * Set up timer interrupt, and return the current time in seconds.
 */
static void __init shark_timer_init(void)
{
	outb(0x34, 0x43);               /* binary, mode 0, LSB/MSB, Ch 0 */
	outb(HZ_TIME & 0xff, 0x40);     /* LSB of count */
	outb(HZ_TIME >> 8, 0x40);

	setup_irq(IRQ_TIMER, &shark_timer_irq);
}

static struct sys_timer shark_timer = {
	.init		= shark_timer_init,
};

MACHINE_START(SHARK, "Shark")
153
	/* Maintainer: Alexander Schulz */
154
	.atag_offset	= 0x3000,
155 156
	.map_io		= shark_map_io,
	.init_irq	= shark_init_irq,
L
Linus Torvalds 已提交
157
	.timer		= &shark_timer,
158
	.dma_zone_size	= SZ_4M,
L
Linus Torvalds 已提交
159
MACHINE_END