20 #include <linux/sched.h>
21 #include <linux/bitops.h>
26 #include <linux/input.h>
31 #include <linux/slab.h>
34 #include <asm/types.h>
35 #include <asm/setup.h>
36 #include <asm/memory.h>
38 #include <mach/hardware.h>
40 #include <asm/sizes.h>
60 static unsigned long mainstone_pin_config[] = {
125 static unsigned long mainstone_irq_enabled;
127 static void mainstone_mask_irq(
struct irq_data *
d)
130 MST_INTMSKENA = (mainstone_irq_enabled &= ~(1 << mainstone_irq));
133 static void mainstone_unmask_irq(
struct irq_data *
d)
138 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq));
141 static struct irq_chip mainstone_irq_chip = {
143 .irq_ack = mainstone_mask_irq,
144 .irq_mask = mainstone_mask_irq,
145 .irq_unmask = mainstone_unmask_irq,
148 static void mainstone_irq_handler(
unsigned int irq,
struct irq_desc *
desc)
150 unsigned long pending =
MST_INTSETCLR & mainstone_irq_enabled;
162 static void __init mainstone_init_irq(
void)
170 irq_set_chip_and_handler(irq, &mainstone_irq_chip,
189 static void mainstone_irq_resume(
void)
194 static struct syscore_ops mainstone_irq_syscore_ops = {
195 .
resume = mainstone_irq_resume,
198 static int __init mainstone_irq_device_init(
void)
200 if (machine_is_mainstone())
211 static struct resource smc91x_resources[] = {
232 .num_resources =
ARRAY_SIZE(smc91x_resources),
233 .resource = smc91x_resources,
235 .platform_data = &mainstone_smc91x_info,
252 static long mst_audio_suspend_mask;
254 static void mst_audio_suspend(
void *priv)
260 static void mst_audio_resume(
void *priv)
267 .shutdown = mst_audio_shutdown,
268 .suspend = mst_audio_suspend,
269 .resume = mst_audio_resume,
272 static struct resource flash_resources[] = {
287 .name =
"Bootloader",
294 .offset = 0x00040000,
296 .name =
"Filesystem",
304 .map_name =
"cfi_probe",
305 .parts = mainstoneflash0_partitions,
306 .nr_parts =
ARRAY_SIZE(mainstoneflash0_partitions),
308 .map_name =
"cfi_probe",
316 .name =
"pxa2xx-flash",
319 .platform_data = &mst_flash_data[0],
321 .resource = &flash_resources[0],
325 .
name =
"pxa2xx-flash",
328 .platform_data = &mst_flash_data[1],
330 .resource = &flash_resources[1],
335 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
338 .max_brightness = 1023,
339 .dft_brightness = 1023,
340 .pwm_period_ns = 78770,
344 .
name =
"pwm-backlight",
347 .platform_data = &mainstone_backlight_data,
355 printk(
KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
358 #define mainstone_backlight_register() do { } while (0)
404 "MMC card detect", data);
406 printk(
KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
411 static void mainstone_mci_setpower(
struct device *dev,
unsigned int vdd)
425 static void mainstone_mci_exit(
struct device *dev,
void *data)
432 .init = mainstone_mci_init,
433 .setpower = mainstone_mci_setpower,
434 .exit = mainstone_mci_exit,
435 .gpio_card_detect = -1,
440 static void mainstone_irda_transceiver_mode(
struct device *dev,
int mode)
461 .transceiver_cap = IR_SIRMODE | IR_FIRMODE |
IR_OFF,
462 .transceiver_mode = mainstone_irda_transceiver_mode,
476 .buttons = gpio_keys_button,
484 .platform_data = &mainstone_gpio_keys,
490 &mst_flash_device[0],
491 &mst_flash_device[1],
492 &mst_gpio_keys_device,
500 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
501 static unsigned int mainstone_matrix_keys[] = {
532 .matrix_key_cols = 7,
533 .matrix_key_map = mainstone_matrix_keys,
534 .matrix_key_map_size =
ARRAY_SIZE(mainstone_matrix_keys),
540 .debounce_interval = 30,
543 static void __init mainstone_init_keypad(
void)
548 static inline void mainstone_init_keypad(
void) {}
551 static void __init mainstone_init(
void)
562 mst_flash_data[1].
width = 4;
565 mst_flash_data[SW7].
name =
"processor-flash";
566 mst_flash_data[SW7 ^ 1].
name =
"mainboard-flash";
569 mst_flash_data[0].
name);
582 mainstone_pxafb_info.
modes = &toshiba_ltm04c380k_mode;
584 mainstone_pxafb_info.
modes = &toshiba_ltm035a776c_mode;
595 mainstone_init_keypad();
599 static struct map_desc mainstone_io_desc[] __initdata = {
603 .length = 0x00100000,
608 static void __init mainstone_map_io(
void)
624 #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
625 struct mainstone_led {
634 static const struct {
637 } mainstone_leds[] = {
638 {
"mainstone:D28",
"default-on", },
639 {
"mainstone:D27",
"cpu0", },
640 {
"mainstone:D26",
"heartbeat" },
641 {
"mainstone:D25", },
642 {
"mainstone:D24", },
643 {
"mainstone:D23", },
644 {
"mainstone:D22", },
645 {
"mainstone:D21", },
652 struct mainstone_led, cdev);
666 struct mainstone_led, cdev);
672 static int __init mainstone_leds_init(
void)
676 if (!machine_is_mainstone())
681 for (i = 0; i <
ARRAY_SIZE(mainstone_leds); i++) {
682 struct mainstone_led *
led;
688 led->cdev.name = mainstone_leds[
i].name;
689 led->cdev.brightness_set = mainstone_led_set;
690 led->cdev.brightness_get = mainstone_led_get;
691 led->cdev.default_trigger = mainstone_leds[
i].trigger;
710 MACHINE_START(MAINSTONE,
"Intel HCDDBBVA0 Development Platform (aka Mainstone)")
712 .atag_offset = 0x100,
713 .map_io = mainstone_map_io,
715 .init_irq = mainstone_init_irq,
718 .init_machine = mainstone_init,