Merge with Linux 2.4.0-test5-pre3.
[linux-2.6/linux-mips.git] / arch / arm / kernel / hw-sa1100.c
blob27786cdd23d3f54c60bba3d59a10333838b2fd23
1 /*
2 * arch/arm/kernel/hw-sa1100.c
4 * SA1100-dependent machine specifics
6 * Copyright (C) 2000 Nicolas Pitre <nico@cam.org>
8 * This will certainly contain more stuff with time... like power management,
9 * special hardware autodetection, etc.
12 #include <linux/config.h>
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/sched.h>
18 #include <asm/delay.h>
19 #include <asm/hardware.h>
23 * SA1100 GPIO edge detection for IRQs:
24 * IRQs are generated on Falling-Edge, Rising-Edge, or both.
25 * This must be called *before* the appropriate IRQ is registered.
26 * Use this instead of directly setting GRER/GFER.
29 int GPIO_IRQ_rising_edge;
30 int GPIO_IRQ_falling_edge;
32 void set_GPIO_IRQ_edge( int gpio_mask, int edge )
34 if( edge & GPIO_FALLING_EDGE )
35 GPIO_IRQ_falling_edge |= gpio_mask;
36 else
37 GPIO_IRQ_falling_edge &= ~gpio_mask;
38 if( edge & GPIO_RISING_EDGE )
39 GPIO_IRQ_rising_edge |= gpio_mask;
40 else
41 GPIO_IRQ_rising_edge &= ~gpio_mask;
44 EXPORT_SYMBOL(set_GPIO_IRQ_edge);
47 #ifdef CONFIG_SA1100_ASSABET
49 unsigned long BCR_value = BCR_DB1110;
50 unsigned long SCR_value = SCR_INIT;
51 EXPORT_SYMBOL(BCR_value);
52 EXPORT_SYMBOL(SCR_value);
55 * Read System Configuration "Register"
56 * (taken from "Intel StrongARM SA-1110 Microprocessor Development Board
57 * User's Guide", section 4.4.1)
59 * This same scan is performed in arch/arm/boot/compressed/head-sa1100.S
60 * to set up the serial port for decompression status messages. We
61 * repeat it here because the kernel may not be loaded as a zImage, and
62 * also because it's a hassle to communicate the SCR value to the kernel
63 * from the decompressor.
66 void __init get_assabet_scr(void)
68 unsigned long flags, scr, i;
70 save_flags_cli(flags);
71 GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */
72 GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */
73 GPDR &= ~(0x3fc); /* Configure GPIO 9:2 as inputs */
74 for(i = 100; i--; scr = GPLR); /* Read GPIO 9:2 */
75 GPDR |= 0x3fc; /* restore correct pin direction */
76 restore_flags(flags);
77 scr &= 0x3fc; /* save as system configuration byte. */
79 SCR_value = scr;
82 #endif /* CONFIG_SA1100_ASSABET */
85 * Bitsy has extended, write-only memory-mapped GPIO's
87 #if defined(CONFIG_SA1100_BITSY)
88 static int bitsy_egpio = EGPIO_BITSY_RS232_ON;
89 void clr_bitsy_egpio(unsigned long x)
91 bitsy_egpio &= ~x;
92 *(volatile int *)0xdc000000 = bitsy_egpio;
94 void set_bitsy_egpio(unsigned long x)
96 bitsy_egpio |= x;
97 *(volatile int *)0xdc000000 = bitsy_egpio;
99 EXPORT_SYMBOL(clr_bitsy_egpio);
100 EXPORT_SYMBOL(set_bitsy_egpio);
101 #endif
103 #ifdef CONFIG_SA1111
105 void __init sa1111_init(void){
106 unsigned long id=SKID;
108 if((id & SKID_ID_MASK) == SKID_SA1111_ID)
109 printk(KERN_INFO "SA-1111 Microprocessor Companion Chip: "
110 "silicon revision %x, metal revision %x\n",
111 (id & SKID_SIREV_MASK)>>4, (id & SKID_MTREV_MASK));
112 else {
113 printk(KERN_ERR "Could not detect SA-1111!\n");
114 return;
117 /* First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
118 * (SA-1110 Developer's Manual, section 9.1.2.1)
120 GAFR |= GPIO_GPIO27;
121 GPDR |= GPIO_GPIO27;
122 TUCR = TUCR_3_6864MHz;
124 /* Now, set up the PLL and RCLK in the SA-1111: */
125 SKCR = SKCR_PLL_BYPASS | SKCR_RDYEN | SKCR_OE_EN;
126 udelay(100);
127 SKCR = SKCR_PLL_BYPASS | SKCR_RCLKEN | SKCR_RDYEN | SKCR_OE_EN;
129 /* SA-1111 Register Access Bus should now be available. Clocks for
130 * any other SA-1111 functional blocks must be enabled separately
131 * using the SKPCR.
135 #endif
138 static void __init hw_sa1100_init(void)
140 if( machine_is_assabet() ){
141 if(machine_has_neponset()){
142 #ifdef CONFIG_ASSABET_NEPONSET
143 LEDS = WHOAMI;
144 sa1111_init();
145 #else
146 printk( "Warning: Neponset detected but full support "
147 "hasn't been configured in the kernel\n" );
148 #endif
153 module_init(hw_sa1100_init);