blob: 14155fc49a1208d2c8b9fc7116719c73f8972b7c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Support for Sharp SL-C7xx PDAs
3 * Models: SL-C700 (Corgi), SL-C750 (Shepherd), SL-C760 (Husky)
4 *
5 * Copyright (c) 2004-2005 Richard Purdie
6 *
7 * Based on Sharp's 2.4 kernel patches/lubbock.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010017#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/major.h>
19#include <linux/fs.h>
20#include <linux/interrupt.h>
21#include <linux/mmc/host.h>
Richard Purdie74617fb2006-06-19 19:57:12 +010022#include <linux/pm.h>
Eric Miao9d708752008-08-27 09:16:30 +080023#include <linux/gpio.h>
Richard Purdiec3f8f652007-09-03 00:27:00 +010024#include <linux/backlight.h>
Richard Purdieca4d6cf2008-01-02 01:09:54 +010025#include <video/w100fb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27#include <asm/setup.h>
28#include <asm/memory.h>
29#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010030#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/irq.h>
32#include <asm/io.h>
Richard Purdie74617fb2006-06-19 19:57:12 +010033#include <asm/system.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38
Russell Kinga09e64f2008-08-05 16:14:15 +010039#include <mach/pxa-regs.h>
40#include <mach/pxa2xx-regs.h>
Eric Miao9ae808d2008-08-27 09:32:48 +080041#include <mach/mfp-pxa25x.h>
Mark Brownf8787fd2008-08-26 13:30:03 +010042#include <mach/i2c.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010043#include <mach/irda.h>
44#include <mach/mmc.h>
45#include <mach/udc.h>
46#include <mach/corgi.h>
47#include <mach/sharpsl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49#include <asm/mach/sharpsl_param.h>
50#include <asm/hardware/scoop.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010053#include "devices.h"
Richard Purdie50a5de42005-09-13 01:25:30 -070054#include "sharpsl.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Eric Miao9ae808d2008-08-27 09:32:48 +080056static unsigned long corgi_pin_config[] __initdata = {
57 /* Static Memory I/O */
58 GPIO78_nCS_2, /* w100fb */
59 GPIO80_nCS_4, /* scoop */
60
61 /* SSP1 */
62 GPIO23_SSP1_SCLK,
63 GPIO25_SSP1_TXD,
64 GPIO26_SSP1_RXD,
65 GPIO24_GPIO, /* CORGI_GPIO_ADS7846_CS - SFRM as chip select */
66
67 /* I2S */
68 GPIO28_I2S_BITCLK_OUT,
69 GPIO29_I2S_SDATA_IN,
70 GPIO30_I2S_SDATA_OUT,
71 GPIO31_I2S_SYNC,
72 GPIO32_I2S_SYSCLK,
73
74 /* Infra-Red */
75 GPIO47_FICP_TXD,
76 GPIO46_FICP_RXD,
77
78 /* FFUART */
79 GPIO40_FFUART_DTR,
80 GPIO41_FFUART_RTS,
81 GPIO39_FFUART_TXD,
82 GPIO37_FFUART_DSR,
83 GPIO34_FFUART_RXD,
84 GPIO35_FFUART_CTS,
85
86 /* PC Card */
87 GPIO48_nPOE,
88 GPIO49_nPWE,
89 GPIO50_nPIOR,
90 GPIO51_nPIOW,
91 GPIO52_nPCE_1,
92 GPIO53_nPCE_2,
93 GPIO54_nPSKTSEL,
94 GPIO55_nPREG,
95 GPIO56_nPWAIT,
96 GPIO57_nIOIS16,
97
98 /* MMC */
99 GPIO6_MMC_CLK,
100 GPIO8_MMC_CS0,
101
102 /* GPIO */
103 GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */
104 GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */
105 GPIO33_GPIO, /* CORGI_GPIO_SD_PWR */
106 GPIO22_GPIO, /* CORGI_GPIO_IR_ON */
107 GPIO44_GPIO, /* CORGI_GPIO_HSYNC */
108
109 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
110};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
112/*
113 * Corgi SCOOP Device
114 */
115static struct resource corgi_scoop_resources[] = {
116 [0] = {
117 .start = 0x10800000,
118 .end = 0x10800fff,
119 .flags = IORESOURCE_MEM,
120 },
121};
122
123static struct scoop_config corgi_scoop_setup = {
124 .io_dir = CORGI_SCOOP_IO_DIR,
125 .io_out = CORGI_SCOOP_IO_OUT,
126};
127
128struct platform_device corgiscoop_device = {
129 .name = "sharp-scoop",
130 .id = -1,
131 .dev = {
132 .platform_data = &corgi_scoop_setup,
133 },
134 .num_resources = ARRAY_SIZE(corgi_scoop_resources),
135 .resource = corgi_scoop_resources,
136};
137
Richard Purdiea63ae442005-11-08 19:15:43 +0000138static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = {
139{
140 .dev = &corgiscoop_device.dev,
141 .irq = CORGI_IRQ_GPIO_CF_IRQ,
142 .cd_irq = CORGI_IRQ_GPIO_CF_CD,
143 .cd_irq_str = "PCMCIA0 CD",
144},
145};
146
147static struct scoop_pcmcia_config corgi_pcmcia_config = {
148 .devs = &corgi_pcmcia_scoop[0],
149 .num_devs = 1,
Richard Purdiea63ae442005-11-08 19:15:43 +0000150};
151
152EXPORT_SYMBOL(corgiscoop_device);
153
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
155/*
156 * Corgi SSP Device
157 *
158 * Set the parent as the scoop device because a lot of SSP devices
159 * also use scoop functions and this makes the power up/down order
160 * work correctly.
161 */
Richard Purdie41b1bce2005-09-06 15:19:05 -0700162struct platform_device corgissp_device = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 .name = "corgi-ssp",
164 .dev = {
165 .parent = &corgiscoop_device.dev,
166 },
167 .id = -1,
168};
169
Richard Purdie50a5de42005-09-13 01:25:30 -0700170struct corgissp_machinfo corgi_ssp_machinfo = {
171 .port = 1,
172 .cs_lcdcon = CORGI_GPIO_LCDCON_CS,
173 .cs_ads7846 = CORGI_GPIO_ADS7846_CS,
174 .cs_max1111 = CORGI_GPIO_MAX1111_CS,
175 .clk_lcdcon = 76,
176 .clk_ads7846 = 2,
177 .clk_max1111 = 8,
178};
179
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
181/*
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100182 * LCD/Framebuffer
183 */
184static void w100_lcdtg_suspend(struct w100fb_par *par)
185{
186 corgi_lcdtg_suspend();
187}
188
189static void w100_lcdtg_init(struct w100fb_par *par)
190{
191 corgi_lcdtg_hw_init(par->xres);
192}
193
194
195static struct w100_tg_info corgi_lcdtg_info = {
196 .change = w100_lcdtg_init,
197 .suspend = w100_lcdtg_suspend,
198 .resume = w100_lcdtg_init,
199};
200
201static struct w100_mem_info corgi_fb_mem = {
202 .ext_cntl = 0x00040003,
203 .sdram_mode_reg = 0x00650021,
204 .ext_timing_cntl = 0x10002a4a,
205 .io_cntl = 0x7ff87012,
206 .size = 0x1fffff,
207};
208
209static struct w100_gen_regs corgi_fb_regs = {
210 .lcd_format = 0x00000003,
211 .lcdd_cntl1 = 0x01CC0000,
212 .lcdd_cntl2 = 0x0003FFFF,
213 .genlcd_cntl1 = 0x00FFFF0D,
214 .genlcd_cntl2 = 0x003F3003,
215 .genlcd_cntl3 = 0x000102aa,
216};
217
218static struct w100_gpio_regs corgi_fb_gpio = {
219 .init_data1 = 0x000000bf,
220 .init_data2 = 0x00000000,
221 .gpio_dir1 = 0x00000000,
222 .gpio_oe1 = 0x03c0feff,
223 .gpio_dir2 = 0x00000000,
224 .gpio_oe2 = 0x00000000,
225};
226
227static struct w100_mode corgi_fb_modes[] = {
228{
229 .xres = 480,
230 .yres = 640,
231 .left_margin = 0x56,
232 .right_margin = 0x55,
233 .upper_margin = 0x03,
234 .lower_margin = 0x00,
235 .crtc_ss = 0x82360056,
236 .crtc_ls = 0xA0280000,
237 .crtc_gs = 0x80280028,
238 .crtc_vpos_gs = 0x02830002,
239 .crtc_rev = 0x00400008,
240 .crtc_dclk = 0xA0000000,
241 .crtc_gclk = 0x8015010F,
242 .crtc_goe = 0x80100110,
243 .crtc_ps1_active = 0x41060010,
244 .pll_freq = 75,
245 .fast_pll_freq = 100,
246 .sysclk_src = CLK_SRC_PLL,
247 .sysclk_divider = 0,
248 .pixclk_src = CLK_SRC_PLL,
249 .pixclk_divider = 2,
250 .pixclk_divider_rotated = 6,
251},{
252 .xres = 240,
253 .yres = 320,
254 .left_margin = 0x27,
255 .right_margin = 0x2e,
256 .upper_margin = 0x01,
257 .lower_margin = 0x00,
258 .crtc_ss = 0x81170027,
259 .crtc_ls = 0xA0140000,
260 .crtc_gs = 0xC0140014,
261 .crtc_vpos_gs = 0x00010141,
262 .crtc_rev = 0x00400008,
263 .crtc_dclk = 0xA0000000,
264 .crtc_gclk = 0x8015010F,
265 .crtc_goe = 0x80100110,
266 .crtc_ps1_active = 0x41060010,
267 .pll_freq = 0,
268 .fast_pll_freq = 0,
269 .sysclk_src = CLK_SRC_XTAL,
270 .sysclk_divider = 0,
271 .pixclk_src = CLK_SRC_XTAL,
272 .pixclk_divider = 1,
273 .pixclk_divider_rotated = 1,
274},
275
276};
277
278static struct w100fb_mach_info corgi_fb_info = {
279 .tg = &corgi_lcdtg_info,
280 .init_mode = INIT_MODE_ROTATED,
281 .mem = &corgi_fb_mem,
282 .regs = &corgi_fb_regs,
283 .modelist = &corgi_fb_modes[0],
284 .num_modes = 2,
285 .gpio = &corgi_fb_gpio,
286 .xtal_freq = 12500000,
287 .xtal_dbl = 0,
288};
289
290static struct resource corgi_fb_resources[] = {
291 [0] = {
292 .start = 0x08000000,
293 .end = 0x08ffffff,
294 .flags = IORESOURCE_MEM,
295 },
296};
297
298static struct platform_device corgifb_device = {
299 .name = "w100fb",
300 .id = -1,
301 .num_resources = ARRAY_SIZE(corgi_fb_resources),
302 .resource = corgi_fb_resources,
303 .dev = {
304 .platform_data = &corgi_fb_info,
305 .parent = &corgissp_device.dev,
306 },
307
308};
309
310
311/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 * Corgi Backlight Device
313 */
Richard Purdiec3f8f652007-09-03 00:27:00 +0100314static void corgi_bl_kick_battery(void)
315{
316 void (*kick_batt)(void);
317
318 kick_batt = symbol_get(sharpsl_battery_kick);
319 if (kick_batt) {
320 kick_batt();
321 symbol_put(sharpsl_battery_kick);
322 }
323}
324
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100325static void corgi_bl_set_intensity(int intensity)
326{
327 if (intensity > 0x10)
328 intensity += 0x10;
329
330 /* Bits 0-4 are accessed via the SSP interface */
331 corgi_ssp_blduty_set(intensity & 0x1f);
332
333 /* Bit 5 is via SCOOP */
334 if (intensity & 0x0020)
335 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
336 else
337 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
338}
339
Richard Purdiec3f8f652007-09-03 00:27:00 +0100340static struct generic_bl_info corgi_bl_machinfo = {
341 .name = "corgi-bl",
Richard Purdie1351e6e2005-09-13 01:25:33 -0700342 .max_intensity = 0x2f,
Richard Purdie2c0f5fb2006-03-31 02:31:51 -0800343 .default_intensity = 0x1f,
344 .limit_mask = 0x0b,
Richard Purdie1351e6e2005-09-13 01:25:33 -0700345 .set_bl_intensity = corgi_bl_set_intensity,
Richard Purdiec3f8f652007-09-03 00:27:00 +0100346 .kick_battery = corgi_bl_kick_battery,
Richard Purdie1351e6e2005-09-13 01:25:33 -0700347};
348
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349static struct platform_device corgibl_device = {
Richard Purdiec3f8f652007-09-03 00:27:00 +0100350 .name = "generic-bl",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 .dev = {
352 .parent = &corgifb_device.dev,
Richard Purdie1351e6e2005-09-13 01:25:33 -0700353 .platform_data = &corgi_bl_machinfo,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 },
355 .id = -1,
356};
357
358
359/*
Richard Purdief7ceff32005-09-06 15:19:07 -0700360 * Corgi Keyboard Device
361 */
362static struct platform_device corgikbd_device = {
363 .name = "corgi-keyboard",
364 .id = -1,
365};
366
367
368/*
Richard Purdie31791082006-03-31 02:31:09 -0800369 * Corgi LEDs
370 */
371static struct platform_device corgiled_device = {
372 .name = "corgi-led",
373 .id = -1,
374};
375
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100376
Richard Purdie31791082006-03-31 02:31:09 -0800377/*
Richard Purdief7ceff32005-09-06 15:19:07 -0700378 * Corgi Touch Screen Device
379 */
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100380static unsigned long (*get_hsync_invperiod)(struct device *dev);
381
382static void inline sharpsl_wait_sync(int gpio)
383{
384 while((GPLR(gpio) & GPIO_bit(gpio)) == 0);
385 while((GPLR(gpio) & GPIO_bit(gpio)) != 0);
386}
387
388static unsigned long corgi_get_hsync_invperiod(void)
389{
390 if (!get_hsync_invperiod)
391 get_hsync_invperiod = symbol_get(w100fb_get_hsynclen);
392 if (!get_hsync_invperiod)
393 return 0;
394
395 return get_hsync_invperiod(&corgifb_device.dev);
396}
397
398static void corgi_put_hsync(void)
399{
400 if (get_hsync_invperiod)
401 symbol_put(w100fb_get_hsynclen);
402 get_hsync_invperiod = NULL;
403}
404
405static void corgi_wait_hsync(void)
406{
407 sharpsl_wait_sync(CORGI_GPIO_HSYNC);
408}
409
Richard Purdie513b6e12005-09-13 01:25:33 -0700410static struct resource corgits_resources[] = {
411 [0] = {
412 .start = CORGI_IRQ_GPIO_TP_INT,
413 .end = CORGI_IRQ_GPIO_TP_INT,
414 .flags = IORESOURCE_IRQ,
415 },
416};
417
418static struct corgits_machinfo corgi_ts_machinfo = {
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100419 .get_hsync_invperiod = corgi_get_hsync_invperiod,
420 .put_hsync = corgi_put_hsync,
421 .wait_hsync = corgi_wait_hsync,
Richard Purdie513b6e12005-09-13 01:25:33 -0700422};
423
Richard Purdief7ceff32005-09-06 15:19:07 -0700424static struct platform_device corgits_device = {
425 .name = "corgi-ts",
426 .dev = {
427 .parent = &corgissp_device.dev,
Richard Purdie513b6e12005-09-13 01:25:33 -0700428 .platform_data = &corgi_ts_machinfo,
Richard Purdief7ceff32005-09-06 15:19:07 -0700429 },
430 .id = -1,
Richard Purdie513b6e12005-09-13 01:25:33 -0700431 .num_resources = ARRAY_SIZE(corgits_resources),
432 .resource = corgits_resources,
Richard Purdief7ceff32005-09-06 15:19:07 -0700433};
434
435
436/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 * MMC/SD Device
438 *
Richard Purdieaa6c2e72005-09-09 18:54:03 +0100439 * The card detect interrupt isn't debounced so we delay it by 250ms
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 * to give the card a chance to fully insert/eject.
441 */
Richard Purdieaa6c2e72005-09-09 18:54:03 +0100442static struct pxamci_platform_data corgi_mci_platform_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443
David Howells40220c12006-10-09 12:19:47 +0100444static int corgi_mci_init(struct device *dev, irq_handler_t corgi_detect_int, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445{
446 int err;
447
Eric Miao9d708752008-08-27 09:16:30 +0800448 err = gpio_request(CORGI_GPIO_nSD_DETECT, "nSD_DETECT");
449 if (err)
450 goto err_out;
451
452 err = gpio_request(CORGI_GPIO_nSD_WP, "nSD_WP");
453 if (err)
454 goto err_free_1;
455
456 err = gpio_request(CORGI_GPIO_SD_PWR, "SD_PWR");
457 if (err)
458 goto err_free_2;
459
460 gpio_direction_input(CORGI_GPIO_nSD_DETECT);
461 gpio_direction_input(CORGI_GPIO_nSD_WP);
462 gpio_direction_output(CORGI_GPIO_SD_PWR, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463
Richard Purdieaa6c2e72005-09-09 18:54:03 +0100464 corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
Russell King9ded96f2006-01-08 01:02:07 -0800466 err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int,
Eric Miao9d708752008-08-27 09:16:30 +0800467 IRQF_DISABLED | IRQF_TRIGGER_RISING |
468 IRQF_TRIGGER_FALLING,
469 "MMC card detect", data);
470 if (err) {
471 pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
472 __func__);
473 goto err_free_3;
474 }
475 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476
Eric Miao9d708752008-08-27 09:16:30 +0800477err_free_3:
478 gpio_free(CORGI_GPIO_SD_PWR);
479err_free_2:
480 gpio_free(CORGI_GPIO_nSD_WP);
481err_free_1:
482 gpio_free(CORGI_GPIO_nSD_DETECT);
483err_out:
Russell King2687bd32008-01-23 14:05:58 +0000484 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485}
486
487static void corgi_mci_setpower(struct device *dev, unsigned int vdd)
488{
489 struct pxamci_platform_data* p_d = dev->platform_data;
490
Eric Miao9d708752008-08-27 09:16:30 +0800491 gpio_set_value(CORGI_GPIO_SD_PWR, ((1 << vdd) & p_d->ocr_mask));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492}
493
Richard Purdie3870ee82005-09-06 15:19:07 -0700494static int corgi_mci_get_ro(struct device *dev)
495{
Eric Miao9d708752008-08-27 09:16:30 +0800496 return gpio_get_value(CORGI_GPIO_nSD_WP);
Richard Purdie3870ee82005-09-06 15:19:07 -0700497}
498
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499static void corgi_mci_exit(struct device *dev, void *data)
500{
501 free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data);
Eric Miao9d708752008-08-27 09:16:30 +0800502 gpio_free(CORGI_GPIO_SD_PWR);
503 gpio_free(CORGI_GPIO_nSD_WP);
504 gpio_free(CORGI_GPIO_nSD_DETECT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505}
506
507static struct pxamci_platform_data corgi_mci_platform_data = {
508 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
509 .init = corgi_mci_init,
Richard Purdie3870ee82005-09-06 15:19:07 -0700510 .get_ro = corgi_mci_get_ro,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511 .setpower = corgi_mci_setpower,
512 .exit = corgi_mci_exit,
513};
514
515
Richard Purdieca1140b2005-10-30 14:38:53 +0000516/*
517 * Irda
518 */
519static void corgi_irda_transceiver_mode(struct device *dev, int mode)
520{
Eric Miao9d708752008-08-27 09:16:30 +0800521 gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF);
Dmitry Baryshkov0fc3ff32008-07-02 13:54:46 +0100522 pxa2xx_transceiver_mode(dev, mode);
Richard Purdieca1140b2005-10-30 14:38:53 +0000523}
524
Eric Miao9d708752008-08-27 09:16:30 +0800525static int corgi_irda_startup(struct device *dev)
526{
527 int err;
528
529 err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON");
530 if (err)
531 return err;
532
533 gpio_direction_output(CORGI_GPIO_IR_ON, 1);
534 return 0;
535}
536
537static void corgi_irda_shutdown(struct device *dev)
538{
539 gpio_free(CORGI_GPIO_IR_ON);
540}
541
Richard Purdieca1140b2005-10-30 14:38:53 +0000542static struct pxaficp_platform_data corgi_ficp_platform_data = {
Eric Miao9d708752008-08-27 09:16:30 +0800543 .transceiver_cap = IR_SIRMODE | IR_OFF,
544 .transceiver_mode = corgi_irda_transceiver_mode,
545 .startup = corgi_irda_startup,
546 .shutdown = corgi_irda_shutdown,
Richard Purdieca1140b2005-10-30 14:38:53 +0000547};
548
Richard Purdief7ceff32005-09-06 15:19:07 -0700549
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550/*
551 * USB Device Controller
552 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553static struct pxa2xx_udc_mach_info udc_info __initdata = {
554 /* no connect GPIO; corgi can't tell connection status */
David Brownellb2bbb202006-06-29 12:25:39 -0700555 .gpio_pullup = CORGI_GPIO_USB_PULLUP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556};
557
558
559static struct platform_device *devices[] __initdata = {
560 &corgiscoop_device,
561 &corgissp_device,
562 &corgifb_device,
Richard Purdief7ceff32005-09-06 15:19:07 -0700563 &corgikbd_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 &corgibl_device,
Richard Purdief7ceff32005-09-06 15:19:07 -0700565 &corgits_device,
Richard Purdie31791082006-03-31 02:31:09 -0800566 &corgiled_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567};
568
Richard Purdie74617fb2006-06-19 19:57:12 +0100569static void corgi_poweroff(void)
570{
Richard Purdie74617fb2006-06-19 19:57:12 +0100571 if (!machine_is_corgi())
572 /* Green LED off tells the bootloader to halt */
573 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
574 arm_machine_restart('h');
575}
576
577static void corgi_restart(char mode)
578{
Richard Purdie74617fb2006-06-19 19:57:12 +0100579 if (!machine_is_corgi())
580 /* Green LED on tells the bootloader to reboot */
581 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
582 arm_machine_restart('h');
583}
584
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585static void __init corgi_init(void)
586{
Richard Purdie74617fb2006-06-19 19:57:12 +0100587 pm_power_off = corgi_poweroff;
588 arm_pm_restart = corgi_restart;
589
Richard Purdiefdce05b2005-09-15 14:53:21 +0100590 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
591 PCFR |= PCFR_OPDE;
592
Eric Miao9ae808d2008-08-27 09:32:48 +0800593 pxa2xx_mfp_config(ARRAY_AND_SIZE(corgi_pin_config));
Richard Purdie50a5de42005-09-13 01:25:30 -0700594
Eric Miao9ae808d2008-08-27 09:32:48 +0800595 corgi_ssp_set_machinfo(&corgi_ssp_machinfo);
Richard Purdieca1140b2005-10-30 14:38:53 +0000596
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 pxa_set_udc_info(&udc_info);
598 pxa_set_mci_info(&corgi_mci_platform_data);
Richard Purdieca1140b2005-10-30 14:38:53 +0000599 pxa_set_ficp_info(&corgi_ficp_platform_data);
Mark Brownf8787fd2008-08-26 13:30:03 +0100600 pxa_set_i2c_info(NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601
Richard Purdiea63ae442005-11-08 19:15:43 +0000602 platform_scoop_config = &corgi_pcmcia_config;
Richard Purdie0ce76252005-09-05 20:49:54 +0100603
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 platform_add_devices(devices, ARRAY_SIZE(devices));
605}
606
607static void __init fixup_corgi(struct machine_desc *desc,
608 struct tag *tags, char **cmdline, struct meminfo *mi)
609{
610 sharpsl_save_param();
611 mi->nr_banks=1;
612 mi->bank[0].start = 0xa0000000;
613 mi->bank[0].node = 0;
614 if (machine_is_corgi())
615 mi->bank[0].size = (32*1024*1024);
616 else
617 mi->bank[0].size = (64*1024*1024);
618}
619
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620#ifdef CONFIG_MACH_CORGI
621MACHINE_START(CORGI, "SHARP Corgi")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100622 .phys_io = 0x40000000,
Russell King68070bd2005-07-04 10:44:34 +0100623 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100624 .fixup = fixup_corgi,
Richard Purdiefdce05b2005-09-15 14:53:21 +0100625 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100626 .init_irq = pxa25x_init_irq,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100627 .init_machine = corgi_init,
628 .timer = &pxa_timer,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629MACHINE_END
630#endif
631
632#ifdef CONFIG_MACH_SHEPHERD
633MACHINE_START(SHEPHERD, "SHARP Shepherd")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100634 .phys_io = 0x40000000,
Russell King68070bd2005-07-04 10:44:34 +0100635 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100636 .fixup = fixup_corgi,
Richard Purdiefdce05b2005-09-15 14:53:21 +0100637 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100638 .init_irq = pxa25x_init_irq,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100639 .init_machine = corgi_init,
640 .timer = &pxa_timer,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641MACHINE_END
642#endif
643
644#ifdef CONFIG_MACH_HUSKY
645MACHINE_START(HUSKY, "SHARP Husky")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100646 .phys_io = 0x40000000,
Russell King68070bd2005-07-04 10:44:34 +0100647 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100648 .fixup = fixup_corgi,
Richard Purdiefdce05b2005-09-15 14:53:21 +0100649 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100650 .init_irq = pxa25x_init_irq,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100651 .init_machine = corgi_init,
652 .timer = &pxa_timer,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653MACHINE_END
654#endif
655