2 * linux/arch/arm/mach-sa1100/badge4.c
4 * BadgePAD 4 specific initialization
6 * Tim Connors <connors@hpl.hp.com>
7 * Christopher Hoover <ch@hpl.hp.com>
9 * Copyright (C) 2002 Hewlett-Packard Company
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
17 #include <linux/module.h>
18 #include <linux/init.h>
19 #include <linux/kernel.h>
20 #include <linux/delay.h>
21 #include <linux/tty.h>
22 #include <linux/errno.h>
24 #include <asm/hardware.h>
25 #include <asm/setup.h>
26 #include <asm/arch/irqs.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/hardware/sa1111.h>
31 #include <asm/mach/serial_sa1100.h>
36 static int __init badge4_sa1111_init(void)
41 * Ensure that the memory bus request/grant signals are setup,
42 * and the grant is held in its inactive state
49 ret = sa1111_probe(BADGE4_SA1111_BASE);
54 * We found it. Wake the chip up.
59 * The SDRAM configuration of the SA1110 and the SA1111 must
60 * match. This is very important to ensure that SA1111 accesses
61 * don't corrupt the SDRAM. Note that this ungates the SA1111's
62 * MBGNT signal, so we must have called sa1110_mb_disable()
65 sa1111_configure_smc(1,
66 FExtr(MDCNFG, MDCNFG_SA1110_DRAC0),
67 FExtr(MDCNFG, MDCNFG_SA1110_TDL0));
70 * We only need to turn on DCLK whenever we want to use the
71 * DMA. It can otherwise be held firmly in the off position.
73 SKPCR |= SKPCR_DCLKEN;
76 * Enable the SA1110 memory bus request and grant signals.
80 set_GPIO_IRQ_edge(BADGE4_GPIO_INT_1111, GPIO_RISING_EDGE);
81 sa1111_init_irq(BADGE4_IRQ_GPIO_SA1111);
86 static int __init badge4_init(void)
90 if (!machine_is_badge4())
93 ret = badge4_sa1111_init();
95 printk(KERN_ERR __FUNCTION__
96 ": SA-1111 initialization failed (%d)\n", ret);
98 /* N.B, according to rmk this is the singular place that GPDR
101 /* Video expansion */
102 GPCR = (BADGE4_GPIO_INT_VID | BADGE4_GPIO_LGP2 | BADGE4_GPIO_LGP3 |
103 BADGE4_GPIO_LGP4 | BADGE4_GPIO_LGP5 | BADGE4_GPIO_LGP6 |
104 BADGE4_GPIO_LGP7 | BADGE4_GPIO_LGP8 | BADGE4_GPIO_LGP9 |
105 BADGE4_GPIO_GPA_VID | BADGE4_GPIO_GPB_VID |
106 BADGE4_GPIO_GPC_VID);
107 GPDR |= (BADGE4_GPIO_INT_VID | BADGE4_GPIO_LGP2 | BADGE4_GPIO_LGP3 |
108 BADGE4_GPIO_LGP4 | BADGE4_GPIO_LGP5 | BADGE4_GPIO_LGP6 |
109 BADGE4_GPIO_LGP7 | BADGE4_GPIO_LGP8 | BADGE4_GPIO_LGP9 |
110 BADGE4_GPIO_GPA_VID | BADGE4_GPIO_GPB_VID |
111 BADGE4_GPIO_GPC_VID);
114 GPCR = (BADGE4_GPIO_SDSDA | BADGE4_GPIO_SDSCL);
115 GPDR |= (BADGE4_GPIO_SDSDA | BADGE4_GPIO_SDSCL);
118 GPCR = (BADGE4_GPIO_UART_HS1 | BADGE4_GPIO_UART_HS2);
119 GPDR |= (BADGE4_GPIO_UART_HS1 | BADGE4_GPIO_UART_HS2);
121 /* drives CPLD muxsel0 input */
122 GPCR = BADGE4_GPIO_MUXSEL0;
123 GPDR |= BADGE4_GPIO_MUXSEL0;
126 GPCR = (BADGE4_GPIO_TESTPT_J7 | BADGE4_GPIO_TESTPT_J6 |
127 BADGE4_GPIO_TESTPT_J5);
128 GPDR |= (BADGE4_GPIO_TESTPT_J7 | BADGE4_GPIO_TESTPT_J6 |
129 BADGE4_GPIO_TESTPT_J5);
131 /* drives CPLD sdram type inputs; this shouldn't be needed;
132 bootloader left it this way. */
133 GPDR |= (BADGE4_GPIO_SDTYP0 | BADGE4_GPIO_SDTYP1);
135 /* 5V supply rail. */
136 GPCR = BADGE4_GPIO_PCMEN5V; /* initially off */
137 GPDR |= BADGE4_GPIO_PCMEN5V;
139 /* drives SA1111 reset pin; this shouldn't be needed;
140 bootloader left it this way. */
141 GPSR = BADGE4_GPIO_SA1111_NRST;
142 GPDR |= BADGE4_GPIO_SA1111_NRST;
147 __initcall(badge4_init);
150 static unsigned badge4_5V_bitmap = 0;
152 void badge4_set_5V(unsigned subsystem, int on)
155 unsigned old_5V_bitmap;
157 local_irq_save(flags);
159 old_5V_bitmap = badge4_5V_bitmap;
162 badge4_5V_bitmap |= subsystem;
164 badge4_5V_bitmap &= ~subsystem;
167 /* detect on->off and off->on transitions */
168 if ((!old_5V_bitmap) && (badge4_5V_bitmap)) {
169 /* was off, now on */
170 printk(KERN_INFO __FUNCTION__ ": enabling 5V supply rail\n");
171 GPSR = BADGE4_GPIO_PCMEN5V;
172 } else if ((old_5V_bitmap) && (!badge4_5V_bitmap)) {
173 /* was on, now off */
174 printk(KERN_INFO __FUNCTION__ ": disabling 5V supply rail\n");
175 GPCR = BADGE4_GPIO_PCMEN5V;
178 local_irq_restore(flags);
180 EXPORT_SYMBOL(badge4_set_5V);
184 fixup_badge4(struct machine_desc *desc, struct param_struct *params,
185 char **cmdline, struct meminfo *mi)
187 /* nothing needed here */
190 static struct map_desc badge4_io_desc[] __initdata = {
191 /* virtual physical length domain r w c b */
192 {0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 0,1,0,0},/* Flash bank 0 */
193 {0xf1000000, 0x08000000, 0x00100000, DOMAIN_IO, 0,1,0,0},/* SRAM bank 1 */
194 {0xf2000000, 0x10000000, 0x00100000, DOMAIN_IO, 0,1,0,0},/* SRAM bank 2 */
195 {0xf4000000, 0x48000000, 0x00100000, DOMAIN_IO, 0,1,0,0},/* SA-1111 */
199 static void __init badge4_map_io(void)
202 iotable_init(badge4_io_desc);
204 sa1100_register_uart(0, 3);
205 sa1100_register_uart(1, 1);
208 MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
209 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
210 BOOT_PARAMS(0xc0000100)
213 INITIRQ(sa1100_init_irq)