2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-shark/arch.c
|
|
|
|
*
|
|
|
|
* Architecture specific stuff.
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/interrupt.h>
|
2006-07-02 05:32:37 +08:00
|
|
|
#include <linux/irq.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/serial_8250.h>
|
2008-09-06 19:10:45 +08:00
|
|
|
#include <linux/io.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/setup.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/param.h>
|
2012-03-30 14:22:44 +08:00
|
|
|
#include <asm/system_misc.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/time.h>
|
|
|
|
|
2009-01-09 01:05:58 +08:00
|
|
|
#define ROMCARD_SIZE 0x08000000
|
|
|
|
#define ROMCARD_START 0x10000000
|
|
|
|
|
2011-11-05 22:41:14 +08:00
|
|
|
static void shark_restart(char mode, const char *cmd)
|
2009-01-09 01:05:58 +08:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct plat_serial8250_port serial_platform_data[] = {
|
|
|
|
{
|
|
|
|
.iobase = 0x3f8,
|
|
|
|
.irq = 4,
|
|
|
|
.uartclk = 1843200,
|
2005-07-17 00:17:18 +08:00
|
|
|
.regshift = 0,
|
2005-04-17 06:20:36 +08:00
|
|
|
.iotype = UPIO_PORT,
|
|
|
|
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.iobase = 0x2f8,
|
|
|
|
.irq = 3,
|
|
|
|
.uartclk = 1843200,
|
2005-07-17 00:17:18 +08:00
|
|
|
.regshift = 0,
|
2005-04-17 06:20:36 +08:00
|
|
|
.iotype = UPIO_PORT,
|
|
|
|
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
|
|
|
|
},
|
|
|
|
{ },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device serial_device = {
|
|
|
|
.name = "serial8250",
|
2005-09-08 23:04:41 +08:00
|
|
|
.id = PLAT8250_DEV_PLATFORM,
|
2005-04-17 06:20:36 +08:00
|
|
|
.dev = {
|
|
|
|
.platform_data = serial_platform_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2009-01-09 01:05:58 +08:00
|
|
|
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),
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static int __init shark_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (machine_is_shark())
|
2009-01-09 01:05:58 +08:00
|
|
|
{
|
|
|
|
ret = platform_device_register(&rtc_device);
|
|
|
|
if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
|
2005-04-17 06:20:36 +08:00
|
|
|
ret = platform_device_register(&serial_device);
|
2009-01-09 01:05:58 +08:00
|
|
|
if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
|
|
|
|
}
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
arch_initcall(shark_init);
|
|
|
|
|
|
|
|
extern void shark_init_irq(void);
|
|
|
|
|
|
|
|
#define IRQ_TIMER 0
|
|
|
|
#define HZ_TIME ((1193180 + HZ/2) / HZ)
|
|
|
|
|
|
|
|
static irqreturn_t
|
2006-10-07 01:53:39 +08:00
|
|
|
shark_timer_interrupt(int irq, void *dev_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-10-07 01:53:39 +08:00
|
|
|
timer_tick();
|
2005-04-17 06:20:36 +08:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct irqaction shark_timer_irq = {
|
|
|
|
.name = "Shark Timer Tick",
|
2007-05-08 15:35:39 +08:00
|
|
|
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
|
2005-06-27 00:06:36 +08:00
|
|
|
.handler = shark_timer_interrupt,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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,
|
|
|
|
};
|
|
|
|
|
2011-08-04 00:00:02 +08:00
|
|
|
static void shark_init_early(void)
|
|
|
|
{
|
|
|
|
disable_hlt();
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_START(SHARK, "Shark")
|
2005-07-04 00:38:58 +08:00
|
|
|
/* Maintainer: Alexander Schulz */
|
2011-07-06 10:38:17 +08:00
|
|
|
.atag_offset = 0x3000,
|
2011-08-04 00:00:02 +08:00
|
|
|
.init_early = shark_init_early,
|
2005-07-04 00:38:58 +08:00
|
|
|
.init_irq = shark_init_irq,
|
2005-04-17 06:20:36 +08:00
|
|
|
.timer = &shark_timer,
|
2011-07-06 10:28:09 +08:00
|
|
|
.dma_zone_size = SZ_4M,
|
2011-11-05 22:41:14 +08:00
|
|
|
.restart = shark_restart,
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_END
|