blob: 7289363be47fce2e6748ac2f3ff718b7fa1601e9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-pxa/idp.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Copyright (c) 2001 Cliff Brake, Accelent Systems Inc.
9 *
10 * 2001-09-13: Cliff Brake <cbrake@accelent.com>
11 * Initial code
12 *
13 * 2005-02-15: Cliff Brake <cliff.brake@gmail.com>
14 * <http://www.vibren.com> <http://bec-systems.com>
15 * Updated for 2.6 kernel
16 *
17 */
18
19#include <linux/init.h>
20#include <linux/interrupt.h>
Thomas Gleixner1623dee2006-07-01 22:32:20 +010021#include <linux/irq.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010022#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <linux/fb.h>
24
25#include <asm/setup.h>
26#include <asm/memory.h>
27#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010028#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/irq.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/pxa-regs.h>
Eric Miao399ba622008-08-08 13:33:31 +080035#include <mach/mfp-pxa25x.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010036#include <mach/idp.h>
37#include <mach/pxafb.h>
38#include <mach/bitfield.h>
39#include <mach/mmc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010042#include "devices.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
44/* TODO:
45 * - add pxa2xx_audio_ops_t device structure
46 * - Ethernet interrupt
47 */
48
Eric Miao399ba622008-08-08 13:33:31 +080049static unsigned long idp_pin_config[] __initdata = {
50 /* BTUART */
51 GPIO42_BTUART_RXD,
52 GPIO43_BTUART_TXD,
53 GPIO44_BTUART_CTS,
54 GPIO45_BTUART_RTS,
55
56 /* STUART */
57 GPIO46_STUART_RXD,
58 GPIO47_STUART_TXD,
59
60 /* MMC */
61 GPIO6_MMC_CLK,
62 GPIO8_MMC_CS0,
63
64 /* Ethernet */
65 GPIO33_nCS_5, /* Ethernet CS */
66 GPIO4_GPIO, /* Ethernet IRQ */
67};
68
Linus Torvalds1da177e2005-04-16 15:20:36 -070069static struct resource smc91x_resources[] = {
70 [0] = {
71 .start = (IDP_ETH_PHYS + 0x300),
72 .end = (IDP_ETH_PHYS + 0xfffff),
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76 .start = IRQ_GPIO(4),
77 .end = IRQ_GPIO(4),
Russell Kinge7b3dc72008-01-14 22:30:10 +000078 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 }
80};
81
82static struct platform_device smc91x_device = {
83 .name = "smc91x",
84 .id = 0,
85 .num_resources = ARRAY_SIZE(smc91x_resources),
86 .resource = smc91x_resources,
87};
88
89static void idp_backlight_power(int on)
90{
91 if (on) {
92 IDP_CPLD_LCD |= (1<<1);
93 } else {
94 IDP_CPLD_LCD &= ~(1<<1);
95 }
96}
97
98static void idp_vlcd(int on)
99{
100 if (on) {
101 IDP_CPLD_LCD |= (1<<2);
102 } else {
103 IDP_CPLD_LCD &= ~(1<<2);
104 }
105}
106
Richard Purdied14b2722006-09-20 22:54:21 +0100107static void idp_lcd_power(int on, struct fb_var_screeninfo *var)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108{
109 if (on) {
110 IDP_CPLD_LCD |= (1<<0);
111 } else {
112 IDP_CPLD_LCD &= ~(1<<0);
113 }
114
115 /* call idp_vlcd for now as core driver does not support
116 * both power and vlcd hooks. Note, this is not technically
117 * the correct sequence, but seems to work. Disclaimer:
118 * this may eventually damage the display.
119 */
120
121 idp_vlcd(on);
122}
123
Richard Purdied14b2722006-09-20 22:54:21 +0100124static struct pxafb_mode_info sharp_lm8v31_mode = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 .pixclock = 270000,
126 .xres = 640,
127 .yres = 480,
128 .bpp = 16,
129 .hsync_len = 1,
130 .left_margin = 3,
131 .right_margin = 3,
132 .vsync_len = 1,
133 .upper_margin = 0,
134 .lower_margin = 0,
135 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
136 .cmap_greyscale = 0,
Richard Purdied14b2722006-09-20 22:54:21 +0100137};
138
139static struct pxafb_mach_info sharp_lm8v31 = {
140 .modes = &sharp_lm8v31_mode,
141 .num_modes = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 .cmap_inverse = 0,
143 .cmap_static = 0,
144 .lccr0 = LCCR0_SDS,
145 .lccr3 = LCCR3_PCP | LCCR3_Acb(255),
146 .pxafb_backlight_power = &idp_backlight_power,
147 .pxafb_lcd_power = &idp_lcd_power
148};
149
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150static struct pxamci_platform_data idp_mci_platform_data = {
151 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152};
153
154static void __init idp_init(void)
155{
156 printk("idp_init()\n");
157
Eric Miao399ba622008-08-08 13:33:31 +0800158 pxa2xx_mfp_config(ARRAY_AND_SIZE(idp_pin_config));
159
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 platform_device_register(&smc91x_device);
161 //platform_device_register(&mst_audio_device);
162 set_pxa_fb_info(&sharp_lm8v31);
163 pxa_set_mci_info(&idp_mci_platform_data);
164}
165
166static void __init idp_init_irq(void)
167{
168
Eric Miaocd491042007-06-22 04:14:09 +0100169 pxa25x_init_irq();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
171 set_irq_type(TOUCH_PANEL_IRQ, TOUCH_PANEL_IRQ_EDGE);
172}
173
174static struct map_desc idp_io_desc[] __initdata = {
Deepak Saxena6f9182e2005-10-28 15:19:01 +0100175 {
176 .virtual = IDP_COREVOLT_VIRT,
177 .pfn = __phys_to_pfn(IDP_COREVOLT_PHYS),
178 .length = IDP_COREVOLT_SIZE,
179 .type = MT_DEVICE
180 }, {
181 .virtual = IDP_CPLD_VIRT,
182 .pfn = __phys_to_pfn(IDP_CPLD_PHYS),
183 .length = IDP_CPLD_SIZE,
184 .type = MT_DEVICE
185 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186};
187
188static void __init idp_map_io(void)
189{
190 pxa_map_io();
191 iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192}
193
194
195MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100196 /* Maintainer: Vibren Technologies */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100197 .phys_io = 0x40000000,
Russell King68070bd2005-07-04 10:44:34 +0100198 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100199 .map_io = idp_map_io,
200 .init_irq = idp_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 .timer = &pxa_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100202 .init_machine = idp_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203MACHINE_END