MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-sa1100 / yopy.c
blob46e447fc87d9bcb5f82c3b6f1c4f1a44cf393d24
1 /*
2 * linux/arch/arm/mach-sa1100/yopy.c
3 */
4 #include <linux/module.h>
5 #include <linux/init.h>
6 #include <linux/kernel.h>
7 #include <linux/tty.h>
9 #include <asm/hardware.h>
10 #include <asm/mach-types.h>
11 #include <asm/setup.h>
13 #include <asm/mach/arch.h>
14 #include <asm/mach/map.h>
15 #include <asm/mach/serial_sa1100.h>
17 #include "generic.h"
20 static spinlock_t egpio_lock = SPIN_LOCK_UNLOCKED;
22 static unsigned long yopy_egpio =
23 GPIO_MASK(GPIO_CF_RESET) |
24 GPIO_MASK(GPIO_CLKDIV_CLR1) | GPIO_MASK(GPIO_CLKDIV_CLR2) |
25 GPIO_MASK(GPIO_SPEAKER_MUTE) | GPIO_MASK(GPIO_AUDIO_OPAMP_POWER);
27 int yopy_gpio_test(unsigned int gpio)
29 return ((yopy_egpio & (1 << gpio)) != 0);
32 void yopy_gpio_set(unsigned int gpio, int level)
34 unsigned long flags, mask;
36 mask = 1 << gpio;
38 spin_lock_irqsave(&egpio_lock, flags);
40 if (level)
41 yopy_egpio |= mask;
42 else
43 yopy_egpio &= ~mask;
44 YOPY_EGPIO = yopy_egpio;
46 spin_unlock_irqrestore(&egpio_lock, flags);
49 EXPORT_SYMBOL(yopy_gpio_test);
50 EXPORT_SYMBOL(yopy_gpio_set);
52 static int __init yopy_hw_init(void)
54 if (machine_is_yopy()) {
55 YOPY_EGPIO = yopy_egpio;
57 /* Enable Output */
58 PPDR |= PPC_L_BIAS;
59 PSDR &= ~PPC_L_BIAS;
60 PPSR |= PPC_L_BIAS;
62 YOPY_EGPIO = yopy_egpio;
65 return 0;
68 arch_initcall(yopy_hw_init);
71 static struct map_desc yopy_io_desc[] __initdata = {
72 /* virtual physical length type */
73 { 0xf0000000, 0x48000000, 0x00300000, MT_DEVICE }, /* LCD */
74 { 0xf1000000, 0x10000000, 0x00100000, MT_DEVICE } /* EGPIO */
77 static void __init yopy_map_io(void)
79 sa1100_map_io();
80 iotable_init(yopy_io_desc, ARRAY_SIZE(yopy_io_desc));
82 sa1100_register_uart(0, 3);
84 set_GPIO_IRQ_edge(GPIO_UCB1200_IRQ, GPIO_RISING_EDGE);
88 MACHINE_START(YOPY, "Yopy")
89 MAINTAINER("G.Mate, Inc.")
90 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
91 BOOT_PARAMS(0xc0000100)
92 MAPIO(yopy_map_io)
93 INITIRQ(sa1100_init_irq)
94 INITTIME(sa1100_init_time)
95 MACHINE_END