2 * linux/arch/arm/mach-pxa/mainstone.c
4 * Support for the Intel HCDDBBVA0 Development Platform.
5 * (go figure how they came up with such name...)
7 * Author: Nicolas Pitre
8 * Created: Nov 05, 2002
9 * Copyright: MontaVista Software Inc.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #include <linux/init.h>
17 #include <linux/device.h>
18 #include <linux/interrupt.h>
19 #include <linux/sched.h>
20 #include <linux/bitops.h>
23 #include <asm/types.h>
24 #include <asm/setup.h>
25 #include <asm/memory.h>
26 #include <asm/mach-types.h>
27 #include <asm/hardware.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/irq.h>
34 #include <asm/arch/pxa-regs.h>
35 #include <asm/arch/mainstone.h>
36 #include <asm/arch/pxafb.h>
41 static unsigned long mainstone_irq_enabled;
43 static void mainstone_mask_irq(unsigned int irq)
45 int mainstone_irq = (irq - MAINSTONE_IRQ(0));
46 MST_INTMSKENA = (mainstone_irq_enabled &= ~(1 << mainstone_irq));
49 static void mainstone_unmask_irq(unsigned int irq)
51 int mainstone_irq = (irq - MAINSTONE_IRQ(0));
52 /* the irq can be acknowledged only if deasserted, so it's done here */
53 MST_INTSETCLR &= ~(1 << mainstone_irq);
54 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq));
57 static struct irqchip mainstone_irq_chip = {
58 .ack = mainstone_mask_irq,
59 .mask = mainstone_mask_irq,
60 .unmask = mainstone_unmask_irq,
64 static void mainstone_irq_handler(unsigned int irq, struct irqdesc *desc,
67 unsigned long pending = MST_INTSETCLR & mainstone_irq_enabled;
69 GEDR(0) = GPIO_bit(0); /* clear useless edge notification */
70 if (likely(pending)) {
71 irq = MAINSTONE_IRQ(0) + __ffs(pending);
72 desc = irq_desc + irq;
73 desc->handle(irq, desc, regs);
75 pending = MST_INTSETCLR & mainstone_irq_enabled;
79 static void __init mainstone_init_irq(void)
85 /* setup extra Mainstone irqs */
86 for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) {
87 set_irq_chip(irq, &mainstone_irq_chip);
88 set_irq_handler(irq, do_level_IRQ);
89 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
91 set_irq_flags(MAINSTONE_IRQ(8), 0);
92 set_irq_flags(MAINSTONE_IRQ(12), 0);
97 set_irq_chained_handler(IRQ_GPIO(0), mainstone_irq_handler);
98 set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
102 static struct resource smc91x_resources[] = {
104 .start = (MST_ETH_PHYS + 0x300),
105 .end = (MST_ETH_PHYS + 0xfffff),
106 .flags = IORESOURCE_MEM,
109 .start = MAINSTONE_IRQ(3),
110 .end = MAINSTONE_IRQ(3),
111 .flags = IORESOURCE_IRQ,
115 static struct platform_device smc91x_device = {
118 .num_resources = ARRAY_SIZE(smc91x_resources),
119 .resource = smc91x_resources,
123 static void mainstone_backlight_power(int on)
126 pxa_gpio_mode(GPIO16_PWM0_MD);
127 pxa_set_cken(CKEN0_PWM0, 1);
135 pxa_set_cken(CKEN0_PWM0, 0);
139 static struct pxafb_mach_info toshiba_ltm04c380k __initdata = {
150 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
153 .pxafb_backlight_power = mainstone_backlight_power,
156 static struct pxafb_mach_info toshiba_ltm035a776c __initdata = {
167 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
170 .pxafb_backlight_power = mainstone_backlight_power,
173 static void __init mainstone_init(void)
175 platform_device_register(&smc91x_device);
177 /* reading Mainstone's "Virtual Configuration Register"
178 might be handy to select LCD type here */
180 set_pxa_fb_info(&toshiba_ltm04c380k);
182 set_pxa_fb_info(&toshiba_ltm035a776c);
186 static struct map_desc mainstone_io_desc[] __initdata = {
187 { MST_FPGA_VIRT, MST_FPGA_PHYS, 0x00100000, MT_DEVICE }, /* CPLD */
190 static void __init mainstone_map_io(void)
193 iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc));
196 MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
197 MAINTAINER("MontaVista Software Inc.")
198 BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
199 MAPIO(mainstone_map_io)
200 INITIRQ(mainstone_init_irq)
201 INITTIME(pxa_init_time)
202 INIT_MACHINE(mainstone_init)