initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / arm / mach-pxa / lubbock.c
bloba09d4c11b4cb491a4991c7939df33ccf7dad6c90
1 /*
2 * linux/arch/arm/mach-pxa/lubbock.c
4 * Support for the Intel DBPXA250 Development Platform.
6 * Author: Nicolas Pitre
7 * Created: Jun 15, 2001
8 * Copyright: MontaVista Software Inc.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/device.h>
18 #include <linux/major.h>
19 #include <linux/fb.h>
20 #include <linux/interrupt.h>
22 #include <asm/setup.h>
23 #include <asm/memory.h>
24 #include <asm/mach-types.h>
25 #include <asm/hardware.h>
26 #include <asm/irq.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/mach/irq.h>
32 #include <asm/arch/pxa-regs.h>
33 #include <asm/arch/lubbock.h>
34 #include <asm/arch/udc.h>
35 #include <asm/arch/pxafb.h>
36 #include <asm/hardware/sa1111.h>
38 #include "generic.h"
41 void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
43 unsigned long flags;
45 local_irq_save(flags);
46 LUB_MISC_WR = (LUB_MISC_WR & ~mask) | (set & mask);
47 local_irq_restore(flags);
49 EXPORT_SYMBOL(lubbock_set_misc_wr);
51 static unsigned long lubbock_irq_enabled;
53 static void lubbock_mask_irq(unsigned int irq)
55 int lubbock_irq = (irq - LUBBOCK_IRQ(0));
56 LUB_IRQ_MASK_EN = (lubbock_irq_enabled &= ~(1 << lubbock_irq));
59 static void lubbock_unmask_irq(unsigned int irq)
61 int lubbock_irq = (irq - LUBBOCK_IRQ(0));
62 /* the irq can be acknowledged only if deasserted, so it's done here */
63 LUB_IRQ_SET_CLR &= ~(1 << lubbock_irq);
64 LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq));
67 static struct irqchip lubbock_irq_chip = {
68 .ack = lubbock_mask_irq,
69 .mask = lubbock_mask_irq,
70 .unmask = lubbock_unmask_irq,
73 static void lubbock_irq_handler(unsigned int irq, struct irqdesc *desc,
74 struct pt_regs *regs)
76 unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
77 do {
78 GEDR(0) = GPIO_bit(0); /* clear our parent irq */
79 if (likely(pending)) {
80 irq = LUBBOCK_IRQ(0) + __ffs(pending);
81 desc = irq_desc + irq;
82 desc->handle(irq, desc, regs);
84 pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
85 } while (pending);
88 static void __init lubbock_init_irq(void)
90 int irq;
92 pxa_init_irq();
94 /* setup extra lubbock irqs */
95 for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) {
96 set_irq_chip(irq, &lubbock_irq_chip);
97 set_irq_handler(irq, do_level_IRQ);
98 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
101 set_irq_chained_handler(IRQ_GPIO(0), lubbock_irq_handler);
102 set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
105 static int lubbock_udc_is_connected(void)
107 return (LUB_MISC_RD & (1 << 9)) == 0;
110 static struct pxa2xx_udc_mach_info udc_info __initdata = {
111 .udc_is_connected = lubbock_udc_is_connected,
112 // no D+ pullup; lubbock can't connect/disconnect in software
115 static struct resource sa1111_resources[] = {
116 [0] = {
117 .start = 0x10000000,
118 .end = 0x10001fff,
119 .flags = IORESOURCE_MEM,
121 [1] = {
122 .start = LUBBOCK_SA1111_IRQ,
123 .end = LUBBOCK_SA1111_IRQ,
124 .flags = IORESOURCE_IRQ,
128 static struct platform_device sa1111_device = {
129 .name = "sa1111",
130 .id = -1,
131 .num_resources = ARRAY_SIZE(sa1111_resources),
132 .resource = sa1111_resources,
135 static struct resource smc91x_resources[] = {
136 [0] = {
137 .start = 0x0c000000,
138 .end = 0x0c0fffff,
139 .flags = IORESOURCE_MEM,
141 [1] = {
142 .start = LUBBOCK_ETH_IRQ,
143 .end = LUBBOCK_ETH_IRQ,
144 .flags = IORESOURCE_IRQ,
146 [2] = {
147 .start = 0x0e000000,
148 .end = 0x0e0fffff,
149 .flags = IORESOURCE_MEM,
153 static struct platform_device smc91x_device = {
154 .name = "smc91x",
155 .id = -1,
156 .num_resources = ARRAY_SIZE(smc91x_resources),
157 .resource = smc91x_resources,
160 static struct platform_device *devices[] __initdata = {
161 &sa1111_device,
162 &smc91x_device,
165 static struct pxafb_mach_info sharp_lm8v31 __initdata = {
166 .pixclock = 270000,
167 .xres = 640,
168 .yres = 480,
169 .bpp = 16,
170 .hsync_len = 1,
171 .left_margin = 3,
172 .right_margin = 3,
173 .vsync_len = 1,
174 .upper_margin = 0,
175 .lower_margin = 0,
176 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
177 .cmap_greyscale = 0,
178 .cmap_inverse = 0,
179 .cmap_static = 0,
180 .lccr0 = LCCR0_SDS,
181 .lccr3 = LCCR3_PCP | LCCR3_Acb(255),
184 static void __init lubbock_init(void)
186 pxa_set_udc_info(&udc_info);
187 set_pxa_fb_info(&sharp_lm8v31);
188 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
191 static struct map_desc lubbock_io_desc[] __initdata = {
192 { LUBBOCK_FPGA_VIRT, LUBBOCK_FPGA_PHYS, 0x00100000, MT_DEVICE }, /* CPLD */
195 static void __init lubbock_map_io(void)
197 pxa_map_io();
198 iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc));
200 /* This enables the BTUART */
201 pxa_gpio_mode(GPIO42_BTRXD_MD);
202 pxa_gpio_mode(GPIO43_BTTXD_MD);
203 pxa_gpio_mode(GPIO44_BTCTS_MD);
204 pxa_gpio_mode(GPIO45_BTRTS_MD);
206 /* This is for the SMC chip select */
207 pxa_gpio_mode(GPIO79_nCS_3_MD);
209 /* setup sleep mode values */
210 PWER = 0x00000002;
211 PFER = 0x00000000;
212 PRER = 0x00000002;
213 PGSR0 = 0x00008000;
214 PGSR1 = 0x003F0202;
215 PGSR2 = 0x0001C000;
216 PCFR |= PCFR_OPDE;
219 MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
220 MAINTAINER("MontaVista Software Inc.")
221 BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
222 MAPIO(lubbock_map_io)
223 INITIRQ(lubbock_init_irq)
224 INITTIME(pxa_init_time)
225 INIT_MACHINE(lubbock_init)
226 MACHINE_END