2 * linux/arch/arm/mach-sa1100/flexanet.c
4 * Author: Jordi Colomer <jco@ict.es>
6 * This file contains all FlexaNet-specific tweaks.
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/init.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/tty.h>
16 #include <linux/module.h>
17 #include <linux/errno.h>
18 #include <linux/delay.h>
20 #include <asm/hardware.h>
21 #include <asm/setup.h>
23 #include <asm/pgtable.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/serial_sa1100.h>
28 #include <linux/serial_core.h>
29 #include <asm/arch/flexanet.h>
34 unsigned long flexanet_BCR = FHH_BCR_POWERUP;
36 EXPORT_SYMBOL(flexanet_BCR);
38 /* physical addresses */
39 #define _RCNR 0x90010004
40 #define _GPLR 0x90040000
41 #define _Ser4SSCR0 0x80070060
44 * Get the modem-control register of the UARTs
47 static int flexanet_get_mctrl(struct uart_port *port)
52 /* only DSR and CTS are implemented in UART1 & 3 */
53 if (port->membase == (void *)&Ser1UTCR0)
57 if ((bsr & FHH_BSR_DSR1) != 0)
59 if ((bsr & FHH_BSR_CTS1) != 0)
62 else if (port->membase == (void *)&Ser3UTCR0)
66 if ((bsr & FHH_BSR_DSR3) != 0)
68 if ((bsr & FHH_BSR_CTS3) != 0)
76 * Set the modem-control register of the UARTs
79 static void flexanet_set_mctrl(struct uart_port *port, u_int mctrl)
83 /* only the RTS signal is implemented in UART1 & 3 */
84 if (port->membase == (void *)&Ser1UTCR0)
86 local_irq_save(flags);
88 if (mctrl & TIOCM_RTS)
89 flexanet_BCR |= FHH_BCR_RTS1;
91 flexanet_BCR &= ~FHH_BCR_RTS1;
93 FHH_BCR = flexanet_BCR;
94 local_irq_restore(flags);
96 else if (port->membase == (void *)&Ser3UTCR0)
98 local_irq_save(flags);
100 if (mctrl & TIOCM_RTS)
101 flexanet_BCR |= FHH_BCR_RTS3;
103 flexanet_BCR &= ~FHH_BCR_RTS3;
105 FHH_BCR = flexanet_BCR;
106 local_irq_restore(flags);
111 * machine-specific serial port functions
113 * get_mctrl : set state of modem control lines
114 * set_mctrl : set the modem control lines
115 * pm : power-management. Turn device on/off.
118 static struct sa1100_port_fns flexanet_port_fns __initdata =
120 set_mctrl : flexanet_set_mctrl,
121 get_mctrl : flexanet_get_mctrl,
127 * Initialization and serial port mapping
131 static int flexanet_serial_init(void)
133 /* register low-level functions */
134 sa1100_register_uart_fns(&flexanet_port_fns);
136 /* UART port number mapping */
137 sa1100_register_uart(0, 1); /* RS232 */
138 sa1100_register_uart(1, 3); /* Radio */
140 /* Select UART function in Serial port 1 */
141 Ser1SDCR0 |= SDCR0_UART;
147 static int __init flexanet_init(void)
150 set_GPIO_IRQ_edge(GPIO_GUI_IRQ, GPIO_RISING_EDGE);
152 /* deassert the GUI reset */
153 FLEXANET_BCR_set(FHH_BCR_GUI_NRST);
157 __initcall(flexanet_init);
161 fixup_flexanet(struct machine_desc *desc, struct param_struct *params,
162 char **cmdline, struct meminfo *mi)
164 /* fixed RAM size, by now (64MB) */
165 SET_BANK( 0, 0xc0000000, 64*1024*1024 );
169 ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
170 setup_ramdisk( 1, 0, 0, 8192 );
171 setup_initrd( 0xc0800000, 3*1024*1024 );
175 static struct map_desc flexanet_io_desc[] __initdata = {
176 /* virtual physical length domain r w c b */
177 { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Flash bank 0 */
178 { 0xf0000000, 0x10000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* Board Control Register */
179 { 0xf1000000, 0x18000000, 0x01000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Ethernet controller */
180 { 0xD0000000, 0x40000000, 0x04000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Instrument boards */
181 { 0xD8000000, 0x48000000, 0x01000000, DOMAIN_IO, 0, 1, 0, 0 }, /* External peripherals */
185 static void __init flexanet_map_io(void)
188 iotable_init(flexanet_io_desc);
189 flexanet_serial_init();
191 /* wakeup source is GPIO-0 only */
194 /* GPIOs set to zero during sleep */
198 * stop the 3.68 MHz oscillator and float control busses
199 * during sleep, since peripherals are powered off.
201 PCFR = PCFR_OPDE | PCFR_FP | PCFR_FS;
206 MACHINE_START(FLEXANET, "FlexaNet")
207 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
208 BOOT_PARAMS(0xc0000100)
209 FIXUP(fixup_flexanet)
210 MAPIO(flexanet_map_io)
211 INITIRQ(sa1100_init_irq)