MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-sa1100 / adsbitsy.c
blob53f990e7d61580a019e6d8fcea0e15f6a91d81b6
1 /*
2 * linux/arch/arm/mach-sa1100/adsbitsy.c
4 * Author: Woojung Huh
6 * Pieces specific to the ADS Bitsy
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/ptrace.h>
15 #include <linux/ioport.h>
16 #include <linux/serial_core.h>
18 #include <asm/hardware.h>
19 #include <asm/mach-types.h>
20 #include <asm/setup.h>
21 #include <asm/irq.h>
23 #include <asm/mach/irq.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/serial_sa1100.h>
28 #include "generic.h"
30 static struct resource sa1111_resources[] = {
31 [0] = {
32 .start = 0x18000000,
33 .end = 0x18001fff,
34 .flags = IORESOURCE_MEM,
36 [1] = {
37 .start = IRQ_GPIO0,
38 .end = IRQ_GPIO0,
39 .flags = IORESOURCE_IRQ,
43 static u64 sa1111_dmamask = 0xffffffffUL;
45 static struct platform_device sa1111_device = {
46 .name = "sa1111",
47 .id = 0,
48 .dev = {
49 .dma_mask = &sa1111_dmamask,
50 .coherent_dma_mask = 0xffffffff,
52 .num_resources = ARRAY_SIZE(sa1111_resources),
53 .resource = sa1111_resources,
56 static struct platform_device *devices[] __initdata = {
57 &sa1111_device,
60 static int __init adsbitsy_init(void)
62 int ret;
64 if (!machine_is_adsbitsy())
65 return -ENODEV;
68 * Ensure that the memory bus request/grant signals are setup,
69 * and the grant is held in its inactive state
71 sa1110_mb_disable();
74 * Reset SA1111
76 GPCR |= GPIO_GPIO26;
77 udelay(1000);
78 GPSR |= GPIO_GPIO26;
81 * Probe for SA1111.
83 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
84 if (ret < 0)
85 return ret;
88 * Enable PWM control for LCD
90 sa1111_enable_device(SKPCR_PWMCLKEN);
91 SKPWM0 = 0x7F; // VEE
92 SKPEN0 = 1;
93 SKPWM1 = 0x01; // Backlight
94 SKPEN1 = 1;
96 return 0;
99 arch_initcall(adsbitsy_init);
101 static void __init adsbitsy_init_irq(void)
103 /* First the standard SA1100 IRQs */
104 sa1100_init_irq();
107 static struct map_desc adsbitsy_io_desc[] __initdata = {
108 /* virtual physical length type */
109 { 0xf4000000, 0x18000000, 0x00800000, MT_DEVICE } /* SA1111 */
112 static int adsbitsy_uart_open(struct uart_port *port, struct uart_info *info)
114 if (port->mapbase == _Ser1UTCR0) {
115 Ser1SDCR0 |= SDCR0_UART;
116 #error Fixme // Set RTS High (should be done in the set_mctrl fn)
117 GPCR = GPIO_GPIO15;
118 } else if (port->mapbase == _Ser2UTCR0) {
119 Ser2UTCR4 = Ser2HSCR0 = 0;
120 #error Fixme // Set RTS High (should be done in the set_mctrl fn)
121 GPCR = GPIO_GPIO17;
122 } else if (port->mapbase == _Ser2UTCR0) {
123 #error Fixme // Set RTS High (should be done in the set_mctrl fn)
124 GPCR = GPIO_GPIO19;
126 return 0;
129 static struct sa1100_port_fns adsbitsy_port_fns __initdata = {
130 .open = adsbitsy_uart_open,
133 static void __init adsbitsy_map_io(void)
135 sa1100_map_io();
136 iotable_init(adsbitsy_io_desc, ARRAY_SIZE(adsbitsy_io_desc));
138 sa1100_register_uart_fns(&adsbitsy_port_fns);
139 sa1100_register_uart(0, 3);
140 sa1100_register_uart(1, 1);
141 sa1100_register_uart(2, 2);
142 GPDR |= GPIO_GPIO15 | GPIO_GPIO17 | GPIO_GPIO19;
143 GPDR &= ~(GPIO_GPIO14 | GPIO_GPIO16 | GPIO_GPIO18);
146 MACHINE_START(ADSBITSY, "ADS Bitsy")
147 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
148 MAPIO(adsbitsy_map_io)
149 INITIRQ(adsbitsy_init_irq)
150 INITTIME(sa1100_init_time)
151 MACHINE_END