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/sysdev.h>
19 #include <linux/major.h>
21 #include <linux/interrupt.h>
23 #include <asm/setup.h>
24 #include <asm/memory.h>
25 #include <asm/mach-types.h>
26 #include <asm/hardware.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
33 #include <asm/hardware/sa1111.h>
35 #include <asm/arch/pxa-regs.h>
36 #include <asm/arch/lubbock.h>
37 #include <asm/arch/udc.h>
38 #include <asm/arch/irda.h>
39 #include <asm/arch/pxafb.h>
40 #include <asm/arch/mmc.h>
45 #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
47 void lubbock_set_misc_wr(unsigned int mask
, unsigned int set
)
51 local_irq_save(flags
);
52 LUB_MISC_WR
= (LUB_MISC_WR
& ~mask
) | (set
& mask
);
53 local_irq_restore(flags
);
55 EXPORT_SYMBOL(lubbock_set_misc_wr
);
57 static unsigned long lubbock_irq_enabled
;
59 static void lubbock_mask_irq(unsigned int irq
)
61 int lubbock_irq
= (irq
- LUBBOCK_IRQ(0));
62 LUB_IRQ_MASK_EN
= (lubbock_irq_enabled
&= ~(1 << lubbock_irq
));
65 static void lubbock_unmask_irq(unsigned int irq
)
67 int lubbock_irq
= (irq
- LUBBOCK_IRQ(0));
68 /* the irq can be acknowledged only if deasserted, so it's done here */
69 LUB_IRQ_SET_CLR
&= ~(1 << lubbock_irq
);
70 LUB_IRQ_MASK_EN
= (lubbock_irq_enabled
|= (1 << lubbock_irq
));
73 static struct irqchip lubbock_irq_chip
= {
74 .ack
= lubbock_mask_irq
,
75 .mask
= lubbock_mask_irq
,
76 .unmask
= lubbock_unmask_irq
,
79 static void lubbock_irq_handler(unsigned int irq
, struct irqdesc
*desc
,
82 unsigned long pending
= LUB_IRQ_SET_CLR
& lubbock_irq_enabled
;
84 GEDR(0) = GPIO_bit(0); /* clear our parent irq */
85 if (likely(pending
)) {
86 irq
= LUBBOCK_IRQ(0) + __ffs(pending
);
87 desc
= irq_desc
+ irq
;
88 desc_handle_irq(irq
, desc
, regs
);
90 pending
= LUB_IRQ_SET_CLR
& lubbock_irq_enabled
;
94 static void __init
lubbock_init_irq(void)
100 /* setup extra lubbock irqs */
101 for (irq
= LUBBOCK_IRQ(0); irq
<= LUBBOCK_LAST_IRQ
; irq
++) {
102 set_irq_chip(irq
, &lubbock_irq_chip
);
103 set_irq_handler(irq
, do_level_IRQ
);
104 set_irq_flags(irq
, IRQF_VALID
| IRQF_PROBE
);
107 set_irq_chained_handler(IRQ_GPIO(0), lubbock_irq_handler
);
108 set_irq_type(IRQ_GPIO(0), IRQT_FALLING
);
113 static int lubbock_irq_resume(struct sys_device
*dev
)
115 LUB_IRQ_MASK_EN
= lubbock_irq_enabled
;
119 static struct sysdev_class lubbock_irq_sysclass
= {
120 set_kset_name("cpld_irq"),
121 .resume
= lubbock_irq_resume
,
124 static struct sys_device lubbock_irq_device
= {
125 .cls
= &lubbock_irq_sysclass
,
128 static int __init
lubbock_irq_device_init(void)
130 int ret
= sysdev_class_register(&lubbock_irq_sysclass
);
132 ret
= sysdev_register(&lubbock_irq_device
);
136 device_initcall(lubbock_irq_device_init
);
140 static int lubbock_udc_is_connected(void)
142 return (LUB_MISC_RD
& (1 << 9)) == 0;
145 static struct pxa2xx_udc_mach_info udc_info __initdata
= {
146 .udc_is_connected
= lubbock_udc_is_connected
,
147 // no D+ pullup; lubbock can't connect/disconnect in software
150 static struct platform_device lub_audio_device
= {
151 .name
= "pxa2xx-ac97",
155 static struct resource sa1111_resources
[] = {
159 .flags
= IORESOURCE_MEM
,
162 .start
= LUBBOCK_SA1111_IRQ
,
163 .end
= LUBBOCK_SA1111_IRQ
,
164 .flags
= IORESOURCE_IRQ
,
168 static struct platform_device sa1111_device
= {
171 .num_resources
= ARRAY_SIZE(sa1111_resources
),
172 .resource
= sa1111_resources
,
175 static struct resource smc91x_resources
[] = {
177 .name
= "smc91x-regs",
180 .flags
= IORESOURCE_MEM
,
183 .start
= LUBBOCK_ETH_IRQ
,
184 .end
= LUBBOCK_ETH_IRQ
,
185 .flags
= IORESOURCE_IRQ
,
188 .name
= "smc91x-attrib",
191 .flags
= IORESOURCE_MEM
,
195 static struct platform_device smc91x_device
= {
198 .num_resources
= ARRAY_SIZE(smc91x_resources
),
199 .resource
= smc91x_resources
,
202 static struct platform_device
*devices
[] __initdata
= {
208 static struct pxafb_mach_info sharp_lm8v31 __initdata
= {
219 .sync
= FB_SYNC_HOR_HIGH_ACT
| FB_SYNC_VERT_HIGH_ACT
,
224 .lccr3
= LCCR3_PCP
| LCCR3_Acb(255),
227 static int lubbock_mci_init(struct device
*dev
, irqreturn_t (*lubbock_detect_int
)(int, void *, struct pt_regs
*), void *data
)
229 /* setup GPIO for PXA25x MMC controller */
230 pxa_gpio_mode(GPIO6_MMCCLK_MD
);
231 pxa_gpio_mode(GPIO8_MMCCS0_MD
);
236 static struct pxamci_platform_data lubbock_mci_platform_data
= {
237 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
238 .init
= lubbock_mci_init
,
241 static void lubbock_irda_transceiver_mode(struct device
*dev
, int mode
)
245 local_irq_save(flags
);
246 if (mode
& IR_SIRMODE
) {
247 LUB_MISC_WR
&= ~(1 << 4);
248 } else if (mode
& IR_FIRMODE
) {
249 LUB_MISC_WR
|= 1 << 4;
251 local_irq_restore(flags
);
254 static struct pxaficp_platform_data lubbock_ficp_platform_data
= {
255 .transceiver_cap
= IR_SIRMODE
| IR_FIRMODE
,
256 .transceiver_mode
= lubbock_irda_transceiver_mode
,
259 static void __init
lubbock_init(void)
261 pxa_set_udc_info(&udc_info
);
262 set_pxa_fb_info(&sharp_lm8v31
);
263 pxa_set_mci_info(&lubbock_mci_platform_data
);
264 pxa_set_ficp_info(&lubbock_ficp_platform_data
);
265 (void) platform_add_devices(devices
, ARRAY_SIZE(devices
));
268 static struct map_desc lubbock_io_desc
[] __initdata
= {
270 .virtual = LUBBOCK_FPGA_VIRT
,
271 .pfn
= __phys_to_pfn(LUBBOCK_FPGA_PHYS
),
272 .length
= 0x00100000,
277 static void __init
lubbock_map_io(void)
280 iotable_init(lubbock_io_desc
, ARRAY_SIZE(lubbock_io_desc
));
282 /* This enables the BTUART */
283 pxa_gpio_mode(GPIO42_BTRXD_MD
);
284 pxa_gpio_mode(GPIO43_BTTXD_MD
);
285 pxa_gpio_mode(GPIO44_BTCTS_MD
);
286 pxa_gpio_mode(GPIO45_BTRTS_MD
);
288 /* This is for the SMC chip select */
289 pxa_gpio_mode(GPIO79_nCS_3_MD
);
291 /* setup sleep mode values */
301 MACHINE_START(LUBBOCK
, "Intel DBPXA250 Development Platform (aka Lubbock)")
302 /* Maintainer: MontaVista Software Inc. */
303 .phys_ram
= 0xa0000000,
304 .phys_io
= 0x40000000,
305 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
306 .map_io
= lubbock_map_io
,
307 .init_irq
= lubbock_init_irq
,
309 .init_machine
= lubbock_init
,