3 * linux/arch/arm/mach-sa1100/frodo.c
5 * Author: Abraham van der Merwe <abraham@2d3d.co.za>
7 * This file contains the 2d3D, Inc. SA-1110 Development Board tweaks.
9 * This source code is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
15 * 2002/05/27 Setup GPIOs for all the onboard peripherals so
16 * that we don't have to do it in each driver
18 * 2002/01/31 Initial version
21 #include <linux/init.h>
22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/tty.h>
25 #include <linux/spinlock.h>
27 #include <asm/setup.h>
28 #include <asm/hardware.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <asm/mach/serial_sa1100.h>
38 static struct map_desc frodo_io_desc[] __initdata = {
39 /* virtual physical length domain r w c b */
40 { 0xe8000000, 0x00000000, 0x04000000, DOMAIN_IO, 0, 1, 0, 0 }, /* flash memory */
41 { 0xf0000000, 0x40000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, /* 16-bit on-board devices (including CPLDs) */
42 { 0xf1000000, 0x18000000, 0x04000000, DOMAIN_IO, 0, 1, 0, 0 }, /* 32-bit daughter card */
46 static spinlock_t frodo_cpld_lock = SPIN_LOCK_UNLOCKED;
47 static volatile u16 *frodo_cpld_memory = (u16 *) 0xf0000000;
49 static void __init frodo_map_io (void)
52 iotable_init (frodo_io_desc);
54 sa1100_register_uart (0,2); /* UART2 (serial console) */
55 sa1100_register_uart (1,1); /* UART1 (big kahuna flow control serial port) */
58 * Set SUS bit in SDCR0 so serial port 1 acts as a UART.
59 * See Intel SA-1110 Developers Manual Section 11.9.2.1 (GPCLK/UART Select)
61 Ser1SDCR0 |= SDCR0_SUS;
64 static int __init frodo_init_irq(void)
74 FRODO_PCMCIA_STATUS_GPIO,
75 FRODO_PCMCIA_RDYBSY_GPIO
78 for (i = 0; i < sizeof (gpio) / sizeof (gpio[0]); i++)
79 set_GPIO_IRQ_edge (gpio[i],GPIO_RISING_EDGE);
84 __initcall(frodo_init_irq);
86 static int __init frodo_init_cpld(void)
88 if ((frodo_cpld_memory = ioremap (FRODO_CPLD_BASE,FRODO_CPLD_LENGTH)) == NULL)
89 panic ("Couldn't map CPLD memory to a virtual address. We're screwed!\n");
94 __initcall(frodo_init_cpld);
96 u16 frodo_cpld_read (u32 reg)
101 spin_lock_irqsave (&frodo_cpld_lock,flags);
102 value = frodo_cpld_memory[reg / 2];
103 spin_unlock_irqrestore (&frodo_cpld_lock,flags);
108 void frodo_cpld_write (u32 reg,u16 value)
112 spin_lock_irqsave (&frodo_cpld_lock,flags);
113 frodo_cpld_memory[reg / 2] = value;
114 spin_unlock_irqrestore (&frodo_cpld_lock,flags);
117 void frodo_cpld_set (u32 reg,u16 mask)
121 spin_lock_irqsave (&frodo_cpld_lock,flags);
122 frodo_cpld_memory[reg / 2] |= mask;
123 spin_unlock_irqrestore (&frodo_cpld_lock,flags);
126 void frodo_cpld_clear (u32 reg,u16 mask)
130 spin_lock_irqsave (&frodo_cpld_lock,flags);
131 frodo_cpld_memory[reg / 2] &= ~mask;
132 spin_unlock_irqrestore (&frodo_cpld_lock,flags);
135 EXPORT_SYMBOL (frodo_cpld_read);
136 EXPORT_SYMBOL (frodo_cpld_write);
137 EXPORT_SYMBOL (frodo_cpld_set);
138 EXPORT_SYMBOL (frodo_cpld_clear);
140 MACHINE_START (FRODO,"2d3D, Inc. SA-1110 Development Board")
141 BOOT_MEM (0xc0000000,0x80000000,0xf8000000)
142 BOOT_PARAMS (0xc0000100)
144 INITIRQ (sa1100_init_irq)